:root {
  --bg: #0d1330;
  --bg2: #121a3d;
  --card: #18214a;
  --card2: #1f2a5a;
  --line: #2b3770;
  --text: #eef1ff;
  --muted: #9aa5d1;
  --lime: #a3e635;
  --green: #34d399;
  --orange: #fb923c;
  --cyan: #38d6ff;
  --violet: #a78bfa;
  --yellow: #fcd34d;
  --red: #fb7185;
  --radius: 16px;
  --font: 'Lexend', system-ui, -apple-system, sans-serif;
  --display: 'Russo One', 'Lexend', sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
html { scrollbar-color: #2b3770 transparent; }
body {
  background: radial-gradient(1200px 600px at 80% -10%, #22306b 0%, transparent 60%), var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-size: 28px; font-weight: 700; }
h2 { font-size: 20px; font-weight: 700; }
p { line-height: 1.5; }
.muted { color: var(--muted); }
small { font-size: 13px; }
button { font: inherit; color: inherit; }

kbd {
  display: inline-block;
  font: 600 12px/1 var(--font);
  padding: 4px 7px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-bottom-width: 2px;
  color: var(--text);
  vertical-align: middle;
}

/* ---------- buttons, cards, chips ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  padding: 12px 20px; border-radius: 12px; border: 0; cursor: pointer;
  font-weight: 700; font-size: 16px; background: var(--card2); color: var(--text);
  transition: transform .12s, filter .12s, background .12s;
}
.btn:hover { transform: translateY(-1px); filter: brightness(1.1); }
.btn.primary { background: linear-gradient(180deg, #b9f45a, #84cc16); color: #13210a; box-shadow: 0 6px 0 #4d7c0f; }
.btn.primary:active { transform: translateY(3px); box-shadow: 0 3px 0 #4d7c0f; }
.btn.primary kbd { background: rgba(0,0,0,.15); border-color: rgba(0,0,0,.2); color: #13210a; }
.btn.ghost { background: transparent; border: 2px solid var(--line); }
.btn.danger { background: #e11d48; }
.btn.small { padding: 8px 14px; font-size: 14px; }
.danger-text { color: var(--red); }

.card {
  background: linear-gradient(180deg, var(--card), #161e44);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}
.chip { padding: 6px 10px; border-radius: 999px; background: var(--card2); font-weight: 700; font-size: 14px; }
.avatar {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
  background: linear-gradient(135deg, #2c3b80, #1b2456); font-size: 22px; flex: none;
}
.avatar.sm { width: 32px; height: 32px; font-size: 18px; }
.avatar.xl { width: 72px; height: 72px; font-size: 40px; }

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; gap: 24px; padding: 12px 28px;
  border-bottom: 1px solid var(--line); background: rgba(13, 19, 48, .85);
  backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 10;
}
.brand { font-family: var(--display); font-size: 22px; letter-spacing: .5px; display: flex; align-items: center; gap: 8px; }
.brand span:last-child { color: var(--lime); }
.nav { display: flex; gap: 4px; flex: 1; }
.nav-link { padding: 8px 14px; border-radius: 10px; color: var(--muted); font-weight: 600; }
.nav-link:hover { color: var(--text); background: var(--card); }
.nav-link.active { color: var(--text); background: var(--card2); }
.top-right { display: flex; align-items: center; gap: 10px; }
.icon-btn { background: var(--card2); border: 0; border-radius: 10px; width: 38px; height: 34px; cursor: pointer; font-size: 16px; }
.me { display: flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); }
.me-text { display: flex; flex-direction: column; line-height: 1.1; }
.me-text b { font-size: 14px; }
.me-text small { font-size: 11px; color: var(--muted); }

.page { max-width: 1080px; margin: 0 auto; padding: 28px 24px 60px; display: flex; flex-direction: column; gap: 20px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; }
.page-head p { margin: 6px 0 0; }

/* ---------- profiles ---------- */
.center-page { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px 16px; gap: 12px; }
.logo-big { font-family: var(--display); font-size: 56px; letter-spacing: 1px; }
.logo-big em { font-style: normal; color: var(--lime); }
.tagline { color: var(--muted); font-size: 18px; margin: 0 0 18px; }
.who { margin-bottom: 8px; }
.profile-grid { display: flex; flex-wrap: wrap; gap: 16px; justify-content: center; }
.profile-card {
  width: 160px; padding: 22px 12px; display: flex; flex-direction: column; align-items: center; gap: 8px;
  background: var(--card); border: 2px solid var(--line); border-radius: 20px; cursor: pointer; transition: transform .15s, border-color .15s;
}
.profile-card:hover { transform: translateY(-4px); border-color: var(--lime); }
.profile-card b { font-size: 18px; }
.profile-card small { color: var(--muted); }
.profile-card.add .avatar { background: transparent; border: 2px dashed var(--line); color: var(--muted); }
.new-player { width: min(480px, 100%); display: flex; flex-direction: column; gap: 18px; }
.field { display: flex; flex-direction: column; gap: 8px; font-weight: 600; }
.field input {
  font: 600 20px var(--font); padding: 12px 14px; border-radius: 12px; border: 2px solid var(--line);
  background: var(--bg); color: var(--text); outline: none;
}
.field input:focus { border-color: var(--lime); }
.avatar-pick { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.avatar-opt { font-size: 26px; padding: 8px 0; border-radius: 12px; border: 2px solid var(--line); background: var(--bg); cursor: pointer; }
.avatar-opt.on { border-color: var(--lime); background: var(--card2); }
.row-end { display: flex; justify-content: flex-end; gap: 10px; }

/* ---------- home ---------- */
.hero { display: flex; justify-content: space-between; align-items: center; gap: 24px; flex-wrap: wrap; }
.hero-left { display: flex; gap: 18px; align-items: center; flex: 1; min-width: 280px; }
.hero-left > div { flex: 1; }
.level-line { margin: 6px 0 8px; color: var(--yellow); }
.xpbar { height: 12px; background: var(--bg); border-radius: 999px; overflow: hidden; margin-bottom: 6px; max-width: 360px; }
.xpbar i { display: block; height: 100%; background: linear-gradient(90deg, var(--yellow), var(--orange)); border-radius: 999px; }
.hero-right { display: flex; align-items: center; gap: 18px; }
.ring { position: relative; width: 92px; height: 92px; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 9; }
.ring-bg { stroke: var(--bg); }
.ring-fg { stroke: var(--lime); stroke-linecap: round; transition: stroke-dashoffset .8s; }
.ring-label { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; line-height: 1.1; }
.ring-label b { font-size: 24px; }
.ring-label small { font-size: 11px; color: var(--muted); }
.hero-mini { display: flex; flex-direction: column; gap: 10px; }
.hero-mini div { display: flex; flex-direction: column; }
.hero-mini small { color: var(--muted); }

.continue { display: flex; align-items: center; gap: 20px; border-color: #4d6b1a; background: linear-gradient(120deg, #1c2a4f, #1d3527); transition: transform .15s; }
.continue:hover { transform: translateY(-2px); }
.continue-num {
  width: 64px; height: 64px; border-radius: 18px; display: grid; place-items: center; flex: none;
  font-family: var(--display); font-size: 30px; background: var(--lime); color: #13210a;
}
.continue-body { flex: 1; }
.continue-body small { color: var(--lime); font-weight: 700; text-transform: uppercase; letter-spacing: .5px; font-size: 12px; }
.continue-body h2 { font-size: 24px; margin: 4px 0; }
.continue-body p { margin: 0; }
.continue-go { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; text-align: right; }

.game-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.game-card {
  border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: var(--card);
  display: flex; flex-direction: column; transition: transform .15s, box-shadow .15s;
}
.game-card:hover { transform: translateY(-4px); }
.race-card:hover { box-shadow: 0 10px 40px -10px var(--orange); }
.space-card:hover { box-shadow: 0 10px 40px -10px var(--cyan); }
.gc-art { height: 150px; position: relative; overflow: hidden; }
.race-card .gc-art { background: linear-gradient(180deg, #ff7e5f 0%, #feb47b 45%, #3a9d3a 45%); }
.gc-road { position: absolute; left: 50%; bottom: 0; width: 70%; height: 55%; transform: translateX(-50%); background: #4b5563; clip-path: polygon(44% 0, 56% 0, 100% 100%, 0 100%); }
.gc-road::after { content: ''; position: absolute; left: 50%; top: 0; bottom: 0; width: 4px; transform: translateX(-50%); background: repeating-linear-gradient(#fff 0 12px, transparent 12px 24px); animation: road 0.6s linear infinite; }
@keyframes road { to { background-position: 0 24px; } }
.gc-car { position: absolute; left: 50%; bottom: 6px; transform: translateX(-50%) scaleX(-1); font-size: 52px; }
.gc-bug { position: absolute; left: 62%; top: 16px; font-size: 28px; animation: bug 2.4s ease-in-out infinite; }
@keyframes bug { 0%, 100% { transform: translate(0, 0) rotate(0); } 50% { transform: translate(-30px, 20px) rotate(-30deg); } }
.space-card .gc-art { background: radial-gradient(circle at 50% 160%, #2563eb 0 35%, transparent 36%), radial-gradient(#fff 1px, transparent 1.5px) 0 0/34px 34px, linear-gradient(#070b24, #1a1150); }
.gc-ship { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%) rotate(-45deg); font-size: 44px; }
.gc-meteor { position: absolute; font-size: 32px; animation: fall 3s linear infinite; }
.gc-meteor.m1 { left: 20%; }
.gc-meteor.m2 { left: 70%; animation-delay: -1.5s; font-size: 24px; }
@keyframes fall { from { top: -40px; transform: rotate(200deg); } to { top: 150px; transform: rotate(200deg); } }
.gc-body { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 6px; }
.gc-body h3 { font-family: var(--display); font-size: 26px; letter-spacing: .5px; }
.race-card h3 { color: var(--orange); }
.space-card h3 { color: var(--cyan); }
.gc-body p { margin: 0; color: var(--muted); }
.gc-meta { font-size: 13px; font-weight: 600; margin-top: 4px; }

.quick-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.qs { display: flex; flex-direction: column; gap: 4px; padding: 16px 20px; }
.qs b { font-size: 30px; }
.qs b small { font-size: 16px; color: var(--muted); }
.qs span { color: var(--muted); font-size: 14px; }

/* ---------- lesson map ---------- */
.head-stats { display: flex; gap: 24px; }
.head-stats div { display: flex; flex-direction: column; align-items: flex-end; }
.head-stats b { font-size: 22px; }
.head-stats small { color: var(--muted); }
.progress-line { height: 8px; background: var(--card); border-radius: 999px; overflow: hidden; }
.progress-line i { display: block; height: 100%; background: linear-gradient(90deg, var(--lime), var(--green)); }
.drill-card { display: flex; align-items: center; gap: 16px; border-color: #7c4a1b; }
.drill-card > div:nth-child(2) { display: flex; flex-direction: column; flex: 1; }
.drill-icon { font-size: 30px; }
.drill-keys { display: flex; gap: 6px; }
.drill-keys kbd { font-size: 16px; padding: 6px 10px; }
.lesson-section h2 { margin: 8px 0 12px; display: flex; gap: 8px; align-items: center; }
.lesson-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.lesson-tile {
  position: relative; display: flex; flex-direction: column; gap: 8px; padding: 14px 16px; border-radius: 14px;
  background: var(--card); border: 2px solid var(--line); transition: transform .15s, border-color .15s;
}
a.lesson-tile:hover { transform: translateY(-3px); border-color: var(--violet); }
.lesson-tile.passed { border-color: #3b4f8f; }
.lesson-tile.next { border-color: var(--lime); box-shadow: 0 0 0 4px rgba(163, 230, 53, .15); }
.lesson-tile.locked { opacity: .45; }
.lt-top { display: flex; justify-content: space-between; align-items: center; }
.lt-num { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--card2); font-weight: 800; }
.lesson-tile.passed .lt-num { background: var(--violet); color: #1a1240; }
.lt-keys { display: flex; gap: 4px; min-height: 26px; align-items: center; flex-wrap: wrap; }
.lt-badge { position: absolute; top: -10px; right: 12px; background: var(--lime); color: #13210a; font-size: 11px; font-weight: 800; padding: 3px 8px; border-radius: 999px; text-transform: uppercase; }
.stars { display: inline-flex; gap: 1px; }
.star { color: #3a4577; font-size: 18px; }
.star.on { color: var(--yellow); text-shadow: 0 0 8px rgba(252, 211, 77, .5); }

/* ---------- lesson player ---------- */
.lesson-screen, .game-screen { height: 100vh; display: flex; flex-direction: column; }
.game-top { display: flex; align-items: center; gap: 20px; padding: 12px 24px; border-bottom: 1px solid var(--line); background: rgba(13, 19, 48, .9); }
.back { color: var(--muted); font-weight: 600; display: flex; gap: 8px; align-items: center; white-space: nowrap; }
.back:hover { color: var(--text); }
.lesson-title { flex: 1; display: flex; flex-direction: column; text-align: center; }
.lesson-title small { color: var(--muted); }
.lesson-title b { font-size: 18px; }
.live-stats { display: flex; gap: 16px; align-items: baseline; }
.live-stats b { font-size: 22px; }
.lesson-body { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 16px 24px 12px; overflow: auto; }
.part-steps { display: flex; gap: 8px; align-items: center; font-size: 14px; flex-wrap: wrap; justify-content: center; }
.part-steps i { width: 24px; height: 2px; background: var(--line); }
.step { padding: 6px 12px; border-radius: 999px; background: var(--card); color: var(--muted); font-weight: 600; }
.step.on { background: var(--violet); color: #1a1240; }
.step.done { color: var(--green); }
.type-panel { width: min(900px, 100%); min-height: 150px; display: flex; align-items: center; justify-content: center; padding: 22px 28px; }
.intro { display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.intro-keys { display: flex; gap: 14px; }
.big-key {
  min-width: 64px; height: 64px; padding: 0 14px; border-radius: 14px; display: grid; place-items: center;
  font-size: 32px; font-weight: 800; background: var(--card2); border: 2px solid var(--violet); border-bottom-width: 5px;
}
.big-key.wide { font-size: 22px; }
.intro-tip { margin: 0; font-size: 18px; max-width: 560px; }
.finger-hint { font-weight: 600; color: var(--yellow); min-height: 22px; text-align: center; }
.kb-wrap { width: min(820px, 100%); }
.hands-wrap { width: min(440px, 80%, 52vh); margin-top: -4px; }

/* ---------- typed text ---------- */
.tv { font-size: 32px; font-weight: 500; letter-spacing: .5px; line-height: 1.7; user-select: none; }
.tv-wrap { width: 100%; max-height: 170px; overflow: hidden; white-space: pre-wrap; }
.tv-ticker { width: 100%; overflow: hidden; white-space: pre; position: relative; }
.tv-ticker .tv-track { display: inline-block; transition: transform .12s ease-out; will-change: transform; }
.ch { color: #c7cdf0; border-radius: 4px; position: relative; }
.ch.done { color: var(--green); }
.ch.fixed { color: var(--yellow); }
.ch.cur { background: rgba(163, 230, 53, .22); color: #fff; box-shadow: inset 0 -4px 0 var(--lime); }
.ch.sp.cur { background: rgba(163, 230, 53, .3); }
.ch.bad { animation: bad .3s; }
@keyframes bad {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-4px); background: rgba(251, 113, 133, .6); box-shadow: inset 0 -4px 0 var(--red); }
  60% { transform: translateX(4px); background: rgba(251, 113, 133, .6); }
}

/* ---------- keyboard ---------- */
.kb { display: flex; flex-direction: column; gap: 0; padding: 10px; background: #0a0f28; border-radius: 16px; border: 1px solid var(--line); }
.kb-row { display: flex; }
.kb-key { padding: 3px; }
.kb-cap {
  --fc: #64748b;
  height: clamp(30px, 5.2vh, 42px); border-radius: 8px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--fc) 16%, #1a2147); border: 1px solid color-mix(in srgb, var(--fc) 35%, transparent);
  border-bottom: 3px solid color-mix(in srgb, var(--fc) 30%, #0a0f28); font-weight: 600; font-size: 15px; color: #d6dcf7;
  position: relative; transition: background .1s, transform .1s; line-height: 1;
}
.kb-cap.kb-dead { background: #151b3b; border-color: #1f2750; color: #5d6797; }
.kb-cap.kb-word { font-size: 10px; color: #8d97c4; }
.kb-mod { align-items: flex-start; padding: 0 8px; justify-content: flex-end; padding-bottom: 6px; }
.kb-sub { font-size: 10px; color: #8d97c4; margin-bottom: 2px; }
.kb-bump::after { content: ''; position: absolute; bottom: 6px; width: 10px; height: 2px; border-radius: 2px; background: currentColor; opacity: .7; }
.kb-cap.kb-new { background: color-mix(in srgb, var(--fc) 45%, #1a2147); box-shadow: 0 0 0 2px var(--fc); color: #fff; }
.kb-cap.kb-lit {
  background: var(--fc); color: #0b1028; transform: translateY(1px); border-bottom-width: 2px;
  box-shadow: 0 0 18px var(--fc), 0 0 0 2px #fff;
}
.kb-cap.kb-lit .kb-sub { color: #0b1028; }
.kb-cap.kb-err { animation: kerr .3s; }
@keyframes kerr { 50% { box-shadow: 0 0 22px var(--red), 0 0 0 3px var(--red); } }
.kb-compact .kb-cap { height: 34px; font-size: 13px; }
.kb-heat .kb-cap:not(.kb-dead) { background: #1a2147; border-color: #2a3466; border-bottom-color: #10163a; }
.kb-heat .kb-cap.kb-hot { background: var(--heat); color: #2a1306; border-color: transparent; }
.kb-heat .kb-cap.kb-hot .kb-sub { color: #5a2d10; }

.hands svg { width: 100%; display: block; }
.hands .palm { fill: #283266; }
.hands [data-f] { opacity: .28; transition: opacity .1s; }
.hands:not(.active) [data-f] { opacity: .55; }
.hands [data-f].on { opacity: 1; stroke: #fff; stroke-width: 3; filter: drop-shadow(0 0 8px rgba(255, 255, 255, .5)); }

/* ---------- stats ---------- */
.who-head { display: flex; gap: 16px; align-items: center; }
.who-head p { margin: 4px 0 0; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.st { display: flex; flex-direction: column; gap: 4px; padding: 16px 18px; }
.st b { font-size: 26px; }
.st span { color: var(--muted); font-size: 13px; }
.stats section.card > h2 { margin-bottom: 4px; }
.stats section.card > p { margin: 0 0 12px; }
.sec-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.sec-head p { margin: 4px 0 12px; }
.empty { padding: 30px 0; text-align: center; }
.chart { position: relative; }
.chart svg { width: 100%; display: block; }
.chart .grid { stroke: #2a3466; stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart .line { fill: none; stroke: var(--lime); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: rgba(163, 230, 53, .1); }
.chart .dot { fill: var(--lime); stroke: var(--card); stroke-width: 2; }
.chart .dot-hi { fill: var(--lime); stroke: #fff; stroke-width: 2; pointer-events: none; }
.chart .cross { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; pointer-events: none; }
.chart .hit { fill: transparent; cursor: crosshair; }
.chart .tip {
  position: absolute; top: 0; width: 140px; padding: 8px 10px; border-radius: 10px; background: #0a0f28; border: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 2px; pointer-events: none; font-size: 13px;
}
.chart .tip small { color: var(--muted); }
.trouble-list { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 14px; }
.tk { display: flex; align-items: center; gap: 8px; background: var(--bg); padding: 6px 12px 6px 6px; border-radius: 10px; }
.tk kbd { font-size: 16px; padding: 6px 10px; }
.tk span { color: var(--muted); font-size: 14px; }
.kb-wrap.heat { width: 100%; max-width: 760px; }
.heat-legend { display: flex; align-items: center; gap: 4px; margin-top: 10px; font-size: 12px; color: var(--muted); }
.heat-legend i { width: 28px; height: 10px; border-radius: 3px; }
.heat-legend span:first-child { margin-right: 6px; }
.heat-legend span:last-child { margin-left: 6px; }
.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-top: 12px; }
.badge { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; padding: 14px 10px; border-radius: 14px; background: var(--bg); border: 1px solid var(--line); opacity: .4; filter: grayscale(1); }
.badge.got { opacity: 1; filter: none; border-color: #574a1a; background: linear-gradient(180deg, #2a2a3f, var(--bg)); }
.badge span { font-size: 32px; }
.badge b { font-size: 14px; }
.badge small { color: var(--muted); font-size: 11px; }
.settings { display: flex; flex-direction: column; gap: 14px; }
.toggle { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.toggle input { width: 20px; height: 20px; accent-color: var(--lime); }
.settings-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.small-print { font-size: 13px; margin: 0; }

/* ---------- modal + toasts ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(5, 8, 25, .72); display: grid; place-items: center; z-index: 50; animation: fade .2s; padding: 16px; backdrop-filter: blur(3px); }
@keyframes fade { from { opacity: 0; } }
.modal {
  width: min(520px, 100%); background: linear-gradient(180deg, #202b5e, var(--card)); border: 1px solid var(--line);
  border-radius: 22px; padding: 28px; text-align: center; animation: pop .35s cubic-bezier(.2, 1.4, .4, 1);
  max-height: calc(100vh - 32px); overflow: auto;
}
.modal.small { width: min(420px, 100%); }
@keyframes pop { from { transform: scale(.85); opacity: 0; } }
.modal h2 { font-size: 30px; font-family: var(--display); letter-spacing: .5px; }
.modal p { margin: 6px 0; }
.r-icon { font-size: 56px; line-height: 1; margin-bottom: 8px; }
.stars.big { margin: 10px 0; }
.stars.big .star { font-size: 52px; display: inline-block; }
.stars.big .star.on { animation: starpop .45s backwards; }
@keyframes starpop { from { transform: scale(0) rotate(-90deg); } 70% { transform: scale(1.3); } }
.r-stats { display: flex; justify-content: center; gap: 12px; margin: 14px 0; flex-wrap: wrap; }
.rs { background: rgba(0, 0, 0, .25); border-radius: 14px; padding: 12px 18px; min-width: 100px; display: flex; flex-direction: column; }
.rs b { font-size: 28px; }
.rs span { color: var(--muted); font-size: 13px; }
.r-note { color: var(--muted); }
.r-note b { color: var(--text); }
.xp-gain { display: inline-block; margin: 6px 0; padding: 6px 14px; border-radius: 999px; background: rgba(252, 211, 77, .15); color: var(--yellow); font-weight: 800; }
.level-up { margin: 10px 0; padding: 10px; border-radius: 12px; background: rgba(163, 230, 53, .12); color: var(--lime); }
.new-badges { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px; margin: 8px 0; }
.new-badge { display: flex; align-items: center; gap: 12px; text-align: left; padding: 10px 14px; border-radius: 12px; background: rgba(167, 139, 250, .15); }
.new-badge > span { font-size: 32px; }
.new-badge div { display: flex; flex-direction: column; }
.new-badge small { color: var(--muted); }
.r-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 18px; }
#toasts { position: fixed; top: 76px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 60; pointer-events: none; }
.toast { background: #0a0f28; border: 1px solid var(--line); border-left: 4px solid var(--lime); padding: 12px 16px; border-radius: 12px; font-weight: 600; animation: tin .3s; box-shadow: 0 10px 30px rgba(0, 0, 0, .4); }
.toast.warn { border-left-color: var(--orange); }
.toast.out { opacity: 0; transform: translateX(20px); transition: .4s; }
@keyframes tin { from { transform: translateX(40px); opacity: 0; } }

/* ---------- games ---------- */
.game-screen .game-top { justify-content: space-between; }
.hud { display: flex; gap: 10px; }
.hud-item { display: flex; flex-direction: column; align-items: center; padding: 4px 14px; border-radius: 10px; background: var(--card); min-width: 78px; }
.hud-item b { font-size: 22px; line-height: 1.1; }
.hud-item small { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .5px; }
.hud-item.place b { color: var(--yellow); }
.canvas-wrap { flex: 1; position: relative; min-height: 0; overflow: hidden; }
.canvas-wrap canvas { position: absolute; inset: 0; display: block; }
.overlay { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(8, 11, 30, .55); padding: 16px; overflow: auto; }
.overlay.hidden { display: none; }
.setup { width: min(640px, 100%); text-align: center; display: flex; flex-direction: column; gap: 14px; align-items: center; }
.setup h1 { font-family: var(--display); font-size: 44px; letter-spacing: 1px; }
.race-screen .setup h1 { color: var(--orange); }
.space-screen .setup h1 { color: var(--cyan); }
.how { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin: 0; padding: 0; list-style: none; }
.how li { background: rgba(0, 0, 0, .35); border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; font-size: 14px; }
.tiers { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; width: 100%; }
.tier {
  position: relative; padding: 12px 6px 10px; border-radius: 14px; border: 2px solid var(--line); background: var(--card); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 4px; transition: border-color .12s, transform .12s;
}
.tier:hover { transform: translateY(-2px); }
.tier.on { border-color: var(--lime); background: var(--card2); box-shadow: 0 0 0 4px rgba(163, 230, 53, .15); }
.tier span { font-size: 24px; }
.tier b { font-size: 14px; }
.tier small { font-size: 11px; color: var(--muted); }
.tier kbd { position: absolute; top: 6px; left: 6px; font-size: 10px; padding: 2px 5px; }
.tier .rec { position: absolute; top: -9px; right: 6px; background: var(--lime); color: #13210a; font-size: 10px; font-weight: 800; padding: 2px 6px; border-radius: 999px; }
.countdown { font-family: var(--display); font-size: 140px; color: #fff; text-shadow: 0 0 40px rgba(0, 0, 0, .6), 0 6px 0 rgba(0, 0, 0, .3); animation: cd .9s ease-out; }
.countdown.go { color: var(--lime); }
@keyframes cd { from { transform: scale(1.8); opacity: 0; } 30% { opacity: 1; } }
.pause-box { text-align: center; display: flex; flex-direction: column; gap: 16px; align-items: center; }
.pause-box h1 { font-family: var(--display); font-size: 48px; }
.pause-box .r-actions { margin: 0; }

.race-bottom { padding: 14px 24px 18px; background: #0a0f28; border-top: 1px solid var(--line); }
.race-bottom .tv { font-size: 38px; }
.mini-track { position: relative; height: 26px; margin: 0 24px; }
.mini-track .lane { position: absolute; left: 0; right: 28px; top: 12px; height: 3px; background: var(--line); border-radius: 2px; }
.mini-track .fin { position: absolute; right: 0; top: 2px; font-size: 20px; }
.mini-track .dot { position: absolute; top: 3px; width: 20px; height: 20px; border-radius: 50%; transform: translateX(-50%); border: 2px solid #0a0f28; display: grid; place-items: center; font-size: 11px; transition: left .1s linear; }
.mini-track .dot.me { z-index: 2; width: 26px; height: 26px; top: 0; font-size: 15px; border-color: #fff; }
.game-msg { position: absolute; top: 18%; left: 50%; transform: translateX(-50%); font-family: var(--display); font-size: 34px; color: #fff; text-shadow: 0 3px 0 rgba(0, 0, 0, .4), 0 0 20px rgba(0, 0, 0, .5); pointer-events: none; white-space: nowrap; animation: msg 1.4s forwards; }
@keyframes msg { 0% { transform: translate(-50%, 20px) scale(.6); opacity: 0; } 15% { transform: translate(-50%, 0) scale(1.1); opacity: 1; } 75% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -20px); } }

.caps-warn { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); }

@media (max-width: 860px) {
  .topbar { flex-wrap: wrap; padding: 10px 16px; gap: 10px; }
  .nav { order: 3; width: 100%; overflow-x: auto; }
  .game-cards, .quick-stats, .stat-grid { grid-template-columns: 1fr 1fr; }
  .tiers { grid-template-columns: repeat(3, 1fr); }
  .continue { flex-wrap: wrap; }
  .continue-go { align-items: flex-start; text-align: left; }
  .live-stats .muted { display: none; }
}
.tier .rec { font-style: normal; }
.tiers.six { grid-template-columns: repeat(6, 1fr); }
.level-card .sec-head p { margin: 4px 0 12px; }
@media (max-width: 860px) { .tiers.six { grid-template-columns: repeat(3, 1fr); } }
