:root {
  --bg: #f5f6fb;
  --surface: #ffffff;
  --surface-2: #eff1f7;
  --surface-3: #e5e8f1;
  --border: #e1e5ef;
  --text: #141a2e;
  --muted: #646e87;
  --accent: #4b63f5;
  --accent-2: #7a5af8;
  --accent-soft: rgba(75, 99, 245, .11);
  --ok: #129a52;
  --ok-soft: rgba(18, 154, 82, .12);
  --bad: #d92d3a;
  --bad-soft: rgba(217, 45, 58, .12);
  --warn: #c97a06;
  --warn-soft: rgba(201, 122, 6, .13);
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 8px 28px rgba(16, 24, 40, .06);
  --radius: 16px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, Consolas, monospace;
  --type-font: var(--mono);
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #0a0d16;
  --surface: #111625;
  --surface-2: #171e31;
  --surface-3: #1f2840;
  --border: #232c45;
  --text: #e8ebf5;
  --muted: #8a93ab;
  --accent: #7189ff;
  --accent-2: #9b7bff;
  --accent-soft: rgba(113, 137, 255, .14);
  --ok: #3ddc97;
  --ok-soft: rgba(61, 220, 151, .13);
  --bad: #ff6b74;
  --bad-soft: rgba(255, 107, 116, .14);
  --warn: #fbbf24;
  --warn-soft: rgba(251, 191, 36, .14);
  --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 12px 32px rgba(0, 0, 0, .28);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; letter-spacing: -.015em; }
h1 { font-size: clamp(24px, 3vw, 32px); font-weight: 800; }
h2 { font-size: 20px; font-weight: 700; }
h3 { font-size: 16px; font-weight: 650; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
.ic { flex: none; display: block; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: var(--mono); }
.ok-t { color: var(--ok); }
.bad-t { color: var(--bad); }
.warn-t { color: var(--warn); }

/* ---------- Shell ---------- */
.app { display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 16px;
  padding: 20px 14px 16px; background: var(--surface); border-right: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 11px; padding: 0 8px; }
.logo {
  width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff;
  font: 800 18px var(--font); box-shadow: inset 0 -3px 0 rgba(0,0,0,.18);
}
.brand b { font-size: 17px; font-weight: 800; letter-spacing: -.02em; display: block; }
.brand small { color: var(--muted); font-size: 12px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.drawer { display: flex; flex-direction: column; gap: 14px; flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: none; }
.drawer::-webkit-scrollbar { display: none; }
.drawer-head, .menu-btn, .mob-actions, .nav-backdrop { display: none; }
.nav-sec { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 12px 12px 4px; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: 10px;
  color: var(--muted); font-weight: 550; transition: background .15s, color .15s;
}
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.active { background: var(--accent-soft); color: var(--accent); }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; padding: 0 4px; }
.side-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--muted); }

.view { width: 100%; max-width: 1180px; margin: 0 auto; padding: 30px clamp(16px, 4vw, 40px) 60px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head p { color: var(--muted); margin-top: 6px; max-width: 640px; }

/* ---------- Primitives ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-2-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
@media (max-width: 960px) { .g3, .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g-2-1, .g2 { grid-template-columns: 1fr; } }
@media (max-width: 520px) { .g3 { grid-template-columns: 1fr; } }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spacer { flex: 1; }
.mt { margin-top: 16px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px; border-radius: 11px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-weight: 600; cursor: pointer;
  transition: transform .08s, background .15s, border-color .15s, box-shadow .15s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; border-color: transparent; box-shadow: 0 6px 18px -6px var(--accent); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.danger { color: var(--bad); }
.btn.lg { padding: 13px 22px; font-size: 16px; border-radius: 13px; }
.btn.sq { padding: 10px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn:focus-visible, .seg button:focus-visible, .nav a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.seg { display: inline-flex; padding: 3px; background: var(--surface-2); border-radius: 11px; border: 1px solid var(--border); gap: 2px; }
.seg button {
  border: 0; background: transparent; padding: 6px 13px; border-radius: 8px; cursor: pointer;
  color: var(--muted); font-weight: 600; font-size: 14px;
}
.seg button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.seg.sm button { padding: 4px 10px; font-size: 13px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .lbl { font-size: 13px; font-weight: 600; color: var(--muted); }
.input, select.input, textarea.input {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface-2); outline: none; transition: border-color .15s, box-shadow .15s;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea.input { resize: vertical; min-height: 140px; line-height: 1.6; }

.switch { position: relative; width: 42px; height: 24px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; background: var(--surface-3); border-radius: 99px; cursor: pointer; transition: background .2s; }
.switch span::after { content: ''; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--border); font-size: 13px; font-weight: 550; }
.chip.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.chip.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.chip.acc { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.chip.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.kcap { display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding: 0 6px; border-radius: 7px; background: var(--surface-2); border: 1px solid var(--border); border-bottom-width: 2px; font: 700 13px var(--font); }
.kcap.focus { background: var(--accent); color: #fff; border-color: transparent; }

.empty { padding: 28px; text-align: center; color: var(--muted); font-size: 14px; }
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.bar { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .4s; }

/* ---------- Dashboard ---------- */
.hero {
  position: relative; overflow: hidden; padding: 28px; border-radius: 22px; color: #fff;
  background: radial-gradient(120% 140% at 100% 0%, #8f6bff 0%, transparent 55%), linear-gradient(135deg, #3546d6, #5a3fd8 60%, #2a2f8f);
  box-shadow: 0 18px 40px -18px rgba(70, 70, 220, .7);
}
.hero h1 { color: #fff; }
.hero p { color: rgba(255,255,255,.82); margin-top: 8px; max-width: 520px; }
.hero .btn { border-color: rgba(255,255,255,.25); background: rgba(255,255,255,.12); color: #fff; }
.hero .btn:hover { background: rgba(255,255,255,.2); }
.hero .btn.white { background: #fff; color: #2c35b5; border-color: #fff; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px; align-items: center; }
.hero-keys { position: absolute; right: -30px; bottom: -40px; opacity: .1; font: 800 160px/1 var(--mono); letter-spacing: -.05em; pointer-events: none; }
@media (max-width: 700px) { .hero-grid { grid-template-columns: 1fr; } }
.ring { position: relative; width: 132px; height: 132px; }
.ring svg { transform: rotate(-90deg); }
.ring .ring-txt { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring b { font-size: 26px; font-weight: 800; line-height: 1; }
.ring small { font-size: 12px; opacity: .8; }

.stat { display: flex; flex-direction: column; gap: 4px; }
.stat .v { font-size: 28px; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; }
.stat .l { font-size: 13px; color: var(--muted); font-weight: 550; display: flex; align-items: center; gap: 6px; }
.stat .s { font-size: 12px; color: var(--muted); }
.stat-ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); margin-bottom: 8px; }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.tile {
  display: flex; flex-direction: column; gap: 10px; padding: 18px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border); transition: transform .15s, border-color .15s, box-shadow .15s;
}
.tile:hover { transform: translateY(-2px); border-color: var(--accent); box-shadow: var(--shadow); }
.tile .t-ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: #fff; }
.tile p { color: var(--muted); font-size: 13.5px; }

.rank-badge { width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; color: #fff; flex: none; box-shadow: inset 0 -4px 0 rgba(0,0,0,.18); }
.ranks { display: flex; gap: 6px; margin-top: 14px; }
.ranks > div { flex: 1; text-align: center; font-size: 11px; color: var(--muted); }
.ranks > div i { display: block; height: 6px; border-radius: 99px; margin-bottom: 6px; background: var(--surface-3); }
.ranks > div.on i { background: var(--c); }
.ranks > div.on { color: var(--text); font-weight: 600; }

.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.list-item:last-child { border-bottom: 0; }
.list-item .grow { flex: 1; min-width: 0; }
.dbk-pill { font: 800 15px var(--font); padding: 4px 10px; border-radius: 9px; background: var(--accent-soft); color: var(--accent); min-width: 56px; text-align: center; }

/* ---------- Typer ---------- */
.typer { display: flex; flex-direction: column; gap: 14px; }
.hud { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.hud-item { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; display: flex; flex-direction: column; }
.hud-v { font: 800 26px/1.15 var(--font); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.hud-v.warn { color: var(--bad); animation: pulse 1s infinite; }
.hud-l { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
@keyframes pulse { 50% { opacity: .55; } }
@media (max-width: 600px) { .hud { grid-template-columns: repeat(2, 1fr); } .hud-v { font-size: 22px; } }

.words-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 18px 22px; box-shadow: var(--shadow); cursor: text; position: relative; }
.words-box { font-family: var(--type-font); font-size: var(--fs, 26px); line-height: 1.95; height: calc(3 * 1.95em); overflow: hidden; }
.words-inner { position: relative; transition: transform .18s ease; }
.word { display: inline-block; margin-right: .5em; padding: 0 .18em; border-radius: 7px; color: var(--muted); line-height: 1.5; vertical-align: baseline; }
.word.cur { color: var(--text); }
.hl-box .word.cur { background: var(--accent-soft); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--accent) 45%, transparent); }
.hl-box .word.cur.bad { background: var(--bad-soft); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--bad) 45%, transparent); }
.hl-underline .word.cur { box-shadow: inset 0 -2.5px 0 var(--accent); border-radius: 0; }
.hl-underline .word.cur.bad { box-shadow: inset 0 -2.5px 0 var(--bad); }
.word.ok { color: var(--ok); }
.word.no { color: var(--bad); text-decoration: underline wavy color-mix(in srgb, var(--bad) 60%, transparent); text-underline-offset: 5px; }
.l.ok { color: var(--ok); }
.l.no { color: var(--bad); background: var(--bad-soft); border-radius: 3px; }
.l.caret, .caret-end { position: relative; }
.l.caret::before, .caret-end::before {
  content: ''; position: absolute; left: -1px; top: 12%; bottom: 12%; width: 2px; border-radius: 2px; background: var(--accent);
  animation: blink 1s steps(1) infinite;
}
.caret-end { display: inline-block; width: 0; }
.typing .l.caret::before, .typing .caret-end::before { animation: none; }
@keyframes blink { 50% { opacity: 0; } }

.typer-bar { display: flex; gap: 10px; }
.typer-input {
  flex: 1; min-width: 0; font: 500 22px var(--type-font); padding: 13px 16px; border-radius: 14px;
  border: 2px solid var(--border); background: var(--surface); outline: none; transition: border-color .15s, box-shadow .15s;
}
.typer-input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.typer-input.bad { border-color: var(--bad); box-shadow: 0 0 0 4px var(--bad-soft); }
.typer-input:disabled { opacity: .6; }
.typer-tip { font-size: 13px; color: var(--muted); display: flex; gap: 14px; flex-wrap: wrap; }

.overlay-count {
  position: absolute; inset: 0; display: grid; place-items: center; border-radius: inherit;
  background: color-mix(in srgb, var(--surface) 82%, transparent); backdrop-filter: blur(3px);
  font: 800 72px var(--font); color: var(--accent); z-index: 2;
}

/* ---------- Keyboard ---------- */
.kb-card { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 18px 12px 14px; }
.kb {
  --u: min(44px, calc((100vw - 92px) / 15.4)); --g: clamp(3px, .6vw, 6px);
  display: flex; flex-direction: column; gap: var(--g); align-items: center; user-select: none;
}
@media (min-width: 961px) { .kb { --u: min(44px, calc((100vw - 340px) / 15.4)); } }
.kb-row { display: flex; gap: var(--g); }
.key {
  --fc: var(--accent);
  width: var(--u); height: var(--u); border-radius: calc(var(--u) * .2);
  display: grid; place-items: center; position: relative;
  background: var(--surface-2); border: 1px solid var(--border); border-bottom-width: 3px;
  font: 650 calc(var(--u) * .36) var(--font); color: var(--muted);
  transition: background .12s, color .12s, transform .08s, opacity .2s;
}
.key.mod { font-size: calc(var(--u) * .27); font-weight: 600; }
.key.w125 { width: calc(var(--u) * 1.25 + var(--g) * .25); }
.key.w15 { width: calc(var(--u) * 1.5 + var(--g) * .5); }
.key.w175 { width: calc(var(--u) * 1.75 + var(--g) * .75); }
.key.w2 { width: calc(var(--u) * 2 + var(--g)); }
.key.w275 { width: calc(var(--u) * 2.75 + var(--g) * 1.75); }
.key.space { width: calc(var(--u) * 6.5 + var(--g) * 5.5); }
.key.bump::after { content: ''; position: absolute; bottom: 16%; width: 28%; height: 2px; border-radius: 2px; background: currentColor; opacity: .7; }
[data-f="lp"] { --fc: #f06aa9; } [data-f="lr"] { --fc: #f59a4a; } [data-f="lm"] { --fc: #e5b919; } [data-f="li"] { --fc: #3fbf6a; }
[data-f="ri"] { --fc: #1fb5c9; } [data-f="rm"] { --fc: #4f8cf7; } [data-f="rr"] { --fc: #9a73f5; } [data-f="rp"] { --fc: #d465e8; }
[data-f="th"] { --fc: #8a93ab; }
.kb.fingers .key[data-f] { background: color-mix(in srgb, var(--fc) 15%, var(--surface-2)); border-color: color-mix(in srgb, var(--fc) 30%, var(--border)); }
.key.dim { opacity: .3; }
.key.focus { color: var(--text); box-shadow: 0 0 0 2px var(--fc); }
.key.next { background: var(--fc) !important; color: #fff !important; border-color: transparent !important; box-shadow: 0 0 0 4px color-mix(in srgb, var(--fc) 30%, transparent); transform: translateY(1px); }
.key.hit { transform: translateY(2px); filter: brightness(1.15); }
.key.miss { background: var(--bad) !important; color: #fff !important; }
.kb-hint { text-align: center; font-size: 13px; color: var(--muted); margin-top: 12px; min-height: 20px; }
.kb-hint b { color: var(--text); }
.legend { display: flex; flex-wrap: wrap; gap: 8px 14px; justify-content: center; margin-top: 12px; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

/* ---------- Results ---------- */
.result-top { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 28px; align-items: center; }
@media (max-width: 700px) { .result-top { grid-template-columns: 1fr; } }
.big-score { text-align: center; padding: 18px 26px; border-radius: 20px; background: linear-gradient(160deg, var(--accent-soft), transparent); border: 1px solid var(--border); }
.big-score b { display: block; font: 800 72px/1 var(--font); letter-spacing: -.04em; background: linear-gradient(135deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.big-score span { font-size: 13px; font-weight: 700; color: var(--muted); letter-spacing: .06em; }
.metrics { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.metric { padding: 12px 14px; border-radius: 12px; background: var(--surface-2); }
.metric b { display: block; font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.metric span { font-size: 12px; color: var(--muted); font-weight: 600; }
.verdict { display: flex; gap: 12px; align-items: center; padding: 14px 16px; border-radius: 14px; font-weight: 600; }
.verdict.pass { background: var(--ok-soft); color: var(--ok); }
.verdict.fail { background: var(--bad-soft); color: var(--bad); }
.mist { display: flex; flex-wrap: wrap; gap: 8px; }
.mist .chip s { color: var(--bad); text-decoration-thickness: 1.5px; }
.chart { width: 100%; height: auto; display: block; }
.chart text { fill: var(--muted); font: 11px var(--font); }
.chart .grid-l { stroke: var(--border); stroke-dasharray: 3 4; }
.chart .ref-l { stroke: var(--warn); stroke-dasharray: 6 5; stroke-width: 1.5; }
.chart circle { fill: var(--surface); stroke-width: 2; }

/* ---------- Exam ---------- */
.ref-box { position: relative; max-height: 220px; overflow-y: auto; font: 19px/1.85 var(--type-font); padding: 18px 22px; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; scroll-behavior: smooth; }
.ref-box .rw { padding: 1px 2px; border-radius: 5px; }
.ref-box .rw.past { color: var(--muted); }
.ref-box .rw.cur { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.exam-area { width: 100%; min-height: 170px; font: 19px/1.7 var(--type-font); padding: 16px 18px; border-radius: 18px; border: 2px solid var(--border); background: var(--surface); outline: none; resize: vertical; }
.exam-area:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.exam-timer { font: 800 40px/1 var(--font); font-variant-numeric: tabular-nums; letter-spacing: -.03em; }
.diff { font: 16px/2 var(--type-font); }
.diff .d-eq { color: var(--ok); }
.diff .d-sub { color: var(--bad); text-decoration: line-through; }
.diff .d-fix { color: var(--ok); font-size: .82em; background: var(--ok-soft); border-radius: 4px; padding: 0 3px; margin-left: 2px; }
.diff .d-del { color: var(--warn); background: var(--warn-soft); border-radius: 4px; padding: 0 3px; text-decoration: underline dashed; }
.diff .d-ins { color: var(--bad); background: var(--bad-soft); border-radius: 4px; padding: 0 3px; }

/* ---------- Lessons ---------- */
.lesson-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.lesson { display: flex; flex-direction: column; gap: 12px; padding: 18px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); transition: transform .15s, border-color .15s; }
.lesson:hover { transform: translateY(-2px); border-color: var(--accent); }
.lesson .num { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; font-weight: 800; font-size: 14px; background: var(--surface-2); }
.lesson.done .num { background: var(--ok-soft); color: var(--ok); }
.stars { display: flex; gap: 2px; color: var(--surface-3); }
.stars .on { color: #f5b301; }
.keys { display: flex; flex-wrap: wrap; gap: 5px; }

/* ---------- Duel ---------- */
.opps { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.opp { text-align: left; padding: 16px; border-radius: 14px; border: 2px solid var(--border); background: var(--surface); cursor: pointer; display: flex; flex-direction: column; gap: 8px; transition: border-color .15s, transform .15s; }
.opp:hover { transform: translateY(-2px); }
.opp.on { border-color: var(--accent); background: var(--accent-soft); }
.avatar { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-weight: 800; color: #fff; }
.lane { position: relative; height: 58px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; }
.lane::after { content: ''; position: absolute; right: 52px; top: 0; bottom: 0; width: 6px; background: repeating-linear-gradient(0deg, var(--text) 0 6px, transparent 6px 12px); opacity: .25; }
.lane .fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--accent-soft); transition: width .15s linear; }
.lane .runner { position: absolute; top: 8px; left: calc((100% - 100px) * var(--p, 0) + 8px); transition: left .15s linear; display: flex; align-items: center; gap: 8px; white-space: nowrap; font-weight: 700; font-size: 13px; z-index: 1; }
.lane .runner .avatar { width: 40px; height: 40px; }

/* ---------- Stats ---------- */
.cal { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 1fr); gap: 4px; overflow-x: auto; padding-bottom: 4px; }
.cal i { width: 14px; height: 14px; border-radius: 4px; background: var(--surface-2); display: block; }
.cal i[data-l="1"] { background: color-mix(in srgb, var(--accent) 30%, var(--surface-2)); }
.cal i[data-l="2"] { background: color-mix(in srgb, var(--accent) 55%, var(--surface-2)); }
.cal i[data-l="3"] { background: color-mix(in srgb, var(--accent) 80%, var(--surface-2)); }
.cal i[data-l="4"] { background: var(--accent); }
.cal i.future { visibility: hidden; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 650; text-transform: uppercase; letter-spacing: .05em; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.tbl td { padding: 10px; border-bottom: 1px solid var(--border); font-variant-numeric: tabular-nums; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl-wrap { overflow-x: auto; }
.kb.heat .key { transition: none; }

/* ---------- Guide ---------- */
details.acc { border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
details.acc + details.acc { margin-top: 8px; }
details.acc summary { cursor: pointer; padding: 14px 16px; font-weight: 600; list-style: none; display: flex; justify-content: space-between; gap: 10px; }
details.acc summary::-webkit-details-marker { display: none; }
details.acc summary::after { content: '+'; font-size: 20px; line-height: 1; color: var(--muted); }
details.acc[open] summary::after { content: '–'; }
details.acc p { padding: 0 16px 16px; color: var(--muted); }
.steps { counter-reset: s; display: flex; flex-direction: column; gap: 12px; }
.steps li { list-style: none; position: relative; padding-left: 40px; }
.steps li::before { counter-increment: s; content: counter(s); position: absolute; left: 0; top: -2px; width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 800; font-size: 14px; }
ul.clean { margin: 0; padding-left: 18px; color: var(--muted); }
ul.clean li + li { margin-top: 6px; }

/* ---------- Settings ---------- */
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.set-row:last-child { border-bottom: 0; }
.set-row .info b { display: block; font-weight: 600; }
.set-row .info span { font-size: 13px; color: var(--muted); }

#toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; background: var(--text); color: var(--bg); padding: 11px 18px; border-radius: 12px; font-weight: 600; font-size: 14px; transition: .25s; pointer-events: none; z-index: 100; box-shadow: var(--shadow); }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

.fade-in { animation: fadeIn .25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ================= v2: eğitim + üyelik ================= */
.btn.sq.on { background: var(--accent-soft); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }

/* Eller */
.hands { display: flex; justify-content: center; margin-top: 10px; }
.hands svg { width: min(400px, 92%); height: auto; }
.hands .palm { fill: var(--surface-3); }
.hands .fg { fill: color-mix(in srgb, var(--fc) 24%, var(--surface-3)); transition: fill .12s; }
.hands .fg.on { fill: var(--fc); filter: drop-shadow(0 0 7px var(--fc)); }

/* Ders aşamaları */
.stepper { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin-bottom: 18px; }
.step { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; text-align: left; min-width: 0; }
.step:hover { border-color: var(--accent); }
.step .n { width: 26px; height: 26px; flex: none; border-radius: 8px; display: grid; place-items: center; font-weight: 800; font-size: 13px; background: var(--surface-2); color: var(--muted); }
.step b { display: block; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.step small { display: block; font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.step.done .n { background: var(--ok-soft); color: var(--ok); }
.step.cur { border-color: var(--accent); background: var(--accent-soft); }
.step.cur .n { background: var(--accent); color: #fff; }
@media (max-width: 760px) { .stepper { grid-template-columns: repeat(5, 1fr); } .step { justify-content: center; padding: 8px; } .step div { display: none; } }

.finder { display: grid; place-items: center; gap: 10px; padding: 26px 20px; text-align: center; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow); outline: none; }
.finder:focus-visible { box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow); }
.finder .big { width: 110px; height: 110px; border-radius: 26px; display: grid; place-items: center; font: 800 58px var(--font); color: #fff; background: var(--fc, var(--accent)); box-shadow: inset 0 -6px 0 rgba(0,0,0,.18), 0 14px 30px -12px var(--fc, var(--accent)); transition: transform .1s; }
.finder .big.shake { animation: shake .3s; }
.finder .big.pop { transform: scale(1.08); }
@keyframes shake { 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
.finder .dots { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.finder .dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--surface-3); }
.finder .dots i.ok { background: var(--ok); } .finder .dots i.no { background: var(--bad); }
.tipbox { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 14px; background: var(--accent-soft); color: var(--text); font-size: 14px; }
.tipbox .ic { color: var(--accent); margin-top: 2px; }

/* Program */
.tasks { display: flex; flex-direction: column; gap: 8px; }
.task { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid transparent; transition: border-color .15s; }
a.task:hover { border-color: var(--accent); }
.task .chk { width: 24px; height: 24px; border-radius: 8px; flex: none; display: grid; place-items: center; border: 2px solid var(--border); color: transparent; }
.task.done .chk { background: var(--ok); border-color: var(--ok); color: #fff; }
.task.done b { text-decoration: line-through; color: var(--muted); }
.task .grow { flex: 1; min-width: 0; }
.days30 { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 6px; }
.days30 > div { aspect-ratio: 1; border-radius: 10px; display: grid; place-items: center; font-weight: 700; font-size: 13px; background: var(--surface-2); color: var(--muted); border: 2px solid transparent; }
.days30 .done { background: var(--ok); color: #fff; }
.days30 .part { background: var(--warn-soft); color: var(--warn); }
.days30 .miss { background: var(--bad-soft); color: var(--bad); }
.days30 .today { border-color: var(--accent); color: var(--accent); }
.level-pick { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 700px) { .level-pick { grid-template-columns: 1fr; } }

/* Dikte */
.speaker { display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-radius: 16px; background: var(--surface); border: 1px solid var(--border); }
.speaker .wave { display: flex; gap: 3px; align-items: center; height: 28px; }
.speaker .wave i { width: 4px; height: 6px; border-radius: 2px; background: var(--accent); }
.speaker.talking .wave i { animation: wave .9s ease-in-out infinite; }
.speaker.talking .wave i:nth-child(2) { animation-delay: .1s; } .speaker.talking .wave i:nth-child(3) { animation-delay: .2s; }
.speaker.talking .wave i:nth-child(4) { animation-delay: .3s; } .speaker.talking .wave i:nth-child(5) { animation-delay: .4s; }
@keyframes wave { 50% { height: 26px; } }

/* Hesap */
.auth-wrap { max-width: 440px; margin: 20px auto; }
.auth-wrap .card { padding: 28px; }
.auth-wrap h1 { text-align: center; }
.auth-wrap .sub { text-align: center; color: var(--muted); margin: 8px 0 22px; }
.form { display: flex; flex-direction: column; gap: 14px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; color: var(--muted); cursor: pointer; }
.check input { margin-top: 3px; accent-color: var(--accent); width: 16px; height: 16px; flex: none; }
.form-err { padding: 10px 12px; border-radius: 10px; background: var(--bad-soft); color: var(--bad); font-size: 14px; font-weight: 550; }
.form-err:empty { display: none; }
.side-acc { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 12px; background: var(--surface-2); }
.side-acc .avatar { width: 34px; height: 34px; border-radius: 10px; font-size: 14px; }
.side-acc .grow { flex: 1; min-width: 0; }
.side-acc b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-acc small { color: var(--muted); font-size: 12px; }
.sync-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); display: inline-block; margin-right: 4px; }
.sync-dot.busy { background: var(--warn); } .sync-dot.off { background: var(--muted); }
.lb-row { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto auto; gap: 12px; align-items: center; padding: 10px 6px; border-bottom: 1px solid var(--border); }
.lb-row:last-child { border-bottom: 0; }
.lb-row.me { background: var(--accent-soft); border-radius: 10px; }
.lb-pos { font-weight: 800; text-align: center; color: var(--muted); }
.lb-row:nth-child(1) .lb-pos { color: #e0a800; } .lb-row:nth-child(2) .lb-pos { color: #9aa6b8; } .lb-row:nth-child(3) .lb-pos { color: #c27a3e; }
.prose { color: var(--muted); } .prose h3 { color: var(--text); margin: 18px 0 8px; } .prose p + p { margin-top: 8px; }
[hidden] { display: none !important; }
@media (max-width: 520px) { .finder .big { width: 90px; height: 90px; font-size: 46px; } }

/* ================= v3: düello, odalar, davetler, klasik sınav, rozetler ================= */
.avatar.sm { width: 32px; height: 32px; border-radius: 10px; font-size: 13px; flex: none; }
.duel-modes { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 14px; }
@media (max-width: 900px) { .duel-modes { grid-template-columns: 1fr; } }
.duel-mode { display: flex; flex-direction: column; gap: 12px; padding: 20px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); transition: transform .15s, border-color .15s; }
.duel-mode:hover { transform: translateY(-2px); border-color: var(--accent); }
.duel-mode .t-ic { width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; color: #fff; }
.duel-mode p { color: var(--muted); font-size: 14px; margin-top: 4px; }
.duel-mode.hero-mode { background: radial-gradient(120% 140% at 100% 0%, rgba(219,39,119,.22), transparent 60%), var(--surface); }
.duel-mode .btn { align-self: flex-start; margin-top: auto; }

.mm { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px; padding: 34px 20px; }
.mm-pulse { width: 84px; height: 84px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, #db2777, var(--accent-2)); animation: mmp 1.6s ease-out infinite; }
@keyframes mmp { 0% { box-shadow: 0 0 0 0 rgba(219,39,119,.5); } 100% { box-shadow: 0 0 0 26px rgba(219,39,119,0); } }
.mm-found { display: flex; flex-direction: column; gap: 8px; width: min(420px, 100%); }
.opp-card { display: flex; gap: 12px; align-items: center; text-align: left; padding: 12px 14px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); }

.race-board { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; }
.rb-row { display: grid; grid-template-columns: 30px 32px minmax(0, 1fr); gap: 10px; align-items: center; padding: 4px 0; }
.rb-row.you .rb-main b { color: var(--accent); }
.rb-row.off { opacity: .5; }
.rb-place { text-align: center; font-weight: 800; }
.rb-top { display: flex; align-items: center; gap: 8px; font-size: 14px; min-width: 0; }
.rb-top b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rb-bar { height: 7px; margin-top: 5px; }
.rb-bar > i { transition: width .25s linear; }
.room-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
@media (max-width: 1100px) { .room-grid { grid-template-columns: 1fr; } }

.chat { display: flex; flex-direction: column; gap: 10px; }
.chat-log { height: 220px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; padding-right: 4px; font-size: 14px; }
.msg { line-height: 1.4; overflow-wrap: anywhere; }
.msg b { color: var(--accent); }
.msg.sys { color: var(--muted); font-size: 12.5px; font-style: italic; }
.chat-form { display: flex; gap: 8px; }

.nbadge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: #db2777; color: #fff; font: 700 12px/20px var(--font); text-align: center; font-style: normal; }
#invitePops { position: fixed; right: 18px; bottom: 18px; z-index: 90; display: flex; flex-direction: column; gap: 10px; width: min(340px, calc(100vw - 36px)); }
.inv-pop { background: var(--surface); border: 1px solid var(--accent); border-radius: 16px; padding: 14px; box-shadow: 0 18px 40px -12px rgba(0,0,0,.45); font-size: 14px; }

.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.badge { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; padding: 14px 10px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); filter: grayscale(1); opacity: .45; }
.badge.got { filter: none; opacity: 1; border-color: color-mix(in srgb, #f5b301 45%, var(--border)); background: linear-gradient(160deg, rgba(245,179,1,.1), var(--surface-2)); }
.badge .be { font-size: 30px; line-height: 1.1; }
.badge b { font-size: 13.5px; }
.badge small { font-size: 11.5px; color: var(--muted); line-height: 1.3; }

/* Klasik sınav ekranı: sitenin temasından bağımsız, sade masaüstü program görünümü */
body.exam-focus .sidebar { display: none; }
body.exam-focus .app { grid-template-columns: minmax(0, 1fr); }
body.exam-focus .view { max-width: 1000px; }
.classic { --cl-bg: #ece9e6; color: #111; background: var(--cl-bg); border: 1px solid #8a8a8a; border-radius: 6px; overflow: hidden; font: 14px Tahoma, 'Segoe UI', Arial, sans-serif; box-shadow: 0 10px 30px rgba(0,0,0,.35); color-scheme: light; }
.cl-titlebar { display: flex; justify-content: space-between; align-items: center; padding: 7px 12px; color: #fff; font-weight: 700; background: linear-gradient(#3a6fc4, #2453a3); letter-spacing: .01em; }
.cl-ctl { opacity: .85; letter-spacing: 6px; }
.cl-info { display: flex; flex-wrap: wrap; gap: 6px 22px; padding: 10px 14px; border-bottom: 1px solid #c5c2bd; background: #f7f6f4; }
.cl-timer { margin-left: auto; }
.cl-timer b { font: 700 18px 'Courier New', monospace; color: #b00000; }
.cl-timer b.bad-t { color: #ff0000; }
.cl-group { margin: 10px 14px; border: 1px solid #b4b1ab; border-radius: 3px; padding: 8px 10px 10px; }
.cl-group legend { padding: 0 4px; color: #1d3f7a; font-weight: 700; }
.cl-ref { position: relative; background: #fff; border: 1px solid #7f9db9; height: 200px; overflow-y: auto; padding: 8px 10px; font: 17px/1.7 Arial, sans-serif; color: #000; }
.cl-ref .rw.cur, .cl-ref .rw.past { background: none; color: inherit; font-weight: normal; }
.cl-area { width: 100%; height: 190px; resize: none; background: #fff; color: #000; border: 1px solid #7f9db9; padding: 8px 10px; font: 17px/1.7 Arial, sans-serif; outline: none; border-radius: 0; }
.cl-area:focus { border-color: #3a6fc4; }
.cl-area:disabled { background: #f4f4f4; }
.cl-cd { background: rgba(236,233,230,.85) !important; color: #2453a3 !important; border-radius: 0 !important; backdrop-filter: none !important; }
.cl-status { display: flex; align-items: center; gap: 10px; padding: 8px 14px 12px; color: #333; font-size: 13px; }
.cl-btn { font: 13px Tahoma, 'Segoe UI', Arial, sans-serif; padding: 6px 18px; border: 1px solid #707070; border-radius: 3px; background: linear-gradient(#fdfdfd, #e3e3e3); color: #111; cursor: pointer; }
.cl-btn:hover { background: linear-gradient(#eaf4fd, #cfe6fb); border-color: #3c7fb1; }

/* ================= Mobil: üst çubuk + ☰ ile sağdan açılan menü ================= */
@media (max-width: 960px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: sticky; top: 0; z-index: 30; height: auto; min-width: 0;
    flex-direction: row; align-items: center; gap: 10px;
    padding: 10px 14px; border-right: 0; border-bottom: 1px solid var(--border);
    background: var(--surface); /* not: backdrop-filter kullanma — içindeki sabit konumlu menüyü çubuğa hapseder */
  }
  .brand { flex: none; padding: 0; } .brand b { white-space: nowrap; } .brand small { display: none; }
  .mob-actions { display: flex; gap: 8px; margin-left: auto; align-items: center; }
  .mob-actions .btn { padding: 8px 12px; font-size: 14px; border-radius: 10px; }
  .mob-actions .avatar { width: 34px; height: 34px; border-radius: 10px; font-size: 14px; }
  .menu-btn { display: grid; place-items: center; width: 42px; height: 42px; flex: none; border-radius: 11px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; }
  .menu-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
  .drawer {
    position: fixed; top: 0; right: 0; bottom: 0; z-index: 60; width: min(320px, 86vw);
    padding: 14px 14px 24px; background: var(--surface); border-left: 1px solid var(--border);
    box-shadow: -18px 0 40px rgba(0,0,0,.25); transform: translateX(105%); transition: transform .25s ease; visibility: hidden;
  }
  body.nav-open .drawer { transform: none; visibility: visible; }
  .drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 0 4px 0 10px; }
  .drawer-head b { font-size: 17px; }
  .nav-backdrop { display: block; position: fixed; inset: 0; z-index: 25; /* üst çubuğun (z 30) ve içindeki menünün altında kalsın */ background: rgba(10, 13, 22, .45); opacity: 0; pointer-events: none; transition: opacity .25s; }
  body.nav-open .nav-backdrop { opacity: 1; pointer-events: auto; }
  body.nav-open { overflow: hidden; }
  .nav a { padding: 11px 12px; font-size: 15px; }
  .side-foot { margin-top: 8px; }
}
@media (max-width: 380px) { .mob-actions .btn.ghost-sm { display: none; } }
.auth-cta { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); }
.auth-cta > .row:first-child { flex: 1; min-width: 240px; }
@media (max-width: 600px) { .auth-cta-btns { width: 100%; } .auth-cta-btns .btn { flex: 1; } }
