/* «Дракончик ищет маму» — production styles.
   Base: arena/codex (one-scene melted composition, camera glide).
   Tokens: DESIGN.md §3–§7, verbatim. */

:root {
  /* paper & ink */
  --ground:      #FEFAEF;  /* app background == art ground (measured) */
  --wash:        #FBF1D9;  /* warm wash for pills, soft sections */
  --card:        #FFFCF5;  /* cards, barely lighter than ground */
  --line:        #EAD9C0;  /* 2px warm borders */
  --ink:         #46362B;  /* body text — warm dark brown, never #000 */
  --ink-muted:   #7C6A5B;
  --ink-faint:   #A8988A;

  /* the dragon — primary action colour */
  --red-600:     #C22C1B;  /* pressed */
  --red-500:     #DE3A26;  /* primary buttons, active road */
  --red-400:     #F26350;  /* focus ring, highlights */
  --red-100:     #FBDDD5;  /* tint fills */
  --on-red:      #FFF8F0;  /* text/icons on red */

  /* crystal families (from crystal.sea / .song / .effort) — full-strength UI citizens */
  --sea-500:     #3FB5AB;  --sea-300: #7BD6C6;  --sea-100:  #DFF6EE;
  --gold-500:    #EFA934;  --gold-300: #F7C96A; --gold-100: #FCEECF;
  --rose-500:    #F26D6D;  --rose-300: #F79C96; --rose-100: #FDE2DF;

  /* world */
  --leaf-500:    #97A24B;  --leaf-300: #BFC77E;  /* meadow */
  --sky-200:     #CFE8E4;  /* soft sea-sky wash for sea-road surfaces */
  --stone-400:   #B3A3A3;  /* locked milestones (from milestone.locked) */
  --stone-200:   #E2D6D2;

  --font:       "Nunito", ui-rounded, system-ui, sans-serif;
  --fs-display: 42px;  --lh-display: 1.15;  /* screen titles, weight 900 */
  --fs-title:   32px;  --lh-title:   1.2;   /* card titles, weight 800 */
  --fs-body:    20px;  --lh-body:    1.4;   /* default, weight 700 */
  --fs-note:    17px;  --lh-note:    1.4;   /* secondary, weight 600, --ink-muted */

  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px;
  --space-5: 24px; --space-6: 32px; --space-7: 48px;
  --tap-primary: 88px;  /* the big log button */
  --tap-min:     56px;  /* nothing tappable is smaller */
  --content-max: 680px; /* single centred column */
  --page-pad:    24px;

  --r-sm: 14px; --r-md: 22px; --r-lg: 32px; --r-round: 999px;
  --border: 2px solid var(--line);
  --shadow-rest:  0 2px 0 rgba(70,54,43,.06), 0 8px 24px rgba(70,54,43,.10);
  --shadow-press: 0 1px 0 rgba(70,54,43,.08), 0 3px 10px rgba(70,54,43,.12);

  --ease-pop:   cubic-bezier(.34, 1.56, .64, 1);  /* gentle overshoot */
  --ease-out:   cubic-bezier(.22, .8, .36, 1);
  --t-quick:    180ms;  /* presses, toggles */
  --t-pop:      280ms;  /* cards, chips entering */
  --t-scene:    600ms;  /* screen transitions, growth stage change */
  --t-crystal:  900ms;  /* crystal flying into the world */
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ================= base ================= */

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font);
}

body {
  min-width: 760px;
  min-height: 620px;
  font-size: var(--fs-body);
  font-weight: 700;
  line-height: var(--lh-body);
  -webkit-tap-highlight-color: transparent;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
  touch-action: manipulation;
}

button:focus-visible,
input:focus-visible {
  outline: 3px solid var(--red-400);
  outline-offset: 2px;
}

button:disabled {
  cursor: default;
  opacity: .62;
}

img,
video {
  user-select: none;
  -webkit-user-drag: none;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* rotate (not transform) so the wobble composes with translate-centred elements */
@keyframes wobble {
  0% { rotate: 0deg; }
  25% { rotate: -3deg; }
  55% { rotate: 2.4deg; }
  80% { rotate: -1.2deg; }
  100% { rotate: 0deg; }
}

.wobbling {
  animation: wobble 420ms var(--ease-out);
}

/* ================= stage & camera ================= */

.app,
.camera,
.living-stage,
.place {
  width: 100%;
  height: 100%;
}

.app {
  position: relative;
  isolation: isolate;
  background: var(--ground);
}

.camera {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.living-stage {
  display: flex;
  width: 300vw;
  transform: translate3d(-100vw, 0, 0);
  transition: transform var(--t-scene) var(--ease-out);
  will-change: transform;
}

.camera-sea .living-stage {
  transform: translate3d(0, 0, 0);
}

.camera-music .living-stage {
  transform: translate3d(-200vw, 0, 0);
}

.place {
  position: relative;
  flex: 0 0 100vw;
  overflow: hidden;
  background: var(--ground);
}

.place-paint {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* The home page is pure --ground (the token equals the art's measured
   paper — DESIGN §3 melt rule), with the painted hills kept as a soft
   masked band at the foot of the page. */
.home-wash {
  top: auto;
  bottom: 0;
  height: 30%;
  object-position: 50% 100%;
  -webkit-mask-image: linear-gradient(to top, #000 45%, transparent 100%);
  mask-image: linear-gradient(to top, #000 45%, transparent 100%);
}

.road-colour {
  position: absolute;
  inset: 0;
  pointer-events: none;
  mix-blend-mode: multiply;
}

.sea-colour {
  background: rgba(123, 214, 198, .1);
}

.music-colour {
  background: rgba(247, 201, 106, .12);
}

/* ================= home place ================= */

.home-heading {
  position: absolute;
  z-index: 3;
  top: 18px;
  left: 50%;
  width: min(620px, 46vw);
  transform: translateX(-50%);
  text-align: center;
  pointer-events: none;
}

.home-heading p,
.road-heading p {
  margin: 0 0 var(--space-1);
  color: var(--ink-muted);
  font-size: var(--fs-note);
  font-weight: 800;
}

.home-heading h2,
.road-heading h2 {
  margin: 0;
  font-size: clamp(30px, 3vw, var(--fs-display));
  font-weight: 900;
  line-height: var(--lh-display);
}

/* The home & garden: ONE painted image from the home.01..16 chain,
   swapped whole (PRD §6.2 v2). Never composited cut-outs. */
.home-scene {
  position: absolute;
  z-index: 2;
  top: 76px;
  left: 50%;
  width: min(610px, 47vw);
  height: min(610px, 68vh);
  min-width: var(--tap-min);
  min-height: var(--tap-min);
  padding: 0;
  border: 0;
  background: transparent;
  transform: translateX(-50%);
  cursor: pointer;
}

.home-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  /* the chain art's baked paper differs a breath from --ground; a soft
     radial fade melts its edges into the page (no visible rectangle) */
  -webkit-mask-image: radial-gradient(ellipse closest-side, #000 58%, rgba(0, 0, 0, .92) 72%, transparent 96%);
  mask-image: radial-gradient(ellipse closest-side, #000 58%, rgba(0, 0, 0, .92) 72%, transparent 96%);
  transition: transform var(--t-quick) var(--ease-out);
}

.home-scene:hover .home-art {
  transform: translateY(-2px) rotate(-.35deg);
}

.home-scene:active .home-art {
  transform: rotate(1.1deg) translateY(1px);
}

.home-art.home-next {
  opacity: 0;
  transition: opacity var(--t-scene) var(--ease-out);
}

.home-art.home-next.home-shown {
  opacity: 1;
}

.home-highlight {
  position: absolute;
  z-index: 3;
  width: 46%;
  aspect-ratio: 1;
  border-radius: var(--r-round);
  background: radial-gradient(circle, rgba(247, 201, 106, .5) 0%, rgba(252, 238, 207, .28) 46%, rgba(252, 238, 207, 0) 72%);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.home-highlight.glowing {
  animation: highlight-pop 1400ms var(--ease-out) both;
}

@keyframes highlight-pop {
  0% { opacity: 0; scale: .6; }
  30% { opacity: 1; scale: 1.06; }
  60% { opacity: .9; scale: 1; }
  100% { opacity: 0; scale: 1.05; }
}

/* the magic build moment (PRD §6.8): a golden band sweeps the painting
   while little stars twinkle — masked to the same melt as the art, so
   the light lives inside the picture, never as a rectangle over it */
.magic-sweep {
  position: absolute;
  z-index: 4;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  -webkit-mask-image: radial-gradient(ellipse closest-side, #000 58%, rgba(0, 0, 0, .92) 72%, transparent 96%);
  mask-image: radial-gradient(ellipse closest-side, #000 58%, rgba(0, 0, 0, .92) 72%, transparent 96%);
}

.magic-sweep::before {
  content: "";
  position: absolute;
  inset: -14%;
  background: linear-gradient(115deg, rgba(247, 201, 106, 0) 34%, rgba(252, 238, 207, .2) 46%, rgba(247, 201, 106, .42) 52%, rgba(252, 238, 207, .2) 58%, rgba(247, 201, 106, 0) 70%);
  animation: magic-band 1200ms var(--ease-out) both;
}

@keyframes magic-band {
  from { transform: translateX(-72%); opacity: 0; }
  18% { opacity: 1; }
  85% { opacity: 1; }
  to { transform: translateX(72%); opacity: 0; }
}

.magic-sweep i {
  position: absolute;
  left: var(--mx);
  top: var(--my);
  width: 15px;
  height: 15px;
  background: radial-gradient(circle, var(--gold-100) 18%, var(--gold-300) 55%, rgba(247, 201, 106, 0) 80%);
  clip-path: polygon(50% 0, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0 50%, 39% 39%);
  animation: magic-twinkle 980ms var(--ease-out) var(--md) both;
}

@keyframes magic-twinkle {
  0% { opacity: 0; transform: scale(.3) rotate(-24deg); }
  40% { opacity: 1; transform: scale(1.25) rotate(4deg); }
  100% { opacity: 0; transform: scale(.55) rotate(22deg); }
}

/* scene furniture: treasures shelf, story book, parent door */

.scene-object {
  position: absolute;
  z-index: 6;
  min-width: var(--tap-min);
  min-height: var(--tap-min);
  border: var(--border);
  border-radius: var(--r-md);
  background: var(--card);
  box-shadow: var(--shadow-rest);
  cursor: pointer;
  transition: transform var(--t-quick) var(--ease-out), box-shadow var(--t-quick) var(--ease-out);
}

.scene-object:hover {
  transform: translateY(-2px) rotate(-.5deg);
}

.scene-object:active {
  transform: translateY(1px) scale(.97);
  box-shadow: var(--shadow-press);
}

.scene-object > span:last-child {
  display: block;
  color: var(--ink);
  font-size: 15px;
  font-weight: 900;
  line-height: 1.15;
}

.treasure-object {
  right: 32px;
  bottom: 106px;
  width: 188px;
  height: 112px;
  padding: 14px 14px 10px;
  transform: rotate(1.5deg);
}

.treasure-object:hover {
  transform: translateY(-2px) rotate(.5deg);
}

.shelf-lines {
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  width: 100%;
  height: 58px;
  margin-bottom: 4px;
  border-bottom: 6px solid #B47B43;
  border-radius: 2px;
}

.shelf-lines i {
  width: 30px;
  height: 40px;
  background: var(--sea-300);
  border: 2px solid var(--ink-muted);
  border-radius: 52% 48% 42% 58%;
  transform: rotate(-7deg);
}

.shelf-lines i:nth-child(2) {
  height: 48px;
  background: var(--gold-300);
  border-radius: 45% 55% 50% 43%;
  transform: rotate(5deg);
}

.shelf-lines i:nth-child(3) {
  height: 36px;
  background: var(--rose-300);
  transform: rotate(10deg);
}

.story-object {
  right: 32px;
  top: 486px;
  width: 164px;
  height: 112px;
  padding: 10px 12px 8px;
  transform: rotate(-2deg);
}

.story-object:hover {
  transform: translateY(-2px) rotate(-1deg);
}

.story-object svg {
  display: block;
  width: 92px;
  height: 62px;
  margin: 0 auto 3px;
  fill: var(--wash);
  stroke: var(--ink-muted);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.parent-door {
  right: 24px;
  top: 20px;
  width: 68px;
  height: 76px;
  padding: 5px;
  border-color: rgba(234, 217, 192, .68);
  box-shadow: none;
  opacity: .72;
}

.parent-door:hover,
.parent-door:focus-visible {
  opacity: 1;
}

.parent-door svg {
  width: 42px;
  height: 42px;
  fill: none;
  stroke: var(--ink-faint);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.parent-door span {
  font-size: 10px !important;
}

/* road gates: spatial progress — stone thumbnails, never numerals */

.road-gate {
  position: absolute;
  z-index: 4;
  top: 152px;
  width: clamp(226px, 21vw, 296px);
  height: 312px;
  padding: 8px 8px 14px;
  overflow: hidden;
  border: var(--border);
  border-radius: var(--r-md);
  background: var(--card);
  box-shadow: var(--shadow-rest);
  cursor: pointer;
  transition: transform var(--t-quick) var(--ease-out), box-shadow var(--t-quick) var(--ease-out);
}

.road-gate:hover {
  transform: translateY(-2px) rotate(var(--gate-tilt));
}

.road-gate:active {
  transform: translateY(1px) rotate(var(--gate-tilt)) scale(.97);
  box-shadow: var(--shadow-press);
}

.road-gate-sea {
  --gate-tilt: -1.2deg;
  left: clamp(24px, 3vw, 52px);
  transform: rotate(var(--gate-tilt));
}

.road-gate-music {
  --gate-tilt: 1.2deg;
  right: clamp(24px, 3vw, 52px);
  transform: rotate(var(--gate-tilt));
}

.road-gate > img {
  width: 100%;
  height: 170px;
  object-fit: cover;
  border-radius: var(--r-sm);
}

.road-gate-copy {
  display: block;
  padding: 8px 7px 0;
  text-align: left;
}

.road-gate-copy strong {
  font-size: 27px;
  font-weight: 900;
  line-height: 1.1;
}

.mini-trail {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 44px;
  padding: 4px 8px 0;
}

.mini-stone-img {
  width: 30px;
  height: 30px;
  object-fit: contain;
  mix-blend-mode: multiply;
}

.mini-dash {
  display: block;
  width: 12px;
  height: 3px;
  border-radius: 2px;
  background: var(--stone-200);
}

/* care rituals: three quiet buttons near the dragon (PRD §6.8) */

.care-stack {
  position: absolute;
  z-index: 6;
  left: 32px;
  bottom: 150px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.care-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 152px;
  min-height: var(--tap-min);
  padding: 0 12px;
  border: var(--border);
  border-radius: var(--r-md);
  background: var(--card);
  box-shadow: var(--shadow-rest);
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
  text-align: left;
  cursor: pointer;
  transition: transform var(--t-quick) var(--ease-out), box-shadow var(--t-quick) var(--ease-out), background-color var(--t-quick) var(--ease-out);
}

.care-btn:hover {
  transform: translateY(-2px) rotate(-.4deg);
}

.care-btn:active {
  transform: translateY(1px) scale(.97);
  box-shadow: var(--shadow-press);
}

.care-btn svg {
  flex: 0 0 26px;
  width: 26px;
  height: 26px;
  fill: none;
  stroke: var(--ink-muted);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.care-btn.care-done {
  background: var(--wash);
  box-shadow: none;
  color: var(--ink-muted);
}

.care-btn.care-evening {
  background: var(--gold-100);
  box-shadow: 0 0 0 3px var(--gold-100), var(--shadow-rest);
}

/* while he sleeps the sleep pill is «Разбудить» — warm, never dimmed */
.care-btn.care-wake {
  background: var(--gold-100);
}

/* week rhythm: a picture of the week, never a score */

.week-rhythm {
  position: absolute;
  z-index: 5;
  bottom: 24px;
  left: clamp(24px, 3vw, 52px);
  width: clamp(270px, 27vw, 390px);
  min-height: 96px;
  padding: 13px 18px 12px 90px;
  border: var(--border);
  border-radius: var(--r-lg);
  background: var(--card);
  box-shadow: var(--shadow-rest);
}

.week-rhythm h3 {
  margin: 0 0 4px;
  font-size: var(--fs-note);
  font-weight: 900;
}

.week-rhythm p {
  margin: 0;
  color: var(--ink-muted);
  font-size: 15px;
  line-height: 1.15;
}

.week-dragon {
  position: absolute;
  left: 11px;
  bottom: 7px;
  width: 74px;
  height: 74px;
  object-fit: contain;
  mix-blend-mode: multiply;
}

.week-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  min-height: 40px;
}

.week-chip-button {
  display: grid;
  place-items: center;
  width: var(--tap-min);
  height: var(--tap-min);
  padding: 0;
  border: 0;
  border-radius: 48% 52% 45% 55%;
  background: transparent;
  cursor: pointer;
  transition: transform var(--t-quick) var(--ease-out), background-color var(--t-quick) var(--ease-out);
}

.week-chip-button:hover {
  background: var(--wash);
  transform: translateY(-2px) rotate(-3deg);
}

.week-chip-button:active {
  transform: translateY(1px) scale(.97);
}

.week-chip {
  width: 32px;
  height: 32px;
  object-fit: contain;
  mix-blend-mode: multiply;
  animation: chip-arrives var(--t-pop) var(--ease-pop) both;
}

@keyframes chip-arrives {
  from { opacity: 0; transform: translateY(8px) rotate(-8deg); }
  to { opacity: 1; transform: translateY(0) rotate(0); }
}

/* ================= road places ================= */

.road-heading {
  position: absolute;
  z-index: 4;
  top: 28px;
  left: 34px;
  width: min(520px, 42vw);
  padding: 17px 24px 15px;
  border: var(--border);
  border-radius: var(--r-lg);
  background: rgba(255, 252, 245, .93);
  box-shadow: var(--shadow-rest);
}

.place-sea .place-name {
  color: #286E68;
}

.place-music .place-name {
  color: #775318;
}

.road-heading h2 {
  font-size: clamp(28px, 3.2vw, var(--fs-display));
}

.road-chips {
  display: flex;
  gap: 4px;
  margin-top: 8px;
  min-height: 30px;
}

.road-chips img {
  width: 30px;
  height: 30px;
  object-fit: contain;
  mix-blend-mode: multiply;
}

.milestone-trail {
  position: absolute;
  inset: 0;
  z-index: 3;
}

.milestone {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: min(250px, 20vw);
  min-width: var(--tap-min);
  min-height: var(--tap-min);
  padding: 0;
  border: 0;
  background: transparent;
  transform: translate(-50%, -50%);
  cursor: pointer;
  transition: transform var(--t-quick) var(--ease-out);
}

.milestone:hover {
  transform: translate(-50%, calc(-50% - 3px)) rotate(-.5deg);
}

.milestone:active {
  transform: translate(-50%, calc(-50% + 1px)) scale(.97);
}

.milestone img {
  width: clamp(60px, 6vw, 86px);
  height: clamp(60px, 6vw, 86px);
  object-fit: contain;
  /* the button's transform isolates blending, so the paper margin is
     faded out instead: the stone melts into the painted road */
  -webkit-mask-image: radial-gradient(circle closest-side, #000 55%, transparent 92%);
  mask-image: radial-gradient(circle closest-side, #000 55%, transparent 92%);
}

.milestone-label {
  display: block;
  max-width: 240px;
  margin-top: -6px;
  padding: 7px 12px;
  border: 2px solid rgba(234, 217, 192, .82);
  border-radius: var(--r-round);
  background: rgba(255, 252, 245, .94);
  color: var(--ink);
  font-size: clamp(14px, 1.35vw, var(--fs-note));
  font-weight: 800;
  line-height: 1.15;
  text-align: center;
}

.milestone.locked .milestone-label {
  color: var(--ink-muted);
}

.milestone.goal-stone::before {
  content: "Цель";
  position: absolute;
  top: -9px;
  left: 50%;
  padding: 2px 9px;
  border-radius: var(--r-round);
  background: var(--gold-300);
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
  transform: translateX(-50%);
}

.revisit-choice {
  position: absolute;
  right: 28px;
  top: 230px;
  min-width: 210px;
  min-height: var(--tap-min);
  padding: 12px 18px;
  border: 2px solid #B4781B;
  border-radius: var(--r-md);
  background: var(--gold-100);
  box-shadow: var(--shadow-rest);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: transform var(--t-quick) var(--ease-out), box-shadow var(--t-quick) var(--ease-out);
}

.revisit-choice:hover {
  transform: translateY(-2px) rotate(.4deg);
}

.revisit-choice:active {
  transform: translateY(1px) scale(.97);
  box-shadow: var(--shadow-press);
}

.revisit-choice strong,
.revisit-choice span {
  display: block;
}

.revisit-choice strong {
  font-size: var(--fs-note);
  font-weight: 900;
}

.revisit-choice span {
  color: var(--ink-muted);
  font-size: 14px;
}

.goal-vignette {
  position: absolute;
  z-index: 4;
  top: 30px;
  right: 30px;
  width: 218px;
  min-height: 176px;
  padding: 8px 8px 12px;
  overflow: hidden;
  border: var(--border);
  border-radius: var(--r-md);
  background: var(--card);
  box-shadow: var(--shadow-rest);
  color: var(--ink);
  cursor: pointer;
  transition: transform var(--t-quick) var(--ease-out), box-shadow var(--t-quick) var(--ease-out);
}

.goal-vignette:hover {
  transform: translateY(-2px) rotate(.5deg);
}

.place-music .goal-vignette:hover {
  transform: translateY(-2px) rotate(-.5deg);
}

.goal-vignette:active {
  transform: translateY(1px) scale(.97);
  box-shadow: var(--shadow-press);
}

.goal-vignette img {
  width: 100%;
  height: 122px;
  object-fit: cover;
  border-radius: var(--r-sm);
  mix-blend-mode: multiply;
}

.music-goal-vignette img {
  object-fit: contain;
}

.goal-vignette span {
  display: block;
  margin-top: 2px;
  font-size: 15px;
  font-weight: 900;
  line-height: 1.15;
}

.painted-home-link {
  position: absolute;
  z-index: 5;
  right: 28px;
  bottom: 112px;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 148px;
  min-height: var(--tap-min);
  padding: 6px 8px 10px;
  border: var(--border);
  border-radius: var(--r-md);
  background: var(--card);
  box-shadow: var(--shadow-rest);
  cursor: pointer;
  transition: transform var(--t-quick) var(--ease-out), box-shadow var(--t-quick) var(--ease-out);
}

.place-music .painted-home-link {
  right: auto;
  left: 28px;
}

.painted-home-link:hover {
  transform: translateY(-2px) rotate(.6deg);
}

.painted-home-link:active {
  transform: translateY(1px) scale(.97);
  box-shadow: var(--shadow-press);
}

.painted-home-link img {
  width: 112px;
  height: 82px;
  object-fit: cover;
  object-position: 50% 54%;
  border-radius: var(--r-sm);
}

.painted-home-link span {
  font-size: var(--fs-note);
  font-weight: 900;
}

/* ================= the dragon companion ================= */

.dragon-companion {
  position: absolute;
  z-index: 15;
  left: calc(50% - 420px);
  bottom: 102px;
  width: clamp(150px, 14vw, 205px);
  height: clamp(150px, 14vw, 205px);
  min-width: var(--tap-min);
  min-height: var(--tap-min);
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 46% 54% 48% 52%;
  background: rgba(254, 250, 239, .7);
  cursor: pointer;
  mix-blend-mode: multiply;
  transition: left var(--t-scene) var(--ease-out), top var(--t-scene) var(--ease-out), bottom var(--t-scene) var(--ease-out), width var(--t-scene) var(--ease-out), height var(--t-scene) var(--ease-out), transform var(--t-quick) var(--ease-out);
}

.dragon-companion video,
.dragon-companion img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.dragon-companion img {
  display: none;
}

.dragon-companion:hover {
  transform: translateY(-2px) rotate(-1deg);
}

.dragon-companion.wobbling {
  animation: dragon-wobble 420ms var(--ease-pop);
}

.dragon-companion:active {
  transform: translateY(1px) scale(.97);
}

.camera-sea .dragon-companion,
.camera-music .dragon-companion {
  left: var(--dragon-x, 38%);
  top: var(--dragon-y, 66%);
  bottom: auto;
  width: 128px;
  height: 128px;
  border: 4px solid var(--card);
  box-shadow: var(--shadow-rest);
  transform: translate(-50%, -50%);
}

.camera-sea .dragon-companion:hover,
.camera-music .dragon-companion:hover {
  transform: translate(-50%, calc(-50% - 2px)) rotate(-1deg);
}

@keyframes dragon-wobble {
  0%, 100% { rotate: 0deg; }
  28% { rotate: -7deg; }
  58% { rotate: 6deg; }
  78% { rotate: -2deg; }
}

/* cared-for day: a quiet sparkle on his idle — no meters, no counters */
.dragon-spark {
  position: absolute;
  top: 8px;
  right: 14px;
  width: 22px;
  height: 22px;
  fill: var(--gold-500);
  animation: spark-twinkle 3.6s ease-in-out infinite;
  pointer-events: none;
}

@keyframes spark-twinkle {
  0%, 100% { opacity: .35; transform: scale(.85) rotate(-6deg); }
  50% { opacity: .9; transform: scale(1) rotate(6deg); }
}

/* wake: crossfade sleeping still → idle clip over ~800ms —
   face-transform clips are banned (DESIGN §10.5) */
.dragon-companion img.wake-ghost {
  display: block;
  z-index: 2;
  opacity: 1;
  transition: opacity 800ms var(--ease-out);
}

.dragon-companion img.wake-ghost.wake-faded {
  opacity: 0;
}

.dragon-bubble {
  position: absolute;
  z-index: 25;
  left: calc(50% - 300px);
  bottom: 312px;
  max-width: 360px;
  min-height: var(--tap-min);
  padding: 13px 18px;
  border: var(--border);
  border-radius: var(--r-md);
  background: var(--card);
  box-shadow: var(--shadow-rest);
  color: var(--ink);
  font-size: var(--fs-body);
  font-weight: 800;
  line-height: 1.28;
  text-align: left;
  cursor: pointer;
  animation: bubble-arrives var(--t-pop) var(--ease-pop);
}

.dragon-bubble::after {
  content: "";
  position: absolute;
  left: 72px;
  bottom: -12px;
  width: 22px;
  height: 22px;
  border-right: var(--border);
  border-bottom: var(--border);
  background: var(--card);
  transform: rotate(45deg);
}

.camera-sea .dragon-bubble,
.camera-music .dragon-bubble {
  left: calc(var(--dragon-x, 38%) + 78px);
  top: calc(var(--dragon-y, 66%) - 90px);
  bottom: auto;
}

.camera-sea .dragon-bubble::after,
.camera-music .dragon-bubble::after {
  left: -11px;
  bottom: 18px;
  transform: rotate(135deg);
}

@keyframes bubble-arrives {
  from { opacity: 0; transform: translateY(8px) scale(.93); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ================= big log button ================= */

.big-log-button {
  position: absolute;
  z-index: 30;
  left: 50%;
  bottom: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  width: min(420px, 42vw);
  height: var(--tap-primary);
  min-width: 320px;
  padding: 0 var(--space-6);
  border: 0;
  border-radius: var(--r-lg);
  background: var(--red-500);
  box-shadow: 0 3px 0 rgba(114, 22, 12, .2), 0 10px 22px rgba(114, 22, 12, .2);
  color: var(--on-red);
  font-size: clamp(22px, 2.2vw, var(--fs-title));
  font-weight: 900;
  line-height: 1.05;
  transform: translateX(-50%);
  cursor: pointer;
  transition: transform var(--t-quick) var(--ease-out), box-shadow var(--t-quick) var(--ease-out), background-color var(--t-quick) var(--ease-out);
}

.big-log-button:hover {
  transform: translate(-50%, -2px) rotate(-.25deg);
}

.big-log-button:active {
  background: var(--red-600);
  box-shadow: var(--shadow-press);
  transform: translate(-50%, 1px) scale(.97);
}

.big-log-button svg {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  fill: none;
  stroke: currentColor;
  stroke-width: 4;
  stroke-linecap: round;
}

/* ================= overlay ================= */

.overlay {
  position: absolute;
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: center;
  padding: var(--page-pad);
}

.overlay[hidden],
.toast[hidden],
.dragon-bubble[hidden],
.home-highlight[hidden],
.dragon-spark[hidden] {
  display: none;
}

.overlay-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(70, 54, 43, .34);
}

.storybook-card {
  position: relative;
  z-index: 1;
  width: min(1120px, calc(100vw - 48px));
  max-height: calc(100vh - 48px);
  overflow: auto;
  overscroll-behavior: contain;
  padding: 30px;
  border: var(--border);
  border-radius: var(--r-lg);
  background: var(--card);
  box-shadow: 0 6px 0 rgba(70,54,43,.08), 0 18px 44px rgba(70,54,43,.18);
  animation: panel-rises var(--t-pop) var(--ease-pop);
}

.storybook-card.compact-card {
  width: min(760px, calc(100vw - 48px));
}

.storybook-card.pin-card {
  width: min(480px, calc(100vw - 48px));
}

.storybook-card.full-scene-card {
  width: calc(100vw - 32px);
  height: calc(100vh - 32px);
  max-height: none;
  padding: 0;
  overflow: hidden;
  border-radius: var(--r-lg);
}

@keyframes panel-rises {
  from { opacity: 0; transform: translateY(26px) scale(.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.panel-topline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-5);
  margin-bottom: var(--space-5);
}

.panel-topline h2 {
  margin: 0;
  font-size: var(--fs-display);
  font-weight: 900;
  line-height: var(--lh-display);
}

.panel-topline p {
  margin: 5px 0 0;
  color: var(--ink-muted);
  font-size: var(--fs-note);
}

.icon-button {
  flex: 0 0 var(--tap-min);
  display: grid;
  place-items: center;
  width: var(--tap-min);
  height: var(--tap-min);
  padding: 0;
  border: 0;
  border-radius: var(--r-round);
  background: var(--wash);
  cursor: pointer;
  transition: transform var(--t-quick) var(--ease-out), background-color var(--t-quick) var(--ease-out);
}

.icon-button:hover {
  transform: translateY(-2px) rotate(-2deg);
}

.icon-button:active {
  transform: translateY(1px) scale(.97);
}

.icon-button svg {
  width: 30px;
  height: 30px;
  fill: none;
  stroke: var(--ink-muted);
  stroke-width: 2.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ================= log flow ================= */

.log-choices {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-5);
}

.log-choice {
  position: relative;
  min-height: 248px;
  padding: 20px 18px 18px;
  border: var(--border);
  border-radius: var(--r-md);
  background: var(--choice-bg);
  box-shadow: var(--shadow-rest);
  cursor: pointer;
  transition: transform var(--t-quick) var(--ease-out), box-shadow var(--t-quick) var(--ease-out);
}

.log-choice:hover {
  transform: translateY(-3px) rotate(-.5deg);
}

.log-choice:nth-child(2):hover {
  transform: translateY(-3px) rotate(.5deg);
}

.log-choice:active {
  transform: translateY(1px) scale(.97);
  box-shadow: var(--shadow-press);
}

.log-choice img {
  display: block;
  width: 116px;
  height: 116px;
  margin: 0 auto 5px;
  object-fit: contain;
  mix-blend-mode: multiply;
}

.log-choice strong {
  display: block;
  font-size: 23px;
  font-weight: 900;
  line-height: 1.15;
}

.log-choice small {
  display: block;
  margin-top: 7px;
  color: var(--ink-muted);
  font-size: var(--fs-note);
  font-weight: 700;
  line-height: 1.2;
}

.already-chip {
  display: block;
  margin-top: 8px;
  padding: 5px 9px;
  border-radius: var(--r-round);
  background: var(--wash);
  color: var(--ink-muted);
  font-size: 14px;
  font-weight: 800;
}

/* game chooser: three illustrated cards (PRD §6.8 games — free, repeatable) */

.play-choices {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-5);
}

.play-choice {
  min-height: 232px;
  padding: 18px 16px 16px;
  border: var(--border);
  border-radius: var(--r-md);
  background: var(--card);
  box-shadow: var(--shadow-rest);
  cursor: pointer;
  transition: transform var(--t-quick) var(--ease-out), box-shadow var(--t-quick) var(--ease-out);
}

.play-choice:hover {
  transform: translateY(-3px) rotate(-.5deg);
}

.play-choice:nth-child(2):hover {
  transform: translateY(-3px) rotate(.5deg);
}

.play-choice:active {
  transform: translateY(1px) scale(.97);
  box-shadow: var(--shadow-press);
}

.play-choice img {
  display: block;
  width: 150px;
  height: 150px;
  margin: 0 auto 8px;
  object-fit: contain;
  mix-blend-mode: multiply;
}

.play-choice strong {
  display: block;
  font-size: 23px;
  font-weight: 900;
  text-align: center;
}

/* crystal reveal — the signature moment begins */

.reveal-card {
  text-align: center;
  overflow: hidden;
}

.reveal-light {
  position: absolute;
  inset: 24px;
  border: 8px solid var(--gold-100);
  border-radius: var(--r-lg);
  opacity: .9;
  animation: reveal-ring 900ms var(--ease-out) infinite alternate;
  pointer-events: none;
}

@keyframes reveal-ring {
  from { transform: rotate(-1deg); opacity: .48; }
  to { transform: rotate(1deg); opacity: .95; }
}

.reveal-card h2 {
  position: relative;
  margin: 0;
  font-size: var(--fs-display);
  font-weight: 900;
}

.reveal-holder {
  position: relative;
  display: block;
  width: min(290px, 42vh);
  margin: 6px auto;
}

.reveal-crystal {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  mix-blend-mode: multiply;
  animation: crystal-opens 650ms var(--ease-pop) both;
}

@keyframes crystal-opens {
  from { opacity: 0; transform: translateY(24px) scale(.55) rotate(-9deg); }
  to { opacity: 1; transform: translateY(0) scale(1) rotate(0); }
}

.spark {
  position: absolute;
  width: 22px;
  height: 22px;
  fill: var(--gold-500);
  opacity: 0;
  animation: spark-once 900ms var(--ease-out) forwards;
  pointer-events: none;
}

@keyframes spark-once {
  0% { transform: scale(0); opacity: 0; }
  35% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(.6); opacity: 0; }
}

.reveal-card p {
  position: relative;
  margin: 0 auto;
  max-width: 560px;
  font-size: var(--fs-body);
  font-weight: 800;
}

.reveal-family {
  color: var(--ink-muted);
  font-size: var(--fs-note) !important;
  font-weight: 700 !important;
  margin-top: 4px !important;
}

.skip-note {
  margin-top: 12px !important;
  color: var(--ink-muted);
  font-size: var(--fs-note) !important;
}

/* the crystal-fly: born at the reveal, arcs into the home scene */

.fly-layer {
  position: absolute;
  z-index: 90;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.flying-crystal {
  position: absolute;
  object-fit: contain;
  mix-blend-mode: multiply;
  will-change: transform, opacity;
  animation: fly-arc var(--t-crystal) var(--ease-out) forwards;
}

@keyframes fly-arc {
  0% { transform: translate(0, 0) scale(1) rotate(-6deg); opacity: 1; }
  45% { transform: translate(calc(var(--fx) * .5), calc(var(--fy) * .4 - 130px)) scale(.72) rotate(8deg); opacity: 1; }
  92% { opacity: 1; }
  100% { transform: translate(var(--fx), var(--fy)) scale(var(--fscale, .3)) rotate(2deg); opacity: 0; }
}

.toast {
  position: absolute;
  z-index: 130;
  left: 50%;
  bottom: 126px;
  max-width: 620px;
  min-height: var(--tap-min);
  padding: 14px 22px;
  border: var(--border);
  border-radius: var(--r-round);
  background: var(--card);
  box-shadow: var(--shadow-rest);
  color: var(--ink);
  font-size: var(--fs-body);
  font-weight: 800;
  text-align: center;
  transform: translateX(-50%);
  animation: bubble-arrives var(--t-pop) var(--ease-pop);
}

/* ================= treasures ================= */

.treasure-layout {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: var(--space-6);
}

.shelf-section h3,
.album-section h3 {
  margin: 0 0 var(--space-3);
  font-size: var(--fs-title);
  font-weight: 900;
}

.trophy-shelf {
  display: flex;
  gap: var(--space-5);
  min-height: 230px;
  padding: 0 4px 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
}

.trophy-card {
  position: relative;
  flex: 0 0 188px;
  height: 250px;
  padding: 46px 22px 22px;
  border: 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  scroll-snap-align: start;
  transition: transform var(--t-quick) var(--ease-out);
}

.trophy-card:hover {
  transform: translateY(-3px) rotate(-.6deg);
}

.trophy-card:active {
  transform: translateY(1px) scale(.97);
}

.trophy-card > img {
  position: absolute;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  object-fit: fill;
  mix-blend-mode: multiply;
}

.trophy-card strong {
  display: block;
  font-size: 18px;
  font-weight: 900;
  line-height: 1.15;
}

.trophy-card small {
  display: block;
  margin: 9px 0;
  color: var(--ink-muted);
  font-size: 14px;
  font-weight: 700;
}

.trophy-card span {
  display: block;
  font-size: 14px;
  line-height: 1.18;
}

.empty-shelf {
  display: flex;
  align-items: center;
  min-height: 150px;
  color: var(--ink-muted);
  font-size: var(--fs-body);
}

.crystal-album {
  display: grid;
  grid-template-columns: repeat(9, minmax(64px, 1fr));
  gap: 12px;
}

.album-crystal {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  min-width: var(--tap-min);
  min-height: var(--tap-min);
  padding: 4px;
  border: 0;
  border-radius: 47% 53% 46% 54%;
  background: transparent;
  cursor: pointer;
  transition: transform var(--t-quick) var(--ease-out), background-color var(--t-quick) var(--ease-out);
}

.album-crystal:hover {
  background: var(--wash);
  transform: translateY(-3px) rotate(-3deg);
}

.album-crystal:active {
  transform: translateY(1px) scale(.97);
}

.album-crystal img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  mix-blend-mode: multiply;
}

.crystal-detail {
  text-align: center;
}

.crystal-detail > img {
  display: block;
  width: min(330px, 46vh);
  height: min(330px, 46vh);
  margin: 0 auto;
  object-fit: contain;
  mix-blend-mode: multiply;
}

.crystal-detail h2 {
  margin: 0 0 8px;
  font-size: var(--fs-title);
  font-weight: 900;
}

.crystal-detail p {
  margin: 4px 0;
}

/* ================= story book ================= */

.book-shell {
  display: grid;
  grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr);
  min-height: 560px;
  overflow: hidden;
  border: 3px solid #D2B278;
  border-radius: var(--r-md);
  background: var(--ground);
  box-shadow: inset 0 0 0 8px var(--wash);
}

.book-art,
.book-copy {
  min-height: 560px;
  padding: 28px;
}

.book-art {
  display: grid;
  place-items: center;
  border-right: 3px solid #D2B278;
}

.book-art img {
  width: 100%;
  height: 460px;
  object-fit: contain;
  mix-blend-mode: multiply;
}

.book-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.book-copy h3 {
  margin: 0 0 var(--space-5);
  font-size: var(--fs-title);
  font-weight: 900;
  line-height: var(--lh-title);
}

.book-copy p {
  margin: 0;
  font-size: clamp(19px, 1.7vw, 24px);
  line-height: 1.48;
}

.book-hook {
  display: grid;
  grid-template-columns: 62px 1fr;
  align-items: center;
  gap: 12px;
  min-height: 76px;
  margin: 0 0 var(--space-4);
  padding: 7px 14px 7px 7px;
  border: var(--border);
  border-radius: var(--r-md);
  background: var(--card);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: transform var(--t-quick) var(--ease-out), box-shadow var(--t-quick) var(--ease-out);
}

.book-hook:hover {
  transform: translateY(-2px) rotate(-.3deg);
  box-shadow: var(--shadow-rest);
}

.book-hook:active,
.book-hook.is-tapped {
  transform: translateY(1px) scale(.97);
}

.book-hook img {
  width: 62px;
  height: 62px;
  object-fit: contain;
  mix-blend-mode: multiply;
}

.book-hook span {
  font-size: 16px;
  font-weight: 800;
  line-height: 1.22;
}

.locked-page {
  align-items: center;
  text-align: center;
}

.locked-page img {
  width: 120px;
  height: 120px;
  margin-bottom: var(--space-4);
  object-fit: contain;
  mix-blend-mode: multiply;
}

.book-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-5);
  margin-top: var(--space-4);
}

.page-dots {
  display: flex;
  justify-content: center;
  gap: 7px;
  flex: 1;
}

.page-dot {
  width: 11px;
  height: 11px;
  border: 2px solid var(--stone-400);
  border-radius: 50%;
  background: transparent;
}

.page-dot.open {
  border-color: var(--gold-500);
  background: var(--gold-300);
}

.page-dot.current {
  box-shadow: 0 0 0 4px var(--wash);
}

/* ================= pin & parent panel ================= */

.pin-display {
  display: flex;
  justify-content: center;
  gap: 15px;
  min-height: 42px;
  margin: 8px 0 18px;
}

.pin-dot {
  width: 22px;
  height: 22px;
  border: 3px solid var(--ink-faint);
  border-radius: 50%;
  background: transparent;
}

.pin-dot.filled {
  border-color: var(--ink);
  background: var(--ink);
}

.pin-pad {
  display: grid;
  grid-template-columns: repeat(3, 68px);
  justify-content: center;
  gap: 11px;
}

.pin-key {
  width: 68px;
  height: 64px;
  padding: 0;
  border: var(--border);
  border-radius: var(--r-sm);
  background: var(--wash);
  color: var(--ink);
  font-size: 25px;
  font-weight: 800;
  cursor: pointer;
  transition: transform var(--t-quick) var(--ease-out), background-color var(--t-quick) var(--ease-out);
}

.pin-key svg {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: var(--ink-muted);
  stroke-width: 2.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.pin-key:hover {
  transform: translateY(-2px);
  background: var(--card);
}

.pin-key:active {
  transform: translateY(1px) scale(.97);
}

.pin-message {
  min-height: 24px;
  margin: 14px 0 0;
  color: var(--ink-muted);
  font-size: var(--fs-note);
  text-align: center;
}

.parent-panel {
  width: min(1180px, calc(100vw - 48px));
  color: var(--ink);
}

.parent-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
  padding: 12px 16px;
  border-radius: var(--r-md);
  background: var(--wash);
}

.parent-toolbar label {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--tap-min);
}

.parent-toolbar input[type="checkbox"] {
  width: 26px;
  height: 26px;
  accent-color: var(--ink);
}

.parent-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-5);
}

.parent-section {
  padding: 20px;
  border: var(--border);
  border-radius: var(--r-md);
  background: var(--card);
}

.parent-section h3 {
  margin: 0 0 var(--space-4);
  font-size: 24px;
  font-weight: 900;
}

.parent-section > p {
  font-size: 15px;
  line-height: 1.4;
}

.parent-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.parent-field input[type="text"] {
  width: 100%;
  min-height: var(--tap-min);
  padding: 8px 12px;
  border: var(--border);
  border-radius: var(--r-sm);
  background: var(--ground);
  color: var(--ink);
  font-size: 15px;
  font-weight: 700;
}

.milestone-toggle {
  min-width: 96px;
  min-height: var(--tap-min);
  padding: 6px 8px;
  border: var(--border);
  border-radius: var(--r-sm);
  background: var(--wash);
  color: var(--ink);
  font-size: 14px;
  font-weight: 900;
  cursor: pointer;
}

.milestone-toggle.done {
  background: var(--gold-100);
}

.parent-action {
  min-height: var(--tap-min);
  padding: 12px 20px;
  border: var(--border);
  border-radius: var(--r-md);
  background: var(--card);
  box-shadow: var(--shadow-rest);
  color: var(--ink);
  font-size: var(--fs-note);
  font-weight: 900;
  cursor: pointer;
  transition: transform var(--t-quick) var(--ease-out), box-shadow var(--t-quick) var(--ease-out);
}

.parent-action:hover {
  transform: translateY(-2px) rotate(-.3deg);
}

.parent-action:active {
  transform: translateY(1px) scale(.97);
  box-shadow: var(--shadow-press);
}

.recent-log {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 50px;
  padding: 6px 0;
  border-bottom: 2px solid var(--line);
  font-size: 15px;
}

.recent-log:last-child {
  border-bottom: 0;
}

.recent-log button {
  min-width: 88px;
  min-height: var(--tap-min);
  border: 0;
  border-radius: var(--r-sm);
  background: var(--wash);
  color: var(--ink-muted);
  font-size: 14px;
  font-weight: 900;
  cursor: pointer;
}

.storage-note {
  margin: var(--space-4) 0 0;
  color: var(--ink-muted);
  font-size: 14px;
}

/* ================= celebration, beats, finale ================= */

.celebration-card {
  text-align: center;
}

.celebration-trophy {
  position: relative;
  width: 270px;
  height: 360px;
  margin: 0 auto 14px;
  padding: 82px 40px 40px;
}

.celebration-trophy > img {
  position: absolute;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  object-fit: fill;
  mix-blend-mode: multiply;
}

.celebration-trophy h2 {
  margin: 0 0 10px;
  font-size: 25px;
  font-weight: 900;
  line-height: 1.18;
}

.celebration-trophy p {
  font-size: var(--fs-note);
  line-height: 1.3;
}

.praise-pill {
  max-width: 560px;
  margin: 0 auto var(--space-4);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--r-round);
  background: var(--wash);
  font-size: var(--fs-note);
  font-weight: 700;
}

.primary-small {
  min-height: var(--tap-min);
  padding: 12px 26px;
  border: 0;
  border-radius: var(--r-md);
  background: var(--red-500);
  box-shadow: var(--shadow-rest);
  color: var(--on-red);
  font-size: var(--fs-body);
  font-weight: 900;
  cursor: pointer;
  transition: transform var(--t-quick) var(--ease-out), background-color var(--t-quick) var(--ease-out), box-shadow var(--t-quick) var(--ease-out);
}

.primary-small:hover {
  transform: translateY(-2px) rotate(-.25deg);
}

.primary-small:active {
  background: var(--red-600);
  transform: translateY(1px) scale(.97);
  box-shadow: var(--shadow-press);
}

.beat-scene,
.finale-scene {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--ground);
}

.beat-scene > img,
.beat-scene > video,
.finale-scene > img,
.finale-scene > video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.beat-scene.ukulele-beat > img,
.beat-scene.ukulele-beat > video,
.beat-scene.care-beat > img,
.beat-scene.care-beat > video,
.finale-scene.scene-contain > img,
.finale-scene.scene-contain > video,
.final-home {
  object-fit: contain;
}

.scene-caption {
  position: absolute;
  z-index: 2;
  left: 50%;
  bottom: 34px;
  width: min(760px, calc(100% - 80px));
  padding: 18px 24px;
  border: var(--border);
  border-radius: var(--r-lg);
  background: rgba(255, 252, 245, .95);
  box-shadow: var(--shadow-rest);
  text-align: center;
  transform: translateX(-50%);
}

.scene-caption h2 {
  margin: 0;
  font-size: var(--fs-title);
  font-weight: 900;
}

.scene-caption p {
  margin: 5px 0 0;
  font-size: var(--fs-body);
}

.finale-advance {
  position: absolute;
  z-index: 5;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.finale-advance:focus-visible {
  outline-offset: -6px;
}

/* ================= continue-or-not ================= */

.continue-copy {
  max-width: 760px;
  margin: 0 auto var(--space-6);
  text-align: center;
}

.continue-copy h2 {
  margin: 0 0 var(--space-3);
  font-size: var(--fs-display);
  font-weight: 900;
}

.continue-copy p {
  margin: 0;
  font-size: var(--fs-body);
}

.continue-choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-5);
}

.choice-card {
  min-height: 180px;
  padding: 28px;
  border: var(--border);
  border-radius: var(--r-md);
  background: var(--gold-100);
  box-shadow: var(--shadow-rest);
  color: var(--ink);
  text-align: center;
  cursor: pointer;
  transition: transform var(--t-quick) var(--ease-out), box-shadow var(--t-quick) var(--ease-out);
}

.choice-card:hover {
  transform: translateY(-2px) rotate(-.3deg);
}

.choice-card:active {
  transform: translateY(1px) scale(.97);
  box-shadow: var(--shadow-press);
}

.choice-card strong {
  display: block;
  margin-bottom: 8px;
  font-size: var(--fs-title);
  font-weight: 900;
  line-height: var(--lh-title);
}

.choice-card span {
  display: block;
  color: var(--ink-muted);
  font-size: var(--fs-note);
}

/* ================= smaller windows ================= */

@media (max-width: 1080px) {
  .road-gate {
    width: 230px;
  }

  .treasure-object {
    right: 52px;
  }

  .story-object {
    right: 52px;
  }

  .care-stack {
    left: 50px;
  }

  .dragon-companion {
    left: calc(50% - 344px);
  }

  .dragon-bubble {
    left: calc(50% - 244px);
  }

  .week-rhythm {
    width: 300px;
  }

  .crystal-album {
    grid-template-columns: repeat(7, minmax(64px, 1fr));
  }
}

@media (max-height: 760px) {
  .road-gate {
    top: 116px;
    height: 264px;
  }

  .road-gate > img {
    height: 132px;
  }

  .home-scene {
    top: 62px;
    height: min(520px, 65vh);
  }

  .treasure-object {
    bottom: 20px;
  }

  .story-object {
    top: 388px;
    bottom: auto;
  }

  .care-stack {
    top: 392px;
    bottom: auto;
    left: 24px;
    flex-direction: row;
    gap: 8px;
  }

  .care-btn {
    width: auto;
    min-width: 118px;
    padding: 0 10px;
  }

  .dragon-companion {
    left: calc(50% - 300px);
  }

  .dragon-bubble {
    left: calc(50% - 200px);
  }

  .week-rhythm {
    bottom: 16px;
  }

  .big-log-button {
    bottom: 14px;
    height: 76px;
  }

  .dragon-companion {
    bottom: 82px;
    width: 150px;
    height: 150px;
  }

  .dragon-bubble {
    bottom: 252px;
  }

  .book-shell,
  .book-art,
  .book-copy {
    min-height: 430px;
  }

  .book-art img {
    height: 350px;
  }
}

/* ================= reduced motion: posters instead of clips ================= */

@media (prefers-reduced-motion: reduce) {
  .dragon-companion video {
    display: none;
  }

  .dragon-companion img {
    display: block;
  }

  .beat-scene video,
  .finale-scene video {
    display: none;
  }
}
