:root {
  --ink: #10243d;
  --ink-2: #173454;
  --paper: #f4f7fb;
  --white: #ffffff;
  --blue: #626970;
  --blue-soft: #eef0f2;
  --gold: #f2b33d;
  --green: #22a06b;
  --red: #df4b4b;
  --muted: #64748b;
  --line: #dce4ee;
  --shadow: 0 14px 40px rgba(16,36,61,.09);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--paper); }
body { margin: 0; min-height: 100vh; color: var(--ink); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; background: var(--paper); }
button, input { font: inherit; }
button { color: inherit; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 270px minmax(0,1fr); }

.sidebar { position: fixed; inset: 0 auto 0 0; width: 270px; display: flex; flex-direction: column; padding: 28px 18px 20px; color: #fff; background: radial-gradient(circle at 0 100%, #59616b 0, transparent 40%), linear-gradient(165deg, #3b4148 0%, #252a30 75%); overflow-y: auto; z-index: 10; }
.brand { display: flex; align-items: center; padding: 1px 10px 31px; }
.brand strong { display: block; font: 750 23px/1.1 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; letter-spacing: .01em; }
.brand small { display: block; margin-top: 4px; font-size: 12px; font-weight: 650; letter-spacing: .08em; opacity: .72; }
nav { display: grid; gap: 5px; }
.nav-item { width: 100%; border: 0; border-radius: 10px; padding: 12px; display: flex; gap: 12px; align-items: center; text-align: left; background: transparent; color: #d6d8db; cursor: pointer; }
.editor-link { text-decoration: none; }
.nav-item[hidden] { display: none; }
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: rgba(255,255,255,.11); color: #fff; font-weight: 700; }
.nav-icon { width: 22px; text-align: center; font-size: 18px; }
.lesson-nav { margin-top: 26px; }
.eyebrow { margin: 0 0 9px; color: #aeb3b8; font-size: 11px; font-weight: 800; letter-spacing: .15em; }
.lesson-nav > .eyebrow { padding: 0 12px; }
.stage-heading { margin: 18px 12px 5px; color: #92989e; font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.stage-heading:first-child { margin-top: 5px; }
.lesson-button { position: relative; width: 100%; display: grid; grid-template-columns: 30px 1fr 17px; gap: 9px; align-items: center; border: 0; border-radius: 9px; padding: 9px 11px; color: #bcc1c6; background: transparent; text-align: left; cursor: pointer; }
.lesson-button:hover { color: #fff; background: rgba(255,255,255,.05); }
.lesson-button.active { color: #fff; background: rgba(255,255,255,.14); }
.lesson-number { display: grid; place-items: center; width: 27px; height: 27px; border: 1px solid rgba(255,255,255,.16); border-radius: 50%; font-size: 12px; font-weight: 800; }
.lesson-button.active .lesson-number { color: #fff; background: #8d1a7c; border-color: #8d1a7c; }
.lesson-button.done .lesson-number { color: #fff; background: var(--green); border-color: var(--green); }
.lesson-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.lesson-check { color: #6ee7b7; font-weight: 900; }
.sidebar-progress { margin-top: auto; padding: 18px 12px 2px; border-top: 1px solid rgba(255,255,255,.09); }
.sidebar-progress > div:first-child { display: flex; justify-content: space-between; font-size: 12px; }
.sidebar-progress small { color: #a7adb3; font-size: 11px; }
.progress-track { height: 6px; margin: 10px 0 9px; border-radius: 10px; background: rgba(255,255,255,.1); overflow: hidden; }
.progress-track span { display: block; width: 0; height: 100%; background: var(--gold); border-radius: inherit; transition: width .3s; }

main { grid-column: 2; min-width: 0; }
.topbar { height: 103px; padding: 22px clamp(24px,4vw,62px); display: flex; align-items: center; gap: 14px; justify-content: space-between; background: rgba(255,255,255,.92); border-bottom: 1px solid var(--line); backdrop-filter: blur(12px); }
.topbar .eyebrow { color: var(--blue); margin-bottom: 4px; }
h1 { margin: 0; font: 750 clamp(23px,2.4vw,32px)/1.15 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
.top-actions { display: flex; align-items: center; gap: 18px; }
.streak { display: grid; grid-template-columns: auto auto; grid-template-rows: auto auto; column-gap: 7px; align-items: center; min-width: 72px; }
.streak > span { grid-row: 1 / 3; color: var(--gold); font-size: 22px; }
.streak strong { font-size: 17px; line-height: 1; }
.streak small { color: var(--muted); font-size: 10px; text-transform: uppercase; }
.icon-button { width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer; font-size: 20px; }
.icon-button:hover { border-color: var(--blue); color: var(--blue); }
.menu-button { display: none; }
.workspace { width: min(1050px, calc(100% - 48px)); margin: 0 auto; padding: 30px 0 50px; }
.lesson-intro { display: flex; justify-content: space-between; align-items: start; gap: 25px; margin-bottom: 20px; }
.lesson-intro p { margin: 7px 0 0; color: var(--muted); font-size: 14px; }
.lesson-goals { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 11px; }
.lesson-goals span { padding: 5px 8px; color: #52677e; background: #fff; border: 1px solid var(--line); border-radius: 6px; font-size: 11px; font-weight: 700; }
.lesson-chip { display: inline-flex; padding: 5px 9px; border-radius: 5px; color: var(--blue); background: var(--blue-soft); font-size: 10px; font-weight: 850; letter-spacing: .1em; }
.sound-toggle { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; cursor: pointer; white-space: nowrap; }
.sound-toggle input { position: absolute; opacity: 0; }
.sound-toggle span { position: relative; width: 36px; height: 20px; border-radius: 20px; background: #cbd5e1; transition: .2s; }
.sound-toggle span::after { content: ""; position: absolute; width: 14px; height: 14px; left: 3px; top: 3px; border-radius: 50%; background: #fff; transition: .2s; }
.sound-toggle input:checked + span { background: var(--blue); }
.sound-toggle input:checked + span::after { transform: translateX(16px); }
.stats-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 12px; margin-bottom: 16px; }
.stats-grid article { min-height: 74px; padding: 14px 16px; display: flex; align-items: center; gap: 12px; background: #fff; border: 1px solid var(--line); border-radius: 11px; }
.stats-grid strong { display: block; font-size: 21px; }
.stats-grid small { color: var(--muted); font-size: 11px; }
.stat-icon { display: grid; place-items: center; width: 34px; height: 34px; flex: 0 0 auto; border-radius: 9px; font-weight: 800; }
.stat-icon.speed { color: var(--blue); background: var(--blue-soft); }
.stat-icon.accuracy { color: var(--green); background: #e8f8f1; }
.stat-icon.time { color: #8659d3; background: #f1eafd; }
.stat-icon.errors { color: var(--red); background: #fff0f0; }
.typing-card { position: relative; min-height: 245px; padding: 0 32px 26px; background: #fff; border: 2px solid transparent; border-radius: 16px; box-shadow: var(--shadow); outline: none; cursor: text; overflow: hidden; transition: border-color .2s, box-shadow .2s; }
.typing-card:focus { border-color: rgba(98,105,112,.55); box-shadow: 0 16px 45px rgba(98,105,112,.13); }
.typing-toolbar { height: 51px; display: flex; align-items: center; justify-content: space-between; color: var(--muted); border-bottom: 1px solid #edf1f6; font-size: 12px; }
.typing-toolbar > span:first-child { display: flex; align-items: center; gap: 7px; }
.status-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px rgba(34,160,107,.12); }
.typing-card.running .status-dot { background: var(--blue); box-shadow: 0 0 0 4px rgba(98,105,112,.12); }
.text-window { padding: 32px 0 20px; font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; font-size: clamp(20px,2.15vw,27px); line-height: 1.85; letter-spacing: .02em; user-select: none; }
.char { color: #b0bac7; border-radius: 3px; }
.char.correct { color: #152b43; }
.char.current { color: var(--ink); background: #fff0c7; box-shadow: 0 2px 0 var(--gold); }
.char.current.error { color: #fff; background: var(--red); box-shadow: 0 2px 0 #b53131; }
.typing-prompt { display: none; position: absolute; inset: 51px 0 7px; align-items: center; justify-content: center; color: var(--blue); background: rgba(255,255,255,.9); font-size: 14px; font-weight: 750; backdrop-filter: blur(2px); }
.typing-card:not(:focus):not(.running):hover .typing-prompt { display: flex; }
.card-progress { position: absolute; height: 5px; inset: auto 0 0; background: #e9eef5; }
.card-progress span { display: block; width: 0; height: 100%; background: linear-gradient(90deg,var(--blue),#8b9197); transition: width .15s; }
.finger-callout { width: fit-content; margin: 14px auto 18px; padding: 9px 14px; display: flex; align-items: center; gap: 8px; color: #53657a; background: #fff; border: 1px solid var(--line); border-radius: 30px; font-size: 12px; }
.finger-dot { width: 9px; height: 9px; border-radius: 50%; }
.divider { height: 16px; border-left: 1px solid var(--line); }
.keyboard-section { padding: 18px 22px 15px; background: rgba(255,255,255,.62); border: 1px solid var(--line); border-radius: 16px; }
.keyboard { max-width: 790px; margin: 0 auto; display: grid; gap: 7px; }
.key-row { display: flex; gap: 7px; justify-content: center; }
.key { position: relative; width: clamp(34px,4.5vw,52px); height: 43px; display: grid; place-items: center; border: 1px solid #cdd7e3; border-bottom-width: 3px; border-radius: 7px; color: #43566c; background: #fff; font: 650 13px/1 "SFMono-Regular", Consolas, monospace; transition: .1s; }
.key.wide { width: clamp(61px,8vw,100px); }
.key.space { width: min(330px,42vw); }
.key.active { color: #fff; background: var(--blue); border-color: #4a5056; transform: translateY(2px); box-shadow: 0 0 0 4px rgba(98,105,112,.16); }
.key.finger-l5, .key.finger-r5, .hands-legend .finger-l5 { border-top: 3px solid #ce64be; }
.key.finger-l4, .key.finger-r4, .hands-legend .finger-l4 { border-top: 3px solid #7659d5; }
.key.finger-l3, .key.finger-r3, .hands-legend .finger-l3 { border-top: 3px solid #3e8de1; }
.key.finger-l2, .key.finger-r2, .hands-legend .finger-l2 { border-top: 3px solid #25aa8b; }
.hands-legend { margin-top: 14px; display: flex; justify-content: center; flex-wrap: wrap; gap: 18px; color: var(--muted); font-size: 10px; }
.hands-legend span { display: flex; align-items: center; gap: 5px; }
.hands-legend i { width: 9px; height: 9px; border: 0; border-radius: 50%; background: currentColor; }
.hands-legend .finger-l5 { color: #ce64be; }.hands-legend .finger-l4 { color: #7659d5; }.hands-legend .finger-l3 { color: #3e8de1; }.hands-legend .finger-l2 { color: #25aa8b; }
.modal-backdrop { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 20px; background: rgba(8,22,38,.68); backdrop-filter: blur(5px); }
.modal-backdrop[hidden] { display: none; }
.result-modal { width: min(480px,100%); padding: 36px; text-align: center; background: #fff; border-radius: 20px; box-shadow: 0 30px 80px rgba(0,0,0,.25); }
.result-symbol { width: 57px; height: 57px; margin: 0 auto 17px; display: grid; place-items: center; color: #fff; background: var(--green); border-radius: 50%; font-size: 28px; }
.result-modal .eyebrow { color: var(--green); }
.result-modal h2 { margin: 0; font: 750 30px/1.2 Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif; }
.result-modal > p:not(.eyebrow) { color: var(--muted); }
.result-goal { margin: 17px 0 0; padding: 10px 12px; border-radius: 9px; font-size: 12px; font-weight: 800; }
.result-goal.reached { color: #14734c; background: #e8f8f1; }
.result-goal.open { color: #7b5a16; background: #fff6df; }
.result-stats { margin: 25px 0; display: grid; grid-template-columns: repeat(3,1fr); border: 1px solid var(--line); border-radius: 12px; }
.result-stats div { padding: 15px 8px; }
.result-stats div + div { border-left: 1px solid var(--line); }
.result-stats strong,.result-stats span { display: block; }
.result-stats strong { font-size: 22px; }.result-stats span { margin-top: 3px; color: var(--muted); font-size: 10px; }
.primary-button { width: 100%; padding: 13px 18px; border: 0; border-radius: 9px; color: #fff; background: var(--blue); font-weight: 800; cursor: pointer; }
.primary-button:hover { background: #4f565d; }
.text-button { margin-top: 13px; border: 0; background: none; color: var(--blue); cursor: pointer; font-weight: 700; }

@media (max-width: 950px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { transform: translateX(-100%); transition: transform .25s; box-shadow: 20px 0 60px rgba(0,0,0,.2); }
  body.menu-open .sidebar { transform: translateX(0); }
  main { grid-column: 1; }
  .menu-button { display: inline-grid; place-items: center; }
  .topbar { padding-inline: 20px; }
}
@media (max-width: 700px) {
  .workspace { width: min(100% - 28px,1050px); padding-top: 20px; }
  .lesson-intro { display: block; }.sound-toggle { margin-top: 14px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .typing-card { padding-inline: 20px; min-height: 220px; }
  .text-window { padding-top: 22px; line-height: 1.7; }
  .keyboard-section { overflow-x: auto; padding-inline: 8px; }
  .keyboard { min-width: 590px; }
  .hands-legend { min-width: 590px; }
  .key { width: 38px; }
  .key.wide { width: 72px; }.key.space { width: 250px; }
}
@media (max-width: 470px) {
  .topbar { height: 90px; }.topbar .streak { display: none; }
  .stats-grid article { padding: 10px; min-height: 65px; }.stats-grid strong { font-size: 18px; }
  .finger-callout { max-width: 100%; flex-wrap: wrap; justify-content: center; border-radius: 12px; }
  .result-modal { padding: 28px 20px; }
}
@media (prefers-reduced-motion: reduce) { *,*::before,*::after { scroll-behavior: auto !important; transition: none !important; } }
body:has(.access-gate:not([hidden])){overflow:hidden}
.access-gate{position:fixed;inset:0;z-index:1000;display:grid;place-items:center;background:#f4f7fb;padding:24px;color:#10243d}
.access-gate[hidden]{display:none}
.access-gate section{width:min(520px,100%);border:1px solid #dbe3ed;border-radius:20px;background:#fff;padding:38px;text-align:center;box-shadow:0 18px 55px rgba(16,36,61,.12)}
.gate-brand{display:flex;flex-direction:column;margin:0 0 28px}
.gate-brand strong{font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;font-size:26px}
.gate-brand span{margin-top:3px;color:#68788b;font-size:14px;font-weight:700;letter-spacing:.08em}
.access-gate h1{margin:0 0 12px;font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;font-size:30px}
.access-gate p{font-size:17px;line-height:1.55}
.access-gate a{display:inline-flex;margin-top:14px;border-radius:10px;background:#8d1a7c;padding:12px 20px;color:#fff;font-weight:800;text-decoration:none}
