:root {
  --bg: #fff;
  --surface: #fff;
  --surface-2: #f3f3f3;
  --surface-3: #e8e8e8;
  --line: #dedede;
  --line-strong: #adadad;
  --ink: #111;
  --muted: #555;
  --faint: #777;
  --danger: #b42318;
  --on-dark: #fff;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--ink); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
button, input, textarea { font: inherit; }
button, a, textarea, input { -webkit-tap-highlight-color: transparent; }
button, a { touch-action: manipulation; }
::selection { background: var(--ink); color: var(--on-dark); }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
/* Programmatic reading-heading focus is semantic, not an interactive control. */
#course-reading-title:focus { outline: none; }
[hidden] { display: none !important; }

.app-header { position: sticky; z-index: 10; top: 0; display: flex; align-items: center; justify-content: space-between; gap: 32px; min-height: 68px; padding: 0 max(24px, calc((100vw - 1120px) / 2)); border-bottom: 1px solid var(--line); background: #fff; }
.brand { flex: none; color: var(--ink); font-size: .95rem; font-weight: 800; letter-spacing: -.03em; text-decoration: none; }
.header-actions { display: flex; align-items: center; justify-content: flex-end; gap: 14px; min-width: 0; margin-left: auto; }
.app-header nav { display: flex; align-items: center; gap: 2px; }
.app-header nav a { min-height: 44px; padding: 12px 13px; border-bottom: 2px solid transparent; color: var(--muted); font-size: .82rem; font-weight: 650; text-decoration: none; }
.app-header nav a:hover { color: var(--ink); }
.app-header nav a[aria-current="page"] { border-color: var(--ink); color: var(--ink); }
.account-identity { display: inline-flex; align-items: center; gap: 8px; max-width: 190px; min-height: 44px; padding: 0; border: 0; border-radius: 0; background: transparent; color: var(--ink); font-size: .78rem; font-weight: 750; text-decoration: none; }
.account-identity:hover { color: var(--muted); }
.account-identity svg { flex: none; width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.account-identity.signed-in > svg { display: none !important; }
.account-user-photo { flex: none; width: 24px; height: 24px; border-radius: 50%; object-fit: cover; }
.account-identity span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-identity .account-crown { position: relative; display: inline-grid; flex: none; place-items: center; width: 25px; height: 25px; min-width: 25px; margin-left: 1px; overflow: visible; color: #f2bd24; line-height: 1; text-overflow: clip; }
.account-identity .account-crown svg { display: block; width: 21px; height: 21px; overflow: visible; fill: currentColor; stroke: #8f6500; stroke-width: 1.15; stroke-linecap: round; stroke-linejoin: round; transform-origin: center; animation: crown-shine 2.2s ease-in-out infinite; }
.account-identity .account-crown .account-crown-band { fill: none; stroke-width: 1.7; }
.account-identity .account-crown::before, .account-identity .account-crown::after { content: ""; position: absolute; width: 4px; height: 4px; border-radius: 1px; background: #fff3a6; filter: drop-shadow(0 0 4px #ffd84d); transform: rotate(45deg) scale(.35); opacity: 0; animation: crown-sparkle 1.8s ease-in-out infinite; }
.account-identity .account-crown::before { top: 0; right: 0; }
.account-identity .account-crown::after { bottom: 1px; left: 0; animation-delay: -.9s; }
@keyframes crown-shine { 0%, 100% { filter: drop-shadow(0 0 0 rgb(255 213 64 / 0%)); transform: translateY(0) scale(1); } 45% { filter: drop-shadow(0 0 5px rgb(255 213 64 / 85%)); transform: translateY(-1px) scale(1.06); } 60% { filter: drop-shadow(0 0 2px rgb(255 235 152 / 65%)); transform: translateY(0) scale(1.02); } }
@keyframes crown-sparkle { 0%, 32%, 100% { opacity: 0; transform: rotate(45deg) scale(.35); } 45% { opacity: 1; transform: rotate(45deg) scale(1); } 58% { opacity: 0; transform: rotate(45deg) scale(.35); } }
@media (prefers-reduced-motion: reduce) { .account-identity .account-crown svg, .account-identity .account-crown::before, .account-identity .account-crown::after { animation: none; } }
.account-menu { position: fixed; z-index: 40; display: grid; min-width: 150px; padding: 6px; border: 1px solid var(--line-strong); border-radius: 9px; background: var(--surface); }
.account-menu a, .account-menu button { display: block; width: 100%; min-height: 38px; padding: 9px 11px; border: 0; border-radius: 5px; background: transparent; color: var(--ink); font-size: .78rem; font-weight: 700; text-align: left; text-decoration: none; cursor: pointer; }
.account-menu a:hover, .account-menu button:hover, .account-menu a:focus-visible, .account-menu button:focus-visible { background: var(--surface-2); }
.auth-gate { width: min(calc(100% - 32px), 390px); margin: auto; padding: 30px; border: 1px solid var(--line-strong); border-radius: 14px; background: var(--surface); color: var(--ink); text-align: left; }
.auth-gate::backdrop { background: rgb(17 17 17 / 42%); }
.auth-gate-close { position: absolute; top: 12px; right: 14px; width: 36px; height: 36px; padding: 0; border: 0; background: transparent; color: var(--muted); font-size: 1.5rem; line-height: 1; cursor: pointer; }
.auth-gate-kicker { margin: 0 42px 10px 0; color: var(--muted); font-size: .66rem; font-weight: 800; letter-spacing: .14em; }
.auth-gate h2 { margin: 0; font-size: 1.65rem; line-height: 1.05; letter-spacing: -.04em; }
.auth-gate-copy { margin: 14px 0 24px; color: var(--muted); font-size: .88rem; line-height: 1.55; }
.auth-google-button, .auth-guest-button { width: 100%; min-height: 46px; cursor: pointer; }
.auth-google-button { border: 1px solid var(--ink); border-radius: 8px; background: var(--ink); color: var(--on-dark); font-weight: 780; }
.auth-guest-button { margin-top: 8px; border: 0; background: transparent; color: #666; font-size: .82rem; }
.auth-guest-button:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.auth-gate-status { min-height: 18px; margin: 10px 0 0; color: var(--muted); font-size: .72rem; text-align: center; }
.sync-choice-dialog { width: min(calc(100% - 32px), 440px); max-height: calc(100dvh - 32px); overflow-y: auto; }
.sync-choice-dialog h2 { font-size: 1.4rem; line-height: 1.2; }
.sync-choice-dialog p { margin: 16px 0 24px; color: var(--muted); font-size: .88rem; line-height: 1.55; }
.sync-choice-actions { display: grid; gap: 10px; }
.sync-choice-actions button { width: 100%; min-height: 44px; padding: 11px 14px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--ink); font: inherit; font-size: .85rem; font-weight: 650; cursor: pointer; }
.sync-choice-actions button:hover { background: var(--surface-2); }
.sync-choice-actions [data-choice="merge"] { border-color: var(--ink); background: var(--ink); color: var(--on-dark); }
.sync-choice-actions [data-choice="cancel"] { border-color: transparent; color: var(--muted); }
.premium-dialog form { display: grid; gap: 10px; margin-top: 24px; }
.premium-dialog label { color: var(--ink); font-size: .78rem; font-weight: 750; }
.premium-dialog input { width: 100%; min-height: 46px; padding: 0 13px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--ink); font: inherit; }
.premium-dialog input:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.premium-code-hint { margin: -2px 0 8px; color: var(--muted); font-size: .78rem; }
main { width: min(100% - 48px, 1120px); margin: 0 auto; padding: 72px 0 104px; }
.eyebrow { margin: 0 0 12px; color: var(--muted); font-size: .68rem; font-weight: 800; letter-spacing: .15em; }
h1, h2, h3, p { overflow-wrap: break-word; }
h1 { margin: 0; max-width: 820px; font-size: clamp(2.6rem, 7vw, 5.6rem); line-height: .94; letter-spacing: -.065em; }
h2 { margin: 0; font-size: clamp(1.8rem, 4vw, 3.2rem); line-height: 1; letter-spacing: -.045em; }
h3 { margin: 0; font-size: 1.05rem; letter-spacing: -.02em; }
.page-intro, .lead { max-width: 640px; color: var(--muted); font-size: clamp(1rem, 2vw, 1.18rem); line-height: 1.65; }
.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 36px; margin-bottom: 46px; }
.page-heading.compact { align-items: center; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }
.primary, .secondary { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 10px 17px; border: 1px solid var(--ink); border-radius: 8px; font-size: .84rem; font-weight: 750; text-decoration: none; cursor: pointer; }
.primary { background: var(--ink); color: var(--on-dark); }
.secondary { background: var(--surface); color: var(--ink); }
button:disabled { cursor: not-allowed; opacity: .45; }
.text-link { color: var(--ink); font-weight: 750; text-underline-offset: 4px; }
.microcopy, .helper, .tier-note { color: var(--faint); font-size: .78rem; line-height: 1.6; }

.landing-page { max-width: 1040px; text-align: center; }
.landing-hero { display: flex; align-items: center; flex-direction: column; justify-content: center; min-height: min(820px, calc(100vh - 68px)); padding: 72px 0 108px; }
.landing-hero h1 { max-width: 960px; font-size: clamp(3.4rem, 9vw, 7.5rem); line-height: .92; }
.landing-highlight { display: inline; padding: .02em .12em .09em; background: #d92d20; color: #fff; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.landing-subtitle { max-width: 680px; margin: 30px auto 0; color: var(--muted); font-size: clamp(1.25rem, 3vw, 2rem); line-height: 1.35; }
.landing-cta { min-height: 64px; margin-top: 34px; padding: 17px 30px; border-radius: 10px; font-size: clamp(1rem, 2vw, 1.22rem); }
.landing-visual-keyboard { width: min(100%, 820px); margin-top: 68px; padding: clamp(18px, 4vw, 34px); border-radius: 18px; background: var(--ink); }
.landing-visual-screen { display: flex; align-items: center; gap: 9px; min-height: 94px; margin-bottom: 22px; padding: 22px; overflow: hidden; border: 1px solid #363636; border-radius: 9px; background: #191919; }
.landing-visual-screen i { display: block; width: clamp(26px, 7vw, 74px); height: 17px; border-radius: 3px; background: #666; }
.landing-visual-screen i:nth-child(-n+4) { background: #fff; }
.landing-visual-screen b { display: block; width: 3px; height: 28px; background: #d92d20; }
.landing-visual-keys { display: grid; gap: 7px; }
.landing-visual-keys > div { display: flex; justify-content: center; gap: 7px; }
.landing-visual-keys i { display: block; width: clamp(22px, 5vw, 54px); aspect-ratio: 1.16; border: 1px solid #555; border-bottom-width: 4px; border-radius: 6px; background: #252525; }
.landing-visual-keys i.home { border-color: #d92d20; background: #d92d20; }
.landing-visual-keys i.space { width: min(46%, 340px); height: 38px; aspect-ratio: auto; }
.landing-story, .speed-section, .benefits-section, .lifetime-section { padding: 120px 0; border-top: 1px solid var(--line); }
.landing-story h2, .benefits-section h2, .lifetime-section h2 { max-width: 760px; margin: 0 auto; }
.landing-story-copy { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0; margin-top: 54px; border: 1px solid var(--line-strong); border-radius: 14px; overflow: hidden; text-align: left; }
.landing-story-copy p { min-height: 230px; margin: 0; padding: clamp(28px, 5vw, 48px); color: var(--muted); font-size: clamp(1.05rem, 2vw, 1.3rem); line-height: 1.75; }
.landing-story-copy p + p { border-left: 1px solid var(--line); background: var(--surface-2); }
.speed-section > p, .lifetime-section > p { max-width: 690px; margin: 28px auto 0; color: var(--muted); font-size: clamp(1.05rem, 2vw, 1.3rem); line-height: 1.75; }
.speed-comparison { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 28px; max-width: 880px; margin: 0 auto 48px; }
.speed-comparison > div { display: flex; min-height: 300px; padding: 34px 28px; border: 1px solid var(--line-strong); border-radius: 14px; flex-direction: column; justify-content: space-between; text-align: left; }
.speed-comparison strong { display: block; font-size: clamp(4rem, 10vw, 7rem); line-height: .9; letter-spacing: -.08em; }
.speed-comparison div > span { max-width: 260px; color: var(--muted); font-size: .9rem; line-height: 1.55; }
.speed-comparison .speed-target { border-color: #d92d20; background: #d92d20; color: #fff; }
.speed-comparison .speed-target span { color: #fff; }
.speed-arrow { color: #d92d20; font-size: 2.6rem; font-weight: 850; }
.benefit-list { display: grid; grid-template-columns: repeat(2, 1fr); max-width: 900px; margin: 52px auto 0; padding: 0; list-style: none; border: 1px solid var(--line-strong); border-radius: 14px; overflow: hidden; text-align: left; }
.benefit-list li { position: relative; min-height: 128px; padding: 30px 28px 30px 66px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: clamp(.98rem, 2vw, 1.15rem); line-height: 1.55; }
.benefit-list li:nth-child(odd) { border-right: 1px solid var(--line); }
.benefit-list li:last-child { grid-column: 1 / -1; border-bottom: 0; border-right: 0; background: var(--surface-2); }
.benefit-list li::before { content: "✓"; position: absolute; top: 28px; left: 28px; display: grid; place-items: center; width: 25px; height: 25px; border-radius: 50%; background: var(--ink); color: #fff; font-size: .76rem; font-weight: 850; }
.lifetime-section h2 { font-size: clamp(2.7rem, 7vw, 5.8rem); }
.landing-final-cta { padding: clamp(58px, 9vw, 96px); border: 0; border-radius: 18px; background: var(--ink); color: var(--on-dark); }
.landing-final-cta > p { color: #bbb; }
.landing-final-cta h2 { max-width: 760px; margin: 0 auto; }
.landing-cta-invert { border-color: var(--on-dark); background: var(--on-dark); color: var(--ink); }
.site-footer { display: flex; justify-content: space-between; width: min(100% - 48px, 1120px); margin: 0 auto; padding: 28px 0; border-top: 1px solid var(--line); color: var(--faint); font-size: .75rem; }

.timer { display: flex; align-items: baseline; gap: 8px; color: var(--muted); }
.timer strong { color: var(--ink); font-size: clamp(3rem, 7vw, 5rem); font-variant-numeric: tabular-nums; letter-spacing: -.07em; }
.timer span { font-size: .75rem; }
.notice { padding: 12px 14px; border: 1px solid var(--danger); color: var(--danger); }
.typing-panel { position: relative; border-top: 1px solid var(--ink); padding-top: 30px; }
.training-typing-surface { min-height: 360px; overflow: hidden; }
.zen-timer { margin-bottom: 18px; color: var(--ink); font-size: clamp(2rem, 5vw, 3.6rem); font-variant-numeric: tabular-nums; font-weight: 800; letter-spacing: -.06em; }
.passage { min-height: 165px; max-height: 250px; overflow: hidden; margin-bottom: 28px; color: #aaa; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: clamp(1.22rem, 2.5vw, 1.75rem); font-weight: 500; line-height: 1.75; letter-spacing: .012em; white-space: pre-wrap; }
.passage .correct { color: var(--ink); }
.passage .wrong { color: var(--danger); text-decoration: underline; text-decoration-thickness: 2px; }
.typing-cursor { position: relative; }
.typing-cursor::before { content: ''; position: absolute; top: .12em; bottom: .12em; left: 0; width: 2px; background: var(--ink); opacity: 1; animation: caret-blink .9s steps(1, end) infinite; }
.typing-active .typing-cursor::before { animation: none; opacity: 1; }
@keyframes caret-blink { 0%, 48% { opacity: 1; } 49%, 100% { opacity: .25; } }
.zen-restart { position: absolute; z-index: 2; top: 0; right: 0; min-height: 40px; padding: 7px 14px; border-color: var(--line-strong); background: transparent; color: var(--muted); font-size: .76rem; }
.training-typing-surface .passage { min-height: 0; max-height: none; overflow: hidden; scroll-behavior: auto; }
.typing-panel label { display: block; margin-bottom: 8px; color: var(--muted); font-size: .75rem; font-weight: 700; }
.zen-input-proxy, .course-input-proxy, .game-input-proxy { position: fixed; left: -100vw; width: 1px; height: 1px; opacity: 0; }
.start-overlay { position: absolute; z-index: 3; inset: 0; display: grid; place-items: center; background: rgba(255,255,255,.52); }
.awaiting-start .passage, .awaiting-start .course-inline-passage { filter: blur(8px); user-select: none; }
.practice-actions { display: flex; justify-content: space-between; align-items: center; min-height: 64px; gap: 16px; }
.practice-actions p { margin: 0; color: var(--muted); font-size: .82rem; }
body.training-zen { overflow: hidden; }
body.training-zen .app-header, body.training-zen .training-prelude, body.training-zen .training-toolbar, body.training-zen #storage-warning, body.training-zen .practice-mode, body.training-zen .practice-actions, body.training-zen #result { display: none !important; }
body.training-zen .practice-page { display: grid; place-items: center; width: min(100% - 48px, 1040px); min-height: 100vh; padding: 0; }
body.training-zen .typing-panel { width: 100%; min-height: 0; padding: 0; border: 0; }
body.training-zen .zen-timer { margin-bottom: 30px; }
body.training-zen .passage { max-height: 54vh; margin: 0; font-size: clamp(1.45rem, 3vw, 2.15rem); line-height: 1.8; }
.result-panel, .analytics { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--ink); border-bottom: 1px solid var(--line); }
.result-panel { margin-top: 36px; }
.result-panel > div, .analytics > div { min-width: 0; padding: 24px 20px; border-right: 1px solid var(--line); }
.result-panel > div:last-child, .analytics > div:last-child { border-right: 0; }
.result-panel span, .analytics span { display: block; color: var(--muted); font-size: .72rem; }
.result-panel strong, .analytics strong { display: inline-block; margin-top: 8px; font-size: clamp(1.8rem, 4vw, 3.1rem); font-variant-numeric: tabular-nums; letter-spacing: -.055em; }
.result-panel small, .analytics small { margin-left: 6px; color: var(--faint); font-size: .7rem; }

.game-page { width: min(100% - 48px, 1120px); padding: 0; }
.game-shell { display: grid; place-items: center; min-height: calc(100vh - 68px); }
.game-intro { display: grid; place-items: center; gap: 28px; max-width: 900px; text-align: center; }
.game-intro h1 { max-width: 900px; font-size: clamp(3.4rem, 8vw, 7rem); line-height: .92; }
.game-intro .primary { min-width: 220px; min-height: 56px; padding: 14px 26px; font-size: .95rem; }
.game-hud { display: none; align-items: center; justify-content: flex-end; gap: 24px; min-height: 64px; padding: 12px 0; }
.game-hud p { margin: 0; color: var(--muted); font-size: .76rem; font-weight: 700; }
#game-time { color: var(--ink); font-size: 1.5rem; font-variant-numeric: tabular-nums; font-weight: 850; letter-spacing: -.05em; }
.game-playfield { display: none; align-content: center; min-height: 420px; padding: clamp(36px, 7vw, 76px) 0; cursor: text; }
.race-status { min-height: 24px; margin: 0 0 22px; color: var(--muted); font-size: .78rem; }
.race-passage { max-height: none; min-height: 210px; margin: 0; font-size: clamp(1.5rem, 3.1vw, 2.35rem); line-height: 1.75; }
body.game-active { overflow: hidden; }
body.game-active .app-header, body.game-active .game-intro, body.game-active #matchmaking-status { display: none; }
body.game-active .game-page { display: grid; align-items: center; width: min(100% - 48px, 1040px); min-height: 100vh; padding: 0; }
body.game-active .game-shell { display: block; min-height: 0; }
body.game-active .game-hud { display: flex; }
body.game-active #game-time { font-size: clamp(2.3rem, 5vw, 4rem); }
body.game-active .game-playfield { display: grid; min-height: 0; padding: 34px 0 0; }
body.game-active .race-status { display: none; }
body.game-active .race-passage { max-height: 58vh; min-height: 0; overflow: hidden; }

.tier-page { max-width: 1120px; padding-top: 56px; }
.tier-page .page-heading { display: block; margin: 0 auto 52px; text-align: center; }
.tier-page .page-heading h1 { max-width: 920px; margin: 0 auto; font-size: clamp(3rem, 5vw, 4.5rem); line-height: 1.08; }
.tier-page .page-intro { max-width: 720px; margin: 20px auto 0; font-size: 1.18rem; }
.tier-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; align-items: stretch; }
.tier-card { display: flex; flex-direction: column; min-width: 0; padding: clamp(28px, 3.5vw, 44px); border: 1px solid var(--line-strong); border-radius: 20px; background: var(--surface); }
.tier-card.featured { background: var(--surface-2); }
.tier-summary { min-height: 245px; }
.tier-name { margin: 0 0 36px; color: var(--ink); font-size: 1.15rem; font-weight: 800; }
.tier-card h2 { font-size: clamp(2rem, 3.2vw, 2.6rem); line-height: 1.12; }
.tier-summary > p:last-child { margin: 22px 0 0; color: var(--muted); font-size: 1.08rem; line-height: 1.55; }
.tier-card .primary, .tier-card .secondary { width: 100%; min-height: 58px; border-radius: 999px; font-size: 1rem; }
.tier-card ul { margin: 34px 0 0; padding: 0; list-style: none; }
.tier-card li { position: relative; padding: 14px 0 14px 30px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 1.03rem; line-height: 1.5; }
.tier-card li::before { content: "✓"; position: absolute; left: 2px; color: var(--ink); font-weight: 800; }
.tier-card li:last-child { border-bottom: 0; }
.tier-card .guarantee { margin: 34px 0 0; padding: 20px 24px; border-color: var(--line-strong); }
.tier-card .guarantee summary { color: var(--ink); font-size: 1rem; font-weight: 750; cursor: pointer; }
.tier-card .guarantee p { margin: 18px 0 0; color: var(--muted); font-size: .9rem; line-height: 1.6; }
.tier-note { margin: 22px 0 0; font-size: .9rem; text-align: center; }

.profile-intro { display: flex; align-items: end; justify-content: space-between; gap: 36px; margin-bottom: 46px; }
.profile-page #profile-title { font-size: clamp(2rem, 4vw, 3.4rem); }
.dashboard-user-photo { display: block; width: 54px; height: 54px; margin-bottom: 18px; border-radius: 50%; object-fit: cover; }
.dashboard-account-email { margin: 12px 0 0; color: var(--muted); font-size: .82rem; }
.dashboard-account-actions { display: flex; gap: 16px; margin-top: 12px; }
.dashboard-account-actions button, .dashboard-nickname-form button { padding: 0; border: 0; background: transparent; color: var(--muted); font-size: .78rem; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.dashboard-account-actions button:hover, .dashboard-nickname-form button:hover { color: var(--ink); }
.dashboard-nickname-form { max-width: 360px; margin-top: 14px; }
.dashboard-nickname-form label { display: block; margin-bottom: 7px; color: var(--muted); font-size: .72rem; font-weight: 700; }
.dashboard-nickname-form > div { display: flex; align-items: center; gap: 12px; }
.dashboard-nickname-form input { width: min(100%, 210px); min-height: 40px; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--surface); color: var(--ink); }
.dashboard-nickname-form p { min-height: 17px; margin: 7px 0 0; color: var(--danger); font-size: .72rem; }
.analytics { margin-bottom: 58px; }
.cloud-sync-notice { margin: 0 0 24px; color: var(--muted); font-size: .8rem; line-height: 1.5; }
.data-settings-dialog { width: min(calc(100% - 32px), 440px); max-height: calc(100dvh - 32px); overflow-y: auto; }
.data-settings-dialog h2 { margin-right: 36px; font-size: 1.4rem; }
.data-settings-dialog .auth-gate-close { width: 44px; height: 44px; top: 7px; right: 7px; }
.data-settings-group { margin-top: 24px; border-top: 1px solid var(--line); }
.data-settings-group summary { min-height: 44px; padding: 14px 0; font-size: .85rem; font-weight: 650; cursor: pointer; }
.data-settings-actions { display: flex; flex-wrap: wrap; gap: 10px; padding: 4px 0 12px; }
.data-settings-actions button { min-height: 44px; padding: 10px 14px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--surface); color: var(--ink); font: inherit; font-size: .8rem; cursor: pointer; }
.data-settings-danger { margin-top: 12px; }
.data-settings-danger .data-settings-actions button { border-color: var(--danger); color: var(--danger); }
.data-settings-dialog .cloud-sync-notice { margin: 16px 0 0; }
.profile-baseline { display: flex; align-items: baseline; flex-wrap: wrap; gap: 12px; margin: -22px 0 48px; padding: 16px 0; border-bottom: 1px solid var(--line); color: var(--muted); font-size: .85rem; }
.profile-baseline strong { color: var(--ink); font-size: 1.5rem; }
.profile-baseline span:last-child { margin-left: 0; }
.analytics .metric-main { background: var(--ink); color: var(--on-dark); }
.analytics .metric-main span, .analytics .metric-main small { color: #bbb; }
.profile-layout { display: grid; grid-template-columns: minmax(0, 1fr); }
.section-title { display: flex; justify-content: space-between; align-items: center; padding-bottom: 15px; border-bottom: 1px solid var(--ink); }
.section-title h2 { font-size: 1rem; letter-spacing: -.01em; }
.section-title span { color: var(--faint); font-size: .72rem; }
.recent-runs { list-style: none; margin: 0; padding: 0; }
.recent-runs li { display: grid; grid-template-columns: 120px 95px 1fr; align-items: center; gap: 18px; padding: 20px 0; border-bottom: 1px solid var(--line); }
.recent-runs time, .recent-runs span { color: var(--muted); font-size: .78rem; }
.recent-runs strong { font-variant-numeric: tabular-nums; }
.empty-state { margin: 0; padding: 34px 0; color: var(--muted); line-height: 1.6; }

.brand { display: inline-flex; align-items: center; gap: 10px; }
.brand-logo { display: block; flex: none; width: 38px; height: 38px; object-fit: contain; }
.landing-header { justify-content: flex-start; }

.course-focus-page { width: min(100% - 40px, 1120px); padding-top: 36px; }
.course-journey { margin-bottom: 24px; padding: 20px 22px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--surface); }
.course-journey-top { display: flex; align-items: end; justify-content: space-between; gap: 24px; }
.course-journey-top > div { display: grid; gap: 4px; }
.course-journey-label, .course-picker-label { color: var(--faint); font-size: .68rem; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; }
.course-journey-top strong { font-size: 1.05rem; }
#course-completion { font-size: 1.35rem; font-variant-numeric: tabular-nums; letter-spacing: -.04em; }
.course-completion-track { height: 7px; margin: 16px 0 12px; overflow: hidden; border-radius: 999px; background: var(--surface-3); }
.course-completion-track i { display: block; width: 0; height: 100%; background: var(--ink); transition: width 180ms ease; }
.course-stages { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; color: var(--faint); font-size: .7rem; }
.course-stages span { min-width: 0; overflow-wrap: anywhere; text-align: center; }
.course-stages span:first-child { text-align: left; }
.course-stages span:last-child { text-align: right; }
.course-stages span.active, .course-stages span.complete { color: var(--ink); font-weight: 750; }
.course-picker { position: relative; z-index: 6; width: min(100%, 720px); margin: 0 auto 24px; }
.course-picker-label { display: block; margin-bottom: 8px; }
.course-picker-trigger { display: flex; align-items: center; justify-content: space-between; gap: 18px; width: 100%; min-height: 54px; padding: 12px 16px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); color: var(--ink); font-weight: 700; text-align: left; cursor: pointer; }
.course-picker-trigger[aria-expanded="true"] { border-color: var(--ink); border-radius: 10px 10px 0 0; }
.course-picker-menu { position: absolute; right: 0; left: 0; max-height: min(58vh, 520px); overflow-y: auto; border: 1px solid var(--ink); border-top: 0; border-radius: 0 0 10px 10px; background: var(--surface); }
.course-picker-menu button { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 20px; width: 100%; min-height: 52px; padding: 10px 15px; border: 0; border-bottom: 1px solid var(--line); background: var(--surface); color: var(--ink); text-align: left; cursor: pointer; }
.course-picker-menu button:last-child { border-bottom: 0; }
.course-picker-menu button:hover:not(:disabled), .course-picker-menu button[aria-selected="true"] { background: var(--surface-2); }
.course-picker-menu button:disabled { color: var(--faint); }
.course-picker-menu button strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.course-picker-menu button span { color: var(--faint); font-size: .7rem; white-space: nowrap; }
.course-workspace { padding: clamp(22px, 4vw, 42px); border: 1px solid var(--line-strong); border-radius: 14px; background: var(--surface); }
.course-workspace-top { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.course-modes { display: flex; gap: 4px; }
.course-mode { min-height: 44px; padding: 9px 15px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); font-weight: 750; cursor: pointer; }
.course-mode.active { border-color: var(--ink); color: var(--ink); }
.course-mode:disabled { opacity: .35; }
.course-timer { color: var(--ink); font-size: 1.35rem; font-variant-numeric: tabular-nums; font-weight: 800; letter-spacing: -.04em; }
.course-context { display: flex; align-items: end; justify-content: space-between; gap: 36px; padding: 30px 0 24px; }
.course-context h1 { font-size: clamp(2rem, 5vw, 4rem); }
.course-context #course-tip { max-width: 720px; margin: 16px 0 0; color: var(--muted); font-size: .9rem; line-height: 1.65; }
.course-rep-count { display: flex; align-items: baseline; gap: 7px; white-space: nowrap; }
.course-rep-count strong { font-size: clamp(2.4rem, 6vw, 4.8rem); font-variant-numeric: tabular-nums; letter-spacing: -.07em; }
.course-rep-count span { color: var(--faint); font-size: .72rem; }
.course-typing-surface { position: relative; min-height: 245px; padding: clamp(22px, 4vw, 36px); overflow: hidden; border: 1px solid var(--line-strong); border-radius: 9px; background: var(--surface); cursor: text; }
.course-typing-surface:focus-within, .course-typing-surface:focus { border-color: var(--ink); outline: 2px solid var(--ink); outline-offset: 3px; }
.course-inline-passage { color: #aaa; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: clamp(1.35rem, 3vw, 2rem); font-weight: 550; line-height: 1.75; letter-spacing: .015em; white-space: pre-wrap; }
.course-inline-passage .correct { color: var(--ink); }
.course-inline-passage .wrong { color: var(--danger); text-decoration: underline; text-decoration-thickness: 2px; }
.course-workspace-bottom { display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 68px; padding-top: 16px; }
.course-workspace-bottom p { margin: 0; color: var(--muted); font-size: .8rem; }
.finger-guidance { display: grid; grid-template-columns: 150px minmax(0, 1fr) 150px; align-items: end; gap: 24px; margin-top: 34px; }
.keyboard-guide-wrap { min-width: 0; }
.course-keyboard { display: grid; gap: 5px; width: min(100%, 780px); margin: 0 auto; }
.course-key-row { display: flex; gap: 5px; }
.course-key-row kbd { --finger-color: var(--line-strong); display: grid; flex: var(--key-wide) 1 0; place-items: center; min-width: 27px; min-height: 40px; border: 1px solid var(--line-strong); border-bottom: 3px solid var(--finger-color); border-radius: 5px; background: var(--surface); color: var(--ink); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .72rem; font-weight: 750; }
[data-finger-code="L-pinky"] { --finger-color: #8f2d2d; }
[data-finger-code="L-ring"] { --finger-color: #9b5c13; }
[data-finger-code="L-middle"] { --finger-color: #5f7317; }
[data-finger-code="L-index"] { --finger-color: #166a4b; }
[data-finger-code="L-thumb"], [data-finger-code="R-thumb"] { --finger-color: #4f5965; }
[data-finger-code="R-index"] { --finger-color: #176c7d; }
[data-finger-code="R-middle"] { --finger-color: #315ca8; }
[data-finger-code="R-ring"] { --finger-color: #6a43a2; }
[data-finger-code="R-pinky"] { --finger-color: #8b356b; }
.course-key-row kbd.target-key { border-color: #f04449; background: #f04449; color: #fff; }
.course-key-row kbd.pressed { transform: translateY(2px); }
.finger-instruction { min-height: 24px; margin: 18px 0 0; color: var(--ink); font-size: .85rem; font-weight: 750; text-align: center; }
.hand-guide { width: 150px; justify-self: center; }
.hand-illustration { display: block; width: 100%; height: auto; overflow: visible; }
.hand-left .hand-glove { fill: url(#glove-L); }
.hand-right .hand-glove { fill: url(#glove-R); }
.hand-illustration .hand-glove { stroke: #17191c; stroke-width: 3; stroke-linejoin: round; }
.hand-illustration .hand-finger { fill: #292b2f; stroke: #17191c; stroke-width: 2.2; stroke-linejoin: round; transition: fill 120ms ease, stroke 120ms ease, filter 120ms ease; }
.hand-illustration .hand-tip { fill: #e7e8e9; stroke: #c7c9cb; stroke-width: 1.2; pointer-events: none; transition: fill 120ms ease, stroke 120ms ease; }
.hand-illustration .hand-finger.active { fill: #f04449; stroke: #ff6b70; filter: drop-shadow(0 0 4px #ff6b70); }
.hand-illustration .hand-finger.active + .hand-tip { fill: #ffe4e5; stroke: #fff; }
.hand-illustration .hand-palm-detail { fill: none; stroke: #47494d; stroke-width: 2; stroke-linecap: round; }
.hand-illustration .hand-cuff { fill: #222427; stroke: #151719; stroke-width: 3; stroke-linejoin: round; }
.hand-illustration .hand-cuff-seam { fill: none; stroke: #aeb0b2; stroke-width: 2; stroke-linecap: round; }
@media (prefers-reduced-motion: reduce) { .hand-illustration .hand-finger, .hand-illustration .hand-tip { transition: none; } }

.profile-analytics { grid-template-columns: repeat(3, 1fr); }
.profile-analytics > div:nth-child(3) { border-right: 0; }
.profile-analytics > div:nth-child(-n+3) { border-bottom: 1px solid var(--line); }
.progress-chart-section { margin-bottom: 58px; }
.wpm-chart { display: block; width: 100%; height: auto; margin-top: 20px; border: 1px solid var(--line); background: var(--surface); }
.chart-grid { stroke: var(--line); stroke-width: 1; }
.chart-line { fill: none; stroke: var(--ink); stroke-width: 4; stroke-linejoin: round; stroke-linecap: round; }
.chart-dot { fill: var(--surface); stroke: var(--ink); stroke-width: 3; }
.wpm-chart text { fill: var(--muted); font-size: 13px; }

.training-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 32px; padding: 14px 0; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--line); }
.track-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.track-button { min-height: 44px; padding: 9px 14px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); color: var(--muted); cursor: pointer; }
.track-button.active { border-color: var(--ink); background: var(--ink); color: var(--on-dark); }
.practice-mode { display: flex; justify-content: space-between; gap: 18px; margin-bottom: 18px; color: var(--muted); font-size: .75rem; }

.guarantee { margin: 16px 0 28px; padding: 22px; border: 1px solid var(--ink); border-radius: 10px; background: var(--surface); }
.guarantee h3 { font-size: 1.25rem; }
.guarantee p:last-child { margin-bottom: 0; font-size: .8rem; }

.customer-service { position: fixed; z-index: 12; right: 24px; bottom: 24px; display: inline-flex; align-items: center; gap: 9px; min-height: 52px; padding: 10px 15px; border: 1px solid var(--ink); border-radius: 999px; background: var(--surface); color: var(--ink); font-size: .78rem; font-weight: 750; text-decoration: none; }
.customer-service-icon { width: 24px; height: 24px; fill: currentColor; }

.topic-dialog { position: fixed; z-index: 30; inset: 0; display: grid; place-items: center; padding: 24px; background: rgba(255,255,255,.96); }
.topic-card { width: min(100%, 620px); padding: clamp(30px, 6vw, 58px); border: 0; background: var(--surface); text-align: center; }
.topic-card h2 { margin: 0 auto; font-size: clamp(2rem, 6vw, 4rem); }
.topic-match { margin: 26px 0 0; color: var(--muted); font-size: .8rem; font-weight: 750; }
.countdown { position: fixed; z-index: 40; inset: 0; display: grid; place-items: center; background: var(--ink); color: #fff; font-size: clamp(7rem, 30vw, 18rem); font-weight: 900; line-height: 1; letter-spacing: -.08em; }

/* Ranked game keeps selection and ranking subordinate to the typing passage. */
.game-shell { grid-template-columns: minmax(0, 1fr) minmax(260px, 320px); place-items: stretch; gap: clamp(28px, 5vw, 72px); padding: 72px 0; }
.game-lobby { display: grid; align-content: center; gap: 18px; min-height: 430px; }
.game-setup { display: grid; gap: 18px; }
.game-setup-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.game-intro { display: block; text-align: left; }
.game-intro h1 { font-size: clamp(3rem, 6vw, 5.7rem); }
.game-mode-picker, .game-topic-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.game-mode-picker button, .game-topic-picker button, .game-leaderboard-head button { min-height: 44px; padding: 8px 12px; border: 1px solid var(--line-strong); border-radius: 7px; background: var(--surface); color: var(--muted); font-size: .78rem; font-weight: 750; cursor: pointer; }
.game-mode-picker button.active, .game-topic-picker button.active, .game-leaderboard-head button.active { border-color: var(--ink); background: var(--ink); color: var(--on-dark); }
.game-mode-picker span { display: block; margin-top: 2px; font-size: .64rem; font-weight: 600; opacity: .8; }
.game-lobby .primary { justify-self: start; min-width: 180px; }
.game-lobby-status { margin: 0; color: var(--muted); font-size: .77rem; }
.game-leaderboard { align-self: center; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--line); }
.game-leaderboard-head { padding: 16px 0; border-bottom: 1px solid var(--line); }
.game-leaderboard-head h2 { margin-bottom: 14px; font-size: 1rem; }
.game-leaderboard-head div { display: flex; gap: 5px; }
.game-leaderboard-head button { min-height: 34px; padding: 5px 8px; font-size: .66rem; }
.leaderboard-list { margin: 0; padding: 0; list-style: none; }
.leaderboard-list li { display: flex; justify-content: space-between; gap: 10px; padding: 14px 0; border-bottom: 1px solid var(--line); font-size: .78rem; }
.leaderboard-list li:last-child { border-bottom: 0; }
.leaderboard-list strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.leaderboard-list span { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.game-result { align-self: center; max-width: 700px; padding: 38px 0; }
.game-result h2 { margin: 8px 0 28px; font-size: clamp(2.3rem, 5vw, 4.2rem); }
.game-result-metrics { display: grid; grid-template-columns: repeat(3, 1fr); margin-bottom: 28px; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--line); }
.game-result-metrics > div { padding: 18px 14px; border-right: 1px solid var(--line); }
.game-result-metrics > div:last-child { border-right: 0; }
.game-result-metrics span { display: block; color: var(--muted); font-size: .68rem; }
.game-result-metrics strong { display: block; margin-top: 7px; font-size: clamp(1.6rem, 4vw, 2.4rem); font-variant-numeric: tabular-nums; letter-spacing: -.05em; }
body.game-active .game-shell { display: block; padding: 0; }
body.game-active .game-lobby, body.game-active .game-leaderboard, body.game-active .game-result { display: none; }
body.game-active .game-playfield { display: grid; }

@media (max-width: 820px) {
  .game-shell { grid-template-columns: 1fr; padding: 46px 0 76px; }
  .game-lobby { min-height: 0; }
  .game-leaderboard { max-width: none; }
}
@media (max-width: 560px) {
  .game-result-metrics { grid-template-columns: 1fr; }
  .game-result-metrics > div { border-right: 0; border-bottom: 1px solid var(--line); }
  .game-result-metrics > div:last-child { border-bottom: 0; }
}

@media (max-width: 820px) {
  .app-header { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px 14px; padding: 12px 20px 8px; }
  .header-actions { display: contents; }
  .app-header nav { grid-column: 1 / -1; grid-row: 2; width: 100%; overflow-x: auto; }
  .app-header nav a { flex: 1; min-width: max-content; text-align: center; }
  .account-identity { grid-column: 2; grid-row: 1; max-width: min(42vw, 190px); }
  main { width: min(100% - 36px, 1120px); padding: 52px 0 76px; }
  .landing-story, .speed-section, .benefits-section, .lifetime-section { padding: 90px 0; }
  .hero { grid-template-columns: 1fr; min-height: 0; }
  .typing-preview { max-width: 620px; }
  .section-heading { grid-template-columns: 1fr; gap: 10px; }
  .reason-grid { grid-template-columns: 1fr; }
  .reason-grid article, .reason-grid article + article { min-height: 0; padding: 26px 0; border-left: 0; }
  .reason-grid span { margin-bottom: 24px; }
  .simple-path { grid-template-columns: 1fr; padding: 34px; }
  .simple-path .text-link { grid-column: 1; }
  .page-heading, .profile-intro { align-items: flex-start; flex-direction: column; }
  .course-focus-page { width: min(100% - 32px, 1120px); padding-top: 28px; }
  .course-picker { width: 100%; }
  .course-workspace { padding: 24px; }
  .course-workspace-top, .course-context { align-items: flex-start; flex-direction: column; }
  .finger-guidance { grid-template-columns: 1fr; }
  .keyboard-guide-wrap { grid-row: 1; }
  .hand-guide { display: none; }
  .training-toolbar { align-items: stretch; flex-direction: column; }
  .tier-grid { grid-template-columns: 1fr; }
  .tier-summary { min-height: 0; margin-bottom: 30px; }
  .tier-card { min-height: 0; }
}
@media (max-width: 560px) {
  h1 { font-size: clamp(2.55rem, 15vw, 4rem); }
  .landing-hero { min-height: 0; padding: 64px 0 82px; }
  .landing-hero h1 { font-size: clamp(3rem, 15vw, 4.7rem); }
  .landing-highlight { padding-inline: .08em; }
  .landing-cta { width: 100%; }
  .landing-visual-keyboard { margin-top: 48px; padding: 16px 12px; border-radius: 12px; }
  .landing-visual-screen { min-height: 68px; margin-bottom: 14px; padding: 14px; gap: 5px; }
  .landing-visual-screen i { height: 11px; }
  .landing-visual-keys, .landing-visual-keys > div { gap: 4px; }
  .landing-visual-keys i { border-bottom-width: 3px; border-radius: 4px; }
  .landing-story-copy { grid-template-columns: 1fr; }
  .landing-story-copy p { min-height: 0; }
  .landing-story-copy p + p { border-top: 1px solid var(--line); border-left: 0; }
  .speed-comparison { grid-template-columns: 1fr; gap: 18px; }
  .speed-comparison > div { min-height: 250px; }
  .speed-arrow { transform: rotate(90deg); }
  .benefit-list { grid-template-columns: 1fr; }
  .benefit-list li, .benefit-list li:nth-child(odd) { border-right: 0; }
  .benefit-list li:last-child { grid-column: auto; }
  .landing-final-cta { padding: 48px 22px; }
  .app-header nav a { padding-inline: 10px; font-size: .76rem; }
  .account-identity { max-width: 130px; }
  .result-panel, .analytics { grid-template-columns: repeat(2, 1fr); }
  .profile-analytics > div { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
  .profile-analytics > div:nth-child(even) { border-right: 0; }
  .profile-analytics > div:nth-last-child(-n+2) { border-bottom: 0; }
  .result-panel > div:nth-child(2), .analytics > div:nth-child(2) { border-right: 0; }
  .result-panel > div:nth-child(-n+2), .analytics > div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .game-page { width: min(100% - 36px, 1120px); padding: 0; }
  .game-intro { gap: 22px; }
  .game-intro h1 { font-size: clamp(3rem, 15vw, 4.8rem); }
  .game-intro .primary { width: auto; min-height: 52px; }
  .game-hud { min-height: 58px; }
  .game-playfield { min-height: 350px; padding-block: 36px; }
  .race-passage { min-height: 180px; font-size: clamp(1.3rem, 6vw, 1.75rem); line-height: 1.7; }
  body.game-active .game-page { width: min(100% - 36px, 1040px); align-items: start; padding-top: max(72px, 12vh); }
  body.game-active .game-playfield { padding-top: 24px; }
  body.game-active .race-passage { max-height: 65vh; }
  .course-workspace { padding: 20px 16px; }
  .course-workspace-top { gap: 18px; }
  .course-modes { width: 100%; }
  .course-mode { flex: 1; }
  .course-context { gap: 14px; padding: 24px 0 18px; }
  .course-typing-surface { min-height: 210px; padding: 20px 16px; }
  .course-inline-passage { font-size: 1.2rem; line-height: 1.65; }
  .course-workspace-bottom { align-items: stretch; flex-direction: column; padding-top: 18px; }
  .course-workspace-bottom .secondary { width: 100%; }
  .course-key-row { gap: 3px; }
  .course-key-row kbd { min-width: 20px; min-height: 34px; font-size: .62rem; }
  .customer-service { right: 14px; bottom: 14px; width: 52px; padding: 10px; }
  .customer-service span { display: none; }
  .topic-card { padding: 30px 22px; }
  .recent-runs li { grid-template-columns: 1fr auto; gap: 5px 12px; }
  .recent-runs span { grid-column: 1 / -1; }
  .site-footer { width: min(100% - 36px, 1120px); }
  .site-footer span:last-child { display: none; }
}

.course-player-page { width: 100%; max-width: none; margin: 0; padding: 0; }
.course-player-layout { display: grid; grid-template-columns: minmax(0, 1fr) 390px; min-height: calc(100vh - 68px); }
.course-player-main { min-width: 0; overflow: hidden; }
.course-player-bar { display: flex; align-items: center; justify-content: space-between; gap: 24px; min-height: 56px; padding: 0 clamp(24px, 4vw, 56px); border-bottom: 1px solid var(--line); }
.course-player-bar > strong { min-width: 0; overflow: hidden; font-size: .82rem; text-overflow: ellipsis; white-space: nowrap; }
.course-player-bar-end { display: flex; align-items: center; gap: 16px; color: var(--muted); font-size: .72rem; white-space: nowrap; }
.finger-map-toggle { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 0; border: 1px solid var(--line-strong); border-radius: 7px; background: var(--surface); color: var(--ink); cursor: pointer; }
.finger-map-toggle:hover,.finger-map-toggle:focus-visible { background: var(--surface-2); border-color: var(--ink); }
.course-workspace-controls { display: flex; align-items: center; gap: 12px; }
.course-exit { min-height: 44px; padding: 8px 12px; border: 1px solid var(--line-strong); border-radius: 7px; background: var(--surface); color: var(--ink); font-size: .76rem; font-weight: 750; cursor: pointer; }
.course-player-bar-end > span > strong { color: var(--ink); font-size: .82rem; }
.course-curriculum-toggle { display: none; min-height: 40px; padding: 8px 13px; border: 1px solid var(--ink); border-radius: 7px; background: var(--surface); color: var(--ink); font-weight: 750; cursor: pointer; }
.course-player-page .course-workspace { min-height: calc(100vh - 124px); padding: clamp(32px, 4vw, 54px) clamp(28px, 5vw, 72px) 40px; border: 0; border-radius: 0; }
.course-player-page .course-workspace-top { padding-bottom: 18px; }
.course-player-page .course-context { padding: 38px 0 30px; }
.course-player-page .course-context > div { max-width: 900px; }
.course-player-page .course-context h1 { max-width: 900px; font-size: clamp(2.25rem, 4.2vw, 4.4rem); line-height: 1.05; overflow-wrap: anywhere; }
.course-player-page .course-context #course-tip { max-width: 780px; }
.course-player-page .course-typing-surface { min-height: 300px; padding: clamp(28px, 5vw, 56px); }
.course-player-page .course-inline-passage { font-size: clamp(1.55rem, 3vw, 2.45rem); line-height: 1.7; }
.course-player-page .finger-guidance { margin-top: 42px; }
.course-player-page .course-workspace-bottom { min-height: 58px; }
.course-curriculum { position: sticky; top: 68px; height: calc(100vh - 68px); min-width: 0; overflow-y: auto; border-left: 1px solid var(--line); background: var(--surface); }
.course-curriculum-head { position: sticky; z-index: 2; top: 0; display: flex; align-items: center; justify-content: space-between; min-height: 56px; padding: 0 20px; border-bottom: 1px solid var(--line); background: var(--surface); }
.course-curriculum-head h2 { font-size: .95rem; letter-spacing: -.02em; }
.course-curriculum-close { display: none; width: 40px; height: 40px; border: 0; background: transparent; color: var(--ink); font-size: 1.4rem; cursor: pointer; }
.course-curriculum .course-journey { margin: 0; padding: 20px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; }
.course-curriculum .course-journey-top strong { font-size: .85rem; }
.course-curriculum #course-completion { font-size: 1.15rem; }
.course-curriculum .course-stages { font-size: .58rem; }
.course-progress-caption { margin: 0 0 13px; color: var(--muted); font-size: .69rem; }
.course-curriculum-stage { border-bottom: 1px solid var(--line); }
.course-curriculum-stage.current .course-curriculum-stage-button { border-left: 3px solid var(--ink); padding-left: 17px; }
.course-curriculum-stage.reading-stage .course-curriculum-stage-button { min-height: 86px; }
.course-stage-row { display: flex; align-items: stretch; min-width: 0; }
.course-curriculum-stage-button { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-width: 0; flex: 1; min-height: 76px; padding: 16px 20px; border: 0; background: var(--surface); color: var(--ink); text-align: left; cursor: pointer; }

.course-curriculum-stage-button:hover { background: var(--surface-2); }
.course-curriculum-stage-button strong { display: block; font-size: .84rem; }
.course-curriculum-stage-button small { display: block; margin-top: 6px; color: var(--faint); font-size: .67rem; font-weight: 500; }
.course-curriculum-lessons { display: grid; }
.course-curriculum-lesson { display: grid; gap: 6px; width: 100%; min-height: 68px; padding: 14px 20px 14px 44px; border: 0; border-top: 1px solid #ededed; background: var(--surface); color: var(--ink); text-align: left; cursor: pointer; }
.course-curriculum-lesson:hover:not(:disabled) { background: var(--surface-2); }
.course-curriculum-lesson.current { background: #e9e9e9; }
.course-curriculum-lesson:disabled { color: var(--faint); cursor: not-allowed; }
.course-curriculum-lesson strong { font-size: .78rem; line-height: 1.4; }
.course-curriculum-lesson span { color: var(--faint); font-size: .66rem; }
.course-stage-guide { min-height: 54px; padding: 12px 20px 12px 44px; border: 0; border-top: 1px solid var(--line); background: var(--surface-2); color: var(--ink); font-size: .78rem; font-weight: 750; text-align: left; cursor: pointer; }
.course-stage-guide:hover { background: var(--surface-3); }
.course-picker-fallback { display: none; }
.course-curriculum-backdrop { display: none; }
.course-reading { display: flex; flex-direction: column; max-width: 860px; min-height: min(780px, calc(100vh - 124px)); padding: clamp(36px, 5vw, 72px) clamp(28px, 5vw, 72px) 52px; }
.course-reading h1 { font-size: clamp(2.5rem, 4.7vw, 4.5rem); line-height: 1.05; }
.course-reading-progress { margin: 0 0 13px; color: var(--muted); font-size: .72rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.course-reading-track { height: 5px; margin: 0 0 clamp(36px, 6vw, 68px); overflow: hidden; border-radius: 999px; background: var(--surface-3); }
.course-reading-track i { display: block; height: 100%; background: var(--ink); transition: width .2s ease; }
.course-reading-lead { max-width: 690px; margin: 22px 0 30px; color: var(--muted); font-size: clamp(1rem, 1.8vw, 1.2rem); line-height: 1.65; }
.course-step-content { margin-bottom: 30px; }
.course-map-status { margin: 14px 0; color: var(--muted); font-size: .85rem; }
.course-step-actions { display: flex; justify-content: space-between; gap: 12px; margin-top: auto; padding-top: 24px; border-top: 1px solid var(--line); }
.course-step-actions > :last-child { margin-left: auto; }
.course-practice-target { padding: 22px; border: 1px solid var(--line-strong); border-radius: 10px; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: clamp(1.15rem, 2.5vw, 1.6rem); line-height: 1.65; overflow-wrap: anywhere; }
.course-practice-label { display: block; margin: 18px 0 8px; font-size: .78rem; font-weight: 750; }
#course-practice-input { display: block; width: 100%; min-height: 100px; padding: 15px; resize: vertical; border: 1px solid var(--line-strong); border-radius: 9px; background: var(--surface); color: var(--ink); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 1.12rem; line-height: 1.5; }
.course-practice-feedback, .course-practice-result { margin: 12px 0 0; color: var(--muted); font-size: .86rem; line-height: 1.5; }
.course-choice-list { display: grid; gap: 10px; max-width: 620px; }
.course-choice { min-height: 52px; padding: 13px 18px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--ink); text-align: left; font: inherit; cursor: pointer; }
.course-choice:hover, .course-choice:focus-visible { border-color: var(--ink); }
.course-choice[aria-pressed="true"] { border-color: var(--ink); background: var(--surface-2); font-weight: 800; }
.course-baseline-clock { display: block; margin-bottom: 16px; font-size: 1.65rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.course-reading.baseline-step { padding-top: 20px; padding-bottom: 20px; min-height: 0; }
.baseline-step .course-reading-track { margin-bottom: 18px; }
.baseline-step h1 { font-size: clamp(2rem, 3.5vw, 3.2rem); }
.baseline-step .course-reading-lead { margin: 10px 0 16px; }
.baseline-step .course-step-content { margin-bottom: 8px; }
.baseline-step .course-step-actions { padding-top: 12px; }
.baseline-step .course-baseline-clock { margin-bottom: 8px; }
.course-baseline-passage { max-height: 190px; min-height: 125px; overflow: auto; padding: 16px 22px; border: 1px solid var(--line-strong); border-radius: 9px; color: #999; font: 550 clamp(1.25rem,2.8vw,1.85rem)/1.65 ui-monospace,SFMono-Regular,Consolas,monospace; cursor: text; }
.baseline-step .course-baseline-passage { max-height: 155px; min-height: 110px; }
.course-reading.baseline-step { width: 100%; max-width: none; min-height: 0; padding-inline: clamp(24px, 5vw, 80px); }
.baseline-step .course-reading-lead { max-width: 920px; }
.baseline-step .course-step-content { width: 100%; }
.baseline-step .course-baseline-passage { box-sizing: border-box; width: 100%; min-height: 0; max-height: none; overflow: hidden; padding: 12px 20px; font-size: clamp(1.25rem, 1.9vw, 1.7rem); line-height: 1.45; }
.baseline-step .course-reading-track { margin-bottom: 8px; }
.baseline-step .course-reading-lead { margin: 6px 0 10px; line-height: 1.35; }
.baseline-step .course-baseline-clock { margin-bottom: 2px; }
.baseline-step .course-baseline-passage { padding-block: 6px; font-size: clamp(1.15rem, 1.6vw, 1.5rem); line-height: 1.3; }
.baseline-step .course-step-actions { padding-top: 5px; }
#course-practice-input.course-input-proxy { opacity: 0; position: fixed; left: -100vw; width: 1px; height: 1px; min-height: 0; }
.course-check-passage { box-sizing: border-box; min-height: 0; max-height: none; overflow: hidden; }
.goal-name-form { display: grid; gap: 10px; width: 100%; max-width: 520px; }
.goal-name-form .goal-custom-label { margin: 0; }
.course-baseline-passage:focus { outline: 2px solid var(--ink); outline-offset: 3px; }
.course-baseline-passage .correct { color: var(--ink); }
.course-baseline-passage .wrong { color: var(--danger); text-decoration: underline; }
#course-baseline-input { opacity: 0; position: fixed; left: -100vw; width: 1px; height: 1px; }
.finger-map { width: min(940px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); padding: clamp(16px, 3vw, 28px); overflow-y: auto; border: 1px solid var(--line-strong); border-radius: 14px; background: var(--surface); color: var(--ink); }
.finger-map::backdrop { background: rgba(0,0,0,.6); }
.finger-map-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.finger-map-head h2 { font-size: clamp(1.6rem, 4vw, 2.4rem); }
.finger-map-head button { flex: none; min-width: 44px; min-height: 44px; border: 0; background: var(--surface-2); color: var(--ink); font-size: 1.5rem; cursor: pointer; }
.finger-map > p { color: var(--muted); font-size: .87rem; line-height: 1.6; }
.finger-map-keyboard { overflow-x: auto; margin-top: 18px; }
.finger-map-keyboard .course-keyboard { width: 100%; min-width: 590px; }
.finger-map-keyboard .course-key-row kbd { background: var(--finger-color); color: #fff; border-color: var(--finger-color); border-bottom-color: var(--finger-color); transform: none; }
.finger-map-keyboard .course-key-row kbd[data-finger-code="L-pinky"] { --finger-color: #8f2d2d; }
.finger-map-keyboard .course-key-row kbd[data-finger-code="L-ring"] { --finger-color: #9b5c13; }
.finger-map-keyboard .course-key-row kbd[data-finger-code="L-middle"] { --finger-color: #5f7317; }
.finger-map-keyboard .course-key-row kbd[data-finger-code="L-index"] { --finger-color: #166a4b; }
.finger-map-keyboard .course-key-row kbd[data-finger-code="R-index"] { --finger-color: #176c7d; }
.finger-map-keyboard .course-key-row kbd[data-finger-code="R-middle"] { --finger-color: #315ca8; }
.finger-map-keyboard .course-key-row kbd[data-finger-code="R-ring"] { --finger-color: #6a43a2; }
.finger-map-keyboard .course-key-row kbd[data-finger-code="R-pinky"] { --finger-color: #8b356b; }
.finger-map-keyboard .course-key-row kbd[data-finger-code="R-thumb"] { --finger-color: #4f5965; }
.finger-map-keyboard .course-key-row kbd:not([data-finger-code]) { background: var(--surface-2); border-color: var(--line-strong); color: var(--ink); }
.finger-map-keyboard .course-key-row kbd.space-key { background: #4f5965; }
.finger-map-keyboard .course-key-row kbd.home-key { outline: 2px solid var(--ink); outline-offset: 2px; }
.finger-map-hands { display: flex; justify-content: center; align-items: center; gap: clamp(30px, 12vw, 160px); margin: 16px 0 0; }
.finger-map-hands .hand-guide { display: block; width: clamp(105px, 17vw, 165px); }
.finger-map-hands .hand-finger { stroke: var(--finger-color); fill: var(--finger-color); stroke-width: 1; }
.finger-map-hands .hand-finger[data-finger-code="L-pinky"] { --finger-color: #8f2d2d; }
.finger-map-hands .hand-finger[data-finger-code="L-ring"] { --finger-color: #9b5c13; }
.finger-map-hands .hand-finger[data-finger-code="L-middle"] { --finger-color: #5f7317; }
.finger-map-hands .hand-finger[data-finger-code="L-index"] { --finger-color: #166a4b; }
.finger-map-hands .hand-finger[data-finger-code="L-thumb"] { --finger-color: #4f5965; }
.finger-map-hands .hand-finger[data-finger-code="R-thumb"] { --finger-color: #4f5965; }
.finger-map-hands .hand-finger[data-finger-code="R-index"] { --finger-color: #176c7d; }
.finger-map-hands .hand-finger[data-finger-code="R-middle"] { --finger-color: #315ca8; }
.finger-map-hands .hand-finger[data-finger-code="R-ring"] { --finger-color: #6a43a2; }
.finger-map-hands .hand-finger[data-finger-code="R-pinky"] { --finger-color: #8b356b; }
.finger-map-hands .hand-tip { opacity: .12; }
.course-reading-goal { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding: 22px 0; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--line); }
.course-reading-goal span { color: var(--muted); font-size: .7rem; font-weight: 800; letter-spacing: .09em; }
.course-reading-goal strong { font-size: clamp(1.4rem, 3vw, 2.2rem); letter-spacing: -.04em; }
.course-reading-sections { margin: 12px 0 30px; }
.course-reading-sections section { padding: 24px 0; border-bottom: 1px solid var(--line); }
.course-reading-sections h2 { font-size: 1.14rem; line-height: 1.3; letter-spacing: -.02em; }
.course-reading-sections p { max-width: 680px; margin: 12px 0 0; color: var(--muted); font-size: .91rem; line-height: 1.7; }

/* Course guides are compact work surfaces, not full-height articles. */
.course-player-page .course-reading {
  width: min(100%, 1050px);
  max-width: none;
  min-height: 0;
  margin-inline: auto;
  padding: clamp(38px, 7vh, 70px) clamp(24px, 4vw, 56px) 40px;
}
.course-reading .course-reading-track { margin-bottom: clamp(22px, 4vh, 40px); }
.course-reading .course-reading-lead { max-width: 740px; margin: 16px 0 24px; }
.course-reading .course-step-content { margin-bottom: 0; }
.course-reading .course-step-actions { margin-top: 26px; padding-top: 18px; }
.course-player-page .course-reading.baseline-step {
  width: min(100%, 1140px);
  max-width: none;
  min-height: 0;
  padding: clamp(22px, 4vh, 36px) clamp(24px, 4vw, 56px) 28px;
}
.baseline-step .course-reading-track { margin-bottom: 14px; }
.baseline-step h1 { font-size: clamp(2rem, 3vw, 2.8rem); }
.baseline-step .course-reading-lead { max-width: 760px; margin: 9px 0 14px; line-height: 1.4; }
.baseline-step .course-baseline-clock { margin: 0 0 4px; font-size: 1.45rem; }
.baseline-step .course-baseline-passage {
  width: 100%;
  padding: 12px 18px 0;
  overflow: hidden;
  border-color: var(--line-strong);
  font-size: clamp(1.16rem, 1.7vw, 1.45rem);
  line-height: 1.38;
}
.course-baseline-passage { white-space: normal; }
.course-baseline-passage span { white-space: pre-wrap; }
.baseline-step .course-step-actions { margin-top: 15px; padding-top: 12px; }

@media (max-width: 560px) {
  .course-player-page .course-reading, .course-player-page .course-reading.baseline-step { padding-inline: 20px; }
  .course-reading .course-reading-track { margin-bottom: 20px; }
  .course-reading .course-step-actions { margin-top: 22px; }
  .baseline-step .course-baseline-passage { font-size: 1.15rem; }
}

@media (max-width: 1320px) {
  .course-player-layout { grid-template-columns: 1fr; }
  .course-curriculum-toggle { display: inline-flex; align-items: center; justify-content: center; }
  .course-curriculum-backdrop:not([hidden]) { position: fixed; z-index: 29; inset: 0; display: block; width: 100%; border: 0; background: rgba(0,0,0,.55); cursor: pointer; }
  .course-curriculum { position: fixed; z-index: 30; top: 0; right: 0; bottom: 0; width: min(430px, 100vw); height: 100dvh; max-height: 100vh; transform: translateX(100%); transition: transform 180ms ease; }
  .course-curriculum.open { transform: translateX(0); }
  .course-curriculum-close { display: block; }
  .course-player-page .course-workspace { min-height: calc(100vh - 124px); }
}

@media (max-width: 820px) {
  .course-curriculum { width: 100vw; }
}

@media (max-width: 560px) {
  .course-player-bar { padding: 0 18px; }
  .course-player-bar-end > span { display: none; }
  .course-player-page .course-workspace { padding: 24px 18px 30px; }
  .course-player-page .course-context { padding: 28px 0 20px; }
  .course-player-page .course-context h1 { font-size: clamp(2rem, 9vw, 3rem); }
  .course-player-page .course-context #course-tip { margin-top: 12px; font-size: .8rem; }
  .course-player-page .course-typing-surface { min-height: 230px; padding: 24px 18px; }
  .course-player-page .course-inline-passage { font-size: 1.25rem; }
  .course-player-page .finger-guidance { margin-top: 28px; }
  .course-curriculum { width: 100vw; }
  .course-reading { padding: 36px 22px 56px; }
  .course-reading-goal { align-items: flex-start; flex-direction: column; gap: 6px; }
  .finger-map-toggle { padding-inline: 10px; }
  .finger-map-toggle span { display: none; }
  .course-step-actions { flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) { .course-curriculum, .course-reading-track i { transition: none; } }

@media (max-width: 900px) {
  .course-player-page .finger-guidance { grid-template-columns: 110px minmax(0, 1fr) 110px; gap: 12px; }
  .course-player-page .hand-guide { display: block; width: 110px; }
  .course-player-page .keyboard-guide-wrap { grid-row: auto; }
}

@media (max-width: 640px) {
  .course-player-page .finger-guidance { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .course-player-page .keyboard-guide-wrap { grid-column: 1 / -1; grid-row: 1; }
  .course-player-page .hand-left { grid-column: 1; grid-row: 2; }
  .course-player-page .hand-right { grid-column: 2; grid-row: 2; }
  .course-player-page .hand-guide { width: 96px; }
}

/* An active drill is a single-screen workspace; keep the passage and both hands visible. */
body.course-active .app-header,
body.course-active .course-player-bar,
body.course-active .site-footer { display: none; }
body.course-active .course-player-layout { display: block; min-height: 100dvh; }
body.course-active .course-curriculum,
body.course-active .course-curriculum-backdrop { display: none !important; }
body.course-active .course-player-page .course-workspace {
  display: flex; flex-direction: column; justify-content: space-between;
  min-height: 100dvh; padding: 12px clamp(18px, 3vw, 48px);
}
body.course-active .course-player-page .course-workspace-top { padding-bottom: 5px; }
body.course-active .course-player-page .course-context { padding: 4px 0; }
body.course-active .course-player-page .course-context h1 { font-size: clamp(1.5rem, 2.5vw, 2.5rem); }
body.course-active .course-player-page .course-typing-surface { min-height: 130px; max-height: 28dvh; overflow: auto; padding: 16px 22px; }
body.course-active .course-player-page .course-inline-passage { font-size: clamp(1.25rem, 2vw, 1.85rem); line-height: 1.5; }
body.course-active .course-player-page .finger-guidance { margin-top: 5px; }
body.course-active .course-player-page .hand-guide { width: min(100%, 120px); }
body.course-active .course-player-page .course-key-row kbd { min-height: clamp(24px, 4.2dvh, 36px); }
body.course-active .course-player-page .course-workspace-bottom { min-height: 28px; padding-top: 4px; }
@media (max-width: 640px) {
  .finger-map-hands { gap: 12px; }
  .finger-map-hands .hand-guide { width: 105px; }
  .finger-map-keyboard .course-keyboard { min-width: 0; gap: 3px; }
  .finger-map-keyboard .course-key-row { gap: 2px; }
  .finger-map-keyboard .course-key-row kbd { min-width: 0; min-height: 27px; font-size: .51rem; }
  body.course-active .course-player-page .course-workspace { padding: 8px 16px; }
  body.course-active .course-player-page .course-workspace-top { flex-direction: row; align-items: center; gap: 8px; }
  body.course-active .course-player-page .course-context h1 { font-size: 1.45rem; }
  body.course-active .course-player-page .course-typing-surface { min-height: 100px; padding: 12px; }
  body.course-active .course-player-page .finger-guidance { grid-template-columns: repeat(2, minmax(0,1fr)); }
  body.course-active .course-player-page .hand-guide { width: 80px; }
  body.course-active .course-player-page .course-key-row kbd { min-width: 20px; min-height: 26px; }
  body.course-active .course-player-page .finger-instruction { margin-top: 4px; }
  body.course-active .course-modes { width: auto; }
  body.course-active .course-mode { padding-inline: 8px; }
  body.course-active .course-workspace-controls { gap: 5px; }
  body.course-active .course-timer { font-size: 1rem; }
  body.course-active .course-exit { font-size: .68rem; }
}
