/* ============================================================
   BATTLEARENA — Postmodern Results Playground
   Memphis Group meets data visualization.
   No dark mode. Bold geometry. Clashing color. Mixed type.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;500;600;700;800&family=Playfair+Display:ital,wght@0,700;0,900;1,700&family=JetBrains+Mono:wght@400;600;700;800&display=swap');

:root {
  --bg: #FFF8F0;
  --surface: #FFFFFF;
  --surface2: #F5F0E8;
  --border: #1a1a2e;
  --border-light: #d4cfc7;
  --text: #1a1a2e;
  --text2: #4a4a5a;
  --text3: #8a8a9a;

  --red: #FF3366;
  --blue: #0055FF;
  --cyan: #00CED1;
  --violet: #7B2FBE;
  --fuchsia: #FF1493;
  --amber: #FFB800;
  --orange: #FF6B35;
  --emerald: #00A878;

  --haiku: #0055FF;
  --sonnet: #FF1493;
  --opus: #FFB800;

  --memphis-pink: #FF6B9D;
  --memphis-yellow: #FFE66D;
  --memphis-teal: #00CED1;
  --memphis-coral: #FF6B6B;

  --font-display: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --font-body: 'Syne', 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 18px; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
  overflow-x: hidden;
  /* Memphis dot pattern */
  background-image:
    radial-gradient(circle, #e8e0d4 1px, transparent 1px);
  background-size: 24px 24px;
}

/* ============================================================
   HEADER
   ============================================================ */
.header {
  background: var(--surface);
  border-bottom: 4px solid var(--border);
  padding: 24px 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
}

/* Decorative corner shapes */
.header::before {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 120px; height: 120px;
  background: var(--memphis-yellow);
  clip-path: polygon(100% 0, 0 0, 100% 100%);
  opacity: 0.6;
}
.header::after {
  content: '';
  position: absolute;
  bottom: -4px; left: 40px;
  width: 60px; height: 8px;
  background: var(--red);
}

.header h1 {
  font-family: var(--font-display);
  font-size: 2.8rem;
  font-weight: 900;
  letter-spacing: -0.02em;
  color: var(--text);
  position: relative;
}
.header h1 span {
  color: var(--red);
  font-style: italic;
}
.header .subtitle {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.35em;
  color: var(--text3);
  font-weight: 600;
  margin-top: 4px;
}
.header .run-info {
  text-align: right;
  font-size: 0.75rem;
  color: var(--text3);
  font-family: var(--font-mono);
  position: relative;
}
.header .run-info strong { color: var(--text2); }

/* ============================================================
   NAVIGATION
   ============================================================ */
.nav {
  display: flex;
  gap: 3px;
  padding: 12px 40px;
  background: var(--surface);
  border-bottom: 3px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
/* Memphis accent stripe across nav */
.nav::before {
  content: '';
  position: absolute;
  bottom: -3px;
  left: 0;
  width: 100%;
  height: 3px;
  background: repeating-linear-gradient(
    90deg,
    var(--red) 0, var(--red) 60px,
    var(--memphis-yellow) 60px, var(--memphis-yellow) 120px,
    var(--blue) 120px, var(--blue) 180px,
    var(--memphis-teal) 180px, var(--memphis-teal) 240px
  );
  z-index: 1;
}
.nav button {
  background: transparent;
  border: 2px solid transparent;
  color: var(--text3);
  padding: 8px 18px;
  border-radius: 0;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
}
.nav button:hover {
  color: var(--text);
  background: var(--memphis-yellow);
  border-color: var(--border);
}
.nav button.active {
  background: var(--border);
  color: var(--bg);
  border-color: var(--border);
}
/* Active tab triangle indicator */
.nav button.active::after {
  content: '';
  position: absolute;
  bottom: -7px;
  left: 50%;
  transform: translateX(-50%);
  width: 0; height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 6px solid var(--border);
  z-index: 2;
}

/* ============================================================
   PANELS
   ============================================================ */
.panel {
  display: none;
  padding: 40px;
  max-width: 1400px;
  margin: 0 auto;
}
.panel.active {
  display: block;
  animation: slideIn 0.35s ease;
}
@keyframes slideIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Entrance animations — staggered page-load reveals */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes slideRight {
  from { opacity: 0; transform: translateX(-16px); }
  to { opacity: 1; transform: translateX(0); }
}

.champion {
  animation: scaleIn 0.6s cubic-bezier(0.22, 1, 0.36, 1) both;
  animation-delay: 0.1s;
}
.panel.active .card:nth-child(1) { animation: fadeUp 0.45s ease both; animation-delay: 0.08s; }
.panel.active .card:nth-child(2) { animation: fadeUp 0.45s ease both; animation-delay: 0.16s; }
.panel.active .card:nth-child(3) { animation: fadeUp 0.45s ease both; animation-delay: 0.24s; }
.panel.active .card:nth-child(4) { animation: fadeUp 0.45s ease both; animation-delay: 0.32s; }
.panel.active .card:nth-child(5) { animation: fadeUp 0.45s ease both; animation-delay: 0.40s; }
.panel.active .card:nth-child(6) { animation: fadeUp 0.45s ease both; animation-delay: 0.48s; }
.panel.active .card:nth-child(7) { animation: fadeUp 0.45s ease both; animation-delay: 0.56s; }

.leaderboard {
  animation: fadeUp 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
  animation-delay: 0.25s;
}
.lb-card:nth-child(1) { animation: slideRight 0.45s ease both; animation-delay: 0.3s; }
.lb-card:nth-child(2) { animation: slideRight 0.45s ease both; animation-delay: 0.4s; }
.lb-card:nth-child(3) { animation: slideRight 0.45s ease both; animation-delay: 0.5s; }

.insight {
  animation: fadeUp 0.4s ease both;
}
.panel.active .insight:nth-child(1) { animation-delay: 0.05s; }
.panel.active .insight:nth-child(2) { animation-delay: 0.1s; }
.panel.active .insight:nth-child(3) { animation-delay: 0.15s; }
.panel.active .insight:nth-child(4) { animation-delay: 0.2s; }
.panel.active .insight:nth-child(5) { animation-delay: 0.25s; }
.panel.active .insight:nth-child(6) { animation-delay: 0.3s; }
.panel.active .insight:nth-child(7) { animation-delay: 0.35s; }
.panel.active .insight:nth-child(8) { animation-delay: 0.4s; }
.panel.active .insight:nth-child(9) { animation-delay: 0.45s; }
.panel.active .insight:nth-child(10) { animation-delay: 0.5s; }
.panel.active .insight:nth-child(11) { animation-delay: 0.55s; }
.panel.active .insight:nth-child(12) { animation-delay: 0.6s; }

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--surface);
  border: 3px solid var(--border);
  border-radius: 0;
  padding: 28px;
  margin-bottom: 24px;
  position: relative;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.card:hover {
  transform: translate(-2px, -2px);
}
/* Offset shadow for depth */
.card::after {
  content: '';
  position: absolute;
  top: 6px; left: 6px;
  width: 100%; height: 100%;
  border: 3px solid var(--border);
  z-index: -1;
  background: var(--memphis-yellow);
  opacity: 0.15;
  transition: top 0.2s ease, left 0.2s ease, opacity 0.2s ease;
}
.card:hover::after {
  top: 8px; left: 8px;
  opacity: 0.25;
}

.card-title {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--text);
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 3px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}
/* Decorative Memphis dot before card titles */
.card-title::before {
  content: '';
  display: inline-block;
  width: 10px;
  height: 10px;
  background: var(--memphis-coral);
  border-radius: 50%;
  flex-shrink: 0;
  border: 2px solid var(--border);
}
/* Alternate dot colors for visual variety */
.card:nth-child(2n) .card-title::before { background: var(--memphis-teal); }
.card:nth-child(3n) .card-title::before { background: var(--memphis-yellow); border-radius: 0; transform: rotate(45deg); }
.card:nth-child(5n) .card-title::before { background: var(--memphis-pink); border-radius: 0; }

/* ============================================================
   CHAMPION BANNER
   ============================================================ */
.champion {
  background: var(--surface);
  border: 4px solid var(--blue);
  padding: 48px 40px;
  text-align: center;
  margin-bottom: 32px;
  position: relative;
  overflow: hidden;
}
/* Geometric decorations */
.champion::before {
  content: '';
  position: absolute;
  top: -20px; left: -20px;
  width: 80px; height: 80px;
  background: var(--memphis-pink);
  border-radius: 50%;
  opacity: 0.4;
}
.champion::after {
  content: '';
  position: absolute;
  bottom: -10px; right: 30px;
  width: 60px; height: 60px;
  background: var(--memphis-yellow);
  transform: rotate(45deg);
  opacity: 0.5;
}
.champion .crown {
  font-size: 3.5rem;
  margin-bottom: 8px;
  position: relative;
}
.champion .name {
  font-family: var(--font-display);
  font-size: 3rem;
  font-weight: 900;
  font-style: italic;
  letter-spacing: -0.02em;
  position: relative;
}
.champion .score {
  font-family: var(--font-mono);
  font-size: 1.3rem;
  font-weight: 800;
  margin-top: 10px;
  position: relative;
}
.champion .tagline {
  font-size: 0.85rem;
  color: var(--text3);
  margin-top: 6px;
  position: relative;
  font-style: italic;
}

/* ============================================================
   LEADERBOARD
   ============================================================ */
.leaderboard {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 32px;
}
.lb-card {
  background: var(--surface);
  border: 3px solid var(--border);
  padding: 24px;
  text-align: center;
  transition: transform 0.2s;
  position: relative;
}
.lb-card:hover {
  transform: translate(-3px, -3px);
  box-shadow: 6px 6px 0 var(--border);
}
.lb-card.first {
  border-width: 4px;
}
.lb-card .position {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.2em;
}
.lb-card .position.gold { color: var(--amber); }
.lb-card .position.silver { color: var(--text2); }
.lb-card .position.bronze { color: #a0522d; }
.lb-card .model-badge {
  width: 56px; height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-style: italic;
  color: white;
  margin: 12px auto;
  border: 3px solid var(--border);
}
.lb-card .model-name {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 900;
  margin: 8px 0 4px;
}
.lb-card .model-total {
  font-family: var(--font-mono);
  font-size: 2.2rem;
  font-weight: 800;
}
.lb-card .model-avg {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text3);
}

/* ============================================================
   BAR CHART
   ============================================================ */
.bar-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.bar-label {
  width: 100px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text2);
  text-align: right;
  flex-shrink: 0;
}
.bar-track {
  flex: 1;
  height: 32px;
  background: var(--surface2);
  border: 2px solid var(--border);
  overflow: hidden;
  position: relative;
}
.bar-fill {
  height: 100%;
  display: flex;
  align-items: center;
  padding-left: 12px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  color: white;
  transition: width 1s cubic-bezier(0.22, 1, 0.36, 1);
}
.bar-value {
  width: 50px;
  font-size: 0.85rem;
  font-weight: 800;
  font-family: var(--font-mono);
  text-align: right;
  flex-shrink: 0;
}

/* ============================================================
   GRID TABLES
   ============================================================ */
.grid-table {
  width: 100%;
  border-collapse: collapse;
}
.grid-table th {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text3);
  padding: 10px 14px;
  text-align: left;
  border-bottom: 3px solid var(--border);
}
.grid-table td {
  padding: 10px 14px;
  font-size: 0.85rem;
  border-bottom: 1px solid var(--border-light);
}
.grid-table tr:hover td { background: var(--surface2); }
.grid-table .mono {
  font-family: var(--font-mono);
  font-weight: 700;
}
.grid-table .check-name {
  font-weight: 600;
  color: var(--text2);
}
.grid-table .perfect { color: var(--emerald); }
.grid-table .partial { color: var(--amber); }
.grid-table .fail { color: var(--red); }
.grid-table .winner-cell { background: rgba(0, 168, 120, 0.08); }

/* ============================================================
   RADAR
   ============================================================ */
.radar-container {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px 0;
}

/* ============================================================
   CHALLENGE TABS
   ============================================================ */
.challenge-tabs { display: flex; gap: 4px; margin-bottom: 20px; }
.challenge-tabs button {
  background: var(--surface2);
  border: 2px solid var(--border);
  color: var(--text2);
  padding: 8px 24px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}
.challenge-tabs button.active {
  background: var(--border);
  color: var(--bg);
  border-color: var(--border);
}

/* ============================================================
   INSIGHTS
   ============================================================ */
.insight {
  display: flex;
  gap: 16px;
  padding: 20px;
  background: var(--surface);
  margin-bottom: 10px;
  border-left: 6px solid var(--blue);
  border-top: 2px solid var(--border-light);
  border-right: 2px solid var(--border-light);
  border-bottom: 2px solid var(--border-light);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.insight:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 0 var(--border-light);
}
.insight.warn { border-left-color: var(--amber); }
.insight.fail { border-left-color: var(--red); }
.insight .insight-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface2);
  border: 2px solid var(--border-light);
  border-radius: 50%;
}
.insight.warn .insight-icon { background: rgba(255,184,0,0.1); }
.insight.fail .insight-icon { background: rgba(255,51,102,0.06); }
.insight .insight-text {
  font-size: 0.85rem;
  color: var(--text2);
  line-height: 1.65;
}
.insight .insight-text strong { color: var(--text); }

/* ============================================================
   HEATMAP
   ============================================================ */
.heatmap {
  display: grid;
  grid-template-columns: 160px repeat(3, 1fr);
  gap: 2px;
}
.heatmap-header {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text3);
  padding: 8px 12px;
  text-align: center;
}
.heatmap-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text2);
  padding: 8px 12px;
  display: flex;
  align-items: center;
}
.heatmap-cell {
  padding: 8px 12px;
  text-align: center;
  font-size: 0.85rem;
  font-weight: 800;
  font-family: var(--font-mono);
  border: 1px solid var(--border-light);
  transition: transform 0.15s;
  cursor: default;
}
.heatmap-cell:hover { transform: scale(1.08); }

/* ============================================================
   SPEED CHART
   ============================================================ */
.speed-bars {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  justify-content: center;
  height: 220px;
  padding-top: 20px;
}
.speed-bar-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.speed-bar {
  width: 72px;
  border: 2px solid var(--border);
  border-bottom: none;
  transition: height 1s cubic-bezier(0.22, 1, 0.36, 1);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 10px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 800;
  color: white;
}
.speed-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text3);
}

/* ============================================================
   TOOLTIP
   ============================================================ */
.tooltip {
  position: fixed;
  background: var(--surface);
  border: 3px solid var(--border);
  padding: 10px 14px;
  font-size: 0.78rem;
  color: var(--text2);
  pointer-events: none;
  z-index: 1000;
  box-shadow: 4px 4px 0 var(--border);
  display: none;
  max-width: 300px;
}

/* ============================================================
   RECOVERY
   ============================================================ */
.recovery-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-light);
}
.recovery-model {
  width: 80px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.9rem;
}
.recovery-challenges { display: flex; gap: 8px; flex: 1; }
.recovery-badge {
  padding: 6px 16px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  text-align: center;
  min-width: 70px;
  border: 2px solid;
}
.recovery-badge.pass {
  background: rgba(0, 168, 120, 0.1);
  color: var(--emerald);
  border-color: var(--emerald);
}
.recovery-badge.fail {
  background: rgba(255, 51, 102, 0.08);
  color: var(--red);
  border-color: var(--red);
}
.recovery-badge.na {
  background: var(--surface2);
  color: var(--text3);
  border-color: var(--border-light);
}

/* ============================================================
   PROSE (Analysis, About, Costs, Prompts)
   ============================================================ */
.prose {
  font-size: 0.92rem;
  color: var(--text2);
  line-height: 1.85;
}
.prose p { margin-bottom: 16px; }
.prose strong { color: var(--text); font-weight: 700; }
.prose h3 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 900;
  font-style: italic;
  color: var(--text);
  margin: 36px 0 12px;
}
.prose h3:first-child { margin-top: 0; }

.prose .highlight {
  padding: 20px 24px;
  margin: 16px 0;
  font-size: 0.88rem;
  line-height: 1.7;
  border-left: 6px solid;
  background: var(--surface);
  border-top: 1px solid var(--border-light);
  border-right: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
}
.prose .highlight.blue   { border-left-color: var(--blue); }
.prose .highlight.amber  { border-left-color: var(--amber); }
.prose .highlight.violet { border-left-color: var(--violet); }
.prose .highlight.red    { border-left-color: var(--red); }
.prose .highlight.emerald { border-left-color: var(--emerald); }

.prose .stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 20px 0;
}
.prose .stat-box {
  background: var(--surface);
  border: 3px solid var(--border);
  padding: 20px;
  text-align: center;
  position: relative;
}
.prose .stat-box::after {
  content: '';
  position: absolute;
  top: 4px; left: 4px;
  width: 100%; height: 100%;
  border: 2px solid var(--border-light);
  z-index: -1;
}
.prose .stat-box .stat-val {
  font-size: 2rem;
  font-weight: 900;
  font-family: var(--font-mono);
}
.prose .stat-box .stat-label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text3);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-top: 4px;
}

.prose blockquote {
  border-left: 4px solid var(--border);
  padding-left: 16px;
  color: var(--text3);
  font-style: italic;
  margin: 16px 0;
}

/* ============================================================
   CHALLENGE CARDS (About tab)
   ============================================================ */
.challenge-card {
  background: var(--surface);
  padding: 24px;
  margin-bottom: 16px;
  border: 2px solid var(--border);
}
.challenge-card .cc-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.challenge-card .cc-num {
  width: 44px; height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 900;
  font-style: italic;
  font-size: 1.1rem;
  color: white;
  border: 2px solid var(--border);
}
.challenge-card .cc-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 900;
}
.challenge-card .cc-desc {
  font-size: 0.85rem;
  color: var(--text2);
  line-height: 1.7;
}
.challenge-card .cc-diff {
  display: inline-block;
  padding: 3px 12px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 8px;
  border: 2px solid;
}

/* ============================================================
   DETAILS / SUMMARY (Prompts tab)
   ============================================================ */
details summary::-webkit-details-marker { display: none; }
details summary {
  list-style: none;
  cursor: pointer;
  padding: 14px 18px;
  background: var(--surface2);
  border: 2px solid var(--border);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.82rem;
  transition: background 0.15s;
}
details summary:hover { background: var(--memphis-yellow); }
details[open] summary {
  border-bottom: none;
  background: var(--memphis-yellow);
}

/* Code blocks in prompts */
.prompt-pre {
  color: var(--text2);
  font-size: 0.75rem;
  line-height: 1.65;
  font-family: var(--font-mono);
  white-space: pre-wrap;
  margin: 0;
}
.prompt-block {
  background: var(--surface2);
  border: 2px solid var(--border);
  border-top: none;
  padding: 20px;
  overflow-x: auto;
}

/* ============================================================
   METHODOLOGY TABLES
   ============================================================ */
.method-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}
.method-table th {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text3);
  padding: 10px 12px;
  text-align: left;
  border-bottom: 3px solid var(--border);
}
.method-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: top;
}
.method-table tr:hover td { background: var(--surface2); }
.method-table .check-id {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.75rem;
  white-space: nowrap;
}
.method-table .check-desc {
  color: var(--text2);
  line-height: 1.5;
}

/* Speed tier badges */
.speed-tier {
  display: inline-block;
  padding: 3px 10px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  border: 2px solid;
  margin: 2px 4px 2px 0;
}
.speed-tier.t10 { color: var(--emerald); border-color: var(--emerald); background: rgba(0,168,120,0.08); }
.speed-tier.t7 { color: var(--blue); border-color: var(--blue); background: rgba(0,85,255,0.06); }
.speed-tier.t3 { color: var(--amber); border-color: var(--amber); background: rgba(255,184,0,0.1); }
.speed-tier.t0 { color: var(--red); border-color: var(--red); background: rgba(255,51,102,0.06); }

/* Injection timeline bars */
.timeline-bar-container {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.timeline-bar-label {
  width: 90px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  flex-shrink: 0;
}
.timeline-bar {
  flex: 1;
  height: 28px;
  background: var(--surface2);
  border: 2px solid var(--border);
  position: relative;
  overflow: hidden;
}
.timeline-bar .tl-fill {
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
}
.timeline-bar .tl-inject-marker {
  position: absolute;
  top: 0;
  height: 100%;
  width: 3px;
  background: var(--red);
  z-index: 2;
}
.timeline-bar .tl-inject-marker::after {
  content: '⚡';
  position: absolute;
  top: -16px;
  left: -6px;
  font-size: 0.7rem;
}
.timeline-bar .tl-time {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text2);
}

/* Diagnostic tooltip on score cells */
.grid-table td[title] { cursor: help; }

/* Eligibility badge */
.eligibility-badge {
  display: inline-block;
  padding: 2px 8px;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border: 1.5px solid;
  vertical-align: middle;
  margin-left: 4px;
}
.eligibility-badge.eligible { color: var(--emerald); border-color: var(--emerald); }
.eligibility-badge.ineligible { color: var(--red); border-color: var(--red); }

/* ============================================================
   SCROLL HINT WRAPPER (for data tables on mobile)
   ============================================================ */
.table-scroll-wrapper {
  position: relative;
  overflow: visible;
}
.table-scroll-wrapper .scroll-inner {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.table-scroll-wrapper .scroll-hint {
  display: none;
}

/* ============================================================
   RESPONSIVE — TABLET (≤ 900px)
   ============================================================ */
@media (max-width: 900px) {
  .leaderboard { grid-template-columns: 1fr; }
  .header { padding: 16px 20px; }
  .header::before { display: none; }
  .panel { padding: 20px; }

  /* Nav: horizontal scroll with fade hint */
  .nav {
    padding: 10px 20px;
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    mask-image: linear-gradient(to right, black 85%, transparent 100%);
    -webkit-mask-image: linear-gradient(to right, black 85%, transparent 100%);
  }
  .nav button { flex-shrink: 0; }

  .heatmap { grid-template-columns: 120px repeat(3, 1fr); }
  .prose .stat-grid { grid-template-columns: 1fr; }

  /* Per-challenge mini bars: stack on tablet */
  .panel .card > div[style*="grid-template-columns:repeat(3"] {
    grid-template-columns: 1fr !important;
    gap: 24px !important;
  }

  /* Scoring dimensions 2-col grid */
  .prose div[style*="grid-template-columns:repeat(2"] {
    grid-template-columns: 1fr !important;
  }

  /* Pricing tiers 3-col grid */
  .prose div[style*="grid-template-columns:repeat(3,1fr)"] {
    grid-template-columns: 1fr !important;
  }

  /* Table scroll hints visible on tablet+ small */
  .table-scroll-wrapper .scroll-hint {
    display: block;
    text-align: center;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text3);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 8px 0 4px;
  }
  .table-scroll-wrapper .scroll-inner {
    position: relative;
  }
  /* Right fade gradient on scrollable tables */
  .table-scroll-wrapper::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 40px;
    height: 100%;
    pointer-events: none;
    background: linear-gradient(to right, transparent, var(--surface));
    opacity: 0.8;
    z-index: 2;
  }
  .table-scroll-wrapper.scrolled-end::after {
    opacity: 0;
  }

  /* Speed bars: wrap + reduce height */
  .speed-bars { height: auto; flex-wrap: wrap; gap: 12px 16px; }
  .speed-bar { width: 56px; }

  /* Recovery row: allow wrapping */
  .recovery-challenges { flex-wrap: wrap; }
}

/* ============================================================
   RESPONSIVE — PHONE (≤ 600px)
   ============================================================ */
@media (max-width: 600px) {
  .header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 12px 16px;
  }
  .header h1 { font-size: 1.8rem; }
  .header .subtitle { font-size: 0.55rem; letter-spacing: 0.2em; }
  .header .run-info { text-align: left; font-size: 0.65rem; }
  .header::after { left: 16px; }

  .nav {
    padding: 8px 16px;
    gap: 2px;
  }
  .nav button {
    padding: 6px 12px;
    font-size: 0.6rem;
  }

  .panel { padding: 12px; }

  .card { padding: 16px; margin-bottom: 16px; }
  .card::after { top: 4px; left: 4px; }

  /* Champion banner */
  .champion { padding: 28px 20px; }
  .champion .crown { font-size: 2.4rem; }
  .champion .name { font-size: 1.8rem; }
  .champion .score { font-size: 1rem; }
  .champion .tagline { font-size: 0.75rem; }
  .champion::before { width: 50px; height: 50px; }
  .champion::after { width: 40px; height: 40px; }

  /* Leaderboard cards */
  .lb-card { padding: 16px; }
  .lb-card .model-total { font-size: 1.6rem; }

  /* Bar charts: narrower labels */
  .bar-label { width: 60px; font-size: 0.7rem; }
  .bar-value { width: 40px; font-size: 0.75rem; }

  /* Heatmap: tighter on phone */
  .heatmap {
    grid-template-columns: 90px repeat(3, 1fr);
    gap: 1px;
    font-size: 0.7rem;
  }
  .heatmap-label { font-size: 0.65rem; padding: 6px 4px; }
  .heatmap-cell { padding: 6px 4px; font-size: 0.7rem; }
  .heatmap-header { font-size: 0.55rem; padding: 6px 4px; }

  /* Speed bars: more compact */
  .speed-bars {
    gap: 8px 10px;
    justify-content: flex-start;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 8px;
  }
  .speed-bar { width: 44px; }
  .speed-bar-col { gap: 4px; }
  .speed-label { font-size: 0.6rem; }

  /* Canvases: scale down */
  #radar { width: 100% !important; max-width: 320px; height: auto !important; margin: 0 auto; display: block; }
  #scatter { max-width: 100% !important; }

  /* Recovery: stack on phone */
  .recovery-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .recovery-model { width: auto; }
  .recovery-challenges { width: 100%; }
  .recovery-badge { flex: 1; min-width: 0; padding: 6px 8px; font-size: 0.65rem; }

  /* Challenge tabs: scroll */
  .challenge-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
  }
  .challenge-tabs button { flex-shrink: 0; padding: 6px 14px; font-size: 0.65rem; }

  /* Insights */
  .insight { padding: 14px; gap: 10px; }
  .insight .insight-text { font-size: 0.8rem; }

  /* Prose */
  .prose { font-size: 0.85rem; }
  .prose h3 { font-size: 1.05rem; margin: 24px 0 10px; }
  .prose .stat-box .stat-val { font-size: 1.5rem; }
  .prose .stat-box .stat-label { font-size: 0.6rem; }
  .prose .stat-box { padding: 14px; }

  /* Prompt blocks: ensure scroll */
  .prompt-block { padding: 12px; }
  .prompt-pre { font-size: 0.65rem; }

  /* Challenge cards */
  .challenge-card { padding: 16px; }
  .challenge-card .cc-num { width: 36px; height: 36px; font-size: 0.9rem; }
  .challenge-card .cc-title { font-size: 0.9rem; }
  .challenge-card .cc-desc { font-size: 0.8rem; }

  /* Details/summary */
  details summary { padding: 10px 14px; font-size: 0.75rem; }
}
