/* The Sugar Spell Bakery v2 — full-screen storybook scene, palette changes with the season. */
:root {
  --font-display: 'Fraunces', 'Georgia', serif;
  --font-body: 'Nunito', 'Segoe UI', system-ui, sans-serif;
  --radius: 18px;
  --shadow: 0 18px 50px rgba(20, 8, 2, .45);
  --ink: #2a1a10;
  --ink-soft: #5b4030;
  --paper: #fff6e6;
  --paper-2: #fbe9cc;
  --line: #e2c79c;
  --accent: #d9822b;
  --accent-dark: #a6531a;
  --accent-2: #7a2e2e;
  --accent-3: #e2b23a;
  --deep: #2c1a12;
  --glow: rgba(255, 170, 70, .55);
  --good: #3f7a3a;
  --text-scale: 1;
}
[data-season='pumpkin'] { --paper: #fff1e2; --paper-2: #fde0c2; --line: #eab98a; --accent: #e8661c; --accent-dark: #b2470b; --accent-2: #4b2346; --accent-3: #f2b84b; --deep: #24121f; --glow: rgba(255, 140, 40, .6); }
[data-season='frost'] { --paper: #f7f9fc; --paper-2: #e6edf5; --line: #b9c8d8; --ink: #1b2533; --ink-soft: #445468; --accent: #b8324b; --accent-dark: #8a1f35; --accent-2: #3c5a78; --accent-3: #9fb7cf; --deep: #121b27; --glow: rgba(160, 200, 255, .5); }
[data-season='snowfall'] { --paper: #fffaf2; --paper-2: #f3e8d4; --line: #dcc79a; --ink: #1d1a14; --ink-soft: #4f4636; --accent: #b3202c; --accent-dark: #85131d; --accent-2: #1f4d3a; --accent-3: #d4af37; --deep: #0f1c17; --glow: rgba(255, 215, 120, .6); }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--deep); color: var(--ink); font-family: var(--font-body); font-size: calc(18px * var(--text-scale)); line-height: 1.55; -webkit-text-size-adjust: 100%; }
body { overflow: hidden; transition: background .8s; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--accent-3); outline-offset: 3px; }
img { max-width: 100%; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 700; line-height: 1.15; margin: 0 0 .4em; letter-spacing: -.01em; }

/* ── Stage & scene ───────────────────────────── */
#stage { position: fixed; inset: 0; overflow: hidden; }
.bg { position: absolute; inset: 0; z-index: 0; }
.bg video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity 1.2s; }
.bg video.ready { opacity: 1; }
.bg img { width: 100%; height: 100%; object-fit: cover; object-position: center; display: block; transition: opacity .8s, filter .8s; }
.bg::after { content: ''; position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 35%, transparent 30%, rgba(10, 4, 0, .55) 100%), linear-gradient(180deg, rgba(0,0,0,.25), transparent 25%, transparent 55%, rgba(0,0,0,.55)); pointer-events: none; }
/* Temporary colour grade while the seasonal art is being painted. */
.bg img.graded { filter: saturate(1.35) contrast(1.08); }
[data-season='harvest'] .bg img.graded { filter: sepia(.35) saturate(1.7) hue-rotate(-12deg) contrast(1.1) brightness(.95); }
[data-season='pumpkin'] .bg img.graded { filter: sepia(.5) saturate(2) hue-rotate(-22deg) contrast(1.15) brightness(.75); }
[data-season='frost'] .bg img.graded { filter: saturate(.7) hue-rotate(170deg) contrast(1.05) brightness(.95); }
[data-season='snowfall'] .bg img.graded { filter: saturate(.9) hue-rotate(95deg) contrast(1.1) brightness(.75); }
#fx { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
#decor { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.decor-item { position: absolute; font-size: clamp(34px, 6vw, 64px); filter: drop-shadow(0 10px 14px rgba(0,0,0,.5)); animation: pop .5s ease-out; }
.decor-item img { display: block; height: clamp(90px, 22vh, 230px); width: auto; }
.decor-chalkboard { left: 1.5%; bottom: 16%; }
.decor-reading_nook { left: 12%; bottom: 14%; }
.decor-copper_oven { right: 1.5%; bottom: 16%; }
.decor-display_case { right: 13%; bottom: 13%; }
.decor-display_case img { height: clamp(80px, 18vh, 190px); }
.decor-garland { left: 50%; top: calc(var(--hud-h, 70px) + 4px); transform: translateX(-50%); }
.decor-garland img { height: auto; width: min(70vw, 760px); }
.decor-wreath { left: 3%; top: calc(var(--hud-h, 70px) + 10px); }
.decor-wreath img { height: clamp(70px, 14vh, 150px); }

/* ── Actor at the counter ────────────────────── */
#actor { position: absolute; z-index: 3; left: 50%; bottom: calc(var(--dialog-h, 220px) + var(--dock-space, 110px) + 16px); transform: translateX(-50%); width: clamp(84px, calc(100dvh - var(--dialog-h, 220px) - var(--dock-space, 110px) - var(--hud-h, 70px) - 40px), min(46vh, 420px)); pointer-events: none; transition: opacity .4s; }
#actor .portrait { width: 100%; aspect-ratio: 1; border-radius: 50% 50% 22px 22px; overflow: hidden; border: 6px solid var(--paper); box-shadow: var(--shadow), 0 0 0 3px var(--accent), 0 0 60px var(--glow); background: var(--paper-2); animation: arrive .6s cubic-bezier(.2,.9,.3,1.2); }
#actor .portrait img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 20%; display: block; }
.ing-icon img { width: 100%; height: 100%; object-fit: contain; }
.ing-icon .img-missing { font-size: 36px; }
#actor .mono { width: 100%; height: 100%; display: grid; place-items: center; font-family: var(--font-display); font-size: clamp(60px, 12vh, 120px); color: var(--paper); background: radial-gradient(circle at 50% 35%, var(--c, var(--accent)), var(--deep)); }
#actor.standing { width: auto; height: clamp(110px, calc(100dvh - var(--dialog-h, 220px) - var(--dock-space, 110px) - var(--hud-h, 70px) + 30px), 68vh); bottom: calc(var(--dialog-h, 220px) + var(--dock-space, 110px) - 36px); }
#actor .figure { height: 100%; display: flex; justify-content: center; align-items: flex-end; animation: arrive .6s cubic-bezier(.2,.9,.3,1.2); }
#actor .figure img { height: 100%; width: auto; max-width: 92vw; object-fit: contain; object-position: bottom; filter: drop-shadow(0 16px 26px rgba(0,0,0,.55)) drop-shadow(0 0 34px var(--glow)); }
#actor .figure .mono { width: 40vh; height: 40vh; border-radius: 50%; }
#actor.regular { width: clamp(84px, calc(100dvh - var(--dialog-h, 220px) - var(--dock-space, 110px) - var(--hud-h, 70px) - 40px), min(30vh, 260px)); }
@keyframes arrive { from { transform: translateY(40px) scale(.92); opacity: 0; } }
@keyframes pop { from { transform: scale(.4); opacity: 0; } }

/* ── HUD ─────────────────────────────────────── */
#hud { position: absolute; z-index: 5; top: 0; left: 0; right: 0; display: flex; gap: 10px; align-items: center; justify-content: space-between; padding: max(10px, env(safe-area-inset-top)) 16px 10px; pointer-events: none; }
#hud > * { pointer-events: auto; }
.chip { display: inline-flex; align-items: center; gap: 8px; background: color-mix(in srgb, var(--paper) 92%, transparent); color: var(--ink); border: 2px solid var(--accent); border-radius: 999px; padding: 6px 14px; font-weight: 800; font-size: 16px; box-shadow: 0 6px 18px rgba(0,0,0,.35); white-space: nowrap; }
.chip small { font-weight: 700; color: var(--ink-soft); font-size: 15px; }
.chip.season { background: var(--accent); color: #fff; border-color: var(--accent-3); }
.chip.season small { color: #fff; opacity: .9; }
.hud-right { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.chip.due.urgent { background: var(--accent-2); color: #fff; border-color: var(--accent-3); }
.chip.due.urgent small { color: #fff; }

/* ── Dock ────────────────────────────────────── */
#dock { position: absolute; z-index: 6; left: 50%; transform: translateX(-50%); bottom: max(10px, env(safe-area-inset-bottom)); display: flex; gap: 6px; background: color-mix(in srgb, var(--deep) 82%, transparent); padding: 6px; border-radius: 22px; border: 2px solid color-mix(in srgb, var(--accent-3) 60%, transparent); box-shadow: var(--shadow); }
#dock button { display: grid; justify-items: center; gap: 0; min-width: 74px; padding: 6px 8px 5px; background: transparent; border: 0; border-radius: 16px; color: #fff; font-weight: 800; font-size: 15px; }
#dock button span { font-size: 26px; line-height: 1.1; }
#dock button:hover, #dock button[aria-expanded='true'] { background: color-mix(in srgb, var(--accent) 75%, transparent); }
#dock .badge { position: absolute; }

/* ── Dialogue (visual-novel box) ─────────────── */
#layer { position: absolute; z-index: 4; inset: 0; pointer-events: none; }
#layer > * { pointer-events: auto; }
.dialog { position: absolute; left: 50%; transform: translateX(-50%); bottom: var(--dock-space, 110px); width: min(920px, calc(100% - 32px)); background: var(--paper); border: 3px solid var(--accent); border-radius: var(--radius); box-shadow: var(--shadow), inset 0 0 0 6px var(--paper-2); padding: 26px 26px 20px; max-height: calc(100dvh - var(--dock-space, 110px) - 90px); overflow: auto; animation: rise .35s ease-out; }
.dialog .nameplate { display: inline-block; background: var(--c, var(--accent-2)); color: #fff; font-family: var(--font-display); font-size: 21px; padding: 4px 18px; border-radius: 12px; border: 2px solid var(--accent-3); box-shadow: 0 6px 14px rgba(0,0,0,.3); margin: 0 0 6px; }
hr.rule { border: 0; border-top: 2px dashed var(--line); margin: 18px 0; }
.img-missing { display: grid; place-items: center; width: 100%; height: 100%; font-size: 54px; }
.tile .art .mono, .mini-mono .mono { width: 100%; height: 100%; display: grid; place-items: center; font-family: var(--font-display); font-size: 28px; color: #fff; background: var(--c, var(--accent-2)); }
.dialog .role { font-size: 15px; color: var(--ink-soft); font-weight: 700; margin: 0 0 8px; }
.dialog .line { font-size: 19px; margin: 0 0 14px; color: var(--ink); }
.dialog .reply { font-size: 18px; background: var(--paper-2); border-left: 5px solid var(--accent); padding: 12px 16px; border-radius: 10px; margin: 0 0 14px; }
.dialog .eyebrow { font-weight: 900; font-size: 15px; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-dark); margin: 0 0 6px; }
@keyframes rise { from { transform: translate(-50%, 20px); opacity: 0; } }
.choices { display: grid; gap: 10px; margin-top: 6px; }
.choice { text-align: left; background: #fff; border: 2px solid var(--line); border-radius: 14px; padding: 13px 16px; font-size: 18px; font-weight: 700; color: var(--ink); transition: transform .12s, border-color .12s, background .12s; }
.choice:hover:not(:disabled) { border-color: var(--accent); background: var(--paper-2); transform: translateX(4px); }
.choice:disabled { opacity: .62; cursor: not-allowed; font-weight: 600; }
.choice .lock { display: block; font-size: 15px; font-weight: 700; color: var(--ink-soft); margin-top: 2px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.row.end { justify-content: flex-end; }
.spacer { flex: 1; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 50px; padding: 10px 22px; border-radius: 999px; border: 0; background: linear-gradient(180deg, var(--accent), var(--accent-dark)); color: #fff; font-weight: 900; font-size: 18px; box-shadow: 0 6px 0 color-mix(in srgb, var(--accent-dark) 70%, #000), 0 10px 22px rgba(0,0,0,.25); transition: transform .1s, box-shadow .1s, filter .1s; }
.btn:hover:not(:disabled) { filter: brightness(1.08); }
.btn:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 2px 0 color-mix(in srgb, var(--accent-dark) 70%, #000); }
.btn:disabled { filter: grayscale(.8); opacity: .55; cursor: not-allowed; }
.btn.alt { background: var(--paper-2); color: var(--ink); box-shadow: 0 5px 0 var(--line); border: 2px solid var(--line); }
.btn.dark { background: linear-gradient(180deg, var(--accent-2), color-mix(in srgb, var(--accent-2) 70%, #000)); box-shadow: 0 6px 0 color-mix(in srgb, var(--accent-2) 50%, #000); }
.btn.small { min-height: 42px; padding: 6px 16px; font-size: 16px; }
.btn.ghost { background: transparent; color: var(--ink-soft); box-shadow: none; text-decoration: underline; padding-inline: 8px; }

/* ── Order card ─────────────────────────────── */
.order { display: flex; gap: 14px; align-items: center; background: var(--paper-2); border: 2px dashed var(--accent); border-radius: 14px; padding: 12px 16px; margin: 0 0 14px; }
.order .ico { font-size: 34px; }
.order b { display: block; font-size: 19px; }
.order span { color: var(--ink-soft); font-size: 16px; }
.result { text-align: center; padding: 4px 0 8px; }
.stars { font-size: 46px; letter-spacing: .1em; color: var(--accent-3); text-shadow: 0 3px 0 var(--accent-dark); }
.stars .off { color: #d7cbb8; text-shadow: none; }
.coins-earned { font-family: var(--font-display); font-size: 30px; color: var(--good); }
.tagline { display: inline-block; font-weight: 900; background: var(--good); color: #fff; padding: 2px 12px; border-radius: 999px; font-size: 15px; }

/* ── Oracle cards ───────────────────────────── */
.oracle { position: absolute; inset: 0; display: grid; place-items: center; padding: 80px 16px calc(var(--dock-space, 110px) + 16px); overflow: auto; }
.oracle-inner { width: min(980px, 100%); text-align: center; }
.oracle h2 { color: #fff; font-size: clamp(28px, 4.5vw, 46px); text-shadow: 0 4px 18px rgba(0,0,0,.7); margin-bottom: 4px; }
.oracle .sub { color: #fff; font-weight: 700; text-shadow: 0 2px 10px rgba(0,0,0,.8); margin: 0 0 22px; font-size: 18px; }
.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.card { perspective: 1200px; background: none; border: 0; padding: 0; min-height: 430px; }
.card-inner { position: relative; width: 100%; height: 100%; min-height: 430px; transform-style: preserve-3d; transition: transform .7s cubic-bezier(.3,1.3,.5,1); }
.card.flipped .card-inner { transform: rotateY(180deg); }
.card-face { position: absolute; inset: 0; backface-visibility: hidden; border-radius: 18px; border: 4px solid var(--accent-3); box-shadow: var(--shadow); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 18px 14px; }
.card-back { background: radial-gradient(circle at 50% 40%, var(--accent), var(--accent-2) 70%); color: var(--accent-3); font-size: 70px; overflow: hidden; padding: 0; }
.card-back img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.card-back small { position: absolute; bottom: 12px; left: 0; right: 0; text-align: center; text-shadow: 0 2px 6px #000; }
.card-front { overflow: hidden; padding: 0; justify-content: flex-start; }
.card-art { position: relative; width: 100%; height: 52%; flex: none; background: var(--paper-2); display: grid; place-items: center; font-size: 50px; }
.card-art { overflow: hidden; }
.card-art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; display: block; }
.card-art .card-icon { z-index: 1; }
.card-icon { position: absolute; right: 10px; bottom: -20px; width: 46px; height: 46px; border-radius: 50%; background: var(--paper); border: 3px solid var(--accent-3); display: grid; place-items: center; font-size: 24px; }
.card-text { padding: 18px 14px 14px; text-align: center; }
.card-back small { font-size: 16px; font-weight: 900; letter-spacing: .14em; color: #fff; margin-top: 8px; }
.card-front { transform: rotateY(180deg); background: var(--paper); color: var(--ink); }
.card-front .suit { font-size: 14px; font-weight: 900; letter-spacing: .14em; color: var(--accent-dark); text-transform: uppercase; }
.card-front .big { font-size: 54px; line-height: 1.2; }
.card-front h3 { font-size: 22px; margin: 4px 0 6px; }
.card-front p { font-size: 16px; margin: 0; color: var(--ink-soft); }
.card:not(.flipped):hover .card-inner { transform: translateY(-8px) rotate(-1deg); }
.oracle .actions { margin-top: 22px; justify-content: center; }

/* ── Evening & splash panels ────────────────── */
.panel-center { position: absolute; inset: 0; display: grid; place-items: center; padding: 76px 16px calc(var(--dock-space, 110px) + 16px); overflow: auto; }
.paper { background: var(--paper); border: 3px solid var(--accent); border-radius: var(--radius); box-shadow: var(--shadow), inset 0 0 0 6px var(--paper-2); padding: 26px; width: min(760px, 100%); animation: rise2 .35s ease-out; }
@keyframes rise2 { from { transform: translateY(20px); opacity: 0; } }
.ledger-lines { display: grid; gap: 6px; margin: 10px 0 18px; font-size: 18px; }
.ledger-lines div { display: flex; justify-content: space-between; border-bottom: 1px dashed var(--line); padding: 4px 0; }
.ledger-lines .total { font-weight: 900; border-bottom: 0; font-size: 20px; }
.neg { color: var(--accent-2); }
.pos { color: var(--good); }
textarea { width: 100%; min-height: 150px; border: 2px solid var(--line); border-radius: 14px; padding: 14px; background: #fff; font-size: 18px; line-height: 1.6; resize: vertical; }
.prompt { font-family: var(--font-display); font-size: 21px; font-style: italic; color: var(--ink); margin: 0 0 10px; }
.hint { font-size: 16px; color: var(--ink-soft); }
.reward { background: var(--paper-2); border: 2px solid var(--accent-3); border-radius: 12px; padding: 10px 14px; font-weight: 800; margin: 10px 0; }
.splash { text-align: center; color: #fff; text-shadow: 0 4px 20px rgba(0,0,0,.8); }
.splash .week { font-weight: 900; letter-spacing: .2em; text-transform: uppercase; font-size: 18px; color: var(--accent-3); }
.splash h2 { font-size: clamp(44px, 9vw, 96px); margin: 6px 0; }
.splash p { font-size: 21px; font-weight: 700; margin: 0 0 22px; }
.grimsby-card { display: flex; gap: 16px; align-items: center; margin-bottom: 12px; }
.mini-mono { flex: none; width: 70px; height: 70px; border-radius: 50%; display: grid; place-items: center; background: var(--c, var(--accent-2)); color: #fff; font-family: var(--font-display); font-size: 26px; border: 3px solid var(--accent-3); overflow: hidden; }
.mini-mono img { width: 100%; height: 100%; object-fit: cover; }

/* ── Title & intro ──────────────────────────── */
.title { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px 16px; text-align: center; overflow: auto; }
.title-inner { max-width: 760px; }
.title .kicker { color: var(--accent-3); font-weight: 900; letter-spacing: .25em; text-transform: uppercase; font-size: 16px; text-shadow: 0 2px 10px rgba(0,0,0,.8); }
.title h1 { color: #fff; font-size: clamp(46px, 10vw, 104px); line-height: .98; margin: 10px 0 8px; text-shadow: 0 6px 30px rgba(0,0,0,.75), 0 0 40px var(--glow); }
.title h1 em { font-style: italic; color: var(--accent-3); }
.title p { color: #fff; font-size: 20px; font-weight: 700; text-shadow: 0 2px 12px rgba(0,0,0,.85); margin: 0 auto 26px; max-width: 560px; }
.title .row { justify-content: center; }
.season-strip { display: flex; justify-content: center; gap: 8px; margin: 18px 0 0; flex-wrap: wrap; }
.season-strip span { background: rgba(0,0,0,.45); color: #fff; padding: 4px 12px; border-radius: 999px; font-weight: 800; font-size: 15px; border: 1px solid rgba(255,255,255,.3); }
.letter { background: #fffaf0 repeating-linear-gradient(180deg, transparent 0 33px, rgba(160,110,60,.15) 33px 34px); color: #3a2414; font-family: var(--font-display); font-size: 20px; line-height: 34px; padding: 30px 32px; border-radius: 6px; box-shadow: var(--shadow); transform: rotate(-.6deg); text-align: left; }
.letter .sig { text-align: right; font-style: italic; }
input[type=text] { width: 100%; min-height: 52px; border: 2px solid var(--line); border-radius: 14px; padding: 10px 16px; font-size: 19px; background: #fff; }
label.field { display: block; font-weight: 900; margin: 16px 0 6px; }

/* ── Sheets (Market, Recipes, Journal, Ledger, Menu) ── */
#sheet { position: fixed; inset: 0; z-index: 20; display: grid; place-items: end center; background: rgba(10, 4, 0, .55); backdrop-filter: blur(3px); }
#sheet[hidden] { display: none; }
.sheet { width: min(1040px, 100%); max-height: min(88dvh, 900px); display: flex; flex-direction: column; background: var(--paper); border: 3px solid var(--accent); border-bottom: 0; border-radius: 26px 26px 0 0; box-shadow: var(--shadow); animation: slide .3s ease-out; }
@keyframes slide { from { transform: translateY(40px); opacity: 0; } }
.sheet-head { display: flex; align-items: center; gap: 12px; padding: 18px 22px 12px; border-bottom: 2px solid var(--line); }
.sheet-head h2 { margin: 0; font-size: 30px; flex: 1; }
.sheet-body { overflow: auto; padding: 18px 22px 28px; }
.close { width: 48px; height: 48px; border-radius: 50%; border: 2px solid var(--line); background: #fff; font-size: 24px; font-weight: 900; }
.tabs { display: flex; gap: 8px; padding: 0 22px; margin-top: 12px; flex-wrap: wrap; }
.tabs button { border: 2px solid var(--line); background: #fff; border-radius: 999px; padding: 6px 16px; font-weight: 800; font-size: 16px; }
.tabs button[aria-selected='true'] { background: var(--accent); color: #fff; border-color: var(--accent); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.tile { background: #fff; border: 2px solid var(--line); border-radius: 16px; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.tile.match { border-color: var(--good); box-shadow: 0 0 0 3px color-mix(in srgb, var(--good) 30%, transparent); }
.tile.locked { opacity: .55; }
.tile h4 { font-size: 19px; margin: 0; }
.tile .meta { font-size: 15px; color: var(--ink-soft); font-weight: 700; }
.tile .art { width: 100%; aspect-ratio: 4 / 3; border-radius: 12px; overflow: hidden; background: var(--paper-2); display: grid; place-items: center; font-size: 54px; }
.tile .art img { width: 100%; height: 100%; object-fit: cover; }
.tags { display: flex; flex-wrap: wrap; gap: 5px; }
.tag { background: var(--paper-2); border: 1px solid var(--line); border-radius: 999px; padding: 1px 10px; font-size: 15px; font-weight: 800; }
.needs { display: flex; flex-wrap: wrap; gap: 6px; font-size: 16px; font-weight: 800; }
.needs .miss { color: var(--accent-2); }
.ing-row { display: flex; align-items: center; gap: 12px; }
.ing-icon { font-size: 36px; width: 56px; height: 56px; display: grid; place-items: center; background: var(--paper-2); border-radius: 14px; flex: none; }
.ing-row .grow { flex: 1; min-width: 0; }
.ing-row b { display: block; font-size: 18px; }
.qty { font-weight: 900; font-size: 17px; }
.sale { color: #fff; background: var(--accent-2); border-radius: 6px; padding: 0 6px; font-size: 14px; font-weight: 900; }
.memory-toggle { display: flex; gap: 10px; align-items: center; font-weight: 800; background: var(--paper-2); border-radius: 12px; padding: 10px 14px; margin-bottom: 14px; }
.memory-toggle input { width: 24px; height: 24px; accent-color: var(--accent); }
.hearts { color: var(--accent); letter-spacing: .06em; font-size: 18px; }
.page-card { background: #fffaf0; border: 2px solid var(--line); border-radius: 12px; padding: 14px 16px; font-family: var(--font-display); font-size: 18px; }
.page-card.missing { font-family: var(--font-body); color: var(--ink-soft); font-style: italic; }
.entry { border-bottom: 2px dashed var(--line); padding: 14px 0; }
.entry h4 { font-size: 20px; margin-bottom: 4px; }
.entry .writing { white-space: pre-wrap; overflow-wrap: anywhere; background: #fff; border-radius: 10px; padding: 10px 14px; margin-top: 8px; }
.setting { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px dashed var(--line); flex-wrap: wrap; }
.setting p { margin: 2px 0 0; font-size: 16px; color: var(--ink-soft); }

/* ── Mini-games ─────────────────────────────── */
#game { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; background: radial-gradient(circle at 50% 30%, color-mix(in srgb, var(--accent) 45%, var(--deep)), var(--deep)); padding: 16px; overflow: auto; }
#game[hidden] { display: none; }
.game-card { width: min(640px, 100%); text-align: center; color: #fff; }
.game-card h2 { font-size: clamp(28px, 5vw, 42px); margin: 0; text-shadow: 0 3px 14px rgba(0,0,0,.6); }
.game-card .how { font-size: 18px; font-weight: 700; margin: 4px 0 14px; opacity: .95; }
.game-area { position: relative; width: min(440px, 88vw, 58dvh); aspect-ratio: 1; margin: 0 auto; touch-action: none; user-select: none; -webkit-user-select: none; }
.game-hud { display: flex; justify-content: center; gap: 10px; margin: 12px 0; flex-wrap: wrap; }
.game-hud .chip { font-size: 16px; }
.feedback { min-height: 34px; font-family: var(--font-display); font-size: 26px; color: var(--accent-3); text-shadow: 0 2px 8px rgba(0,0,0,.6); }
.tapzone { position: absolute; inset: 0; border: 0; background: transparent; border-radius: 50%; }
/* lattice */
.pie { position: absolute; inset: 6%; border-radius: 50%; background: radial-gradient(circle, #d9772f 0 55%, #b85a1d 56% 62%, #e8b46a 63% 100%); box-shadow: inset 0 0 0 10px #f0c47c, 0 18px 40px rgba(0,0,0,.5); overflow: hidden; }
.strip { position: absolute; background: linear-gradient(90deg, #f7d08a, #e9b264, #f7d08a); border: 2px solid #c98a3c; border-radius: 8px; box-shadow: 0 3px 6px rgba(0,0,0,.3); }
.strip.v { width: 12%; top: -5%; bottom: -5%; }
.strip.h { height: 12%; left: -5%; right: -5%; }
.strip.moving { background: linear-gradient(90deg, #fff1c8, #f5c97b, #fff1c8); }
.guide { position: absolute; border: 3px dashed rgba(255,255,255,.9); border-radius: 8px; }
.guide.v { width: 12%; top: 0; bottom: 0; }
.guide.h { height: 12%; left: 0; right: 0; }
/* icing */
.cookie { position: absolute; inset: 4%; border-radius: 22%; background: radial-gradient(circle at 40% 35%, #e7a85a, #b8692a); box-shadow: 0 18px 40px rgba(0,0,0,.5); }
.dot { position: absolute; width: 15%; height: 15%; margin: -7.5% 0 0 -7.5%; border-radius: 50%; border: 4px solid #fff; background: rgba(255,255,255,.25); color: #fff; font-weight: 900; font-size: 20px; display: grid; place-items: center; }
.dot.next { background: var(--accent); box-shadow: 0 0 0 6px rgba(255,255,255,.35), 0 0 24px #fff; animation: pulse 1s infinite; }
.dot.done { background: #fff; color: var(--accent-dark); }
@keyframes pulse { 50% { transform: scale(1.12); } }
.icing-line { position: absolute; inset: 0; pointer-events: none; }
/* knead */
.dough-ball { position: absolute; inset: 22%; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #fff4dc, #e7c58e); box-shadow: 0 18px 40px rgba(0,0,0,.45), inset 0 -10px 20px rgba(160,110,40,.35); transition: transform .12s; }
.dough-ball.squish { transform: scale(1.12, .86); }
.ring { position: absolute; left: 50%; top: 50%; border-radius: 50%; border: 6px solid var(--accent-3); transform: translate(-50%, -50%); pointer-events: none; }
.ring.target { width: 60%; height: 60%; border: 4px dashed rgba(255,255,255,.85); }
/* layers */
.stack-area { position: absolute; inset: 0; border-radius: 22px; background: linear-gradient(180deg, rgba(255,255,255,.08), rgba(255,255,255,.18)); overflow: hidden; }
.plate { position: absolute; left: 15%; right: 15%; bottom: 6%; height: 4%; background: #f4f4f4; border-radius: 50%; box-shadow: 0 6px 12px rgba(0,0,0,.35); }
.layer { position: absolute; height: 11%; border-radius: 10px; box-shadow: inset 0 -6px 0 rgba(0,0,0,.12), 0 4px 8px rgba(0,0,0,.3); border: 2px solid rgba(255,255,255,.5); }
/* caramel */
.thermo { position: absolute; left: 50%; top: 4%; bottom: 22%; width: 22%; transform: translateX(-50%); background: #fff; border-radius: 30px; border: 5px solid #fff; box-shadow: 0 10px 30px rgba(0,0,0,.45); overflow: hidden; }
.thermo .fill { position: absolute; left: 0; right: 0; bottom: 0; background: linear-gradient(0deg, #c8691d, #f0a640, #fbe0a0); }
.thermo .zone { position: absolute; left: 0; right: 0; background: rgba(63,122,58,.35); border-top: 3px solid var(--good); border-bottom: 3px solid var(--good); }
.thermo .burn { position: absolute; left: 0; right: 0; top: 0; height: 7%; background: repeating-linear-gradient(45deg, #8a1f1f 0 8px, #b33 8px 16px); }
.heat-btn { position: absolute; left: 50%; bottom: 0; transform: translateX(-50%); width: 70%; min-height: 64px; border-radius: 999px; border: 4px solid #fff; background: linear-gradient(180deg, var(--accent), var(--accent-dark)); color: #fff; font-weight: 900; font-size: 20px; touch-action: none; }
.heat-btn.on { background: linear-gradient(180deg, #ff8a3d, #c0391b); box-shadow: 0 0 30px #ff8a3d; }
.donebar { width: min(440px, 88vw); height: 16px; margin: 10px auto 0; background: rgba(255,255,255,.25); border-radius: 999px; overflow: hidden; }
.donebar i { display: block; height: 100%; background: var(--good); border-radius: 999px; }
/* flavour */
.flavour { width: min(560px, 100%); margin: 0 auto; background: var(--paper); color: var(--ink); border-radius: 20px; padding: 18px; text-align: left; }
.profile { display: grid; grid-template-columns: auto 1fr auto; gap: 6px 12px; align-items: center; font-weight: 800; margin-bottom: 12px; }
.meter { display: flex; gap: 5px; }
.meter i { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--accent-dark); }
.meter i.want { background: var(--accent-3); }
.meter i.have { background: var(--accent); border-color: var(--accent); }
.meter i.over { background: var(--accent-2); border-color: var(--accent-2); }
.tokens { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.token { border: 2px solid var(--line); background: #fff; border-radius: 14px; padding: 10px 6px; font-weight: 800; font-size: 16px; text-align: center; }
.token span { display: block; font-size: 30px; }
.token[aria-pressed='true'] { border-color: var(--accent); background: var(--paper-2); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent); }
.token small { display: block; font-size: 14px; color: var(--ink-soft); font-weight: 700; }

#toast { position: fixed; z-index: 40; left: 50%; top: 70px; transform: translateX(-50%); background: var(--deep); color: #fff; border: 2px solid var(--accent-3); padding: 10px 20px; border-radius: 999px; font-weight: 800; box-shadow: var(--shadow); max-width: calc(100% - 32px); text-align: center; }
#toast[hidden] { display: none; }

/* ── Ending ─────────────────────────────────── */
.ending-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; margin-top: 14px; }
.ending-card { text-align: left; background: #fff; border: 3px solid var(--accent); border-radius: 16px; padding: 16px; }
.ending-card.locked { border-style: dashed; border-color: var(--line); opacity: .7; }
.ending-card .big { font-size: 40px; }
.ending-card h3 { font-size: 22px; }
.ending-text p { font-size: 20px; font-family: var(--font-display); line-height: 1.6; }

/* ── Print: the chronicle ───────────────────── */
#print { display: none; }
@media print {
  body { overflow: visible; background: #fff; }
  #stage, #sheet, #game, #toast { display: none !important; }
  #print { display: block; color: #222; font-family: Georgia, serif; font-size: 13pt; }
  #print h1 { font-size: 30pt; }
  #print .pday { break-inside: avoid; border-bottom: 1px solid #ccc; padding: 10pt 0; }
}

/* ── Responsive ─────────────────────────────── */
@media (max-width: 760px) {
  html, body { font-size: calc(17px * var(--text-scale)); }
  #hud { flex-wrap: wrap; gap: 6px; padding-inline: 10px; }
  .hud-right { gap: 5px; }
  .chip { font-size: 15px; padding: 3px 10px; gap: 5px; border-width: 2px; }
  .chip small { font-size: 14px; }
  #dock button { min-width: 58px; font-size: 14px; padding: 5px 4px; }
  #dock button span { font-size: 23px; }
  .dialog { padding: 18px 16px 14px; max-height: calc(100dvh - var(--dock-space, 100px) - 120px); }
  .dialog .line { font-size: 18px; }
  .choice { font-size: 17px; padding: 11px 13px; }
  .cards { grid-template-columns: 1fr; gap: 10px; }
  .card, .card-inner { min-height: 150px; }
  .card-front { flex-direction: row; }
  .card-art { width: 34%; height: 100%; }
  .card-icon { display: none; }
  .card-text { text-align: left; padding: 10px 12px; }
  .card-front h3 { font-size: 19px; }
  .decor-item img { height: clamp(60px, 11vh, 110px); }
  .decor-garland img { width: 92vw; }
  .decor-reading_nook, .decor-display_case { display: none; }
  .oracle { padding-top: 120px; }
  .panel-center { padding-top: 116px; }
  .paper { padding: 20px 16px; }
  .sheet-head h2 { font-size: 25px; }
  .sheet-body { padding: 14px 16px 24px; }
  .grid { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .chip.season .sname { display: none; }
}
@media (max-width: 380px) {
  #dock button { min-width: 52px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
.reduce-motion *, .reduce-motion *::before, .reduce-motion *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }

.chip-ico { display: inline-grid; width: 24px; height: 24px; }
.chip-ico img { width: 24px; height: 24px; object-fit: contain; }
.letter .hazel { float: right; width: 120px; height: 150px; margin: 0 0 10px 16px; border-radius: 50% / 45%; overflow: hidden; border: 5px solid #d4af37; box-shadow: 0 8px 20px rgba(0,0,0,.3); }
.letter .hazel img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 15%; }
@media (max-width: 520px) { .letter .hazel { width: 86px; height: 108px; } .letter { padding: 22px 18px; font-size: 18px; } }

/* ── v2.1: the guided day ───────────────────── */
.pathbar { position: absolute; z-index: 5; top: calc(var(--hud-h, 64px) + 6px); left: 50%; transform: translateX(-50%); display: flex; gap: 4px; list-style: none; margin: 0; padding: 4px; border-radius: 999px; background: var(--deep); border: 1px solid color-mix(in srgb, var(--accent-3) 60%, transparent); box-shadow: 0 6px 16px rgba(0,0,0,.4); max-width: calc(100% - 24px); }
.pathbar li { display: flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; color: #fff; opacity: .65; font-weight: 800; font-size: 14px; white-space: nowrap; }
.pathbar li.done { opacity: .85; }
.pathbar li.now { opacity: 1; background: var(--accent); box-shadow: 0 0 0 2px var(--accent-3); }
.oracle, .panel-center { padding-top: calc(var(--hud-h, 64px) + 52px); }
.tip { display: flex; gap: 12px; align-items: flex-start; background: #fffaf0; border: 2px dashed var(--accent-3); border-radius: 14px; padding: 10px 14px; margin: 12px 0; text-align: left; }
.tip p { margin: 0; font-size: 17px; color: var(--ink); }
.tip-face { flex: none; width: 46px; height: 46px; border-radius: 50%; overflow: hidden; border: 2px solid var(--accent-3); background: var(--paper-2); display: grid; place-items: center; font-size: 26px; }
.tip-face img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 15%; }
.tip-wrap { max-width: 720px; margin: 0 auto 10px; }
.moods { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 6px 0 14px; }
.mood { display: grid; justify-items: center; gap: 2px; padding: 12px 6px; border-radius: 16px; border: 2px solid var(--line); background: #fff; font-weight: 800; font-size: 17px; }
.mood span { font-size: 34px; }
.mood[aria-pressed='true'] { border-color: var(--accent); background: var(--paper-2); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent); }
.card { min-height: 0; }
.card, .card-inner { aspect-ratio: 3 / 4; min-height: 0; height: auto; }
.cards { max-width: 660px; margin: 0 auto; }
.card-front .card-art { height: 76%; }
.card-text { padding: 8px 8px 6px; }
.card-text .suit { font-size: 14px; }
.card-front h3 { font-size: 18px; margin: 0; }
.card-back small { font-size: 15px; }
.card:not(.flipped):not([tabindex='-1']) .card-inner { animation: beckon 2.4s ease-in-out infinite; }
@keyframes beckon { 50% { transform: translateY(-6px); box-shadow: 0 0 30px var(--glow); } }
.card[tabindex='-1']:not(.flipped) { cursor: default; opacity: .85; }
.hazel-card .card-face { border-color: #f6d36b; box-shadow: 0 0 34px rgba(246, 211, 107, .7), var(--shadow); }
.reading { display: grid; gap: 10px; max-width: 720px; margin: 16px auto 0; text-align: left; }
.reading-row { background: var(--paper); border: 2px solid var(--accent); border-radius: 16px; padding: 12px 16px; animation: rise2 .35s ease-out; }
.reading-row p { margin: 4px 0 0; font-size: 17px; }
.reading-head { font-size: 18px; }
.reading-row .effect { color: var(--accent-dark); }
.reading-row .reflect { font-family: var(--font-display); font-style: italic; color: var(--ink); }
.hazel-row { border-color: #d4af37; background: #fffaf0; }
.visitor-row { display: flex; gap: 14px; align-items: center; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.visitor-row .mini-mono { width: 64px; height: 64px; }
.visitor-row b { font-size: 19px; }
.visitor-row .ok, .visitor-row .miss { margin: 4px 0 0; font-weight: 800; font-size: 16px; }
.visitor-row .ok { color: var(--good); }
.visitor-row .miss { color: var(--accent-2); }
.mini-mono img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 15%; }
.visit-count { font-size: 14px; }
.question { background: var(--paper-2); border-radius: 14px; padding: 12px 14px; margin: 0 0 12px; }
.question .prompt { font-size: 19px; }
textarea.short { min-height: 80px; }
.prompt-pick { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 10px; }
.tag-btn { border: 2px solid var(--line); background: #fff; border-radius: 999px; padding: 4px 14px; font-weight: 800; font-size: 15px; }
.tag-btn[aria-pressed='true'] { background: var(--accent); color: #fff; border-color: var(--accent); }
.breath { position: relative; width: min(260px, 60vw); aspect-ratio: 1; margin: 10px auto; display: grid; place-items: center; }
.breath-ring { position: absolute; inset: 20%; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--accent-3) 70%, #fff), transparent 70%); transition: transform 4s ease-in-out, opacity 4s; transform: scale(.7); opacity: .6; }
.breath.in .breath-ring { transform: scale(1.5); opacity: 1; }
.breath.out .breath-ring { transform: scale(.7); opacity: .6; }
.breath-cup { font-size: 72px; position: relative; }
@media (max-width: 760px) {
  .pathbar li { padding: 3px 7px; font-size: 14px; gap: 3px; }
  .pathbar li:not(.now) .lbl { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .pathbar li:not(.now) { gap: 0; }
  .oracle, .panel-center { padding-top: calc(var(--hud-h, 90px) + 46px); }
  .moods { grid-template-columns: repeat(2, 1fr); }
  .cards { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .card, .card-inner { min-height: 0; }
  .card-front { flex-direction: column; }
  .card-front .card-art { width: 100%; height: 72%; }
  .card-text { text-align: center; padding: 4px; }
  .card-text .suit { display: none; }
  .card-front h3 { font-size: 14px; }
  .card-back small { font-size: 14px; bottom: 6px; }
}

.rescue { background: #fffaf0; border: 2px solid var(--accent-3); border-radius: 14px; padding: 10px 14px; margin: 10px 0; }
.rescue p { margin: 0 0 8px; font-size: 17px; }
.rescue-used { margin: 6px 0 10px; }
