/* Mangatique · Direction A · Lantern Night */
:root {
  color-scheme: dark light;
  /* type */
  --font-display: "Literata", Georgia, serif;
  --font-ui: "Inter", system-ui, sans-serif;
  --font-reader: "Literata", Georgia, serif;
  --font-reader-alt: "Inter", system-ui, sans-serif;
  --fw-regular: 400; --fw-medium: 500; --fw-semibold: 600; --fw-display: 600;
  --fs-xs: 13px;  --lh-xs: 18px;
  --fs-sm: 14px;  --lh-sm: 20px;
  --fs-md: 16px;  --lh-md: 24px;
  --fs-lg: 18px;  --lh-lg: 28px;
  --fs-reader: 18px; --lh-reader: 30px;
  --fs-xl: 20px;  --lh-xl: 28px;
  --fs-2xl: 24px; --lh-2xl: 30px;
  --fs-3xl: 28px; --lh-3xl: 34px;
  --fs-4xl: 34px; --lh-4xl: 40px;
  --fs-5xl: 42px; --lh-5xl: 48px;
  --ls-display: -0.01em; --ls-label: 0.04em;
  --measure-reader: 66ch;
  /* space */
  --space-1: 2px; --space-2: 4px; --space-3: 8px; --space-4: 12px; --space-5: 16px; --space-6: 20px;
  --space-7: 24px; --space-8: 32px; --space-9: 40px; --space-10: 48px; --space-11: 64px; --space-12: 80px;
  /* radius */
  --radius-sm: 6px; --radius-md: 10px; --radius-lg: 14px; --radius-xl: 18px; --radius-pill: 999px;
  /* motion */
  --dur-instant: 80ms; --dur-fast: 140ms; --dur-base: 200ms; --dur-slow: 280ms; --dur-scene: 440ms;
  --ease-out: cubic-bezier(.2,.8,.2,1); --ease-in-out: cubic-bezier(.4,0,.2,1); --ease-emphasized: cubic-bezier(.3,0,0,1);
  /* z */
  --z-sticky: 10; --z-topbar: 20; --z-dock: 30; --z-scrim: 40; --z-modal: 50; --z-toast: 60;
}
@media (min-width: 700px)  { :root { --fs-reader: 19px; --lh-reader: 32px; } }
@media (min-width: 1280px) { :root { --fs-reader: 20px; --lh-reader: 34px; } }

/* Dark */
:root, [data-theme="dark"] {
  --bg: #14161B;
  --surface: #1E2128;
  --surface-raised: #262A33;
  --text: #E7E2D8;
  --text-muted: #A8A297;
  --border: #30343E;
  --border-strong: #6A707D;
  --accent: #8DBFAE;
  --accent-hover: #A5CEC0;
  --on-accent: #14161B;
  --focus: #A5CEC0;
  --success: #9CC98B;
  --warning: #DDB063;
  --danger: #E8837A;
  --coin: #E2BC62;
  --world-kids: #7CCBA8;
  --world-young: #93A9EE;
  --world-adults: #D49A9A;
  --shadow-1: 0 1px 2px rgba(0,0,0,.30);
  --shadow-2: 0 4px 12px rgba(0,0,0,.28);
  --shadow-3: 0 12px 32px rgba(0,0,0,.36);
  --plate: color-mix(in srgb, var(--surface) 92%, transparent);
}
/* Light */
[data-theme="light"] {
  --bg: #F1EEE8;
  --surface: #F8F6F2;
  --surface-raised: #FCFBF8;
  --text: #22252C;
  --text-muted: #595D66;
  --border: #DCD8CF;
  --border-strong: #8A877F;
  --accent: #2F6B5A;
  --accent-hover: #245547;
  --on-accent: #FCFBF8;
  --focus: #2F6B5A;
  --success: #2D6A3E;
  --warning: #84570E;
  --danger: #A63A30;
  --coin: #85620C;
  --world-kids: #1F6D52;
  --world-young: #3A52A6;
  --world-adults: #9A3F48;
  --shadow-1: 0 1px 2px rgba(20,24,32,.06), 0 1px 1px rgba(20,24,32,.04);
  --shadow-2: 0 4px 12px rgba(20,24,32,.08);
  --shadow-3: 0 16px 40px rgba(20,24,32,.12);
  --plate: color-mix(in srgb, var(--surface) 92%, transparent);
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    --bg: #F1EEE8;
    --surface: #F8F6F2;
    --surface-raised: #FCFBF8;
    --text: #22252C;
    --text-muted: #595D66;
    --border: #DCD8CF;
    --border-strong: #8A877F;
    --accent: #2F6B5A;
    --accent-hover: #245547;
    --on-accent: #FCFBF8;
    --focus: #2F6B5A;
    --success: #2D6A3E;
    --warning: #84570E;
    --danger: #A63A30;
    --coin: #85620C;
    --world-kids: #1F6D52;
    --world-young: #3A52A6;
    --world-adults: #9A3F48;
    --shadow-1: 0 1px 2px rgba(20,24,32,.06), 0 1px 1px rgba(20,24,32,.04);
    --shadow-2: 0 4px 12px rgba(20,24,32,.08);
    --shadow-3: 0 16px 40px rgba(20,24,32,.12);
  }
}
/* World accent hook (replaces #phone[data-world] re-tints; bg is NOT re-tinted) */
[data-world="kids"]   { --world: var(--world-kids); }
[data-world="young"]  { --world: var(--world-young); }
[data-world="adults"] { --world: var(--world-adults); }

/* Reduced motion (system or in-app setting) */
@media (prefers-reduced-motion: reduce) {
  :root { --dur-fast: 1ms; --dur-base: 120ms; --dur-slow: 120ms; --dur-scene: 120ms; }
  *, *::before, *::after { scroll-behavior: auto !important; }
}
html[data-motion="reduce"] { --dur-fast: 1ms; --dur-base: 120ms; --dur-slow: 120ms; --dur-scene: 120ms; }


/* ---------- fonts (self-hosted, variable, latin) ---------- */
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400 600; font-display: swap; src: url(../assets/fonts/inter-var-latin.woff2) format("woff2"); }
@font-face { font-family: "Literata"; font-style: normal; font-weight: 400 600; font-display: swap; src: url(../assets/fonts/literata-var-latin.woff2) format("woff2"); }

/* ---------- reader prefs ---------- */
:root { --rs: 1; --rlh: 1.67; --safe-top: env(safe-area-inset-top,0px); --safe-bot: env(safe-area-inset-bottom,0px); --dock-h: 64px; --content: 1120px; }
@media (min-width: 1024px) { :root { --fs-reader: 20px; --lh-reader: 34px; } }
html[data-size="S"] { --rs: .9; } html[data-size="L"] { --rs: 1.12; } html[data-size="XL"] { --rs: 1.25; }
html[data-spacing="tight"] { --rlh: 1.5; } html[data-spacing="loose"] { --rlh: 1.85; }
[data-world="kids"] { --world: var(--world-kids); } [data-world="young"] { --world: var(--world-young); } [data-world="adults"] { --world: var(--world-adults); }
:root { --world: var(--accent); }

/* ---------- base ---------- */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: var(--fw-regular) var(--fs-md)/var(--lh-md) var(--font-ui); font-feature-settings: "cv11","ss01"; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; padding: 0; text-align: inherit; }
img { max-width: 100%; display: block; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent-hover); }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--radius-sm); }
.ico { flex: none; }
.vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--text-muted); }
.small { font-size: var(--fs-sm); }
.tab { font-variant-numeric: tabular-nums; }
.reader-text { font-family: var(--font-reader); font-size: calc(var(--fs-reader) * var(--rs)); line-height: var(--rlh); max-width: var(--measure-reader); font-weight: 400; margin: 0; }

#app { min-height: 100%; height: 100%; background: var(--bg); }
#phone { width: 100%; height: 100vh; height: 100dvh; position: relative; overflow: hidden; background: var(--bg); }
#screen { position: absolute; inset: 0; overflow: hidden; }

/* motion (opacity/transform only; never start at opacity 0) */
.fade { opacity: 1; }
@media (prefers-reduced-motion: no-preference) {
  html:not([data-motion="reduce"]) .fade { animation: rise var(--dur-slow) var(--ease-out); }
  html:not([data-motion="reduce"]) .fade-line { animation: rise6 var(--dur-fast) var(--ease-out); }
}
@keyframes rise { from { transform: translateY(8px); opacity: .9; } to { transform: none; opacity: 1; } }
@keyframes rise6 { from { transform: translateY(6px); opacity: .85; } to { transform: none; opacity: 1; } }

/* ---------- buttons, chips ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 20px; border-radius: var(--radius-md); font-size: var(--fs-md); font-weight: var(--fw-medium); width: 100%;
  background: var(--surface-raised); color: var(--text); border: 1px solid var(--border-strong); transition: background-color var(--dur-fast), border-color var(--dur-fast), transform var(--dur-instant); }
.btn.primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.secondary:hover { border-color: var(--text-muted); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--surface-raised); }
.btn.danger { background: var(--danger); color: var(--on-accent); border-color: var(--danger); }
.btn.lg { min-height: 56px; }
.btn.sm { min-height: 36px; padding: 0 14px; width: auto; font-size: var(--fs-sm); }
.btn:active { transform: scale(.99); }
.btn:disabled { background: var(--surface); color: var(--text-muted); border-color: var(--border); cursor: not-allowed; }
.link { color: var(--accent); font-size: var(--fs-sm); font-weight: var(--fw-medium); text-decoration: underline; text-underline-offset: 3px; min-height: 32px; padding: 0 4px; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 28px; padding: 0 10px; border-radius: var(--radius-pill); font-size: var(--fs-sm); line-height: var(--lh-sm); font-weight: var(--fw-medium);
  background: var(--surface-raised); color: var(--text); border: 1px solid var(--border); }
.chip.lock { color: var(--text-muted); }
.icon-btn { position: relative; width: 44px; height: 44px; border-radius: var(--radius-md); display: inline-grid; place-items: center; color: var(--text); flex: none; transition: background-color var(--dur-fast); }
.icon-btn:hover { background: var(--surface-raised); }
.icon-btn.sm { width: 36px; height: 36px; }
.coin-pill { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px 0 8px; border-radius: var(--radius-pill); background: var(--surface-raised); border: 1px solid var(--border); font-size: var(--fs-sm); color: var(--text); flex: none; }
.coin-pill .bal { font-weight: var(--fw-semibold); font-variant-numeric: tabular-nums; }
.coin-pill .unit { color: var(--text-muted); font-size: var(--fs-xs); }
.coin-pill:hover { border-color: var(--border-strong); }
.coin-g { flex: none; display: inline-block; vertical-align: -3px; }
.coin-chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: var(--radius-pill); flex: none; white-space: nowrap;
  color: var(--coin); background: color-mix(in srgb, var(--coin) 12%, transparent); border: 1px solid color-mix(in srgb, var(--coin) 40%, transparent); font-size: var(--fs-sm); font-weight: var(--fw-semibold); font-variant-numeric: tabular-nums; }

/* ---------- page chrome ---------- */
.page { position: absolute; inset: 0; overflow: auto; overscroll-behavior: contain; padding-bottom: calc(24px + var(--safe-bot)); }
.page.has-dock { padding-bottom: calc(var(--dock-h) + 24px + var(--safe-bot)); }
.topbar { position: sticky; top: 0; z-index: var(--z-topbar); display: flex; align-items: center; gap: 8px; min-height: 56px;
  padding: var(--safe-top) max(12px, calc((100% - var(--content)) / 2)) 0; background: var(--plate); border-bottom: 1px solid var(--border);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
.topbar .sp, .r-top .sp, .spend .sp { flex: 1; }
.brand-mini { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); font-family: var(--font-display); font-weight: var(--fw-display); font-size: var(--fs-xl); }
.brand-mini img { width: 32px; height: 32px; border-radius: var(--radius-sm); border: 1px solid var(--border); object-fit: cover; }
.world-chip { display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 12px; border-radius: var(--radius-pill); border: 1px solid var(--border); font-size: var(--fs-sm); font-weight: var(--fw-medium); }
.wdot { width: 6px; height: 6px; border-radius: 50%; background: var(--world); display: inline-block; flex: none; }
.wrap { max-width: var(--content); margin: 0 auto; padding: 24px 16px 8px; }
.wrap.narrow { max-width: 720px; }
.h1 { font-family: var(--font-display); font-weight: var(--fw-display); font-size: var(--fs-3xl); line-height: var(--lh-3xl); letter-spacing: var(--ls-display); margin: 4px 0 8px; }
.lead { color: var(--text-muted); margin: 0; max-width: 60ch; }
.sec { font-size: var(--fs-md); font-weight: var(--fw-semibold); margin: 32px 0 12px; color: var(--text); }
.note { display: flex; gap: 8px; align-items: center; margin: 24px 0 0; padding: 12px 16px; border-radius: var(--radius-md); background: var(--surface); border: 1px solid var(--border); color: var(--text-muted); font-size: var(--fs-sm); }
.note .ico { color: var(--world); }

/* world picker */
.wp-head { display: flex; gap: 16px; align-items: center; margin: 8px 0 12px; }
.wp-head .mark { width: 48px; height: 48px; border-radius: var(--radius-md); border: 1px solid var(--border); object-fit: cover; }
.wordmark { font-family: var(--font-display); font-weight: var(--fw-display); font-size: var(--fs-3xl); line-height: var(--lh-3xl); letter-spacing: var(--ls-display); margin: 0 0 4px; }
.reading-as { color: var(--text-muted); font-size: var(--fs-sm); margin: 0 0 20px; }
.reading-as b { color: var(--text); font-weight: var(--fw-semibold); }
.world-grid { display: grid; gap: 12px; }
.world-card { position: relative; display: flex; flex-direction: column; border-radius: var(--radius-lg); overflow: hidden; background: var(--surface); border: 1px solid var(--border); text-align: left; transition: border-color var(--dur-fast); }
.world-card:hover { border-color: var(--border-strong); }
.world-card .wc-img { display: block; aspect-ratio: 16/9; overflow: hidden; background: var(--surface-raised); }
.world-card .wc-img img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 35%; transition: transform var(--dur-slow) var(--ease-out); }
@media (hover: hover) and (pointer: fine) { .world-card:hover .wc-img img { transform: scale(1.03); } }
.world-card .plate { display: flex; flex-direction: column; gap: 4px; padding: 16px; background: var(--surface); border-top: 3px solid var(--world); }
.world-card .wtitle { font-family: var(--font-display); font-weight: var(--fw-display); font-size: var(--fs-2xl); line-height: var(--lh-2xl); letter-spacing: var(--ls-display); }
.world-card .wsub { color: var(--text-muted); font-size: var(--fs-sm); line-height: var(--lh-sm); }
.world-card .chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.world-card .chips .ico { color: var(--world); }
.world-card.locked .wc-img img { filter: blur(6px); transform: scale(1.06); }
.world-card:active { transform: scale(.99); }

/* story cards */
.story-grid { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 400px) { .story-grid { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; } }
.story-card { display: flex; flex-direction: column; width: 100%; border-radius: var(--radius-lg); overflow: hidden; background: var(--surface); border: 1px solid var(--border); text-align: left; transition: border-color var(--dur-fast); }
.story-card:hover { border-color: var(--border-strong); }
.story-card .sc-img { display: block; aspect-ratio: 3/4; overflow: hidden; background: var(--surface-raised); }
.story-card .sc-img img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 20%; }
.story-card .sc-panel { display: flex; flex-direction: column; gap: 6px; padding: 14px 14px 16px; align-items: flex-start; }
.story-card .sc-title { font-family: var(--font-display); font-weight: var(--fw-display); font-size: var(--fs-xl); line-height: var(--lh-xl); letter-spacing: var(--ls-display); }
.story-card .blurb { color: var(--text-muted); font-size: 15px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.story-card .meta, .meta { color: var(--text-muted); font-size: var(--fs-xs); line-height: var(--lh-xs); }
.story-card .chip { font-size: var(--fs-xs); min-height: 24px; }
.story-card.featured .sc-img { aspect-ratio: 4/3; }
.story-card.featured .sc-title { font-size: var(--fs-2xl); line-height: var(--lh-2xl); }
@media (max-width: 399px) { .story-card .sc-img { aspect-ratio: 4/3; } }

/* story page */
.story-hero { display: grid; gap: 20px; }
.sh-img { border-radius: var(--radius-lg); overflow: hidden; border: 1px solid var(--border); aspect-ratio: 16/9; background: var(--surface); }
.sh-img img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 15%; }
.sh-info .chip { margin-bottom: 4px; }
.blurb-full { color: var(--text-muted); margin: 0 0 12px; max-width: 66ch; }
.actions { display: grid; gap: 8px; margin-top: 16px; max-width: 420px; }
.rows { display: grid; gap: 8px; }
.row { display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 10px 14px; border-radius: var(--radius-md); background: var(--surface); border: 1px solid var(--border); width: 100%; text-align: left; transition: border-color var(--dur-fast); }
.row:hover { border-color: var(--border-strong); }
.row .num { width: 32px; height: 32px; border-radius: var(--radius-sm); display: grid; place-items: center; background: var(--surface-raised); color: var(--text-muted); font-size: var(--fs-sm); font-weight: var(--fw-semibold); flex: none; }
.row .row-t { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.row .row-t b { font-weight: var(--fw-medium); }
.row .row-t small { display: inline-flex; gap: 6px; align-items: center; color: var(--text-muted); font-size: var(--fs-xs); }
.row .ok { color: var(--success); display: inline-flex; gap: 4px; align-items: center; }
.row > .ico { color: var(--text-muted); }
.row.is-locked { background: transparent; border-style: dashed; border-color: var(--border-strong); }
.row.is-locked b { color: var(--text-muted); }
.row.profile .av { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-raised); box-shadow: 0 0 0 2px var(--world); font-weight: var(--fw-semibold); flex: none; }
.endings { padding: 14px 16px; border-radius: var(--radius-md); background: var(--surface); border: 1px solid var(--border); display: grid; gap: 10px; }
.end-head { display: grid; gap: 8px; font-weight: var(--fw-medium); }
.bar { display: block; height: 4px; border-radius: 2px; background: var(--surface-raised); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--success); }
.end-row { display: flex; gap: 10px; align-items: flex-start; }
.end-row .ico { color: var(--coin); margin-top: 3px; }
.end-row small { display: block; color: var(--text-muted); font-size: var(--fs-sm); }

/* dock */
.nav-dock { position: fixed; left: 0; right: 0; bottom: 0; z-index: var(--z-dock); display: grid; grid-template-columns: repeat(4, 1fr);
  height: calc(var(--dock-h) + var(--safe-bot)); padding: 0 8px var(--safe-bot); background: var(--surface); border-top: 1px solid var(--border); }
.dock-i { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 44px; color: var(--text-muted); font-size: var(--fs-xs); font-weight: var(--fw-medium); }
.dock-i.on { color: var(--accent); }
.dock-i.on::before { content: ""; position: absolute; top: 0; width: 20px; height: 3px; border-radius: 0 0 3px 3px; background: var(--accent); }
.dock-i:hover { color: var(--text); }
.dock-i.on:hover { color: var(--accent-hover); }

/* footer */
.site-footer { max-width: var(--content); margin: 40px auto 0; padding: 20px 16px 8px; border-top: 1px solid var(--border); color: var(--text-muted); font-size: var(--fs-sm); }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 4px 20px; }
.site-footer a { color: var(--text-muted); text-decoration: none; min-height: 32px; display: inline-flex; align-items: center; }
.site-footer a:hover { color: var(--text); text-decoration: underline; }
.site-footer p { margin: 8px 0 0; font-size: var(--fs-xs); }
.footer-social { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; list-style: none; margin: 14px 0 0; padding: 0; }
.footer-social li { display: flex; }
.footer-social a {
  width: 40px; height: 40px; min-width: 40px; min-height: 40px; padding: 0;
  border-radius: 50%; border: 1px solid var(--border); background: var(--surface);
  color: var(--text-muted); text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center;
}
.footer-social a:hover, .footer-social a:focus-visible {
  color: var(--text); background: var(--surface-raised); border-color: var(--border-strong);
  text-decoration: none;
}
.footer-social a:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.footer-social .ico { display: block; }

/* creator */
.preview-stage { height: clamp(240px, 46dvh, 520px); border-radius: var(--radius-lg); overflow: hidden; position: relative; margin: 12px 0 16px; background: var(--surface); border: 1px solid var(--border); }
.preview-stage img { position: absolute; left: 50%; bottom: 0; transform: translateX(-50%); max-width: 92%; max-height: 98%; object-fit: contain; object-position: bottom center; }
.lbl { display: block; font-size: var(--fs-sm); font-weight: var(--fw-medium); color: var(--text-muted); margin: 0 0 6px; }
.input { width: 100%; min-height: 48px; margin: 0 0 16px; padding: 0 14px; border-radius: var(--radius-md); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: inherit; font-size: 16px; }
.input:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.opt-group { margin-bottom: 16px; }
.opts { display: flex; flex-wrap: wrap; gap: 8px; }
.opt { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; border-radius: var(--radius-md); border: 1px solid var(--border); background: var(--surface); font-size: var(--fs-sm); font-weight: var(--fw-medium); }
.opt.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--surface)); }
.opt .coin-chip { height: 24px; font-size: var(--fs-xs); }

/* ---------- modal / sheet / toast ---------- */
.modal { position: absolute; inset: 0; z-index: var(--z-modal); display: grid; place-items: center; padding: 16px; background: color-mix(in srgb, var(--bg) 72%, transparent); }
@supports (backdrop-filter: blur(4px)) { @media (prefers-reduced-transparency: no-preference) { .modal { backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); } } }
.modal.hide { display: none !important; }
.modal-card { width: 100%; max-width: 420px; max-height: 88dvh; overflow: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-xl); padding: 20px; box-shadow: var(--shadow-3); color: var(--text); }
.modal-card h2 { font-family: var(--font-display); font-weight: var(--fw-display); font-size: var(--fs-2xl); line-height: var(--lh-2xl); margin: 10px 0 8px; letter-spacing: var(--ls-display); }
.modal-card p { margin: 0 0 12px; }
.m-ico { width: 48px; height: 48px; border-radius: var(--radius-md); display: grid; place-items: center; background: var(--surface-raised); color: var(--coin); }
.m-actions { display: grid; gap: 8px; margin-top: 16px; }
.menu-list { display: grid; gap: 8px; }
.menu-list .btn { justify-content: flex-start; }
@media (max-width: 599px) {
  .modal:has(.sheet) { place-items: end stretch; padding: 0; }
  .modal-card.sheet { max-width: none; border-radius: var(--radius-xl) var(--radius-xl) 0 0; padding-bottom: calc(20px + var(--safe-bot)); max-height: 85dvh; }
}
.sheet-handle { width: 32px; height: 4px; border-radius: 2px; background: var(--border-strong); margin: -6px auto 10px; }
@media (min-width: 600px) { .sheet-handle { display: none; } .modal-card.sheet { max-width: 440px; } }
.sh-sec { font-size: var(--fs-sm); font-weight: var(--fw-semibold); color: var(--text-muted); margin: 18px 0 8px; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; border-radius: var(--radius-md); background: var(--bg); border: 1px solid var(--border); }
.seg button { min-height: 40px; border-radius: var(--radius-sm); font-size: var(--fs-sm); font-weight: var(--fw-medium); color: var(--text-muted); text-align: center; }
.seg button.on { background: var(--surface-raised); color: var(--text); box-shadow: inset 0 0 0 1px var(--border-strong); }
.preview { margin-top: 16px !important; padding: 14px 16px; border-radius: var(--radius-md); background: var(--bg); border: 1px solid var(--border); }
.bal-big { display: flex; align-items: center; gap: 10px; }
.bal-big .n { font-size: var(--fs-4xl); line-height: var(--lh-4xl); font-weight: var(--fw-semibold); font-variant-numeric: tabular-nums; }
.earn { display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.earn .tile { width: 40px; height: 40px; border-radius: var(--radius-md); background: var(--surface-raised); display: grid; place-items: center; color: var(--coin); flex: none; }
.earn .et { flex: 1; display: grid; gap: 4px; }
.earn .et b { font-weight: var(--fw-medium); }
.earn .et small { color: var(--text-muted); font-size: var(--fs-sm); }
.toast { position: absolute; left: 50%; bottom: calc(var(--dock-h) + 16px + var(--safe-bot)); z-index: var(--z-toast); transform: translate(-50%, 12px); opacity: 0; pointer-events: none;
  max-width: min(480px, calc(100% - 32px)); padding: 12px 16px; border-radius: var(--radius-md); background: var(--surface-raised); border: 1px solid var(--border); box-shadow: var(--shadow-3); font-size: var(--fs-sm); transition: opacity var(--dur-base), transform var(--dur-base); }
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.pin-dots { display: flex; justify-content: center; gap: 12px; margin: 12px 0; }
.pin-dots span { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--border-strong); }
.pin-dots span.on { background: var(--accent); border-color: var(--accent); }
.pin-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pin-pad button { min-height: 64px; border-radius: var(--radius-md); background: var(--surface-raised); border: 1px solid var(--border); font-size: var(--fs-2xl); font-weight: var(--fw-medium); display: grid; place-items: center; }
.ad-slot { position: absolute; inset: 0; z-index: 60; background: color-mix(in srgb, var(--bg) 90%, transparent); display: grid; place-items: center; padding: 24px; }
.ad-slot.hide { display: none !important; }
.ad-inner { width: 100%; max-width: 360px; border: 1px dashed var(--border-strong); border-radius: var(--radius-lg); padding: 20px; text-align: center; background: var(--surface); display: grid; gap: 8px; }
.ad-label { font-size: var(--fs-xs); color: var(--text-muted); }

/* cookie consent */
.consent { position: fixed; left: 12px; right: 12px; bottom: calc(12px + var(--safe-bot)); z-index: 70; display: flex; justify-content: center; }
.consent-in { max-width: 760px; width: 100%; display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; padding: 16px 18px; border-radius: var(--radius-lg); background: var(--surface-raised); border: 1px solid var(--border-strong); box-shadow: var(--shadow-3); color: var(--text); }
.consent-txt { flex: 1 1 320px; font-size: var(--fs-sm); line-height: var(--lh-sm); }
.consent-txt p { margin: 0; color: var(--text-muted); }
.consent-txt .consent-t { color: var(--text); font-weight: var(--fw-semibold); margin-bottom: 4px; font-size: var(--fs-md); }
.consent-b { display: flex; gap: 8px; flex: 1 1 220px; }
.consent-b .btn { min-height: 44px; }

/* ---------- reader (A · Lantern Night) ---------- */
.rd { position: absolute; inset: 0; }
.rd .reader { position: relative; display: flex; flex-direction: column; height: 100%; overflow: hidden; background: var(--bg); }
.rd .r-top { position: relative; z-index: var(--z-topbar); display: flex; align-items: center; gap: 4px; min-height: 56px; padding: var(--safe-top) 8px 0; background: var(--plate); border-bottom: 1px solid var(--border); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
.rd .r-title { display: flex; flex-direction: column; min-width: 0; padding-left: 4px; }
.rd .r-title b { font-weight: var(--fw-semibold); font-size: var(--fs-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rd .r-title span { color: var(--text-muted); font-size: var(--fs-xs); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rd .progress { position: relative; z-index: var(--z-topbar); height: 2px; background: color-mix(in srgb, var(--border) 70%, transparent); flex: none; }
.rd .progress i { display: block; height: 100%; background: var(--accent); transition: width var(--dur-base); }
.rd .stage { position: relative; flex: 1 1 auto; min-height: 120px; }
@media (max-width: 1023px) {
  .rd .scene { position: absolute; inset: 0; aspect-ratio: auto !important; z-index: 1; }
  .rd .column { z-index: 2; }
}
.rd .bgimg { position: fixed; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; z-index: 0; }
.rd .sprites { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.rd .spr { position: absolute; bottom: 12px; height: auto; width: auto; max-height: calc(100% - 20px); max-width: 62%; object-fit: contain; object-position: bottom center; transition: filter var(--dur-base); }
.rd .spr.p-l { left: 2%; } .rd .spr.p-r { right: 2%; } .rd .spr.p-c { left: 50%; transform: translateX(-50%); }
.rd .spr.dim { filter: brightness(.78); }
.rd .advance { position: absolute; inset: 0; z-index: 3; width: 100%; cursor: pointer; }
.rd .rels { position: absolute; top: 10px; left: 12px; z-index: 4; display: flex; flex-wrap: wrap; gap: 6px; max-width: calc(100% - 24px); pointer-events: none; }
.rd .rel { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: var(--radius-pill); background: var(--surface-raised); border: 1px solid var(--border); font-size: var(--fs-xs); font-weight: var(--fw-medium); }
.rd .rel .ico { color: var(--world); }
.rd .column { position: relative; z-index: 2; flex: none; margin: 0 12px calc(12px + var(--safe-bot)); padding: 16px 20px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-xl);
  display: flex; flex-direction: column; gap: 12px; min-height: calc(3 * var(--lh-reader) + 56px); max-height: 72%; overflow: auto; }
.rd .log { display: none; }
.rd .line { display: flex; flex-direction: column; gap: 4px; }
.rd .who { display: inline-flex; align-items: center; gap: 8px; font-size: var(--fs-sm); font-weight: var(--fw-semibold); color: var(--text); font-family: var(--font-ui); }
.rd .line.narr .reader-text { color: var(--text-muted); }
.rd .line.cur.narr .reader-text { color: color-mix(in srgb, var(--text) 82%, var(--text-muted)); }
.rd .line.prev .reader-text { color: var(--text-muted); font-size: calc(var(--fs-reader) * var(--rs) * .92); }
.rd .line.prev .who { color: var(--text-muted); font-weight: var(--fw-medium); }
.rd .line-btn { position: absolute; inset: 0; z-index: 1; width: 100%; border-radius: inherit; }
.rd .cur { position: relative; z-index: 0; pointer-events: none; }
.rd .cont-hint { position: relative; z-index: 2; align-self: flex-end; display: inline-flex; align-items: center; gap: 4px; min-height: 44px; padding: 0 4px 0 10px; margin: -8px -8px -8px 0; color: var(--text-muted); font-size: var(--fs-xs); border-radius: var(--radius-md); }
.rd .cont-hint:hover { color: var(--text); }
.rd .context { color: var(--text-muted); font-size: var(--fs-md); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.rd .context b { color: var(--text); font-weight: var(--fw-semibold); }
.rd .choices { display: flex; flex-direction: column; gap: 8px; }
.rd .prompt { margin: 4px 0 0; font-size: 15px; font-weight: var(--fw-semibold); }
.rd .choice-list { display: flex; flex-direction: column; gap: 8px; }
.rd .choice-wrap { border-radius: var(--radius-md); }
.rd .choice { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 12px 14px; border-radius: var(--radius-md); background: var(--surface-raised); border: 1px solid var(--border);
  font-size: var(--fs-md); line-height: 1.4; font-weight: var(--fw-medium); color: var(--text); text-align: left; transition: background-color var(--dur-fast), border-color var(--dur-fast), transform var(--dur-instant); }
@media (hover: hover) and (pointer: fine) { .rd .choice:hover { background: color-mix(in srgb, var(--accent) 6%, var(--surface-raised)); border-color: var(--border-strong); } }
.rd .choice:active { transform: scale(.99); border-color: var(--accent); }
.rd .choice .num { width: 24px; height: 24px; border-radius: var(--radius-sm); display: grid; place-items: center; background: var(--bg); color: var(--text-muted); font-size: var(--fs-xs); font-weight: var(--fw-semibold); flex: none; }
.rd .choice .ct { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.rd .choice .ct small { display: inline-flex; align-items: center; gap: 4px; color: var(--text-muted); font-size: var(--fs-xs); font-weight: var(--fw-regular); }
.rd .choice.is-locked, .rd .choice.short { background: var(--surface); border-style: dashed; border-color: var(--border-strong); color: var(--text-muted); }
.rd .confirming .choice { background: color-mix(in srgb, var(--coin) 10%, var(--surface-raised)); box-shadow: inset 0 0 0 2px var(--coin); border-color: transparent; border-radius: var(--radius-md) var(--radius-md) 0 0; }
.rd .spend { display: flex; align-items: center; flex-wrap: nowrap; gap: 6px; padding: 8px 8px 8px 12px; border-radius: 0 0 var(--radius-md) var(--radius-md); background: color-mix(in srgb, var(--coin) 10%, var(--surface)); box-shadow: inset 0 0 0 2px var(--coin); margin-top: -2px; font-size: var(--fs-sm); }
.rd .spend .c { color: var(--coin); font-weight: var(--fw-semibold); }

@media (min-width: 600px) and (max-width: 1023px) {
  .rd .column { align-self: center; width: min(100% - 48px, 720px); padding: 20px 28px; }
  .rd .choice { font-size: var(--fs-lg); padding: 14px 20px; }
}
@media (max-height: 560px) {
  .rd .column { padding: 12px 16px; min-height: 0; }
  .rd .choice { min-height: 48px; padding: 8px 12px; }
}

/* desktop split: stage column + reading column (no blurred photo fill) */
@media (min-width: 1024px) {
  .rd .reader { display: grid; grid-template-columns: minmax(0,1fr) clamp(480px, 38vw, 580px); grid-template-rows: auto 2px minmax(0,1fr); }
  .rd .r-top { grid-column: 1 / -1; padding: 0 16px; background: var(--surface); -webkit-backdrop-filter: none; backdrop-filter: none; }
  .rd .progress { grid-column: 1 / -1; }
  .rd .stage { display: grid; place-items: center; padding: 24px; min-height: 0; background: radial-gradient(ellipse at center, color-mix(in srgb, var(--world) 8%, var(--bg)) 0%, var(--bg) 70%); }
  .rd .scene { position: relative; inset: auto; aspect-ratio: 9/16; max-width: 100%; max-height: 100%; height: 100%; border-radius: var(--radius-lg); overflow: hidden; border: 1px solid var(--border); background: var(--surface); }
  .rd .scene.land { height: auto; width: 100%; }
  .rd .bgimg { position: absolute; inset: 0; height: 100%; }
  .rd .spr { bottom: 0; max-height: 82%; max-width: 48%; }
  .rd .rels { top: 36px; left: 36px; }
  .rd .column { margin: 0; max-height: none; border: 0; border-left: 1px solid var(--border); border-radius: 0; padding: 28px 40px 28px; gap: 18px; overflow: auto; justify-content: flex-end; }
  .rd .log { display: flex; flex-direction: column; gap: 18px; }
  .rd .context { display: none; }
  .rd .choice { font-size: var(--fs-lg); padding: 14px 18px; }
  .rd .column { -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 72px); mask-image: linear-gradient(to bottom, transparent 0, #000 72px); }
}
@media (max-width: 1023px) { .rd .line.prev.last { display: none; } }

/* ---------- responsive pages ---------- */
@media (min-width: 600px) {
  .wrap { padding: 32px 24px 8px; }
  .world-grid { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 16px; }
  .world-grid .world-card:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .story-grid { grid-template-columns: repeat(3, minmax(0,1fr)); gap: 16px; }
  .nav-dock { left: 50%; right: auto; bottom: 12px; width: 560px; transform: translateX(-50%); border-radius: var(--radius-lg); border: 1px solid var(--border); box-shadow: var(--shadow-2); height: var(--dock-h); padding: 0 8px; }
  .page.has-dock { padding-bottom: calc(var(--dock-h) + 40px); }
  .toast { bottom: calc(var(--dock-h) + 28px); }
  .consent { left: 50%; right: auto; width: min(760px, calc(100% - 24px)); transform: translateX(-50%); }
  .story-card.featured { flex-direction: row; }
  .story-card.featured .sc-img { aspect-ratio: 3/4; width: 34%; flex: none; }
  .story-card.featured .sc-panel { padding: 24px 28px; justify-content: center; gap: 10px; }
  .story-card.featured .blurb { -webkit-line-clamp: 4; font-size: var(--fs-md); }
}
@media (min-width: 1024px) {
  .wrap { padding: 40px 32px 8px; }
  .h1 { font-size: var(--fs-4xl); line-height: var(--lh-4xl); }
  .wordmark { font-size: var(--fs-5xl); line-height: var(--lh-5xl); }
  .wp-head .mark { width: 56px; height: 56px; }
  .world-grid { grid-template-columns: repeat(3, minmax(0,1fr)); gap: 24px; }
  .world-grid .world-card:last-child:nth-child(odd) { grid-column: auto; }
  .world-card .wc-img { aspect-ratio: 4/5; }
  .world-card .plate { padding: 20px; }
  .world-card .wtitle { font-size: var(--fs-4xl); line-height: var(--lh-4xl); }
  .story-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 24px; }
  .story-card.featured .sc-img { width: 300px; }
  .story-card.featured .sc-title { font-size: var(--fs-3xl); line-height: var(--lh-3xl); }
  .story-hero { grid-template-columns: 5fr 7fr; gap: 40px; align-items: start; }
  .sh-img { aspect-ratio: 3/4; }
  .site-footer { padding: 20px 32px 8px; }
}
@media (min-width: 1440px) { :root { --content: 1280px; } }

/* ---------- static pages (privacy, terms, about, contact) ---------- */
.doc-body { min-height: 100%; }
.doc-top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 0 max(16px, calc((100% - 760px) / 2)); background: var(--plate); border-bottom: 1px solid var(--border); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
.doc-top .sp { flex: 1; }
.doc-top .btn { width: auto; min-height: 40px; }
.doc { max-width: 760px; margin: 0 auto; padding: 32px 16px 24px; }
.doc h1 { font-family: var(--font-display); font-weight: var(--fw-display); font-size: var(--fs-3xl); line-height: var(--lh-3xl); letter-spacing: var(--ls-display); margin: 0 0 8px; }
.doc h2 { font-family: var(--font-display); font-weight: var(--fw-display); font-size: var(--fs-xl); line-height: var(--lh-xl); margin: 32px 0 8px; }
.doc p, .doc li { font-family: var(--font-reader); font-size: 17px; line-height: 1.67; max-width: 66ch; }
.doc ul { padding-left: 1.2em; }
.doc .updated { color: var(--text-muted); font-family: var(--font-ui); font-size: var(--fs-sm); }
.doc .card { padding: 16px 20px; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--border); margin: 16px 0; }
.doc table { border-collapse: collapse; width: 100%; font-size: var(--fs-sm); margin: 12px 0; }
.doc th, .doc td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.doc th { color: var(--text-muted); font-weight: var(--fw-semibold); }
@media (min-width: 1024px) { .doc h1 { font-size: var(--fs-4xl); line-height: var(--lh-4xl); } .doc { padding-top: 48px; } }

.rd .spend > span:not(.sp) { min-width: 0; }
.rd .spend .btn.sm { padding: 0 12px; flex: none; }
.rd .spend .icon-btn.sm { flex: none; }
@media (max-width: 599px) { .topbar .brand-mini span { display: none; } }
.rd .spend .tab { white-space: nowrap; }

/* ---------- optional account (au1) ---------- */
.acct-btn { display: inline-flex; align-items: center; justify-content: center; height: 36px; min-width: 36px; padding: 0 12px; border-radius: var(--radius-pill); border: 1px solid var(--border); background: transparent; color: var(--text); font-size: var(--fs-sm); font-weight: var(--fw-medium); flex: none; cursor: pointer; }
.acct-btn:hover { background: var(--surface-raised); }
.acct-btn.signed { padding: 0; width: 36px; overflow: hidden; background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.acct-btn.signed img { width: 100%; height: 100%; object-fit: cover; display: block; }
.acct-col { display: grid; gap: 10px; margin-top: 12px; }
.acct-google { gap: 10px; }
.acct-or { display: flex; align-items: center; gap: 10px; color: var(--text-muted); font-size: var(--fs-sm); }
.acct-or::before, .acct-or::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.acct-lab { font-size: var(--fs-sm); color: var(--text-muted); }
.acct-input { width: 100%; min-height: 48px; padding: 0 14px; border-radius: var(--radius-md); border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; }
.acct-input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.acct-fine { margin-top: 8px; }
.acct-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.acct-head img, .acct-av { width: 48px; height: 48px; border-radius: 50%; flex: none; object-fit: cover; }
.acct-av { display: grid; place-items: center; background: var(--accent); color: var(--on-accent); font-weight: var(--fw-medium); font-size: 20px; }
.acct-head h2 { margin: 0; }
.acct-danger { color: var(--danger); }
.fav-btn.on { color: var(--accent); }

/* ===== r2a: critique round 2 fixes ===== */
.hide, [hidden] { display: none !important; }
/* M-sprite: on phones/tablets the sprite sits behind the top of the text box, never floating above it */
@media (max-width: 1023px) {
  .rd .spr { bottom: -14px; translate: 0 9%; max-height: calc(100% + 4px); }
}
/* S4/S5: genre-only chip, separate tagline, short blurb with Read more */
.sh-info .tagline { margin: 4px 0 10px; font-size: 16px; line-height: 1.45; color: var(--text); }
.blurb-full.clamp { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.sh-info .link.more { display: inline-flex; align-items: center; min-height: 44px; margin: -6px 0 6px; color: var(--accent); font-weight: var(--fw-medium); }
.story-card .chip { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
/* S6: room for the floating dock on desktop */
@media (min-width: 1024px) { .page.has-dock { padding-bottom: calc(var(--dock-h) + 12px + 16px + 24px); } }
/* S11: 44px touch targets in the header */
.topbar .coin-pill, .topbar .acct-btn { height: 44px; min-height: 44px; }
.acct-btn { min-width: 44px; }
.acct-btn.signed { width: 44px; }
/* S8/S9: sign-in validation and disabled provider state */
#acct-note.err { color: var(--danger); font-weight: var(--fw-medium); }
#acct-note.err::before { content: "⚠ "; }
.acct-input[aria-invalid="true"] { border-color: var(--danger); outline-color: var(--danger); }
.btn:disabled, .btn[aria-disabled="true"] { cursor: not-allowed; border-style: dashed; opacity: .6; }
.nav-dock { grid-template-columns: repeat(3, 1fr); }
@media (min-width: 1024px) { .nav-dock { width: 440px; } }
/* S1: 18+ covers on public pages stay blurred until 18+ is confirmed in this browser */
.adult-cover .sc-img { overflow: hidden; position: relative; }
.adult-cover .sc-img img { filter: blur(16px) saturate(.8); transform: scale(1.08); }
.adult-cover .sc-img::after { content: "18+"; position: absolute; inset: auto 8px 8px auto; padding: 2px 8px; border-radius: 999px; background: rgba(0,0,0,.6); color: #fff; font-size: 12px; font-weight: 600; }
.age-ok .adult-cover .sc-img img { filter: none; transform: none; }
.age-ok .adult-cover .sc-img::after { content: none; }

/* ===================== r2b · Netflix-style redesign + 3 themes ===================== */
/* Night (default) */
:root, [data-theme="dark"] {
  color-scheme: dark;
  --bg: #141414; --surface: #1F1F1F; --surface-raised: #2A2A2A;
  --text: #F3F3F3; --text-muted: #B3B3B3; --border: #2E2E2E; --border-strong: #5C5C5C;
  --accent: #E50914; --accent-hover: #F6121D; --on-accent: #FFFFFF; --focus: #FFFFFF; --link: #F3F3F3;
  --coin: #E2BC62; --danger: #FF7A70;
  --world-kids: #7CCBA8; --world-young: #93A9EE; --world-adults: #E87C86;
  --plate: color-mix(in srgb, var(--bg) 88%, transparent);
}
/* Light */
[data-theme="light"] {
  color-scheme: light;
  --bg: #FFFFFF; --surface: #F4F4F4; --surface-raised: #FFFFFF;
  --text: #141414; --text-muted: #5A5A5A; --border: #E2E2E2; --border-strong: #9A9A9A;
  --accent: #C0111A; --accent-hover: #A30E16; --on-accent: #FFFFFF; --focus: #141414; --link: #141414;
  --coin: #85620C; --danger: #A63A30;
  --world-kids: #1F6D52; --world-young: #3A52A6; --world-adults: #9A3F48;
  --shadow-2: 0 4px 14px rgba(0,0,0,.10);
  --plate: color-mix(in srgb, var(--bg) 90%, transparent);
}
/* Reading (warm paper) */
[data-theme="sepia"] {
  color-scheme: light;
  --bg: #F4ECD8; --surface: #FBF4E2; --surface-raised: #FFF9EC;
  --text: #3A2E1F; --text-muted: #6A5841; --border: #E2D4B4; --border-strong: #A8946F;
  --accent: #9A3B12; --accent-hover: #80300E; --on-accent: #FFFFFF; --focus: #3A2E1F; --link: #3A2E1F;
  --coin: #7A5A0A; --danger: #9E3328;
  --world-kids: #2B6A4C; --world-young: #3F4F94; --world-adults: #8E3B3F;
  --shadow-2: 0 4px 14px rgba(58,46,31,.12);
  --plate: color-mix(in srgb, var(--bg) 90%, transparent);
}
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.link, .sh-info .link.more { color: var(--link); }
.nf-page { --content: 1400px; }

/* top nav */
.nf-top { gap: 6px; padding-left: 12px; padding-right: 8px; background: linear-gradient(to bottom, color-mix(in srgb, var(--bg) 92%, transparent), color-mix(in srgb, var(--bg) 70%, transparent)); border-bottom: 0; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.nf-top .brand-mini { font-family: var(--font-ui); font-weight: 700; font-size: 19px; letter-spacing: -.01em; gap: 8px; }
.nf-top .brand-mini img { width: 30px; height: 30px; border: 0; border-radius: 8px; }
.nf-links { display: none; gap: 4px; margin-left: 20px; }
.nf-links button { min-height: 44px; padding: 0 12px; color: var(--text-muted); font-size: 15px; font-weight: var(--fw-medium); border-radius: 8px; }
.nf-links button:hover { color: var(--text); }
.nf-links button.on { color: var(--text); font-weight: var(--fw-semibold); }
@media (min-width: 1024px) {
  .nf-links { display: flex; }
  .nf-page .nav-dock, .page.has-dock .nav-dock { display: none; }
  .page.has-dock { padding-bottom: 32px; }
  .nf-top { padding-left: 4%; padding-right: 4%; min-height: 68px; }
}
.nav-dock { background: color-mix(in srgb, var(--bg) 94%, transparent); border-top: 1px solid var(--border); }
.dock-i.on { color: var(--text); }
.dock-i.on::before { background: var(--accent); }

/* layout */
.nf.wrap { max-width: none; padding: 0 0 24px; }
.nf-h { font-size: 18px; font-weight: var(--fw-semibold); margin: 28px 4% 10px; color: var(--text); letter-spacing: -.005em; }
.nf-pageh { font-family: var(--font-ui); font-size: 28px; font-weight: 700; margin: 20px 4% 4px; }
.nf-kicker { margin: 0 0 6px; font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); font-weight: var(--fw-semibold); }
.nf-title { font-family: var(--font-display); font-weight: 700; font-size: clamp(30px, 6vw, 56px); line-height: 1.05; margin: 0 0 10px; letter-spacing: -.015em; }
.nf-cta { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 16px 0 8px; }
.nf-cta .btn { width: auto; }
.nf-read { padding: 0 28px; font-weight: 700; font-size: 17px; border-radius: 6px; }
.nf-info { background: color-mix(in srgb, var(--surface-raised) 70%, transparent); border-radius: 6px; }
.icon-btn.lg { width: 52px; height: 52px; border-radius: 50%; border: 1.5px solid var(--border-strong); font-size: 22px; }
.fav-btn.on { border-color: var(--text); }

/* hero */
.nf-hero { position: relative; min-height: 72vh; display: flex; align-items: flex-end; overflow: hidden; margin-top: -56px; }
.nf-hero-bg { position: absolute; inset: 0; }
.nf-hero-bg img { width: 100%; height: 100%; object-fit: cover; }
.nf-hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, var(--bg) 0%, color-mix(in srgb, var(--bg) 70%, transparent) 30%, transparent 62%), linear-gradient(to bottom, color-mix(in srgb, #000 45%, transparent), transparent 22%); }
.nf-hero-in { position: relative; z-index: 1; padding: 0 5% 20px; max-width: 640px; }
.nf-hero .nf-line { margin: 0; font-size: 16px; line-height: 1.5; color: var(--text); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
[data-theme="dark"] .nf-hero-in, :root:not([data-theme]) .nf-hero-in { text-shadow: 0 1px 12px rgba(0,0,0,.55); }
@media (max-width: 1023px) {
  .nf-hero { min-height: 0; aspect-ratio: 3 / 4; max-height: 82vh; }
  .nf-hero-in { text-align: center; margin: 0 auto; }
  .nf-hero .nf-cta { justify-content: center; }
  .nf-hero .nf-line { -webkit-line-clamp: 2; font-size: 15px; }
}
@media (min-width: 1024px) {
  .nf-hero { margin-top: -68px; min-height: 0; aspect-ratio: 16 / 7; max-height: 86vh; }
  .nf-hero-bg { left: 34%; }
  .nf-hero-bg img { object-position: 50% 18% !important; }
  .nf-hero::after { background: linear-gradient(to right, var(--bg) 34%, color-mix(in srgb, var(--bg) 60%, transparent) 50%, transparent 72%), linear-gradient(to top, var(--bg) 0%, transparent 30%); }
  .nf-hero-in { padding: 0 4% 64px; }
}

/* rows + poster cards */
.nf-row { position: relative; }
.nf-scroll { display: grid; grid-auto-flow: column; grid-auto-columns: 38%; gap: 8px; overflow-x: auto; padding: 4px 4% 12px; scroll-snap-type: x mandatory; scroll-padding: 0 4%; scrollbar-width: none; overscroll-behavior-x: contain; }
.nf-scroll::-webkit-scrollbar { display: none; }
@media (min-width: 600px) { .nf-scroll { grid-auto-columns: 24%; } }
@media (min-width: 1024px) { .nf-scroll { grid-auto-columns: calc((100% - 8% - 5 * 10px) / 6.3); gap: 10px; } }
.nf-card { position: relative; display: block; scroll-snap-align: start; text-align: left; border-radius: 6px; transition: transform var(--dur-base) var(--ease-out); }
.nf-img { display: block; aspect-ratio: 3 / 4; border-radius: 6px; overflow: hidden; background: var(--surface-raised); }
.nf-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.nf-t { display: block; margin-top: 6px; font-size: 14px; line-height: 1.3; font-weight: var(--fw-medium); color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nf-bar { position: absolute; left: 6px; right: 6px; top: calc(100% - 34px); height: 3px; border-radius: 3px; background: rgba(255,255,255,.35); overflow: hidden; }
.nf-bar i { display: block; height: 100%; background: var(--accent); }
@media (hover: hover) and (pointer: fine) {
  .nf-card:hover { transform: scale(1.06); z-index: 2; }
  .nf-card:hover .nf-img { box-shadow: 0 10px 28px rgba(0,0,0,.45); }
}
.nf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; padding: 0 4%; }
@media (min-width: 1024px) { .nf-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); } }
.g-ad-row { margin: 16px 4%; }

/* story detail */
.nf-detail .story-hero { position: relative; display: grid; gap: 18px; padding: 8px 4% 8px; overflow: hidden; }
.nf-dbg { position: absolute; inset: -40px; z-index: 0; opacity: .35; }
.nf-dbg img { width: 100%; height: 100%; object-fit: cover; filter: blur(40px) saturate(1.2); }
.nf-detail .story-hero > :not(.nf-dbg) { position: relative; z-index: 1; }
.nf-detail .sh-img { border: 0; border-radius: 10px; box-shadow: var(--shadow-3); aspect-ratio: 16 / 9; }
.nf-detail .nf-meta { color: var(--text-muted); font-size: 14px; margin: 0; }
.nf-detail .tagline { font-size: 17px; margin: 14px 0 6px; }
.nf-detail .blurb-full { color: var(--text-muted); font-size: 15.5px; line-height: 1.6; }
.nf-note { color: var(--text-muted); font-size: 13px; display: flex; gap: 6px; align-items: center; }
.nf-detail .g-share { margin: 6px 4% 0; }
.nf-chapters { margin: 20px 4% 0; border-top: 1px solid var(--border); }
.nf-chapters summary { list-style: none; cursor: pointer; min-height: 52px; display: flex; align-items: center; justify-content: space-between; font-weight: var(--fw-semibold); font-size: 17px; }
.nf-chapters summary::after { content: "+"; font-size: 22px; color: var(--text-muted); }
.nf-chapters[open] summary::after { content: "–"; }
.nf-chapters summary::-webkit-details-marker { display: none; }
.nf-endings { margin: 0 4%; }
.nf-endings .nf-h { margin-left: 0; }
.nf-detail .g-rail { margin: 0; }
.nf-detail .g-rail .sec { margin: 28px 4% 10px; font-size: 18px; }
.nf-detail .g-row { padding: 0 4%; }
@media (min-width: 1024px) {
  .nf-detail .story-hero { grid-template-columns: minmax(260px, 360px) 1fr; gap: 48px; align-items: center; padding: 32px 4% 16px; }
  .nf-detail .sh-img { aspect-ratio: 3 / 4; }
  .nf-detail .sh-img img { object-position: 50% 50% !important; }
  .nf-detail .sh-info { max-width: 720px; }
}

/* world picker + profiles */
.nf-worlds { padding: 8px 4% 24px !important; max-width: 1100px !important; margin: 0 auto; }
.nf-q { font-size: clamp(26px, 5vw, 40px); font-weight: 700; text-align: center; margin: 24px 0 6px; letter-spacing: -.01em; }
.nf-sub { text-align: center; color: var(--text-muted); margin: 0 0 24px; font-size: 16px; }
.nf-worlds .world-grid { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.nf-worlds .world-card { border: 0; border-radius: 10px; background: var(--surface); }
.nf-worlds .world-card .wc-img { aspect-ratio: 4 / 3; }
.nf-worlds .world-card .plate { border-top: 0; flex-direction: row; align-items: baseline; justify-content: space-between; gap: 8px; }
.nf-worlds .world-card .wtitle { font-family: var(--font-ui); font-weight: 700; font-size: 20px; }
@media (hover: hover) and (pointer: fine) { .nf-worlds .world-card:hover { transform: scale(1.03); } .nf-worlds .world-card { transition: transform var(--dur-base) var(--ease-out); } }
.nf-worlds .reading-as { text-align: center; margin-top: 20px; }
.nf-prof { padding: 0 4% 24px !important; max-width: 760px !important; margin: 0 auto; }
.nf-prof .nf-pageh { margin-left: 0; text-align: center; }
.nf-prof .nf-h { margin-left: 0; margin-right: 0; }
.nf-avatars { display: flex; flex-wrap: wrap; justify-content: center; gap: 18px; margin: 20px 0 8px; }
.nf-av { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 96px; color: var(--text-muted); }
.nf-av .av { width: 84px; height: 84px; border-radius: 10px; display: grid; place-items: center; font-size: 34px; font-weight: 700; color: #fff; background: var(--world); border: 3px solid transparent; }
.nf-av.on .av { border-color: var(--text); }
.nf-av b { color: var(--text); font-weight: var(--fw-medium); }
.nf-av small { font-size: 12px; }
.nf-theme { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.nf-theme button { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 72px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-weight: var(--fw-medium); }
.nf-theme button.on { border: 2px solid var(--text); }
.nf-streak { margin-top: 20px; }
.nf-prof .row { min-height: 60px; }
.theme-btn .ico { display: block; }
.site-footer { opacity: .9; }

/* reader: themed text box and choices stay AA in all three themes */
.rd .column { background: color-mix(in srgb, var(--surface) 96%, transparent); }
.rd .choice { color: var(--text); }
[data-theme="sepia"] .rd .reader, [data-theme="light"] .rd .reader { background: var(--bg); }
[data-theme="sepia"] .rd .line.narr .reader-text, [data-theme="light"] .rd .line.narr .reader-text { color: var(--text); }
.nf-endcol { display: flex; flex-direction: column; gap: 12px; align-items: stretch; }
.nf-endcol .reader-text { margin: 0; color: var(--text-muted); }

/* ===================== p1 · fast images + round-3 fixes (look unchanged) ===================== */
/* image placeholders: solid theme surface while WebP loads; no layout jump (fixed aspect boxes) */
.nf-img, .sh-img, .wc-img, .nf-hero-bg { background-color: var(--surface-raised); }
.nf-img img, .sh-img img, .wc-img img { color: transparent; }
/* M1 · hero text ≥4.5:1 in every theme: text sits on the solid part of the scrim; solid text colours */
:root, [data-theme="dark"] { --accent-hover: #C20811; }
.nf-hero .nf-kicker { color: var(--text); font-weight: 600; opacity: 1; }
.nf-hero .nf-line { color: var(--text); }
.nf-hero .nf-read, .nf-hero .nf-read:hover, .nf-hero .nf-read:active { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
[data-theme="dark"] .nf-hero .nf-read:hover, :root:not([data-theme]) .nf-hero .nf-read:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
@media (max-width: 1023px) {
  .nf-hero::after { background: linear-gradient(to top, var(--bg) 0%, var(--bg) 36%, color-mix(in srgb, var(--bg) 86%, transparent) 47%, color-mix(in srgb, var(--bg) 40%, transparent) 60%, transparent 74%), linear-gradient(to bottom, color-mix(in srgb, #000 45%, transparent), transparent 22%); }
}
@media (min-width: 1024px) {
  .nf-hero::after { background: linear-gradient(to right, var(--bg) 0%, var(--bg) 36%, color-mix(in srgb, var(--bg) 82%, transparent) 46%, color-mix(in srgb, var(--bg) 35%, transparent) 58%, transparent 72%), linear-gradient(to top, var(--bg) 0%, transparent 30%); }
  .nf-hero-in { max-width: min(640px, 38%); }
}
/* M4 · desktop rows: ‹ › paddles, peek, hover zoom not clipped */
.nf-pad { display: none; }
@media (hover: hover) and (pointer: fine) {
  .nf-scroll { padding-top: 14px; padding-bottom: 18px; margin-top: -10px; margin-bottom: -6px; }
  .nf-card:first-child { transform-origin: left center; }
  .nf-card:last-child { transform-origin: right center; }
  .nf-pad { display: flex; position: absolute; z-index: 3; top: 66px; bottom: 44px; width: max(44px, 3.6%); align-items: center; justify-content: center;
    border: 0; padding: 0; font-size: 46px; line-height: 1; color: var(--text); background: color-mix(in srgb, var(--bg) 62%, transparent); opacity: 0; transition: opacity var(--dur-base); cursor: pointer; }
  .nf-pad.prev { left: 0; border-radius: 0 6px 6px 0; } .nf-pad.next { right: 0; border-radius: 6px 0 0 6px; }
  .nf-row:hover .nf-pad { opacity: 1; }
  .nf-pad:hover { background: color-mix(in srgb, var(--bg) 80%, transparent); }
  .nf-row.at-start .nf-pad.prev, .nf-row.at-end .nf-pad.next, .nf-row.no-over .nf-pad { display: none; }
}
/* M5 · sign-in legal links on the dark dialog */
[data-theme="dark"] .acct-fine a, :root:not([data-theme]) .acct-fine a { color: #FF4D57; }
/* M6 · no empty boxes on story pages */
.nf-endings:empty, .endings:empty { display: none; }
/* S3 · dock active marker stays inside the bar */
.dock-i.on::before { top: 3px; height: 3px; border-radius: 3px; }
/* S4 · profiles: Leaderboard is a normal row; settings grouped apart from the picker */
.rows a.row, .rows a.row:hover { color: var(--text); text-decoration: none; }
.nf-settings { margin-top: 28px; padding-top: 8px; border-top: 1px solid var(--border); }
.nf-sec-h { font-size: 22px; font-weight: 700; margin: 16px 0 0; }
/* S7 · Light coin chip ≥4.5:1 */
[data-theme="light"] .coin-chip { color: #6E510A; }
/* S9 · Light/Reading story header: blurred art capped so the band stays white/paper */
[data-theme="light"] .nf-dbg, [data-theme="sepia"] .nf-dbg { opacity: .16; }
/* p3 · story text loading */
.mq-busy, .mq-busy * { cursor: progress !important; }

/* ===== m1 · opt-in character staging (transform/opacity only; existing stories unchanged) ===== */
:root { --dur-stage: 760ms; --ease-stage: cubic-bezier(.22,.7,.2,1); }
@media (prefers-reduced-motion: reduce) {
  :root { --dur-stage: 1ms; }
}
html[data-motion="reduce"] { --dur-stage: 1ms; }

/* slot carries position so motion transforms on .spr-act don't fight centering */
.rd .spr-slot {
  position: absolute;
  bottom: 12px;
  height: calc(100% - 20px);
  width: max-content;
  max-width: 80%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  pointer-events: none;
  z-index: 1;
}
.rd .spr-slot:only-child { max-width: 94%; }
.rd .spr-slot.s-duo { left: 50%; right: auto; transform: translateX(-50%); max-width: 96%; width: auto; z-index: 2; }
.rd .spr-slot.p-l { left: 0; }
.rd .spr-slot.p-r { right: 0; }
.rd .spr-slot.p-c { left: 50%; transform: translateX(-50%); }
.rd .spr-slot.has-talk, .rd .spr-slot.s-front { z-index: 2; }
.rd .spr-slot.is-dim { z-index: 1; }
.rd .spr-act {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  position: relative;
  max-height: 100%;
  max-width: 100%;
  transform-origin: 50% 100%;
  backface-visibility: hidden;
}
.rd .spr-slot .spr {
  position: relative;
  left: auto;
  right: auto;
  bottom: 0;
  max-height: 100%;
  max-width: 100%;
  width: auto;
  height: auto;
  translate: none;
  object-fit: contain;
  object-position: bottom center;
}
.rd .spr-act.s-run { will-change: transform; }

/* mobile: short-drama scale — fill most of the area above the dialogue box;
   legs may tuck behind the box (z-index keeps text on top).
   Use top+bottom so the slot has a definite height (same pattern as desktop).
   height:100% + max-height:none let width-driven PNG height overflow the
   stage, so heads ran under the reader toolbar and out of the viewport. */
@media (max-width: 1023px) {
  .rd .spr-slot {
    top: 0;
    bottom: -6%;
    height: auto;
    max-height: none;
    max-width: 82%;
    translate: none;
  }
  .rd .spr-slot:only-child { max-width: 96%; }
  .rd .spr-slot.s-duo { max-width: 98%; }
  .rd .spr-act { height: 100%; width: auto; max-height: 100%; max-width: 100%; min-height: 0; }
  .rd .spr-slot .spr {
    bottom: 0;
    translate: none;
    height: 100%;
    width: auto;
    max-height: 100%;
    max-width: 100%;
    object-fit: contain;
    object-position: bottom center;
  }
}
@media (min-width: 1024px) {
  /* top+bottom gives the slot a definite height even when .scene.land
     sizes from aspect-ratio (height:auto). height:100% would not resolve,
     and intrinsic PNG size would overflow the frame and clip heads. */
  .rd .spr-slot {
    top: 2%;
    bottom: -4%;
    height: auto;
    max-height: none;
    max-width: 62%;
  }
  .rd .spr-slot:only-child { max-width: 78%; }
  .rd .spr-slot.s-duo { max-width: 88%; }
  .rd .spr-act { height: 100%; width: auto; max-height: 100%; max-width: 100%; min-height: 0; }
  .rd .spr-slot .spr {
    bottom: 0;
    height: 100%;
    width: auto;
    max-height: 100%;
    max-width: 100%;
    object-fit: contain;
    object-position: bottom center;
  }
}

/* held end-poses (applied even with reduced motion; animation is opt-in below) */
.rd .spr-act.s-approach { transform: scale(1.2) translateY(6%); }
.rd .spr-act.s-retreat { transform: scale(.84) translateY(-2%); }
.rd .spr-slot.p-l .spr-act.s-lean { transform: rotate(5deg) translateX(10%); }
.rd .spr-slot.p-r .spr-act.s-lean { transform: rotate(-5deg) translateX(-10%); }
.rd .spr-slot.p-c .spr-act.s-lean { transform: rotate(-3deg) scale(1.06) translateY(2%); }
.rd .spr-act.s-sleep { transform-origin: 50% 18%; transform: rotate(-4deg) translateY(var(--sleep-drop, 0%)); filter: brightness(.82) saturate(.9); }
/* Seated sleep sprites have no furniture. On mobile the dialogue panel covers
   the room's floor/sofa, so drop the sprite until the thigh-line meets the
   panel. On desktop there is no general drop (it would sink through
   foreground furniture). A soft contact shadow grounds the seat. */
:root { --sleep-drop: 0%; }
@media (max-width: 1023px) { :root { --sleep-drop: 24%; } }
.rd .spr-act.s-sleep::after {
  content: "";
  position: absolute;
  left: 16%;
  right: 16%;
  top: 64%;
  height: 10%;
  border-radius: 50%;
  background: radial-gradient(ellipse at 50% 50%, rgba(0,0,0,.5) 0%, rgba(0,0,0,.22) 42%, transparent 72%);
  pointer-events: none;
  z-index: 0;
}
.rd .spr-act.s-sleep .spr { position: relative; z-index: 1; }
/* Beat-specific close-up seating for three sleep beats only.
   Unique background files, so unrelated lodge/suite/cabin scenes are untouched.
   No general desktop drop; sleep-drop is zeroed here so seated hips stay on the cushion. */
.rd .scene[data-src="assets/bg/adults/act-of-dragon-lodge-sofa.jpg"],
.rd .scene[data-src="assets/bg/adults/holding-pattern-suite-sofa.jpg"],
.rd .scene[data-src="assets/bg/adults/holding-pattern-cabin-seats.jpg"] {
  --sleep-drop: 0%;
}
.rd .scene[data-src="assets/bg/adults/act-of-dragon-lodge-sofa.jpg"] .spr-slot.s-duo .spr-act,
.rd .scene[data-src="assets/bg/adults/act-of-dragon-lodge-sofa.jpg"] .spr-slot.s-duo .spr,
.rd .scene[data-src="assets/bg/adults/holding-pattern-suite-sofa.jpg"] .spr-slot .spr-act,
.rd .scene[data-src="assets/bg/adults/holding-pattern-suite-sofa.jpg"] .spr-slot .spr,
.rd .scene[data-src="assets/bg/adults/holding-pattern-cabin-seats.jpg"] .spr-slot.s-duo .spr-act,
.rd .scene[data-src="assets/bg/adults/holding-pattern-cabin-seats.jpg"] .spr-slot.s-duo .spr {
  height: 100%;
  width: auto;
  max-height: 100%;
  max-width: 100%;
  object-fit: contain;
  object-position: bottom center;
}

@media (max-width: 1023px) {
  /* Keep these close-ups in the scene box so the sofa lines up with the sprites
     (default mobile bgimg is fixed to the full viewport). */
  .rd .scene[data-src="assets/bg/adults/act-of-dragon-lodge-sofa.jpg"] .bgimg,
  .rd .scene[data-src="assets/bg/adults/holding-pattern-suite-sofa.jpg"] .bgimg,
  .rd .scene[data-src="assets/bg/adults/holding-pattern-cabin-seats.jpg"] .bgimg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 50% 50%;
  }
  .rd .scene[data-src="assets/bg/adults/act-of-dragon-lodge-sofa.jpg"] .spr-slot.s-duo {
    left: 50%;
    right: auto;
    top: auto;
    bottom: -2%;
    width: 115%;
    max-width: 120%;
    height: 90%;
    transform: translateX(-50%);
  }
  .rd .scene[data-src="assets/bg/adults/holding-pattern-cabin-seats.jpg"] .spr-slot.s-duo {
    left: 48%;
    right: auto;
    top: auto;
    bottom: -18%;
    width: 102%;
    max-width: 110%;
    height: 112%;
    transform: translateX(-50%);
  }
  .rd .scene[data-src="assets/bg/adults/holding-pattern-suite-sofa.jpg"] .bgimg {
    object-position: 38% 50%;
  }
  .rd .scene[data-src="assets/bg/adults/holding-pattern-suite-sofa.jpg"] .spr-slot.p-l {
    left: -6%;
    top: auto;
    bottom: 0;
    width: 72%;
    max-width: 80%;
    height: 95%;
  }
  .rd .scene[data-src="assets/bg/adults/holding-pattern-suite-sofa.jpg"] .spr-slot.p-r {
    left: auto;
    right: -8%;
    top: auto;
    bottom: -4%;
    width: 82%;
    max-width: 90%;
    height: 88%;
  }
}

@media (min-width: 1024px) {
  .rd .scene[data-src="assets/bg/adults/act-of-dragon-lodge-sofa.jpg"] .spr-slot.s-duo {
    left: 46%;
    right: auto;
    top: auto;
    bottom: -6%;
    width: 54%;
    max-width: 62%;
    height: 96%;
    transform: translateX(-50%);
  }
  .rd .scene[data-src="assets/bg/adults/holding-pattern-cabin-seats.jpg"] .spr-slot.s-duo {
    left: 48%;
    right: auto;
    top: auto;
    bottom: -20%;
    width: 52%;
    max-width: 58%;
    height: 114%;
    transform: translateX(-50%);
  }
  .rd .scene[data-src="assets/bg/adults/holding-pattern-suite-sofa.jpg"] .spr-slot.p-l {
    left: 1%;
    top: auto;
    bottom: 0;
    width: 36%;
    max-width: 40%;
    height: 100%;
  }
  .rd .scene[data-src="assets/bg/adults/holding-pattern-suite-sofa.jpg"] .spr-slot.p-r {
    left: auto;
    right: 6%;
    top: auto;
    bottom: -4%;
    width: 44%;
    max-width: 50%;
    height: 94%;
  }
}

.rd .spr-act.s-turn { transform: scaleX(-1); }
.rd .spr-slot.p-l .spr-act.s-hug { transform: translateX(44%) scale(1.06); }
.rd .spr-slot.p-r .spr-act.s-hug { transform: translateX(-44%) scale(1.06); }
.rd .spr-slot.p-c .spr-act.s-hug { transform: scale(1.08) translateY(2%); }
.rd .spr-slot.p-l .spr-act.s-together { transform: translateX(22%) scale(1.03); }
.rd .spr-slot.p-r .spr-act.s-together { transform: translateX(-22%) scale(1.03); }
.rd .spr-slot.p-c .spr-act.s-together { transform: scale(1.04); }
.rd .spr-act.s-enter-left,
.rd .spr-act.s-enter-right { transform: translateX(0); }
.rd .spr-act.s-exit-right { transform: translateX(140%); }
.rd .spr-act.s-exit-left { transform: translateX(-140%); }

/* sleep: soft vignette on the scene (no lie-down, no zzz) */
.rd .scene:has(.spr-act.s-sleep)::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 36%, transparent 42%, rgba(0,0,0,.4) 100%);
}
[data-theme="light"] .rd .scene:has(.spr-act.s-sleep)::after {
  background: radial-gradient(ellipse at 50% 36%, transparent 46%, rgba(40,32,24,.28) 100%);
}
[data-theme="sepia"] .rd .scene:has(.spr-act.s-sleep)::after {
  background: radial-gradient(ellipse at 50% 36%, transparent 46%, rgba(50,32,12,.32) 100%);
}

@media (prefers-reduced-motion: no-preference) {
  html:not([data-motion="reduce"]) .rd .spr {
    animation: mq-idle 4.8s var(--ease-in-out) infinite;
  }
  html:not([data-motion="reduce"]) .rd .bgimg {
    animation: mq-kb 28s var(--ease-in-out) alternate infinite;
    transform-origin: 50% 42%;
  }
  html:not([data-motion="reduce"]) .rd .spr-act.s-approach.s-run { animation: mq-approach var(--dur-stage) var(--ease-stage) both; }
  html:not([data-motion="reduce"]) .rd .spr-act.s-retreat.s-run { animation: mq-retreat var(--dur-stage) var(--ease-stage) both; }
  html:not([data-motion="reduce"]) .rd .spr-slot.p-l .spr-act.s-lean.s-run { animation: mq-lean-l var(--dur-stage) var(--ease-stage) both; }
  html:not([data-motion="reduce"]) .rd .spr-slot.p-r .spr-act.s-lean.s-run { animation: mq-lean-r var(--dur-stage) var(--ease-stage) both; }
  html:not([data-motion="reduce"]) .rd .spr-slot.p-c .spr-act.s-lean.s-run { animation: mq-lean-c var(--dur-stage) var(--ease-stage) both; }
  html:not([data-motion="reduce"]) .rd .spr-act.s-sleep { animation: mq-sleep-breathe 3.8s var(--ease-in-out) infinite; }
  html:not([data-motion="reduce"]) .rd .spr-act.s-sleep.s-run { animation: mq-sleep-in var(--dur-stage) var(--ease-stage) both, mq-sleep-breathe 3.8s var(--ease-in-out) 760ms infinite; }
  html:not([data-motion="reduce"]) .rd .spr-act.s-sleep .spr { animation: mq-sleep-idle 3.8s var(--ease-in-out) infinite; }
  html:not([data-motion="reduce"]) .rd .spr-act.s-turn.s-run { animation: mq-turn var(--dur-stage) var(--ease-stage) both; }
  html:not([data-motion="reduce"]) .rd .spr-slot.p-l .spr-act.s-hug.s-run { animation: mq-hug-l var(--dur-stage) var(--ease-stage) both; }
  html:not([data-motion="reduce"]) .rd .spr-slot.p-r .spr-act.s-hug.s-run { animation: mq-hug-r var(--dur-stage) var(--ease-stage) both; }
  html:not([data-motion="reduce"]) .rd .spr-slot.p-c .spr-act.s-hug.s-run { animation: mq-hug-c var(--dur-stage) var(--ease-stage) both; }
  html:not([data-motion="reduce"]) .rd .spr-slot.p-l .spr-act.s-together.s-run { animation: mq-tog-l var(--dur-stage) var(--ease-stage) both; }
  html:not([data-motion="reduce"]) .rd .spr-slot.p-r .spr-act.s-together.s-run { animation: mq-tog-r var(--dur-stage) var(--ease-stage) both; }
  html:not([data-motion="reduce"]) .rd .spr-slot.p-c .spr-act.s-together.s-run { animation: mq-tog-c var(--dur-stage) var(--ease-stage) both; }
  html:not([data-motion="reduce"]) .rd .spr-act.s-enter-left.s-run { animation: mq-enter-l var(--dur-stage) var(--ease-stage) both; }
  html:not([data-motion="reduce"]) .rd .spr-act.s-enter-right.s-run { animation: mq-enter-r var(--dur-stage) var(--ease-stage) both; }
  html:not([data-motion="reduce"]) .rd .spr-act.s-exit-right.s-run { animation: mq-exit-r var(--dur-stage) var(--ease-stage) both; }
  html:not([data-motion="reduce"]) .rd .spr-act.s-exit-left.s-run { animation: mq-exit-l var(--dur-stage) var(--ease-stage) both; }
  html:not([data-motion="reduce"]) .rd .spr-act.s-shake { animation: mq-shake 520ms var(--ease-in-out) both; }

}

@keyframes mq-idle {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-1.4%) scale(1.01); }
}
@keyframes mq-kb {
  0% { transform: scale(1) translate(0, 0); }
  100% { transform: scale(1.06) translate(1.1%, -.7%); }
}
@keyframes mq-approach {
  from { transform: scale(1) translateY(0); }
  to { transform: scale(1.2) translateY(6%); }
}
@keyframes mq-retreat {
  from { transform: scale(1) translateY(0); }
  to { transform: scale(.84) translateY(-2%); }
}
@keyframes mq-lean-l {
  from { transform: rotate(0deg) translateX(0); }
  to { transform: rotate(5deg) translateX(10%); }
}
@keyframes mq-lean-r {
  from { transform: rotate(0deg) translateX(0); }
  to { transform: rotate(-5deg) translateX(-10%); }
}
@keyframes mq-lean-c {
  from { transform: rotate(0deg) scale(1) translateY(0); }
  to { transform: rotate(-3deg) scale(1.06) translateY(2%); }
}
@keyframes mq-sleep-in {
  from { transform: rotate(0deg) translateY(var(--sleep-drop, 0%)); filter: brightness(1) saturate(1); }
  to { transform: rotate(-4deg) translateY(var(--sleep-drop, 0%)); filter: brightness(.82) saturate(.9); }
}
@keyframes mq-sleep-breathe {
  0%, 100% { transform: rotate(-4deg) translateY(var(--sleep-drop, 0%)) scale(1); }
  50% { transform: rotate(-4deg) translateY(var(--sleep-drop, 0%)) scale(1.015); }
}
@keyframes mq-sleep-idle {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(1%) scale(1.01); }
}
@keyframes mq-turn {
  from { transform: scaleX(1); }
  to { transform: scaleX(-1); }
}
@keyframes mq-hug-l {
  from { transform: translateX(0) scale(1); }
  to { transform: translateX(44%) scale(1.06); }
}
@keyframes mq-hug-r {
  from { transform: translateX(0) scale(1); }
  to { transform: translateX(-44%) scale(1.06); }
}
@keyframes mq-hug-c {
  from { transform: scale(1) translateY(0); }
  to { transform: scale(1.08) translateY(2%); }
}
@keyframes mq-tog-l {
  from { transform: translateX(0) scale(1); }
  to { transform: translateX(22%) scale(1.03); }
}
@keyframes mq-tog-r {
  from { transform: translateX(0) scale(1); }
  to { transform: translateX(-22%) scale(1.03); }
}
@keyframes mq-tog-c {
  from { transform: scale(1); }
  to { transform: scale(1.04); }
}
@keyframes mq-enter-l {
  from { transform: translateX(-120%); }
  to { transform: translateX(0); }
}
@keyframes mq-enter-r {
  from { transform: translateX(120%); }
  to { transform: translateX(0); }
}
@keyframes mq-exit-r {
  from { transform: translateX(0); }
  to { transform: translateX(140%); }
}
@keyframes mq-exit-l {
  from { transform: translateX(0); }
  to { transform: translateX(-140%); }
}
@keyframes mq-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-4%); }
  40% { transform: translateX(4%); }
  60% { transform: translateX(-2.4%); }
  80% { transform: translateX(2.4%); }
}
  50% { opacity: .9; transform: rotate(12deg) translateY(-6px); }
}
