/* ============================================================
   The Garden of Minds — styles
   ============================================================ */
:root {
  --ink: #2f2a24;
  --ink-soft: #6a5f52;
  --cream: #fbf6ea;
  --paper: #fffdf7;
  --rose: #e7558c;
  --rose-deep: #b8336a;
  --leaf: #4ea155;
  --sky-1: #aee3f5;
  --sky-2: #fdf3d4;
  --gold: #ffc83d;
  --shadow: 0 18px 40px -18px rgba(70, 50, 30, .45);
  --radius: 22px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; height: 100%;
  font-family: "Nunito", system-ui, sans-serif;
  color: var(--ink);
  background: #efe6d2;
  overflow: hidden;
}

body {
  background:
    radial-gradient(1200px 700px at 50% -10%, #fef8e6 0%, #efe6d2 60%);
}

#vignette {
  position: fixed; inset: 0; pointer-events: none; z-index: 5;
  box-shadow: inset 0 0 220px rgba(80, 55, 25, .22);
}

#stage { position: relative; width: 100vw; height: 100vh; }

/* ---------- scenes ---------- */
.scene {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  opacity: 0; visibility: hidden;
  transform: scale(1.02);
  transition: opacity .6s ease, transform .6s ease, visibility .6s;
  padding: 24px;
}
.scene.is-active { opacity: 1; visibility: visible; transform: scale(1); }

/* ---------- buttons ---------- */
.btn {
  font-family: "Nunito", sans-serif; font-weight: 800;
  font-size: 1rem; border: none; cursor: pointer;
  padding: 14px 28px; border-radius: 100px;
  transition: transform .15s ease, box-shadow .2s ease, background .2s;
}
.btn:active { transform: translateY(1px) scale(.99); }
.btn--primary {
  background: linear-gradient(180deg, var(--rose) 0%, var(--rose-deep) 100%);
  color: #fff; box-shadow: 0 10px 22px -8px rgba(184, 51, 106, .7);
}
.btn--primary:hover { transform: translateY(-2px); box-shadow: 0 16px 28px -10px rgba(184, 51, 106, .8); }
.btn--ghost {
  background: var(--paper); color: var(--rose-deep);
  box-shadow: var(--shadow); border: 2px solid #f0d9e3;
}
.btn--ghost:hover { transform: translateY(-2px); }

.flower-svg { width: 100%; height: 100%; overflow: visible; display: block; }

/* ============================================================
   INTRO
   ============================================================ */
.scene--intro { overflow: hidden; }
.intro-sky {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, var(--sky-1) 0%, #d6f0e2 55%, #cfe8a8 100%);
}
.sun-soft {
  position: absolute; top: 8%; right: 12%;
  width: 130px; height: 130px; border-radius: 50%;
  background: radial-gradient(circle, #fff6c8 0%, #ffd75e 55%, rgba(255,215,94,0) 72%);
  filter: blur(2px); animation: pulse 6s ease-in-out infinite;
}
@keyframes pulse { 50% { transform: scale(1.12); opacity: .92; } }

.intro-flowers { position: absolute; inset: 0; }
.intro-flower {
  position: absolute; bottom: -6%;
  width: 150px; height: 220px; transform-origin: bottom center;
  animation: sway 5s ease-in-out infinite;
}
@keyframes sway {
  0%, 100% { transform: rotate(-2.5deg); }
  50% { transform: rotate(2.5deg); }
}

.intro-card {
  position: relative; z-index: 2; text-align: center;
  background: rgba(255, 253, 247, .82);
  backdrop-filter: blur(6px);
  padding: 40px 48px; border-radius: var(--radius);
  box-shadow: var(--shadow); max-width: 560px;
  border: 1px solid rgba(255,255,255,.6);
}
.kicker {
  text-transform: uppercase; letter-spacing: .18em;
  font-size: .72rem; font-weight: 800; color: var(--rose-deep);
  margin: 0 0 10px;
}
.title {
  font-family: "Fraunces", serif; font-weight: 600;
  font-size: clamp(2.4rem, 6vw, 3.6rem); line-height: 1.02;
  margin: 0 0 14px; color: var(--ink);
}
.subtitle {
  font-size: 1.08rem; color: var(--ink-soft); line-height: 1.5;
  margin: 0 0 26px;
}
.credit { margin: 18px 0 0; font-size: .8rem; color: var(--ink-soft); opacity: .8; }

/* ============================================================
   OFFICE
   ============================================================ */
.scene--office { justify-content: flex-end; gap: 0; }
.office {
  position: absolute; inset: 0;
  display: flex; align-items: flex-end; justify-content: center;
}
.office-wall {
  position: absolute; inset: 0 0 28% 0;
  background:
    linear-gradient(180deg, #efe2c9 0%, #e7d6b6 100%);
}
.office-wall::after {
  content: ""; position: absolute; inset: 0;
  background-image: linear-gradient(90deg, rgba(180,150,100,.12) 1px, transparent 1px);
  background-size: 46px 100%;
}
.office-desk {
  position: absolute; left: 0; right: 0; bottom: 0; height: 28%;
  background: linear-gradient(180deg, #c89b6a 0%, #a9794c 100%);
  box-shadow: inset 0 6px 0 rgba(255,255,255,.18), 0 -10px 30px -10px rgba(0,0,0,.25);
}
.office-desk::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 14px;
  background: linear-gradient(180deg, #e0b988, #c89b6a);
}

.wall-chart {
  position: absolute; top: 14%; right: 10%;
  width: 120px; height: 150px; background: var(--paper);
  border: 6px solid #fff; box-shadow: var(--shadow);
  transform: rotate(2deg);
  display: flex; align-items: flex-end; justify-content: center;
  background-image: radial-gradient(circle at 50% 38%, #ffe1ec 0 30%, transparent 31%);
}
.wall-chart::before {
  /* a lone "standard" rose silhouette */
  content: "❀"; position: absolute; top: 26%; left: 50%; transform: translateX(-50%);
  font-size: 2.6rem; color: var(--rose);
}
.wall-chart__label {
  font-size: .6rem; color: var(--ink-soft); padding: 6px; text-align: center;
}

.rose-doctor {
  position: absolute; right: 16%; bottom: 26%;
  width: 200px; height: 250px; z-index: 3;
  transform-origin: bottom center;
  animation: sway 6s ease-in-out infinite;
}
.desk-clipboard {
  /* Anchored a fixed px above the bottom so it always clears the dialogue box
     (whose height in px is ~constant regardless of viewport aspect ratio). */
  position: absolute; right: 3%; bottom: 248px; z-index: 4;
  width: 104px; height: 132px; background: #6b4f2f;
  border-radius: 8px; padding: 10px; transform: rotate(-3deg);
  box-shadow: var(--shadow);
}
.clip {
  position: absolute; top: -8px; left: 50%; transform: translateX(-50%);
  width: 44px; height: 14px; background: #9aa0a6; border-radius: 4px;
}
.clipboard-paper {
  width: 100%; height: 100%; background: var(--paper); border-radius: 3px;
  padding: 10px 8px; display: flex; flex-direction: column; gap: 4px;
  align-items: center; justify-content: center; text-align: center;
}
.clip-scribble { font-size: .68rem; color: var(--ink-soft); font-style: italic; }
.clip-diag { font-size: .55rem; letter-spacing: .2em; color: var(--ink-soft); }
.clip-code { font-family: "Fraunces", serif; font-weight: 700; font-size: 1.1rem; color: var(--rose-deep); }
.clip-stamp {
  margin-top: 6px; font-size: .5rem; font-weight: 800; color: #c0392b;
  border: 2px solid #c0392b; border-radius: 4px; padding: 2px 4px;
  transform: rotate(-8deg); letter-spacing: .05em;
}

.patient-slot {
  position: absolute; left: 20%; bottom: 26%;
  width: 190px; height: 240px; z-index: 3;
  transition: transform .5s ease, opacity .5s ease;
}
.patient-flower { width: 100%; height: 100%; transform-origin: bottom center; animation: sway 5.5s ease-in-out infinite; }
.patient-slot.is-entering { transform: translateX(-40px); opacity: 0; }
.patient-slot.is-leaving { transform: translateX(-120px) scale(.85); opacity: 0; }
.patient-flower.is-wilting { animation: wiltDrop .9s ease forwards; }
@keyframes wiltDrop {
  0% { transform: rotate(0); }
  100% { transform: rotate(-3deg) translateY(6px); }
}

/* dialogue box */
.dialogue {
  position: relative; z-index: 6; width: min(680px, 92vw);
  background: var(--paper); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px 26px 18px;
  margin-bottom: 18px; border: 1px solid #f0e6cf;
}
.speaker {
  font-family: "Fraunces", serif; font-weight: 700; font-size: 1.05rem;
  color: var(--rose-deep); margin-bottom: 6px;
}
.speaker--patient { color: var(--leaf); }
.dialogue-text { margin: 0 0 14px; font-size: 1.1rem; line-height: 1.55; min-height: 3.2em; color: var(--ink); }
.dialogue-text.is-typed { animation: fadeUp .45s ease; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.dialogue-controls { display: flex; justify-content: flex-end; }

.wilt-meter {
  position: absolute; top: 18px; left: 50%; transform: translateX(-50%);
  z-index: 6; text-align: center;
}
.wilt-meter__label { font-size: .72rem; color: var(--ink-soft); font-weight: 700; }
.wilt-meter__track {
  width: 220px; height: 8px; background: #d9c9a6; border-radius: 100px; margin-top: 5px; overflow: hidden;
}
.wilt-meter__fill {
  height: 100%; width: 0; border-radius: 100px;
  background: linear-gradient(90deg, #8db255, #c9a14a, #b06a4a);
  transition: width .8s ease;
}

/* ============================================================
   REFRAME
   ============================================================ */
.scene--reframe { background: radial-gradient(1000px 700px at 50% 30%, #322c3e 0%, #1d1a26 75%); }
.reframe-inner { text-align: center; max-width: 720px; }
.reframe-lines { display: flex; flex-direction: column; gap: 18px; margin-bottom: 26px; }
.reframe-line {
  font-family: "Fraunces", serif; font-size: clamp(1.2rem, 2.6vw, 1.7rem);
  line-height: 1.4; color: #f3ecde; margin: 0;
  opacity: 0; transform: translateY(14px); filter: blur(3px);
}
.reframe-line.is-shown { animation: lineIn 1s ease forwards; }
.reframe-line b { color: var(--gold); }
.reframe-line:last-child { color: #ffd9e7; font-weight: 600; }
@keyframes lineIn { from { opacity: 0; transform: translateY(14px); filter: blur(3px); } to { opacity: 1; transform: none; filter: blur(0); } }

/* "click / press →" cue */
.reframe-cue {
  margin: 0 0 30px; color: #b6aecb; font-size: .95rem; font-weight: 600;
  letter-spacing: .01em; animation: cueBob 1.9s ease-in-out infinite;
}
.reframe-cue.is-hidden { display: none; }
.reframe-cue .cue-arrow { color: var(--gold); margin-right: 4px; }
.reframe-cue kbd {
  display: inline-block; min-width: 1.1em; text-align: center;
  padding: 1px 8px 2px; margin: 0 2px; border-radius: 6px;
  background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.28);
  border-bottom-width: 2px; font-family: "Nunito", sans-serif; font-weight: 800; color: #f3ecde;
}
@keyframes cueBob { 0%, 100% { transform: translateY(0); opacity: 1; } 50% { transform: translateY(-3px); opacity: .65; } }

#toGardenBtn { opacity: 0; pointer-events: none; transition: opacity .8s ease; }
#toGardenBtn.is-ready { opacity: 1; pointer-events: auto; }

/* ============================================================
   GARDEN
   ============================================================ */
.scene--garden { justify-content: flex-start; padding-top: 4vh; }
.garden-sky {
  position: absolute; inset: 0; z-index: 0;
  background: linear-gradient(180deg, var(--sky-1) 0%, var(--sky-2) 58%, #cfe8a8 100%);
}
.garden-sun {
  position: absolute; top: 7%; left: 9%; width: 110px; height: 110px; border-radius: 50%;
  background: radial-gradient(circle, #fff6c8 0%, #ffd75e 58%, rgba(255,215,94,0) 74%);
  animation: pulse 6s ease-in-out infinite;
}
.cloud {
  position: absolute; height: 36px; border-radius: 100px; background: rgba(255,255,255,.8);
  filter: blur(1px);
}
.cloud::before, .cloud::after { content: ""; position: absolute; background: inherit; border-radius: 50%; }
.cloud--1 { width: 120px; top: 12%; right: 16%; animation: drift 26s linear infinite; }
.cloud--1::before { width: 56px; height: 56px; top: -22px; left: 18px; }
.cloud--1::after { width: 42px; height: 42px; top: -14px; right: 16px; }
.cloud--2 { width: 90px; top: 24%; left: 24%; animation: drift 34s linear infinite reverse; opacity: .7; }
.cloud--2::before { width: 40px; height: 40px; top: -16px; left: 14px; }
@keyframes drift { from { transform: translateX(-30px); } to { transform: translateX(30px); } }

.garden-head { position: relative; z-index: 2; text-align: center; margin-bottom: 18px; }
.garden-title {
  font-family: "Fraunces", serif; font-weight: 600; font-size: clamp(1.6rem, 4vw, 2.4rem);
  margin: 0 0 6px; color: var(--ink);
}
.garden-instructions {
  margin: 0 auto; max-width: 540px; color: var(--ink-soft); font-size: 1rem; min-height: 1.4em;
}
.garden-instructions.is-nudge { animation: shakeX .45s ease; color: var(--rose-deep); }
@keyframes shakeX { 0%,100%{transform:translateX(0);} 25%{transform:translateX(-6px);} 75%{transform:translateX(6px);} }

.plots {
  position: relative; z-index: 2;
  display: flex; gap: 22px; flex-wrap: wrap; justify-content: center;
  margin-bottom: 26px;
}
.plot {
  width: 200px; background: rgba(255,253,247,.7); border-radius: 18px;
  padding: 10px 10px 14px; box-shadow: var(--shadow); cursor: pointer;
  border: 3px solid transparent; transition: transform .18s ease, border-color .2s, box-shadow .2s;
  position: relative; backdrop-filter: blur(3px);
}
.plot:hover, .plot.is-hover { transform: translateY(-4px); border-color: var(--gold); }
.plot.is-shake { animation: shakeX .5s ease; border-color: #c0392b; }
.plot-art { border-radius: 12px; overflow: hidden; line-height: 0; }
.env-svg { width: 100%; height: auto; display: block; }
.plot-label { text-align: center; font-weight: 700; font-size: .82rem; color: var(--ink-soft); margin-top: 8px; }
.plot-bloom {
  position: absolute; left: 50%; bottom: 46px; transform: translateX(-50%);
  width: 150px; height: 190px; pointer-events: none;
}
.plot-bloom .flower-svg { animation: sprout .8s cubic-bezier(.2,1.3,.4,1) both; transform-origin: bottom center; }
@keyframes sprout { 0% { transform: translateY(30px) scale(.2); opacity: 0; } 100% { transform: none; opacity: 1; } }
.plot.is-filled { border-color: var(--leaf); cursor: default; }
.plot.is-filled .plot-label { color: var(--leaf); }

.tray {
  position: relative; z-index: 2;
  display: flex; gap: 18px; justify-content: center; flex-wrap: wrap;
}
.tray-flower {
  width: 120px; background: var(--paper); border-radius: 16px;
  padding: 8px 8px 10px; box-shadow: var(--shadow); cursor: grab;
  border: 3px solid transparent; transition: transform .18s ease, border-color .2s, opacity .4s;
  text-align: center;
}
.tray-flower:hover { transform: translateY(-4px); }
.tray-flower.is-selected { border-color: var(--rose); transform: translateY(-6px) scale(1.04); }
.tray-flower__art { width: 100%; height: 120px; }
.tray-flower__art .flower-svg { animation: sway 5s ease-in-out infinite; transform-origin: bottom center; }
.tray-flower__name { font-weight: 800; font-size: .85rem; color: var(--ink); }
.tray-flower.is-placed { opacity: .25; pointer-events: none; filter: grayscale(.4); }

.strength-pop {
  position: absolute; left: 50%; bottom: 4%; transform: translate(-50%, 20px);
  z-index: 8; width: min(560px, 92vw);
  background: var(--paper); border-radius: var(--radius); padding: 18px 24px;
  box-shadow: var(--shadow); border: 2px solid #e7dcbe;
  opacity: 0; pointer-events: none; transition: opacity .4s ease, transform .4s ease;
}
.strength-pop.is-visible { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.strength-pop h3 { font-family: "Fraunces", serif; margin: 0 0 6px; padding-right: 34px; color: var(--leaf); font-size: 1.25rem; }
.strength-pop p { margin: 0; line-height: 1.5; color: var(--ink); font-size: .98rem; }
.strength-pop b { color: var(--rose-deep); }
.strength-close {
  position: absolute; top: 12px; right: 14px;
  width: 30px; height: 30px; border-radius: 50%; border: none;
  background: #f0e6cf; color: var(--ink-soft);
  font-size: 1.35rem; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .2s, color .2s, transform .15s;
}
.strength-close:hover { background: #e7dcbe; color: var(--ink); transform: scale(1.08); }
.strength-cta { margin-top: 14px; font-size: .92rem; padding: 11px 22px; }

/* ============================================================
   ENDING
   ============================================================ */
.scene--ending { justify-content: center; overflow: hidden; }
.ending-sky {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, #fde6b8 0%, #ffd3e2 38%, #cdeaa6 100%);
}
.ending-garden { position: absolute; inset: 0; z-index: 1; }
.ending-flower {
  position: absolute; bottom: -4%; width: 150px; height: 220px;
  transform-origin: bottom center; animation: sway 5s ease-in-out infinite, rise 1.1s ease both;
}
@keyframes rise { from { transform: translateY(60px) scale(.4); opacity: 0; } }
.ending-card {
  position: relative; z-index: 3; text-align: center; max-width: 600px;
  background: rgba(255,253,247,.9); backdrop-filter: blur(6px);
  border-radius: var(--radius); padding: 30px 36px; box-shadow: var(--shadow);
  border: 1px solid rgba(255,255,255,.6);
}
.ending-title { font-family: "Fraunces", serif; font-weight: 600; font-size: clamp(1.8rem, 4vw, 2.6rem); margin: 0 0 12px; }
.ending-text { margin: 0 0 20px; line-height: 1.6; color: var(--ink); font-size: 1.05rem; }
.ending-text b { color: var(--rose-deep); }

/* ---------- sound toggle ---------- */
.sound-toggle {
  position: fixed; top: 16px; right: 16px; z-index: 30;
  width: 42px; height: 42px; border-radius: 50%; border: none; cursor: pointer;
  background: rgba(255,253,247,.85); box-shadow: var(--shadow);
  font-size: 1.1rem; color: var(--rose-deep); transition: transform .15s ease;
}
.sound-toggle:hover { transform: scale(1.08); }
.sound-toggle.is-off { color: var(--ink-soft); opacity: .7; }

/* ---------- responsive ---------- */
@media (max-width: 720px) {
  .rose-doctor { right: 6%; width: 150px; }
  .patient-slot { left: 6%; width: 150px; }
  .desk-clipboard { display: none; }
  .wall-chart { width: 90px; height: 120px; }
  .plot { width: 150px; }
  .plot-bloom { width: 110px; bottom: 40px; }
  .dialogue-text { font-size: 1rem; }
}
@media (max-height: 640px) {
  .wilt-meter { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001s !important; }
}
