:root {
  color-scheme: light;
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-soft: #fafafa;
  --line: #ebebeb;
  --line-soft: #f4f4f4;
  --text: #0a0a0a;
  --muted: #71717a;
  --dim: #a1a1aa;
  --accent: #15803d;
  --accent-soft: rgba(21, 128, 61, 0.08);
  --halo: rgba(21, 128, 61, 0.10);
  --tooltip-bg: rgba(255, 255, 255, 0.98);
  --tooltip-border: rgba(0, 0, 0, 0.06);
  --tooltip-shadow: 0 8px 28px rgba(0, 0, 0, 0.08), 0 2px 6px rgba(0, 0, 0, 0.04);
  --toggle-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 12px rgba(0, 0, 0, 0.06);
  --radius: 10px;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b0b0c;
  --surface: #0b0b0c;
  --surface-soft: #121214;
  --line: #1f1f23;
  --line-soft: #17171a;
  --text: #f4f4f5;
  --muted: #8a8f98;
  --dim: #52525b;
  --accent: #a3e635;
  --accent-soft: rgba(163, 230, 53, 0.10);
  --halo: rgba(163, 230, 53, 0.16);
  --tooltip-bg: rgba(18, 18, 20, 0.96);
  --tooltip-border: rgba(255, 255, 255, 0.08);
  --tooltip-shadow: 0 8px 28px rgba(0, 0, 0, 0.55), 0 2px 6px rgba(0, 0, 0, 0.4);
  --toggle-shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 4px 12px rgba(0, 0, 0, 0.5);
}

* { box-sizing: border-box; }

html, body {
  background: var(--bg);
  color: var(--text);
}

body {
  min-width: 320px;
  margin: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 200ms ease, color 200ms ease;
}

button, input, select { font: inherit; }

.app-shell {
  width: 100%;
  min-height: 100vh;
  margin: 0 auto;
  padding: 72px 0 96px;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 36px;
}

.masthead {
  width: min(1080px, calc(100% - 48px));
  justify-self: center;
  text-align: center;
}

h1, p { margin-top: 0; }

h1 {
  margin-bottom: 14px;
  font-size: 3.5rem;
  line-height: 1;
  letter-spacing: 0;
  font-weight: 700;
}

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

.subtitle {
  max-width: 34rem;
  margin: 0 auto;
  color: var(--muted);
  font-size: 0.975rem;
  line-height: 1.55;
  letter-spacing: 0;
}

.selector-row {
  justify-self: center;
  width: min(1040px, calc(100% - 48px));
  display: grid;
  grid-template-columns: minmax(170px, 230px) minmax(220px, 320px) auto auto;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.selector-wrap {
  position: relative;
  justify-self: center;
  width: 100%;
}

.selector-wrap:not(.search-selector)::after {
  content: "";
  position: absolute;
  right: 14px;
  top: 50%;
  width: 6px;
  height: 6px;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}

.search-selector::before {
  content: "";
  position: absolute;
  left: 15px;
  top: 50%;
  width: 12px;
  height: 12px;
  border: 1.7px solid var(--muted);
  border-radius: 999px;
  transform: translateY(-58%);
  pointer-events: none;
}

.search-selector::after {
  content: "";
  position: absolute;
  left: 26px;
  top: 50%;
  width: 6px;
  height: 1.7px;
  border-radius: 999px;
  background: var(--muted);
  transform: translateY(4px) rotate(45deg);
  pointer-events: none;
}

input:not([type="checkbox"]),
select {
  width: 100%;
  min-height: 38px;
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 36px 0 16px;
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  font-size: 0.875rem;
  letter-spacing: 0;
  outline: none;
  cursor: pointer;
  transition: border-color 150ms ease, background-color 150ms ease;
}

input:not([type="checkbox"]) { padding-left: 40px; }
input:not([type="checkbox"]) { cursor: text; }
select:hover { border-color: var(--muted); }
input:not([type="checkbox"]):hover { border-color: var(--muted); }

input:not([type="checkbox"]):focus-visible,
select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.model-selector input {
  font-weight: 500;
  color: var(--muted);
}

input::-webkit-search-cancel-button { display: none; }

.mode-toggle {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 150ms ease, color 150ms ease, background-color 150ms ease;
}

.mode-toggle:hover,
.mode-toggle[aria-pressed="true"] {
  border-color: var(--accent);
  color: var(--text);
  background: var(--accent-soft);
}

.mode-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.mode-toggle-switch {
  position: relative;
  width: 24px;
  height: 14px;
  border-radius: 999px;
  background: var(--line);
}

.mode-toggle-switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--muted);
  transition: transform 150ms ease, background-color 150ms ease;
}

.mode-toggle[aria-pressed="true"] .mode-toggle-switch {
  background: var(--accent);
}

.mode-toggle[aria-pressed="true"] .mode-toggle-switch::after {
  background: var(--surface);
  transform: translateX(10px);
}

.info-dot {
  position: relative;
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1;
  cursor: help;
}

.info-dot::after {
  content: attr(data-tooltip);
  position: absolute;
  z-index: 30;
  left: 50%;
  bottom: calc(100% + 10px);
  width: 240px;
  padding: 10px 12px;
  border: 1px solid var(--tooltip-border);
  border-radius: 10px;
  background: var(--tooltip-bg);
  color: var(--text);
  box-shadow: var(--tooltip-shadow);
  font-family: inherit;
  font-size: 0.76rem;
  font-weight: 500;
  line-height: 1.4;
  white-space: normal;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 4px);
  transition: opacity 140ms ease, transform 140ms ease;
}

.info-dot:hover::after,
.info-dot:focus-visible::after {
  opacity: 1;
  transform: translate(-50%, 0);
}

.model-suggestions {
  position: absolute;
  z-index: 20;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  max-height: 256px;
  overflow: auto;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--tooltip-shadow);
}

.model-suggestions[hidden] { display: none; }

.model-suggestion {
  min-height: 34px;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--text);
  font-size: 0.84rem;
  font-weight: 600;
  line-height: 1.3;
  cursor: pointer;
}

.model-suggestion:hover {
  background: var(--surface-soft);
}

.chart-stage {
  position: relative;
  justify-self: center;
  width: 100%;
  min-height: 640px;
  border: 1px solid var(--line);
  border-right: 0;
  border-left: 0;
  border-radius: 0;
  overflow: hidden;
  background: var(--surface);
  transition: border-color 200ms ease, background-color 200ms ease;
}

#chart {
  display: block;
  width: 100%;
  height: 640px;
  overflow: visible;
}

.axis {
  stroke: var(--line);
  stroke-width: 1;
}

.grid-line {
  stroke: var(--line-soft);
  stroke-width: 1;
}

.tick-label {
  fill: var(--dim);
  font-family: var(--mono);
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
}

.axis-label {
  fill: var(--muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: uppercase;
}

.frontier-area { fill: url("#frontierFill"); }

.frontier-halo {
  fill: none;
  stroke: var(--halo);
  stroke-width: 10;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.frontier-line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.label-leader {
  stroke: color-mix(in srgb, var(--muted) 46%, transparent);
  stroke-width: 1;
  stroke-linecap: round;
  pointer-events: none;
}

.point {
  stroke: var(--bg);
  stroke-width: 2;
  transition: opacity 150ms ease, transform 150ms ease;
  transform-box: fill-box;
  transform-origin: center;
}

.point.frontier {
  stroke: var(--bg);
  stroke-width: 2.25;
}

.point.dominated { opacity: 0.28; }

.point.dominated.selected {
  opacity: 1;
  stroke-width: 2.4;
}

.point:hover {
  opacity: 1;
  transform: scale(1.18);
}

.point-label {
  fill: var(--text);
  font-size: 11.2px;
  font-weight: 600;
  letter-spacing: 0;
  paint-order: stroke;
  stroke: var(--bg);
  stroke-width: 4px;
  stroke-linejoin: round;
  pointer-events: none;
}

.empty-state {
  fill: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

.tooltip {
  position: absolute;
  z-index: 2;
  width: 220px;
  padding: 12px 14px;
  border: 1px solid var(--tooltip-border);
  border-radius: var(--radius);
  background: var(--tooltip-bg);
  color: var(--text);
  box-shadow: var(--tooltip-shadow);
  backdrop-filter: blur(12px);
  pointer-events: none;
}

.tooltip strong {
  display: block;
  margin-bottom: 6px;
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0;
}

.tooltip span {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.5;
}

.tooltip span + span {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

.theme-toggle {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  z-index: 10;
  box-shadow: var(--toggle-shadow);
  transition: border-color 150ms ease, background-color 150ms ease, transform 200ms ease, color 200ms ease;
}

.theme-toggle:hover {
  border-color: var(--muted);
  transform: translateY(-1px);
}

.theme-toggle:active { transform: translateY(0); }

.theme-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.theme-toggle svg {
  width: 16px;
  height: 16px;
  display: block;
}

.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

@media (max-width: 720px) {
  .app-shell {
    width: 100%;
    padding: 44px 0 96px;
    gap: 24px;
  }

  .masthead { width: min(100% - 24px, 1080px); }

  h1 { font-size: 2.5rem; }
  .subtitle { font-size: 0.9rem; }

  .selector-row {
    width: min(360px, 100%);
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .mode-toggle { justify-content: center; }

  .chart-stage {
    width: 100%;
    min-height: 500px;
  }
  #chart { height: 500px; }

  .axis-label { font-size: 9.5px; }
  .point-label { font-size: 10px; }

  .theme-toggle {
    right: 16px;
    bottom: 16px;
  }
}
