:root {
  --bg: #0d0d0f;
  --panel: #16161a;
  --panel-2: #1e1e23;
  --line: #2a2a31;
  --text: #ecebe6;
  --muted: #8b8a92;
  --red: #ff4d3d;
  --blue: #3d8bff;
  --gold: #f5c542;
  --ok: #3ccf8e;
  --trash: #ff5b6e;
  --radius: 14px;
  --sans: ui-sans-serif, -apple-system, "Inter", "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: radial-gradient(1200px 600px at 50% -200px, #1b1b22 0%, var(--bg) 60%) fixed, var(--bg);
  color: var(--text);
  font: 16px/1.5 var(--sans);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
button:disabled { opacity: 0.35; cursor: default; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.primary {
  background: var(--text); color: var(--bg);
  padding: 0.7rem 1.2rem; border-radius: 999px; font-weight: 700;
  transition: transform 0.12s ease, background 0.2s;
}
.primary:hover:not(:disabled) { transform: translateY(-1px); }
.primary.big { font-size: 1.1rem; padding: 0.95rem 1.8rem; }
.ghost {
  border: 1px solid var(--line); padding: 0.55rem 1rem; border-radius: 999px; color: var(--muted);
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.ghost:hover:not(:disabled) { color: var(--text); border-color: #45454f; }
.ghost.small { padding: 0.35rem 0.8rem; font-size: 0.85rem; }
.ghost.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.link { color: var(--muted); text-decoration: underline; font-size: 0.85rem; padding: 0; }
.link:hover { color: var(--text); }
kbd {
  font: 0.8em var(--mono); border: 1px solid var(--line); border-bottom-width: 2px;
  border-radius: 5px; padding: 0.05em 0.4em; color: var(--text);
}
.muted { color: var(--muted); }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 1.5rem;
  padding: 0.9rem clamp(1rem, 4vw, 2.5rem);
  background: rgba(13, 13, 15, 0.8); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 900; letter-spacing: 0.08em; font-size: 0.95rem; }
.brand span { color: var(--red); margin-left: 0.15em; }
.progress { flex: 1; display: flex; align-items: center; gap: 0.9rem; min-width: 0; }
.progress .bar { flex: 1; height: 4px; background: var(--line); border-radius: 4px; overflow: hidden; max-width: 420px; }
.progress .bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--red), var(--blue)); transition: width 0.4s ease; }
.progress .count { font: 0.8rem var(--mono); color: var(--muted); white-space: nowrap; }

main { max-width: 1120px; margin: 0 auto; padding: clamp(1.5rem, 5vw, 3.5rem) clamp(1rem, 4vw, 2.5rem) 4rem; }

.eyebrow { font: 0.78rem var(--mono); text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); margin: 0 0 1rem; }
h1 { font-size: clamp(2.6rem, 7vw, 5rem); line-height: 0.95; letter-spacing: -0.035em; margin: 0 0 1.5rem; font-weight: 900; }

/* ---------- intro ---------- */
.intro { max-width: 640px; padding-top: 2vh; }
.lede { font-size: 1.15rem; color: #c9c8c2; margin: 0 0 2rem; }
.rules { list-style: none; padding: 0; margin: 0 0 1.5rem; display: grid; gap: 0.6rem; }
.rules li { padding: 0.75rem 1rem; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; color: #c9c8c2; }
.rules b { color: var(--text); }
.hint { color: var(--muted); font-size: 0.9rem; margin: 0 0 2rem; }

/* ---------- match ---------- */
.arena { display: grid; grid-template-columns: 1fr auto 1fr; gap: 1.25rem; align-items: stretch; }
.versus { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1rem; }
.versus span { font-weight: 900; font-size: 1.6rem; letter-spacing: 0.05em; color: var(--muted); font-style: italic; }

.corner {
  --c: var(--red);
  position: relative; display: flex; flex-direction: column; gap: 1.1rem;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.5rem; overflow: hidden;
  transition: border-color 0.25s, transform 0.25s, opacity 0.25s, box-shadow 0.25s;
}
.corner.right { --c: var(--blue); }
.corner::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--c);
}
.corner.playing { border-color: color-mix(in srgb, var(--c) 55%, var(--line)); box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 12%, transparent); }
.corner.won { border-color: var(--gold); box-shadow: 0 0 0 4px rgba(245, 197, 66, 0.15); transform: translateY(-3px); }
.corner.lost { opacity: 0.45; }
.corner header { display: flex; justify-content: space-between; align-items: baseline; }
.corner-label { font: 0.75rem var(--mono); text-transform: uppercase; letter-spacing: 0.14em; color: var(--c); }
.sample-name { font-weight: 800; font-size: 1.6rem; letter-spacing: -0.02em; }

.player { display: flex; align-items: center; gap: 1rem; }
.play {
  flex: none; width: 64px; height: 64px; border-radius: 50%;
  background: var(--c, var(--text)); display: grid; place-items: center;
  transition: transform 0.12s ease, filter 0.2s;
}
.play:hover { transform: scale(1.05); filter: brightness(1.1); }
.play svg { width: 26px; height: 26px; fill: #fff; }
.track { flex: 1; min-width: 0; }
.times { display: flex; justify-content: space-between; font: 0.78rem var(--mono); color: var(--muted); margin-top: 0.35rem; }

.seek {
  --pct: 0%;
  -webkit-appearance: none; appearance: none; width: 100%; height: 22px; background: transparent; margin: 0; cursor: pointer;
}
.seek::-webkit-slider-runnable-track {
  height: 6px; border-radius: 6px;
  background: linear-gradient(90deg, var(--c, var(--text)) var(--pct), var(--line) var(--pct));
}
.seek::-moz-range-track { height: 6px; border-radius: 6px; background: var(--line); }
.seek::-moz-range-progress { height: 6px; border-radius: 6px; background: var(--c, var(--text)); }
.seek::-webkit-slider-thumb {
  -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%; background: #fff; margin-top: -4px;
}
.seek::-moz-range-thumb { width: 14px; height: 14px; border: 0; border-radius: 50%; background: #fff; }

.heard { height: 2px; background: var(--panel-2); border-radius: 2px; position: relative; margin-top: -0.4rem; }
.heard span { position: absolute; inset: 0 auto 0 0; width: 0; background: color-mix(in srgb, var(--c) 45%, transparent); border-radius: 2px; }
.heard::after { content: "listened"; position: absolute; right: 0; top: 5px; font: 0.65rem var(--mono); color: #5d5c64; text-transform: uppercase; letter-spacing: 0.1em; }

.pick { width: 100%; padding: 0.9rem; font-size: 1rem; margin-top: 0.6rem; }
.corner .pick:hover { background: var(--c); color: #fff; }
.corner.won .pick { background: var(--gold); color: var(--bg); }

.verdicts { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }
.verdict {
  border: 1px solid var(--line); border-radius: 10px; padding: 0.55rem; font-size: 0.9rem; color: var(--muted);
  transition: all 0.15s;
}
.verdict.ok:hover, .verdict.ok.on { color: var(--ok); border-color: var(--ok); }
.verdict.trash:hover, .verdict.trash.on { color: var(--trash); border-color: var(--trash); }
.verdict.on { background: color-mix(in srgb, currentColor 12%, transparent); font-weight: 600; }

.match-nav { display: flex; justify-content: space-between; gap: 1rem; margin-top: 1.75rem; }

/* ---------- results ---------- */
.podium { list-style: none; padding: 0; margin: 2rem 0; display: grid; gap: 0.75rem; }
.row {
  --c: var(--text);
  display: grid; grid-template-columns: 3.5rem 1fr auto minmax(220px, 300px); gap: 1.25rem; align-items: center;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.4rem;
  animation: reveal 0.55s cubic-bezier(.2,.8,.2,1) both; animation-delay: var(--d);
}
.row.champ { border-color: var(--gold); background: linear-gradient(100deg, rgba(245,197,66,0.10), var(--panel) 45%); --c: var(--gold); }
.row.trashed { opacity: 0.55; --c: var(--trash); }
.rank { font-weight: 900; font-size: 2.2rem; letter-spacing: -0.04em; color: var(--c); text-align: center; }
.codename { font: 0.75rem var(--mono); color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em; }
.model { font-weight: 800; font-size: 1.3rem; letter-spacing: -0.015em; }
.model small { font-weight: 500; font-size: 0.85rem; color: var(--muted); margin-left: 0.35rem; }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; margin-top: 0.3rem; }
.record { font: 0.82rem var(--mono); color: var(--muted); }
.badge { font-size: 0.72rem; font-weight: 700; padding: 0.15rem 0.55rem; border-radius: 999px; text-transform: uppercase; letter-spacing: 0.06em; }
.badge.ok { color: var(--ok); background: rgba(60, 207, 142, 0.12); }
.badge.trash { color: var(--trash); background: rgba(255, 91, 110, 0.12); }
.pts-bar { height: 3px; background: var(--line); border-radius: 3px; margin-top: 0.6rem; max-width: 280px; }
.pts-bar span { display: block; height: 100%; background: var(--c); border-radius: 3px; }
.price { text-align: right; }
.price b { display: block; font: 700 1.25rem var(--mono); }
.price small { color: var(--muted); font-size: 0.75rem; }
.player.mini .play { width: 42px; height: 42px; }
.player.mini .play svg { width: 18px; height: 18px; fill: var(--bg); }

@keyframes reveal {
  from { opacity: 0; transform: translateY(14px) scale(0.98); filter: blur(4px); }
  to { opacity: 1; transform: none; filter: none; }
}
.row.trashed { animation-name: reveal-dim; }
@keyframes reveal-dim { from { opacity: 0; transform: translateY(14px); } to { opacity: 0.55; transform: none; } }

.log { margin: 1.5rem 0; color: var(--muted); }
.log summary { cursor: pointer; color: var(--text); }
.log ol { font-size: 0.9rem; line-height: 1.8; }
.log b { color: var(--text); }
.result-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.footnote { color: var(--muted); font-size: 0.82rem; margin-top: 2rem; max-width: 640px; }

/* ---------- responsive ---------- */
@media (max-width: 820px) {
  .arena { grid-template-columns: 1fr; }
  .versus { flex-direction: row; }
  .row { grid-template-columns: 2.5rem 1fr auto; }
  .row .player.mini { grid-column: 1 / -1; }
  .progress .count { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
.price small { display: block; }
.price .note { color: #5d5c64; font-size: 0.7rem; max-width: 180px; margin-left: auto; line-height: 1.3; margin-top: 0.2rem; }
