:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --surface-3: #e2e8f0;
  --border: #e2e8f0;
  --border-subtle: #edf2f7;
  --text: #0f172a;
  --text-secondary: #475569;
  --muted: #64748b;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-light: #eff6ff;
  --accent-text: #ffffff;
  --ok: #10b981;
  --ok-bg: #ecfdf5;
  --ok-border: #a7f3d0;
  --changed: #f59e0b;
  --changed-bg: #fffbeb;
  --changed-border: #fde68a;
  --error: #ef4444;
  --error-bg: #fef2f2;
  --error-border: #fecaca;
  --report-bg: #0b1120;
  --report-text: #e2e8f0;
  --mono: ui-monospace, "SF Mono", Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  --radius-sm: 4px;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.08);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #090d16;
    --surface: #111827;
    --surface-2: #1f2937;
    --surface-3: #374151;
    --border: #2d3748;
    --border-subtle: #1f2937;
    --text: #f3f4f6;
    --text-secondary: #9ca3af;
    --muted: #808b96;
    --accent: #3b82f6;
    --accent-hover: #60a5fa;
    --accent-light: #1e293b;
    --accent-text: #ffffff;
    --ok: #34d399;
    --ok-bg: #064e3b;
    --ok-border: #047857;
    --changed: #fbbf24;
    --changed-bg: #451a03;
    --changed-border: #78350f;
    --error: #f87171;
    --error-bg: #450a0a;
    --error-border: #991b1b;
    --report-bg: #030712;
    --report-text: #f3f4f6;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

code {
  font-family: var(--mono);
  font-size: 0.9em;
  background: var(--surface-2);
  padding: 1px 5px;
  border-radius: var(--radius-sm);
  color: var(--accent);
}

.hidden { display: none !important; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 12px; }

/* ── Top Bar ───────────────────────────────────────────────────────────── */

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 18px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  z-index: 10;
}

.brand-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.01em;
  text-decoration: none;
  color: var(--text);
}

.brand-icon {
  color: var(--accent);
}

.quick-select {
  font-size: 12px;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
}

.topbar-model {
  flex: 1;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 13px;
}

.topbar-model strong {
  color: var(--text);
  font-size: 14px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.view-toggle {
  display: flex;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px;
  gap: 2px;
}

.view-btn {
  font-size: 12px;
  padding: 3px 9px;
  border: none;
  background: transparent;
  color: var(--muted);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.view-btn:hover {
  color: var(--text);
}

.view-btn.active {
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  user-select: none;
}

.toggle input {
  cursor: pointer;
}

/* ── Buttons & Controls ────────────────────────────────────────────────── */

button {
  font: inherit;
  cursor: pointer;
  border-radius: 6px;
  padding: 6px 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
  font-weight: 600;
}

button.primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: var(--accent-text);
}

button.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
}

button.ghost:hover {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--text);
}

button.small {
  padding: 3px 8px;
  font-size: 12px;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

input, select, textarea {
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent);
}

textarea {
  width: 100%;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.45;
  resize: vertical;
}

/* ── Layout Grid ───────────────────────────────────────────────────────── */

.layout {
  flex: 1;
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: 0;
}

@media (max-width: 860px) {
  .layout {
    grid-template-columns: 1fr;
  }
  .sidebar {
    display: none;
  }
}

.main-stage {
  padding: 20px 28px 60px;
  overflow-y: auto;
  min-height: 0;
  max-width: 1240px;
  width: 100%;
}

/* ── Sidebar ───────────────────────────────────────────────────────────── */

.sidebar {
  border-right: 1px solid var(--border);
  background: var(--surface);
  padding: 12px 10px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-header {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-subtle);
}

.sidebar-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 700;
  padding: 0 4px;
}

.model-search-input {
  font-size: 12px;
  padding: 5px 8px;
  width: 100%;
  border-radius: 6px;
  background: var(--surface-2);
}

.sidebar ul {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar li {
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  transition: background 0.15s ease, color 0.15s ease;
  font-size: 13px;
}

.sidebar li:hover {
  background: var(--surface-2);
}

.sidebar li.active {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
  font-weight: 600;
}

.sidebar-foot {
  font-size: 11px;
  color: var(--muted);
  padding: 8px 4px;
  border-top: 1px solid var(--border-subtle);
  line-height: 1.4;
}

/* Status Badges */
.badge {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 6px;
  border-radius: 12px;
  border: 1px solid var(--border);
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
}

.badge.calibrated {
  color: var(--ok);
  background: var(--ok-bg);
  border-color: var(--ok-border);
}

.badge.draft {
  color: var(--accent);
  background: var(--accent-light);
  border-color: color-mix(in srgb, var(--accent) 30%, transparent);
}

.badge.stub {
  color: var(--muted);
  background: var(--surface-2);
  border-color: var(--border);
}

/* ── Editor Column ─────────────────────────────────────────────────────── */

.editor {
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--bg);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow-sm);
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.card-head h2 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

.card-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

#variant-desc {
  margin: 4px 0 0 0;
  font-size: 13px;
  min-height: 1.2em;
}

/* Parameters & Formulas */
.param {
  padding: 10px 0;
  border-top: 1px solid var(--border-subtle);
}

.param:first-child {
  border-top: none;
  padding-top: 0;
}

.param-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.param-name {
  font-family: var(--mono);
  font-size: 13px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
}

.param-control {
  display: flex;
  align-items: center;
  gap: 8px;
}

.param-control input[type=number] {
  width: 90px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  padding: 4px 6px;
}

.param-control input[type=text] {
  width: 180px;
  font-family: var(--mono);
  font-size: 12px;
  padding: 4px 6px;
}

.param-control input[type=range] {
  width: 100px;
  padding: 0;
  cursor: pointer;
}

.unit {
  color: var(--muted);
  font-size: 12px;
  min-width: 0;
  white-space: nowrap;
}

.param-desc {
  color: var(--text-secondary);
  font-size: 12px;
  margin-top: 4px;
  line-height: 1.35;
}

.param-meta {
  color: var(--muted);
  font-size: 11px;
  margin-top: 3px;
}

.dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: transparent;
  flex: none;
}

.dot.changed {
  background: var(--changed);
}

.param.changed .param-name, .formula.changed .param-name {
  color: var(--changed);
  font-weight: 600;
}

.param.changed input, .formula.changed textarea {
  border-color: var(--changed);
  background: var(--changed-bg);
}

.reset {
  visibility: hidden;
}

.changed .reset {
  visibility: visible;
}

.formula {
  padding: 10px 0;
  border-top: 1px solid var(--border-subtle);
}

.formula:first-child {
  border-top: none;
  padding-top: 0;
}

.formula textarea {
  margin-top: 6px;
  font-size: 12px;
  padding: 6px 8px;
}

/* ── Output & Results Column ───────────────────────────────────────────── */

.output {
  overflow-y: auto;
  padding: 14px 18px;
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  background: var(--bg);
}

/* Tabs */
.tabs {
  display: flex;
  gap: 2px;
  align-items: center;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 5;
}

.tab {
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  padding: 8px 14px;
  font-weight: 500;
  font-size: 13px;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.tab:hover {
  color: var(--text);
  background: transparent;
  border-color: transparent;
}

.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
  background: transparent;
}

.tabs-spacer { flex: 1; }

.status {
  font-size: 13px;
  min-height: 0;
  padding: 0;
  transition: all 0.2s ease;
}

.status.error {
  color: var(--error);
  background: var(--error-bg);
  border: 1px solid var(--error-border);
  padding: 8px 12px;
  border-radius: var(--radius);
  white-space: pre-wrap;
}

.status.ok {
  color: var(--ok);
  font-size: 12px;
}

/* Baseline Bar */
.baseline {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  box-shadow: var(--shadow-sm);
}

.baseline-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.baseline-badge {
  font-size: 11px;
  text-transform: uppercase;
  font-weight: 700;
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  color: var(--accent);
  padding: 2px 7px;
  border-radius: 4px;
  letter-spacing: 0.05em;
  margin-right: 8px;
}

.baseline-sub {
  font-size: 12px;
  color: var(--muted);
}

.baseline table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.baseline th {
  text-align: left;
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
  padding: 5px 8px;
  border-bottom: 1px solid var(--border);
}

.baseline td {
  padding: 5px 8px;
  font-variant-numeric: tabular-nums;
  border-bottom: 1px solid var(--border-subtle);
}

.baseline td.num, .baseline th.num { text-align: right; }
.baseline td.up { color: var(--ok); font-weight: 600; }
.baseline td.down { color: var(--changed); font-weight: 600; }

/* ── 🌟 EXPLORE TAB (Core Web UI to explore results) ────────────────────── */

.explore-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Hero Result Card */
.hero-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  overflow: hidden;
}

.hero-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--accent), #60a5fa);
}

.hero-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.hero-primary-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.hero-eyebrow {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 600;
}

.hero-value {
  font-size: 2.3rem;
  line-height: 1.1;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  letter-spacing: -0.02em;
}

.hero-value-unit {
  font-size: 1.2rem;
  font-weight: 500;
  color: var(--muted);
  margin-left: 4px;
}

.hero-delta-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 12px;
  align-self: flex-start;
}

.hero-delta-pill.up { background: var(--ok-bg); color: var(--ok); border: 1px solid var(--ok-border); }
.hero-delta-pill.down { background: var(--changed-bg); color: var(--changed); border: 1px solid var(--changed-border); }

/* Range / Confidence Whisker */
.whisker-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 14px;
  background: var(--surface-2);
  border-radius: var(--radius);
  border: 1px solid var(--border-subtle);
}

.whisker-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
}

.whisker-bar-container {
  position: relative;
  height: 8px;
  background: var(--surface-3);
  border-radius: 4px;
  margin: 6px 0;
}

.whisker-range-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  background: color-mix(in srgb, var(--accent) 45%, transparent);
  border-radius: 4px;
}

.whisker-dot {
  position: absolute;
  top: 50%;
  width: 12px;
  height: 12px;
  background: var(--accent);
  border: 2px solid var(--surface);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.whisker-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

/* Scenario Inputs Badges */
.scenario-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.scenario-pill {
  font-size: 11px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 12px;
  color: var(--text-secondary);
}

.scenario-pill strong {
  color: var(--text);
}

/* ── Specialized Model Exploration Grids ───────────────────────────────── */

.explore-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-card-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  font-weight: 600;
}

.stat-card-value {
  font-size: 1.4rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.stat-card-sub {
  font-size: 12px;
  color: var(--text-secondary);
}

/* Distribution Ladder (e.g. S&P 500 percentiles) */
.ladder-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ladder-row {
  display: grid;
  grid-template-columns: 85px 1fr 110px;
  align-items: center;
  gap: 12px;
  font-size: 13px;
}

.ladder-label {
  font-weight: 500;
  color: var(--text-secondary);
  font-size: 12px;
}

.ladder-bar-bg {
  height: 18px;
  background: var(--surface-2);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.ladder-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.ladder-val {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 12.5px;
}

/* Interactive Calculator Card */
.calc-card {
  background: linear-gradient(135deg, var(--surface), var(--surface-2));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.calc-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.calc-input-row input[type=number] {
  width: 130px;
  font-weight: 600;
}

.calc-result-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.calc-result-main {
  font-size: 1.35rem;
  font-weight: 750;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

/* Pitch / Probability Horizontal Bars */
.prob-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: var(--shadow-sm);
}

.prob-item-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}

.prob-item-title {
  font-weight: 600;
}

.prob-item-note {
  font-size: 11px;
  color: var(--muted);
  margin-left: 6px;
}

.prob-item-val {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.prob-bar-track {
  height: 8px;
  background: var(--surface-2);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.prob-bar-fill {
  height: 100%;
  border-radius: 4px;
  background: var(--accent);
  transition: width 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.prob-bar-fill.high { background: var(--ok); }
.prob-bar-fill.medium { background: var(--accent); }
.prob-bar-fill.low { background: #94a3b8; }

/* Bullpen / Roster Cards */
.roster-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
}

.pitcher-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.pitcher-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
}

.pitcher-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.pitcher-name {
  font-weight: 600;
  font-size: 14px;
}

.role-pill {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 10px;
  letter-spacing: 0.04em;
}

.role-closer { background: #fee2e2; color: #b91c1c; }
.role-setup { background: #fef3c7; color: #b45309; }
.role-middle { background: #e0f2fe; color: #0369a1; }
.role-long { background: #f1f5f9; color: #475569; }

.pitcher-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  font-size: 11.5px;
  color: var(--muted);
  border-top: 1px solid var(--border-subtle);
  padding-top: 6px;
}

.pitcher-metrics strong {
  color: var(--text);
}

/* ── Outcomes Breakdown Filter & List ──────────────────────────────────── */

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}

.section-title {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 700;
}

.filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-chip {
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

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

.filter-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
  font-weight: 600;
}

.filter-search {
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  width: 140px;
}

.outcomes-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.outcome-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease;
}

.outcome-row:hover {
  border-color: color-mix(in srgb, var(--accent) 40%, transparent);
}

.outcome-main {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.outcome-label {
  font-weight: 600;
  font-size: 13.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.outcome-note {
  font-size: 11.5px;
  color: var(--muted);
}

.outcome-vis {
  width: 120px;
}

.outcome-value-wrap {
  text-align: right;
  min-width: 80px;
}

.outcome-value {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-size: 14px;
}

/* ── Steps / Calculation Trace ─────────────────────────────────────────── */

.trace-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.trace-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  box-shadow: var(--shadow-sm);
}

.trace-num {
  font-size: 11px;
  font-weight: 700;
  background: var(--surface-2);
  color: var(--accent);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  border: 1px solid var(--border);
}

.trace-body {
  font-size: 13px;
  line-height: 1.45;
  color: var(--text);
}

/* ── Model Blueprint (for Stubs) ───────────────────────────────────────── */

.blueprint-card {
  background: var(--surface);
  border: 1px dashed var(--accent);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.blueprint-badge {
  align-self: flex-start;
  font-size: 11px;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.05em;
  background: var(--accent-light);
  color: var(--accent);
  padding: 3px 8px;
  border-radius: 4px;
}

.blueprint-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}

.blueprint-question {
  font-size: 15px;
  color: var(--text-secondary);
  font-style: italic;
}

/* ── Data Tables ───────────────────────────────────────────────────────── */

.table-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.table-filters {
  display: flex;
  align-items: center;
  gap: 8px;
}

.table-wrapper {
  overflow: auto;
  max-width: 100%;
  max-height: calc(100vh - 160px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table thead {
  position: sticky;
  top: 0;
  background: var(--surface-2);
  z-index: 2;
}

.data-table th {
  text-align: left;
  padding: 8px 12px;
  font-weight: 600;
  font-size: 12px;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-subtle);
  font-variant-numeric: tabular-nums;
}

.data-table tr:hover td {
  background: var(--surface-2);
}

.data-table td.num, .data-table th.num {
  text-align: right;
}

/* ── Raw Reports, Markdown, Docs ───────────────────────────────────────── */

.panel-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.report {
  margin: 0;
  padding: 16px 18px;
  background: var(--report-bg);
  color: var(--report-text);
  border-radius: var(--radius);
  font: 12.5px/1.45 var(--mono);
  overflow: auto;
  white-space: pre;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.4);
}

.report.stale {
  opacity: 0.55;
}

.markdown-preview {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
}

.code-details {
  margin-top: 12px;
  font-size: 12px;
}

.code-details summary {
  cursor: pointer;
  color: var(--muted);
  padding: 4px 0;
}

.docs {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  line-height: 1.6;
}

.docs h1, .docs h2, .docs h3 {
  margin-top: 1.5em;
  margin-bottom: 0.5em;
  color: var(--text);
}

.docs h1:first-child { margin-top: 0; }
.docs hr { border: none; border-top: 1px solid var(--border); margin: 24px 0; }
.docs table { width: 100%; border-collapse: collapse; margin: 16px 0; font-size: 13px; }
.docs th, .docs td { padding: 6px 10px; border: 1px solid var(--border); }
.docs th { background: var(--surface-2); font-weight: 600; text-align: left; }

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
  font-size: 14px;
}

/* ── Name Dialog ───────────────────────────────────────────────────────── */

dialog {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2);
  max-width: 420px;
  width: 90%;
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
}

dialog form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

dialog h3 {
  margin: 0;
  font-size: 16px;
}

dialog label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
}

dialog input {
  width: 100%;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
}

/* ── Runner Progression Curve & Interactive Workbench ──────────────────── */

.runner-chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.chart-legend {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 12px;
  color: var(--text-secondary);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.legend-line {
  width: 14px;
  height: 3px;
  border-radius: 2px;
  display: inline-block;
}

.legend-band {
  width: 14px;
  height: 8px;
  border-radius: 2px;
  display: inline-block;
}

.curve-svg-container {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.curve-svg-container svg {
  display: block;
  width: 100%;
  height: auto;
  min-width: 500px;
}

.workbench-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.workbench-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.workbench-row label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.workbench-races-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.workbench-races-table th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  color: var(--muted);
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
}

.workbench-races-table td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--border-subtle);
}

.workbench-races-table input,
.workbench-races-table select {
  padding: 4px 8px;
  font-size: 13px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
}

/* ── 🏠 Home Page Showcase ────────────────────────────────────────────── */

.home-view {
  flex: 1;
  overflow-y: auto;
  padding: 28px 24px 48px;
  background: var(--bg);
}

.home-container {
  max-width: 1240px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.home-hero {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  overflow: hidden;
}

.home-hero::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--accent), #10b981, #f59e0b);
}

.home-hero-badge {
  align-self: flex-start;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  background: var(--accent-light);
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
}

.home-hero-title {
  margin: 0;
  font-size: 1.85rem;
  font-weight: 750;
  letter-spacing: -0.02em;
  color: var(--text);
}

.home-hero-sub {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-secondary);
  max-width: 860px;
}

.home-category-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.home-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 18px;
}

.home-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.home-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
}

.home-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.home-cat-pill {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--surface-2);
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
}

.home-card-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
}

.home-card-title:hover {
  color: var(--accent);
}

.home-card-question {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  line-height: 1.4;
}

.home-card-desc {
  margin: 0;
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.45;
  flex: 1;
}

.home-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.home-preset-btn {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.home-preset-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
}

.home-card-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
}

.sidebar-home-item {
  width: 100%;
  justify-content: space-between;
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 600;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.sidebar-home-item.active {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  border-color: color-mix(in srgb, var(--accent) 35%, transparent);
  color: var(--accent);
}

/* ── Friendly Input Form & Example Pills ──────────────────────────────── */

.example-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.example-pill {
  font-size: 11.5px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.example-pill.active,
.example-pill:hover {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

.scenario-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}

.scenario-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 12px;
  flex-wrap: wrap;
}

.scenario-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.scenario-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.friendly-inputs {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
}

.friendly-inputs:empty {
  display: none;
}

.friendly-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--surface-2);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  flex: 1 1 200px;
  max-width: 340px;
}

.friendly-field label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.friendly-field input,
.friendly-field select {
  padding: 8px 10px;
  font-size: 13.5px;
  font-weight: 500;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  width: 100%;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.friendly-field input:focus,
.friendly-field select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 20%, transparent);
}

/* Custom Interactive Autocomplete Dropdown */
.autocomplete-wrapper {
  position: relative;
  width: 100%;
}

.autocomplete-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.22);
  max-height: 280px;
  overflow-y: auto;
  z-index: 1000;
  display: none;
}

.autocomplete-dropdown.open {
  display: block;
}

.autocomplete-header {
  padding: 6px 12px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}

.autocomplete-item {
  padding: 9px 12px;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 40%, transparent);
  transition: background 0.1s ease, color 0.1s ease;
}

.autocomplete-item:last-child {
  border-bottom: none;
}

.autocomplete-item:hover,
.autocomplete-item.selected {
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  color: var(--accent);
  font-weight: 600;
}

.autocomplete-match {
  color: var(--accent);
  font-weight: 700;
}

.autocomplete-badge {
  font-size: 10px;
  padding: 2px 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--muted);
}

.toml-details {
  border-top: 1px solid var(--border-subtle);
  padding-top: 8px;
}

.toml-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  user-select: none;
}

/* ── Model Explorer Visual Cards ──────────────────────────────────────── */

.versus-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: center;
}

.versus-badge {
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.player-box {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.player-box-title {
  font-weight: 700;
  font-size: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.player-stats-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
}

.podium-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.podium-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.podium-card.gold {
  border-color: #f59e0b;
  background: color-mix(in srgb, #f59e0b 8%, var(--surface));
}

.podium-place {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--muted);
}

.podium-name {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
}

.podium-meta {
  font-size: 12px;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

/* ── Static-site notice, Tweak tab ─────────────────────────────────────── */

.static-note {
  margin: 10px 0 0;
  padding: 8px 12px;
  font-size: 12.5px;
  color: var(--text);
  background: var(--changed-bg);
  border: 1px solid var(--changed-border);
  border-radius: var(--radius-sm);
}

.status.warn {
  color: var(--changed);
  font-size: 12px;
}

#panel-tweak {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

#panel-tweak.hidden { display: none; }

.tweak-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.inputs-editor {
  width: 100%;
  box-sizing: border-box;
  font: 12.5px/1.45 var(--mono);
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  resize: vertical;
}

#panel-tweak input:disabled,
#panel-tweak select:disabled,
#panel-tweak textarea:disabled,
#panel-tweak button:disabled,
.friendly-inputs input:disabled,
.friendly-inputs select:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}


/* ── Race-time distance chart: median + 50/80/95% bands ─────────────────── */

:root { --race-color: #d97706; }

.band-summary { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.band-summary-head { display: flex; gap: 24px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 4px; }
.band-median { font-size: 2.2rem; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text); }
.band-explainer { flex: 1; min-width: 240px; margin: 0; font-size: 12.5px; color: var(--text-secondary); }
.band-row { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-secondary); }
.band-row strong { margin-left: auto; color: var(--text); font-variant-numeric: tabular-nums; }
.band-swatch { display: inline-block; width: 18px; height: 12px; border-radius: 3px; background: var(--accent); }
.band-swatch.band-50 { opacity: 0.42; }
.band-swatch.band-80 { opacity: 0.24; }
.band-swatch.band-95 { opacity: 0.12; }

.curve-svg-container { position: relative; }
.curve-svg .band-fill { fill: var(--accent); stroke: none; }
.curve-svg .band-95 { opacity: 0.10; }
.curve-svg .band-80 { opacity: 0.16; }
.curve-svg .band-50 { opacity: 0.26; }
.curve-svg .median-line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.curve-svg .chart-grid { stroke: var(--border-subtle); stroke-width: 1; }
.curve-svg .chart-tick { font-size: 11px; fill: var(--muted); }
.curve-svg .chart-tick.strong { fill: var(--text); font-weight: 600; }
.curve-svg .chart-axis-title { font-size: 11px; fill: var(--muted); }
.curve-svg .common-guide { stroke: var(--border); stroke-width: 1; }
.curve-svg .common-label { font-size: 11.5px; font-weight: 600; fill: var(--text); }
.curve-svg .common-value { font-size: 11.5px; font-weight: 600; fill: var(--text); paint-order: stroke; stroke: var(--surface); stroke-width: 3px; }
.curve-svg .common-marker { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.curve-svg .race-marker { fill: var(--race-color); stroke: var(--surface); stroke-width: 2; }
.curve-svg .chart-crosshair { stroke: var(--muted); stroke-width: 1; }
.median-swatch { background: var(--accent); }
.race-swatch { background: var(--race-color); }

.chart-tooltip {
  position: absolute;
  pointer-events: none;
  min-width: 170px;
  padding: 8px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
  font-size: 12px;
  color: var(--text-secondary);
  z-index: 3;
}
.chart-tooltip .tip-value { font-size: 15px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.chart-tooltip .tip-label { margin-bottom: 4px; }
.chart-tooltip .tip-row { font-variant-numeric: tabular-nums; }
.data-table tr.common-row td { font-weight: 600; color: var(--text); }
.data-table tr:not(.common-row) td { color: var(--text-secondary); }


/* ── Home page games row ───────────────────────────────────────────────── */

.home-games { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 16px; }
.home-games-label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.home-game-link {
  display: inline-flex; flex-direction: column; gap: 2px; padding: 8px 14px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface);
  color: var(--text); text-decoration: none; font-size: 13px;
}
.home-game-link span { font-size: 12px; color: var(--text-secondary); }
.home-game-link:hover { border-color: var(--accent); }


/* ── Game replay player ────────────────────────────────────────────────── */

.replay-card { display: flex; gap: 24px; flex-wrap: wrap; align-items: flex-start; }
.replay-stage { flex: 0 0 auto; }
.replay-canvas { width: 360px; height: 640px; border-radius: 18px; box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25); background: #0b1020; }
.replay-side { flex: 1; min-width: 260px; display: flex; flex-direction: column; gap: 8px; }
.replay-controls { display: flex; align-items: center; gap: 12px; }
.replay-time { font-variant-numeric: tabular-nums; color: var(--text-secondary); font-size: 13px; }
.replay-scrub { width: 100%; }
.replay-top { font-size: 13px; padding: 6px 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; }
.replay-top:hover { border-color: var(--accent); }
.replay-cmd { white-space: pre-wrap; font-size: 12px; padding: 10px 12px; }

/* ranked_choice: place-by-method grid */
.rc-grid td.rc-up { background: var(--accent-light); color: var(--text); font-weight: 600; }
.rc-grid td.rc-down { background: var(--changed-bg); color: var(--text); font-weight: 600; }
.rc-grid td.rc-same { color: var(--muted); }
