/* Prism Garden - one palette, three chapter skies. */
@property --sky-1 { syntax: '<color>'; inherits: true; initial-value: #04061a; }
@property --sky-2 { syntax: '<color>'; inherits: true; initial-value: #0b1440; }
@property --sky-3 { syntax: '<color>'; inherits: true; initial-value: #1d2f66; }
@property --hill-far { syntax: '<color>'; inherits: true; initial-value: #121c45; }
@property --hill-mid { syntax: '<color>'; inherits: true; initial-value: #0b1131; }
@property --fg { syntax: '<color>'; inherits: true; initial-value: #060a1e; }

:root {
  --ink: #0b0a1f;
  --ink-2: #15123a;
  --panel: rgba(16, 13, 44, 0.72);
  --line: rgba(255, 222, 160, 0.18);
  --text: #f6eedb;
  --text-dim: rgba(246, 238, 219, 0.68);
  --brass: #d9a24f;
  --brass-hi: #ffe0a0;
  --brass-lo: #7a4f1e;
  --red: #ff4a6b;
  --blue: #3f7dff;
  --purple: #b86dff;
  --leaf: #4f8a5f;
  --danger: #ff9a8a;
  --f-display: 'Fraunces', 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif;
  --f-ui: 'Figtree', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --flower-1: #3c2a5c; --flower-2: #2e2350; --flower-3: #4a2f5a;
  --star-op: 1; --moon-op: 1; --dusk-op: 0; --dawn-op: 0;
  color-scheme: dark;
}
body[data-theme="dusk"] {
  --sky-1: #1b1140; --sky-2: #5c2a68; --sky-3: #ee8a52;
  --hill-far: #3d2152; --hill-mid: #22123a; --fg: #130a24;
  --star-op: .45; --moon-op: 0; --dusk-op: 1; --dawn-op: 0;
  --flower-1: #6b2f5f; --flower-2: #8a3f4f; --flower-3: #4f2a6b;
}
body[data-theme="midnight"] {
  --sky-1: #03051a; --sky-2: #0b1442; --sky-3: #1f3270;
  --hill-far: #131d48; --hill-mid: #0a1131; --fg: #050a1d;
}
body[data-theme="dawn"] {
  --sky-1: #46427e; --sky-2: #d4949e; --sky-3: #ffdca6;
  --hill-far: #8a759f; --hill-mid: #4b3f70; --fg: #241d44;
  --star-op: .12; --moon-op: 0; --dusk-op: 0; --dawn-op: 1;
  --flower-1: #e9a0b8; --flower-2: #f6d3a0; --flower-3: #b9a3e6;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--ink);
  color: var(--text);
  font: 500 16px/1.4 var(--f-ui);
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none; user-select: none;
  -webkit-font-smoothing: antialiased;
  transition: --sky-1 1.4s, --sky-2 1.4s, --sky-3 1.4s, --hill-far 1.4s, --hill-mid 1.4s, --fg 1.4s;
}
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible { outline: 2px solid var(--brass-hi); outline-offset: 3px; }
h1, h2, h3, p { margin: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ic { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- background ---------- */
.garden { position: fixed; inset: 0; z-index: 0; }
.garden-svg { width: 100%; height: 100%; display: block; }
.garden::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(8, 6, 26, .35), transparent 28%, transparent 62%, rgba(8, 6, 26, .5));
}
.stars { fill: #fff; opacity: var(--star-op); transition: opacity 1.4s; }
.stars .tw { animation: twinkle 4s ease-in-out infinite; }
.moon { opacity: var(--moon-op); transition: opacity 1.4s; }
.sun-dusk { opacity: var(--dusk-op); transition: opacity 1.4s; }
.sun-dawn { opacity: var(--dawn-op); transition: opacity 1.4s; }
.fg { fill: var(--fg); }
.fg .stem { fill: none; stroke: var(--hill-mid); stroke-width: 2; }
.fg .pistil { fill: #ffe7a8; opacity: .55; }
.bg-lamp { animation: flicker 3.4s ease-in-out infinite; }
.fx-ambient, .fx-top { position: fixed; inset: 0; pointer-events: none; }
.fx-ambient { z-index: 1; }
.fx-top { z-index: 40; }

/* ---------- screens ---------- */
.app { position: fixed; inset: 0; z-index: 2; }
.screen {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  padding: calc(var(--safe-t) + 10px) calc(var(--safe-r) + 16px) calc(var(--safe-b) + 10px) calc(var(--safe-l) + 16px);
  opacity: 0; visibility: hidden; transform: translateY(14px) scale(.99);
  transition: opacity .38s ease, transform .45s cubic-bezier(.2, .8, .3, 1), visibility 0s .45s;
}
.screen.active { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }
.scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: 6px 2px 24px; }

.bar { display: flex; align-items: center; gap: 10px; min-height: 52px; }
.bar h2 { flex: 1; text-align: center; font: 600 22px/1.1 var(--f-display); letter-spacing: .01em; text-shadow: 0 2px 12px rgba(0, 0, 0, .5); }
.bar-spacer { width: 46px; flex: none; }
.bar-stars { display: flex; align-items: center; gap: 4px; min-width: 46px; justify-content: flex-end; font-weight: 700; font-variant-numeric: tabular-nums; }
.bar-stars .of { color: var(--text-dim); font-weight: 500; font-size: 13px; }
.icon-btn {
  width: 46px; height: 46px; flex: none; border-radius: 50%; display: grid; place-items: center;
  background: rgba(13, 11, 38, .55); border: 1px solid var(--line); color: var(--brass-hi);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  transition: transform .15s, background .2s, opacity .2s;
}
.icon-btn:active { transform: scale(.92); }
.icon-btn:disabled { opacity: .32; cursor: default; }
.icon-btn:not(:disabled):hover { background: rgba(40, 32, 80, .7); }
.hint-btn.used { color: var(--text-dim); border-style: dashed; }

/* ---------- title ---------- */
#s-title { justify-content: center; align-items: center; }
.title-wrap { width: 100%; max-width: 420px; display: flex; flex-direction: column; align-items: center; text-align: center; margin-top: -4vh; }
.logo-art { width: min(80vw, 340px); height: auto; display: block; overflow: visible; margin-bottom: -18px; }
.sweep { mix-blend-mode: screen; }
.sweep path { fill: none; stroke-linecap: round; }
.lb-glow { stroke-width: 16; opacity: .32; }
.lb-core { stroke-width: 3; opacity: .95; }
.lb-out { stroke-width: 12; opacity: .4; stroke-linecap: round; mix-blend-mode: screen; animation: breathe 3s ease-in-out infinite; }
.sweep-red { transform-origin: -40px 150px; animation: sweepR 7s ease-in-out infinite alternate; }
.sweep-blue { transform-origin: 400px 150px; animation: sweepB 7s ease-in-out infinite alternate; }
.wordmark { display: flex; flex-direction: column; line-height: .88; font-family: var(--f-display); }
.wm-1 {
  font-size: clamp(56px, 17vw, 92px); font-weight: 650; letter-spacing: -.02em;
  background: linear-gradient(100deg, #f6eedb 30%, #fff 45%, #ffd9f0 50%, #f6eedb 62%) 0 0 / 260% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: shimmer 6s ease-in-out infinite;
}
.wm-2 { font-size: clamp(40px, 12vw, 64px); font-style: italic; font-weight: 400; color: var(--brass-hi); margin-left: .9em; text-shadow: 0 0 24px rgba(255, 200, 110, .35); }
.tagline { margin-top: 14px; color: var(--text-dim); font-size: 15px; letter-spacing: .02em; }
.menu { margin-top: 34px; display: flex; flex-direction: column; align-items: center; gap: 6px; width: 100%; }
.btn-play {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 58px; padding: 0 40px;
  border-radius: 999px; border: 0; color: #2b1505;
  font: 600 22px/1 var(--f-display); letter-spacing: .01em;
  background: radial-gradient(120% 140% at 50% 0%, #fff0c2 0%, #ffcf7a 38%, #d98f3c 75%, #a8652a 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .7), inset 0 -3px 0 rgba(110, 60, 15, .45), 0 0 0 1px rgba(255, 220, 150, .5),
    0 10px 30px rgba(255, 160, 60, .32), 0 0 70px rgba(255, 190, 90, .22);
  animation: lanternGlow 3.2s ease-in-out infinite;
  transition: transform .15s;
}
.btn-play .ic { fill: currentColor; stroke: none; width: 20px; height: 20px; }
.btn-play:active { transform: scale(.96); }
.btn-play.small { min-height: 50px; padding: 0 22px; font-size: 19px; }
.btn-play.small .ic { fill: none; stroke: currentColor; stroke-width: 2.2; }
.btn-play.wide { display: flex; margin: 8px auto 0; }
.btn-play + .menu-item { margin-top: 14px; }
.menu-item {
  display: inline-flex; align-items: center; gap: 12px; min-height: 48px; padding: 0 22px; border-radius: 999px;
  background: transparent; border: 1px solid transparent; font-size: 17px; letter-spacing: .02em; color: var(--text);
  transition: background .2s, border-color .2s, color .2s;
}
.menu-item .ic { color: var(--brass); }
.menu-item:hover, .menu-item:focus-visible { background: rgba(255, 224, 160, .07); border-color: var(--line); color: var(--brass-hi); }

/* ---------- level select ---------- */
.chapters { display: flex; justify-content: center; gap: clamp(10px, 4vw, 28px); margin: 12px 0 6px; }
.chapter-tab { display: flex; flex-direction: column; align-items: center; gap: 6px; background: none; border: 0; padding: 4px 6px; min-width: 76px; color: var(--text-dim); }
.emblem { position: relative; width: 58px; height: 58px; border-radius: 50%; display: block; box-shadow: 0 0 0 2px rgba(255, 255, 255, .08), 0 6px 18px rgba(0, 0, 0, .4); transition: box-shadow .25s, transform .25s; }
.emblem > svg:first-child { width: 100%; height: 100%; display: block; border-radius: 50%; }
.emblem .lock { position: absolute; right: -4px; bottom: -4px; width: 24px; height: 24px; padding: 4px; border-radius: 50%; background: var(--ink-2); color: var(--brass-hi); stroke-width: 2; }
.chapter-tab.locked .emblem > svg:first-child { filter: saturate(.3) brightness(.6); }
.chapter-tab.sel { color: var(--text); }
.chapter-tab.sel .emblem { box-shadow: 0 0 0 2px var(--brass-hi), 0 0 26px rgba(255, 210, 130, .45); transform: translateY(-2px); }
.ct-name { font: 600 15px var(--f-display); text-shadow: 0 1px 8px rgba(0, 0, 0, .7); }
.chapter-panel { width: calc(100% + 24px); max-width: 600px; margin: 0 -12px; align-self: center; flex: 1; min-height: 0; overflow-y: auto; padding: 8px 20px 28px; }
.cp-head { text-align: center; margin: 6px 0 16px; text-shadow: 0 2px 14px rgba(0, 0, 0, .55); }
.cp-head h3 { font: italic 500 34px/1.1 var(--f-display); }
.cp-head p { color: var(--text-dim); font-size: 14px; margin-top: 2px; }
.cp-stars { display: inline-flex; align-items: center; gap: 5px; margin-top: 8px; font-size: 13px; font-weight: 700; color: var(--brass-hi); font-variant-numeric: tabular-nums; }
.cp-lock, .cp-empty { display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--brass-hi); font-size: 14px; margin: 0 auto 14px; padding: 10px 16px;
  border-radius: 999px; background: rgba(13, 11, 38, .6); border: 1px solid var(--line); width: fit-content; }
.stones { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px 10px; }
.stones li:nth-child(even) { transform: translateY(12px); }
.stone {
  width: 100%; aspect-ratio: 1 / 1.05; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  border: 0; border-radius: 47% 53% 45% 55% / 55% 46% 54% 45%; color: var(--text);
  background: radial-gradient(circle at 34% 28%, #55547e 0%, #302e55 45%, #1d1b38 100%);
  box-shadow: inset 0 -7px 12px rgba(0, 0, 0, .4), inset 0 2px 0 rgba(255, 255, 255, .1), 0 8px 16px rgba(0, 0, 0, .4);
  transition: transform .18s, box-shadow .25s;
}
.stones li:nth-child(3n) .stone { border-radius: 55% 45% 52% 48% / 46% 54% 46% 54%; }
.stone:not(:disabled):hover { transform: translateY(-2px); }
.stone:not(:disabled):active { transform: scale(.95); }
.stone-n { font: 600 26px/1 var(--f-display); }
.stone-n .ic { width: 20px; height: 20px; color: var(--text-dim); }
.stone-name { display: none; font-size: 11px; color: var(--text-dim); max-width: 90%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stone-stars { display: flex; gap: 1px; }
.stone.done { box-shadow: inset 0 -7px 12px rgba(0, 0, 0, .4), inset 0 2px 0 rgba(255, 255, 255, .12), 0 0 0 1.5px rgba(255, 210, 130, .45), 0 8px 18px rgba(0, 0, 0, .4); }
.stone.fresh { animation: freshGlow 2.6s ease-in-out infinite; }
.stone.locked { opacity: .5; cursor: default; }
.stone.locked .stone-stars { visibility: hidden; }
.star path { fill: rgba(255, 255, 255, .16); }
.star.on path { fill: #ffd27a; }
@media (min-width: 560px) { .stone-name { display: block; } }

/* ---------- game ---------- */
.game-bar { gap: 8px; }
.g-title { flex: 1; min-width: 0; text-align: center; }
.g-title h2 { font: 600 clamp(16px, 4.6vw, 20px)/1.15 var(--f-display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 2px 10px rgba(0, 0, 0, .5); }
.g-meta { display: flex; align-items: center; justify-content: center; gap: 7px; font-size: 13px; color: var(--text-dim); margin-top: 2px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.g-meta .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--brass); }
#g-moves.over { color: #ffb6a6; }
.g-tools { display: flex; gap: 6px; }
.board-wrap { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 6px 0; }
#board { width: 100%; height: 100%; max-width: 820px; display: block; overflow: visible; }
.g-foot { min-height: 70px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; }
.gems { display: flex; gap: 8px; align-items: center; }
.gem-dot { width: 16px; height: 19px; }
.gem-dot path { fill: rgba(10, 8, 30, .7); stroke: var(--c); stroke-width: 1.6; transition: fill .3s; }
.gem-dot.ok path { fill: var(--c); filter: drop-shadow(0 0 4px var(--c)); }
.g-tip { font-size: 14px; color: var(--text-dim); min-height: 20px; opacity: 0; transform: translateY(4px); transition: opacity .3s, transform .3s; text-shadow: 0 1px 8px rgba(0, 0, 0, .6); }
.g-tip.show { opacity: 1; transform: none; }

/* board pieces */
.board-svg.enter { animation: boardIn .6s cubic-bezier(.2, .8, .3, 1); }
.ground-bed { opacity: .92; }
.ground-rim { fill: none; stroke: rgba(255, 220, 150, .2); stroke-width: 2; }
.tile rect { fill: rgba(255, 255, 255, .035); stroke: rgba(190, 200, 255, .07); stroke-width: 1.5; }
.dew circle { fill: rgba(200, 220, 255, .22); }
.w-shadow { fill: rgba(0, 0, 0, .35); }
.w-leaf { fill: #8acb80; opacity: .5; }
.w-flower { fill: #ffd6e6; opacity: .9; }
.moss { fill: #5c8f4c; opacity: .9; }
.w-crack { fill: none; stroke: rgba(10, 8, 30, .45); stroke-width: 2.2; stroke-linecap: round; }
.beam { mix-blend-mode: screen; }
.beam polyline { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.b-glow { stroke-width: 36; opacity: .14; }
.b-mid { stroke-width: 14; opacity: .42; }
.b-core { stroke-width: 4.5; opacity: .95; }
.b-flow { stroke-width: 7; stroke-dasharray: .1 34; opacity: .9; animation: flow 1.1s linear infinite; }
.b-flow2 { stroke-width: 2.5; stroke-dasharray: 22 66; opacity: .7; animation: flow2 1.9s linear infinite; }
.b-splash { transform-box: fill-box; transform-origin: center; opacity: .95; }
.l-halo { animation: flicker 2.6s ease-in-out infinite; animation-delay: var(--d); }
.l-core { opacity: .6; animation: flicker 1.7s ease-in-out infinite; animation-delay: var(--d); }
.l-chain { stroke: #8a6230; stroke-width: 2.5; }
.l-ribs { stroke: rgba(80, 10, 30, .35); stroke-width: 1.4; }
.lantern-blue .l-ribs { stroke: rgba(10, 20, 90, .35); }
.l-tassel { stroke: #c88f45; stroke-width: 2; fill: #c88f45; }
.mirror { cursor: pointer; outline: none; }
.hit { fill: transparent; }
.m-focus { fill: rgba(255, 224, 160, .06); stroke: var(--brass-hi); stroke-width: 3; stroke-dasharray: 7 9; opacity: 0; transition: opacity .2s; }
.mirror:focus-visible .m-focus { opacity: 1; }
.mirror.hinted .m-focus { opacity: 1; stroke: #fff; animation: hintPulse .8s ease-in-out 2; }
.m-rot { transition: transform .34s cubic-bezier(.34, 1.5, .55, 1); }
.rivet { fill: #4a2e10; }
.m-shine { stroke: #fff; stroke-width: 1.6; stroke-linecap: round; opacity: .75; }
.mirror.lit .m-shine { opacity: 1; stroke-width: 2.2; }
.mirror:not(.fixed):hover .m-plate { opacity: .85; }
.bolt { fill: #2a2d3a; stroke: #a3a9bd; stroke-width: 1.2; }
.bolt-x { stroke: #c9cedd; stroke-width: 1.6; stroke-linecap: round; }
.c-halo { opacity: 0; transition: opacity .4s; }
.c-ring { fill: none; stroke: var(--want); stroke-width: 3; opacity: .55; transition: opacity .3s; }
.c-stone { fill: #120f2a; opacity: .85; }
.g-base { fill: var(--gem); transition: fill .3s; }
.g-dark { fill: #05031a; opacity: .32; }
.g-light { fill: #fff; opacity: .14; }
.g-top { fill: #fff; opacity: .3; }
.g-edge { fill: none; stroke: var(--want); stroke-width: 1.6; stroke-linejoin: round; opacity: .7; }
.c-crack path { fill: none; stroke: #f2f0ff; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.c-crack, .c-fog, .c-spark { opacity: 0; transition: opacity .3s; }
.c-fog { fill: rgba(205, 205, 230, .38); }
.c-spark path { stroke: #fff; stroke-width: 2.2; stroke-linecap: round; }
.crystal.c-dark .c-gem { opacity: .8; }
.crystal.c-partial .c-halo { opacity: .3; }
.crystal.c-partial .g-top { opacity: .2; }
.crystal.c-ok .c-halo { opacity: 1; animation: pulse 2.4s ease-in-out infinite; animation-delay: var(--d, 0s); }
.crystal.c-ok .c-ring { opacity: 1; }
.crystal.c-ok .g-edge { stroke: #fff; opacity: .6; }
.crystal.c-ok .g-top { opacity: .5; }
.crystal.c-ok .c-spark { opacity: 1; animation: twinkle 2.4s ease-in-out infinite; animation-delay: var(--d, 0s); }
.crystal.c-spoiled .c-crack { opacity: .85; }
.crystal.c-spoiled .c-fog { opacity: 1; }
.crystal.c-spoiled .c-halo { opacity: .18; }
.crystal.c-spoiled .c-gem { animation: spoil .4s ease-out; }
.board-svg.win .crystal .c-halo { animation: flare 1.4s ease-out; }
.board-svg.win .lantern .l-halo { animation-duration: .9s; }

/* ---------- win sheet ---------- */
.sheet-scrim { position: absolute; inset: 0; background: rgba(6, 4, 20, .35); opacity: 0; pointer-events: none; transition: opacity .4s; }
.sheet-scrim.show { opacity: 1; pointer-events: auto; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; margin: 0 auto; width: 100%; max-width: 480px; z-index: 5;
  padding: 12px 22px calc(var(--safe-b) + 22px); text-align: center;
  background: linear-gradient(180deg, rgba(34, 28, 78, .96), rgba(14, 12, 40, .98));
  border-radius: 30px 30px 0 0; border: 1px solid var(--line); border-bottom: 0;
  box-shadow: 0 -20px 60px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 230, 170, .18);
  transform: translateY(105%); visibility: hidden;
  transition: transform .5s cubic-bezier(.2, .9, .25, 1.05), visibility 0s .5s;
}
.sheet.show { transform: none; visibility: visible; transition-delay: 0s; }
.sheet-grip { width: 42px; height: 4px; border-radius: 4px; background: rgba(255, 224, 160, .3); margin: 0 auto 10px; }
.win-stars { display: flex; justify-content: center; align-items: flex-end; gap: 6px; height: 72px; }
.ws { display: block; opacity: 0; transform: scale(.3) rotate(-30deg); }
.ws-2 { margin-bottom: 12px; }
.ws-2 svg { width: 58px; height: 58px; }
.sheet.show .ws { animation: starPop .55s cubic-bezier(.3, 1.6, .5, 1) forwards; }
.sheet.show .ws-1 { animation-delay: .2s; } .sheet.show .ws-2 { animation-delay: .42s; } .sheet.show .ws-3 { animation-delay: .64s; }
.ws.on svg { filter: drop-shadow(0 0 10px rgba(255, 200, 100, .6)); }
.sheet h3 { font: italic 500 30px/1.15 var(--f-display); margin-top: 6px; }
.win-sub { color: var(--text-dim); font-size: 14px; margin-top: 4px; font-variant-numeric: tabular-nums; }
.sheet-actions { display: grid; grid-template-columns: 1fr 1fr 1.25fr; gap: 10px; margin-top: 20px; }
.btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 50px; padding: 0 12px; border-radius: 999px;
  background: rgba(255, 255, 255, .04); border: 1px solid var(--line); color: var(--text); font-weight: 600; font-size: 15px;
}
.btn-ghost .ic { width: 18px; height: 18px; color: var(--brass); }
.btn-ghost:hover { background: rgba(255, 224, 160, .08); }

/* ---------- how to ---------- */
.steps { list-style: none; margin: 0 auto; padding: 0; max-width: 520px; display: grid; gap: 18px; }
.step { background: var(--panel); border: 1px solid var(--line); border-radius: 26px; overflow: hidden; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.demo { background: radial-gradient(120% 100% at 50% 0%, rgba(80, 70, 160, .25), transparent 70%); padding: 6px 10px 0; }
.demo svg { display: block; width: 100%; height: auto; max-height: 210px; }
.step-text { padding: 4px 20px 20px 64px; position: relative; }
.step-n { position: absolute; left: 20px; top: 4px; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  font: 600 16px var(--f-display); color: #2b1505; background: radial-gradient(circle at 40% 30%, #ffe7b0, #d9a24f 70%); }
.step h3 { font: 600 21px/1.2 var(--f-display); margin-bottom: 4px; }
.step p { color: var(--text-dim); font-size: 15px; font-weight: 400; }
@media (min-width: 980px) {
  .steps { max-width: 1120px; grid-template-columns: repeat(3, 1fr); }
  .step { display: flex; flex-direction: column; }
}

/* ---------- settings ---------- */
.settings { list-style: none; margin: 8px auto 0; padding: 6px 0; max-width: 480px; background: var(--panel); border: 1px solid var(--line); border-radius: 24px;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.settings li { display: flex; align-items: center; gap: 14px; padding: 6px 14px 6px 20px; min-height: 60px; font-size: 17px; }
.settings li + li { border-top: 1px solid rgba(255, 224, 160, .08); }
.settings li > span { flex: 1; }
.settings li > .ic { color: var(--brass); }
.toggle { width: 62px; height: 48px; border: 0; background: none; padding: 6px 4px; flex: none; }
.toggle span { display: block; position: relative; width: 54px; height: 32px; border-radius: 99px; background: rgba(255, 255, 255, .1); border: 1px solid var(--line); transition: background .25s; }
.toggle span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #b9b2d6;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .4); transition: transform .25s cubic-bezier(.3, 1.4, .5, 1), background .25s; }
.toggle[aria-checked="true"] span { background: rgba(217, 162, 79, .45); border-color: rgba(255, 224, 160, .5); }
.toggle[aria-checked="true"] span::after { transform: translateX(22px); background: radial-gradient(circle at 40% 30%, #fff2cc, #e8b060); box-shadow: 0 0 12px rgba(255, 200, 110, .6); }
.btn-danger { display: block; margin: 22px auto 0; min-height: 50px; padding: 0 26px; border-radius: 999px; background: rgba(255, 120, 100, .06);
  border: 1px solid rgba(255, 154, 138, .45); color: var(--danger); font-weight: 600; }
.btn-danger.solid { margin: 0; background: #e0634f; color: #fff; border-color: #e0634f; }
.fine { text-align: center; color: var(--text-dim); font-size: 13px; margin: 18px auto 0; max-width: 320px; font-weight: 400; }
.dialog-scrim { position: fixed; inset: 0; z-index: 60; background: rgba(5, 4, 18, .66); display: grid; place-items: center; padding: 20px; }
.dialog-scrim[hidden] { display: none; }
.dialog { width: 100%; max-width: 360px; background: linear-gradient(180deg, #241d55, #15123a); border: 1px solid var(--line); border-radius: 24px; padding: 24px;
  text-align: center; box-shadow: 0 30px 80px rgba(0, 0, 0, .5); animation: dialogIn .3s cubic-bezier(.2, .9, .3, 1.2); }
.dialog h3 { font: 600 23px var(--f-display); }
.dialog p { color: var(--text-dim); font-size: 15px; margin-top: 8px; }
.dialog-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 20px; }

/* ---------- motion ---------- */
@keyframes twinkle { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }
@keyframes flicker { 0%, 100% { opacity: .85; } 20% { opacity: 1; } 45% { opacity: .72; } 60% { opacity: .95; } 80% { opacity: .8; } }
@keyframes breathe { 0%, 100% { opacity: .25; } 50% { opacity: .5; } }
@keyframes sweepR { from { transform: rotate(-7deg); } to { transform: rotate(5deg); } }
@keyframes sweepB { from { transform: rotate(6deg); } to { transform: rotate(-6deg); } }
@keyframes shimmer { 0%, 100% { background-position: 100% 0; } 50% { background-position: 0 0; } }
@keyframes lanternGlow { 0%, 100% { box-shadow: inset 0 1px 0 rgba(255,255,255,.7), inset 0 -3px 0 rgba(110,60,15,.45), 0 0 0 1px rgba(255,220,150,.5), 0 10px 30px rgba(255,160,60,.3), 0 0 50px rgba(255,190,90,.15); }
  50% { box-shadow: inset 0 1px 0 rgba(255,255,255,.7), inset 0 -3px 0 rgba(110,60,15,.45), 0 0 0 1px rgba(255,220,150,.6), 0 10px 34px rgba(255,160,60,.42), 0 0 80px rgba(255,190,90,.32); } }
@keyframes freshGlow { 0%, 100% { box-shadow: inset 0 -7px 12px rgba(0,0,0,.4), 0 0 0 1.5px rgba(255,224,160,.5), 0 0 12px rgba(255,200,110,.2); }
  50% { box-shadow: inset 0 -7px 12px rgba(0,0,0,.4), 0 0 0 2px rgba(255,224,160,.9), 0 0 26px rgba(255,200,110,.5); } }
@keyframes flow { to { stroke-dashoffset: -34.1; } }
@keyframes flow2 { to { stroke-dashoffset: -88; } }
@keyframes pulse { 0%, 100% { opacity: .8; transform: scale(.92); } 50% { opacity: 1; transform: scale(1.08); } }
@keyframes flare { 0% { opacity: 1; transform: scale(1); } 35% { opacity: 1; transform: scale(2.1); } 100% { opacity: 1; transform: scale(1); } }
@keyframes spoil { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-3px); } 50% { transform: translateX(3px); } 75% { transform: translateX(-1.5px); } }
@keyframes hintPulse { 50% { stroke-width: 6; opacity: .5; } }
@keyframes boardIn { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }
@keyframes starPop { to { opacity: 1; transform: none; } }
@keyframes dialogIn { from { opacity: 0; transform: scale(.92); } }

body.reduce-motion *, body.reduce-motion *::before, body.reduce-motion *::after {
  animation-duration: .001s !important; animation-iteration-count: 1 !important; transition-duration: .001s !important;
}
body.reduce-motion .screen { transform: none; }

/* wide screens: the win card floats beside the board instead of covering it */
@media (min-width: 1100px) and (min-aspect-ratio: 4/3) {
  .sheet { left: auto; right: max(32px, calc((100vw - 820px) / 2 - 400px)); bottom: auto; top: 50%; width: 360px; border-radius: 30px; border-bottom: 1px solid var(--line);
    padding-bottom: 24px; transform: translate(calc(100% + 80px), -50%); }
  .sheet.show { transform: translate(0, -50%); }
  .sheet-grip { display: none; }
  .sheet-actions { grid-template-columns: 1fr 1fr; }
  .sheet-actions .btn-play { grid-column: 1 / -1; grid-row: 1; }
}
