:root {
  --bg: #07090e;
  --panel: rgba(20, 24, 33, 0.66);
  --panel-solid: #11151d;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);
  --ink: #eef1f7;
  --ink-dim: #9aa3b4;
  --ink-faint: #5e6675;

  --horrible: #f0445a;
  --bad: #ffb13b;
  --good: #36d399;
  --great: #41c7f5;

  --font-display: "Space Grotesk", system-ui, sans-serif;
  --font-body: "Manrope", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
button { color: inherit; } /* UA default is dark; inherit ink so button text stays readable on dark bg */
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.atmosphere {
  position: fixed; inset: 0; z-index: -2;
  background:
    radial-gradient(60% 50% at 12% -5%, rgba(65, 199, 245, 0.16), transparent 60%),
    radial-gradient(55% 45% at 88% 0%, rgba(54, 211, 153, 0.12), transparent 60%),
    radial-gradient(70% 60% at 50% 110%, rgba(240, 68, 90, 0.12), transparent 60%),
    var(--bg);
}
.grain {
  position: fixed; inset: 0; z-index: -1; opacity: 0.05; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ── Top bar + search ─────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: clamp(10px, 2vw, 18px);
  padding: 12px clamp(16px, 4vw, 48px);
  background: rgba(7, 9, 14, 0.72);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 9px; text-decoration: none; white-space: nowrap; }
.brand-mark { width: 22px; height: 22px; filter: drop-shadow(0 0 10px rgba(65, 199, 245, 0.35)); }
.brand-word { font-family: var(--font-display); font-weight: 600; font-size: 17px; letter-spacing: -0.02em; color: var(--ink); }
.brand-word span { color: var(--ink-faint); font-weight: 500; }

.searchbox { position: relative; flex: 1; max-width: 520px; }
#search, .vs-searchbox input {
  width: 100%; padding: 10px 16px; border-radius: 12px;
  background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line-strong);
  color: var(--ink); font-family: var(--font-body); font-size: 14.5px; outline: none;
  transition: border-color 0.2s, background 0.2s;
}
#search::placeholder, .vs-searchbox input::placeholder { color: var(--ink-faint); }
#search:focus, .vs-searchbox input:focus { border-color: var(--great); background: rgba(255, 255, 255, 0.06); }

.btn {
  flex: none; cursor: pointer; text-decoration: none; white-space: nowrap;
  font-family: var(--font-body); font-weight: 600; font-size: 13.5px;
  padding: 10px 16px; border-radius: 11px; border: 1px solid transparent;
  transition: border-color 0.18s, background 0.18s, transform 0.18s, color 0.18s;
}
.btn-primary { color: #07120f; background: linear-gradient(135deg, var(--good), var(--great)); }
.btn-primary:hover { transform: translateY(-1px); filter: brightness(1.05); }
.btn-ghost { color: var(--ink); background: rgba(255, 255, 255, 0.04); border-color: var(--line-strong); }
.btn-ghost:hover { border-color: var(--great); background: rgba(65, 199, 245, 0.1); transform: translateY(-1px); }

.suggest {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0; z-index: 30;
  max-height: 60vh; overflow-y: auto;
  background: #0c1016; border: 1px solid var(--line-strong); border-radius: 14px;
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.85); padding: 6px;
}
.suggest-item { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 10px; cursor: pointer; transition: background 0.12s; }
.suggest-item:hover, .suggest-item.active { background: rgba(65, 199, 245, 0.1); }
.suggest-item img { width: 34px; height: 50px; object-fit: cover; border-radius: 5px; background: #1a1f29; flex: none; }
.suggest-item .si-main { min-width: 0; }
.suggest-item .si-title { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.suggest-item .si-sub { color: var(--ink-faint); font-size: 12px; font-family: var(--font-mono); margin-top: 2px; }
.suggest-item .si-badge { margin-left: auto; flex: none; font-family: var(--font-mono); font-size: 10px; color: var(--ink-dim); border: 1px solid var(--line); padding: 2px 7px; border-radius: 999px; }
.suggest-empty { padding: 16px; text-align: center; color: var(--ink-faint); font-family: var(--font-mono); font-size: 13px; }

.shell {
  max-width: 1240px; margin: 0 auto;
  padding: clamp(18px, 3vw, 32px) clamp(18px, 4vw, 48px) 80px;
  position: relative; min-height: 60vh;
}

/* ── Landing ──────────────────────────────────────────────────────── */
.landing { animation: rise 0.6s ease both; padding-top: clamp(12px, 4vh, 48px); }
.landing-inner { max-width: 1100px; margin: 0 auto; text-align: center; }
.landing-title {
  font-family: var(--font-display); font-weight: 700; line-height: 1.02; letter-spacing: -0.025em;
  font-size: clamp(36px, 6vw, 64px); margin-bottom: 12px;
}
.landing-title em { font-style: normal; background: linear-gradient(92deg, var(--good), var(--great)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.landing-sub { color: var(--ink-dim); font-size: 16px; margin-bottom: clamp(20px, 3vh, 30px); }

/* Ranking-metric toggle above the popular grid. */
.popular-bar { display: flex; align-items: center; gap: 12px; margin-bottom: clamp(16px, 2.4vh, 26px); }
.popular-bar-label { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-faint); }
.metric-toggle { display: inline-flex; padding: 3px; gap: 3px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line-strong); border-radius: 999px; }
.metric-toggle button {
  cursor: pointer; padding: 6px 16px; border: 0; background: transparent; border-radius: 999px;
  font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.06em; color: var(--ink-dim);
  transition: background 0.16s, color 0.16s;
}
.metric-toggle button:hover { color: var(--ink); }
.metric-toggle button.active { color: #07120f; background: linear-gradient(135deg, var(--good), var(--great)); font-weight: 600; }
.pop-metric { display: block; font-size: 9px; font-family: var(--font-mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-faint); margin-top: 5px; }

/* Fixed column counts (all divisors of the 60-per-page batch) so the grid never
   ends on a half-filled row at any breakpoint. */
.popular { display: grid; grid-template-columns: repeat(6, 1fr); gap: 16px; text-align: left; }
@media (max-width: 1000px) { .popular { grid-template-columns: repeat(5, 1fr); } }
@media (max-width: 840px) { .popular { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 680px) { .popular { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 520px) { .popular { grid-template-columns: repeat(2, 1fr); } }
.pop-card {
  display: flex; flex-direction: column; padding: 0; text-align: left; cursor: pointer;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px; overflow: hidden;
  transition: border-color 0.18s, transform 0.18s, box-shadow 0.18s;
}
.pop-card:hover { border-color: var(--great); transform: translateY(-3px); box-shadow: 0 18px 40px -22px rgba(0, 0, 0, 0.9); }
.pop-poster { width: 100%; aspect-ratio: 2 / 3; object-fit: cover; background: #1a1f29; display: block; }
.pop-meta { padding: 10px 12px 13px; }
.pop-title { font-weight: 600; font-size: 13.5px; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.5em; }
.pop-score { margin-top: 8px; font-family: var(--font-display); font-weight: 700; font-size: 22px; line-height: 1; }
.pop-score span { display: block; font-size: 9px; font-family: var(--font-mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-faint); margin-top: 3px; }
.pop-score .imdb-logo { height: 13px; width: auto; display: block; margin-top: 5px; border-radius: 2px; }
.pop-card.skel { min-height: 280px; border-color: var(--line); background: linear-gradient(100deg, rgba(255,255,255,0.03) 30%, rgba(255,255,255,0.07) 50%, rgba(255,255,255,0.03) 70%); background-size: 200% 100%; animation: shimmer 1.3s infinite; }
.pop-fallback { color: var(--ink-faint); font-family: var(--font-mono); font-size: 13px; grid-column: 1 / -1; }
.popular-more {
  display: block; margin: 22px auto 0; padding: 10px 22px; cursor: pointer;
  font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink);
  background: var(--panel); border: 1px solid var(--line); border-radius: 999px;
  transition: border-color 0.18s, color 0.18s, transform 0.18s;
}
.popular-more:hover { border-color: var(--great); color: #fff; transform: translateY(-1px); }
.popular-more:disabled { opacity: 0.5; cursor: default; transform: none; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ── Hero ─────────────────────────────────────────────────────────── */
#dashboard:not([hidden]), #versus:not([hidden]) { animation: rise 0.5s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.hero { display: grid; grid-template-columns: auto 1fr auto; gap: clamp(18px, 3vw, 36px); align-items: center; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.poster { width: 88px; aspect-ratio: 2 / 3; border-radius: 12px; object-fit: cover; border: 1px solid var(--line-strong); box-shadow: 0 24px 50px -22px rgba(0, 0, 0, 0.9); }
.hero-meta .eyebrow { font-size: 11px; }
.eyebrow { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--ink-faint); }
.hero-meta h1 {
  font-family: var(--font-display); font-weight: 700; font-size: clamp(26px, 4.4vw, 44px);
  line-height: 1.03; letter-spacing: -0.02em; margin: 6px 0 5px;
  background: linear-gradient(92deg, #fff 10%, #b9c2d6 90%); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-meta .orig { color: var(--ink-dim); font-size: 14px; margin-bottom: 4px; }
.hero-links { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.hero-meta a { color: var(--great); text-decoration: none; font-size: 13px; font-family: var(--font-mono); }
.hero-meta a:hover { text-decoration: underline; }
.vs-cta { color: var(--ink) !important; font-family: var(--font-body) !important; font-weight: 600; border: 1px solid var(--line-strong); border-radius: 999px; padding: 5px 12px; transition: border-color 0.18s, background 0.18s; }
.vs-cta:hover { border-color: var(--great); background: rgba(65, 199, 245, 0.1); text-decoration: none !important; }
.score { text-align: right; }
.peakmeter { display: flex; justify-content: flex-end; align-items: center; gap: 11px; }
.pm-num { font-family: var(--font-display); font-weight: 700; font-size: clamp(38px, 5vw, 54px); line-height: 0.9; letter-spacing: -0.02em; }
.pm-cap { text-align: left; }
.pm-cap b { display: block; font-family: var(--font-mono); font-size: 11px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-dim); }
.pm-cap i { font-style: normal; font-family: var(--font-mono); font-size: 11px; color: var(--ink-faint); }
.imdb-line { display: flex; justify-content: flex-end; align-items: center; gap: 7px; margin-top: 12px; }
.imdb-logo { height: 17px; width: auto; display: block; border-radius: 3px; }
.imdb-rating { font-family: var(--font-display); font-weight: 700; font-size: 18px; color: var(--ink); }
.imdb-rating i { font-style: normal; font-size: 0.6em; font-weight: 500; color: var(--ink-faint); margin-left: 1px; }
.score .votes { color: var(--ink-dim); font-size: 13px; font-family: var(--font-mono); margin-top: 6px; }

/* ── Stat cards ───────────────────────────────────────────────────── */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 14px 0 0; }
.card { position: relative; padding: 13px 14px 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); backdrop-filter: blur(8px); overflow: hidden; }
.card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 2px; background: var(--accent, var(--line-strong)); opacity: 0.9; }
.card .k { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-faint); }
.card .v { font-family: var(--font-display); font-weight: 700; font-size: 27px; letter-spacing: -0.01em; margin-top: 6px; line-height: 1; }
.card .v small { font-size: 13px; color: var(--ink-dim); font-weight: 500; }
.card .v-text { font-size: 19px; letter-spacing: 0; }
.card .note { color: var(--ink-dim); font-size: 12px; margin-top: 6px; line-height: 1.4; }
.card-lo { background: rgba(20, 24, 33, 0.42); }
.card-lo::before { opacity: 0.5; }
.card-lo .v { font-size: 20px; color: var(--ink-dim); }
.card-lo .v-text { font-size: 17px; }
.card-lo .note { font-size: 11.5px; }

/* ── Panels ───────────────────────────────────────────────────────── */
.panel { margin-top: 16px; padding: 16px clamp(14px, 2vw, 22px) 14px; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); backdrop-filter: blur(8px); }
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 6px; }
.panel-head h2 { font-family: var(--font-display); font-weight: 600; font-size: 18px; letter-spacing: -0.01em; }
.panel-head h3 { font-family: var(--font-display); font-weight: 600; font-size: 15px; letter-spacing: -0.01em; }
.panel-head .sub { color: var(--ink-dim); font-size: 12.5px; margin-top: 3px; max-width: 64ch; }
.panel-tools { display: flex; align-items: center; gap: 12px; flex: none; }
.panel-tag { font-family: var(--font-mono); font-size: 12px; color: var(--ink-faint); white-space: nowrap; }
.zoomctl { display: inline-flex; gap: 4px; }
.zoomctl button { width: 28px; height: 28px; border-radius: 8px; cursor: pointer; border: 1px solid var(--line-strong); background: rgba(255, 255, 255, 0.04); color: var(--ink); font-size: 15px; line-height: 1; display: grid; place-items: center; font-family: var(--font-body); transition: border-color 0.15s, background 0.15s; }
.zoomctl button:hover { border-color: var(--great); background: rgba(65, 199, 245, 0.12); }
.duo { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
/* pan-y + pinch-zoom: the browser keeps vertical scrolling and pinch natively;
   only single-finger horizontal gestures reach our JS pan handler. Stops the
   chart from ever hijacking a page scroll. */
.chart { width: 100%; touch-action: pan-y pinch-zoom; }
.chart-tall { height: 300px; }
.chart-mid { height: 366px; }
.chart-sm { height: 300px; }

/* Band legend, now living at the bottom of the timeline tile */
.band-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 18px; margin-top: 10px; padding-top: 12px; border-top: 1px solid var(--line); }
.bl-item { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--ink-dim); }
.bl-item i { width: 9px; height: 9px; border-radius: 50%; box-shadow: 0 0 10px currentColor; }
.bl-item b { font-family: var(--font-mono); font-weight: 700; }

/* ── Episode list (season tabs) ───────────────────────────────────── */
.epitabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 14px; }
.epitab {
  display: inline-flex; align-items: center; gap: 9px; cursor: pointer;
  padding: 7px 13px; border-radius: 999px; border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.03); color: var(--ink-dim);
  font-family: var(--font-body); font-weight: 600; font-size: 13px;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.epitab:hover { border-color: var(--great); background: rgba(65, 199, 245, 0.08); color: var(--ink); }
.epitab.active { border-color: var(--great); background: rgba(65, 199, 245, 0.14); color: var(--ink); }
.epitab-meta { font-family: var(--font-mono); font-weight: 700; font-size: 12px; }

.epirows { display: flex; flex-direction: column; }
.epirow {
  display: grid; grid-template-columns: 72px 1fr auto; align-items: center; gap: 14px;
  padding: 11px 6px; border-top: 1px solid var(--line);
}
.epirow:first-child { border-top: none; }
.epi-num { font-family: var(--font-mono); font-size: 12px; color: var(--ink-faint); white-space: nowrap; }
.epi-title { font-size: 14px; font-weight: 500; color: var(--ink); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.epi-rating { display: inline-flex; align-items: center; gap: 7px; font-family: var(--font-display); font-weight: 700; font-size: 16px; white-space: nowrap; }
.epi-rating i { font-style: normal; font-size: 0.6em; font-weight: 500; color: var(--ink-faint); margin-left: 1px; }
.epi-dot { width: 8px; height: 8px; border-radius: 50%; box-shadow: 0 0 8px currentColor; }

@media (max-width: 520px) {
  .epirow { grid-template-columns: 56px 1fr auto; gap: 10px; }
  .epi-title { font-size: 13px; }
}

/* ── Versus ───────────────────────────────────────────────────────── */
.vs-grid { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(14px, 2vw, 22px); align-items: start; }
.vs-col { min-width: 0; }
.vs-col-loading { display: grid; place-items: center; min-height: 360px; }

.vs-picker { border: 1px dashed var(--line-strong); border-radius: 18px; padding: 22px; background: var(--panel-solid); }
.vs-slot-label { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-faint); margin-bottom: 10px; }
.vs-searchbox { max-width: none; }
.vs-pop { margin-top: 16px; }
.vs-pop-label { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-faint); margin-bottom: 8px; }
.pop-row { display: flex; align-items: center; gap: 11px; width: 100%; padding: 7px 9px; margin-bottom: 4px; border-radius: 10px; cursor: pointer; border: 1px solid transparent; background: rgba(255, 255, 255, 0.025); text-align: left; transition: border-color 0.14s, background 0.14s; }
.pop-row:hover { border-color: var(--great); background: rgba(65, 199, 245, 0.1); }
.pop-row img, .pop-row-noimg { width: 28px; height: 42px; border-radius: 4px; object-fit: cover; background: #1a1f29; flex: none; }
.pop-row-title { flex: 1; min-width: 0; font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pop-row-rating { display: inline-flex; align-items: center; gap: 6px; flex: none; }
.pop-row-score { font-family: var(--font-display); font-weight: 700; font-size: 16px; }
.pop-row-rating .imdb-logo { height: 13px; width: auto; border-radius: 2px; }

/* Persistent comparison layout. Row 1 = the two shows (hero or picker), row 2 =
   the full-width head-to-head table. A lone picker spans both rows beside the
   table so the table never resizes — only its columns animate. */
.vs-area { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: auto 1fr; gap: clamp(12px, 2vw, 20px); align-items: start; }
#vs-cell-a { grid-column: 1; grid-row: 1; min-width: 0; }
#vs-cell-b { grid-column: 2; grid-row: 1; min-width: 0; }
#vs-h2h-panel { grid-column: 1 / -1; grid-row: 2; }
.vs-area.solo-a #vs-cell-b { grid-row: 1 / 3; align-self: stretch; z-index: 2; }
.vs-area.solo-b #vs-cell-a { grid-row: 1 / 3; align-self: stretch; z-index: 2; }
.vs-area.solo-a #vs-cell-b .vs-picker,
.vs-area.solo-b #vs-cell-a .vs-picker { height: 100%; }
.vs-hero { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; padding: 14px 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); backdrop-filter: blur(8px); }
.vs-poster { width: 58px; aspect-ratio: 2 / 3; border-radius: 9px; object-fit: cover; border: 1px solid var(--line-strong); flex: none; }
.vs-tilemeta { min-width: 0; }
.vs-tilemeta h2 { font-family: var(--font-display); font-weight: 700; font-size: clamp(16px, 1.8vw, 21px); line-height: 1.08; letter-spacing: -0.01em; }
.vs-tilesub { color: var(--ink-dim); font-family: var(--font-mono); font-size: 12px; margin: 5px 0 8px; }
.vs-change { font-family: var(--font-body); font-size: 12px; color: var(--ink-dim); background: none; border: 1px solid var(--line-strong); border-radius: 999px; padding: 3px 11px; cursor: pointer; transition: border-color 0.15s, color 0.15s; }
.vs-change:hover { border-color: var(--great); color: var(--ink); }
.vs-tilerating { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.vs-tilerating .imdb-logo { height: 15px; width: auto; border-radius: 3px; }
.vs-tilerating-num { font-family: var(--font-display); font-weight: 700; font-size: 28px; line-height: 1; color: var(--ink); }
.vs-tilerating-num i { font-style: normal; font-size: 0.5em; font-weight: 500; color: var(--ink-faint); margin-left: 1px; }
.vs-table-panel { margin-top: 16px; }
.vs-timelines { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(12px, 2vw, 22px); }
.vs-tl-panel { margin-top: 16px; }
.vs-chart { height: 240px; }

.verdict { margin-top: 18px; }
.verdict-eyebrow { text-align: center; }
.verdict-title { text-align: center; font-family: var(--font-display); font-weight: 700; font-size: clamp(24px, 4vw, 38px); letter-spacing: -0.02em; margin: 4px 0 6px; }
.verdict-sub { text-align: center; color: var(--ink-dim); font-size: 14px; font-family: var(--font-mono); margin-bottom: 18px; }
.verdict-bars { display: grid; gap: 10px; max-width: 720px; margin: 0 auto 6px; }
.mb-row { display: grid; grid-template-columns: minmax(120px, 1fr) 3fr auto; align-items: center; gap: 14px; }
.mb-label { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mb-track { height: 16px; border-radius: 8px; overflow: hidden; background: rgba(255, 255, 255, 0.05); }
.mb-track span { display: block; height: 100%; border-radius: 8px; transition: width 0.5s ease; }
.mb-score { font-family: var(--font-display); font-weight: 700; font-size: 22px; min-width: 32px; text-align: right; }

/* Head to head: one persistent table. Value columns grow/shrink (flex-grow
   animates) so each value sits under its show — A on the left, B on the right,
   metric label centred between — as the second show populates. */
.h2h { display: grid; gap: 2px; max-width: 760px; margin: 4px auto 0; transition: margin 0.42s ease; }
.vs-area.solo-a #vs-h2h { margin-left: 0; margin-right: auto; max-width: calc(50% - 10px); }
.vs-area.solo-b #vs-h2h { margin-left: auto; margin-right: 0; max-width: calc(50% - 10px); }
.h2h-row { display: flex; align-items: center; gap: 14px; padding: 10px; border-radius: 10px; }
.h2h-row:nth-child(odd) { background: rgba(255, 255, 255, 0.025); }
.h2h-metric { flex: 0 0 auto; text-align: center; white-space: nowrap; font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-faint); }
.h2h-val { flex: 0 1 auto; min-width: 0; overflow: hidden; white-space: nowrap; font-family: var(--font-display); font-weight: 600; font-size: 18px; color: var(--ink-dim); transition: flex-grow 0.42s ease, opacity 0.42s ease; }
.cell-a { text-align: left; }
.cell-b { text-align: right; }
.h2h-val.empty { opacity: 0; }
.h2h-win { color: var(--good); }
.h2h.m-a .cell-a { flex-grow: 1; } .h2h.m-a .cell-b { flex-grow: 0; }
.h2h.m-b .cell-a { flex-grow: 0; } .h2h.m-b .cell-b { flex-grow: 1; }
.h2h.m-ab .cell-a { flex-grow: 1; } .h2h.m-ab .cell-b { flex-grow: 1; }

/* ── Footer ───────────────────────────────────────────────────────── */
.foot { margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--line); color: var(--ink-faint); font-family: var(--font-mono); font-size: 12px; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.foot a { color: var(--ink-dim); }

/* ── Inline stage states (loading / error) ────────────────────────── */
.stage-state { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; min-height: 52vh; color: var(--ink-dim); font-family: var(--font-mono); font-size: 14px; text-align: center; }
.stage-state[hidden] { display: none; }
.error-state { color: var(--horrible); }
.spinner { width: 38px; height: 38px; border: 3px solid var(--line-strong); border-top-color: var(--great); border-radius: 50%; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 900px) {
  .vs-slots { grid-template-columns: 1fr; }
  .vs-timelines { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .hero { grid-template-columns: auto 1fr; text-align: left; column-gap: 16px; }
  .hero-meta { grid-column: 2; }
  .score { grid-column: 1 / -1; text-align: left; margin-top: 4px; }
  .peakmeter, .imdb-line { justify-content: flex-start; }
  .duo { grid-template-columns: 1fr; }
  .mb-row { grid-template-columns: 1fr auto; }
  .mb-track { grid-column: 1 / -1; order: 3; }

  /* Compare: stack the two shows and let the head-to-head table go full width
     under them instead of squeezing into a half. */
  .vs-area { grid-template-columns: 1fr; grid-template-rows: none; }
  #vs-cell-a, #vs-cell-b, #vs-h2h-panel { grid-column: 1; grid-row: auto; }
  .vs-area.solo-a #vs-cell-b, .vs-area.solo-b #vs-cell-a { grid-row: auto; }
  .vs-area.solo-a #vs-h2h, .vs-area.solo-b #vs-h2h { max-width: 100%; margin: 4px auto 0; }
}

/* ── Phone: keep the page scrollable and everything thumb-sized ───────── */
@media (max-width: 560px) {
  /* Topbar reflows to two rows: brand + actions on top, full-width search below,
     so nothing gets crushed and the search box stays tappable. */
  .topbar { flex-wrap: wrap; gap: 10px 12px; padding: 10px 16px; }
  .searchbox { order: 3; flex-basis: 100%; max-width: none; }
  .brand { margin-right: auto; }
  .btn { padding: 9px 14px; font-size: 13px; }

  .shell { padding-left: 14px; padding-right: 14px; }
  .panel { padding: 14px 13px 12px; border-radius: 14px; }
  .panel-head { flex-wrap: wrap; gap: 8px 12px; }
  .panel-head .sub { max-width: none; }
  .panel-tools { width: 100%; justify-content: space-between; }

  /* Shorter charts so a phone-height viewport shows the chart AND room to scroll
     past it; the chart no longer fills the screen and trap the swipe. */
  .chart-tall { height: 240px; }
  .chart-mid { height: 300px; }
  .chart-sm { height: 240px; }
  .vs-chart { height: 200px; }

  .hero { padding-bottom: 14px; }
  .poster { width: 64px; }
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .band-legend { gap: 6px 12px; font-size: 12px; }
}
