:root {
  --background: 240 10% 3.9%;
  --foreground: 0 0% 98%;
  --card: 240 10% 3.9%;
  --card-foreground: 0 0% 98%;
  --primary: 0 0% 98%;
  --primary-foreground: 240 5.9% 10%;
  --secondary: 240 3.7% 15.9%;
  --muted: 240 3.7% 15.9%;
  --muted-foreground: 240 5% 64.9%;
  --accent: 240 3.7% 15.9%;
  --accent-foreground: 0 0% 98%;
  --border: 240 3.7% 15.9%;
  --input: 240 3.7% 15.9%;
  --ring: 240 4.9% 83.9%;
  --radius: 0.5rem;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { color-scheme: dark; background: hsl(var(--background)); }
body {
  margin: 0;
  min-width: 320px;
  color: hsl(var(--foreground));
  background: hsl(var(--background));
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.5;
}
button, select, input { font: inherit; }
button, select { cursor: pointer; }

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 52px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid hsl(var(--border));
  background: hsl(var(--background) / 0.92);
  backdrop-filter: blur(10px);
}
.header-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.header-label { font-weight: 600; }
.header-meta { color: hsl(var(--muted-foreground)); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hero-status { display: flex; align-items: center; gap: 7px; color: hsl(var(--muted-foreground)); font-size: 12px; }
.status-dot { width: 7px; height: 7px; border-radius: 999px; background: #f59e0b; }
.hero-status.ready .status-dot { background: #22c55e; }

main { width: min(1600px, calc(100% - 32px)); margin: 0 auto; padding: 20px 0 36px; }
.card { border: 1px solid hsl(var(--border)); border-radius: var(--radius); background: hsl(var(--card)); color: hsl(var(--card-foreground)); }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.metric { padding: 14px 16px; }
.metric span { display: block; font-size: 22px; font-weight: 650; line-height: 1.2; letter-spacing: -0.025em; }
.metric small { color: hsl(var(--muted-foreground)); font-size: 12px; }

.tabs-list { display: inline-flex; align-items: center; margin: 18px 0 12px; padding: 4px; border-radius: calc(var(--radius) + 2px); background: hsl(var(--muted)); }
.view-tab { min-height: 32px; padding: 0 12px; border: 0; border-radius: calc(var(--radius) - 2px); color: hsl(var(--muted-foreground)); background: transparent; font-size: 13px; font-weight: 500; }
.view-tab.active { color: hsl(var(--foreground)); background: hsl(var(--background)); box-shadow: 0 1px 2px rgba(0,0,0,.35); }
.view-panel { display: none; }
.view-panel.active { display: grid; }
#view-explorer { grid-template-columns: 300px minmax(0, 1fr); gap: 12px; align-items: start; }

.control-panel { padding: 16px; }
.panel-heading, .filter-title, .plot-header, .dimensions-header, .coverage-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
h2 { margin: 0; font-size: 14px; font-weight: 600; letter-spacing: -0.01em; }
.panel-heading p, .plot-header p, .dimensions-header p, .coverage-heading p, .helper { margin: 3px 0 0; color: hsl(var(--muted-foreground)); font-size: 12px; }

.button { min-height: 36px; padding: 0 12px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid transparent; border-radius: var(--radius); color: hsl(var(--primary-foreground)); background: hsl(var(--primary)); font-weight: 500; }
.button.small { min-height: 28px; padding: 0 8px; font-size: 12px; }
.button.ghost { color: hsl(var(--muted-foreground)); background: transparent; }
.button.ghost:hover { color: hsl(var(--accent-foreground)); background: hsl(var(--accent)); }
.button.outline { color: hsl(var(--foreground)); background: transparent; border-color: hsl(var(--border)); }
.button.outline:hover { background: hsl(var(--accent)); }
.button.full { width: 100%; margin-top: 16px; }

.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; margin: 14px 0; padding: 3px; border-radius: var(--radius); background: hsl(var(--muted)); }
.segmented button { min-height: 30px; border: 0; border-radius: calc(var(--radius) - 2px); color: hsl(var(--muted-foreground)); background: transparent; font-size: 12px; }
.segmented button.active { color: hsl(var(--foreground)); background: hsl(var(--background)); box-shadow: 0 1px 2px rgba(0,0,0,.35); }

.field { display: grid; gap: 5px; margin-top: 10px; }
.field > span, .filter-title > span { color: hsl(var(--foreground)); font-size: 12px; font-weight: 500; }
select, .input { width: 100%; min-height: 36px; padding: 7px 10px; border: 1px solid hsl(var(--input)); border-radius: var(--radius); color: hsl(var(--foreground)); background: hsl(var(--background)); outline: none; }
select:focus, .input:focus { border-color: hsl(var(--ring)); box-shadow: 0 0 0 2px hsl(var(--ring) / 0.18); }
.separator { height: 1px; margin: 16px 0; background: hsl(var(--border)); }
.filter-title { align-items: center; margin-bottom: 8px; }
.check-list { display: grid; gap: 8px; }
.check-item { display: grid; grid-template-columns: 14px minmax(0,1fr) auto; gap: 8px; align-items: center; color: hsl(var(--muted-foreground)); font-size: 12px; }
.check-item input { appearance: none; width: 14px; height: 14px; margin: 0; border: 1px solid hsl(var(--input)); border-radius: 3px; background: hsl(var(--background)); }
.check-item input:checked { border-color: hsl(var(--primary)); background: hsl(var(--primary)); box-shadow: inset 0 0 0 3px hsl(var(--background)); }
.check-item .count { font-variant-numeric: tabular-nums; color: hsl(var(--muted-foreground) / 0.65); }

.language-list { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; max-height: 190px; margin-top: 8px; overflow: auto; }
.language-chip { display: flex; align-items: center; gap: 7px; min-width: 0; min-height: 30px; padding: 0 8px; border: 1px solid hsl(var(--border)); border-radius: var(--radius); color: hsl(var(--muted-foreground)); background: transparent; font-size: 12px; text-align: left; }
.language-chip:hover { background: hsl(var(--accent)); color: hsl(var(--accent-foreground)); }
.language-chip.active { color: hsl(var(--foreground)); background: hsl(var(--secondary)); }
.language-chip .swatch { width: 7px; height: 7px; flex: 0 0 auto; border-radius: 999px; }

.visual-panel { min-width: 0; overflow: hidden; }
.plot-header { padding: 16px 16px 0; }
.plot { width: 100%; height: 690px; }
.empty-state { min-height: 590px; place-items: center; align-content: center; gap: 4px; color: hsl(var(--muted-foreground)); }
.empty-state:not([hidden]) { display: grid; }
.empty-state strong { color: hsl(var(--foreground)); }
.point-detail { min-height: 66px; padding: 12px 16px; border-top: 1px solid hsl(var(--border)); color: hsl(var(--muted-foreground)); font-size: 12px; }
.point-detail-grid { display: flex; flex-wrap: wrap; gap: 10px 24px; align-items: center; }
.point-detail-grid strong { display: block; color: hsl(var(--foreground)); font-size: 12px; font-weight: 500; }
.point-detail-grid small { color: hsl(var(--muted-foreground)); }
.wandb-link { margin-left: auto; color: hsl(var(--foreground)); text-decoration: underline; text-underline-offset: 3px; }

.dimensions-view { padding: 18px; }
.dimensions-view.active { display: block; }
.dimensions-header { align-items: flex-end; }
.dimensions-header > div { max-width: 720px; }
.inline-field { min-width: 190px; margin: 0; }
.helper { margin-top: 8px; }
.parallel-plot { width: 100%; height: 660px; }
.coverage-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
.coverage-card { padding: 11px; border: 1px solid hsl(var(--border)); border-radius: var(--radius); }
.coverage-card strong { display: block; margin-bottom: 7px; font-size: 12px; font-weight: 500; }
.coverage-bar { height: 4px; overflow: hidden; border-radius: 999px; background: hsl(var(--muted)); }
.coverage-bar span { display: block; height: 100%; border-radius: inherit; background: hsl(var(--primary)); }
.coverage-card small { display: flex; justify-content: space-between; gap: 6px; margin-top: 6px; color: hsl(var(--muted-foreground)); font-size: 10px; }

.notice { display: flex; gap: 10px; margin-top: 12px; padding: 12px 14px; border: 1px solid hsl(var(--border)); border-radius: var(--radius); color: hsl(var(--muted-foreground)); font-size: 12px; }
.notice strong { flex: 0 0 auto; color: hsl(var(--foreground)); font-weight: 500; }

@media (max-width: 980px) {
  #view-explorer { grid-template-columns: 270px minmax(0, 1fr); }
  .coverage-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .app-header { padding: 0 14px; }
  main { width: min(100% - 20px, 1600px); padding-top: 12px; }
  .metrics { grid-template-columns: 1fr 1fr; gap: 8px; }
  #view-explorer { grid-template-columns: 1fr; }
  .language-list { grid-template-columns: repeat(3, 1fr); }
  .plot { height: 540px; }
  .dimensions-header { align-items: flex-start; flex-direction: column; }
  .inline-field { width: 100%; }
  .parallel-plot { height: 720px; }
  .coverage-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 460px) {
  .header-meta { display: none; }
  .metric { padding: 12px; }
  .metric span { font-size: 19px; }
  .language-list { grid-template-columns: 1fr 1fr; }
  .plot { height: 480px; }
  .coverage-grid { grid-template-columns: 1fr; }
  .notice { flex-direction: column; }
}
