/* ==========================================================================
   BRAMBLE & THE LOST BELLS — ALPINE STORYBOOK DESIGN SYSTEM
   Rules of the house: nothing under 14px, story text 17–21px, tap targets 44px,
   everything works at 360px wide, motion can be turned down.
   ========================================================================== */
/* ---- Fonts: bundled with the game (OFL-1.1, see assets/fonts/FONT-LICENSES.txt). Nothing is fetched from another website. ---- */
@font-face{font-family:'Cinzel';font-style:normal;font-weight:400 900;font-display:swap;src:url('../assets/fonts/cinzel-latin-wght-normal.woff2') format('woff2');unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}
@font-face{font-family:'Cormorant Garamond';font-style:normal;font-weight:300 700;font-display:swap;src:url('../assets/fonts/cormorant-garamond-latin-wght-normal.woff2') format('woff2');unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}
@font-face{font-family:'Cormorant Garamond';font-style:italic;font-weight:300 700;font-display:swap;src:url('../assets/fonts/cormorant-garamond-latin-wght-italic.woff2') format('woff2');unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}
@font-face{font-family:'Quicksand';font-style:normal;font-weight:400 700;font-display:swap;src:url('../assets/fonts/quicksand-latin.woff2') format('woff2');unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}
@font-face{font-family:'Caveat';font-style:normal;font-weight:400 700;font-display:swap;src:url('../assets/fonts/caveat-latin.woff2') format('woff2');unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}

:root {
  --night: #0B131F;
  --slate: #152238;
  --slate-2: #20314F;
  --card: rgba(18, 30, 48, 0.92);
  --card-solid: #142236;
  --ink: #FDFBF7;
  --ink-2: #D8E1EC;
  --ink-3: #A9BACD;
  --cream: #F7F2E8;
  --parchment: #FAF6EF;
  --parchment-line: #DDCFBD;
  --paper-ink: #2D2015;
  --cranberry: #9E2A2B;
  --cranberry-2: #C44547;
  --berry-soft: #F8A5A5;
  --gold: #DDA15E;
  --gold-light: #FEFAE0;
  --gold-dim: #997042;
  --gold-glow: rgba(221, 161, 94, 0.5);
  --frost: #A5C4D4;
  --pine: #142820;
  --ok: #A3E635;

  --font-title: 'Cinzel', 'Trajan Pro', Georgia, serif;
  --font-prose: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  --font-ui: 'Quicksand', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-hand: 'Caveat', 'Segoe Print', 'Bradley Hand', cursive;

  --radius: 1.15rem;
  --hud-h: 64px;
}

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html { background: var(--night); color-scheme: dark; scroll-padding-top: 90px; }
body {
  font-family: var(--font-ui);
  font-size: 1.0625rem;
  font-weight: 500;
  line-height: 1.6;
  color: var(--ink);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  background: radial-gradient(circle at 50% 10%, #1C2D4A 0%, #101B2B 55%, #080D15 100%) fixed;
}
body.modal-open { overflow: hidden; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--ink-3); }
.center { text-align: center; justify-content: center; }
.fine { font-size: 0.875rem; color: var(--ink-3); text-align: center; }
.hint { font-size: 0.9375rem; color: var(--ink-3); line-height: 1.5; }
.stack { display: flex; flex-direction: column; gap: 0.9rem; }

:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; border-radius: 6px; }
.skip-link { position: absolute; left: 0.75rem; top: -60px; z-index: 300; background: var(--gold); color: var(--night); padding: 0.6rem 1rem; border-radius: 0.5rem; font-weight: 700; text-decoration: none; }
.skip-link:focus { top: 0.75rem; }

#bgCanvas { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 0; }
.frost-vignette { position: fixed; inset: 0; pointer-events: none; z-index: 1; box-shadow: inset 0 0 120px rgba(165, 196, 212, 0.14); }
#app { position: relative; z-index: 2; min-height: 100vh; display: flex; flex-direction: column; }

/* ============================ HUD ============================ */
.hud {
  position: sticky; top: 0; z-index: 50;
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 0.75rem 1.25rem;
  padding: 0.55rem 1.25rem;
  padding: calc(0.55rem + env(safe-area-inset-top)) max(1.25rem, env(safe-area-inset-right)) 0.55rem max(1.25rem, env(safe-area-inset-left));
  background: rgba(11, 19, 31, 0.9);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(221, 161, 94, 0.28);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.45);
}
.hud-brand { display: flex; align-items: center; gap: 0.6rem; min-width: 0; }
.bell-emblem, .avatar-btn {
  width: 46px; height: 46px; flex: 0 0 auto; border: 0; background: transparent;
  display: flex; align-items: center; justify-content: center; overflow: hidden; font-size: 1.5rem; padding: 0;
  transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.bell-emblem img, .avatar-btn img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.55)); }
.bell-emblem:hover, .avatar-btn:hover { transform: scale(1.12) rotate(8deg); }
.bell-emblem.ringing { animation: bellShake 0.65s ease-in-out; }
@keyframes bellShake {
  0%, 100% { transform: rotate(0) scale(1); }
  20% { transform: rotate(-24deg) scale(1.18); } 40% { transform: rotate(22deg) scale(1.18); }
  60% { transform: rotate(-15deg) scale(1.12); } 80% { transform: rotate(10deg) scale(1.06); }
}
.brand-text { background: none; border: 0; text-align: left; display: flex; flex-direction: column; justify-content: center; line-height: 1.15; min-width: 0; min-height: 44px; padding: 0.2rem 0.3rem; }
.brand-name { font-family: var(--font-title); font-weight: 700; font-size: 1.2rem; letter-spacing: 0.1em; color: var(--ink); }
.brand-mood { font-size: 0.875rem; font-weight: 700; color: var(--gold); letter-spacing: 0.04em; white-space: nowrap; }

.hud-meters { display: flex; align-items: center; justify-content: center; gap: 0.6rem; flex-wrap: wrap; }
.meter {
  position: relative; display: flex; align-items: center; gap: 0.5rem; min-height: 44px;
  padding: 0.3rem 0.85rem; border-radius: 999px; text-align: left;
  background: rgba(22, 34, 56, 0.85); border: 1px solid rgba(221, 161, 94, 0.3);
  font-size: 0.9375rem; font-weight: 700; color: var(--cream);
  transition: border-color 0.3s, box-shadow 0.3s;
}
.meter:hover { border-color: var(--gold); }
.meter.at-mark { border-color: var(--gold); box-shadow: 0 0 16px var(--gold-glow); }
.meter.at-mark .meter-val::after { content: ' ✨'; }
.meter-label { white-space: nowrap; }
.meter-val { min-width: 3.1ch; text-align: right; color: var(--gold-light); font-variant-numeric: tabular-nums; }
.bar-track { position: relative; width: 84px; height: 10px; border-radius: 999px; background: rgba(0, 0, 0, 0.5); flex: 0 0 auto; }
.bar-track.big { width: 100%; height: 14px; }
.bar-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 999px; transition: width 0.9s cubic-bezier(0.4, 0, 0.2, 1); }
.bar-fill.res { background: linear-gradient(90deg, #997042, var(--gold), var(--gold-light)); box-shadow: 0 0 12px var(--gold-glow); }
.bar-fill.warm { background: linear-gradient(90deg, #5B7B96, var(--cranberry-2), #E06D53); box-shadow: 0 0 12px rgba(196, 69, 71, 0.5); }
.bar-mark { position: absolute; top: -4px; bottom: -4px; width: 3px; margin-left: -1px; background: var(--gold-light); border-radius: 2px; box-shadow: 0 0 8px var(--gold); pointer-events: none; }
.float-delta { position: absolute; right: 0.6rem; top: -0.2rem; font-weight: 700; font-size: 1.05rem; pointer-events: none; animation: floatUp 1.6s ease-out forwards; text-shadow: 0 2px 6px #000; }
.float-delta.up { color: #FFE9A8; } .float-delta.down { color: var(--berry-soft); }
@keyframes floatUp { 0% { opacity: 0; transform: translateY(8px); } 15% { opacity: 1; } 100% { opacity: 0; transform: translateY(-30px); } }

.satchel-hud { display: flex; align-items: center; gap: 0.35rem; min-height: 44px; padding: 0.25rem 0.7rem; border-radius: 999px; background: rgba(20, 40, 32, 0.7); border: 1px solid rgba(221, 161, 94, 0.35); font-size: 0.9375rem; font-weight: 700; color: var(--cream); }
.satchel-hud:hover { border-color: var(--gold); }
.slot { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: rgba(0, 0, 0, 0.35); border: 1px dashed rgba(221, 161, 94, 0.4); font-size: 0.95rem; }
.slot.filled { border: 1px solid var(--gold); background: radial-gradient(circle, rgba(221, 161, 94, 0.35), rgba(0, 0, 0, 0.6)); }

.hud-actions { display: flex; gap: 0.4rem; }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-size: 1.15rem; background: rgba(22, 34, 56, 0.85); border: 1px solid rgba(221, 161, 94, 0.3); transition: all 0.2s; }
.icon-btn:hover { background: var(--gold); border-color: var(--gold); transform: translateY(-2px); }

/* ============================ ZOOM ============================ */
.zoom-btn { position: absolute; top: 0.7rem; right: 0.7rem; z-index: 4; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-size: 1.15rem; background: rgba(11, 19, 31, 0.72); border: 1px solid rgba(221, 161, 94, 0.75); color: var(--gold-light); opacity: 0.88; backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); transition: opacity 0.2s, transform 0.2s; }
.zoom-btn:hover, .zoom-btn:focus-visible { opacity: 1; transform: scale(1.08); }
img[data-zoom] { cursor: zoom-in; }
.modal-backdrop.lightbox { background: rgba(4, 7, 12, 0.96); padding: 0; z-index: 120; }
.modal-backdrop.lightbox .modal-card.lightbox-card { max-width: none; width: 100%; height: 100%; max-height: none; border-radius: 0; border: 0; background: transparent; box-shadow: none; padding: 0; gap: 0; display: flex; flex-direction: column; overflow: hidden; }
.modal-backdrop.lightbox .modal-close { top: max(0.7rem, env(safe-area-inset-top)); right: 0.7rem; width: 48px; height: 48px; z-index: 5; background: rgba(11, 19, 31, 0.85); border: 1px solid var(--gold); }
.lightbox-scroll { flex: 1 1 auto; min-height: 0; overflow: auto; display: flex; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; touch-action: pan-x pan-y pinch-zoom; }
.lightbox-scroll img { margin: auto; display: block; max-width: none; flex: 0 0 auto; border-radius: 0.4rem; box-shadow: 0 10px 50px rgba(0, 0, 0, 0.7); }
.lightbox-scroll img.pan { height: 78vh; height: 78dvh; width: auto; }
.lightbox-scroll img.fit { max-width: calc(100vw - 1.5rem); max-height: 78vh; max-height: 78dvh; width: auto; height: auto; object-fit: contain; }
.lightbox-cap { flex: 0 0 auto; text-align: center; padding: 0.6rem 1rem calc(0.8rem + env(safe-area-inset-bottom)); color: var(--ink-2); font-size: 1rem; }
.lightbox-hint { color: var(--gold); font-weight: 700; }
@media (min-width: 900px) { .lightbox-scroll img.pan { height: auto; width: auto; max-width: calc(100vw - 4rem); max-height: 82vh; object-fit: contain; } }

/* ============================ STAGE ============================ */
#stage { flex: 1 0 auto; width: 100%; max-width: 980px; margin: 0 auto; padding: 1.25rem 1.25rem 4rem; padding: 1.25rem max(1.25rem, env(safe-area-inset-right)) calc(4rem + env(safe-area-inset-bottom)) max(1.25rem, env(safe-area-inset-left)); display: flex; flex-direction: column; gap: 1.25rem; outline: none; }

.timeline { list-style: none; display: flex; gap: 0.25rem; padding: 0.2rem 0.2rem 0; }
.tl-node { flex: 1; position: relative; text-align: center; min-width: 0; }
.tl-node::before { content: ''; position: absolute; top: 15px; left: -50%; width: 100%; height: 2px; background: rgba(221, 161, 94, 0.25); z-index: 0; }
.tl-node:first-child::before { display: none; }
.tl-node.done::before, .tl-node.current::before { background: var(--gold); }
.tl-btn { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 0.15rem; background: none; border: 0; padding: 0.15rem 0; width: 100%; color: var(--ink-3); font-size: 0.875rem; font-weight: 700; }
button.tl-btn:hover .tl-dot { border-color: var(--gold-light); }
.tl-dot { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; background: var(--slate); border: 2px solid rgba(221, 161, 94, 0.35); font-size: 0.9rem; font-weight: 700; }
.tl-node.done .tl-dot { background: radial-gradient(circle at 35% 35%, var(--gold-light), var(--gold)); border-color: var(--gold); color: var(--night); }
.tl-node.current .tl-dot { border-color: var(--gold-light); background: var(--slate-2); color: var(--gold-light); box-shadow: 0 0 14px var(--gold-glow); }
.tl-node.current .tl-btn, .tl-node.done .tl-btn { color: var(--cream); }

.card { background: var(--card); border: 1px solid rgba(221, 161, 94, 0.35); border-radius: var(--radius); box-shadow: 0 12px 45px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.08); overflow: hidden; }

.scene-frame { position: relative; width: 100%; aspect-ratio: 16 / 9; background: var(--night); overflow: hidden; border-bottom: 1px solid rgba(221, 161, 94, 0.3); }
.scene-frame img { width: 100%; height: 100%; object-fit: cover; }
.kenburns img { animation: kenBurns 26s ease-in-out infinite alternate; }
@keyframes kenBurns { from { transform: scale(1) translate(0, 0); } to { transform: scale(1.08) translate(-1%, -1%); } }
.scene-overlay { position: absolute; inset: 0; pointer-events: none; background: linear-gradient(to top, rgba(18, 30, 48, 0.96) 0%, rgba(18, 30, 48, 0.12) 46%, rgba(11, 19, 31, 0.3) 100%); }
.scene-frame.bright .scene-overlay { background: linear-gradient(to top, rgba(18, 30, 48, 0.75) 0%, rgba(18, 30, 48, 0) 38%); }
.scene-badge { position: absolute; top: 0.9rem; left: 0.9rem; z-index: 3; padding: 0.35rem 0.9rem; border-radius: 999px; background: rgba(11, 19, 31, 0.88); border: 1px solid var(--gold); color: var(--gold-light); font-size: 0.9375rem; font-weight: 700; letter-spacing: 0.05em; }

.story-content { padding: 1.6rem 2rem 2rem; display: flex; flex-direction: column; gap: 1.35rem; }
.eyebrow { font-size: 0.875rem; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: var(--gold); }
.stop-header { border-bottom: 1px dashed rgba(221, 161, 94, 0.25); padding-bottom: 0.9rem; }
.stop-title, .sealed-title { font-family: var(--font-title); font-weight: 700; font-size: 1.85rem; line-height: 1.25; letter-spacing: 0.03em; color: var(--ink); outline: none; }
.ending-how { margin-top: 0.3rem; font-size: 1rem; color: var(--gold); font-weight: 700; }
.story-prose { font-family: var(--font-prose); font-weight: 600; font-size: 1.32rem; line-height: 1.72; color: var(--cream); }
.story-prose p + p { margin-top: 0.9rem; }

.section-title { font-family: var(--font-title); font-weight: 700; font-size: 1.05rem; letter-spacing: 0.06em; color: var(--gold); display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.section-title.center { justify-content: center; }
.section-hint { font-size: 1rem; color: var(--ink-2); margin: 0.2rem 0 0.9rem; }

/* wish scroll */
.wish-scroll { position: relative; border-radius: 0.9rem; padding: 1.15rem 1.5rem; border: 1px solid var(--parchment-line); border-left-width: 6px; box-shadow: 0 6px 22px rgba(0, 0, 0, 0.4); color: var(--paper-ink); overflow: hidden; transition: background 1s, border-color 1s, box-shadow 1s; }
.wish-scroll.trapped { background: linear-gradient(135deg, #EAF2F8, #D6E4EE); border-left-color: var(--frost); }
.wish-scroll.trapped::after { content: '❄'; position: absolute; right: 0.8rem; top: 0.3rem; font-size: 2.4rem; opacity: 0.28; color: #5B7B96; }
.wish-scroll.freed { background: var(--parchment); border-left-color: var(--gold); box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4), 0 0 28px var(--gold-glow); }
.wish-scroll.just-freed { animation: thaw 1.4s ease-out; }
@keyframes thaw { 0% { filter: saturate(0.2) brightness(1.1); transform: scale(0.99); } 60% { transform: scale(1.015); } 100% { filter: none; transform: none; } }
.wish-label { font-size: 0.875rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--cranberry); margin-bottom: 0.25rem; }
.wish-scroll.trapped .wish-label { color: #3F6280; }
.wish-label span { text-transform: none; letter-spacing: 0.02em; font-weight: 600; opacity: 0.85; }
.wish-text { font-family: var(--font-prose); font-style: italic; font-weight: 600; font-size: 1.45rem; line-height: 1.5; }

/* deeds */
.coach { background: rgba(165, 196, 212, 0.14); border: 1px solid rgba(165, 196, 212, 0.45); border-radius: 0.8rem; padding: 0.8rem 1rem; font-size: 1rem; color: var(--ink-2); margin-bottom: 0.9rem; }
.deeds-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0.9rem; }
.deed-card { text-align: left; display: flex; flex-direction: column; gap: 0.45rem; padding: 1.1rem 1.15rem; border-radius: 0.9rem; background: rgba(13, 23, 38, 0.92); border: 1.5px solid rgba(221, 161, 94, 0.28); transition: all 0.22s; min-height: 44px; }
.deed-card:hover { border-color: var(--gold); transform: translateY(-2px); box-shadow: 0 8px 25px rgba(0, 0, 0, 0.45); }
.deed-card.selected { border-color: var(--gold-light); background: rgba(30, 48, 75, 0.98); box-shadow: 0 0 0 2px var(--gold), 0 0 26px var(--gold-glow); }
.deed-style { font-size: 0.875rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--gold); }
.deed-name { font-family: var(--font-title); font-weight: 700; font-size: 1.1rem; color: var(--ink); line-height: 1.25; }
.deed-desc { font-size: 1rem; color: var(--ink-2); line-height: 1.45; }
.deed-chips, .chips-row { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; margin-top: auto; padding-top: 0.2rem; }
.chip { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.25rem 0.65rem; border-radius: 999px; font-size: 0.875rem; font-weight: 700; border: 1px solid transparent; }
.chip-warm { background: rgba(196, 69, 71, 0.28); color: var(--berry-soft); border-color: rgba(196, 69, 71, 0.5); }
.chip-warm.neg { background: rgba(120, 40, 40, 0.5); }
.chip-res { background: rgba(221, 161, 94, 0.25); color: var(--gold-light); border-color: rgba(221, 161, 94, 0.5); }
.chip-item { background: rgba(20, 40, 32, 0.8); color: var(--ok); border-color: #65A30D; }
.chips-label { font-size: 0.875rem; font-weight: 700; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.08em; margin-left: 0.2rem; }
.chips-row { margin-top: 0.8rem; }
.deed-footnote { margin-top: 0.8rem; font-size: 0.9375rem; color: var(--ink-3); }
.deed-confirm { margin-top: 1rem; display: flex; justify-content: center; }

/* outcome */
.outcome { background: linear-gradient(180deg, rgba(221, 161, 94, 0.14), rgba(13, 23, 38, 0.6)); border: 1px solid rgba(221, 161, 94, 0.45); border-radius: 1rem; padding: 1.35rem 1.5rem; outline: none; animation: fadeUp 0.7s ease both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.outcome-kicker { font-family: var(--font-title); font-weight: 700; font-size: 1.1rem; letter-spacing: 0.05em; color: var(--gold-light); margin-bottom: 0.5rem; }
.outcome-text { font-family: var(--font-prose); font-weight: 600; font-size: 1.32rem; line-height: 1.7; color: var(--cream); }
.chime-card { margin-top: 1rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding: 0.9rem 1rem; border-radius: 0.8rem; background: rgba(11, 19, 31, 0.7); border: 1px dashed rgba(221, 161, 94, 0.45); }
.chime-kicker { font-size: 0.875rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--gold); }
.chime-name { font-family: var(--font-title); font-weight: 700; font-size: 1.05rem; color: var(--ink); margin: 0.1rem 0 0.4rem; }
.chime-pips { list-style: none; display: flex; gap: 0.4rem; max-width: 100%; }
.chime-card > div { min-width: 0; flex: 1 1 180px; }
.pip { display: flex; flex-direction: column; align-items: center; flex: 1 1 0; min-width: 0; max-width: 34px; padding: 0.15rem 0; border-radius: 0.6rem; opacity: 0.35; filter: grayscale(1); transition: all 0.5s; }
.pip .pip-note { font-size: 0.875rem; font-weight: 700; color: var(--ink-3); line-height: 1; }
.pip .pip-bell { font-size: 1.15rem; line-height: 1.3; }
.pip.lit { opacity: 1; filter: none; background: rgba(221, 161, 94, 0.18); box-shadow: 0 0 14px var(--gold-glow); }
.pip.lit .pip-note { color: var(--gold-light); }
.chime-pips.big { justify-content: center; gap: 0.7rem; width: 100%; }
.chime-pips.big .pip { flex: 0 1 50px; width: 50px; min-width: 0; padding: 0.3rem 0; }
.chime-pips.big .pip-bell { font-size: 1.7rem; }

.item-gain, .item-offer { display: flex; gap: 1rem; align-items: center; margin-top: 1rem; padding: 0.9rem 1rem; border-radius: 0.9rem; background: rgba(20, 40, 32, 0.75); border: 1px solid #65A30D; }
.item-offer { margin-top: 0; background: rgba(20, 40, 32, 0.6); border-style: dashed; }
.item-gain img, .item-offer img { width: 76px; height: 76px; border-radius: 0.7rem; object-fit: cover; border: 1.5px solid var(--gold); flex: 0 0 auto; }
.item-kicker { font-size: 0.875rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ok); }
.item-gain p, .item-offer p { font-size: 1rem; color: var(--ink-2); margin: 0.15rem 0 0.5rem; line-height: 1.45; }
.item-used { padding: 1rem 1.25rem; border-radius: 0.9rem; background: rgba(20, 40, 32, 0.75); border: 1px solid #65A30D; animation: fadeUp 0.6s ease both; }
.item-used p { font-family: var(--font-prose); font-weight: 600; font-size: 1.22rem; line-height: 1.6; color: var(--cream); margin-top: 0.4rem; }

.roads { margin-top: 0.9rem; font-size: 1rem; color: var(--ink-2); }
.roads summary { cursor: pointer; font-weight: 700; color: var(--gold); padding: 0.3rem 0; min-height: 44px; display: flex; align-items: center; gap: 0.5rem; list-style: none; }
.roads summary::-webkit-details-marker { display: none; }
.roads summary::before { content: '▸'; display: inline-block; transition: transform 0.2s; }
.roads[open] summary::before { transform: rotate(90deg); }
.roads ul { margin: 0.4rem 0 0 1.2rem; display: flex; flex-direction: column; gap: 0.4rem; }

/* journal */
.journal-desk { background: var(--cream); color: #2D2218; border-radius: 1rem; border: 1px solid var(--parchment-line); padding: 1.4rem 1.5rem; box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.05), 0 8px 30px rgba(0, 0, 0, 0.35); }
.journal-head { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; flex-wrap: wrap; margin-bottom: 0.5rem; }
.journal-kicker { font-size: 0.9375rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--cranberry); }
.journal-prompt { font-family: var(--font-prose); font-style: italic; font-weight: 600; font-size: 1.4rem; line-height: 1.5; color: #261B12; margin-bottom: 0.8rem; }
.oracle-note { background: #FAF3E8; border: 1px dashed #CDB9A2; border-radius: 0.6rem; padding: 0.5rem 0.8rem; font-size: 1rem; color: #4A3828; margin-bottom: 0.7rem; }
.starters { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-bottom: 0.6rem; }
.starters-label { font-size: 0.9375rem; font-weight: 700; color: #6B5845; }
.chip-btn { background: #EFE4D3; color: #4A3828; border: 1px solid #CDB9A2; border-radius: 999px; padding: 0.4rem 0.9rem; font-size: 0.9375rem; font-weight: 600; min-height: 40px; text-align: left; }
.chip-btn:hover { background: #E4D3BA; }
.btn-oracle { background: #EFE4D3; color: #4A3828; border: 1px solid #CDB9A2; border-radius: 999px; padding: 0.45rem 1rem; font-size: 0.9375rem; font-weight: 700; min-height: 44px; }
.btn-oracle:hover { background: #E4D3BA; }
.journal-textarea { width: 100%; min-height: 150px; background: transparent; border: 0; border-top: 1px dashed #D5C4AF; border-bottom: 1px dashed #D5C4AF; padding: 0.8rem 0.25rem; font-family: var(--font-hand); font-weight: 500; font-size: 1.65rem; line-height: 1.6; color: #1A120A; resize: vertical; outline: none; }
.journal-textarea:focus { border-color: var(--gold-dim); box-shadow: 0 2px 0 var(--gold-dim); }
.journal-textarea::placeholder { color: #8C7A67; opacity: 1; }
.journal-footer { display: flex; justify-content: space-between; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.7rem; font-size: 0.9375rem; color: #6B5845; }

.stop-nav { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-top: 0.4rem; }

/* ============================ BUTTONS ============================ */
.btn-primary { display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; min-height: 48px; padding: 0.8rem 1.7rem; border: 0; border-radius: 999px; background: radial-gradient(circle at 35% 30%, var(--gold-light), var(--gold) 60%, var(--gold-dim)); color: var(--night); font-family: var(--font-title); font-weight: 700; font-size: 1rem; letter-spacing: 0.05em; box-shadow: 0 4px 18px var(--gold-glow); transition: all 0.22s; text-align: center; }
.btn-primary:hover:not(:disabled) { transform: translateY(-2px); filter: brightness(1.08); box-shadow: 0 6px 26px var(--gold-glow); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; filter: grayscale(0.4); }
.btn-xl { font-size: 1.12rem; padding: 1rem 2.4rem; }
.btn-secondary { display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem; min-height: 44px; padding: 0.6rem 1.25rem; border-radius: 999px; background: rgba(22, 34, 56, 0.9); border: 1px solid rgba(221, 161, 94, 0.4); color: var(--cream); font-family: var(--font-ui); font-weight: 700; font-size: 1rem; transition: all 0.2s; text-align: center; }
.btn-secondary:hover { background: rgba(30, 48, 75, 1); border-color: var(--gold); transform: translateY(-1px); }
.btn-danger { color: var(--berry-soft); border-color: rgba(196, 69, 71, 0.6); }
.link-btn { background: none; border: 0; color: var(--gold); text-decoration: underline; font-weight: 700; font-size: inherit; padding: 0.3rem 0.2rem; min-height: 40px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; }
.btn-row.center { justify-content: center; }
.pill { display: inline-flex; align-items: center; padding: 0.2rem 0.7rem; border-radius: 999px; background: rgba(255, 255, 255, 0.07); border: 1px solid rgba(221, 161, 94, 0.3); font-size: 0.875rem; font-weight: 700; color: var(--ink-2); font-family: var(--font-ui); letter-spacing: 0; text-transform: none; }
.pill-gold { background: rgba(221, 161, 94, 0.22); border-color: var(--gold); color: var(--gold-light); }

/* ============================ TITLE ============================ */
.hero { aspect-ratio: 16 / 9; max-height: 560px; }
.hero-overlay { background: linear-gradient(to top, rgba(11, 19, 31, 0.95) 0%, rgba(11, 19, 31, 0.35) 55%, rgba(11, 19, 31, 0.1) 100%); }
.hero-text { position: absolute; left: 0; right: 0; bottom: 0; z-index: 3; padding: 1.5rem 2rem; text-align: center; }
.hero-title { font-family: var(--font-title); font-weight: 700; font-size: clamp(1.9rem, 5.2vw, 3.1rem); line-height: 1.15; letter-spacing: 0.06em; color: var(--gold-light); text-shadow: 0 4px 22px #000, 0 0 34px var(--gold-glow); outline: none; margin: 0.2rem 0; }
.hero-title span { color: var(--gold); }
.hero-sub { font-family: var(--font-prose); font-style: italic; font-weight: 600; font-size: clamp(1.15rem, 2.6vw, 1.5rem); color: var(--cream); text-shadow: 0 2px 10px #000; }
.title-body { align-items: stretch; gap: 1.6rem; }
.cta-row { display: flex; flex-wrap: wrap; gap: 0.8rem; justify-content: center; }
.meta-line { text-align: center; font-size: 0.9375rem; color: var(--ink-3); margin-top: -0.6rem; }
.bramble-card { display: flex; gap: 1.4rem; align-items: center; flex-wrap: wrap; padding: 1.3rem; border-radius: 1rem; background: rgba(13, 23, 38, 0.85); border: 1.5px solid var(--gold); box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5); }
.bramble-card > div { flex: 1 1 280px; }
.bramble-card h2 { font-family: var(--font-title); font-size: 1.3rem; color: var(--gold-light); margin-bottom: 0.3rem; }
.bramble-card p { font-size: 1.0625rem; color: var(--ink-2); line-height: 1.55; margin-bottom: 0.8rem; }
.bramble-portrait { width: 150px; height: 150px; border-radius: 50%; object-fit: cover; border: 2px solid var(--gold); box-shadow: 0 0 22px var(--gold-glow); flex: 0 0 auto; margin: 0 auto; }
.rules-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 0.9rem; }
.rule-card { background: rgba(11, 19, 31, 0.75); border: 1px solid rgba(221, 161, 94, 0.28); border-radius: 0.9rem; padding: 1.1rem; }
.rule-title { font-family: var(--font-title); font-weight: 700; font-size: 1rem; color: var(--gold-light); margin-bottom: 0.35rem; }
.rule-card p { font-size: 1rem; color: var(--ink-2); line-height: 1.5; }
.endings-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0.8rem; }
.ending-tile { display: flex; flex-direction: column; gap: 0.5rem; border-radius: 0.9rem; overflow: hidden; background: rgba(11, 19, 31, 0.75); border: 1px dashed rgba(221, 161, 94, 0.3); padding: 0.6rem; font-size: 0.9375rem; font-weight: 700; text-align: center; }
.ending-tile.found { border-style: solid; border-color: var(--gold); }
.ending-tile img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 0.55rem; }
.ending-lock { aspect-ratio: 16 / 9; display: grid; place-items: center; border-radius: 0.55rem; background: repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.04) 8px, transparent 8px, transparent 16px); font-family: var(--font-title); font-size: 2.2rem; color: var(--gold-dim); }

/* ============================ SEALED / MIDNIGHT / ENDING ============================ */
.sealed-card { padding: 2.2rem 1.6rem 2rem; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 1rem; }
.wax-seal { width: 92px; height: 92px; border-radius: 50%; display: grid; place-items: center; font-size: 2.6rem; background: radial-gradient(circle at 35% 30%, #D8585A, var(--cranberry) 62%, #5E1415); box-shadow: 0 6px 20px rgba(0, 0, 0, 0.6), inset 0 -4px 8px rgba(0, 0, 0, 0.35), inset 0 3px 6px rgba(255, 255, 255, 0.25); animation: stamp 0.7s cubic-bezier(.2, 1.4, .4, 1) both; }
@keyframes stamp { 0% { transform: scale(2.2) rotate(-18deg); opacity: 0; } 70% { transform: scale(0.94) rotate(3deg); opacity: 1; } 100% { transform: none; } }
.sealed-chime { font-family: var(--font-prose); font-weight: 600; font-size: 1.4rem; color: var(--cream); }
.mini-meters, .final-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; width: 100%; max-width: 560px; }
.final-stats { max-width: none; }
.stat { background: rgba(13, 23, 38, 0.85); border: 1.5px solid rgba(221, 161, 94, 0.45); border-radius: 0.9rem; padding: 0.9rem 1rem; text-align: left; }
.stat-top { display: flex; justify-content: space-between; align-items: baseline; font-size: 0.9375rem; font-weight: 700; color: var(--ink-2); margin-bottom: 0.7rem; }
.stat-top strong { font-family: var(--font-title); font-size: 1.5rem; color: var(--gold-light); }
.teaser { font-family: var(--font-prose); font-style: italic; font-weight: 600; font-size: 1.28rem; line-height: 1.6; color: var(--ink-2); max-width: 640px; }

.midnight-card { padding: 2.4rem 1.5rem; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 1.1rem; background: radial-gradient(circle at 50% 0%, #1C2D4A, #0B131F 70%); min-height: 70vh; justify-content: center; }
.clock svg { filter: drop-shadow(0 0 22px var(--gold-glow)); }
.midnight-line { font-family: var(--font-prose); font-style: italic; font-weight: 600; font-size: 1.5rem; color: var(--cream); min-height: 2.2rem; }

.echo-list { list-style: none; display: flex; flex-direction: column; gap: 0.8rem; }
.echo { display: flex; gap: 1rem; padding: 0.9rem 1rem; border-radius: 0.8rem; background: rgba(13, 23, 38, 0.8); border: 1px solid rgba(221, 161, 94, 0.25); }
.echo.small { background: rgba(20, 40, 32, 0.6); border-color: rgba(101, 163, 13, 0.4); }
.echo-hour { flex: 0 0 auto; min-width: 3.4rem; font-family: var(--font-title); font-weight: 700; font-size: 1.05rem; color: var(--gold); }
.echo-top { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; margin-bottom: 0.25rem; }
.echo p { font-family: var(--font-prose); font-weight: 600; font-size: 1.2rem; line-height: 1.5; color: var(--cream); }
.try-next { font-size: 1.0625rem; color: var(--ink-2); background: rgba(221, 161, 94, 0.12); border: 1px dashed var(--gold); border-radius: 0.8rem; padding: 0.8rem 1rem; }
.ending-actions { justify-content: center; margin-top: 0.4rem; }

/* ============================ MODALS ============================ */
.modal-backdrop { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 1rem; background: rgba(8, 13, 21, 0.86); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); opacity: 0; visibility: hidden; pointer-events: none; transition: opacity 0.25s, visibility 0.25s; }
.modal-backdrop.open { opacity: 1; visibility: visible; pointer-events: auto; }
.modal-card { position: relative; width: 100%; max-width: 640px; max-height: 90vh; max-height: 90dvh; overflow-y: auto; display: flex; flex-direction: column; gap: 1.1rem; padding: 1.8rem; background: var(--card-solid); border: 1px solid var(--gold); border-radius: var(--radius); box-shadow: 0 15px 50px rgba(0, 0, 0, 0.7), 0 0 25px var(--gold-glow); overscroll-behavior: contain; }
.modal-card.wide { max-width: 820px; }
.modal-card.narrow { max-width: 480px; }
.modal-close { position: absolute; top: 0.7rem; right: 0.7rem; z-index: 2; width: 44px; height: 44px; border: 0; border-radius: 50%; background: transparent; color: var(--cream); font-size: 1.8rem; line-height: 1; }
.modal-close:hover { background: rgba(255, 255, 255, 0.12); }
.modal-title { font-family: var(--font-title); font-weight: 700; font-size: 1.4rem; line-height: 1.3; color: var(--gold-light); padding-right: 2.5rem; }
.modal-title.center { padding: 0; }
.modal-lead { font-size: 1.0625rem; color: var(--ink-2); line-height: 1.55; }
.modal-lead.center { text-align: center; max-width: 520px; margin: 0 auto; }
.modal-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; justify-content: flex-end; }

.satchel-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0.9rem; }
.satchel-item { display: flex; flex-direction: column; align-items: center; gap: 0.4rem; text-align: center; padding: 1.1rem 0.9rem; border-radius: 0.9rem; background: rgba(11, 19, 31, 0.7); border: 1px dashed rgba(221, 161, 94, 0.3); }
.satchel-item.active { border: 1.5px solid var(--gold); background: rgba(22, 38, 62, 0.85); }
.satchel-item img { width: 72px; height: 72px; border-radius: 0.6rem; object-fit: cover; border: 1.5px solid var(--gold); }
.item-emoji { font-size: 2.4rem; } .item-emoji.dim { opacity: 0.25; }
.item-name { font-family: var(--font-title); font-weight: 700; font-size: 1rem; color: var(--ink); }
.item-desc { font-size: 0.9375rem; color: var(--ink-3); line-height: 1.4; }
.item-hint { font-size: 0.9375rem; color: var(--ok); font-weight: 600; }
.satchel-gifts { grid-column: 1 / -1; font-size: 1rem; color: var(--ink-2); }
.satchel-gifts h3 { font-size: 1rem; color: var(--gold); margin-bottom: 0.3rem; }
.satchel-gifts ul { list-style: none; display: flex; flex-direction: column; gap: 0.3rem; }

.wish-row, .chron-row { padding: 1.1rem 1.2rem; border-radius: 0.85rem; background: rgba(11, 19, 31, 0.85); border: 1px solid rgba(221, 161, 94, 0.2); }
.wish-row.freed { border-color: var(--gold); }
.wish-row-top, .chron-top { display: flex; justify-content: space-between; align-items: center; gap: 0.6rem; flex-wrap: wrap; font-size: 0.9375rem; font-weight: 700; color: var(--gold); }
.wish-row-text { font-family: var(--font-prose); font-style: italic; font-weight: 600; font-size: 1.25rem; color: var(--cream); margin: 0.35rem 0; line-height: 1.5; }
.wish-row-meta { font-size: 0.9375rem; color: var(--ink-3); }
.chron-prompt { font-size: 0.9375rem; color: var(--ink-3); margin: 0.4rem 0; font-style: italic; }
.chron-text { font-family: var(--font-hand); font-size: 1.5rem; line-height: 1.5; color: var(--cream); white-space: pre-wrap; overflow-wrap: anywhere; }
.chron-text.empty { font-family: var(--font-ui); font-size: 1rem; color: var(--ink-3); }

.set-block { display: flex; flex-direction: column; gap: 0.6rem; padding-top: 1rem; border-top: 1px dashed rgba(221, 161, 94, 0.25); }
.set-block:first-of-type { border-top: 0; padding-top: 0; }
.set-block h3 { font-size: 0.9375rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--gold); }
.set-block label { font-size: 1rem; font-weight: 600; color: var(--ink-2); }
.set-block select, .name-row input { width: 100%; min-height: 48px; padding: 0.6rem 0.9rem; border-radius: 0.6rem; background: var(--night); border: 1px solid var(--gold); color: #fff; font-size: 1rem; }
.set-block input[type=range] { width: 100%; accent-color: var(--gold); min-height: 44px; }
.check { display: flex; align-items: center; gap: 0.7rem; min-height: 44px; cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--gold); flex: 0 0 auto; }
.install-box { flex-direction: row !important; align-items: center; flex-wrap: wrap; background: rgba(11, 19, 31, 0.85); border: 1.5px solid var(--gold) !important; border-radius: 0.9rem; padding: 1rem !important; }
.install-box img { border-radius: 12px; }
.install-box > div { flex: 1 1 200px; } .install-box p { font-size: 0.9375rem; color: var(--ink-3); }
.name-row { display: flex; flex-direction: column; gap: 0.4rem; }
.name-row label { font-size: 1rem; font-weight: 600; color: var(--ink-2); }

.oracle-card { max-width: 600px; }
.oracle-card .eyebrow { text-align: center; }
.dice-stage { perspective: 800px; width: 140px; height: 140px; margin: 0.5rem auto; display: grid; place-items: center; cursor: pointer; }
.dice-cube { width: 90px; height: 90px; position: relative; transform-style: preserve-3d; transform: rotateX(-22deg) rotateY(28deg); transition: transform 1.6s cubic-bezier(0.18, 0.9, 0.28, 1.02); }
.dice-face { position: absolute; width: 90px; height: 90px; display: flex; flex-direction: column; align-items: center; justify-content: center; background: radial-gradient(circle at 35% 35%, #223754, #0D1623); border: 2px solid var(--gold); border-radius: 14px; box-shadow: inset 0 0 14px rgba(221, 161, 94, 0.3); backface-visibility: hidden; font-family: var(--font-title); color: var(--gold-light); }
.face-1 { transform: rotateY(0deg) translateZ(45px); } .face-2 { transform: rotateY(180deg) translateZ(45px); }
.face-3 { transform: rotateY(90deg) translateZ(45px); } .face-4 { transform: rotateY(-90deg) translateZ(45px); }
.face-5 { transform: rotateX(90deg) translateZ(45px); } .face-6 { transform: rotateX(-90deg) translateZ(45px); }
.pip-icon { font-size: 2rem; line-height: 1; filter: drop-shadow(0 0 8px var(--gold-glow)); }
.pip-num { font-size: 0.875rem; font-weight: 700; color: var(--gold); margin-top: 3px; }
.oracle-result { background: rgba(11, 19, 31, 0.92); border: 1.5px solid var(--gold); border-radius: 0.9rem; padding: 1.2rem; display: flex; flex-direction: column; gap: 0.7rem; animation: fadeUp 0.5s ease both; }
.oracle-result-top { display: flex; justify-content: space-between; align-items: center; gap: 0.6rem; flex-wrap: wrap; font-family: var(--font-title); font-size: 1.15rem; color: var(--gold-light); }
.oracle-omen { font-family: var(--font-prose); font-style: italic; font-weight: 600; font-size: 1.25rem; line-height: 1.5; color: var(--cream); }
.oracle-prompt { background: rgba(22, 34, 56, 0.75); border-left: 3px solid var(--gold); border-radius: 0 0.5rem 0.5rem 0; padding: 0.8rem 1rem; font-size: 1.0625rem; color: var(--ink); line-height: 1.5; }

/* ============================ TOAST / ORB ============================ */
.toast { position: fixed; left: 50%; bottom: max(1.2rem, env(safe-area-inset-bottom)); z-index: 200; transform: translate(-50%, 30px); max-width: min(560px, calc(100vw - 2rem)); padding: 0.85rem 1.3rem; border-radius: 0.9rem; background: rgba(11, 19, 31, 0.97); border: 1px solid var(--gold); box-shadow: 0 10px 34px rgba(0, 0, 0, 0.7), 0 0 20px var(--gold-glow); color: var(--gold-light); font-weight: 700; font-size: 1rem; line-height: 1.45; text-align: center; opacity: 0; pointer-events: none; transition: opacity 0.3s, transform 0.3s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.wish-orb { position: fixed; left: 0; top: 0; z-index: 150; width: 22px; height: 22px; margin: -11px 0 0 -11px; border-radius: 50%; pointer-events: none; background: radial-gradient(circle, #fff, var(--gold-light) 35%, var(--gold) 65%, transparent 72%); box-shadow: 0 0 22px 8px var(--gold-glow); }

/* ============================ KEEPSAKE (screen) ============================ */
.ks { background: #FFFDF9; color: var(--paper-ink); border-radius: 0.8rem; padding: 1.6rem; min-width: 0; overflow-wrap: anywhere; font-family: var(--font-prose); font-weight: 600; font-size: 1.1rem; line-height: 1.55; }
.ks-page { text-align: center; padding-bottom: 1.4rem; border-bottom: 2px solid #8B7355; margin-bottom: 1.4rem; }
.ks-hero { width: 100%; max-height: 260px; object-fit: cover; border-radius: 0.6rem; border: 2px solid #8B7355; margin-bottom: 1rem; }
.ks-title { font-family: var(--font-title); font-size: 1.9rem; color: #801E20; letter-spacing: 0.06em; line-height: 1.2; }
.ks-sub { font-style: italic; color: #7A5326; font-size: 1.2rem; margin-bottom: 1rem; }
.ks-cert { border: 3px double #8B7355; background: #FAF5EB; padding: 1.3rem; max-width: 640px; margin: 0 auto; }
.ks-cert h2 { font-family: var(--font-title); font-size: 1.15rem; color: #801E20; margin-bottom: 0.5rem; }
.ks-name { font-size: 1.3rem; color: #801E20; }
.ks-stats { display: flex; justify-content: center; gap: 1.6rem; flex-wrap: wrap; margin: 1rem 0 0.6rem; }
.ks-stats span { display: block; font-family: var(--font-ui); font-size: 0.875rem; text-transform: uppercase; letter-spacing: 0.06em; color: #7A5326; }
.ks-stats strong { font-family: var(--font-title); font-size: 1.5rem; color: #801E20; }
.ks-ending { margin-top: 0.4rem; } .ks-date { font-size: 1rem; color: #8C755E; }
.ks-section { margin-bottom: 1.4rem; }
.ks-section h3 { font-family: var(--font-title); font-size: 1.1rem; color: #801E20; border-bottom: 1px solid #D5C4AF; padding-bottom: 0.3rem; margin-bottom: 0.8rem; letter-spacing: 0.05em; }
.ks-night { list-style: none; display: flex; flex-direction: column; font-family: var(--font-ui); font-size: 1rem; }
.ks-night li { display: flex; gap: 0.9rem; padding: 0.55rem 0.1rem; border-bottom: 1px solid #E6D9C6; min-width: 0; }
.ks-night .ks-hr { flex: 0 0 3.6rem; font-family: var(--font-title); font-weight: 700; color: #801E20; }
.ks-night li > div { min-width: 0; overflow-wrap: anywhere; }
.ks-night .ks-sub2 { display: block; color: #7A5326; font-size: 0.9375rem; }
.ks-entry { padding-bottom: 0.9rem; margin-bottom: 0.9rem; border-bottom: 1px dashed #D5C4AF; }
.ks-entry-head { display: flex; justify-content: space-between; gap: 0.5rem; flex-wrap: wrap; align-items: baseline; }
.ks-entry h4 { font-family: var(--font-title); font-size: 1.05rem; color: #801E20; }
.ks-entry-head span { font-family: var(--font-ui); font-size: 0.9375rem; color: #7A5326; }
.ks-wish { font-style: italic; color: #5C4A3A; margin: 0.2rem 0; }
.ks-prompt { font-family: var(--font-ui); font-size: 0.9375rem; color: #7A6553; margin-bottom: 0.4rem; }
.ks-text { font-family: var(--font-hand); font-size: 1.55rem; line-height: 1.5; color: #1F160E; white-space: pre-wrap; overflow-wrap: anywhere; }
.ks-text.empty, .ks-empty { font-family: var(--font-ui); font-size: 1rem; color: #8C755E; font-style: italic; }
.ks-items { list-style: none; display: flex; flex-direction: column; gap: 0.3rem; font-family: var(--font-ui); }
.ks-items span { color: #7A6553; }
.ks-blessing { text-align: center; font-style: italic; color: #7A5326; font-size: 1.25rem; margin-top: 1.2rem; }

/* ============================ PRINT: only the keepsake ============================ */
@media print {
  @page { margin: 16mm 14mm; }
  html, body { background: #fff !important; color: #000 !important; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; animation: none !important; }
  body.keepsake-open > *:not(#modalKeepsake) { display: none !important; }
  body.keepsake-open #modalKeepsake { display: block !important; position: static !important; opacity: 1 !important; visibility: visible !important; background: none !important; backdrop-filter: none !important; padding: 0 !important; }
  body.keepsake-open #modalKeepsake .modal-card { max-height: none !important; overflow: visible !important; box-shadow: none !important; border: 0 !important; background: #fff !important; padding: 0 !important; max-width: none !important; display: block !important; }
  .no-print { display: none !important; }
  .ks { padding: 0; border-radius: 0; }
  .ks-page { break-after: page; border-bottom: 0; }
  .ks-entry, .ks-night li, .ks-cert { break-inside: avoid; }
  .ks-hero { max-height: 90mm; }
  .ks-section h3 { break-after: avoid; }
}

/* ============================ RESPONSIVE ============================ */
@media (min-width: 1301px) and (max-width: 1500px) {
  .sat-emoji { display: none; }
  .hud .bar-track { width: 66px; }
  .hud { gap: 0.5rem 0.9rem; }
}
@media (max-width: 1300px) {
  .hud { grid-template-columns: 1fr auto; padding: 0.5rem 0.9rem; }
  .hud-meters { grid-column: 1 / -1; grid-row: 2; justify-content: stretch; }
  .meter { flex: 1 1 140px; justify-content: space-between; }
  .bar-track { flex: 1 1 auto; width: auto; min-width: 40px; }
  .satchel-hud { flex: 0 0 auto; }
}
@media (max-width: 640px) {
  .hud { position: static; display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 0.4rem; padding: 0.5rem 0.7rem 0.6rem; padding: calc(0.5rem + env(safe-area-inset-top)) max(0.7rem, env(safe-area-inset-right)) 0.6rem max(0.7rem, env(safe-area-inset-left)); }
  .hud-meters, .hud-actions { display: contents; }
  .hud-brand { grid-column: 1 / 9; grid-row: 1; gap: 0.35rem; }
  .act-sound { grid-column: 9 / 11; grid-row: 1; }
  .act-settings { grid-column: 11 / 13; grid-row: 1; }
  #meterResonance { grid-column: 1 / 7; grid-row: 2; }
  #meterWarmth { grid-column: 7 / 13; grid-row: 2; }
  #satchelBtn { grid-column: 1 / 7; grid-row: 3; }
  .act-wishes { grid-column: 7 / 9; grid-row: 3; }
  .act-journal { grid-column: 9 / 11; grid-row: 3; }
  .act-keepsake { grid-column: 11 / 13; grid-row: 3; }
  .icon-btn { width: 100%; height: 44px; border-radius: 999px; }
  .bell-emblem, .avatar-btn { width: 40px; height: 40px; }
  .brand-text { padding: 0.1rem 0.2rem; }
  .brand-name { font-size: 1.1rem; letter-spacing: 0.08em; }
  .brand-mood { overflow: hidden; text-overflow: ellipsis; }
  .meter { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "label val" "bar bar"; align-items: center; gap: 0.2rem 0.4rem; min-height: 48px; padding: 0.3rem 0.7rem 0.4rem; border-radius: 1rem; }
  .meter-label { grid-area: label; font-size: 0.875rem; }
  .meter-val { grid-area: val; font-size: 0.875rem; min-width: 0; }
  .meter .bar-track { grid-area: bar; width: 100%; height: 8px; }
  .meter.at-mark .meter-val::after { content: ''; }
  .satchel-hud { justify-content: space-between; gap: 0.25rem; padding: 0.2rem 0.55rem; }
  .sat-emoji { display: none; }
  .slot { width: 26px; height: 26px; }
  #stage { padding: 0.9rem 0.8rem 3rem; }
  .story-content { padding: 1.2rem 1.1rem 1.5rem; }
  .stop-title, .sealed-title { font-size: 1.5rem; }
  .story-prose, .outcome-text { font-size: 1.2rem; }
  .wish-text { font-size: 1.3rem; }
  .journal-desk { padding: 1.1rem; }
  .journal-textarea { font-size: 1.5rem; }
  .hero-text { padding: 1rem; }
  .mini-meters, .final-stats { grid-template-columns: 1fr; }
  .stop-nav { flex-direction: column-reverse; align-items: stretch; }
  .stop-nav .btn-primary, .stop-nav .btn-secondary { width: 100%; }
  .modal-card { padding: 1.3rem 1.1rem; }
  .item-gain, .item-offer { flex-direction: column; text-align: center; }
  .echo { flex-direction: column; gap: 0.2rem; }
  .tl-dot { width: 30px; height: 30px; font-size: 0.875rem; }
  .tl-node::before { top: 14px; }
  .chime-pips.big { gap: 0.3rem; }
  .chime-pips.big .pip { flex: 1 1 0; width: auto; max-width: 52px; }
  .chime-pips.big .pip-bell { font-size: 1.45rem; }
  .ks { padding: 1rem; }
  .ks-cert { padding: 1rem; }
  .ks-title { font-size: 1.55rem; }
  .ks-stats { gap: 1rem; }
  .ks-night li { gap: 0.6rem; }
  .ks-night .ks-hr { flex-basis: 3.2rem; }
}
@media (max-width: 360px) {
  .bell-emblem, .avatar-btn { width: 36px; height: 36px; }
  .brand-name { font-size: 1rem; }
}
/* short landscape phones: a sticky header would eat a third of the screen */
@media (max-height: 520px) and (orientation: landscape) { .hud { position: static; } }

/* ============================ MOTION ============================ */
body.gentle .kenburns img, body.gentle .bell-emblem.ringing, body.gentle .wish-scroll.just-freed, body.gentle .wax-seal { animation: none; }
body.gentle .deed-card:hover, body.gentle .btn-primary:hover { transform: none; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
  .dice-cube { transition-duration: 0.3s !important; }
}
