/* ==================================================================
   MeetKuhiro.com
   Layout concept: an app you hold like a picture book. One scene at a
   time under a shared mountain sky, a glass dock for small thumbs,
   and the lantern's gold as the only loud colour.
   Light theme = fog morning in the mountains. Dark = lantern night.
   ================================================================== */
@font-face { font-family: "Fredoka"; font-style: normal; font-weight: 500; font-display: swap; src: url("../fonts/fredoka-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Fredoka"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/fredoka-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Fredoka"; font-style: normal; font-weight: 700; font-display: swap; src: url("../fonts/fredoka-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Nunito"; font-style: normal; font-weight: 500; font-display: swap; src: url("../fonts/nunito-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Nunito"; font-style: normal; font-weight: 700; font-display: swap; src: url("../fonts/nunito-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Nunito"; font-style: normal; font-weight: 800; font-display: swap; src: url("../fonts/nunito-latin-800-normal.woff2") format("woff2"); }

:root {
  --bg: #DDE8F7;
  --sky-a: #B9D0F0;
  --sky-b: #EEF3FB;
  --ink: #16214A;
  --ink-2: #4A5885;
  --surface: rgba(255, 255, 255, 0.72);
  --surface-2: rgba(255, 255, 255, 0.5);
  --surface-solid: #FFFFFF;
  --line: rgba(22, 33, 74, 0.1);
  --accent: #F2A230;
  --accent-2: #FFCB6B;
  --accent-ink: #4A2A00;
  --glow: #FFD58A;
  --scarf: #2F6BC4;
  --mtn-far: #CCDBF0;
  --mtn-mid: #B6CAE8;
  --mtn-near: #A5BCE0;
  --snow: #FFFFFF;
  --snow-o: 0.85;
  --fog: rgba(255, 255, 255, 0.78);
  --star: rgba(255, 255, 255, 0);
  --globe-sea-a: #4E77CF;
  --globe-sea-b: #1C2E6E;
  --globe-dot: #FFF4DA;
  --globe-rim: #FFB547;
  --globe-path: #FFD27A;
  --lantern-core: #FFE6A8;
  --jar-line: rgba(22, 33, 74, 0.35);
  --jar-inside: rgba(255, 255, 255, 0.35);
  --shadow: 0 18px 40px -18px rgba(22, 40, 100, 0.35);
  --shadow-sm: 0 6px 18px -8px rgba(22, 40, 100, 0.35);

  --font-display: "Fredoka", ui-rounded, "SF Pro Rounded", "Arial Rounded MT Bold", system-ui, sans-serif;
  --font-body: "Nunito", ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", sans-serif;

  --step--1: clamp(0.84rem, 0.8rem + 0.2vw, 0.95rem);
  --step-0: clamp(1rem, 0.95rem + 0.25vw, 1.12rem);
  --step-1: clamp(1.2rem, 1.1rem + 0.5vw, 1.45rem);
  --step-2: clamp(1.6rem, 1.3rem + 1.2vw, 2.2rem);
  --step-3: clamp(2.3rem, 1.7rem + 2.8vw, 4rem);

  --r-lg: 30px;
  --r-md: 22px;
  --r-sm: 14px;
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --top: calc(64px + env(safe-area-inset-top, 0px));
  --dock-h: calc(92px + env(safe-area-inset-bottom, 0px));
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0B1030; --sky-a: #060A22; --sky-b: #1C2560;
    --ink: #F1F4FF; --ink-2: #AFB9E0;
    --surface: rgba(30, 39, 92, 0.62); --surface-2: rgba(30, 39, 92, 0.42); --surface-solid: #1A2252;
    --line: rgba(255, 255, 255, 0.12);
    --accent: #FFBE55; --accent-2: #FFD98C; --accent-ink: #331D00; --glow: #FFD27A;
    --scarf: #79A6F2;
    --mtn-far: #26347A; --mtn-mid: #1B275F; --mtn-near: #131B48; --snow: #B9C8EE; --snow-o: 0.3;
    --fog: rgba(170, 190, 240, 0.14); --star: rgba(255, 255, 255, 0.9);
    --globe-sea-a: #243C8E; --globe-sea-b: #0A1238;
    --jar-line: rgba(255, 255, 255, 0.45); --jar-inside: rgba(255, 255, 255, 0.05);
    --shadow: 0 20px 44px -18px rgba(0, 0, 0, 0.6); --shadow-sm: 0 8px 20px -8px rgba(0, 0, 0, 0.55);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0B1030; --sky-a: #060A22; --sky-b: #1C2560;
  --ink: #F1F4FF; --ink-2: #AFB9E0;
  --surface: rgba(30, 39, 92, 0.62); --surface-2: rgba(30, 39, 92, 0.42); --surface-solid: #1A2252;
  --line: rgba(255, 255, 255, 0.12);
  --accent: #FFBE55; --accent-2: #FFD98C; --accent-ink: #331D00; --glow: #FFD27A;
  --scarf: #79A6F2;
  --mtn-far: #26347A; --mtn-mid: #1B275F; --mtn-near: #131B48; --snow: #B9C8EE; --snow-o: 0.3;
  --fog: rgba(170, 190, 240, 0.14); --star: rgba(255, 255, 255, 0.9);
  --globe-sea-a: #243C8E; --globe-sea-b: #0A1238;
  --jar-line: rgba(255, 255, 255, 0.45); --jar-inside: rgba(255, 255, 255, 0.05);
  --shadow: 0 20px 44px -18px rgba(0, 0, 0, 0.6); --shadow-sm: 0 8px 20px -8px rgba(0, 0, 0, 0.55);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; }
[hidden] { display: none !important; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; line-height: 1.05; margin: 0; text-wrap: balance; letter-spacing: -0.01em; }
p { margin: 0; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 12px; }
.eyebrow { font-family: var(--font-display); font-weight: 600; font-size: var(--step--1); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2); }
.sub { color: var(--ink-2); }

/* ---------------- SKY ---------------- */
.sky { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden;
  background: linear-gradient(180deg, var(--sky-a) 0%, var(--sky-b) 70%); transition: background 0.6s; }
.sky-stars { position: absolute; inset: 0; width: 100%; height: 100%; }
.sky-mountains { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 46vh; transition: transform 1.2s var(--ease), opacity 0.8s; }
.mtn-far { fill: var(--mtn-far); } .mtn-mid { fill: var(--mtn-mid); } .mtn-near { fill: var(--mtn-near); }
.mtn-snow { fill: var(--snow); opacity: var(--snow-o); }
.fog { position: absolute; border-radius: 50%; background: var(--fog); filter: blur(28px); will-change: transform; }
.fog-1 { width: 70vw; height: 16vh; left: -20vw; bottom: 22vh; animation: drift 38s linear infinite; }
.fog-2 { width: 60vw; height: 14vh; right: -25vw; bottom: 12vh; animation: drift 46s linear infinite reverse; }
.fog-3 { width: 80vw; height: 18vh; left: 10vw; bottom: -4vh; animation: drift 54s linear infinite; opacity: 0.9; }
@keyframes drift { 0% { transform: translateX(-12vw); } 50% { transform: translateX(14vw); } 100% { transform: translateX(-12vw); } }
.motes { position: absolute; inset: 0; }
.mote { position: absolute; bottom: -10px; width: 6px; height: 6px; border-radius: 50%; background: var(--glow);
  box-shadow: 0 0 12px 3px var(--glow); opacity: 0; animation: rise linear infinite; }
@keyframes rise { 0% { transform: translate(0, 0); opacity: 0; } 12% { opacity: 0.9; } 80% { opacity: 0.6; } 100% { transform: translate(var(--dx, 20px), -85vh); opacity: 0; } }
body[data-scene="map"] .sky-mountains, body[data-scene="parents"] .sky-mountains { transform: translateY(14vh); opacity: 0.5; }
body[data-scene="map"] .sky { background: linear-gradient(180deg, #080D2A 0%, #1B2560 80%); }

/* ---------------- TOP BAR ---------------- */
.topbar { position: fixed; z-index: 30; top: 0; left: 0; right: 0;
  padding: calc(10px + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left));
  display: flex; align-items: center; justify-content: space-between; gap: 12px; pointer-events: none; }
.topbar > * { pointer-events: auto; }
.wordmark { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; font-family: var(--font-display); font-weight: 700; font-size: 1.5rem; color: var(--ink);
  padding: 6px 14px 6px 10px; border-radius: 999px; background: var(--surface); backdrop-filter: blur(18px) saturate(1.6); -webkit-backdrop-filter: blur(18px) saturate(1.6); box-shadow: var(--shadow-sm); }
body[data-scene="map"] .wordmark, body[data-scene="map"] .icon-btn, body[data-scene="map"] .grownups-link { color: #F1F4FF; background: rgba(30, 39, 92, 0.6); }
.wordmark-lantern { width: 22px; height: 28px; color: var(--accent); }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--surface);
  backdrop-filter: blur(18px) saturate(1.6); -webkit-backdrop-filter: blur(18px) saturate(1.6); box-shadow: var(--shadow-sm); transition: transform 0.3s var(--spring); }
.icon-btn:active { transform: scale(0.9); }
.icon-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn .spk { fill: currentColor; }
.icon-btn .mute { display: none; }
.icon-btn[aria-pressed="false"] .wave1, .icon-btn[aria-pressed="false"] .wave2 { display: none; }
.icon-btn[aria-pressed="false"] .mute { display: inline; }
.icon-btn--solid { background: var(--surface-solid); }
.grownups-link { font-weight: 800; font-size: 0.9rem; text-decoration: none; padding: 10px 14px; border-radius: 999px; background: var(--surface);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); box-shadow: var(--shadow-sm); color: var(--ink-2); }

/* ---------------- SCENES ---------------- */
main { position: relative; z-index: 1; }
.scene { display: none; min-height: 100vh; min-height: 100dvh;
  padding-block: calc(var(--top) + 12px) calc(var(--dock-h) + 24px);
  padding-inline: max(16px, env(safe-area-inset-left)) max(16px, env(safe-area-inset-right)); }
.scene.is-active { display: block; animation: scene-in 0.55s var(--ease) both; }
@keyframes scene-in { from { opacity: 0.001; transform: translateY(18px) scale(0.985); } to { opacity: 1; transform: none; } }
.scene-head { max-width: 1100px; margin: 0 auto 20px; display: grid; gap: 6px; text-align: center; justify-items: center; }
.scene-head h2 { font-size: var(--step-3); }

/* ---------------- BUTTONS ---------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 56px; padding: 0 26px; border-radius: 999px;
  font-family: var(--font-display); font-weight: 600; font-size: 1.15rem; text-decoration: none; transition: transform 0.35s var(--spring), box-shadow 0.3s; user-select: none; }
.btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn:active { transform: scale(0.94); }
.btn--lantern { color: var(--accent-ink); background: linear-gradient(180deg, var(--accent-2), var(--accent));
  box-shadow: 0 10px 30px -8px color-mix(in srgb, var(--accent) 70%, transparent), inset 0 1px 0 rgba(255, 255, 255, 0.6); }
.btn--lantern:hover { transform: translateY(-2px); box-shadow: 0 16px 36px -8px color-mix(in srgb, var(--accent) 80%, transparent), inset 0 1px 0 rgba(255, 255, 255, 0.6); }
.btn--glass { background: var(--surface); backdrop-filter: blur(18px) saturate(1.5); -webkit-backdrop-filter: blur(18px) saturate(1.5); box-shadow: var(--shadow-sm); color: var(--ink); }
.btn--quiet { background: transparent; color: var(--ink-2); box-shadow: inset 0 0 0 2px var(--line); }
.btn--small { min-height: 46px; padding: 0 18px; font-size: 1rem; }
.btn--glass svg path:first-child { fill: currentColor; stroke: none; }
.btn--lantern svg path:first-child { fill: none; }
.cta-row { display: flex; flex-wrap: wrap; gap: 12px; }
.chip { display: inline-block; padding: 3px 12px; border-radius: 999px; font-weight: 800; font-size: 0.85rem; background: var(--surface-2); box-shadow: inset 0 0 0 1.5px var(--line); }

/* ---------------- HELLO ---------------- */
.hello { max-width: 1120px; margin: 0 auto; display: grid; gap: 8px; align-items: center; justify-items: center; }
.hello-stage { position: relative; display: grid; justify-items: center; padding-top: 58px; }
.kuhiro-btn { width: clamp(190px, min(60vw, 36vh), 400px); border-radius: 40% 40% 30% 30%; touch-action: manipulation; animation: arrive 1.1s var(--spring) both 0.1s; }
@keyframes arrive { from { transform: translateY(60px) scale(0.7); opacity: 0; } to { transform: none; opacity: 1; } }
.bubble { position: absolute; z-index: 2; top: 10px; left: 56%; transform: translateX(-4%); max-width: min(230px, 46vw);
  font-family: var(--font-display); font-weight: 600; font-size: 1.15rem; line-height: 1.2; padding: 12px 18px; border-radius: 22px 22px 22px 6px;
  background: var(--surface-solid); color: var(--ink); box-shadow: var(--shadow); animation: bubble-in 0.6s var(--spring) both 0.9s; }
.bubble.is-new { animation: bubble-pop 0.45s var(--spring) both; }
@keyframes bubble-in { from { opacity: 0; transform: translateX(-4%) scale(0.6) translateY(10px); } to { opacity: 1; transform: translateX(-4%); } }
@keyframes bubble-pop { 0% { transform: translateX(-4%) scale(0.85); } 100% { transform: translateX(-4%) scale(1); } }
.tap-hint { position: absolute; bottom: 12%; right: 4%; font-family: var(--font-display); font-weight: 600; font-size: 0.95rem; padding: 6px 12px; border-radius: 999px;
  background: var(--accent); color: var(--accent-ink); box-shadow: var(--shadow-sm); animation: hint 1.8s ease-in-out infinite 2.2s; opacity: 0; }
@keyframes hint { 0%, 100% { opacity: 1; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-6px); } }
.hello-copy { display: grid; gap: 14px; justify-items: center; text-align: center; max-width: 36rem; }
.hello-copy h1 { font-size: var(--step-3); font-weight: 700; }
.name-glow { color: var(--scarf); }
.lede { font-size: var(--step-1); line-height: 1.45; color: var(--ink-2); max-width: 32rem; }
.say-it { display: inline-flex; align-items: center; gap: 6px; padding: 8px 18px 8px 12px; border-radius: 999px; background: var(--surface); box-shadow: var(--shadow-sm);
  font-family: var(--font-display); font-weight: 600; font-size: 1.25rem; backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }
.say-it svg { width: 26px; height: 26px; margin-right: 4px; stroke: var(--scarf); fill: none; stroke-width: 2; stroke-linecap: round; }
.say-it svg path:first-child { fill: var(--scarf); stroke: none; }
.syl { display: inline-block; padding: 0 2px; color: var(--ink-2); transition: transform 0.25s var(--spring), color 0.2s; }
.syl-big { color: var(--ink); font-weight: 700; }
.syl.is-hot { transform: translateY(-6px) scale(1.2); color: var(--scarf); }
@media (max-width: 520px) {
  .hello-copy .eyebrow { display: none; }
  .lede { font-size: var(--step-0); }
  .hello-copy { gap: 12px; }
}
@media (min-width: 900px) {
  .hello { grid-template-columns: 1fr 1fr; min-height: calc(100dvh - var(--top) - var(--dock-h) - 40px); gap: 40px; }
  .hello-stage { order: 2; }
  .hello-copy { justify-items: start; text-align: left; }
  .kuhiro-btn { width: clamp(300px, 34vw, 440px); }
}

/* ---------------- KUHIRO (SVG character) ---------------- */
.kuhiro { width: 100%; height: auto; overflow: visible; display: block; }
.kuhiro .k-all, .kuhiro .k-jump, .kuhiro .k-headwrap, .kuhiro .k-armL, .kuhiro .k-ear, .kuhiro .k-scarf-tail, .kuhiro .k-fringe, .kuhiro .k-brows path, .kuhiro .k-zzz { transform-box: view-box; }
.kuhiro .k-all { transform-origin: 200px 500px; }
.kuhiro .k-jump { transform-origin: 200px 500px; }
.kuhiro.is-alive .k-all { animation: k-breathe 3.4s ease-in-out infinite; }
@keyframes k-breathe { 0%, 100% { transform: scale(1, 1); } 50% { transform: scale(1.012, 0.988) translateY(2px); } }
.kuhiro .k-headwrap { transform-origin: 200px 300px; transform: rotate(var(--tilt, 0deg)); transition: transform 0.25s var(--ease); }
.kuhiro .k-pupils { transform: translate(var(--lx, 0px), var(--ly, 0px)); }
.kuhiro .k-eye { transform-box: fill-box; transform-origin: center; transition: transform 0.07s linear; }
.kuhiro.is-blinking .k-eye { transform: scaleY(0.08); }
.kuhiro .k-earL { transform-origin: 118px 132px; } .kuhiro .k-earR { transform-origin: 282px 132px; }
.kuhiro.is-alive .k-earL { animation: ear 7s ease-in-out infinite 1.5s; }
.kuhiro.is-alive .k-earR { animation: ear 7s ease-in-out infinite 4.8s; }
@keyframes ear { 0%, 90%, 100% { transform: rotate(0); } 93% { transform: rotate(-9deg); } 96% { transform: rotate(4deg); } }
.kuhiro .k-scarf-tail, .kuhiro .k-fringe { transform-origin: 181px 298px; }
.kuhiro.is-alive .k-scarf-tail, .kuhiro.is-alive .k-fringe { animation: sway 3.6s ease-in-out infinite; }
@keyframes sway { 0%, 100% { transform: rotate(-2.5deg); } 50% { transform: rotate(3deg); } }
.kuhiro .k-armL { transform-origin: 108px 290px; }
.kuhiro.is-waving .k-armL { animation: wave 2.5s ease-in-out both; }
@keyframes wave {
  0% { transform: rotate(0deg); } 16% { transform: rotate(140deg); } 28% { transform: rotate(112deg); } 40% { transform: rotate(148deg); }
  52% { transform: rotate(112deg); } 64% { transform: rotate(148deg); } 76% { transform: rotate(124deg); } 100% { transform: rotate(0deg); } }
.kuhiro.is-jumping .k-jump { animation: jump 0.7s cubic-bezier(0.3, 0.7, 0.4, 1) both; }
@keyframes jump { 0% { transform: scale(1.06, 0.92); } 30% { transform: translateY(-60px) scale(0.96, 1.05); } 62% { transform: translateY(0) scale(1.05, 0.94); } 80% { transform: scale(0.98, 1.02); } 100% { transform: none; } }
.kuhiro.is-wiggling .k-jump { animation: wiggle 0.9s ease-in-out both; }
@keyframes wiggle { 0%, 100% { transform: rotate(0); } 15% { transform: rotate(-6deg); } 30% { transform: rotate(6deg); } 45% { transform: rotate(-5deg); } 60% { transform: rotate(5deg); } 75% { transform: rotate(-2deg); } }
.kuhiro.is-spinning .k-jump { animation: spin 1s var(--ease) both; }
@keyframes spin { 0% { transform: scaleX(1); } 25% { transform: scaleX(0.05) translateY(-20px); } 50% { transform: scaleX(-1) translateY(-26px); } 75% { transform: scaleX(0.05) translateY(-20px); } 100% { transform: scaleX(1); } }
/* faces */
.kuhiro .k-mouth, .kuhiro .k-closed path, .kuhiro .k-zzz { display: none; }
.kuhiro[data-face="happy"] .k-mouth-happy, .kuhiro[data-face="giggle"] .k-mouth-giggle, .kuhiro[data-face="sleepy"] .k-mouth-sleepy,
.kuhiro[data-face="surprised"] .k-mouth-surprised, .kuhiro[data-face="brave"] .k-mouth-brave { display: inline; }
.kuhiro[data-face="giggle"] .k-eyes, .kuhiro[data-face="sleepy"] .k-eyes { display: none; }
.kuhiro[data-face="giggle"] .k-closed-happy, .kuhiro[data-face="sleepy"] .k-closed-sleepy { display: inline; }
.kuhiro[data-face="giggle"] .k-blush { opacity: 1; }
.kuhiro[data-face="giggle"] .k-jump { animation: wiggle 0.9s ease-in-out infinite; }
.kuhiro[data-face="sleepy"] .k-zzz { display: inline; animation: zzz 2.6s ease-in-out infinite; }
.kuhiro[data-face="sleepy"] .k-headwrap { transform: rotate(-6deg) translateY(6px); }
@keyframes zzz { 0% { opacity: 0; transform: translate(-10px, 20px); } 30% { opacity: 1; } 100% { opacity: 0; transform: translate(10px, -20px); } }
.kuhiro[data-face="surprised"] .k-eye { transform: scale(1.1); }
.kuhiro[data-face="surprised"] .k-brows { transform: translateY(-12px); }
.kuhiro[data-face="surprised"] .k-pupils circle:nth-child(2) { r: 8px; }
.kuhiro .k-brows path { transform-origin: center; transform-box: fill-box; transition: transform 0.3s var(--spring); }
.kuhiro[data-face="brave"] .k-browL { transform: translateY(6px) rotate(14deg); }
.kuhiro[data-face="brave"] .k-browR { transform: translateY(6px) rotate(-14deg); }
.kuhiro[data-face="brave"] .k-jump { transform: translateY(-6px) scale(1.03); transition: transform 0.4s var(--spring); }
.kuhiro--color [data-region] { cursor: pointer; transition: fill 0.25s; }
@media (prefers-reduced-motion: reduce) {
  .kuhiro * { animation: none !important; }
  .fog, .mote, .scene.is-active, .kuhiro-btn, .bubble, .tap-hint { animation: none !important; }
  .tap-hint { opacity: 1; }
}

/* ---------------- FRIENDS ---------------- */
.friends-rail { max-width: 1100px; margin: 0 auto; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(230px, 1fr); gap: 16px;
  overflow-x: auto; scroll-snap-type: x mandatory; padding: 8px 4px 20px; scrollbar-width: none; }
.friends-rail::-webkit-scrollbar { display: none; }
.friend { scroll-snap-align: center; display: grid; align-content: start; justify-items: center; gap: 8px; padding: 18px 16px 22px; border-radius: var(--r-lg); background: var(--surface);
  backdrop-filter: blur(20px) saturate(1.5); -webkit-backdrop-filter: blur(20px) saturate(1.5); box-shadow: var(--shadow); text-align: center; transition: transform 0.4s var(--spring); }
.friend:active { transform: scale(0.96); }
.friend-art { height: 250px; display: grid; place-items: end center; width: 100%; }
.friend-art img { height: 250px; width: auto; object-fit: contain; filter: drop-shadow(0 10px 14px rgba(10, 20, 60, 0.18)); transition: transform 0.5s var(--spring); }
.friend.is-bouncing .friend-art > * { animation: fbounce 0.7s var(--spring); }
@keyframes fbounce { 0% { transform: translateY(0); } 40% { transform: translateY(-22px) rotate(-3deg); } 100% { transform: none; } }
#friendKuhiro .kuhiro { height: 250px; width: auto; }
.friend-name { font-family: var(--font-display); font-weight: 700; font-size: var(--step-2); }
.friend-line { color: var(--ink-2); font-weight: 700; max-width: 22ch; line-height: 1.35; }

.panel { max-width: 1100px; margin: 16px auto 0; padding: 22px clamp(16px, 3vw, 32px); border-radius: var(--r-lg); background: var(--surface);
  backdrop-filter: blur(20px) saturate(1.5); -webkit-backdrop-filter: blur(20px) saturate(1.5); box-shadow: var(--shadow); }
.panel-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 16px; margin-bottom: 8px; }
.panel-head h3 { font-size: var(--step-2); }
.panel-head p { color: var(--ink-2); font-weight: 700; }
.height-chart { --unit: 1.9px; position: relative; height: calc(150 * var(--unit) + 40px); display: flex; align-items: flex-end; justify-content: space-around; gap: 4px;
  padding: 0 0 36px 36px; border-bottom: 3px solid var(--line); }
@media (min-width: 700px) { .height-chart { --unit: 2.4px; } }
.ruler { position: absolute; left: 0; bottom: 36px; top: 0; width: 30px;
  background: repeating-linear-gradient(0deg, var(--ink-2) 0 2px, transparent 2px calc(10 * var(--unit))) left bottom / 12px 100% no-repeat; opacity: 0.35; }
.hc-figure { position: relative; height: calc(var(--h) * var(--unit)); display: grid; justify-items: center; align-content: end; transition: height 0.4s var(--spring); }
.hc-figure img, .hc-figure > span, .hc-figure > svg { height: calc(var(--h) * var(--unit)); width: auto; max-width: 22vw; object-fit: contain; object-position: bottom; }
.hc-figure > span { display: block; aspect-ratio: 1080 / 1296; height: calc(var(--h) * var(--unit) / 0.97); margin-bottom: calc(var(--h) * var(--unit) * -0.028); max-width: none; }
.hc-you svg { width: calc(var(--h) * var(--unit) * 0.5); }
.hc-figure > span .kuhiro { height: 100%; width: 100%; }
.hc-figure b, .hc-figure small { position: absolute; left: 50%; transform: translateX(-50%); white-space: nowrap; }
.hc-figure b { bottom: -30px; font-family: var(--font-display); font-weight: 600; }
.hc-figure small { top: -22px; font-weight: 800; color: var(--ink-2); font-size: 0.8rem; font-variant-numeric: tabular-nums; }
.hc-figure::after { content: ""; position: absolute; left: -12px; right: -12px; top: 0; border-top: 2px dashed var(--line); }
.hc-you svg { fill: var(--accent); filter: drop-shadow(0 6px 10px color-mix(in srgb, var(--accent) 50%, transparent)); }
.slider-row { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; align-items: center; margin-top: 18px; font-family: var(--font-display); font-weight: 600; }
.slider-row output { grid-column: 1 / -1; font-family: var(--font-body); font-weight: 800; color: var(--ink-2); font-variant-numeric: tabular-nums; }
input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 44px; background: transparent; }
input[type="range"]::-webkit-slider-runnable-track { height: 12px; border-radius: 999px; background: linear-gradient(90deg, var(--accent-2), var(--accent)); }
input[type="range"]::-moz-range-track { height: 12px; border-radius: 999px; background: linear-gradient(90deg, var(--accent-2), var(--accent)); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 36px; height: 36px; margin-top: -12px; border-radius: 50%; background: var(--surface-solid); box-shadow: var(--shadow-sm), inset 0 0 0 3px var(--accent); }
input[type="range"]::-moz-range-thumb { width: 36px; height: 36px; border-radius: 50%; background: var(--surface-solid); border: 3px solid var(--accent); }
.height-say { margin-top: 6px; font-family: var(--font-display); font-weight: 600; font-size: var(--step-1); }

.fact-grid { max-width: 1100px; margin: 16px auto 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.fact { display: grid; gap: 10px; justify-items: start; text-align: left; padding: 20px; border-radius: var(--r-md); background: var(--surface);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); box-shadow: var(--shadow-sm); font-weight: 700; font-size: 1.1rem; transition: transform 0.35s var(--spring); }
.fact:active { transform: scale(0.96); }
.fact b { color: var(--scarf); }
.fact-big { font-size: 2.2rem; font-weight: 800; line-height: 1.1; color: var(--scarf); }
.fact-scarf { width: 120px; height: 36px; border-radius: 10px; background: repeating-linear-gradient(90deg, #2F6BC4 0 16px, #F4F7FD 16px 32px); box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.06); }
.fact-paws { display: flex; gap: 4px; align-items: end; height: 38px; }
.fact-paws i { width: 22px; height: 26px; border-radius: 50% 50% 45% 45%; background: linear-gradient(#6D9CE6, #3C6CC6); }
.fact-paws i:nth-child(2) { height: 32px; }

/* ---------------- MAP ---------------- */
#map { color: #F1F4FF; }
#map .eyebrow, #map .sub { color: #B9C3EA; }
.ritual { max-width: 560px; margin: 0 auto; }
.ritual-card { position: relative; display: grid; gap: 14px; justify-items: center; text-align: center; padding: 22px 18px 20px; border-radius: 34px;
  background: rgba(22, 30, 76, 0.68); backdrop-filter: blur(24px) saturate(1.4); -webkit-backdrop-filter: blur(24px) saturate(1.4);
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.12); }
.ritual h2 { font-size: var(--step-2); }
.ritual .hint { color: #C7CFF0; font-weight: 700; }
.steps { list-style: none; margin: 0; padding: 4px; display: flex; gap: 4px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); }
.steps li { padding: 6px 16px; border-radius: 999px; font-family: var(--font-display); font-weight: 600; color: #9AA5D4; transition: background 0.3s, color 0.3s; }
.steps li.is-on { background: #FFBE55; color: #331D00; }
.steps li.is-done { color: #FFD98C; }
.ritual-step { display: grid; gap: 12px; justify-items: center; width: 100%; }
.lantern-btn { position: relative; display: grid; justify-items: center; touch-action: manipulation; }
.lantern { width: min(230px, 52vw); height: auto; overflow: visible; --lantern-core: #FFE6A8; }
.lantern-glass { fill: color-mix(in srgb, var(--lantern-core) calc(var(--power, 0) * 100%), rgba(255, 255, 255, 0.12)); transition: fill 0.4s; }
.lantern-halo { opacity: calc(var(--power, 0) * 0.95); transition: opacity 0.4s; }
.lantern .crank { transition: transform 0.35s var(--spring); }
.wind-count { font-family: var(--font-display); font-weight: 600; color: #FFD98C; font-variant-numeric: tabular-nums; }
.lantern-btn.is-full .lantern { animation: lglow 1.6s ease-in-out infinite; }
@keyframes lglow { 50% { filter: drop-shadow(0 0 26px var(--lantern-core)); } }
.words { display: grid; gap: 10px; font-family: var(--font-display); font-weight: 600; font-size: clamp(1.5rem, 5vw, 2.1rem); line-height: 1.2; }
.words p { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 10px; }
.words button { padding: 4px 8px; border-radius: 12px; color: #7F8BBE; transition: color 0.25s, transform 0.35s var(--spring), text-shadow 0.3s; }
.words button.is-lit { color: #FFE3A3; text-shadow: 0 0 18px #FFBE55; transform: translateY(-3px); }
.video-frame { width: 100%; border-radius: 22px; overflow: hidden; background: #000; box-shadow: 0 0 60px -10px #FFBE55; aspect-ratio: 16 / 9; max-width: 100%; }
.video-frame video { width: 100%; height: 100%; object-fit: cover; display: block; }
.skip { font-weight: 800; color: #9AA5D4; padding: 10px 14px; border-radius: 999px; font-size: 0.95rem; }
.skip:hover { color: #FFFFFF; }

.map-view { max-width: 1100px; margin: 0 auto; display: grid; justify-items: center; gap: 4px; }
.map-head { margin-bottom: 0; }
.map-head h2 { color: #FFFFFF; }
.globe-wrap { width: 100%; display: grid; place-items: center; }
.globe { width: min(100%, 560px, 58vh); aspect-ratio: 1; max-width: 100%; touch-action: none; cursor: grab; border-radius: 50%;
  --globe-sea-a: #2B4596; --globe-sea-b: #0A1238; }
.globe:active { cursor: grabbing; }
.book-rail { width: 100%; display: grid; grid-auto-flow: column; grid-auto-columns: 150px; gap: 10px; overflow-x: auto; scroll-snap-type: x proximity; padding: 8px 2px 14px; scrollbar-width: none; }
.book-rail::-webkit-scrollbar { display: none; }
.book-chip { scroll-snap-align: center; display: grid; grid-template-columns: 22px 1fr; column-gap: 10px; row-gap: 0; align-items: center; justify-items: start; text-align: left; padding: 10px 14px; border-radius: 20px;
  background: rgba(30, 39, 92, 0.7); color: #F1F4FF; box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.1); transition: transform 0.35s var(--spring), box-shadow 0.3s; }
.book-chip:active { transform: scale(0.95); }
.book-chip .dot { grid-row: 1 / span 3; width: 22px; height: 22px; border-radius: 50%; background: var(--c); box-shadow: 0 0 16px 2px var(--c); }
.book-chip b { font-family: var(--font-display); font-weight: 600; font-size: 1.1rem; }
.book-chip small { color: #AEB8E4; font-weight: 800; }
.book-chip.is-folded { opacity: 0.72; }
.book-chip.is-folded .dot { box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.5) inset; }
.book-chip.is-sel { box-shadow: inset 0 0 0 2.5px var(--c), 0 0 24px -4px var(--c); }
.book-chip .got { min-height: 1.1em; justify-self: stretch; font-size: 0.75rem; font-weight: 800; color: #FFD98C; }
.rewind { color: #F1F4FF; background: rgba(30, 39, 92, 0.7); margin-top: 6px; }
.rewind svg path:first-child { fill: none; stroke: currentColor; }
body[data-scene="map"] .fog { opacity: 0.22; }
@media (min-width: 900px) {
  .map-view { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); align-items: center; column-gap: 32px; min-height: calc(100dvh - var(--top) - var(--dock-h) - 40px); }
  .map-head { grid-column: 1 / -1; }
  .globe { width: min(100%, 600px, 64vh); }
  .book-rail { grid-auto-flow: row; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-columns: auto; overflow: visible; align-self: center; }
}

/* ---------------- SHEET ---------------- */
.sheet-scrim { position: fixed; inset: 0; z-index: 40; background: rgba(5, 9, 30, 0.45); animation: fade 0.3s both; }
@keyframes fade { from { opacity: 0; } }
.sheet { position: fixed; z-index: 41; left: 0; right: 0; bottom: 0; margin: 0 auto; max-width: 640px; max-height: 86dvh; overflow-y: auto;
  padding: 10px 20px calc(24px + env(safe-area-inset-bottom, 0px)); border-radius: 30px 30px 0 0; background: var(--surface-solid); color: var(--ink);
  box-shadow: 0 -20px 60px -10px rgba(0, 0, 0, 0.4); animation: sheet-up 0.5s var(--ease) both; overscroll-behavior: contain; }
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: none; } }
@media (min-width: 700px) { .sheet { bottom: 24px; border-radius: 30px; max-height: calc(100dvh - 120px); } }
.sheet-grab { width: 44px; height: 5px; border-radius: 99px; background: var(--line); margin: 0 auto 10px; }
.sheet-close { position: absolute; top: 12px; right: 12px; background: var(--surface-2); box-shadow: none; }
.sheet-body { display: grid; gap: 16px; }
.sb-top { display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: center; padding-right: 40px; }
.sb-orb { width: 64px; height: 64px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #FFFFFF 0 8%, var(--c) 45%, color-mix(in srgb, var(--c) 60%, #000) 100%);
  box-shadow: 0 0 32px 4px color-mix(in srgb, var(--c) 70%, transparent); }
.sb-orb.is-pearl { background: radial-gradient(circle at 35% 30%, #fff 0 10%, #EDE6F5 45%, #CFC6E0 100%); box-shadow: 0 0 0 4px #F5B83D, 0 0 0 8px #F28DB2, 0 0 0 12px #5BBF72, 0 0 30px 12px rgba(255, 255, 255, 0.4); transform: scale(0.72); }
.sb-kicker { font-family: var(--font-display); font-weight: 600; color: var(--ink-2); font-size: 0.95rem; }
.sb-title { font-size: var(--step-2); }
.sb-glow { font-weight: 800; }
.sb-glow i { font-style: normal; padding: 1px 10px; border-radius: 999px; background: var(--c); color: #1A2550; }
.sb-card { padding: 16px 18px; border-radius: var(--r-md); background: color-mix(in srgb, var(--c) 14%, var(--surface-solid)); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--c) 35%, transparent); display: grid; gap: 8px; }
.sb-card h3 { font-size: 1.1rem; display: flex; align-items: center; gap: 8px; }
.sb-card p { font-size: 1.12rem; font-weight: 700; line-height: 1.4; }
.sb-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.sb-gift { display: grid; grid-template-columns: 64px 1fr; gap: 14px; align-items: center; }
.sb-gift svg { width: 64px; height: 64px; }
.speak { width: 40px; height: 40px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--surface-solid); box-shadow: var(--shadow-sm); flex: none; }
.speak svg { width: 20px; height: 20px; fill: var(--scarf); }

/* ---------------- PLAY ---------------- */
.play-grid { max-width: 1000px; margin: 0 auto; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
@media (min-width: 900px) { .play-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.tile { position: relative; display: grid; align-content: end; gap: 2px; min-height: 230px; padding: 16px; border-radius: 28px; text-align: left; overflow: hidden;
  color: #FFFFFF; box-shadow: var(--shadow); transition: transform 0.4s var(--spring); isolation: isolate; }
.tile:hover { transform: translateY(-4px) rotate(-0.6deg); }
.tile:active { transform: scale(0.95); }
.tile-title { font-family: var(--font-display); font-weight: 700; font-size: clamp(1.15rem, 1rem + 1vw, 1.5rem); line-height: 1.1; }
.tile-sub { font-weight: 800; opacity: 0.9; font-size: 0.92rem; }
.tile-art { position: absolute; inset: 0 0 42% 0; z-index: -1; display: grid; place-items: center; }
.tile--fog { background: linear-gradient(160deg, #7FA3D9, #3D5FA8); }
.tile-art--fog i { position: absolute; border-radius: 50%; background: rgba(255, 255, 255, 0.85); filter: blur(8px); animation: drift 9s ease-in-out infinite; }
.tile-art--fog i:nth-child(1) { width: 70%; height: 30%; top: 20%; left: 5%; }
.tile-art--fog i:nth-child(2) { width: 60%; height: 26%; top: 44%; left: 30%; animation-duration: 12s; }
.tile-art--fog i:nth-child(3) { width: 40%; height: 22%; top: 8%; left: 50%; animation-duration: 7s; }
.tile--faces { background: linear-gradient(160deg, #F7B0C2, #D9607F); }
.tile-art--faces .kuhiro { width: auto; height: 88%; margin-top: 12px; }
.tile--colour { background: linear-gradient(160deg, #8BD39A, #2F9A6A); }
.tile-art--colour { display: flex; gap: 10px; align-items: center; justify-content: center; }
.tile-art--colour i { width: 26px; height: 64px; border-radius: 8px 8px 4px 4px; background: var(--c); box-shadow: 0 6px 10px rgba(0, 0, 0, 0.2); transform: rotate(-8deg); }
.tile-art--colour i:nth-child(even) { transform: rotate(6deg) translateY(8px); }
.tile--song { background: linear-gradient(160deg, #FFCB6B, #E7862B); }
.tile-art--song svg { width: 42%; max-width: 110px; fill: #FFFFFF; stroke: #FFFFFF; stroke-width: 3; stroke-linejoin: round; animation: bop 0.88s ease-in-out infinite; }
@keyframes bop { 50% { transform: translateY(-6px) rotate(-4deg); } }

/* ---------------- GAME MODAL ---------------- */
.game { position: fixed; inset: 0; z-index: 50; display: grid; grid-template-rows: auto 1fr; background: var(--bg); animation: game-in 0.45s var(--ease) both; }
@keyframes game-in { from { opacity: 0; transform: scale(1.04); } }
.game-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(12px + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right)) 8px max(16px, env(safe-area-inset-left)); }
.game-bar h2 { font-size: var(--step-2); }
.game-body { position: relative; overflow: auto; padding: 0 max(16px, env(safe-area-inset-right)) calc(20px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left)); display: grid; align-content: start; justify-items: center; gap: 14px; }
.g-note { color: var(--ink-2); font-weight: 800; text-align: center; }
/* fog game */
.fog-stage { position: relative; width: min(100%, 720px); aspect-ratio: 4 / 3; max-height: 68dvh; border-radius: 28px; overflow: hidden; box-shadow: var(--shadow); touch-action: none; background: linear-gradient(180deg, #A9C6EC, #E9F0FA); }
.fog-scene { position: absolute; inset: 0; }
.fog-scene svg.mtns { position: absolute; inset: auto 0 0 0; width: 100%; height: 60%; }
.fog-hide { position: absolute; width: 22%; transition: transform 0.5s var(--spring); }
.fog-canvas { position: absolute; inset: 0; width: 100%; height: 100%; cursor: grab; }
.fog-found { position: absolute; left: 50%; top: 12px; transform: translateX(-50%); padding: 10px 18px; border-radius: 999px; background: var(--surface-solid); color: var(--ink);
  font-family: var(--font-display); font-weight: 600; font-size: 1.2rem; box-shadow: var(--shadow); animation: bubble-in2 0.5s var(--spring) both; white-space: nowrap; }
@keyframes bubble-in2 { from { opacity: 0; transform: translateX(-50%) scale(0.6); } }
/* faces game */
.faces-stage { width: min(72vw, 340px, 46dvh); }
.face-picks { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.face-pick { display: grid; justify-items: center; gap: 4px; width: 84px; padding: 10px 6px; border-radius: 20px; background: var(--surface); box-shadow: var(--shadow-sm); font-weight: 800; font-size: 0.9rem; transition: transform 0.35s var(--spring); }
.face-pick svg { width: 46px; height: 46px; }
.face-pick.is-on { box-shadow: inset 0 0 0 3px var(--accent), var(--shadow-sm); transform: translateY(-3px); }
/* colour game */
.colour-wrap { display: grid; gap: 14px; justify-items: center; width: 100%; }
.colour-stage { width: min(80vw, 380px, 52dvh); border-radius: 24px; overflow: hidden; box-shadow: var(--shadow); background: #FFFFFF; }
.swatches { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; max-width: 520px; }
.swatch { width: 46px; height: 46px; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 3px rgba(0, 0, 0, 0.08), var(--shadow-sm); transition: transform 0.3s var(--spring); }
.swatch.is-on { transform: scale(1.18); box-shadow: 0 0 0 3px var(--bg), 0 0 0 6px var(--ink); }
/* song */
.song-stage { display: grid; justify-items: center; gap: 8px; width: min(100%, 640px); }
.song-k { width: min(46vw, 220px, 30dvh); }
.lyrics { display: grid; gap: 6px; text-align: center; font-family: var(--font-display); font-weight: 600; font-size: clamp(1.2rem, 4vw, 1.7rem); line-height: 1.2; min-height: 7.5em; }
.lyrics p { color: var(--ink-2); opacity: 0.45; transition: all 0.35s var(--ease); }
.lyrics p.is-now { opacity: 1; color: var(--ink); transform: scale(1.08); }
.lyrics p.is-soft.is-now { color: var(--scarf); }
.song-k.is-dancing .kuhiro .k-jump, .song-k.is-dancing .kp .kp-jump { animation: dance 1s ease-in-out infinite; }
@keyframes dance { 0%, 100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-14px) rotate(3deg); } }

/* ---------------- JAR ---------------- */
.jar-layout { max-width: 1000px; margin: 0 auto; display: grid; gap: 20px; justify-items: center; }
@media (min-width: 860px) { .jar-layout { grid-template-columns: 1fr 1fr; align-items: center; min-height: calc(100dvh - var(--top) - var(--dock-h) - 40px); } }
.jar { width: min(62vw, 320px, 44dvh); height: auto; overflow: visible; filter: drop-shadow(0 20px 30px rgba(10, 20, 60, 0.18)); }
.jar-inside { fill: var(--jar-inside); }
.jar-lid { fill: #C98B34; }
.jar-label { fill: var(--surface-solid); opacity: 0.92; }
.jar-label-text { font-family: var(--font-display); font-weight: 700; font-size: 15px; letter-spacing: 0.14em; fill: var(--ink); }
.jar.is-glowing { animation: jarglow 1.4s ease-in-out 2; }
@keyframes jarglow { 50% { filter: drop-shadow(0 0 30px var(--glow)); } }
.jar-copy { display: grid; gap: 10px; }
.jar-copy h2 { font-size: var(--step-3); }
.gift-list { list-style: none; padding: 0; margin: 6px 0 8px; display: grid; gap: 8px; }
.gift-list li { display: grid; grid-template-columns: 44px 1fr auto; gap: 12px; align-items: center; padding: 10px 14px; border-radius: 18px; background: var(--surface); box-shadow: var(--shadow-sm); font-weight: 800; }
.gift-list li svg { width: 44px; height: 44px; }
.gift-list li small { color: var(--ink-2); font-weight: 700; }
.gift-list li.is-empty { opacity: 0.55; box-shadow: inset 0 0 0 2px dashed var(--line); background: var(--surface-2); }
.gift-list .dot { width: 14px; height: 14px; border-radius: 50%; background: var(--c); }

/* ---------------- GROWN-UPS ---------------- */
.doc { max-width: 980px; margin: 0 auto; padding: clamp(20px, 4vw, 44px); border-radius: var(--r-lg); background: var(--surface);
  backdrop-filter: blur(24px) saturate(1.4); -webkit-backdrop-filter: blur(24px) saturate(1.4); box-shadow: var(--shadow); display: grid; gap: 16px; }
.doc h2 { font-size: var(--step-3); }
.doc-lede { font-size: var(--step-1); color: var(--ink-2); max-width: 44rem; }
.doc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 26px 36px; margin-top: 10px; }
.doc-grid section { display: grid; gap: 10px; align-content: start; min-width: 0; }
.doc h3 { font-size: var(--step-1); }
.doc p { max-width: 62ch; }
.doc blockquote { margin: 0; padding: 12px 16px; border-radius: 16px; background: var(--surface-2); font-family: var(--font-display); font-weight: 600; font-size: 1.15rem; }
.books-h { margin-top: 18px; }
.book-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); gap: 10px; counter-reset: b; }
.book-list li { display: grid; grid-template-columns: 14px 1fr auto; gap: 12px; align-items: center; padding: 12px 16px; border-radius: 16px; background: var(--surface-2); min-width: 0; }
.book-list .dot { width: 14px; height: 14px; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.15); }
.book-list b { font-family: var(--font-display); font-weight: 600; display: block; }
.book-list small { color: var(--ink-2); font-weight: 700; }
.book-list .status { font-weight: 800; font-size: 0.8rem; padding: 3px 10px; border-radius: 999px; background: var(--surface-solid); white-space: nowrap; }
.book-list a.status { background: var(--accent); color: var(--accent-ink); text-decoration: none; }
.fine { color: var(--ink-2); font-size: var(--step--1); }
.privacy { margin-top: 12px; padding: 18px 20px; border-radius: 20px; background: var(--surface-2); display: grid; gap: 10px; }
.select { user-select: all; font-weight: 800; }

/* ---------------- DOCK ---------------- */
.dock { position: fixed; z-index: 30; left: 50%; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  display: flex; gap: 2px; padding: 6px; border-radius: 30px; background: var(--surface); width: max-content; max-width: calc(100vw - 24px);
  backdrop-filter: blur(24px) saturate(1.8); -webkit-backdrop-filter: blur(24px) saturate(1.8); box-shadow: 0 16px 40px -12px rgba(10, 20, 60, 0.45), inset 0 0 0 1px var(--line); }
body[data-scene="map"] .dock { background: rgba(22, 30, 76, 0.72); color: #F1F4FF; --line: rgba(255, 255, 255, 0.12); }
.dock-btn { position: relative; display: grid; justify-items: center; gap: 1px; width: clamp(58px, 17vw, 76px); padding: 7px 0 5px; border-radius: 24px; text-decoration: none;
  font-weight: 800; font-size: 0.74rem; color: inherit; opacity: 0.7; transition: background 0.3s, opacity 0.3s, transform 0.35s var(--spring); }
.dock-btn svg { width: 30px; height: 30px; fill: currentColor; }
.dock-btn .d-eye { fill: var(--bg); stroke: var(--bg); }
body[data-scene="map"] .dock-btn .d-eye { fill: #16204E; stroke: #16204E; }
.dock-btn:active { transform: scale(0.88); }
.dock-btn.is-on { opacity: 1; background: color-mix(in srgb, var(--accent) 26%, transparent); color: inherit; }
.dock-btn.is-on svg { fill: var(--accent); }
.badge { position: absolute; top: 2px; right: 10px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 99px; background: #E5484D; color: #FFFFFF; font-size: 0.72rem; display: grid; place-items: center; }
.badge.is-bump { animation: fbounce 0.6s var(--spring); }

/* ---------------- GATE ---------------- */
.gate { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px; background: rgba(5, 9, 30, 0.55); animation: fade 0.3s both; }
.gate-card { max-width: 380px; display: grid; gap: 14px; justify-items: center; text-align: center; padding: 26px 22px; border-radius: 28px; background: var(--surface-solid); box-shadow: var(--shadow); }
.gate-card h2 { font-size: var(--step-2); }
.gate-card p { color: var(--ink-2); font-weight: 700; }
.hold { position: relative; width: 104px; height: 104px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); font-family: var(--font-display); font-weight: 600; font-size: 1.1rem; touch-action: none; user-select: none; -webkit-user-select: none; }
.hold svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.hold-track { fill: none; stroke: var(--line); stroke-width: 4; }
.hold-fill { fill: none; stroke: var(--accent); stroke-width: 4; stroke-linecap: round; stroke-dasharray: 119.4; stroke-dashoffset: 119.4; }

/* ---------------- FX ---------------- */
.fx { position: fixed; inset: 0; z-index: 70; pointer-events: none; overflow: hidden; }
.spark { position: absolute; width: 10px; height: 10px; border-radius: 3px; animation: spark 1.1s var(--ease) forwards; }
@keyframes spark { from { transform: translate(0, 0) rotate(0); opacity: 1; } to { transform: translate(var(--x), var(--y)) rotate(var(--r)); opacity: 0; } }
.fly { position: absolute; width: 44px; height: 44px; transition: transform 0.9s cubic-bezier(0.5, -0.3, 0.3, 1.2), opacity 0.9s; }
.fly svg { width: 100%; height: 100%; }
.kuhiro--color :not([data-region]):not([data-region] *):not(g):not(svg) { pointer-events: none; }

/* ---------------- PARENTS ---------------- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.parents { max-width: 1100px; margin: 0 auto; display: grid; gap: 22px; }
.p-block, .p-hero { padding: clamp(20px, 4vw, 40px); border-radius: var(--r-lg); background: var(--surface);
  backdrop-filter: blur(24px) saturate(1.4); -webkit-backdrop-filter: blur(24px) saturate(1.4); box-shadow: var(--shadow); display: grid; gap: 12px; min-width: 0; }
.p-hero { gap: 24px; align-items: center; }
@media (min-width: 900px) { .p-hero { grid-template-columns: 1fr 1.05fr; } }
.p-hero-copy { display: grid; gap: 14px; justify-items: start; }
.p-hero h2 { font-size: var(--step-3); font-weight: 700; }
.p-hero-art { margin: 0; display: grid; gap: 8px; }
.p-hero-art img { width: 100%; height: auto; border-radius: 24px; background: #FBF7EF; }
.p-hero-art figcaption { color: var(--ink-2); font-weight: 700; font-size: var(--step--1); text-align: center; }
.p-h { font-size: var(--step-2); }
.p-block h4 { font-family: var(--font-display); font-weight: 600; font-size: 1.2rem; line-height: 1.15; margin: 0; }
.p-block p { max-width: 64ch; }
.pillars { display: grid; grid-template-columns: repeat(auto-fit, minmax(186px, 1fr)); gap: 14px; margin-top: 6px; }
.pillar { display: grid; gap: 8px; align-content: start; padding: 18px; border-radius: var(--r-md); background: var(--surface-2);
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--c) 45%, transparent); min-width: 0; }
.pillar-tag { justify-self: start; font-family: var(--font-display); font-weight: 600; font-size: 0.8rem; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 3px 10px; border-radius: 999px; background: color-mix(in srgb, var(--c) 30%, transparent); }
.rhythm { list-style: none; margin: 6px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; counter-reset: r; }
.rhythm li { counter-increment: r; display: grid; gap: 4px; align-content: start; padding: 16px; border-radius: var(--r-md); background: var(--surface-2); min-width: 0; }
.rhythm li::before { content: counter(r); width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-family: var(--font-display); font-weight: 700;
  background: linear-gradient(180deg, var(--accent-2), var(--accent)); color: var(--accent-ink); margin-bottom: 4px; }
.rhythm b { font-family: var(--font-display); font-weight: 600; font-size: 1.08rem; }
.rhythm span { color: var(--ink-2); font-weight: 700; font-size: 0.95rem; line-height: 1.4; }
.journey { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; margin-top: 8px; }
.j-card { display: grid; grid-template-rows: auto 1fr; border-radius: 22px; overflow: hidden; background: var(--surface-solid); box-shadow: var(--shadow-sm); min-width: 0; }
.j-img { position: relative; aspect-ratio: 4 / 5; max-width: 100%; }
.j-img img { width: 100%; height: 100%; object-fit: cover; }
.j-n { position: absolute; top: 10px; left: 10px; font-family: var(--font-display); font-weight: 700; font-size: 0.95rem; padding: 2px 10px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.88); color: #16214A; font-variant-numeric: tabular-nums; }
.j-body { display: grid; gap: 6px; align-content: start; padding: 14px 16px 16px; border-top: 4px solid var(--c); }
.j-country { display: flex; align-items: center; gap: 8px; font-family: var(--font-display); font-weight: 600; font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2); }
.j-country .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.15); }
.j-body p:not(.j-country) { color: var(--ink-2); font-weight: 700; font-size: 0.95rem; line-height: 1.4; }
.j-status { justify-self: start; margin-top: 2px; font-weight: 800; font-size: 0.75rem; padding: 2px 10px; border-radius: 999px; background: var(--surface-2); box-shadow: inset 0 0 0 1.5px var(--line); }
.story-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 22px 32px; margin-top: 6px; }
.story-grid article { display: grid; gap: 10px; align-content: start; min-width: 0; }
.words-row, .sound-row { display: flex; flex-wrap: wrap; gap: 6px; }
.words-row span, .sound-row span { padding: 4px 12px; border-radius: 999px; background: var(--surface-2); box-shadow: inset 0 0 0 1.5px var(--line); font-weight: 800; font-size: 0.9rem; }
.sound-row span { font-family: var(--font-display); font-weight: 600; color: var(--scarf); }
.inside { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 18px 26px; margin-top: 6px; }
.inside > div { display: grid; gap: 6px; align-content: start; min-width: 0; }
.inside p { color: var(--ink-2); font-weight: 700; font-size: 0.97rem; }
.spot { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; justify-content: space-between; padding: 18px 20px; border-radius: var(--r-md);
  background: color-mix(in srgb, var(--accent) 16%, var(--surface-solid)); }
.spot > div { display: grid; gap: 4px; min-width: 0; flex: 1 1 260px; }
.spot-answer { flex-basis: 100%; font-family: var(--font-display); font-weight: 600; font-size: 1.1rem; }
.p-news { grid-template-columns: 1fr; align-items: center; }
@media (min-width: 900px) { .p-news { grid-template-columns: 1fr 1fr; } }
.news-form { display: flex; flex-wrap: wrap; gap: 10px; }
.news-form input { flex: 1 1 220px; min-height: 56px; padding: 0 20px; border-radius: 999px; border: 0; font: inherit; font-weight: 700; color: var(--ink);
  background: var(--surface-solid); box-shadow: inset 0 0 0 2px var(--line); }
.news-form input:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.news-msg { flex-basis: 100%; font-weight: 800; color: var(--ink-2); min-height: 1.4em; }
.p-foot { text-align: center; }
.parents .privacy { margin-top: 0; }
.parents .doc-grid { margin-top: 0; }

/* ---------------- KUHIRO (character-sheet art, rigged) ---------------- */
.kp-host { border-radius: 0; }
.kp { position: relative; width: 100%; aspect-ratio: 1080 / 1296; max-width: 100%; user-select: none; -webkit-user-select: none; }
.kp img { -webkit-user-drag: none; pointer-events: none; }
.kp-shadow { position: absolute; left: 14%; right: 14%; bottom: -1%; height: 5%; border-radius: 50%; background: radial-gradient(closest-side, rgba(11, 22, 56, 0.28), rgba(11, 22, 56, 0)); }
.kp-all { position: absolute; inset: 0; transform-origin: 50% 98%; transform: translateX(var(--shift, 0px)) rotate(var(--lean, 0deg)); transition: transform 0.35s var(--ease); }
.kp-jump { position: absolute; inset: 0; transform-origin: 50% 98%; animation: kp-breathe 3.4s ease-in-out infinite; }
@keyframes kp-breathe { 0%, 100% { transform: scale(1, 1); } 50% { transform: scale(1.014, 0.986); } }
.kp-body { position: absolute; inset: 0; width: 100%; height: 100%; }
.kp-arm, .kp-scarf { position: absolute; }
.kp-arm img { width: 100%; height: 100%; display: block; }
.kp-scarf { width: auto; }
.kp-face-img, .kp-blink { position: absolute; opacity: 0; transition: opacity 0.12s linear; }
.kp[data-face="giggle"] .kp-face-img[data-f="giggle"], .kp[data-face="sleepy"] .kp-face-img[data-f="sleepy"],
.kp[data-face="surprised"] .kp-face-img[data-f="surprised"], .kp[data-face="brave"] .kp-face-img[data-f="brave"],
.kp[data-face="shy"] .kp-face-img[data-f="shy"] { opacity: 1; }
.kp.is-blinking .kp-blink { opacity: 1; transition: none; }
.kp-zzz { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; display: none; fill: #7C8FC2; font-family: Fredoka, ui-rounded, sans-serif; font-weight: 700; }
.kp[data-face="sleepy"] .kp-zzz { display: block; animation: zzz 2.6s ease-in-out infinite; }
.kp[data-face="giggle"] .kp-jump { animation: wiggle 0.9s ease-in-out infinite; }
.kp[data-face="sleepy"] .kp-all { transform: rotate(-4deg) translateY(4px); }
.kp[data-face="shy"] .kp-all { transform: rotate(3deg) translateX(-4px); }
.kp.is-waving .kp-arm { animation: kp-wave 2.5s ease-in-out both; }
@keyframes kp-wave {
  0% { transform: rotate(0deg); } 16% { transform: rotate(138deg); } 28% { transform: rotate(112deg); } 40% { transform: rotate(146deg); }
  52% { transform: rotate(112deg); } 64% { transform: rotate(146deg); } 76% { transform: rotate(122deg); } 100% { transform: rotate(0deg); } }
.kp.is-jumping .kp-jump { animation: jump 0.7s cubic-bezier(0.3, 0.7, 0.4, 1) both; }
.kp.is-wiggling .kp-jump { animation: wiggle 0.9s ease-in-out both; }
.kp.is-spinning .kp-jump { animation: spin 1s var(--ease) both; }
.kp.is-brave .kp-jump { animation: kp-brave 1.6s var(--spring) both; }
@keyframes kp-brave { 0% { transform: none; } 20% { transform: scale(0.96, 1.04) translateY(4px); } 45%, 80% { transform: translateY(-10px) scale(1.06); } 100% { transform: none; } }
@media (max-width: 520px) { @media (prefers-reduced-motion: reduce) { .kp * { animation: none !important; } }

/* ---------------- FIXES (review pass) ---------------- */
.scene.is-active { animation-fill-mode: backwards; }
.friends-rail { list-style: none; margin: 0 auto; }
.friends-rail > li { display: grid; scroll-snap-align: center; min-width: 0; }
.friends-rail > li > .friend { height: 100%; width: 100%; }
.book-rail { list-style: none; margin: 0; }
.book-rail > li { display: grid; scroll-snap-align: center; min-width: 0; }
.book-rail > li > .book-chip { width: 100%; height: 100%; }
@media (min-width: 900px) {
  .globe-wrap { grid-column: 1; }
  .book-rail { grid-column: 2; }
}
/* play tiles: art sits above the words, never behind them */
.tile { display: flex; flex-direction: column; justify-content: flex-end; min-height: 0; padding: 0 0 16px; }
.tile-art { position: relative; inset: auto; z-index: 0; height: 132px; flex: none; margin-bottom: 6px; overflow: hidden; }
.tile-title, .tile-sub { padding-inline: 16px; }
.tile-art--faces .kuhiro { height: 120px; width: auto; margin-top: 10px; }
/* colour game part buttons */
.parts { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; max-width: 560px; }
.part { min-height: 44px; padding: 0 14px; border-radius: 999px; background: var(--surface); box-shadow: var(--shadow-sm); font-weight: 800; font-size: 0.92rem; transition: transform 0.3s var(--spring); }
.part:active { transform: scale(0.94); }
.words button[aria-pressed="true"] { color: #FFE3A3; }
/* Reduced motion: stop everything that moves on its own */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
  .mote { display: none; }
}

.map-head .rewind { position: static; justify-self: center; }
@media (min-width: 900px) {
  .book-rail { gap: 8px; }
  .book-chip { padding: 8px 12px; }
  .book-chip b { font-size: 1rem; }
  .book-chip small { font-size: 0.78rem; }
  .book-chip .got { font-size: 0.7rem; min-height: 0; }
  .map-head h2 { font-size: clamp(2rem, 1.4rem + 2vw, 3.2rem); }
}
