:root {
  --bg-0: #040b1f;
  --bg-1: #081638;
  --bg-2: #0d2257;
  --card: rgba(18, 42, 98, 0.55);
  --card-solid: #0f2557;
  --card-hover: rgba(30, 64, 140, 0.6);
  --line: rgba(125, 175, 255, 0.16);
  --line-strong: rgba(125, 175, 255, 0.32);
  --text: #e8f0ff;
  --text-dim: #9db3dc;
  --text-faint: #6a83b3;
  --accent: #3b82f6;
  --accent-2: #60a5fa;
  --accent-3: #38bdf8;
  --glow: rgba(59, 130, 246, 0.45);
  --ok: #34d399;
  --bad: #f87171;
  --warn: #fbbf24;
  --radius: 18px;
  --radius-sm: 12px;
  --font: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }

html { background: var(--bg-0); }
body { margin: 0; min-height: 100vh; }

body {
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1200px 700px at 85% -10%, rgba(56, 189, 248, 0.18), transparent 60%),
    radial-gradient(900px 600px at -10% 20%, rgba(59, 130, 246, 0.22), transparent 60%),
    linear-gradient(180deg, var(--bg-1) 0%, var(--bg-0) 900px);
  background-repeat: no-repeat;
  background-color: var(--bg-0);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

a { color: var(--accent-2); text-decoration: none; }
a:hover { color: var(--accent-3); }

.container { width: min(1040px, 100% - 32px); margin: 0 auto; }

/* ---------- header ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  backdrop-filter: blur(14px);
  background: rgba(4, 11, 31, 0.6);
  border-bottom: 1px solid var(--line);
}
.topbar .container { display: flex; align-items: center; justify-content: space-between; height: 64px; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: -0.01em; color: var(--text); font-size: 17px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-3));
  box-shadow: 0 6px 20px var(--glow);
}
.brand-mark svg { width: 20px; height: 20px; }
.nav { display: flex; align-items: center; gap: 12px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--line-strong); object-fit: cover; }
.user-chip { display: flex; align-items: center; gap: 10px; color: var(--text-dim); font-size: 14px; }

/* ---------- buttons ---------- */
.btn {
  appearance: none; border: 1px solid transparent; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  font: inherit; font-weight: 700; font-size: 15px;
  padding: 12px 22px; border-radius: 999px;
  color: #fff; background: linear-gradient(135deg, var(--accent), #2563eb);
  box-shadow: 0 8px 28px -8px var(--glow), inset 0 1px 0 rgba(255,255,255,.15);
  transition: transform .15s ease, box-shadow .2s ease, opacity .2s, background .2s;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 12px 34px -8px var(--glow), inset 0 1px 0 rgba(255,255,255,.2); color: #fff; }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn-lg { padding: 16px 30px; font-size: 17px; }
.btn-ghost { background: transparent; border-color: var(--line-strong); box-shadow: none; color: var(--text); }
.btn-ghost:hover { background: rgba(96, 165, 250, 0.1); box-shadow: none; }
.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn-danger { background: transparent; border-color: rgba(248,113,113,.4); color: var(--bad); box-shadow: none; }
.btn-danger:hover { background: rgba(248,113,113,.1); color: var(--bad); box-shadow: none; }
.btn-google { background: #fff; color: #1f2a44; box-shadow: 0 10px 30px -10px rgba(96,165,250,.6); }
.btn-google:hover { color: #1f2a44; }
.btn-google svg { width: 20px; height: 20px; }

/* ---------- cards ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  backdrop-filter: blur(10px);
  box-shadow: 0 20px 50px -30px rgba(0, 0, 0, 0.7);
}
.card h2, .card h3 { margin-top: 0; }
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 760px) { .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); } }

main { padding: 40px 0 80px; }

.eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: 12px; font-weight: 700; color: var(--accent-3); }
.muted { color: var(--text-dim); }
.faint { color: var(--text-faint); }
.mono { font-family: var(--mono); }
.center { text-align: center; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.spacer { flex: 1; }
.hidden { display: none !important; }

/* ---------- landing ---------- */
.hero { text-align: center; padding: 48px 0 24px; }
.hero h1 {
  font-size: clamp(36px, 6vw, 64px); line-height: 1.05; letter-spacing: -0.03em; margin: 18px 0;
  font-weight: 800;
  background: linear-gradient(180deg, #fff 30%, #9cc4ff);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p.lead { font-size: clamp(16px, 2.2vw, 19px); color: var(--text-dim); max-width: 640px; margin: 0 auto 32px; }
.hero-wave { display: flex; align-items: center; justify-content: center; gap: 5px; height: 90px; margin: 8px auto 0; }
.hero-wave span {
  width: 6px; border-radius: 6px;
  background: linear-gradient(180deg, var(--accent-3), var(--accent));
  animation: pulse 1.6s ease-in-out infinite;
  box-shadow: 0 0 14px var(--glow);
}
@keyframes pulse { 0%, 100% { transform: scaleY(.35); opacity: .6; } 50% { transform: scaleY(1); opacity: 1; } }

.steps { margin-top: 56px; }
.step-num {
  width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center;
  font-weight: 800; color: var(--accent-3); background: rgba(56, 189, 248, .12); border: 1px solid rgba(56,189,248,.3);
  margin-bottom: 14px;
}
.step h3 { margin: 0 0 6px; font-size: 18px; }
.step p { margin: 0; color: var(--text-dim); font-size: 15px; }

.spec-strip { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 28px; }
.pill {
  font-family: var(--mono); font-size: 12.5px; padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--line-strong); color: var(--text-dim); background: rgba(13, 34, 87, .5);
}
.pill.ok { color: var(--ok); border-color: rgba(52,211,153,.35); }
.pill.bad { color: var(--bad); border-color: rgba(248,113,113,.35); }
.pill.accent { color: var(--accent-3); border-color: rgba(56,189,248,.4); }

/* ---------- dashboard ---------- */
.welcome h1 { font-size: clamp(28px, 4vw, 40px); letter-spacing: -0.02em; margin: 6px 0 4px; }
.big-number { font-size: 48px; font-weight: 800; letter-spacing: -0.03em; line-height: 1; }

.history { list-style: none; padding: 0; margin: 0; }
.history li {
  display: flex; align-items: center; gap: 14px; padding: 14px 4px; border-bottom: 1px solid var(--line);
  cursor: pointer; border-radius: 10px; transition: background .15s;
}
.history li:hover { background: rgba(96,165,250,.06); }
.history li:last-child { border-bottom: 0; }
.score-badge {
  font-family: var(--mono); font-weight: 700; padding: 6px 10px; border-radius: 10px; min-width: 70px; text-align: center;
  background: rgba(59,130,246,.15); color: var(--accent-2);
}

/* ---------- quiz ---------- */
.progress { height: 6px; border-radius: 99px; background: rgba(125,175,255,.14); overflow: hidden; }
.progress > div { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-3)); transition: width .4s ease; box-shadow: 0 0 12px var(--glow); }
.q-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 18px 0 8px; }
.q-head .counter { font-family: var(--mono); color: var(--text-dim); }
.track-name { font-size: clamp(22px, 3.4vw, 30px); font-weight: 800; letter-spacing: -0.02em; margin: 0; }
.track-artist { color: var(--text-dim); margin: 2px 0 0; font-size: 16px; }

.players { margin: 26px 0; }
.player {
  position: relative; border-radius: var(--radius); padding: 20px;
  background: linear-gradient(160deg, rgba(25, 56, 128, .55), rgba(11, 28, 70, .6));
  border: 1px solid var(--line);
  transition: border-color .2s, box-shadow .2s;
}
.player.playing { border-color: rgba(96,165,250,.7); box-shadow: 0 0 0 1px rgba(96,165,250,.35), 0 18px 50px -20px var(--glow); }
.player-top { display: flex; align-items: center; gap: 16px; }
.play-btn {
  flex: none; width: 58px; height: 58px; border-radius: 50%; border: 0; cursor: pointer;
  display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-3));
  box-shadow: 0 10px 26px -8px var(--glow);
  transition: transform .15s;
}
.play-btn:hover { transform: scale(1.05); }
.play-btn svg { width: 22px; height: 22px; pointer-events: none; }
.player-label { font-weight: 800; font-size: 18px; }
.player-sub { font-size: 13px; color: var(--text-faint); font-family: var(--mono); }
.kbd {
  font-family: var(--mono); font-size: 11px; padding: 2px 7px; border-radius: 6px;
  border: 1px solid var(--line-strong); color: var(--text-dim); background: rgba(4,11,31,.4);
}
.wave { position: relative; height: 54px; margin-top: 18px; cursor: pointer; user-select: none; }
.wave .bars { position: absolute; inset: 0; display: flex; align-items: center; gap: 2px; }
.wave .bars i { flex: 1; border-radius: 2px; background: rgba(125,175,255,.25); }
.wave .bars.fill { clip-path: inset(0 100% 0 0); }
.wave .bars.fill i { background: linear-gradient(180deg, var(--accent-3), var(--accent)); }
.player-time { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 12px; color: var(--text-faint); margin-top: 8px; }
.loading-bar { position: absolute; left: 0; bottom: 0; height: 2px; background: rgba(56,189,248,.5); border-radius: 2px; transition: width .3s; }
.player.loading .play-btn, .player.loading .wave { opacity: .5; cursor: progress; }

.question-title { font-size: 18px; font-weight: 700; margin: 6px 0 14px; }
.options { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 640px) { .options { grid-template-columns: 1fr; } }
.option {
  display: flex; gap: 14px; align-items: center; text-align: left;
  padding: 16px 18px; border-radius: var(--radius-sm); cursor: pointer;
  border: 1px solid var(--line); background: rgba(13, 34, 87, .45); color: var(--text);
  font: inherit; font-size: 15.5px; font-weight: 600;
  transition: border-color .15s, background .15s, transform .1s;
}
.option:hover { border-color: var(--line-strong); background: var(--card-hover); }
.option .num {
  flex: none; width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center;
  font-family: var(--mono); font-weight: 700; font-size: 14px;
  background: rgba(125,175,255,.12); color: var(--text-dim);
}
.option.selected { border-color: var(--accent-2); background: rgba(59,130,246,.22); box-shadow: 0 0 0 1px rgba(96,165,250,.4); }
.option.selected .num { background: var(--accent); color: #fff; }
.option small { display: block; font-weight: 500; color: var(--text-faint); font-size: 12.5px; margin-top: 2px; }

.quiz-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 26px; flex-wrap: wrap; }
.dots { display: flex; gap: 6px; flex-wrap: wrap; }
.dots button {
  width: 26px; height: 26px; border-radius: 8px; border: 1px solid var(--line); cursor: pointer;
  background: transparent; color: var(--text-faint); font-family: var(--mono); font-size: 11px; padding: 0;
}
.dots button.answered { background: rgba(59,130,246,.25); color: var(--text); border-color: transparent; }
.dots button.current { border-color: var(--accent-3); color: var(--text); }

/* ---------- results ---------- */
.result-hero { text-align: center; padding: 20px 0 10px; }
.score-ring { position: relative; width: 200px; height: 200px; margin: 0 auto 18px; }
.score-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.score-ring .val { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.score-ring .val b { display: block; font-size: 52px; font-weight: 800; letter-spacing: -0.03em; line-height: 1; }
.score-ring .val span { color: var(--text-dim); font-family: var(--mono); font-size: 14px; }
.verdict { font-size: clamp(26px, 4vw, 36px); font-weight: 800; margin: 0; letter-spacing: -0.02em; }

.result-list { list-style: none; padding: 0; margin: 0; }
.result-list li { display: grid; grid-template-columns: 34px 1fr auto; gap: 14px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line); }
.result-list li:last-child { border-bottom: 0; }
.mark { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; }
.mark.ok { background: rgba(52,211,153,.15); color: var(--ok); }
.mark.bad { background: rgba(248,113,113,.15); color: var(--bad); }
.result-list .answers { font-size: 13.5px; color: var(--text-dim); }
.mini-play { display: flex; gap: 6px; }
.mini-play button {
  border: 1px solid var(--line-strong); background: transparent; color: var(--text-dim); cursor: pointer;
  font: inherit; font-size: 12px; font-family: var(--mono); padding: 5px 10px; border-radius: 99px;
}
.mini-play button.on { background: var(--accent); color: #fff; border-color: transparent; }
@media (max-width: 640px) { .result-list li { grid-template-columns: 34px 1fr; } .mini-play { grid-column: 2; } }

/* ---------- misc ---------- */
.notice { padding: 14px 18px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong); background: rgba(13,34,87,.5); color: var(--text-dim); }
.notice.error { border-color: rgba(248,113,113,.4); color: #fecaca; background: rgba(127, 29, 29, .25); }
.notice.ok { border-color: rgba(52,211,153,.4); color: #bbf7d0; background: rgba(6, 78, 59, .25); }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid rgba(125,175,255,.2); border-top-color: var(--accent-2); animation: spin .8s linear infinite; margin: 80px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 50;
  padding: 12px 20px; border-radius: 12px; background: var(--card-solid); border: 1px solid var(--line-strong);
  box-shadow: 0 20px 40px -10px rgba(0,0,0,.6); font-weight: 600; max-width: calc(100% - 32px);
}
.toast.error { border-color: rgba(248,113,113,.5); color: #fecaca; }
footer { color: var(--text-faint); font-size: 13px; text-align: center; padding: 30px 0 40px; }

/* ---------- admin ---------- */
.tabs { display: flex; gap: 6px; padding: 5px; border-radius: 999px; background: rgba(13,34,87,.55); border: 1px solid var(--line); width: fit-content; }
.tabs button { border: 0; background: transparent; color: var(--text-dim); font: inherit; font-weight: 700; padding: 9px 18px; border-radius: 999px; cursor: pointer; }
.tabs button.active { background: var(--accent); color: #fff; box-shadow: 0 6px 18px -6px var(--glow); }

.dropzone {
  border: 2px dashed var(--line-strong); border-radius: var(--radius); padding: 34px; text-align: center; cursor: pointer;
  transition: border-color .2s, background .2s; color: var(--text-dim);
}
.dropzone:hover, .dropzone.drag { border-color: var(--accent-2); background: rgba(59,130,246,.08); }
.dropzone b { color: var(--text); }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 700; color: var(--text-dim); }
.input {
  font: inherit; color: var(--text); background: rgba(4, 11, 31, .55);
  border: 1px solid var(--line-strong); border-radius: 10px; padding: 11px 14px; outline: none; width: 100%;
}
.input:focus { border-color: var(--accent-2); box-shadow: 0 0 0 3px rgba(59,130,246,.25); }
audio { width: 100%; }
.clip-range { position: relative; height: 10px; background: rgba(125,175,255,.15); border-radius: 99px; margin-top: 10px; }
.clip-range div { position: absolute; top: 0; bottom: 0; border-radius: 99px; background: linear-gradient(90deg, var(--accent), var(--accent-3)); }

.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-faint); font-weight: 700; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr.inactive td { opacity: .5; }
.switch { position: relative; display: inline-block; width: 40px; height: 22px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: rgba(125,175,255,.2); cursor: pointer; transition: background .2s; }
.switch span::after { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(18px); }
.upload-progress { height: 8px; border-radius: 99px; background: rgba(125,175,255,.15); overflow: hidden; }
.upload-progress div { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-3)); transition: width .2s; }
.upload-progress.indeterminate div { width: 35%; animation: indet 1.2s ease-in-out infinite; }
@keyframes indet { 0% { transform: translateX(-100%); } 100% { transform: translateX(300%); } }

@media (max-width: 640px) { .hide-sm { display: none; } }

/* ---------- admin statistics ---------- */
:root {
  --series: #4a8ff8;      /* actual results */
  --chance: #cc7a22;      /* what pure guessing would give */
  --grid: rgba(125, 175, 255, 0.12);
  --surface: #0f2557;     /* ring/gap color around marks */
}
.stats-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; margin-bottom: 20px; }
.seg { display: flex; gap: 4px; padding: 4px; border-radius: 12px; background: rgba(13,34,87,.55); border: 1px solid var(--line); }
.seg button { white-space: nowrap; border: 0; background: transparent; color: var(--text-dim); font: inherit; font-size: 14px; font-weight: 700; padding: 7px 14px; border-radius: 9px; cursor: pointer; }
.seg button:hover { color: var(--text); }
.seg button.active { background: rgba(74,143,248,.22); color: var(--text); }
.check { display: inline-flex; align-items: center; gap: 10px; color: var(--text-dim); font-size: 14px; font-weight: 600; cursor: pointer; }
#stats-body { transition: opacity .2s; }
@media (max-width: 480px) {
  .tabs button { padding: 8px 12px; font-size: 14px; }
  .seg { width: 100%; }
  .seg button { flex: 1; padding: 7px 4px; font-size: 13px; }
}
#stats-body.loading { opacity: .5; pointer-events: none; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 960px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 480px) { .grid-4 { grid-template-columns: 1fr; } }
.stat-label { font-size: 13px; font-weight: 700; color: var(--text-dim); }
.stat-value { font-size: 40px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; margin-top: 8px; }
.stat-sub { font-size: 13px; color: var(--text-faint); margin-top: 6px; }
.stats-stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; margin-top: 20px; }

.chart-card h3 { margin: 0; font-size: 17px; }
.chart-head { display: flex; align-items: flex-start; gap: 12px; }
.chart-sub { font-size: 13.5px; color: var(--text-dim); margin-top: 4px; }
.chart-toggle { flex: none; border: 1px solid var(--line); background: transparent; color: var(--text-faint); font: inherit; font-size: 12.5px; font-weight: 700; padding: 5px 10px; border-radius: 8px; cursor: pointer; }
.chart-toggle:hover { color: var(--text); border-color: var(--line-strong); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 14px 0 4px; font-size: 13px; color: var(--text-dim); }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; background: var(--series); }
.legend i.line { width: 16px; height: 2px; border-radius: 2px; background: var(--chance); }
.chart-body { margin-top: 10px; position: relative; }
.chart-body svg { display: block; overflow: visible; }
.chart-body svg text { fill: var(--text-faint); font-family: var(--font); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.chart-body svg text.cap { fill: var(--text-dim); font-weight: 700; }
.chart-body .hit { fill: transparent; cursor: default; outline: none; }
.chart-body .hit:hover, .chart-body .hit:focus { fill: rgba(125,175,255,.07); }
.chart-table { margin-top: 10px; max-height: 420px; overflow: auto; }
.chart-table .table td, .chart-table .table th { padding: 8px 10px; font-variant-numeric: tabular-nums; }
.chart-empty { color: var(--text-faint); font-size: 14px; padding: 30px 0; text-align: center; }

.hbars { display: grid; gap: 4px; }
.hbar { display: grid; grid-template-columns: minmax(120px, 34%) 1fr 64px; align-items: center; gap: 14px; padding: 6px 8px; border-radius: 8px; outline: none; }
.hbar:hover, .hbar:focus { background: rgba(125,175,255,.07); }
.hbar-label { min-width: 0; font-size: 14px; }
.hbar-label b { display: block; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar-label span { display: block; font-size: 12.5px; color: var(--text-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar-track { position: relative; height: 14px; }
.hbar-track::before { content: ""; position: absolute; inset: 6px 0; background: var(--grid); border-radius: 2px; }
.hbar-fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--series); border-radius: 0 4px 4px 0; min-width: 2px; }
.hbar-ref { position: absolute; top: -5px; bottom: -5px; width: 2px; margin-left: -1px; background: var(--chance); border-radius: 2px; }
.hbar-val { text-align: right; font-weight: 700; font-size: 14px; font-variant-numeric: tabular-nums; }
.hbar-val span { display: block; font-size: 11.5px; font-weight: 500; color: var(--text-faint); }
@media (max-width: 560px) {
  .hbar { grid-template-columns: 1fr 56px; }
  .hbar-label { grid-column: 1 / -1; }
}

.heat { width: 100%; border-collapse: separate; border-spacing: 3px; font-size: 13px; font-variant-numeric: tabular-nums; }
.heat th { font-weight: 700; color: var(--text-faint); font-size: 12px; padding: 4px 6px; text-align: center; }
.heat th.rowh { text-align: right; white-space: nowrap; }
.heat td { text-align: center; padding: 10px 4px; border-radius: 6px; font-weight: 700; position: relative; outline: none; }
.heat td small { display: block; font-weight: 500; font-size: 11px; opacity: .75; }
.heat td.diag::after { content: ""; position: absolute; inset: 0; border-radius: 6px; box-shadow: inset 0 0 0 2px rgba(232,240,255,.85); }
.heat td.margin { background: transparent; color: var(--text-dim); font-weight: 600; }
.heat td:not(.margin):hover, .heat td:not(.margin):focus { filter: brightness(1.2); }

.chart-tip {
  position: fixed; z-index: 60; pointer-events: none; min-width: 150px; max-width: 280px;
  background: #0a1838; border: 1px solid var(--line-strong); border-radius: 10px; padding: 10px 12px;
  box-shadow: 0 16px 40px -12px rgba(0,0,0,.7); font-size: 13px;
}
.chart-tip .tt { color: var(--text-dim); font-weight: 700; margin-bottom: 6px; }
.chart-tip .tr { display: flex; align-items: center; gap: 8px; margin-top: 3px; }
.chart-tip .tr i { width: 12px; height: 2px; border-radius: 2px; flex: none; }
.chart-tip .tr b { font-variant-numeric: tabular-nums; }
.chart-tip .tr span { color: var(--text-faint); }

/* ---------- difficulty ---------- */
.levels { display: grid; gap: 8px; margin-top: 16px; }
.option.level { padding: 10px 14px; font-size: 15px; }
.option.level .num { width: auto; min-width: 40px; padding: 0 6px; }
.level-pill { white-space: nowrap; padding: 3px 10px; font-size: 12px; }
.level-pill.level-easy { color: var(--ok); border-color: rgba(52,211,153,.35); }
.level-pill.level-medium { color: var(--accent-3); border-color: rgba(56,189,248,.4); }
.level-pill.level-hard { color: var(--warn); border-color: rgba(251,191,36,.4); }
.level-wrap { position: relative; }
.level-wrap .level { width: 100%; }
.level-tip, .level-about { font-size: 13.5px; line-height: 1.5; color: var(--text-dim); }
.level-tip b, .level-about b { color: var(--text); font-size: 14px; }
.level-tip p, .level-about p { margin: 6px 0 0; }
.level-listen span { color: var(--accent-3); font-weight: 700; }
/* Hover/focus tooltip above the button; above, so the next card can't cover it. */
.level-tip {
  position: absolute; left: 0; right: 0; bottom: calc(100% + 8px); z-index: 20;
  padding: 12px 14px; border-radius: var(--radius-sm);
  background: var(--card-solid); border: 1px solid var(--line-strong);
  box-shadow: 0 16px 40px -12px rgba(0, 0, 0, .8);
  opacity: 0; visibility: hidden; transform: translateY(4px);
  transition: opacity .15s, transform .15s, visibility .15s; pointer-events: none;
}
.level-wrap:hover .level-tip, .level:focus-visible + .level-tip { opacity: 1; visibility: visible; transform: none; }
.level-about { display: none; margin-top: 12px; padding: 12px 14px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: rgba(13, 34, 87, .45); }
/* Touch screens: no hover, so describe the selected level under the picker instead. */
@media (hover: none) {
  .level-tip { display: none; }
  .level-about { display: block; }
}

/* ---------- after the result: next levels / share card ---------- */
.next-levels .option.level:disabled { opacity: .5; cursor: not-allowed; }
.share-card { text-align: center; }
.share-preview { display: grid; place-items: center; min-height: 120px; }
.share-preview img { display: block; width: 100%; max-width: 640px; height: auto; border-radius: var(--radius-sm); border: 1px solid var(--line); }
