@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700;900&display=swap');

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

/* ════════════════════════════
   LIGHT THEME
════════════════════════════ */
[data-theme="light"] {
  --surface-low:     oklch(97.9% 0.006 45.7);
  --base:            oklch(96.9% 0.009 50.4);
  --base-high:       oklch(96.0% 0.011 49.9);
  --surface-high:    oklch(94.9% 0.014 46.1);
  --surface-higher:  oklch(93.0% 0.020 48.3);
  --surface-highest: oklch(91.1% 0.022 49.0);
  --faint:           oklch(84.5% 0.018 48.3);
  --muted:           oklch(73.1% 0.018 49.2);
  --subtext:         oklch(56.8% 0.018 48.1);
  --text:            oklch(43.3% 0.018 47.9);
  --fg-accent:       oklch(43.2% 0.097 59.8);
  --rg-accent:       oklch(73.0% 0.120 60.8);
  --bg-accent:       oklch(89.3% 0.068 60.3);
  --fg-accent-2:     oklch(43.2% 0.088 242.2);
  --rg-accent-2:     oklch(73.0% 0.110 241.8);
  --bg-accent-2:     oklch(89.2% 0.058 241.4);
  --fg-red:          oklch(56.8% 0.125 15.5);
  --fg-green:        oklch(56.8% 0.123 125.2);
  --canvas:          oklch(99% 0.003 50);
  --pill-accent:     #e8721a;
  --pill-accent-hover: #d4670f;
  --outer-bg:        oklch(100% 0 0);
}

/* ════════════════════════════
   DARK THEME
════════════════════════════ */
[data-theme="dark"] {
  --surface-low:     oklch(18% 0.003 260);
  --base:            oklch(21% 0.003 260);
  --base-high:       oklch(24% 0.003 260);
  --surface-high:    oklch(27% 0.003 260);
  --surface-higher:  oklch(31% 0.003 260);
  --surface-highest: oklch(36% 0.003 260);
  --faint:           oklch(44% 0.003 260);
  --muted:           oklch(55% 0.003 260);
  --subtext:         oklch(72% 0.003 260);
  --text:            oklch(93% 0.003 260);
  --fg-accent:       oklch(78% 0.120 60.0);
  --rg-accent:       oklch(60% 0.131 60.6);
  --bg-accent:       oklch(30% 0.060 60.0);
  --fg-accent-2:     oklch(78% 0.100 242.0);
  --rg-accent-2:     oklch(60% 0.122 242.1);
  --bg-accent-2:     oklch(28% 0.055 242.0);
  --fg-red:          oklch(75% 0.140 15.0);
  --fg-green:        oklch(75% 0.140 125.0);
  --canvas:          oklch(22% 0.003 260);
  --pill-accent:     #e8721a;
  --pill-accent-hover: #f59340;
  --outer-bg:        oklch(18% 0.003 260);
}

body {
  font-family: 'Roboto', sans-serif;
  background: var(--outer-bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

.mono { font-family: 'Roboto', sans-serif; font-variant-numeric: tabular-nums; }

/* ════════════════════════════
   TOPBAR
════════════════════════════ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 200;
  height: 54px;
  display: flex;
  align-items: center;
  padding: 0 18px;
  gap: 10px;
  background: var(--base-high);
  border-bottom: 1px solid var(--surface-highest);
}

.topbar-left { display: flex; align-items: center; gap: 14px; flex: 1; }
.brand { display: flex; align-items: center; gap: 8px; }

.brand-icon {
  width: 28px; height: 28px;
  background: var(--fg-accent);
  border-radius: 6px;
  display: grid;
  place-items: center;
  color: #fff;
  flex-shrink: 0;
}

.brand-icon svg { width: 16px; height: 16px; }

.brand-text {
  font-size: 16px;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
  white-space: nowrap;
  letter-spacing: -0.02em;
}

.brand-text em { font-style: normal; font-weight: 500; color: var(--subtext); }

.topbar-pill {
  background: var(--surface-high);
  border: 1px solid var(--surface-highest);
  color: var(--subtext);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 99px;
}

.topbar-nav { display: flex; gap: 0; }

.nav-tab {
  font-family: 'Roboto', sans-serif;
  font-size: 13px;
  font-weight: 600;
  padding: 16px 16px 14px;
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--subtext);
  cursor: pointer;
  transition: all 0.15s;
  margin-bottom: -1px;
}

.nav-tab:hover { color: var(--text); }
.nav-tab.active { color: var(--fg-accent); border-bottom-color: var(--fg-accent); }

.topbar-right { display: flex; align-items: center; gap: 7px; }

/* ════════════════════════════
   BUTTONS
════════════════════════════ */
.btn {
  font-family: 'Roboto', sans-serif;
  font-weight: 600;
  border-radius: 8px;
  border: 1px solid var(--surface-highest);
  padding: 9px 18px;
  font-size: 13px;
  background: var(--base-high);
  color: var(--text);
  cursor: pointer;
  transition: all 0.12s;
  white-space: nowrap;
}

.btn:hover { background: var(--surface-high); }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.25; cursor: not-allowed; transform: none; }
.btn-sm { padding: 6px 12px; font-size: 12px; }

.btn-accent {
  background: var(--pill-accent);
  color: #fff;
  border-color: var(--pill-accent);
  font-weight: 700;
}

.btn-accent:hover { background: var(--pill-accent-hover); border-color: var(--pill-accent-hover); }
.btn-accent:disabled { background: var(--base-high); color: var(--subtext); border-color: var(--surface-highest); }

.btn-ghost { background: transparent; color: var(--subtext); border-color: var(--surface-highest); }
.btn-ghost:hover { background: var(--base-high); color: var(--text); }
.btn-outline { background: transparent; color: var(--subtext); border-color: var(--surface-highest); }
.btn-outline:hover { color: var(--text); background: var(--base-high); }
.full-w { width: 100%; }

.theme-btn {
  width: 32px; height: 32px;
  border-radius: 6px;
  border: 1px solid var(--surface-highest);
  background: var(--surface-high);
  color: var(--subtext);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all 0.15s;
}

.theme-btn svg { width: 14px; height: 14px; }
.theme-btn:hover { color: var(--text); background: var(--surface-higher); }
[data-theme="dark"] .icon-light { display: none; }
[data-theme="light"] .icon-dark { display: none; }

/* ════════════════════════════
   TAB CONTENT
════════════════════════════ */
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ════════════════════════════
   INSPECTOR LAYOUT
════════════════════════════ */
.inspector-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  height: calc(100vh - 54px);
  transition: grid-template-columns 0.3s ease;
}

.inspector-layout.busy { grid-template-columns: 1fr 0px; }

.viewport-col {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--surface-highest);
  overflow: hidden;
}

.viewport-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--outer-bg);
  min-height: 0;
}

#viewport {
  position: relative;
  width: min(100%, calc(100vh - 54px - 44px - 40px));
  aspect-ratio: 1;
  border-radius: 12px;
  overflow: hidden;
  background: var(--canvas);
  border: 1px solid var(--surface-highest);
  cursor: grab;
  user-select: none;
  touch-action: none;
  transition: border-color 0.2s;
}

#viewport:hover { border-color: var(--surface-highest); }
#viewport:active { cursor: grabbing; }

.compass {
  position: absolute;
  top: 12px; right: 12px;
  width: 80px; height: 80px;
  pointer-events: none;
  z-index: 2;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,0.35));
  background: rgba(0,0,0,0.45);
  border-radius: 50%;
  backdrop-filter: blur(6px);
}

#frame { display: block; width: 100%; aspect-ratio: 1; pointer-events: none; }
#pybullet-frame { display: block; width: 100%; aspect-ratio: 1; pointer-events: none; object-fit: contain; transition: all 0.3s ease; }
#pybullet-frame.pip { position: absolute; bottom: 12px; right: 12px; width: 25%; border-radius: 8px; border: 2px solid var(--surface-highest); box-shadow: 0 2px 8px rgba(0,0,0,0.3); z-index: 10; }

#loading {
  position: absolute;
  top: 12px; right: 12px;
  opacity: 0;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  border-radius: 99px;
  background: rgba(0,0,0,0.75);
  border: 1px solid rgba(255,255,255,0.15);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #fff;
  transition: opacity 0.2s;
}

.spinner {
  width: 9px; height: 9px;
  border-radius: 50%;
  border: 2px solid var(--fg-accent);
  border-top-color: transparent;
  animation: spin 0.6s linear infinite;
  flex-shrink: 0;
}

@keyframes spin { to { transform: rotate(360deg); } }
#loading.visible { opacity: 1; }

.viewport-hint {
  position: absolute;
  bottom: 12px; left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  color: #fff;
  text-shadow: 1px 1px 3px rgba(0,0,0,0.6);
  letter-spacing: 0.07em;
  text-transform: uppercase;
  font-weight: 600;
  pointer-events: none;
}

.viewport-status {
  position: absolute;
  top: 12px; left: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 99px;
  background: rgba(0,0,0,0.65);
  font-size: 11px;
  font-weight: 600;
  color: #fff;
}

.vs-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--fg-red);
  transition: background 0.3s;
  flex-shrink: 0;
}

.vs-dot.ok { background: var(--fg-green); box-shadow: 0 0 6px var(--fg-green); }

.collapse-flash {
  position: absolute; inset: 0;
  background: var(--fg-red);
  opacity: 0;
  pointer-events: none;
  border-radius: 12px;
}

.collapse-flash.active { animation: cflash 0.9s ease-out forwards; }
@keyframes cflash { 0% { opacity: 0.45; } 100% { opacity: 0; } }

/* BOTTOM DOCK */
.bottom-dock {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 42px;
  border-top: 1px solid var(--surface-highest);
  background: var(--base);
  padding: 0 18px;
  flex-shrink: 0;
}

.bottom-dock.hidden { display: flex !important; visibility: hidden; }
.dock-left, .dock-right { display: flex; align-items: center; gap: 7px; }

.dock-seed-input {
  width: 72px;
  background: var(--surface-high);
  border: 1px solid var(--surface-highest);
  border-radius: 6px;
  padding: 4px 8px;
  color: var(--text);
  font-family: 'Roboto', sans-serif;
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  font-weight: 500;
  outline: none;
  -webkit-appearance: none;
}

.dock-seed-input:focus { border-color: var(--fg-accent); }

.ss-item { display: flex; align-items: center; gap: 7px; }
.ss-sep { width: 1px; height: 16px; background: var(--surface-highest); margin: 0 16px; }
.ss-label { font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--subtext); }
.ss-val { font-size: 13px; font-weight: 600; color: var(--text); }
.ss-val.mono { font-variant-numeric: tabular-nums; }
.ss-val.highlight { color: var(--fg-accent); }
.ss-val.red { color: var(--fg-red); }
.ss-val.green { color: var(--fg-green); }

/* ════════════════════════════
   CONTROLS COLUMN
════════════════════════════ */
.controls-col {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--base);
  scrollbar-width: thin;
  scrollbar-color: var(--surface-high) transparent;
  transition: opacity 0.2s;
}

.inspector-layout.busy .controls-col { opacity: 0; pointer-events: none; }

.sidebar-tabs {
  display: flex;
  border-bottom: 1px solid var(--surface-higher);
  flex-shrink: 0;
}

.sidebar-tab {
  font-family: 'Roboto', sans-serif;
  font-size: 13px;
  font-weight: 600;
  padding: 12px 18px 10px;
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--subtext);
  cursor: pointer;
  transition: all 0.15s;
  margin-bottom: -1px;
  flex: 1;
  text-align: center;
}

.sidebar-tab:hover { color: var(--text); }
.sidebar-tab.active { color: var(--fg-accent-2); border-bottom-color: var(--fg-accent-2); }

#llm-action-selector {
  padding: 16px 18px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.llm-action-icon { width: 80px; height: 80px; color: var(--text); margin-bottom: 8px; }
.llm-action-icon svg { width: 100%; height: 100%; }

.llm-action-labels { display: flex; gap: 0; width: 100%; }

.llm-action-label {
  font-family: 'Roboto', sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 8px 0 6px;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s;
  flex: 1;
  text-align: center;
}

.llm-action-label:hover { color: var(--text); }
.llm-action-label.active { color: var(--fg-accent); border-bottom: 2px solid var(--fg-accent); }

.card { padding: 16px 18px; border-bottom: 1px solid var(--surface-higher); }
.card:last-child { border-bottom: none; }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }

.chip {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 5px;
  background: var(--bg-accent);
  color: var(--text);
}

.chip.blue { background: var(--bg-accent-2); color: var(--fg-accent-2); }
.chip.red { color: var(--fg-red); background: oklch(from var(--fg-red) l c h / 0.12); }

.card-illustration {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 80px;
  margin-bottom: 12px;
  color: var(--text);
}

.card-illustration svg { max-height: 100%; max-width: 100%; }

.card-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--subtext);
  text-align: center;
  margin-bottom: 12px;
}

.cam-row {
  display: flex;
  background: var(--base-high);
  border: 1px solid var(--surface-higher);
  border-radius: 10px;
  overflow: hidden;
}

.cam-cell { flex: 1; padding: 10px 0; text-align: center; }
.cam-divider { width: 1px; background: var(--surface-highest); margin: 6px 0; }

.cam-val {
  font-variant-numeric: tabular-nums;
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 2px;
}

.cam-label { font-size: 9px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--subtext); }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.form-field { display: flex; flex-direction: column; gap: 5px; }
.form-field.half { grid-column: span 1; }
.form-field.full { grid-column: 1 / -1; }
.form-label { font-size: 10px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--subtext); }

.form-input {
  width: 100%;
  background: var(--base-high);
  border: 1px solid var(--surface-highest);
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--text);
  font-family: 'Roboto', sans-serif;
  font-size: 13px;
  font-weight: 600;
  outline: none;
  transition: border-color 0.15s;
  -webkit-appearance: none;
}

.form-input:focus { border-color: var(--fg-accent); }
.form-input:disabled, .form-input.is-disabled { opacity: 0.55; cursor: not-allowed; }

.hidden { display: none !important; }

.pill-group { display: flex; gap: 5px; }

.pill-group.direction-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 5px;
}

.pill {
  font-family: 'Roboto', sans-serif;
  font-size: 12px;
  font-weight: 700;
  padding: 7px 4px;
  border-radius: 7px;
  border: 1.5px solid var(--surface-highest);
  background: var(--base-high);
  color: var(--subtext);
  cursor: pointer;
  transition: all 0.12s;
  text-align: center;
  flex: 1;
}

.pill:hover { color: var(--text); border-color: var(--fg-accent); }
.pill.disabled, .pill:disabled { opacity: 0.38; cursor: not-allowed; color: var(--muted); border-color: var(--surface-highest); }
.pill.disabled:hover, .pill:disabled:hover { color: var(--muted); border-color: var(--surface-highest); }
.pill.active { background: var(--pill-accent); color: #fff; border-color: var(--pill-accent); }
.pill.active[data-val="Blue"]  { background: oklch(48.3% 0.099 242.0); border-color: oklch(48.3% 0.099 242.0); }
.pill.active[data-val="Green"] { background: oklch(52.0% 0.128 149.0); border-color: oklch(52.0% 0.128 149.0); }
.pill.active[data-val="Red"]   { background: oklch(48.4% 0.120 15.2);  border-color: oklch(48.4% 0.120 15.2); }

.card-actions { display: flex; flex-direction: column; gap: 6px; }
#panel-push { border-bottom: none; }
.sidebar-footer { margin-top: auto; padding: 12px 18px; border-top: 1px solid var(--surface-higher); }
.form-error { min-height: 14px; font-size: 11px; color: var(--fg-red); font-weight: 600; }

/* ════════════════════════════
   RESULTS TAB
════════════════════════════ */
.results-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  min-height: calc(100vh - 54px);
}

.results-main {
  padding: 28px 32px;
  border-right: 1px solid var(--surface-highest);
  overflow-y: auto;
  background: var(--outer-bg);
}

.results-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
}

.results-title { font-size: 24px; font-weight: 800; color: var(--text); letter-spacing: -0.02em; line-height: 1; }
.results-sub { font-size: 13px; color: var(--subtext); margin-top: 6px; }

.results-seed-info {
  font-size: 13px;
  color: var(--subtext);
  padding: 8px 14px;
  background: var(--base);
  border: 1px solid var(--surface-highest);
  border-radius: 8px;
}

.model-tabs { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }

.model-tab {
  font-family: 'Roboto', sans-serif;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 18px;
  border-radius: 99px;
  border: 1px solid var(--surface-highest);
  background: var(--base);
  color: var(--subtext);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.15s;
}

.model-tab:hover { color: var(--text); }
.model-tab.active { color: var(--text); border-color: var(--model-color, var(--fg-accent)); background: color-mix(in srgb, var(--model-color, var(--fg-accent)) 12%, transparent); }
.model-tab-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--model-color, var(--fg-accent)); flex-shrink: 0; display: block; }

.leaderboard { display: flex; flex-direction: column; gap: 8px; margin-bottom: 32px; }

.lb-row {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  background: var(--base);
  border: 1px solid var(--surface-higher);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.15s;
}

.lb-row:hover { border-color: var(--surface-highest); background: var(--base-high); }
.lb-row.active { border-color: var(--fg-accent); background: var(--bg-accent); }
.lb-rank { font-size: 22px; font-weight: 800; color: var(--muted); }
.lb-row:nth-child(1) .lb-rank { color: var(--fg-accent); }
.lb-info { display: flex; flex-direction: column; gap: 6px; }
.lb-name { display: flex; align-items: center; gap: 9px; font-size: 15px; font-weight: 700; color: var(--text); }
.lb-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.lb-bar-wrap { height: 6px; background: var(--surface-high); border-radius: 99px; overflow: hidden; }
.lb-bar { height: 100%; border-radius: 99px; width: 0%; transition: width 0.8s cubic-bezier(0.4,0,0.2,1); }
.lb-meta { font-size: 11px; color: var(--subtext); }
.lb-score-area { text-align: right; }
.lb-score { font-variant-numeric: tabular-nums; font-size: 26px; font-weight: 500; color: var(--text); }
.lb-row:nth-child(1) .lb-score { color: var(--fg-accent); }
.lb-score-label { font-size: 10px; color: var(--subtext); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }

/* ════════════════════════════
   EPISODE REPLAY
════════════════════════════ */
.episode-section { margin-top: 8px; }

.episode-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.replay-nav { display: flex; align-items: center; gap: 8px; }
.replay-score { font-size: 12px; color: var(--subtext); padding-right: 4px; }
.replay-score strong { color: var(--fg-accent); font-size: 15px; margin-left: 4px; }

.replay-counter { font-variant-numeric: tabular-nums; font-size: 12px; color: var(--subtext); min-width: 48px; text-align: center; }

.step-timeline { display: flex; gap: 2px; overflow-x: auto; padding: 4px 0 0; margin-bottom: 14px; scrollbar-width: thin; }

.step-card {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 10px 0;
  border: none;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.12s;
  min-width: 48px;
}
.step-card:hover { color: var(--text); }

.step-card-icon { width: 56px; height: 56px; color: var(--text); }
.step-card-icon svg { width: 100%; height: 100%; }
.step-card-symbol { display: grid; place-items: center; width: 56px; height: 56px; font-size: 26px; }
.step-card-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding-bottom: 4px;
}
.step-card-reward {
  font-size: 9px;
  font-weight: 700;
  padding-bottom: 2px;
}
.step-card-reward.positive { color: var(--fg-green); }
.step-card-reward.negative { color: var(--fg-red); }

.step-card.push { border-bottom-color: transparent; }
.step-card.push:hover, .step-card.push.active { border-bottom-color: var(--fg-accent); }
.step-card.look { border-bottom-color: transparent; }
.step-card.look:hover, .step-card.look.active { border-bottom-color: var(--fg-accent-2); }
.step-card.place { border-bottom-color: transparent; }
.step-card.place:hover, .step-card.place.active { border-bottom-color: var(--fg-green); }
.step-card.fail { color: var(--fg-red); }
.step-card.fail:hover, .step-card.fail.active { border-bottom-color: var(--fg-red); }
.step-card.active { color: var(--text); }

.step-frame {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 8px;
  background: var(--surface-low);
  border: 1px solid var(--surface-higher);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
}

.step-frame img { width: 100%; height: 100%; object-fit: contain; }

.step-frame-placeholder {
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  padding: 12px;
}

.step-frame-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--subtext);
  text-align: center;
}

.step-info-col { display: flex; flex-direction: column; gap: 10px; }

.step-detail-header { display: flex; align-items: center; gap: 10px; }
.step-detail-title { font-size: 15px; font-weight: 700; color: var(--text); flex: 1; }

.reward-tag { font-variant-numeric: tabular-nums; font-size: 12px; padding: 3px 10px; border-radius: 6px; background: var(--base-high); color: var(--subtext); }
.reward-tag.green { background: oklch(from var(--fg-green) l c h / 0.16); color: var(--fg-green); }
.reward-tag.red { background: oklch(from var(--fg-red) l c h / 0.12); color: var(--fg-red); }

.step-reasoning {
  font-size: 13px;
  color: var(--subtext);
  line-height: 1.7;
  padding: 12px 14px;
  background: var(--base-high);
  border-left: 3px solid var(--fg-accent);
  border-radius: 0 8px 8px 0;
}

.step-action {
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  color: var(--text);
  background: var(--surface-low);
  border: 1px solid var(--surface-higher);
  border-radius: 8px;
  padding: 12px 14px;
  overflow-x: auto;
  line-height: 1.6;
}

.step-terminated { font-size: 13px; font-weight: 700; color: var(--fg-red); }

.benchmark-subtabs {
  display: flex;
  gap: 0;
  padding: 0 24px;
  border-bottom: 1px solid var(--surface-higher);
}

.benchmark-subtab {
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--subtext);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 14px 16px 12px;
  margin-bottom: -1px;
  transition: all 0.15s;
}

.benchmark-subtab:hover { color: var(--text); }
.benchmark-subtab.active {
  color: var(--fg-accent);
  border-bottom-color: var(--fg-accent);
}

.replay-selectors {
  display: flex;
  gap: 12px;
  margin-bottom: 14px;
}

.replay-selectors label { flex: 1; }

.replay-selectors select {
  display: block;
  margin-top: 6px;
  width: 100%;
}

.replay-warning {
  background: rgba(232, 123, 36, .12);
  border: 1px solid rgba(232, 123, 36, .45);
  border-radius: 8px;
  color: var(--fg-orange);
  font-size: 13px;
  margin-bottom: 14px;
  padding: 10px 12px;
}

/* ════════════════════════════
   REPLAY BAR
════════════════════════════ */
.replay-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  flex-wrap: wrap;
}
.replay-bar-select { max-width: 240px; font-size: 12px; }
.replay-bar-stat { font-size: 12px; color: var(--muted); }
.replay-bar-stat strong { color: var(--fg-accent); font-size: 14px; margin-right: 2px; }

/* ════════════════════════════
   STEP REPLAY
════════════════════════════ */

.full-replay-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--surface-higher);
}

.full-replay-body { padding: 18px; }

.full-replay-viewer {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(300px, .8fr);
  gap: 0;
  margin: 14px;
  background: var(--surface-low);
  border: 1px solid var(--surface-higher);
  border-radius: 10px;
  overflow: hidden;
}

.replay-panel { min-width: 0; background: var(--surface-low); }
.state-panel { border-left: 3px solid var(--surface-highest); }
.replay-panel-title {
  padding: 10px 12px;
  border-bottom: 1px solid var(--surface-higher);
  background: var(--base-high);
  color: var(--subtext);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.full-replay-frame {
  aspect-ratio: 1;
  max-height: 55vh;
  background: var(--surface-low);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.full-replay-frame img { width: 100%; height: 100%; object-fit: contain; }

#replay-canvas { width: 100%; height: 100%; display: block; }

.replay-detail {
  display: flex;
  flex-direction: column;
  min-width: 0;
  max-height: 55vh;
  overflow-y: auto;
  padding: 14px;
}

.replay-detail-inner { display: flex; flex-direction: column; gap: 10px; }
.replay-capture { width: min(180px, 100%); }

.replay-unavailable {
  align-items: center;
  background: var(--surface-low);
  border: 1px dashed var(--surface-highest);
  border-radius: 10px;
  color: var(--muted);
  display: flex;
  font-size: 13px;
  justify-content: center;
  min-height: 180px;
  padding: 18px;
  text-align: center;
}

.full-replay-frame-label {
  position: absolute;
  bottom: 8px; left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #fff;
  background: rgba(0,0,0,0.6);
  padding: 3px 10px;
  border-radius: 99px;
  white-space: nowrap;
}

.full-replay-no-frame {
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}

.replay-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.replay-step-slider {
  flex: 1;
  accent-color: var(--fg-accent);
  cursor: pointer;
}

.replay-speed {
  font-size: 11px;
  font-weight: 700;
  color: var(--subtext);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid var(--surface-highest);
  background: var(--base-high);
  transition: all 0.12s;
}

.replay-speed:hover { color: var(--text); }

.replay-step-info {
  font-size: 12px;
  color: var(--subtext);
  font-variant-numeric: tabular-nums;
  min-width: 48px;
  text-align: center;
}

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

/* RESULTS SIDE */
.results-side { padding: 20px 18px; background: var(--base); display: flex; flex-direction: column; }
.results-side .card { border-bottom: 1px solid var(--surface-higher); padding: 18px 0; }
.results-side .card:first-child { padding-top: 0; }
.results-side .card:last-child { border-bottom: none; }

.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.stat-cell {
  background: var(--base-high);
  border: 1px solid var(--surface-higher);
  border-radius: 10px;
  padding: 12px 14px;
}

.stat-val { font-variant-numeric: tabular-nums; font-size: 24px; font-weight: 500; color: var(--text); margin-bottom: 2px; }
.stat-val.highlight { color: var(--fg-accent); }
.stat-label { font-size: 10px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--subtext); }

.load-section { display: flex; flex-direction: column; gap: 8px; }
.load-status { font-size: 12px; color: var(--subtext); text-align: center; }

.highlight { color: var(--fg-accent); }
.red { color: var(--fg-red); }
.green { color: var(--fg-green); }
#status-dot { display: none; }

@media (max-width: 800px) {
  .inspector-layout, .results-layout { grid-template-columns: 1fr; height: auto; }
  .viewport-col { border-right: none; }
  .topbar-pill { display: none; }
  .full-replay-viewer { grid-template-columns: 1fr; }
  .state-panel { border-left: none; border-top: 3px solid var(--surface-highest); }
  .replay-nav { flex-wrap: wrap; justify-content: flex-end; }
}

/* ════════════════════════════
   SETTINGS TAB
════════════════════════════ */
.settings-layout {
  min-height: calc(100vh - 54px);
  background: var(--outer-bg);
  padding: 32px;
}

.settings-main { max-width: 900px; margin: 0 auto; }

.settings-header { margin-bottom: 28px; }

.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

.settings-section {
  background: var(--base);
  border: 1px solid var(--surface-higher);
  border-radius: 14px;
  padding: 18px 20px;
}

.settings-section-title { margin-bottom: 14px; }

.settings-fields { display: flex; flex-direction: column; gap: 10px; }

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

.sf-input { text-align: right; font-variant-numeric: tabular-nums; }

.settings-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  background: var(--base);
  border: 1px solid var(--surface-higher);
  border-radius: 14px;
}

.settings-status {
  font-size: 13px;
  font-weight: 600;
  transition: color 0.2s;
}

@media (max-width: 700px) {
  .settings-grid { grid-template-columns: 1fr; }
  .sf-row { grid-template-columns: 1fr; }
}

:root[style*="--transition-override"] * { transition: none !important; }
