/* 모래 정원. 바탕은 이끼 쪽으로 기운 서늘한 모래색이고, 구슬이 지나간 자리만 진해진다. */
:root {
  --bg: #EDF0EB; --surface: #F8FAF6; --ink: #1E2925; --muted: #56645E; --line: #D2D9D2;
  --accent: #2F6B57; --on-accent: #FFFFFF; --accent-soft: #DCE9E1; --scrim: rgb(20 30 26 / .34); --float-shade: rgb(20 30 26 / .16);
  --sand: #DDE1D8; --rake: #D1D6CC; --groove: #BFC6BA; --groove-lit: #EBEEE6;
  --stone: #6E7A73; --stone-top: #87938C; --stone-shade: rgb(30 40 35 / .28); --speck: rgb(255 255 255 / .1);
  --hole: #1F2926; --hole-rim: #B4BBAF; --pond: #3B8C86; --pond-rim: #2B6964; --ripple: #BFE3DE;
  --ball-lit: #E9F4F2; --ball: #1E6C7A; --ball-deep: #0F4450; --gem: #E2A21B; --gem-lit: #FFE9A8;
  --ball-shade: rgb(20 30 26 / .32);
  --door: #A8326A; --door-line: #C65B8C; --gate-t: #1F74C4; --gate-u: #C96A12; --star: #A97505;
  --wet: rgb(50 62 74 / .26); --wet-dot: rgb(50 62 74 / .3); --ice: rgb(198 232 246 / .78); --ice-line: rgb(255 255 255 / .85);
  --slope: rgb(47 107 87 / .13); --slope-line: rgb(47 107 87 / .42); --bumper: #6C5BB5; --bumper-lit: #A99BEB; --mover: #3F4A52; --mover-top: #57646E; --ink-on-lock: #1E2925; --danger: #B3261E;
  --berry: #C23B5A; --berry-lit: #F4B7C5; --leaf: #4E8A47; --burr: #6E9A3A; --burr-spine: #4F7428; --burr-nut: #7A4A26;
  --fox: #D9772B; --fox-dark: #4A2A1A; --fox-light: #F6EEE4; --badger: #8A8E93; --badger-dark: #2E3134; --badger-stripe: #F2F2EE; --owl: #8C6A4A; --owl-face: #D9C3A2; --owl-eye: #F0C243;
  --hog: #A88B6E; --hog-lit: #E3D2BD; --hog-spine: #5B4636; --hog-face: #EFE3D3; --acorn: #A9692A; --acorn-cap: #5E4226;
  --magpie: #20272B; --magpie-white: #F7F8F5; --magpie-blue: #2D5F8A; --snow: #FFFFFF; --bark: #6A5644;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #0F1513; --surface: #18201D; --ink: #E6ECE8; --muted: #9AA8A1; --line: #2B3531;
  --accent: #8FCBB0; --on-accent: #0E1F18; --accent-soft: #1F332B; --scrim: rgb(0 0 0 / .5); --float-shade: rgb(0 0 0 / .4);
  --sand: #232C29; --rake: #2A3430; --groove: #171E1C; --groove-lit: #303B37;
  --stone: #4C5954; --stone-top: #5E6C66; --stone-shade: rgb(0 0 0 / .45); --speck: rgb(255 255 255 / .05);
  --hole: #070A09; --hole-rim: #39443F; --pond: #2F8E88; --pond-rim: #56B8B0; --ripple: #A5E3DA;
  --ball-lit: #D9F2EE; --ball: #2B8A99; --ball-deep: #0F4E5C; --gem: #F2C14E; --gem-lit: #FFF0BC;
  --ball-shade: rgb(0 0 0 / .5);
  --door: #D65A93; --door-line: #E98BB5; --gate-t: #63ADF0; --gate-u: #F0A050; --star: #F2C14E;
  --wet: rgb(0 0 0 / .34); --wet-dot: rgb(0 0 0 / .4); --ice: rgb(112 182 214 / .26); --ice-line: rgb(190 232 248 / .4);
  --slope: rgb(143 203 176 / .1); --slope-line: rgb(143 203 176 / .42); --bumper: #8F7FE0; --bumper-lit: #C7BDF5; --mover: #6B7882; --mover-top: #84929C; --ink-on-lock: #0F1513; --danger: #F2938C;
  --berry: #EC6F8B; --berry-lit: #FFD1DB; --leaf: #7FBF74; --burr: #8DBA57; --burr-spine: #6A9440; --burr-nut: #A06A3F;
  --fox: #EC9147; --fox-dark: #2E1A10; --fox-light: #F6EEE4; --badger: #A3A8AD; --badger-dark: #1C1E20; --badger-stripe: #F2F2EE; --owl: #A9845E; --owl-face: #E6D3B4; --owl-eye: #F6CF5C;
  --hog: #B99C7E; --hog-lit: #EADBC7; --hog-spine: #6B5443; --hog-face: #F1E6D6; --acorn: #D9A25C; --acorn-cap: #9A744A;
  --magpie: #3B464C; --magpie-white: #E9EDEA; --magpie-blue: #6FA3D2; --snow: #E8F0EE; --bark: #5A4A3C;
  color-scheme: dark;
} }
:root[data-theme="dark"] {
  --bg: #0F1513; --surface: #18201D; --ink: #E6ECE8; --muted: #9AA8A1; --line: #2B3531;
  --accent: #8FCBB0; --on-accent: #0E1F18; --accent-soft: #1F332B; --scrim: rgb(0 0 0 / .5); --float-shade: rgb(0 0 0 / .4);
  --sand: #232C29; --rake: #2A3430; --groove: #171E1C; --groove-lit: #303B37;
  --stone: #4C5954; --stone-top: #5E6C66; --stone-shade: rgb(0 0 0 / .45); --speck: rgb(255 255 255 / .05);
  --hole: #070A09; --hole-rim: #39443F; --pond: #2F8E88; --pond-rim: #56B8B0; --ripple: #A5E3DA;
  --ball-lit: #D9F2EE; --ball: #2B8A99; --ball-deep: #0F4E5C; --gem: #F2C14E; --gem-lit: #FFF0BC;
  --ball-shade: rgb(0 0 0 / .5);
  --door: #D65A93; --door-line: #E98BB5; --gate-t: #63ADF0; --gate-u: #F0A050; --star: #F2C14E;
  --wet: rgb(0 0 0 / .34); --wet-dot: rgb(0 0 0 / .4); --ice: rgb(112 182 214 / .26); --ice-line: rgb(190 232 248 / .4);
  --slope: rgb(143 203 176 / .1); --slope-line: rgb(143 203 176 / .42); --bumper: #8F7FE0; --bumper-lit: #C7BDF5; --mover: #6B7882; --mover-top: #84929C; --ink-on-lock: #0F1513; --danger: #F2938C;
  --berry: #EC6F8B; --berry-lit: #FFD1DB; --leaf: #7FBF74; --burr: #8DBA57; --burr-spine: #6A9440; --burr-nut: #A06A3F;
  --fox: #EC9147; --fox-dark: #2E1A10; --fox-light: #F6EEE4; --badger: #A3A8AD; --badger-dark: #1C1E20; --badger-stripe: #F2F2EE; --owl: #A9845E; --owl-face: #E6D3B4; --owl-eye: #F6CF5C;
  --hog: #B99C7E; --hog-lit: #EADBC7; --hog-spine: #6B5443; --hog-face: #F1E6D6; --acorn: #D9A25C; --acorn-cap: #9A744A;
  --magpie: #3B464C; --magpie-white: #E9EDEA; --magpie-blue: #6FA3D2; --snow: #E8F0EE; --bark: #5A4A3C;
  color-scheme: dark;
}

[hidden] { display: none !important; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; overflow: clip; overscroll-behavior: none; }
body {
  background: var(--bg); color: var(--ink);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", Pretendard, "Noto Sans KR", "Malgun Gothic", sans-serif;
  word-break: keep-all; overflow-wrap: break-word;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
h1, h2, p { margin: 0; }
h1, h2 { text-wrap: balance; line-height: 1.3; letter-spacing: -.02em; }
p { text-wrap: pretty; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; touch-action: manipulation; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.screen {
  height: 100dvh; display: flex; flex-direction: column;
  padding: env(safe-area-inset-top, 0px) max(14px, env(safe-area-inset-right, 0px)) max(12px, env(safe-area-inset-bottom, 0px)) max(14px, env(safe-area-inset-left, 0px));
}
.bar { display: flex; align-items: center; gap: 6px; min-height: 52px; flex: none; }
.brand { display: flex; align-items: center; gap: 7px; flex: 1; min-width: 0; }
.brand img { display: block; }
.brand h1 { font-size: 18px; font-weight: 700; white-space: nowrap; }
#stageName { font-size: 15px; line-height: 1.25; font-weight: 700; flex: 1; min-width: 0; }
.stars { font-size: 15px; font-weight: 600; color: var(--star); font-variant-numeric: tabular-nums; white-space: nowrap; }
.clock { font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; padding-inline: 4px; }
.icon-btn { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 10px; flex: none; color: var(--muted); }
#back { margin-left: -10px; color: var(--ink); }
.bar > .icon-btn:last-child { margin-right: -10px; }

.chapters { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding-bottom: 8px; }
.chapter + .chapter { margin-top: 20px; }
.chapter h2 { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 16px; margin: 4px 0 8px; }
.stages { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 10px; }
/* 태블릿: 정원 하나(10판)가 두 줄, 가로로 넓으면 한 줄. 판 그림이 화면을 다 덮지 않게 */
@media (min-width: 600px) { .stages { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px 14px; } }
@media (min-width: 1000px) { .stages { grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 16px 12px; } }
.stage { display: flex; flex-direction: column; gap: 4px; width: 100%; text-align: left; }
.stage canvas { display: block; width: 100%; aspect-ratio: 3 / 5; border-radius: 10px; }
.stage strong { display: block; font-size: 13px; font-weight: 600; line-height: 1.3; }
.stage small { display: block; min-height: 18px; font-size: 11px; line-height: 18px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.stage small.hit { color: var(--accent); }
.stage:active canvas { opacity: .8; }

.install { flex: none; display: flex; align-items: center; gap: 8px; border-top: 1px solid var(--line); padding-top: 8px; font-size: 14px; color: var(--muted); }
.install p { flex: 1; min-width: 0; }

.board-wrap { flex: 1; min-height: 0; display: grid; place-items: center; }
#board { display: block; border-radius: 12px; touch-action: none; }
.note { flex: none; font-size: 14px; color: var(--muted); padding-top: 8px; width: 100%; max-width: max(var(--board-w, 100%), 340px); margin-inline: auto; }
.controls { flex: none; display: flex; gap: 8px; padding-top: 10px; width: 100%; max-width: max(var(--board-w, 100%), 340px); margin-inline: auto; }
.controls .btn { flex: 1; }
.btn { height: 48px; padding-inline: 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); font-weight: 600; white-space: nowrap; }
.btn.small { height: 36px; padding-inline: 12px; font-size: 14px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn:active { opacity: .75; }
.btn:disabled, .btn.primary:disabled { background: var(--line); border-color: var(--line); color: var(--muted); cursor: default; }

.scrim { position: fixed; inset: 0; z-index: 20; background: var(--scrim); display: flex; align-items: flex-end; justify-content: center; }
.sheet {
  width: 100%; max-width: 480px; max-height: 88dvh; overflow-y: auto; overscroll-behavior: contain;
  background: var(--surface); border-radius: 20px 20px 0 0; box-shadow: 0 -4px 24px var(--float-shade);
  padding: 0 max(18px, env(safe-area-inset-right, 0px)) max(18px, env(safe-area-inset-bottom, 0px)) max(18px, env(safe-area-inset-left, 0px));
  animation: rise .26s cubic-bezier(.2, .8, .2, 1);
}
@keyframes rise { from { transform: translateY(40px); opacity: .4; } }
.sheet-head { position: sticky; top: 0; background: var(--surface); padding-top: 8px; touch-action: none; cursor: grab; z-index: 1; }
.grabber { display: block; width: 38px; height: 5px; margin: 0 auto; border-radius: 3px; background: var(--ink); opacity: .22; }
.sheet-title { display: flex; align-items: center; justify-content: space-between; min-height: 48px; }
.sheet-title h2 { font-size: 18px; }
.sheet-title .icon-btn { margin-right: -10px; }
.settings { display: flex; flex-direction: column; gap: 16px; padding-bottom: 6px; }
.field > span { display: block; font-size: 14px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.seg { display: flex; gap: 6px; }
.seg button { flex: 1 1 0; min-width: 0; height: 44px; border-radius: 10px; border: 1px solid var(--line); font-size: 15px; white-space: nowrap; padding-inline: 4px; }
.seg button[aria-checked="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--ink); font-weight: 600; }

.result { padding-top: 22px; }
.result h2 { font-size: 20px; }
.result-time { font-size: 44px; line-height: 1.2; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; margin-top: 2px; }
.result-stars { font-size: 24px; line-height: 1.3; letter-spacing: .08em; color: var(--star); }
.muted { color: var(--muted); font-size: 15px; min-height: 22px; }
.calm-tip { display: flex; align-items: center; gap: 10px; margin-top: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 15px; text-wrap: pretty; }
.calm-tip span { flex: 1; min-width: 0; }
.calm-tip .btn { flex: none; }
.records-text { display: block; width: 100%; margin-top: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); font: 16px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; word-break: break-all; resize: vertical; -webkit-user-select: text; user-select: text; -webkit-touch-callout: default; }
.records-go { width: 100%; margin-top: 8px; }
.result-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.result-actions .row { display: flex; gap: 8px; }
.result-actions .row .btn { flex: 1; }

.toast {
  position: fixed; left: 50%; top: calc(env(safe-area-inset-top, 0px) + 4px); transform: translateX(-50%); z-index: 30; /* 맨 위 줄에 얹는다. 판 위에 얹으면 출발 자리의 구슬을 가린다 */
  max-width: calc(100vw - 24px); width: max-content; min-height: 44px; display: flex; align-items: center; padding: 6px 16px; border-radius: 22px; font-size: 14px; line-height: 1.35;
  background: var(--ink); color: var(--bg); box-shadow: 0 2px 10px var(--float-shade); pointer-events: none;
}
.turn { display: none; }
@media (orientation: landscape) and (max-height: 500px) {
  .phone .turn { display: grid; place-items: center; position: fixed; inset: 0; z-index: 40; background: var(--bg); font-size: 17px; font-weight: 600; }
}
/* 내 판 만들기 */
.chapter h2 .btn.small { font-size: 14px; }
.name-input { flex: 1; min-width: 0; height: 40px; padding: 0 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); font: 600 16px/1 inherit; font-family: inherit; }
#makerBack { margin-left: -10px; color: var(--ink); }
#makerBoard { display: block; border-radius: 10px; touch-action: none; cursor: crosshair; }
.ask { flex: none; display: flex; align-items: center; gap: 8px; padding: 6px 0; font-size: 15px; }
.ask p { flex: 1; min-width: 0; }
.btn.danger { color: var(--danger); border-color: var(--danger); }
.tools { flex: none; display: flex; gap: 6px; overflow-x: auto; overscroll-behavior-x: contain; padding: 10px 0 2px; scrollbar-width: none; }
.tools::-webkit-scrollbar { display: none; }
.tool { flex: none; display: flex; align-items: center; gap: 6px; height: 40px; padding: 0 12px 0 8px; border: 1px solid var(--line); border-radius: 10px; font-size: 14px; white-space: nowrap; background: var(--surface); }
.tool[aria-checked="true"] { border-color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.swatch { width: 18px; height: 18px; border-radius: 4px; border: 1px solid var(--line); }
.maker-opts { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 8px; flex-wrap: wrap; }
.dots { display: flex; gap: 2px; }
.dot { width: 36px; height: 36px; border-radius: 50%; border: 3px solid; background-clip: padding-box; box-shadow: inset 0 0 0 2px var(--surface); }
.dot[aria-checked="true"] { outline: 2px solid var(--accent); outline-offset: 1px; }
.check { display: flex; align-items: center; gap: 6px; min-height: 44px; font-size: 14px; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }
.maker-note { min-height: 28px; padding-top: 4px; overflow-wrap: anywhere; user-select: text; -webkit-user-select: text; }
.maker-note.warn { color: var(--danger); }
/* 만들기: 구슬 수·뛰기 횟수 */
.mini { display: flex; align-items: center; gap: 4px; font-size: 14px; font-weight: 600; }
.mini > span { color: var(--muted); margin-right: 4px; }
.mini button { min-width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font-variant-numeric: tabular-nums; }
.mini button[aria-checked="true"] { border-color: var(--accent); background: var(--accent-soft); }
.mini output { min-width: 24px; text-align: center; font-variant-numeric: tabular-nums; }

/* 손가락으로 굴리기: 누른 자리에 뜨는 고리와 손잡이 */
.board-wrap { position: relative; touch-action: none; }
.stick { position: absolute; width: 128px; height: 128px; margin: -64px 0 0 -64px; border-radius: 50%; border: 2px solid var(--accent); opacity: .5; pointer-events: none; display: grid; place-items: center; }
.stick span { width: 44px; height: 44px; border-radius: 50%; background: var(--accent); opacity: .7; }

/* 구슬 고르기 */
.marbles { display: flex; flex-wrap: wrap; gap: 0; }
.marble { width: 48px; height: 48px; display: grid; place-items: center; position: relative; }
.marble::before { content: ""; width: 34px; height: 34px; border-radius: 50%; background: radial-gradient(circle at 36% 32%, var(--m-lit) 4%, var(--m) 46%, var(--m-deep) 100%); box-shadow: inset 0 0 0 1px var(--line); }
.marble[aria-disabled="true"]::before { opacity: .45; filter: grayscale(.7); box-shadow: inset 0 0 0 1px var(--line); }
.marble[aria-checked="true"]::after { content: ""; position: absolute; width: 40px; height: 40px; border-radius: 50%; box-shadow: 0 0 0 2px var(--accent); }
.marble-note { font-size: 13px; color: var(--muted); min-height: 20px; margin-top: 2px; }

/* 받은 판 카드 */
.got { display: flex; gap: 14px; align-items: flex-start; padding-top: 10px; }
.got canvas { flex: none; width: 84px; aspect-ratio: 3 / 5; border-radius: 8px; }
.got > div { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.got-kicker { font-size: 14px; font-weight: 600; color: var(--accent); }
.got h2 { font-size: 20px; }
.got-by { font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; margin-top: 4px; }
.who-field { display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 600; margin-top: 4px; }
.who-field .name-input { height: 44px; }
#whoSheet .muted { font-size: 14px; margin-top: 6px; }

@media (prefers-reduced-motion: reduce) { .sheet { animation: none; } }

/* 고슴도치 이야기: 도토리(판마다 목표 셋), 세계 이름, 도착 화면의 목표 줄 */
.acorn { display: inline-block; width: 14px; height: 14px; vertical-align: -2px; flex: none; }
.acorn svg { display: block; width: 100%; height: 100%; }
.acorn path { fill: var(--line); }
.acorn.on .nut { fill: var(--acorn); }
.acorn.on .cap { fill: var(--acorn-cap); }
.acorns { color: var(--ink); white-space: nowrap; }
#totalStars { display: flex; align-items: center; gap: 8px; }
.world { font-size: 13px; font-weight: 600; color: var(--muted); margin: 22px 0 2px; }
.world:first-child { margin-top: 2px; }
.world + .chapter { margin-top: 0; }
.chapter.mine { margin-top: 26px; }
.stage small .acorn { width: 11px; height: 11px; margin-right: 1px; }
.goals { list-style: none; margin: 10px 0 4px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.goals li { display: flex; align-items: center; gap: 8px; font-size: 15px; line-height: 1.35; color: var(--muted); }
.goals li.on { color: var(--ink); }
.goals .acorn { width: 20px; height: 20px; }
.goals li.new .acorn { animation: acorn-pop .45s cubic-bezier(.2, 1.6, .4, 1) both; }
@keyframes acorn-pop { from { transform: scale(.3); } }
@media (prefers-reduced-motion: reduce) { .goals li.new .acorn { animation: none; } }

/* 고슴도치 이야기: 장면 창, 결과 창의 한 줄, 다시 읽기 */
.story { padding-top: 18px; }
.story-pic { display: block; width: 100%; height: 132px; border-radius: 12px; }
.story-text { margin-top: 14px; font-size: 17px; line-height: 1.6; min-height: 3.2em; text-wrap: pretty; }
.story-text p + p { margin-top: 8px; }
.story-q { font-weight: 600; }
.story-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.story-actions .btn.pick { height: auto; min-height: 48px; padding-block: 10px; white-space: normal; text-wrap: balance; }
.result-story { margin-top: 12px; font-size: 16px; line-height: 1.55; text-wrap: pretty; }
.world.with-btn { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.world .btn.small { color: var(--ink); font-size: 14px; }
.tales { padding-bottom: 8px; }
.tales h3 { font-size: 14px; font-weight: 600; color: var(--muted); margin: 18px 0 6px; }
.tales h3:first-child { margin-top: 4px; }
.tales p { font-size: 16px; line-height: 1.6; text-wrap: pretty; }
.tales p + p { margin-top: 6px; }
.tales .picked { font-size: 15px; color: var(--muted); }

/* 처음 화면: 이어하기 하나와 모드 목록 */
.page-title { flex: 1; min-width: 0; font-size: 18px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn.back { margin-left: -10px; color: var(--ink); }
.continue { display: flex; align-items: stretch; gap: 14px; width: 100%; margin-top: 6px; padding: 12px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); text-align: left; }
.continue canvas { flex: none; width: 92px; aspect-ratio: 3 / 5; border-radius: 10px; }
.continue-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; padding-top: 2px; }
.continue .kicker { font-size: 13px; font-weight: 600; color: var(--muted); }
.continue strong { font-size: 21px; line-height: 1.3; letter-spacing: -.02em; text-wrap: balance; }
.continue .pill { margin-top: auto; align-self: flex-start; display: inline-flex; align-items: center; height: 44px; padding-inline: 22px; border-radius: 10px; background: var(--accent); color: var(--on-accent); font-weight: 600; white-space: nowrap; }
.continue:active { opacity: .85; }
.modes { list-style: none; margin: 18px 0 0; padding: 0; border-top: 1px solid var(--line); }
.modes li { border-bottom: 1px solid var(--line); }
.mode { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 64px; padding: 10px 2px; text-align: left; }
.mode-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.mode strong { font-size: 17px; font-weight: 600; }
.mode small { display: flex; align-items: center; flex-wrap: wrap; gap: 0 2px; font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.mode small .stars { font-size: 14px; }
.mode-end { flex: none; color: var(--muted); display: grid; place-items: center; width: 24px; }
.mode[aria-disabled="true"] strong { color: var(--muted); }
.mode:active { background: var(--accent-soft); }

/* 판 고르기: 잠긴 판, 지금 할 판 */
.thumb { position: relative; display: block; }
.stage .thumb canvas { display: block; width: 100%; aspect-ratio: 3 / 5; border-radius: 10px; }
.stage.locked canvas { opacity: .32; filter: grayscale(.6); }
.stage.locked strong { color: var(--muted); }
.stage .lock { position: absolute; inset: 0; display: grid; place-items: center; color: var(--ink); }
.stage .lock svg { width: 30px; height: 30px; padding: 6px; border-radius: 50%; background: var(--surface); box-sizing: content-box; }
.stage.next .thumb canvas { outline: 2.5px solid var(--accent); outline-offset: 2px; }

/* 판 화면: 끝없는 들판의 목숨·점수, 라운드 알림, 멈춤 창 */
.lives { display: flex; gap: 3px; flex: none; }
.life { display: block; width: 12px; height: 12px; border-radius: 50%; background: var(--hog); box-shadow: inset 0 -2px 0 var(--hog-spine); }
.clock.score { min-width: 4ch; text-align: right; }
.banner {
  position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); z-index: 2; pointer-events: none;
  padding: 10px 22px; border-radius: 14px; background: var(--surface); color: var(--ink); box-shadow: 0 4px 18px var(--float-shade);
  font-size: 20px; font-weight: 700; letter-spacing: -.02em; white-space: nowrap; font-variant-numeric: tabular-nums;
  animation: banner .25s cubic-bezier(.2, .8, .2, 1);
}
@keyframes banner { from { opacity: 0; transform: translate(-50%, -40%); } }
@media (prefers-reduced-motion: reduce) { .banner { animation: none; } }
.controls:not(:has(> :not([hidden]))) { display: none; }
.pause { padding-top: 22px; }
.pause h2 { font-size: 20px; }
.pause .muted { margin-top: 2px; }
