/* typing-test.ru — redesigned touch typing course */
:root {
  --bg: #080b11; --bg-2: #0b1018; --surface: #10161f; --surface-2: #151d29;
  --border: #232c3a; --border-soft: #1a2230;
  --text: #e8eef7; --dim: #8b98ab; --faint: #5d6b80;
  --accent: #5b9dff; --accent-2: #7c5cff; --green: #3ddc97; --red: #ff6b6b; --amber: #ffc857;
  --key-bg: #131a25; --key-edge: #080b11; --key-line: #293446;
  --mono: 'SF Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, 'Noto Sans', sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { color-scheme: dark; scroll-behavior: smooth; scrollbar-color: #2c3849 #0a0e15; scrollbar-width: thin; }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--text); font-family: var(--sans); line-height: 1.6;
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
body::before {
  content: ""; position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background:
    radial-gradient(960px 560px at 88% -8%, rgba(91, 157, 255, .17), transparent 62%),
    radial-gradient(780px 560px at -6% 72%, rgba(124, 92, 255, .12), transparent 64%);
}
body::after {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: .42;
  background-image: radial-gradient(rgba(255, 255, 255, .05) 1px, transparent 1px); background-size: 28px 28px;
  -webkit-mask-image: linear-gradient(180deg, rgba(0, 0, 0, .75), transparent 76%);
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, .75), transparent 76%);
}
button, a, input { -webkit-tap-highlight-color: transparent; }
button { font-family: inherit; }
a { color: inherit; }
h1, h2, h3 { letter-spacing: -.4px; line-height: 1.18; }
::selection { background: rgba(91, 157, 255, .35); }
.grad {
  background: linear-gradient(100deg, #5b9dff 10%, #9d8bff 55%, #3ddc97 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.inline-link { color: var(--accent); text-decoration: none; font-weight: 650; }
.inline-link:hover { text-decoration: underline; }

/* ------------------------------------------------------------------ topbar */
.topbar {
  position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 18px;
  padding: 11px max(16px, calc((100vw - 1140px) / 2));
  background: rgba(8, 11, 17, .82); backdrop-filter: blur(18px); border-bottom: 1px solid rgba(255, 255, 255, .06);
  transition: opacity .25s, transform .25s;
}
.logo { display: inline-flex; align-items: baseline; text-decoration: none; color: var(--text); font-weight: 900; font-size: 22px; letter-spacing: -1px; line-height: 1.1; white-space: nowrap; }
.logo .domain { color: var(--accent); }
.topnav { display: flex; align-items: center; gap: 4px; }
.topnav a, .nav-tab {
  padding: 7px 12px; border-radius: 9px; text-decoration: none; font-size: 12.5px; font-weight: 650;
  color: var(--dim); background: transparent; border: 0; cursor: pointer; white-space: nowrap;
  transition: color .15s, background .15s;
}
.topnav a:hover, .nav-tab:hover { color: var(--text); background: rgba(255, 255, 255, .04); }
.nav-tab.is-active { color: #dbe9ff; background: rgba(91, 157, 255, .14); box-shadow: inset 0 0 0 1px rgba(91, 157, 255, .28); }
.account-box { display: flex; align-items: center; gap: 10px; margin-left: auto; min-width: 0; }
.save-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; color: var(--faint); white-space: nowrap; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #46546a; flex: none; transition: background .2s, box-shadow .2s; }
.save-badge[data-state="synced"] .status-dot { background: var(--green); box-shadow: 0 0 8px rgba(61, 220, 151, .55); }
.save-badge[data-state="synced"] { color: #9fdcc2; }
.save-badge[data-state="saving"] .status-dot { background: var(--amber); box-shadow: 0 0 8px rgba(255, 200, 87, .55); animation: pulse 1s ease-in-out infinite; }
.save-badge[data-state="offline"], .save-badge[data-state="error"] { color: #ffb0b0; }
.save-badge[data-state="offline"] .status-dot, .save-badge[data-state="error"] .status-dot { background: var(--red); }
.save-badge[data-state="guest"] .status-dot { background: #7f8ea5; }
.save-badge .save-short { display: none; }
.account-menu { position: relative; }
.account-pop {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 210px; z-index: 60; padding: 10px;
  display: grid; gap: 2px; background: #0f1621; border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 22px 50px -20px #000; animation: fade .14s ease-out;
}
.account-pop .account-login { font-size: 13px; font-weight: 700; color: var(--text); word-break: break-all; }
.account-pop .account-mail { font-size: 11.5px; color: var(--dim); word-break: break-all; }
.account-pop .btn { margin-top: 8px; justify-self: start; }

/* ------------------------------------------------------------------ buttons & cards */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid var(--border);
  background: rgba(255, 255, 255, .03); color: var(--dim); font-size: 12.5px; font-weight: 650; padding: 9px 14px;
  border-radius: 11px; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: transform .12s, border-color .15s, color .15s, background .15s, box-shadow .15s;
}
.btn:hover { color: var(--text); border-color: #3a4658; background: rgba(255, 255, 255, .06); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn:focus-visible, a:focus-visible, button:focus-visible, input:focus-visible + .switch-box { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn-lg { padding: 11px 18px; font-size: 13.5px; border-radius: 12px; }
.btn-sm { padding: 6px 11px; font-size: 11.5px; border-radius: 9px; }
.btn-primary {
  border-color: rgba(91, 157, 255, .48); color: #fff;
  background: linear-gradient(180deg, rgba(91, 157, 255, .34), rgba(91, 157, 255, .16));
  box-shadow: 0 8px 24px -10px rgba(91, 157, 255, .65), inset 0 1px 0 rgba(255, 255, 255, .14);
}
.btn-primary:hover { border-color: rgba(91, 157, 255, .82); background: linear-gradient(180deg, rgba(91, 157, 255, .44), rgba(91, 157, 255, .22)); color: #fff; }
.btn-warn { border-color: rgba(255, 200, 87, .4); color: #ffd985; background: rgba(255, 200, 87, .09); }
.btn-warn:hover { border-color: rgba(255, 200, 87, .7); color: #ffe7ad; background: rgba(255, 200, 87, .16); }
.btn-quiet { border-color: transparent; background: transparent; color: var(--faint); }
.btn-icon { width: 36px; height: 36px; padding: 0; font-size: 15px; }
.btn-back { padding: 7px 12px; font-size: 12px; }
.lakeid-btn { border-color: rgba(91, 157, 255, .38); color: #dbe9ff; background: linear-gradient(180deg, rgba(91, 157, 255, .17), rgba(91, 157, 255, .07)); }
.lakeid-btn svg { width: 15px; height: 15px; flex: none; }
.lakeid-btn .auth-short { display: none; }
.account-name {
  display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--border); background: rgba(255, 255, 255, .035);
  color: var(--text); border-radius: 12px; padding: 5px 10px 5px 5px; cursor: pointer; font-size: 12.5px; font-weight: 650; max-width: 220px;
}
.account-name .ava { width: 26px; height: 26px; border-radius: 8px; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #5b9dff, #7c5cff); color: #fff; font-weight: 850; font-size: 12.5px; flex: none; text-transform: uppercase; }
.account-name .uname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-name .caret-glyph { color: var(--faint); font-size: 9px; flex: none; }
.link-btn { border: 0; padding: 0; background: none; color: var(--accent); font: inherit; font-weight: 700; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
kbd { font-family: var(--mono); font-size: 10px; line-height: 1; padding: 3px 5px; border-radius: 5px; border: 1px solid rgba(255, 255, 255, .16); background: rgba(255, 255, 255, .06); color: var(--faint); }
.btn-primary kbd { color: #dbe9ff; border-color: rgba(255, 255, 255, .25); }
.section-kicker { display: block; font-size: 10.5px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); }
.card {
  position: relative; border: 1px solid var(--border); border-radius: 20px; min-width: 0;
  background: linear-gradient(180deg, rgba(19, 26, 38, .92), rgba(11, 16, 24, .96));
  box-shadow: 0 28px 70px -46px #000, inset 0 1px 0 rgba(255, 255, 255, .04);
}
.card::before {
  content: ""; position: absolute; top: 0; left: 12%; right: 12%; height: 1px; pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(91, 157, 255, .42), transparent);
}
.course { width: min(1140px, calc(100% - 32px)); margin: 0 auto; padding: 24px 0 48px; }

/* ------------------------------------------------------------------ VIEW 1: HUB */
.hero-card {
  display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(300px, .95fr); gap: 22px 28px;
  padding: 26px 28px; align-items: center; overflow: hidden;
}
.hero-pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 99px;
  font-size: 11px; font-weight: 750; letter-spacing: .06em; text-transform: uppercase;
  color: #cfe2ff; background: rgba(91, 157, 255, .14); border: 1px solid rgba(91, 157, 255, .28);
}
.hero-copy h1 { margin: 12px 0 10px; font-size: clamp(28px, 3.6vw, 44px); font-weight: 900; letter-spacing: -1.6px; }
.hero-lead { margin: 0; max-width: 600px; color: var(--dim); font-size: 14.5px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 20px; }
.diag-banner {
  margin-top: 14px; padding: 10px 14px; border-radius: 12px; font-size: 13px; color: #dbe9ff;
  background: rgba(61, 220, 151, .08); border: 1px solid rgba(61, 220, 151, .28);
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.hero-visual { display: flex; flex-direction: column; gap: 14px; }
.hero-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.hm-item {
  padding: 11px 14px; border-radius: 14px; background: rgba(255, 255, 255, .028); border: 1px solid rgba(255, 255, 255, .06);
  display: flex; flex-direction: column;
}
.hm-val { font-size: 24px; font-weight: 900; letter-spacing: -.8px; line-height: 1.15; font-variant-numeric: tabular-nums; color: var(--text); }
.hm-val small { font-size: 12.5px; font-weight: 650; color: var(--dim); margin-left: 3px; }
.hm-lbl { font-size: 11px; color: var(--faint); margin-top: 2px; }

.mini-kb-box { padding: 12px 14px; border-radius: 14px; background: rgba(7, 10, 16, .65); border: 1px solid rgba(255, 255, 255, .06); }
.mini-kb-head { display: flex; justify-content: space-between; align-items: center; font-size: 11px; color: var(--dim); margin-bottom: 8px; }
.mini-kb-legend { display: flex; gap: 10px; font-size: 10.5px; color: var(--faint); }
.mini-kb-legend i { font-style: normal; display: inline-flex; align-items: center; gap: 4px; }
.mini-kb-legend b { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.dot-mastered { background: var(--green); }
.dot-weak { background: var(--red); }
.mini-kb { display: grid; gap: 3px; }
.mini-row { display: flex; gap: 3px; justify-content: center; }
.mini-key {
  flex: 1 1 0; max-width: 24px; height: 20px; border-radius: 4px; display: grid; place-items: center;
  font-size: 9px; font-weight: 700; color: var(--faint); background: rgba(255, 255, 255, .04); border: 1px solid rgba(255, 255, 255, .06);
}
.mini-key.is-mastered { color: #b7f5d8; background: rgba(61, 220, 151, .16); border-color: rgba(61, 220, 151, .38); }
.mini-key.is-weak { color: #ffd1d1; background: rgba(255, 107, 107, .22); border-color: rgba(255, 107, 107, .52); }

/* ------------------------------------------------------------------ roadmap */
.roadmap, .insights, .guide-section { margin-top: 28px; }
.section-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 14px; flex-wrap: wrap; }
.section-head h2 { margin: 3px 0 0; font-size: clamp(20px, 2.2vw, 26px); font-weight: 900; letter-spacing: -.8px; }
.course-progress { display: flex; flex-direction: column; gap: 6px; min-width: 220px; }
.course-progress-copy { display: flex; align-items: baseline; gap: 6px; font-size: 12px; color: var(--dim); }
.course-progress-copy b { font-size: 14px; color: var(--text); }
.course-progress-bar { height: 6px; border-radius: 99px; background: rgba(255, 255, 255, .07); overflow: hidden; }
.course-progress-bar > div { height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--green)); transition: width .4s ease-out; }

.module-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 14px; }
.module {
  padding: 16px; border-radius: 18px; border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(17, 23, 34, .88), rgba(11, 15, 23, .92));
  transition: border-color .2s;
}
.module.is-current { border-color: rgba(91, 157, 255, .45); box-shadow: 0 18px 46px -34px rgba(91, 157, 255, .55); }
.module.is-complete { border-color: rgba(61, 220, 151, .35); }
.module-head { display: flex; align-items: flex-start; gap: 11px; }
.module-idx {
  flex: none; width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center;
  font-family: var(--mono); font-size: 12px; font-weight: 800; color: var(--dim);
  background: rgba(255, 255, 255, .04); border: 1px solid rgba(255, 255, 255, .07);
}
.module.is-current .module-idx { color: #fff; background: rgba(91, 157, 255, .24); border-color: rgba(91, 157, 255, .5); }
.module.is-complete .module-idx { color: var(--green); background: rgba(61, 220, 151, .14); border-color: rgba(61, 220, 151, .4); }
.module-head h3 { margin: 0; font-size: 15.5px; font-weight: 800; }
.module-head p { margin: 3px 0 0; font-size: 12px; color: var(--dim); line-height: 1.45; }
.module-count { margin-left: auto; flex: none; font-size: 11.5px; color: var(--faint); font-variant-numeric: tabular-nums; padding-top: 2px; }
.module-count b { color: var(--text); }
.module-bar { height: 3px; border-radius: 99px; background: rgba(255, 255, 255, .06); margin: 12px 0; overflow: hidden; }
.module-bar > div { height: 100%; background: linear-gradient(90deg, var(--accent), var(--green)); border-radius: inherit; }
.module-lessons { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.lesson-chip {
  position: relative; display: flex; flex-direction: column; gap: 4px; width: 100%; min-height: 64px;
  padding: 9px 10px; text-align: left; border-radius: 12px; border: 1px solid var(--border-soft);
  background: rgba(255, 255, 255, .025); color: var(--dim); cursor: pointer;
  transition: border-color .14s, background .14s, color .14s, transform .14s;
}
.lesson-chip:hover { border-color: #3f4e64; background: rgba(255, 255, 255, .055); color: var(--text); transform: translateY(-2px); }
.chip-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; width: 100%; }
.chip-num { font-family: var(--mono); font-size: 11px; font-weight: 700; color: var(--faint); }
.chip-goal { font-size: 10.5px; color: var(--faint); font-variant-numeric: tabular-nums; }
.chip-title { font-size: 12.5px; font-weight: 700; color: inherit; line-height: 1.28; }
.chip-foot { display: flex; align-items: center; justify-content: space-between; margin-top: auto; width: 100%; }
.chip-stars { font-size: 11.5px; letter-spacing: 1.5px; line-height: 1; color: rgba(255, 255, 255, .14); }
.chip-stars .on { color: var(--amber); }
.chip-cpm { font-family: var(--mono); font-size: 10.5px; color: var(--green); font-weight: 700; }
.lesson-chip.is-done { border-color: rgba(61, 220, 151, .24); }
.lesson-chip.is-done .chip-num { color: var(--green); }
.lesson-chip.is-next { border-color: rgba(91, 157, 255, .62); background: rgba(91, 157, 255, .11); color: var(--text); }
.lesson-chip.is-next .chip-num { color: var(--accent); }
.chip-tag {
  position: absolute; top: -8px; right: 8px; padding: 1px 7px; border-radius: 6px; font-size: 9px; font-weight: 800;
  letter-spacing: .06em; text-transform: uppercase; background: var(--accent); color: #fff;
}
.guest-note { margin: 14px 0 0; font-size: 12.5px; color: var(--dim); }

/* ------------------------------------------------------------------ insights */
.insights-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(240px, .8fr) minmax(0, 1fr); gap: 14px; }
.chart-card, .weak-card, .history-card { padding: 16px 18px; display: flex; flex-direction: column; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 10px; }
.card-head h3 { margin: 0; font-size: 15px; font-weight: 800; }
.chart-note { font-size: 11px; color: var(--faint); }
.chart { position: relative; flex: 1 0 auto; min-height: 200px; }
.chart svg { display: block; width: 100%; height: 100%; }
.chart .grid-line { stroke: rgba(255, 255, 255, .07); stroke-width: 1; }
.chart .axis-label { fill: var(--faint); font: 600 10.5px var(--mono); }
.chart .area { stroke: none; }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
.chart .dot { stroke: #0b1018; stroke-width: 1.5; }
.chart .empty-note { fill: var(--faint); font: 600 12.5px var(--sans); text-anchor: middle; }
.chart .empty-line { stroke: rgba(255, 255, 255, .1); stroke-width: 1; stroke-dasharray: 4 6; }

.weak-list { display: grid; gap: 7px; }
.weak-item { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 10px; background: rgba(255, 255, 255, .025); }
.weak-bar-wrap { flex: 1; height: 6px; border-radius: 99px; background: rgba(255, 255, 255, .06); overflow: hidden; }
.weak-bar { height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--amber), var(--red)); }
.weak-cnt { font-family: var(--mono); font-size: 11.5px; color: var(--dim); min-width: 34px; text-align: right; }
.weak-empty { font-size: 13px; color: var(--faint); margin: 8px 0; }

.history { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; }
.history li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; gap: 10px; align-items: center; padding: 7px 8px; border-radius: 9px; font-size: 12.5px; }
.history li:nth-child(odd) { background: rgba(255, 255, 255, .025); }
.history .h-lesson { display: flex; flex-direction: column; min-width: 0; }
.history .h-lesson b { font-weight: 650; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.history .h-lesson span { font-size: 11px; color: var(--faint); }
.history .h-cpm { font-weight: 800; font-variant-numeric: tabular-nums; }
.history .h-acc { color: var(--dim); font-variant-numeric: tabular-nums; }
.history .h-stars { color: var(--amber); letter-spacing: 1px; font-size: 11.5px; width: 40px; text-align: right; }
.history .h-stars .off { color: rgba(255, 255, 255, .14); }
.history .h-free { color: var(--accent); font-weight: 800; }
.history-empty { margin: 8px 0; font-size: 13px; color: var(--faint); }

/* ------------------------------------------------------------------ method & FAQ */
.method-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.method-grid article { padding: 16px 18px; }
.method-num { font-family: var(--mono); font-size: 11px; color: var(--accent); }
.method-grid h3 { margin: 6px 0; font-size: 15px; }
.method-grid p { margin: 0; font-size: 13px; color: var(--dim); }
.seo-faq { margin-top: 14px; padding: 18px 22px; }
.seo-faq h3 { margin: 0 0 10px; font-size: 16px; }
.seo-faq details { border-top: 1px solid var(--border-soft); padding: 10px 0; }
.seo-faq details:first-of-type { border-top: 0; }
.seo-faq summary { cursor: pointer; font-weight: 700; font-size: 13.5px; color: var(--text); list-style: none; display: flex; justify-content: space-between; align-items: center; }
.seo-faq summary::after { content: "+"; color: var(--accent); font-size: 17px; font-weight: 400; }
.seo-faq details[open] summary::after { content: "−"; }
.seo-faq details p { margin: 8px 0 2px; font-size: 13px; color: var(--dim); }
.course-footer { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-top: 28px; padding: 14px 4px 0; border-top: 1px solid var(--border-soft); }
.footer-note { display: flex; flex-direction: column; gap: 1px; font-size: 12.5px; color: var(--faint); }
.footer-note strong { color: var(--dim); font-size: 13px; }
.reset-btn.is-arming { color: #ffd37a; border-color: rgba(255, 200, 87, .4); }

/* ------------------------------------------------------------------ VIEW 2: STUDIO */
.studio-bar {
  display: flex; justify-content: space-between; align-items: center; gap: 14px 20px; flex-wrap: wrap;
  margin-bottom: 14px; padding: 0 2px; transition: opacity .25s;
}
.studio-left { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.studio-left .btn-back { align-self: flex-start; margin-bottom: 4px; }
.studio-crumb { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 12px; color: var(--dim); }
.studio-mod { color: var(--accent); font-weight: 650; }
.crumb-sep { width: 3px; height: 3px; border-radius: 50%; background: var(--faint); }
.studio-title { display: flex; align-items: center; gap: 10px; margin: 0; font-size: clamp(20px, 2.3vw, 28px); font-weight: 900; letter-spacing: -1px; }
.lesson-num {
  flex: none; width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center;
  font-family: var(--mono); font-size: 15px; font-weight: 800; color: #dbe9ff;
  background: linear-gradient(145deg, #22375a, #172238); border: 1px solid rgba(91, 157, 255, .42);
}
.studio-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.goal-pills { display: flex; gap: 8px; flex-wrap: wrap; }
.gpill {
  display: flex; align-items: baseline; gap: 5px; padding: 7px 12px; border-radius: 12px;
  background: rgba(255, 255, 255, .028); border: 1px solid var(--border); font-size: 12px;
}
.gpill > span { color: var(--faint); font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; margin-right: 2px; }
.gpill b { font-size: 16px; font-weight: 800; font-variant-numeric: tabular-nums; }
.gpill small { font-size: 11px; color: var(--dim); }
.gpill-keys { align-items: center; }
.new-keys { display: inline-flex; gap: 4px; align-items: center; }
.kcap {
  display: inline-flex; align-items: center; justify-content: center; min-width: 24px; height: 24px; padding: 0 6px;
  border-radius: 7px; background: #1b2432; border: 1px solid var(--key-line); box-shadow: 0 2px 0 var(--key-edge);
  color: var(--text); font-size: 12.5px; font-weight: 800; line-height: 1;
}
.kcap.is-wide { padding: 0 8px; }
.studio-nav { display: flex; gap: 6px; }

/* Trainer */
.trainer { padding: 16px 22px 14px; }
.trainer-top { display: flex; justify-content: space-between; align-items: center; gap: 12px 16px; flex-wrap: wrap; }
.live-stats { display: flex; gap: clamp(14px, 3vw, 32px); flex-wrap: wrap; }
.stat { display: flex; flex-direction: column; min-width: 68px; }
.stat-label { font-size: 10px; text-transform: uppercase; letter-spacing: .11em; color: var(--faint); font-weight: 750; }
.stat-value { display: flex; align-items: baseline; gap: 4px; }
.stat-value b { font-size: 24px; font-weight: 850; letter-spacing: -.8px; line-height: 1.15; font-variant-numeric: tabular-nums; color: var(--text); }
.stat-value small { font-size: 11px; color: var(--dim); }
.stat-speed.is-on-goal .stat-value b { color: var(--green); }
.phase-pills { display: flex; gap: 6px; align-items: center; }
.phase-pill {
  padding: 4px 10px; border-radius: 99px; font-size: 11px; font-weight: 700;
  color: var(--faint); background: rgba(255, 255, 255, .025); border: 1px solid var(--border-soft);
  transition: color .18s, background .18s, border-color .18s;
}
.phase-pill.is-active { color: #dbe9ff; background: rgba(91, 157, 255, .16); border-color: rgba(91, 157, 255, .45); }
.phase-pill.is-done { color: var(--green); border-color: rgba(61, 220, 151, .35); }
.trainer-tools { display: flex; gap: 6px; align-items: center; }
.trainer-tools .btn.is-active { color: #dbe9ff; border-color: rgba(91, 157, 255, .5); background: rgba(91, 157, 255, .18); }

.progress-track { height: 5px; border-radius: 99px; background: rgba(255, 255, 255, .06); margin: 12px 0 10px; overflow: hidden; }
.progress-track > div { height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--accent-2) 60%, var(--green)); transition: width .12s linear; }
.progress-track.is-endless > div { width: 18%; background: linear-gradient(90deg, rgba(91, 157, 255, 0), var(--accent)); animation: endless 2.6s linear infinite; }

.intro-tip {
  display: flex; align-items: center; gap: 10px; padding: 8px 14px; margin-bottom: 10px; border-radius: 12px;
  background: rgba(91, 157, 255, .07); border: 1px solid rgba(91, 157, 255, .2);
  font-size: 13px; color: #cfe0f7; transition: opacity .22s, max-height .22s, margin .22s, padding .22s;
}
.intro-tip.is-hidden { opacity: 0; max-height: 0; margin: 0; padding-top: 0; padding-bottom: 0; overflow: hidden; border-width: 0; }
.intro-badge { flex: none; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; padding: 2px 7px; border-radius: 6px; background: rgba(91, 157, 255, .22); color: #fff; }
.intro-tip p { margin: 0; }

.stage {
  --lines: 5; position: relative; display: grid; align-items: center; border-radius: 15px;
  min-height: calc(var(--lines) * 1.65em + 16px); font-size: clamp(19px, 1.05vw + 12px, 26px); line-height: 1.65;
  container: stage / inline-size;
}
.stage > :not(.overlay) { grid-area: 1 / 1; min-width: 0; }
.text-window {
  position: relative; overflow: hidden; height: calc(var(--lines) * 1.65em + 16px);
  font-family: var(--mono); letter-spacing: .01em;
  background: rgba(6, 9, 15, .75); border: 1px solid rgba(255, 255, 255, .065); border-radius: 15px;
}
.text-lines { padding: 8px 18px; white-space: pre-wrap; overflow-wrap: anywhere; word-break: normal; will-change: transform; transition: transform .15s ease-out; }
.ch { color: #7f8fa6; border-radius: 3px; transition: color .06s, background .06s; }
.ch.in-word { color: #a9b8ce; }
.ch.done { color: #e8eef7; }
.ch.err { color: #ff9a9a; background: rgba(255, 107, 107, .2); }
.ch.cur { color: #fff; background: rgba(91, 157, 255, .22); }
.caret { position: absolute; left: 0; top: 0; width: 2.5px; border-radius: 2px; background: var(--accent); box-shadow: 0 0 10px rgba(91, 157, 255, .85); transition: left .045s linear, top .11s ease-out; pointer-events: none; }
.text-window.is-shaking { animation: shake .18s linear; }
.stage.is-setup .text-window, .stage.is-result .text-window { visibility: hidden; }
.err-indicator {
  position: absolute; right: 12px; bottom: 10px; padding: 3px 9px; border-radius: 8px; font-family: var(--sans);
  font-size: 11.5px; font-weight: 650; color: #ffb4b4; background: rgba(45, 16, 20, .86); border: 1px solid rgba(255, 107, 107, .38);
  pointer-events: none; animation: fade .12s ease-out;
}

.text-foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 6px 16px; margin-top: 10px; min-height: 38px; }
.next-hint { display: flex; align-items: center; gap: 11px; min-width: 0; }
.next-key {
  flex: none; min-width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; padding: 0 8px;
  font-size: 18px; font-weight: 800; line-height: 1; color: #fff; background: #1b2432;
  border: 1px solid rgba(var(--frgb, 139, 152, 171), .85);
  box-shadow: 0 0 0 3px rgba(var(--frgb, 139, 152, 171), .18), 0 2px 0 var(--key-edge);
}
.next-key.is-wide { font-size: 12px; }
.next-hint-copy { display: flex; flex-direction: column; min-width: 0; }
.next-label { font-size: 10px; text-transform: uppercase; letter-spacing: .1em; color: var(--faint); font-weight: 700; }
.next-hint-copy strong { display: flex; align-items: center; gap: 7px; font-size: 14px; color: var(--text); font-weight: 750; }
.next-hint-copy strong::before { content: ""; width: 8px; height: 8px; border-radius: 50%; flex: none; background: rgb(var(--frgb, 139, 152, 171)); box-shadow: 0 0 8px rgba(var(--frgb, 139, 152, 171), .7); }
.next-hint.is-off .next-key { border-color: var(--key-line); box-shadow: 0 2px 0 var(--key-edge); color: var(--faint); }
.next-hint.is-off .next-hint-copy strong::before { background: var(--faint); box-shadow: none; }
.foot-notes { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 4px 12px; margin-left: auto; font-size: 11.5px; color: var(--faint); }
.caps-warn { color: #ffd37a; font-weight: 700; }

.overlay {
  position: absolute; inset: 0; z-index: 5; display: flex; align-items: center; justify-content: center; padding: 18px;
  background: rgba(8, 11, 17, .84); backdrop-filter: blur(10px); border-radius: 15px; animation: fade .16s ease-out;
}
.pause-box { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; }
.pause-box strong { font-size: 24px; font-weight: 900; }
.pause-box span { font-size: 13px; color: var(--dim); }
.pause-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 10px; }

/* Result panel */
.result-panel {
  z-index: 4; display: grid; place-items: center; padding: 18px 22px; border-radius: 15px; font-size: 14px; line-height: 1.5;
  background: linear-gradient(180deg, #131b28, #0c121b); border: 1px solid rgba(91, 157, 255, .3);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05); animation: fade .18s ease-out;
}
.result-box { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr); align-items: center; gap: 14px 26px; width: 100%; }
.result-main { display: flex; flex-direction: column; gap: 4px; }
.result-stars { font-size: 36px; line-height: 1; letter-spacing: 5px; color: var(--amber); min-height: 36px; }
.result-stars .off { color: rgba(255, 255, 255, .14); }
.result-stars span { display: inline-block; animation: star .4s cubic-bezier(.2, 1.4, .4, 1) both; }
.result-stars span:nth-child(2) { animation-delay: .1s; }
.result-stars span:nth-child(3) { animation-delay: .2s; }
.result-main h2 { margin: 4px 0 0; font-size: clamp(20px, 2.2vw, 28px); font-weight: 900; }
.result-sub { margin: 0; font-size: 13px; color: var(--dim); }
.result-record { margin: 2px 0 0; font-size: 12.5px; font-weight: 700; color: var(--green); }
.result-pace { margin-top: 6px; height: 42px; display: flex; align-items: flex-end; gap: 4px; }
.pace-bar { flex: 1; min-width: 8px; border-radius: 4px 4px 2px 2px; background: rgba(91, 157, 255, .45); transition: height .25s; }
.pace-bar.is-fast { background: rgba(61, 220, 151, .65); }
.result-side { display: flex; flex-direction: column; gap: 10px; }
.result-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.result-stats > div { display: flex; flex-direction: column; padding: 8px 11px; border-radius: 12px; background: rgba(255, 255, 255, .035); border: 1px solid var(--border-soft); }
.result-stats b { font-size: 24px; font-weight: 850; letter-spacing: -.8px; line-height: 1.15; font-variant-numeric: tabular-nums; }
.result-stats span { font-size: 11px; color: var(--dim); white-space: nowrap; }
.result-keys { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 12.5px; color: var(--dim); min-height: 26px; }
.result-keys .kcap { color: #fff; border-color: rgba(255, 107, 107, .5); }
.result-keys .kcap i { font-style: normal; font-size: 11px; color: #ffb0b0; margin-left: 4px; }
.result-actions { display: flex; flex-wrap: wrap; gap: 8px; }
#mobileInput { position: absolute; left: 0; bottom: 0; width: 1px; height: 1px; opacity: 0; border: 0; padding: 0; pointer-events: none; font-size: 16px; }

/* Free practice setup */
.free-setup {
  z-index: 4; display: flex; flex-direction: column; justify-content: center; gap: 11px; padding: 16px 20px; border-radius: 15px;
  font-size: 13.5px; line-height: 1.5; background: rgba(255, 255, 255, .02); border: 1px solid rgba(255, 255, 255, .06);
}
.free-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.free-head h2 { margin: 0; font-size: 20px; font-weight: 900; }
.free-head p { margin: 3px 0 0; font-size: 13px; color: var(--dim); }
.free-count { flex: none; display: flex; flex-direction: column; align-items: flex-end; }
.free-count b { font-size: 28px; font-weight: 900; line-height: 1.1; color: #dbe9ff; }
.free-count span { font-size: 11px; color: var(--dim); white-space: nowrap; }
.free-row { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.free-row-label { flex: none; min-width: 108px; font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em; color: var(--faint); font-weight: 700; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border-radius: 99px; border: 1px solid var(--border);
  background: rgba(255, 255, 255, .03); color: var(--dim); font-size: 12px; font-weight: 650; cursor: pointer; white-space: nowrap;
  transition: border-color .15s, color .15s, background .15s;
}
.chip:hover { color: var(--text); border-color: #3a4658; background: rgba(255, 255, 255, .06); }
.chip.is-on { color: #dbe9ff; border-color: rgba(91, 157, 255, .6); background: rgba(91, 157, 255, .17); }
.seg { display: inline-flex; padding: 3px; border-radius: 10px; background: rgba(255, 255, 255, .035); border: 1px solid var(--border-soft); }
.seg-btn { border: 0; background: none; color: var(--dim); font: inherit; font-size: 12px; font-weight: 650; padding: 5px 11px; border-radius: 7px; cursor: pointer; }
.seg-btn.is-on { color: #fff; background: rgba(91, 157, 255, .3); }
.free-start-btn { margin-left: auto; padding: 9px 20px; font-size: 13.5px; }

/* ------------------------------------------------------------------ Keyboard + Hands Dock */
.keyboard-dock { margin-top: 14px; padding: 14px 18px 16px; }
.kb-head { display: flex; justify-content: space-between; align-items: center; gap: 8px 16px; margin-bottom: 10px; flex-wrap: wrap; }
.kb-tip { margin: 0; font-size: 12.5px; color: var(--dim); min-height: 18px; }
.kb-tip b { color: var(--text); }
.kb-toggles { display: flex; flex-wrap: wrap; gap: 14px; }
.switch { position: relative; display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--dim); cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-box { flex: none; width: 30px; height: 18px; border-radius: 99px; background: #2a3444; position: relative; transition: background .15s; }
.switch-box::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #c7d2e3; transition: transform .15s; }
.switch input:checked + .switch-box { background: var(--accent); }
.switch input:checked + .switch-box::after { transform: translateX(12px); background: #fff; }
.switch:hover { color: var(--text); }

.kb-stage { display: grid; grid-template-columns: 118px minmax(0, 1fr) 118px; gap: 14px; align-items: center; }
.kb-stage.no-hands { grid-template-columns: minmax(0, 1fr); max-width: 820px; margin: 0 auto; }
.kb-stage.no-hands .hand-slot { display: none; }
.hand-slot { display: flex; justify-content: center; align-items: center; }
.hand { display: block; width: 100%; max-width: 114px; height: auto; }
.hand .fg { fill: #151d2a; stroke: #2a3649; stroke-width: 1.25; transition: fill .12s, stroke .12s, filter .12s; }
.hand .fg.on { fill: rgba(var(--frgb), .82); stroke: rgba(255, 255, 255, .65); filter: drop-shadow(0 0 8px rgba(var(--frgb), .5)); }
.hand text { fill: #9fb0c7; font: 700 9.5px var(--sans); text-anchor: middle; pointer-events: none; }
.hand text.on { fill: #fff; }

.kb-wrap { container-type: inline-size; width: 100%; padding: 6px; border-radius: 15px; transition: box-shadow .2s, background .2s; }
body.is-setup .kb-wrap { background: rgba(91, 157, 255, .06); box-shadow: 0 0 0 2px rgba(91, 157, 255, .42); }
.kb {
  --gap: 5px; --unit: 42px; display: grid; grid-template-columns: repeat(60, minmax(0, 1fr)); grid-auto-rows: var(--unit); gap: var(--gap);
  font-size: 16px; user-select: none;
}
@supports (width: 1cqw) {
  .kb { --unit: min(calc((100cqw - 14 * var(--gap)) / 15), 46px); font-size: clamp(9px, 2.8cqw, 16px); }
}
.key {
  position: relative; display: flex; align-items: center; justify-content: center; overflow: hidden;
  grid-column: calc(var(--s) * 4 + 1) / span calc(var(--w) * 4);
  border-radius: max(4px, calc(var(--unit) * .16)); border: 1px solid var(--key-line);
  background: var(--key-bg); color: #dfe7f3; font-weight: 700; line-height: 1;
  box-shadow: 0 2px 0 var(--key-edge), inset 0 1px 0 rgba(255, 255, 255, .05);
  transition: transform .09s, background .09s, border-color .09s, box-shadow .09s, opacity .15s;
}
.key-base { position: relative; transition: opacity .15s; }
.key-shift { position: absolute; top: 9%; left: 11%; font-size: .58em; font-weight: 600; color: var(--faint); line-height: 1; transition: opacity .15s; }
.kb.is-blind .key:not(.is-mod):not(.is-space) .key-base,
.kb.is-blind .key:not(.is-mod):not(.is-space) .key-shift { opacity: 0; }
.key.has-finger {
  background: linear-gradient(180deg, rgba(var(--frgb), .17), rgba(var(--frgb), .04) 65%), var(--key-bg);
  box-shadow: inset 0 2px 0 rgba(var(--frgb), .9), 0 2px 0 var(--key-edge);
}
.key.is-mod { color: var(--dim); }
.key.is-mod .key-base { font-size: .64em; font-weight: 650; }
.key.is-home::after {
  content: ""; position: absolute; left: 34%; right: 34%; bottom: 13%; height: 2px; border-radius: 2px;
  background: rgba(255, 255, 255, .6);
}
.key.is-new::before {
  content: ""; position: absolute; top: 14%; right: 14%; width: max(4px, .3em); height: max(4px, .3em); border-radius: 50%;
  background: rgb(var(--frgb)); box-shadow: 0 0 6px rgba(var(--frgb), .95);
}
.key.is-unknown { opacity: .32; }
.key.is-next {
  opacity: 1; color: #fff; border-color: rgba(var(--frgb), .95); transform: translateY(-2px);
  background: linear-gradient(180deg, rgba(var(--frgb), .58), rgba(var(--frgb), .3)), var(--key-bg);
  box-shadow: inset 0 2px 0 rgba(var(--frgb), 1), 0 0 0 2px rgba(var(--frgb), .3), 0 0 18px rgba(var(--frgb), .45), 0 3px 0 var(--key-edge);
}
.key.is-shift {
  color: #fff; border-color: rgba(91, 157, 255, .95);
  background: linear-gradient(180deg, rgba(91, 157, 255, .48), rgba(91, 157, 255, .2)), var(--key-bg);
  box-shadow: 0 0 0 2px rgba(91, 157, 255, .3), 0 0 16px rgba(91, 157, 255, .45), 0 2px 0 var(--key-edge);
}
.key.is-ok { background: linear-gradient(180deg, rgba(61, 220, 151, .58), rgba(61, 220, 151, .26)), var(--key-bg); border-color: var(--green); }
.key.is-bad { background: linear-gradient(180deg, rgba(255, 107, 107, .62), rgba(255, 107, 107, .3)), var(--key-bg); border-color: var(--red); animation: keypop .16s ease-out; }
.kb.is-picker .key.is-pickable { cursor: pointer; opacity: .28; }
.kb.is-picker .key.is-pickable:not(.is-picked):hover { opacity: .72; transform: translateY(-1px); }
.kb.is-picker .key.is-picked {
  opacity: 1; border-color: rgba(var(--frgb), .95); transform: translateY(-2px);
  background: linear-gradient(180deg, rgba(var(--frgb), .5), rgba(var(--frgb), .22)), var(--key-bg);
  box-shadow: inset 0 2px 0 rgba(var(--frgb), 1), 0 0 0 2px rgba(var(--frgb), .26), 0 3px 0 var(--key-edge);
}
.kb.is-picker .key.is-mod { opacity: .2; }

/* Focus mode while typing */
body.is-focus .studio-bar, body.is-focus .topbar { opacity: .25; }
body.is-focus .studio-bar:hover, body.is-focus .topbar:hover { opacity: 1; }

/* ------------------------------------------------------------------ handheld */
.handheld-note { display: none; }
html.is-handheld .handheld-note { display: block; width: min(560px, calc(100% - 28px)); margin: 16px auto 24px; }
html.is-handheld .course, html.is-handheld .account-box, html.is-handheld .nav-tab { display: none; }
.handheld-card {
  display: flex; flex-direction: column; align-items: flex-start; padding: 22px; border-radius: 22px;
  border: 1px solid var(--border); background: linear-gradient(180deg, rgba(18, 25, 36, .96), rgba(11, 16, 24, .98));
}
.handheld-icon { width: 44px; height: 44px; color: var(--accent); margin-bottom: 12px; }
.handheld-card h1 { margin: 6px 0 0; font-size: clamp(22px, 6vw, 30px); font-weight: 900; }
.handheld-card p { margin: 10px 0 0; font-size: 14px; color: var(--dim); }
.handheld-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 18px; width: 100%; }

/* ------------------------------------------------------------------ toast & anim */
.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 100; max-width: min(92vw, 520px); padding: 11px 16px; border-radius: 12px;
  background: #121a26; color: var(--text); font-size: 13px; font-weight: 600; border: 1px solid var(--border);
  box-shadow: 0 18px 50px -20px #000; opacity: 0; transform: translate(-50%, 10px); pointer-events: none; transition: opacity .18s, transform .18s;
}
.toast.warn { color: #ffe3a3; background: #241d0f; border-color: rgba(255, 200, 87, .44); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
@keyframes keypop { 0% { transform: translateY(1px) scale(.96); } 100% { transform: none; } }
@keyframes star { from { transform: scale(.4) rotate(-18deg); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes endless { from { transform: translateX(-110%); } to { transform: translateX(570%); } }

/* ------------------------------------------------------------------ responsive */
@media (max-width: 1080px) {
  .hero-card { grid-template-columns: 1fr; }
  .insights-grid { grid-template-columns: 1fr 1fr; }
  .insights-grid .history-card { grid-column: 1 / -1; }
  .kb-stage { grid-template-columns: 92px minmax(0, 1fr) 92px; gap: 10px; }
}
@media (max-width: 900px) {
  .method-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .module-grid { grid-template-columns: 1fr; }
  .kb-stage { grid-template-columns: minmax(0, 1fr); }
  .hand-slot { display: none; }
}
@media (max-width: 760px) {
  .topbar { gap: 8px; padding: 10px 12px; }
  .logo { font-size: 19px; }
  .topnav a:first-child { display: none; }
  .lakeid-btn .auth-full { display: none; }
  .lakeid-btn .auth-short { display: inline; }
  .save-badge .save-long { display: none; }
  .save-badge .save-short { display: inline; }
  .insights-grid { grid-template-columns: 1fr; }
  .result-box { grid-template-columns: 1fr; }
  .result-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .course { width: calc(100% - 20px); padding-top: 14px; }
  .hero-card { padding: 18px; }
  .method-grid { grid-template-columns: 1fr; }
  .trainer { padding: 12px; }
  .kb { --gap: 3px; }
  .btn kbd { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
