:root {
  --bg: #0a0a0c;
  --bg-elev: #121216;
  --bg-card: #1a1214;
  --felt: #1c0f12;
  --red: #e31c23;
  --red-hot: #ff2d35;
  --red-dim: #8b1519;
  --gold: #e8b84a;
  --gold-dim: #a67c2a;
  --chip-black: #1a1a1e;
  --chip-edge: #3a3a42;
  --text: #f2ebe3;
  --muted: #9a8f86;
  --ginger: #d4763a;
  --steam: #f0c8a0;
  --green-odds: #2ecc71;
  --border: rgba(227, 28, 35, 0.35);
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --display: "Bebas Neue", Impact, sans-serif;
  --sans: Inter, system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(227, 28, 35, 0.18), transparent 55%),
    radial-gradient(ellipse 40% 30% at 90% 20%, rgba(212, 118, 58, 0.12), transparent 50%),
    linear-gradient(180deg, #0d0a0b 0%, var(--bg) 40%, #080608 100%);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.45;
}

/* ===== TICKER ===== */
.ticker {
  display: flex;
  align-items: stretch;
  background: #000;
  border-bottom: 2px solid var(--red);
  position: sticky;
  top: 0;
  z-index: 50;
  overflow: hidden;
  height: 36px;
}

.ticker-label {
  flex: 0 0 auto;
  background: var(--red);
  color: #fff;
  font-family: var(--display);
  font-size: 0.95rem;
  letter-spacing: 0.06em;
  padding: 0 0.75rem;
  display: flex;
  align-items: center;
  z-index: 2;
  box-shadow: 4px 0 12px rgba(0,0,0,0.5);
  white-space: nowrap;
  max-width: 42vw;
}

.ticker-track {
  flex: 1;
  overflow: hidden;
  position: relative;
  mask-image: linear-gradient(90deg, transparent, #000 2%, #000 98%, transparent);
}

.ticker-inner {
  display: inline-flex;
  white-space: nowrap;
  gap: 2.5rem;
  padding: 0.45rem 1rem;
  font-family: var(--mono);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--gold);
  animation: crawl 55s linear infinite;
  will-change: transform;
}

.ticker-inner:hover { animation-play-state: paused; }

.ticker-item .mul { color: var(--red-hot); }

@keyframes crawl {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

/* ===== HEADER ===== */
.site-header {
  padding: 1.25rem 1.25rem 0.5rem;
  max-width: 1100px;
  margin: 0 auto;
}

.brand-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-start;
}

.avatar-wrap {
  flex: 0 0 auto;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 3px solid var(--gold);
  box-shadow: 0 0 0 3px var(--red-dim), 0 8px 24px rgba(227,28,35,0.4);
  overflow: hidden;
  background: var(--chip-black);
}

.avatar-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.brand-text { flex: 1 1 240px; min-width: 0; }

.brand-text h1 {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(2.4rem, 8vw, 3.6rem);
  letter-spacing: 0.04em;
  line-height: 0.95;
  background: linear-gradient(180deg, #fff 0%, var(--steam) 40%, var(--ginger) 70%, var(--red) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: none;
  filter: drop-shadow(0 2px 0 rgba(0,0,0,0.6));
}

.tagline {
  margin: 0.35rem 0 0.25rem;
  color: var(--steam);
  font-weight: 600;
  font-size: 0.92rem;
}


.intro {
  margin: 0.45rem 0 0.35rem;
  color: var(--steam);
  font-size: 0.88rem;
  line-height: 1.5;
  max-width: 44rem;
}

.disclaimer {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  max-width: 42rem;
}

.header-links {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  align-items: flex-end;
}

.chip-link {
  font-family: var(--mono);
  font-size: 0.72rem;
  text-decoration: none;
  color: var(--gold);
  border: 1px dashed var(--gold-dim);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  background: rgba(232, 184, 74, 0.08);
}

.chip-link.disabled {
  opacity: 0.55;
  pointer-events: none;
  cursor: not-allowed;
  color: var(--muted);
  border-color: var(--chip-edge);
}

/* ===== LAYOUT ===== */
.layout {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0.75rem 1rem 2rem;
  display: grid;
  gap: 1.25rem;
}

/* ===== TDS METER ===== */
.tds-card {
  background:
    radial-gradient(circle at 20% 0%, rgba(227,28,35,0.25), transparent 55%),
    linear-gradient(145deg, #221015 0%, var(--felt) 50%, #140a0c 100%);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.1rem 1.25rem 1.25rem;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.06),
    0 12px 40px rgba(0,0,0,0.45);
  position: relative;
  overflow: hidden;
}

.tds-card::before {
  content: "";
  position: absolute;
  inset: 8px;
  border: 1px dashed rgba(232,184,74,0.2);
  border-radius: 12px;
  pointer-events: none;
}

.tds-head h2 {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(1.45rem, 4vw, 1.85rem);
  letter-spacing: 0.04em;
  color: var(--red-hot);
  text-transform: none;
}

.tds-sub {
  display: block;
  margin-top: 0.25rem;
  font-family: var(--sans);
  font-size: 0.78rem;
  color: var(--muted);
  letter-spacing: 0.01em;
  max-width: 40rem;
  line-height: 1.4;
}

.tds-gauge-wrap {
  display: grid;
  gap: 0.75rem;
  margin-top: 0.85rem;
  justify-items: center;
}

.tds-gauge {
  position: relative;
  width: min(100%, 340px);
  height: 42px;
  background: #0a0506;
  border-radius: 999px;
  border: 2px solid var(--chip-edge);
  box-shadow: inset 0 4px 12px rgba(0,0,0,0.7);
  overflow: hidden;
}

.tds-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg,
    #3d1a00 0%,
    var(--ginger) 35%,
    var(--red) 70%,
    var(--red-hot) 100%);
  border-radius: 999px;
  transition: width 1.1s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: 0 0 20px rgba(227,28,35,0.55);
}

.tds-needle {
  position: absolute;
  top: -4px;
  bottom: -4px;
  width: 3px;
  left: 0%;
  background: #fff;
  box-shadow: 0 0 8px #fff, 0 0 16px var(--red);
  transition: left 1.1s cubic-bezier(0.22, 1, 0.36, 1);
  border-radius: 2px;
}

.tds-score {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--display);
  font-size: 1.65rem;
  letter-spacing: 0.04em;
  color: #fff;
  text-shadow: 0 2px 4px #000, 0 0 12px rgba(0,0,0,0.8);
  pointer-events: none;
}

.tds-blurb {
  margin: 0;
  text-align: center;
  font-size: 0.82rem;
  color: var(--steam);
  max-width: 36rem;
}

.corpus-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: center;
  margin-top: 0.9rem;
}

.corpus-pill {
  font-family: var(--mono);
  font-size: 0.68rem;
  padding: 0.28rem 0.55rem;
  border-radius: 6px;
  background: rgba(0,0,0,0.45);
  border: 1px solid var(--chip-edge);
  color: var(--muted);
}

.corpus-pill strong { color: var(--gold); font-weight: 600; }

/* ===== BOARD ===== */
.board-panel {
  background: var(--bg-elev);
  border: 1px solid var(--chip-edge);
  border-radius: 14px;
  padding: 1rem 0.75rem 0.75rem;
  box-shadow: 0 8px 32px rgba(0,0,0,0.35);
}

.board-head {
  padding: 0 0.5rem 0.65rem;
}

.board-head h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.7rem;
  letter-spacing: 0.04em;
  color: var(--gold);
  text-transform: none;
}

.board-sub {
  margin: 0.2rem 0 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0 0.5rem 0.85rem;
}

.filter-chip {
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  padding: 0.42rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--chip-edge);
  background: var(--chip-black);
  color: var(--muted);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s, transform 0.1s;
}
.filter-chip.cat-filter-recycled_point { border-color: #5a3a18; color: var(--ginger); }
.filter-chip.cat-filter-obfuscation { border-color: #3a4a6a; color: #8ab4ff; }
.filter-chip.cat-filter-dodge { border-color: #2a4a38; color: #7dcea0; }
.filter-chip.cat-filter-strawman { border-color: #5a2828; color: #ff8a8a; }
.filter-chip.cat-filter-fake_smart { border-color: #4a3a5a; color: #d4a0ff; }
.filter-chip.cat-filter-polite_dodge { border-color: #2a4a5a; color: #7ec8e8; }


.filter-chip:hover {
  border-color: var(--gold-dim);
  color: var(--text);
}

.filter-chip.active {
  background: linear-gradient(180deg, var(--red) 0%, var(--red-dim) 100%);
  border-color: var(--red-hot);
  color: #fff;
  box-shadow: 0 0 12px rgba(227,28,35,0.35);
}

.filter-chip:active { transform: scale(0.97); }

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.06);
}

.odds-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.88rem;
  min-width: 640px;
}

.odds-table thead th {
  text-align: left;
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--steam);
  padding: 0.65rem 0.7rem;
  background: #0e0e12;
  border-bottom: 1px solid var(--border);
  /* No sticky. Sticky + overflow-x on .table-wrap clipped row #1 on mobile. */
  position: static;
  white-space: nowrap;
}

.odds-table tbody tr.row {
  cursor: pointer;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  transition: background 0.12s;
}

.odds-table tbody tr.row:nth-child(odd) {
  background: rgba(255,255,255,0.02);
}

.odds-table tbody tr.row:hover {
  background: rgba(227, 28, 35, 0.12);
}

.odds-table tbody tr.row.expanded {
  background: rgba(227, 28, 35, 0.18);
}

.odds-table td {
  padding: 0.7rem;
  vertical-align: middle;
}

.col-rank {
  width: 3rem;
  font-family: var(--display);
  font-size: 1.25rem;
  color: var(--gold);
  letter-spacing: 0.02em;
}

.col-phrase { font-weight: 600; }

.phrase-label {
  display: block;
  line-height: 1.25;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.015em;
  color: #fff7f0;
  text-shadow: 0 1px 0 rgba(0,0,0,0.55);
}

.phrase-meta {
  display: block;
  margin-top: 0.2rem;
  font-family: var(--mono);
  font-size: 0.62rem;
  font-weight: 400;
  color: #7a7068;
  letter-spacing: 0.01em;
}

.col-hits, .col-debates {
  font-family: var(--mono);
  font-weight: 600;
  white-space: nowrap;
  font-size: 0.8rem;
}
.col-debates { text-align: center; }


.col-hits { color: var(--green-odds); }
.col-debates { color: var(--steam); }

.cat-pill {
  display: inline-block;
  font-family: var(--sans);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  padding: 0.3rem 0.55rem;
  border-radius: 6px;
  white-space: normal;
  line-height: 1.25;
  border: 1px solid transparent;
  max-width: 11rem;
  overflow: visible;
}

.cat-recycled_point { background: #2a1a08; color: var(--ginger); border-color: #5a3a18; }
.cat-obfuscation { background: #1a1a2a; color: #8ab4ff; border-color: #3a4a6a; }
.cat-dodge { background: #1a2218; color: #7dcea0; border-color: #2a4a38; }
.cat-strawman { background: #2a1818; color: #ff8a8a; border-color: #5a2828; }
.cat-fake_smart { background: #221a28; color: #d4a0ff; border-color: #4a3a5a; }
.cat-polite_dodge { background: #1a2228; color: #7ec8e8; border-color: #2a4a5a; }

.loading, .empty {
  text-align: center;
  color: var(--muted);
  padding: 2rem !important;
  font-family: var(--mono);
}

/* Expand panel */
.expand-row td {
  padding: 0 !important;
  border-bottom: 1px solid var(--border);
  background: #0c0809;
}

.expand-panel {
  padding: 0.85rem 1rem 1rem;
  display: grid;
  gap: 0.65rem;
}

.expand-quote {
  margin: 0;
  padding: 0.75rem 0.9rem;
  border-left: 3px solid var(--red);
  background: rgba(227,28,35,0.08);
  font-style: italic;
  color: var(--steam);
  font-size: 0.9rem;
}

.expand-meta {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
}

.expand-meta a {
  color: var(--gold);
  text-decoration: none;
  border-bottom: 1px dotted var(--gold-dim);
}

.expand-meta a:hover { color: var(--red-hot); border-color: var(--red-hot); }

.expand-empty {
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0;
}

/* ===== FOOTER ===== */
.site-footer {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0.5rem 1.25rem 2.5rem;
  border-top: 1px solid var(--chip-edge);
  color: var(--muted);
  font-size: 0.78rem;
}

.site-footer code {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--gold-dim);
}

.footer-stats {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--steam);
}

.footer-note { opacity: 0.75; }

/* Mobile */
@media (max-width: 640px) {
  .site-header { padding: 1rem 0.85rem 0.25rem; }
  .header-links { align-items: flex-start; width: 100%; }
  .layout { padding: 0.5rem 0.65rem 1.5rem; }
  .board-panel { padding: 0.75rem 0.35rem 0.5rem; }
  .tds-card { padding: 1rem 0.85rem; }
  .odds-table { font-size: 0.82rem; min-width: 480px; }
  .col-rank { font-size: 1.1rem; }
}

/* About topic tags + tactic line in expand panel */
.about-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0 0 0.75rem;
}
.about-tag {
  font-family: var(--sans);
  font-size: 0.7rem;
  letter-spacing: 0.01em;
  color: var(--steam);
  background: rgba(212, 118, 58, 0.15);
  border: 1px solid rgba(232, 184, 74, 0.35);
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
}
.expand-tactic {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
  margin: 0 0 0.55rem;
}
.expand-panel .expand-quote + .expand-meta {
  margin-bottom: 0.85rem;
}
