:root {
  --paper: #f4f1e8;
  --ink: #17181d;
  --night: #111218;
  --muted: #666865;
  --line: #d2cfc5;
  --yellow: #ffd83d;
  --coral: #ff7048;
  --lime: #baff29;
  --display: "Arial Black", "Pretendard Variable", Pretendard, sans-serif;
  --body: "Pretendard Variable", Pretendard, "Noto Sans KR", Arial, sans-serif;
  --mono: "IBM Plex Mono", Consolas, monospace;
}

* { box-sizing: border-box; }
html { background: var(--paper); }
body { min-width: 320px; min-height: 100svh; display: flex; flex-direction: column; margin: 0; color: var(--ink); background: var(--paper); font-family: var(--body); }
[hidden] { display: none !important; }
button { font-family: inherit; cursor: pointer; }
.skip-link { position: fixed; top: 8px; left: 8px; z-index: 100; padding: 11px 15px; color: var(--night); background: var(--lime); font-size: 13px; font-weight: 850; text-decoration: none; transform: translateY(-160%); }
.skip-link:focus { transform: translateY(0); }
:where(a, button):focus-visible { outline: 3px solid var(--coral); outline-offset: 3px; }

.top { min-height: 64px; display: flex; align-items: center; gap: 16px; padding: 10px 24px; border-bottom: 2px solid var(--ink); }
.home { min-height: 44px; display: inline-flex; align-items: center; color: var(--muted); font: 800 11px var(--display); text-decoration: none; letter-spacing: .06em; }
.home:hover { color: var(--ink); }
.wordmark { font: 900 19px var(--display); letter-spacing: .02em; }
.wordmark b { color: transparent; -webkit-text-stroke: 1.4px var(--ink); }
.top-note { margin-left: auto; color: var(--muted); font-size: 11px; font-weight: 700; }
.tl-languages { display: flex; flex-shrink: 0; gap: 3px; margin-left: auto; }
.tl-languages button { min-width: 44px; min-height: 44px; border: 1px solid var(--line); background: transparent; color: var(--muted); font-size: 11px; font-weight: 850; }
.tl-languages button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }
body[data-screen="run"] .tl-languages, body[data-screen="done"] .tl-languages,
body[data-screen="survival"] .tl-languages,
body[data-screen="keyboard"]:has(#kb-burst-start:disabled) .tl-languages { display: none; }
.practice-language { max-width: 64ch; color: var(--muted); font-size: 13px; line-height: 1.6; border-inline-start: 3px solid var(--yellow); padding-inline-start: 12px; }
html[lang="en"] .leaderboard-head, html[lang="en"] .leaderboard-board-head, html[lang="en"] .kb-head { flex-wrap: wrap; }
html[lang="en"] .board-tablist, html[lang="en"] .sv-board-tabs { flex-wrap: wrap; }
html[lang="en"] .register-row input, html[lang="en"] .kb-stats > div { min-width: 0; }
html[lang="en"] .sv-mode span, html[lang="en"] .sv-perk small { overflow-wrap: anywhere; }

main { flex: 1; width: min(760px, 100% - 40px); margin: 0 auto; }

/* 화면 전환: body[data-screen]이 스위치다. */
.screen { display: none; padding: 40px 0 60px; }
body[data-screen="ready"] .screen-ready,
body[data-screen="run"] .screen-run,
body[data-screen="done"] .screen-done,
body[data-screen="survival"] .screen-survival,
body[data-screen="keyboard"] .screen-keyboard { display: block; }
/* 서바이벌은 무대가 넓을수록 잘 보인다. 이 화면에서만 본문 폭을 넓힌다. */
body[data-screen="survival"] main { width: min(1400px, 100% - 24px); }
body[data-screen="keyboard"] main { width: min(1120px, 100% - 40px); }
body[data-screen="ready"] main { width: min(1120px, 100% - 40px); }
.screen-ready > .eyebrow, .screen-ready > h1, .screen-ready > .lead,
.screen-ready > .duration-row, .screen-ready > .mode-row,
.screen-ready > .start-btn, .screen-ready > .ready-best { max-width: 760px; }

.eyebrow { margin: 0; color: var(--coral); font-size: 11px; font-weight: 850; letter-spacing: .1em; text-transform: uppercase; }
h1 { margin: 12px 0 0; font: 900 clamp(40px, 8vw, 64px)/1.04 var(--display); }
.lead { margin: 20px 0 0; color: #4c4e53; font-size: 15px; line-height: 1.75; }

.duration-row { display: flex; gap: 8px; margin-top: 30px; }
.duration { min-height: 44px; padding: 0 20px; border: 2px solid var(--ink); border-radius: 999px; background: transparent; font-size: 14px; font-weight: 800; transition: background .15s ease, transform .15s ease; }
.duration:hover { transform: translateY(-1px); }
.duration.is-active { background: var(--yellow); box-shadow: 3px 3px 0 var(--ink); }

.mode-row { display: flex; gap: 8px; margin-top: 12px; }
.mode { min-height: 44px; padding: 0 16px; border: 2px dashed var(--line); border-radius: 999px; background: transparent; color: var(--muted); font-size: 13px; font-weight: 800; transition: border-color .15s ease, color .15s ease; }
.mode.is-active { border-style: solid; border-color: var(--ink); color: var(--ink); background: #fffdf6; }

/* 받아쓰기 진행 패널: 문장 대신 이 패널이 보인다. */
.dictation-panel { display: none; align-items: center; gap: 14px; min-height: 74px; margin-top: 34px; padding: 16px 20px; border: 2px dashed var(--ink); background: #fffdf6; }
body[data-run-mode="dictation"] .dictation-panel { display: flex; }
body[data-run-mode="dictation"] .sentence, body[data-run-mode="dictation"] .sentence-next { display: none; }
.dict-icon { font-size: 26px; }
.dictation-panel p { margin: 0; flex: 1; font-size: 15px; font-weight: 700; }
.dict-replay { margin: 0; min-height: 44px; }

.start-btn { display: inline-flex; align-items: center; gap: 10px; min-height: 52px; margin-top: 22px; padding: 0 26px; border: 2px solid var(--ink); background: var(--ink); color: var(--paper); font-size: 16px; font-weight: 850; transition: transform .15s ease, box-shadow .15s ease; }
.start-btn:hover { transform: translate(-2px, -2px); box-shadow: 4px 4px 0 var(--yellow); }
.ghost-btn { min-height: 52px; margin-top: 22px; padding: 0 20px; border: 2px solid var(--ink); background: transparent; color: var(--ink); font-size: 14px; font-weight: 800; }
.ghost-btn:hover { background: #fffdf6; }
.ready-best { margin: 18px 0 0; color: var(--muted); font-size: 13px; }
.ready-best b { color: var(--ink); font-family: var(--mono); }

/* 리더보드 */
.leaderboard-hub { margin-top: clamp(72px, 10vw, 112px); }
.leaderboard-head { display: flex; align-items: end; justify-content: space-between; gap: 40px; padding-bottom: 20px; border-bottom: 4px solid var(--ink); }
.leaderboard-head h2 { margin: 8px 0 0; font: 900 clamp(30px, 5vw, 52px)/1 var(--display); letter-spacing: -.035em; }
.leaderboard-head > p { max-width: 34ch; margin: 0; color: var(--muted); font-size: 12px; font-weight: 700; line-height: 1.65; text-align: right; }
.leaderboard-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-bottom: 2px solid var(--ink); }
.leaderboard-board { min-width: 0; padding: 28px 30px 34px 0; }
.leaderboard-board + .leaderboard-board { padding-right: 0; padding-left: 30px; border-left: 2px solid var(--ink); }
.leaderboard-board-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; }
.leaderboard-board-head > div > span { color: var(--coral); font: 800 10px var(--mono); letter-spacing: .08em; }
.leaderboard-board-head h3 { margin: 6px 0 0; font: 900 clamp(21px, 3vw, 30px)/1.05 var(--display); }
.board-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; margin-top: 22px; }
.board-filter-group { display: flex; align-items: center; gap: 8px; }
.board-filter-group > span { color: var(--muted); font-size: 10px; font-weight: 850; }
.board-tablist { display: flex; }
.board-tablist button { min-height: 40px; padding: 0 12px; border: 1px solid var(--ink); border-right: 0; background: transparent; color: var(--muted); font-size: 11px; font-weight: 850; transition: background .14s ease, color .14s ease, transform .14s ease; }
.board-tablist button:last-child { border-right: 1px solid var(--ink); }
.board-tablist button:hover { color: var(--ink); background: #fffdf6; }
.board-tablist button:active { transform: translateY(1px); }
.board-tablist button:focus-visible { position: relative; z-index: 1; outline: 3px solid var(--yellow); outline-offset: 2px; }
.board-tablist button[aria-selected="true"] { background: var(--ink); color: var(--paper); }
.board-current { margin: 20px 0 5px; color: var(--coral); font: 800 10px var(--mono); letter-spacing: .06em; text-transform: uppercase; }
.leaderboard-board .board-list.is-loading { opacity: .48; }
.leaderboard-board[aria-busy="true"] .board-empty,
.sv-board[aria-busy="true"] .board-empty { animation: loading-pulse 1s ease-in-out infinite alternate; }
.leaderboard-board .board-empty { min-height: 54px; margin: 14px 0 0; line-height: 1.6; }
.survival-board-home { background: var(--night); color: var(--paper); box-shadow: 32px 0 0 var(--night), -1px 0 0 var(--night); }
.survival-board-home .leaderboard-board-head > div > span,
.survival-board-home .board-current { color: var(--lime); }
.survival-board-home .board-note,
.survival-board-home .board-filter-group > span,
.survival-board-home .board-list i,
.survival-board-home .board-list .b-acc,
.survival-board-home .board-list .b-cpm small,
.survival-board-home .board-empty { color: #9da0ae; }
.survival-board-home .board-list li { border-color: #343641; }
.survival-board-home .board-list li.is-you { background: #292d1d; outline-color: var(--lime); }
.survival-board-home .board-list li:nth-child(-n + 3) i { color: var(--lime); }
.survival-board-home .board-tablist button { border-color: #5a5d69; color: #b8bac4; }
.survival-board-home .board-tablist button:last-child { border-right-color: #5a5d69; }
.survival-board-home .board-tablist button:hover { background: #23252e; color: var(--paper); }
.survival-board-home .board-tablist button:focus-visible { outline-color: var(--lime); }
.survival-board-home .board-tablist button[aria-selected="true"] { border-color: var(--lime); background: var(--lime); color: var(--night); }
.board { margin-top: 56px; }
.board header { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding-bottom: 10px; border-bottom: 2px solid var(--ink); }
.board h2 { margin: 0; font: 900 18px var(--display); }
.board h2 span { color: var(--coral); }
.board-note { color: var(--muted); font-size: 11px; font-weight: 700; }
.board-note b { font-family: var(--mono); }
.board-list { margin: 0; padding: 0; list-style: none; }
.board-list li { display: grid; grid-template-columns: 34px 1fr auto auto; align-items: baseline; gap: 14px; padding: 11px 4px; border-bottom: 1px solid var(--line); font-size: 14px; }
.board-list li.is-you { background: #fff7d6; outline: 2px solid var(--yellow); outline-offset: -2px; }
.board-list i { font: 800 12px var(--mono); font-style: normal; color: var(--muted); }
.board-list li:nth-child(1) i, .board-list li:nth-child(2) i, .board-list li:nth-child(3) i { color: var(--coral); }
.board-list .b-name { overflow: hidden; font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }
.board-list .b-cpm { font: 700 15px var(--mono); }
.board-list .b-cpm small { color: var(--muted); font-size: 10px; }
.board-list .b-acc { color: var(--muted); font: 700 11px var(--mono); }
.board-empty { color: var(--muted); font-size: 13px; }
.board-retry { min-height: 44px; margin-top: 12px; padding: 0 16px; border: 2px solid currentColor; background: transparent; color: inherit; font-size: 12px; font-weight: 850; }
.leaderboard-board[data-board-state="error"] .board-empty,
.sv-board[data-board-state="error"] .board-empty { color: #a63821; }
.survival-board-home[data-board-state="error"] .board-empty { color: #ff9e80; }
@keyframes loading-pulse { to { opacity: .45; } }

/* 진행 화면 */
.run-top { display: flex; gap: 34px; margin-top: 6px; }
.run-stat span { display: block; color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.run-stat b { font: 700 30px/1.2 var(--mono); }
.run-stat:first-child b { color: var(--coral); }
.time-bar { height: 6px; margin-top: 14px; background: #e6e2d6; }
.time-bar i { display: block; height: 100%; background: var(--yellow); transform-origin: left; }

.sentence { min-height: 74px; margin-top: 34px; font-size: clamp(20px, 3.4vw, 27px); font-weight: 650; line-height: 1.6; word-break: keep-all; overflow-wrap: anywhere; }
.sentence .ok { color: var(--ink); }
.sentence .bad { color: var(--coral); background: #ffe3d9; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }
.sentence .now { background: var(--yellow); }
.sentence .todo { color: #b4b1a6; }
.sentence-next { margin-top: 10px; color: #b4b1a6; font-size: 15px; word-break: keep-all; }

#typing { width: 100%; margin-top: 26px; padding: 14px 16px; border: 2px solid var(--ink); border-radius: 0; background: #fffdf6; color: var(--ink); font-family: var(--body); font-size: 19px; }
#typing:focus { outline: 3px solid var(--yellow); outline-offset: 2px; }
.run-hint { margin: 12px 0 0; color: var(--muted); font-size: 11px; }
.run-hint kbd { padding: 1px 5px; border: 1px solid var(--line); border-radius: 4px; background: #fffdf6; font-family: var(--mono); font-size: 10px; }

/* 결과 화면 */
.done-cpm { margin: 10px 0 0; font: 700 clamp(64px, 13vw, 108px)/1 var(--mono); letter-spacing: -.02em; }
.done-cpm small { margin-left: 8px; color: var(--muted); font-size: 18px; font-family: var(--body); font-weight: 800; }
.done-badge { display: inline-block; margin: 14px 0 0; padding: 6px 12px; background: var(--yellow); font-size: 13px; font-weight: 850; box-shadow: 3px 3px 0 var(--ink); }
.done-stats { display: flex; gap: 34px; margin: 30px 0 0; }
.done-stats dt { color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.done-stats dd { margin: 2px 0 0; }
.done-stats b { font: 700 24px var(--mono); }
.done-stats small { margin-left: 2px; color: var(--muted); font-size: 11px; }

.spark { display: flex; align-items: flex-end; gap: 5px; height: 56px; margin-top: 28px; }
.spark i { flex: 0 0 14px; min-height: 4px; background: #e0dccd; }
.spark i.is-last { background: var(--yellow); outline: 2px solid var(--ink); outline-offset: -2px; }

.result-save-state { display: flex; align-items: center; gap: 10px; max-width: 520px; margin: 26px 0 0; color: #3f4437; font-size: 13px; font-weight: 750; }
.result-save-state b { flex: 0 0 auto; padding: 5px 8px; color: var(--night); background: var(--lime); font: 850 9px var(--mono); letter-spacing: .08em; }
.result-save-state[data-state="saving"] b { background: var(--yellow); }
.result-save-state[data-state="saved"] b { color: var(--paper); background: #17613c; }
.result-save-state[data-state="error"] b { color: var(--paper); background: #a63821; }

.register { max-width: 520px; margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }
.register label { display: block; font-size: 12px; font-weight: 850; text-transform: uppercase; }
.register-help { margin: 6px 0 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.register-row { display: flex; gap: 8px; margin-top: 8px; }
#callsign { flex: 1; min-width: 0; max-width: 260px; padding: 11px 13px; border: 2px solid var(--ink); background: #fffdf6; font-family: var(--body); font-size: 15px; }
#callsign:focus { outline: 3px solid var(--yellow); outline-offset: 2px; }
#callsign[aria-invalid="true"], #sv-callsign[aria-invalid="true"] { border-color: var(--coral); }
#register-btn { min-height: 46px; padding: 0 20px; border: 2px solid var(--ink); background: var(--yellow); font-size: 14px; font-weight: 850; }
#register-btn:disabled { opacity: .5; cursor: default; }
.register[data-state="error"] .register-result { color: #a63821; }
.register[data-state="success"] .register-result { color: #17613c; }
.register[data-state="success"] { padding-top: 0; border-top: 0; }
.register[data-state="success"] label,
.register[data-state="success"] .register-help,
.register[data-state="success"] .register-row { display: none; }
.register[data-state="success"] .register-result { margin-top: 0; }
.register-result { margin: 10px 0 0; font-size: 14px; font-weight: 750; }
.register-result b { color: var(--coral); font-family: var(--mono); }

.lobby-share { display: flex; align-items: center; justify-content: space-between; gap: 18px; width: min(100%, 430px); min-height: 62px; margin: 18px 0 24px; padding: 12px 16px; border: 2px solid var(--ink); color: var(--ink); background: var(--lime); box-shadow: 4px 4px 0 var(--ink); font-size: 14px; font-weight: 900; transition: transform .16s ease, box-shadow .16s ease; }
.lobby-share[hidden] { display: none; }
.lobby-share:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--ink); }
.lobby-share:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--ink); }
.lobby-share span { min-width: 0; overflow-wrap: anywhere; }
.lobby-share small { display: block; margin-bottom: 3px; color: #46610f; font: 800 9px var(--mono); letter-spacing: .12em; }
.lobby-share > b { flex: 0 0 auto; font: 900 24px var(--display); }

.daily-run-return { display: flex; align-items: center; justify-content: space-between; gap: 18px; width: min(100%, 430px); min-height: 68px; margin: 18px 0 24px; padding: 12px 16px; border: 2px solid var(--ink); color: var(--paper); background: var(--ink); box-shadow: 4px 4px 0 var(--coral); transition: transform .16s ease, box-shadow .16s ease; }
.daily-run-return[hidden] { display: none; }
.daily-run-return:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--coral); }
.daily-run-return small { display: block; margin-bottom: 4px; color: var(--lime); font: 800 9px var(--mono); letter-spacing: .12em; }
.daily-run-return span > b { font: 900 15px/1.25 var(--display); }
.daily-run-return > b { flex: 0 0 auto; color: var(--lime); font: 900 24px var(--display); }

.done-actions { display: grid; grid-template-columns: auto auto minmax(0, auto); align-items: stretch; justify-content: start; gap: 10px; }
.done-actions > * { margin-top: 22px; }
.done-actions .start-btn { justify-content: center; }
.result-project-link { display: inline-flex; align-items: center; justify-content: center; gap: 10px; text-decoration: none; }

.foot { display: flex; justify-content: space-between; gap: 12px; padding: 16px 24px; border-top: 1px solid var(--line); color: var(--muted); font-size: 10px; font-weight: 700; }

/* ---------- 추가 모드 입구 ---------- */
.ready-extras { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-top: 52px; }
.arcade { padding: 24px 26px 28px; border: 2px solid var(--ink); background: var(--night); color: var(--paper); box-shadow: 6px 6px 0 var(--yellow); }
.arcade .eyebrow { color: var(--lime); }
.arcade h2 { margin: 8px 0 0; font: 900 clamp(26px, 4.6vw, 38px)/1.06 var(--display); }
.arcade-lead { margin: 12px 0 0; max-width: 46ch; color: #b8bac4; font-size: 14px; line-height: 1.7; }
.arcade-lead b { color: var(--yellow); }
.arcade .start-btn { border-color: var(--paper); background: var(--paper); color: var(--ink); }
.arcade .start-btn:hover { box-shadow: 4px 4px 0 var(--lime); }
.keyboard-entry { display: flex; flex-direction: column; align-items: flex-start; padding: 24px 26px 28px; border: 2px solid var(--ink); background: var(--yellow); box-shadow: 6px 6px 0 var(--coral); }
.keyboard-entry .eyebrow { color: #8b351e; }
.keyboard-entry h2 { margin: 8px 0 0; font: 900 clamp(26px, 4.6vw, 38px)/1.06 var(--display); }
.keyboard-entry p:not(.eyebrow) { flex: 1; margin: 12px 0 0; color: #4b3f19; font-size: 14px; line-height: 1.7; }

/* ---------- 키보드 입력 점검 ---------- */
.kb-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; }
.kb-head h2 { margin: 7px 0 0; font: 900 clamp(30px, 5vw, 46px)/1.05 var(--display); }
.kb-head p:last-child { margin: 10px 0 0; color: var(--muted); font-size: 14px; }
.kb-head .ghost-btn { flex: 0 0 auto; margin: 0; }
.kb-live { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 4px 20px; margin-top: 28px; padding: 22px 24px; border: 2px solid var(--ink); background: var(--night); color: var(--paper); box-shadow: 6px 6px 0 var(--yellow); }
.kb-live span { grid-column: 1 / -1; color: #9da0ae; font-size: 10px; font-weight: 850; text-transform: uppercase; }
.kb-live strong { overflow: hidden; font: 900 clamp(30px, 6vw, 56px)/1 var(--display); text-overflow: ellipsis; white-space: nowrap; }
.kb-live code { color: var(--lime); font: 700 13px var(--mono); }
.kb-stats { display: grid; grid-template-columns: repeat(4, 1fr); margin: 18px 0 0; border: 2px solid var(--ink); background: #fffdf6; }
.kb-stats div { min-width: 0; padding: 15px 17px; border-right: 1px solid var(--line); }
.kb-stats div:last-child { border-right: 0; }
.kb-stats dt, .kb-burst-results dt { color: var(--muted); font-size: 10px; font-weight: 800; }
.kb-stats dd, .kb-burst-results dd { margin: 4px 0 0; white-space: nowrap; }
.kb-stats b, .kb-burst-results b { font: 700 24px var(--mono); }
.kb-stats small, .kb-burst-results small { margin-left: 4px; color: var(--muted); font-size: 10px; }
.kb-panel { margin-top: 24px; padding: 22px; border: 2px solid var(--ink); background: #fffdf6; }
.kb-panel > header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.kb-panel h3 { margin: 5px 0 0; font: 900 22px/1.1 var(--display); }
.kb-map-panel > header > p { display: flex; align-items: center; gap: 7px; margin: 0; color: var(--muted); font-size: 10px; font-weight: 750; }
.kb-legend-down, .kb-legend-tested { display: inline-block; width: 12px; height: 12px; border: 1px solid var(--ink); }
.kb-legend-down { background: var(--coral); }
.kb-legend-tested { margin-left: 5px; background: var(--yellow); }
.kb-map-scroll { margin-top: 20px; overflow-x: auto; padding: 0 0 8px; }
.kb-map { width: 990px; user-select: none; }
.kb-row { display: flex; gap: 6px; margin-top: 6px; }
.kb-key { flex: 0 0 55px; height: 48px; display: flex; align-items: center; justify-content: center; border: 2px solid var(--ink); background: var(--paper); font: 700 11px var(--mono); transition: transform .06s ease, background .06s ease; }
.kb-key.is-tested { background: var(--yellow); }
.kb-key.is-down { background: var(--coral); color: #fff; transform: translateY(3px); box-shadow: inset 0 3px 0 rgba(0, 0, 0, .18); }
.kb-key[data-units="1.4"] { flex-basis: 79px; }
.kb-key[data-units="1.7"] { flex-basis: 97px; }
.kb-key[data-units="2"] { flex-basis: 115px; }
.kb-key[data-units="2.3"] { flex-basis: 133px; }
.kb-key[data-units="5.9"] { flex-basis: 349px; }
.kb-burst { display: grid; grid-template-columns: minmax(250px, .9fr) minmax(0, 1.1fr); gap: 28px; }
.kb-burst-copy > p:not(.eyebrow) { margin: 10px 0 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.kb-burst-copy .start-btn { margin-top: 16px; }
.kb-burst-copy .start-btn:disabled { cursor: default; opacity: .55; transform: none; box-shadow: none; }
.kb-progress { height: 7px; margin-top: 14px; background: #e4e0d4; }
.kb-progress i { display: block; width: 100%; height: 100%; background: var(--coral); transform: scaleX(0); transform-origin: left; }
.kb-burst-results { display: grid; grid-template-columns: repeat(3, 1fr); margin: 0; border: 1px solid var(--line); }
.kb-burst-results div { min-width: 0; padding: 13px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.kb-burst-results div:nth-child(3n) { border-right: 0; }
.kb-burst-results div:nth-last-child(-n + 3) { border-bottom: 0; }
.kb-burst-results .kb-suspect b { color: var(--coral); }
.kb-caveat { grid-column: 1 / -1; margin: 0; padding-top: 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; line-height: 1.6; }
.kb-reset { min-height: 34px; padding: 0 12px; border: 1px solid var(--ink); background: transparent; font-size: 11px; font-weight: 800; }
.kb-reset:hover { background: var(--yellow); }
.kb-events ol { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; margin: 16px 0 0; padding: 0; list-style: none; }
.kb-events li { display: grid; grid-template-columns: 76px minmax(0, 1fr) auto; gap: 8px; padding: 8px 2px; border-bottom: 1px solid var(--line); font-size: 12px; }
.kb-events li.is-empty { display: block; grid-column: 1 / -1; color: var(--muted); }
.kb-event-kind { color: var(--coral); font: 700 10px var(--mono); }
.kb-event-code { overflow: hidden; font-family: var(--mono); text-overflow: ellipsis; white-space: nowrap; }
.kb-event-detail { color: var(--muted); font-family: var(--mono); }

/* ---------- 서바이벌 화면 ---------- */
.sv-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.sv-wordmark { margin: 6px 0 0; font: 900 clamp(24px, 4vw, 34px)/1 var(--display); }
.sv-head-actions { display: flex; gap: 8px; }
.sv-exit { min-height: 44px; padding: 0 14px; border: 2px solid var(--ink); background: transparent; font-size: 12px; font-weight: 800; }
.sv-exit:hover { background: var(--yellow); }
.sv-sound { min-width: 44px; min-height: 44px; padding: 0; border: 2px solid var(--ink); background: transparent; font-size: 15px; line-height: 1; }
.sv-sound:hover { background: var(--yellow); }
.sv-sound.is-off { opacity: .45; }

.sv-hud { display: flex; align-items: center; gap: 20px; margin-top: 18px; padding: 10px 14px; border: 2px solid var(--ink); background: #fffdf6; }
.sv-hearts { display: flex; gap: 5px; }
.sv-hearts i { width: 13px; height: 13px; border: 2px solid var(--ink); border-radius: 50%; background: transparent; }
.sv-hearts i.is-on { background: var(--coral); }
.sv-stat span { display: block; color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.sv-stat b { font: 700 20px/1.15 var(--mono); }
.sv-stat:nth-of-type(1) b { color: var(--coral); }
#sv-combo.is-hot { color: var(--ink); background: var(--yellow); padding: 0 5px; }
.sv-lv { margin-left: auto; min-width: 120px; text-align: right; }
.sv-lv span { font: 800 11px var(--mono); color: var(--muted); }
.sv-lv b { color: var(--ink); font-size: 14px; }
.sv-xp { height: 6px; margin-top: 5px; background: #e6e2d6; }
.sv-xp i { display: block; height: 100%; background: var(--lime); transform: scaleX(0); transform-origin: left; }

/* 무대가 화면 밖으로 넘치면 아래쪽에서 오는 단어를 못 본다. 세로 여유에서
   가로 폭을 거꾸로 계산해 비율을 지키면서 한 화면에 담는다. 도망칠 자리가
   좁다는 이야기가 있어 여백을 깎고 비율을 더 넓게 잡았다. */
.sv-stage { position: relative; margin: 10px auto 0; max-width: min(100%, calc((100svh - 250px) * 1320 / 700)); border: 2px solid var(--ink); background: var(--night); line-height: 0; }
#sv-canvas { display: block; width: 100%; aspect-ratio: 1320 / 700; touch-action: none; }
/* 좁은 화면에서는 가로로 눕힌 무대가 너무 납작해진다. 세로로 세워서
   피할 공간을 만든다. */
@media (max-width: 720px) {
  #sv-canvas { aspect-ratio: 5 / 7; }
  .sv-stage { max-width: 100%; }
}
/* 진짜 입력창은 IME를 살려 두려고 지우지 않는다. 대신 보이지 않게 두고
   지금 치고 있는 꼬리만 캔버스에 직접 그린다. */
/* 모드 고르기 — 낱자(한 손)와 단어(양손)는 점수 체계가 달라 랭킹도 나뉜다. */
.sv-modes { display: flex; gap: 8px; margin: 0 0 14px; }
.sv-mode { flex: 1; min-height: 52px; display: flex; flex-direction: column; gap: 3px; padding: 9px 10px; border: 2px solid rgba(244, 241, 232, .35); background: transparent; color: #f4f1e8; cursor: pointer; text-align: left; }
.sv-mode b { font-size: 14px; }
.sv-mode span { font-size: 11px; color: rgba(244, 241, 232, .6); letter-spacing: .02em; }
.sv-mode.is-on { border-color: var(--lime); background: rgba(186, 255, 41, .12); }
.sv-mode.is-on span { color: rgba(244, 241, 232, .8); }
.sv-board-tabs { display: flex; gap: 6px; margin-right: auto; }
.sv-board-tabs button { min-height: 44px; padding: 4px 12px; border: 2px solid var(--ink); background: transparent; font: 800 11px var(--mono); color: var(--muted); cursor: pointer; }
.sv-board-tabs button.is-on { background: var(--ink); color: var(--paper); }

.sv-input { position: absolute; left: 0; bottom: 0; width: 1px; height: 1px; padding: 0; border: 0; opacity: 0; }

.sv-overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(17, 18, 24, .9); line-height: 1.5; }
.sv-card { width: min(560px, 100%); max-height: 100%; overflow: auto; padding: 26px 28px; border: 2px solid var(--paper); background: var(--night); color: var(--paper); text-align: left; }
.sv-card h3 { margin: 0; font: 900 24px/1.2 var(--display); }
.sv-card .eyebrow { color: var(--lime); }
.sv-card .eyebrow + h3 { margin-top: 8px; }
.sv-rules { margin: 16px 0 0; padding-left: 18px; color: #b8bac4; font-size: 14px; }
.sv-rules li { margin-top: 7px; }
.sv-rules b { color: var(--yellow); }
.sv-note { margin: 14px 0 0; color: #8a8d99; font-size: 12px; }
.sv-note kbd { padding: 1px 5px; border: 1px solid #45485a; border-radius: 4px; font-family: var(--mono); font-size: 10px; }
.sv-card .start-btn { border-color: var(--paper); background: var(--paper); color: var(--ink); }
.sv-card .start-btn:hover { box-shadow: 4px 4px 0 var(--lime); }
.sv-card .ghost-btn { border-color: #45485a; color: var(--paper); }
.sv-card .ghost-btn:hover { background: #1c1e27; }
.sv-best { margin: 14px 0 0; color: #8a8d99; font-size: 13px; }
.sv-best b { color: var(--yellow); font-family: var(--mono); }
.sv-actions { display: flex; flex-wrap: wrap; gap: 10px; }

.sv-perks { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 18px; }
.sv-perk { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 16px 12px 14px; border: 2px solid #45485a; background: #1a1c25; color: var(--paper); text-align: left; transition: border-color .12s ease, transform .12s ease; }
.sv-perk:hover, .sv-perk:focus-visible { border-color: var(--yellow); transform: translateY(-2px); }
.sv-perk kbd { position: absolute; top: 6px; right: 8px; color: #6f7285; font: 800 10px var(--mono); }
.sv-perk-icon { font-size: 22px; line-height: 1; }
.sv-perk b { font-size: 14px; font-weight: 850; }
.sv-perk b small { color: var(--lime); font-size: 10px; font-family: var(--mono); }
.sv-perk-desc { color: #9a9db0; font-size: 12px; line-height: 1.5; }

.sv-final { margin: 10px 0 0; font: 700 clamp(48px, 10vw, 76px)/1 var(--mono); }
.sv-final small { margin-left: 8px; color: #8a8d99; font-size: 16px; font-family: var(--body); font-weight: 800; }
.sv-card .done-badge { color: var(--ink); box-shadow: 3px 3px 0 var(--paper); }
.sv-final-stats { display: flex; flex-wrap: wrap; gap: 24px; margin: 20px 0 0; }
.sv-final-stats dt { color: #8a8d99; font-size: 10px; font-weight: 800; text-transform: uppercase; }
.sv-final-stats dd { margin: 2px 0 0; }
.sv-final-stats b { font: 700 21px var(--mono); }
.sv-register { margin-top: 22px; }
.sv-register #sv-callsign { border-color: var(--paper); background: #1a1c25; color: var(--paper); }
.sv-register #sv-register-btn { border-color: var(--paper); }
.sv-register #sv-register-btn { min-height: 46px; }
.sv-register[data-state="error"] .register-result { color: #ff9e80; }
.sv-register[data-state="success"] .register-result { color: var(--lime); }
.sv-card .register-result { color: var(--paper); }
.sv-card .lobby-share { width: 100%; border-color: var(--paper); box-shadow: 4px 4px 0 var(--paper); }
.sv-card .lobby-share:hover { box-shadow: 6px 6px 0 var(--paper); }
.sv-hint { margin-top: 12px; }
.sv-board { margin-top: 44px; }

@media (max-width: 720px) {
  .leaderboard-head { display: block; }
  .leaderboard-head > p { margin-top: 14px; text-align: left; }
  .leaderboard-grid { grid-template-columns: 1fr; }
  .leaderboard-board { padding: 24px 0 30px; }
  .leaderboard-board + .leaderboard-board { padding: 28px 0 32px; border-top: 2px solid var(--ink); border-left: 0; }
  .survival-board-home { margin-inline: -20px; padding-inline: 20px !important; box-shadow: none; }
  .ready-extras { grid-template-columns: 1fr; }
  .sv-hud { flex-wrap: wrap; gap: 14px; }
  .sv-lv { margin-left: 0; min-width: 92px; text-align: left; }
  .sv-stat b { font-size: 17px; }
  .sv-perks { grid-template-columns: 1fr; }
  .sv-perk { flex-direction: row; align-items: center; gap: 12px; padding: 12px 14px; }
  .sv-perk-desc { display: none; }
  .sv-card { padding: 20px; }
  .sv-final-stats { gap: 16px; }
  .arcade { padding: 20px; }
  .keyboard-entry { padding: 20px; }
  .kb-stats { grid-template-columns: repeat(2, 1fr); }
  .kb-stats div:nth-child(2) { border-right: 0; }
  .kb-stats div:nth-child(-n + 2) { border-bottom: 1px solid var(--line); }
  .kb-burst { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .top { padding: 14px 16px; gap: 10px; }
  .top-note { display: none; }
  main { width: calc(100% - 32px); }
  body[data-screen="ready"] main { width: calc(100% - 32px); }
  body[data-screen="keyboard"] main { width: calc(100% - 24px); }
  .screen { padding: 28px 0 48px; }
  .run-top { gap: 22px; }
  .run-stat b { font-size: 24px; }
  .done-stats { gap: 22px; }
  .board-list li { grid-template-columns: 26px 1fr auto; }
  .board-list .b-acc { display: none; }
  .leaderboard-board .board-list li { grid-template-columns: 24px minmax(0, 1fr) auto auto; gap: 8px; }
  .leaderboard-board .board-list .b-acc { display: block; font-size: 10px; }
  .leaderboard-board-head { align-items: start; }
  .leaderboard-board-head .board-note { max-width: 11ch; text-align: right; }
  .board-filters { display: grid; gap: 10px; }
  .board-filter-group { justify-content: space-between; }
  .board-tablist button { min-height: 44px; padding-inline: 11px; }
  .survival-board-home { margin-inline: -16px; padding-inline: 16px !important; }
  .done-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .done-actions #retry { grid-column: 1 / -1; }
  .done-actions > * { width: 100%; margin-top: 10px; }
  .result-save-state { align-items: flex-start; }
  .register-row { flex-wrap: wrap; }
  #callsign, #sv-callsign { flex: 1 1 100%; max-width: none; min-width: 0; }
  .done-stats { flex-wrap: wrap; }
  .kb-head { position: relative; display: block; padding-top: 50px; }
  .kb-head .ghost-btn { position: absolute; top: 0; right: 0; min-height: 40px; padding: 0 12px; }
  .kb-live { grid-template-columns: minmax(0, 1fr); padding: 18px; }
  .kb-live code { margin-top: 6px; }
  .kb-panel { padding: 18px 14px; }
  .kb-map-panel > header { display: block; }
  .kb-map-panel > header > p { flex-wrap: wrap; justify-content: flex-start; max-width: none; margin-top: 10px; }
  .kb-burst-results { grid-template-columns: repeat(2, 1fr); }
  .kb-burst-results div:nth-child(3n) { border-right: 1px solid var(--line); }
  .kb-burst-results div:nth-child(2n) { border-right: 0; }
  .kb-burst-results div:nth-last-child(-n + 3) { border-bottom: 1px solid var(--line); }
  .kb-burst-results div:nth-last-child(-n + 2) { border-bottom: 0; }
  .kb-events ol { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
