/* ============================================================
   VIZ — Interaktive Visualisierungen
   Wird zusätzlich zu style.css geladen
   ============================================================ */

/* shared frame */
.viz {
  background: var(--surface);
  border-radius: var(--r-lg);
  padding: 32px;
  margin: 36px 0;
  border: 1px solid var(--line-soft);
  box-shadow: var(--shadow-card);
  position: relative;
}
.viz-title {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 4px;
}
.viz-sub {
  font-size: 14px;
  color: var(--ink-muted);
  margin-bottom: 24px;
}
.viz-caption {
  font-size: 13px;
  color: var(--ink-muted);
  margin-top: 16px;
  font-style: italic;
  line-height: 1.5;
}

/* controls (sliders, buttons) */
.viz-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  align-items: center;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px dashed var(--line);
}
.viz-control-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 200px;
  flex: 1;
}
.viz-control-label {
  font-size: 13px;
  color: var(--ink-soft);
  font-weight: 500;
  display: flex;
  justify-content: space-between;
}
.viz-control-label .v {
  color: var(--teal);
  font-family: var(--font-serif);
  font-weight: 600;
}
input[type="range"].viz-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: var(--cream-deep);
  border-radius: 999px;
  outline: 0;
}
input[type="range"].viz-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--teal);
  cursor: pointer;
  border: 3px solid var(--cream);
  box-shadow: 0 2px 6px rgba(0,0,0,.12);
  transition: transform .15s;
}
input[type="range"].viz-slider::-webkit-slider-thumb:hover { transform: scale(1.1); }
input[type="range"].viz-slider::-moz-range-thumb {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--teal);
  cursor: pointer;
  border: 3px solid var(--cream);
}
.viz-btn {
  background: var(--teal);
  color: var(--cream);
  border: 0;
  padding: 9px 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s;
  font-family: var(--font-sans);
}
.viz-btn:hover { background: var(--teal-deep); }
.viz-btn.alt { background: var(--coral); }
.viz-btn.alt:hover { background: var(--coral-deep); }
.viz-btn.ghost { background: transparent; color: var(--teal); border: 1.5px solid var(--teal); }

/* ============================================================
   1. PROBABILITY BARS — next token prediction
   ============================================================ */
.prob-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.prob-row {
  display: grid;
  grid-template-columns: 120px 1fr 60px;
  gap: 14px;
  align-items: center;
  font-size: 15px;
}
.prob-word {
  font-family: var(--font-serif);
  font-weight: 500;
  text-align: right;
  color: var(--ink);
  font-size: 17px;
}
.prob-bar-track {
  background: var(--cream-deep);
  border-radius: 999px;
  height: 22px;
  overflow: hidden;
  position: relative;
}
.prob-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--teal) 0%, #5BB3A9 100%);
  border-radius: 999px;
  transition: width .6s cubic-bezier(.2,.7,.2,1);
  position: relative;
}
.prob-row:nth-child(1) .prob-bar-fill {
  background: linear-gradient(90deg, var(--coral) 0%, #F4B39A 100%);
}
.prob-pct {
  font-family: var(--font-serif);
  font-weight: 500;
  color: var(--ink-soft);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ============================================================
   2. NEURAL NET — animated SVG
   ============================================================ */
.nn-svg {
  width: 100%;
  height: auto;
  max-height: 360px;
  display: block;
}
.nn-edge {
  stroke: var(--line);
  stroke-width: 1;
  fill: none;
  opacity: .5;
  transition: stroke .3s, opacity .3s, stroke-width .3s;
}
.nn-edge.active {
  stroke: var(--coral);
  opacity: 1;
  stroke-width: 1.5;
}
.nn-node {
  fill: var(--surface);
  stroke: var(--teal);
  stroke-width: 2.5;
  transition: fill .3s, transform .3s;
  transform-origin: center;
  transform-box: fill-box;
}
.nn-node.pulse {
  fill: var(--teal);
  animation: nn-pulse .6s ease-out;
}
@keyframes nn-pulse {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.25); }
  100% { transform: scale(1); }
}
.nn-label {
  font-size: 11px;
  fill: var(--ink-muted);
  font-family: var(--font-sans);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  text-anchor: middle;
}
.nn-signal {
  fill: var(--coral);
}

/* ============================================================
   3. AGENT LOOP — rotating cycle
   ============================================================ */
.loop-svg {
  width: 100%;
  max-width: 540px;
  margin: 0 auto;
  display: block;
}
.loop-arrow {
  stroke: var(--teal);
  stroke-width: 2.5;
  fill: none;
  stroke-dasharray: 6 6;
  animation: loop-dash 1.6s linear infinite;
}
@keyframes loop-dash {
  to { stroke-dashoffset: -24; }
}
.loop-node {
  fill: var(--cream);
  stroke: var(--teal);
  stroke-width: 2;
}
.loop-node.active { fill: var(--teal-soft); }
.loop-text {
  font-family: var(--font-serif);
  font-size: 14px;
  font-weight: 500;
  fill: var(--ink);
  text-anchor: middle;
}
.loop-icon {
  fill: var(--teal-deep);
  font-size: 20px;
  text-anchor: middle;
}

/* ============================================================
   4. FLOW DIAGRAM — request/response / pipeline
   ============================================================ */
.flow {
  display: grid;
  gap: 12px;
  position: relative;
}
.flow-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 18px;
  align-items: center;
}
.flow-node {
  background: var(--surface);
  border: 2px solid var(--teal);
  border-radius: var(--r-md);
  padding: 16px 18px;
  text-align: center;
}
.flow-node.alt { border-color: var(--coral); background: var(--coral-tint); }
.flow-node.dark { background: var(--ink); color: var(--cream); border-color: var(--ink); }
.flow-node .flow-node-title {
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
}
.flow-node .flow-node-sub {
  font-size: 13px;
  color: var(--ink-muted);
}
.flow-node.dark .flow-node-sub { color: rgba(253,248,243,.65); }

.flow-arrow {
  position: relative;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.flow-arrow svg { display: block; }
.flow-arrow .dot {
  fill: var(--coral);
  animation: flow-dot 2.4s linear infinite;
}
@keyframes flow-dot {
  0%   { offset-distance: 0%; opacity: 0; }
  10%  { opacity: 1; }
  90%  { opacity: 1; }
  100% { offset-distance: 100%; opacity: 0; }
}

/* simple horizontal flow line */
.flow-line {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0;
  align-items: stretch;
  margin: 24px 0;
}
.flow-step {
  background: var(--surface);
  padding: 18px 14px;
  border: 1px solid var(--line);
  position: relative;
  text-align: center;
}
.flow-step:first-child { border-radius: var(--r-md) 0 0 var(--r-md); }
.flow-step:last-child { border-radius: 0 var(--r-md) var(--r-md) 0; }
.flow-step + .flow-step { border-left: 0; }
.flow-step-num {
  display: inline-flex;
  width: 24px; height: 24px;
  background: var(--teal);
  color: white;
  border-radius: 50%;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 8px;
}
.flow-step-title {
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
  line-height: 1.2;
}
.flow-step-desc {
  font-size: 12.5px;
  color: var(--ink-muted);
  line-height: 1.45;
}
.flow-step::after {
  content: '';
  position: absolute;
  right: -8px; top: 50%;
  transform: translateY(-50%);
  width: 0; height: 0;
  border-left: 8px solid var(--line);
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  z-index: 1;
}
.flow-step:last-child::after { display: none; }

@media (max-width: 760px) {
  .flow-line { grid-template-columns: 1fr; }
  .flow-step { border-radius: 0 !important; border-left: 1px solid var(--line); border-top: 0; }
  .flow-step:first-child { border-top: 1px solid var(--line); border-radius: var(--r-md) var(--r-md) 0 0 !important; }
  .flow-step:last-child { border-radius: 0 0 var(--r-md) var(--r-md) !important; }
  .flow-step::after { display: none; }
}

/* ============================================================
   5. CONTEXT WINDOW VIS — text filling a container
   ============================================================ */
.ctx {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
.ctx-bar {
  background: var(--cream-deep);
  border-radius: var(--r-md);
  height: 56px;
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  padding: 0 20px;
  border: 1px solid var(--line);
}
.ctx-bar-fill {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  background: linear-gradient(90deg, var(--teal-soft), var(--teal));
  border-radius: var(--r-md);
  transition: width 1s cubic-bezier(.2,.7,.2,1);
}
.ctx-bar-label {
  position: relative;
  z-index: 1;
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 16px;
  color: var(--ink);
  display: flex;
  justify-content: space-between;
  width: 100%;
}
.ctx-bar-label .ctx-amount {
  color: var(--teal-deep);
  font-variant-numeric: tabular-nums;
}

/* ============================================================
   6. EMBEDDING SPACE — 2D scatter
   ============================================================ */
.embed-vis {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  background: var(--cream-warm);
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  overflow: hidden;
}
.embed-axis {
  stroke: var(--line);
  stroke-width: 1;
  stroke-dasharray: 3 3;
}
.embed-point {
  fill: var(--teal);
  cursor: pointer;
  transition: r .2s, fill .2s;
}
.embed-point:hover { r: 9; fill: var(--coral); }
.embed-point.cluster-1 { fill: var(--teal); }
.embed-point.cluster-2 { fill: var(--coral); }
.embed-point.cluster-3 { fill: var(--sun); }
.embed-point.cluster-4 { fill: var(--lavender); }
.embed-label {
  font-size: 11px;
  fill: var(--ink-soft);
  font-family: var(--font-sans);
  font-weight: 500;
  pointer-events: none;
}

/* ============================================================
   7. MCP — hub & connections
   ============================================================ */
.mcp-vis {
  display: block;
  width: 100%;
  max-width: 580px;
  margin: 0 auto;
  height: auto;
}
.mcp-line {
  stroke: var(--teal);
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-dasharray: 5 5;
  animation: mcp-flow 2s linear infinite;
}
@keyframes mcp-flow {
  to { stroke-dashoffset: -20; }
}
.mcp-hub {
  fill: var(--ink);
  stroke: var(--coral);
  stroke-width: 3;
}
.mcp-server {
  fill: var(--surface);
  stroke: var(--teal);
  stroke-width: 2;
}
.mcp-server-coral { stroke: var(--coral); }
.mcp-text { font-family: var(--font-serif); font-size: 13px; fill: var(--ink); text-anchor: middle; }
.mcp-text-light { fill: var(--cream); }

/* ============================================================
   8. PROMPT SLIDER (good vs bad)
   ============================================================ */
.prompt-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 20px 0;
}
.prompt-card {
  background: var(--cream-warm);
  border-radius: var(--r-md);
  padding: 20px;
  border: 1px solid var(--line);
}
.prompt-card.good { border-color: var(--teal); background: var(--teal-tint); }
.prompt-card.bad  { border-color: var(--coral); background: var(--coral-tint); }
.prompt-card-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .12em;
  font-weight: 700;
  margin-bottom: 10px;
}
.prompt-card.good .prompt-card-label { color: var(--teal-deep); }
.prompt-card.bad .prompt-card-label { color: var(--coral-deep); }
.prompt-card-input {
  background: var(--surface);
  padding: 12px 14px;
  border-radius: var(--r-sm);
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  font-family: var(--font-sans);
}
.prompt-card-output {
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.55;
}
.prompt-card-quality {
  margin-top: 14px;
  display: flex;
  gap: 4px;
}
.prompt-card-quality .qb {
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: var(--cream-deep);
}
.prompt-card-quality .qb.on { background: var(--teal); }
.prompt-card.bad .prompt-card-quality .qb.on { background: var(--coral); }

@media (max-width: 640px) {
  .prompt-compare { grid-template-columns: 1fr; }
}

/* ============================================================
   9. TIMELINE
   ============================================================ */
.timeline {
  position: relative;
  padding: 20px 0;
}
.timeline::before {
  content: '';
  position: absolute;
  left: 16px; top: 0; bottom: 0;
  width: 2px;
  background: var(--line);
}
.tl-item {
  position: relative;
  padding-left: 56px;
  margin-bottom: 28px;
}
.tl-dot {
  position: absolute;
  left: 9px; top: 6px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--teal);
  border: 3px solid var(--cream);
  box-shadow: 0 0 0 2px var(--teal);
}
.tl-item:nth-child(odd) .tl-dot { background: var(--coral); box-shadow: 0 0 0 2px var(--coral); }
.tl-year {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 600;
  color: var(--teal-deep);
  margin-bottom: 4px;
}
.tl-item:nth-child(odd) .tl-year { color: var(--coral-deep); }
.tl-event {
  font-size: 15px;
  color: var(--ink-soft);
  line-height: 1.55;
}
.tl-event strong { color: var(--ink); }

/* ============================================================
   10. CONFIDENCE × CORRECTNESS MATRIX
   ============================================================ */
.matrix {
  display: grid;
  grid-template-columns: 80px 1fr 1fr;
  grid-template-rows: 1fr 1fr 80px;
  gap: 4px;
  aspect-ratio: 4/3;
  max-width: 560px;
  margin: 24px auto;
}
.matrix-cell {
  border-radius: var(--r-md);
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
}
.matrix-cell h5 {
  font-family: var(--font-serif);
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 6px;
}
.matrix-cell p { font-size: 13px !important; margin: 0 !important; line-height: 1.45 !important; }
.matrix-cell.good { background: var(--teal-soft); color: var(--teal-deep); }
.matrix-cell.danger { background: var(--coral-soft); color: var(--coral-deep); }
.matrix-cell.meh { background: var(--cream-deep); color: var(--ink-soft); }
.matrix-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: .08em;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

/* ============================================================
   11. TEMPERATURE THERMOMETER
   ============================================================ */
.thermo {
  display: flex;
  gap: 24px;
  align-items: center;
}
.thermo-bar {
  height: 200px;
  width: 40px;
  background: linear-gradient(180deg, var(--coral) 0%, var(--sun) 50%, var(--teal) 100%);
  border-radius: 999px;
  position: relative;
  border: 3px solid var(--surface);
  box-shadow: 0 0 0 2px var(--line);
}
.thermo-marker {
  position: absolute;
  left: -10px; right: -10px;
  height: 14px;
  background: var(--ink);
  border-radius: 999px;
  transform: translateY(-50%);
  transition: top .4s cubic-bezier(.2,.7,.2,1);
}
.thermo-readings { font-size: 14px; color: var(--ink-soft); line-height: 1.7; }
.thermo-readings strong { font-family: var(--font-serif); color: var(--ink); }

/* ============================================================
   Animations
   ============================================================ */
@keyframes signal {
  from { offset-distance: 0%; opacity: 0; }
  10%  { opacity: 1; }
  90%  { opacity: 1; }
  to   { offset-distance: 100%; opacity: 0; }
}
.signal-anim {
  animation: signal 2s linear infinite;
}

/* Token cascade (animated tokens appearing) */
.token-cascade { display: inline-flex; flex-wrap: wrap; gap: 4px; font-family: var(--font-serif); font-size: 18px; }
.token-cascade .tk {
  padding: 3px 9px;
  border-radius: 6px;
  background: var(--teal-soft);
  color: var(--teal-deep);
  opacity: 0;
  animation: token-in .35s forwards;
}
@keyframes token-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.token-cascade .tk:nth-child(3n) { background: var(--coral-soft); color: var(--coral-deep); }
.token-cascade .tk:nth-child(5n) { background: var(--sun-soft); color: #8B6914; }

/* RLHF visual */
.rlhf {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: stretch;
}
.rlhf-side {
  padding: 18px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
}
.rlhf-side.thumb-up { background: var(--teal-tint); border-color: var(--teal-soft); }
.rlhf-side.thumb-down { background: var(--coral-tint); border-color: var(--coral-soft); }
.rlhf-thumb { font-size: 28px; margin-bottom: 8px; }
.rlhf-side h5 { font-family: var(--font-serif); font-size: 15px; margin-bottom: 6px; }
.rlhf-side p { font-size: 13px !important; line-height: 1.55 !important; margin: 0 !important; color: var(--ink-soft); }

/* Bias scale */
.bias-scale {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 8px;
  height: 200px;
  margin: 24px 0;
}
.bias-bar {
  flex: 1;
  max-width: 60px;
  background: var(--teal);
  border-radius: var(--r-sm) var(--r-sm) 0 0;
  position: relative;
  transition: height .8s cubic-bezier(.2,.7,.2,1);
}
.bias-bar.skewed { background: var(--coral); }
.bias-bar-label {
  position: absolute;
  bottom: -28px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  color: var(--ink-soft);
  white-space: nowrap;
}

/* ============================================================
   BENCHMARK CARDS
   ============================================================ */
.bench-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
  margin: 24px 0 8px;
}
.bench-card {
  background: var(--surface);
  border-radius: var(--r-md);
  padding: 22px 24px;
  border: 1px solid var(--line-soft);
  transition: border-color .2s, transform .2s, box-shadow .2s;
  display: flex;
  flex-direction: column;
}
.bench-card:hover {
  border-color: var(--teal);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lift);
}
.bench-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 4px;
}
.bench-card-name {
  font-family: var(--font-serif) !important;
  font-size: 22px !important;
  font-weight: 600 !important;
  color: var(--ink);
  margin: 0 !important;
  line-height: 1.2;
}
.bench-card-cat {
  display: inline-block;
  background: var(--teal-soft);
  color: var(--teal-deep);
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  white-space: nowrap;
  flex-shrink: 0;
}
.bench-card-cat.coral { background: var(--coral-soft); color: var(--coral-deep); }
.bench-card-cat.sun { background: var(--sun-soft); color: #8B6914; }
.bench-card-cat.lavender { background: var(--lavender-soft); color: #5E4A8B; }
.bench-card-translation {
  font-style: italic;
  color: var(--coral-deep);
  font-size: 14px;
  margin-bottom: 12px;
  font-family: var(--font-serif);
}
.bench-card-row {
  margin-top: 10px;
  font-size: 14.5px !important;
  line-height: 1.55 !important;
  color: var(--ink-soft);
  margin-bottom: 0 !important;
}
.bench-card-row strong {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--ink-muted);
  margin-bottom: 3px;
  font-weight: 700;
}

/* category section header (between benchmark groups) */
.bench-cat-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 48px 0 8px;
}
.bench-cat-header h2 {
  margin: 0 !important;
}
.bench-cat-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--teal-soft);
  color: var(--teal-deep);
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 600;
  flex-shrink: 0;
}
.bench-cat-tag.coral { background: var(--coral-soft); color: var(--coral-deep); }
.bench-cat-tag.sun { background: var(--sun-soft); color: #8B6914; }
.bench-cat-tag.lavender { background: var(--lavender-soft); color: #5E4A8B; }

/* ============================================================
   BENCH-CHART — horizontal bars comparing models
   ============================================================ */
.bench-chart {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.bench-chart-row {
  display: grid;
  grid-template-columns: 180px 1fr 60px;
  gap: 14px;
  align-items: center;
  font-size: 14px;
}
.bench-chart-name {
  font-family: var(--font-serif);
  font-weight: 500;
  text-align: right;
  color: var(--ink);
  font-size: 15px;
}
.bench-chart-track {
  background: var(--cream-deep);
  border-radius: 999px;
  height: 22px;
  overflow: hidden;
  position: relative;
}
.bench-chart-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--teal) 0%, #5BB3A9 100%);
  width: 0%;
  transition: width 1s cubic-bezier(.2,.7,.2,1);
}
.bench-chart-fill.coral {
  background: linear-gradient(90deg, var(--coral) 0%, #F4B39A 100%);
}
.bench-chart-fill.sun {
  background: linear-gradient(90deg, #C49826 0%, var(--sun) 100%);
}
.bench-chart-fill.lavender {
  background: linear-gradient(90deg, #8C76B5 0%, var(--lavender) 100%);
}
.bench-chart-pct {
  font-family: var(--font-serif);
  font-weight: 500;
  color: var(--ink-soft);
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-size: 15px;
}
.bench-chart-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.bench-chart-tab {
  background: var(--cream-deep);
  border: 1px solid transparent;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
  font-family: var(--font-sans);
  transition: all .2s;
}
.bench-chart-tab:hover { background: var(--cream-warm); }
.bench-chart-tab.active {
  background: var(--ink);
  color: var(--cream);
  border-color: var(--ink);
}

@media (max-width: 640px) {
  .bench-chart-row { grid-template-columns: 110px 1fr 50px; gap: 8px; font-size: 13px; }
  .bench-card-head { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 760px) {
  .viz { padding: 18px; margin: 28px 0; border-radius: var(--r-md); }
  .viz-title { font-size: 18px; }
  .viz-sub { font-size: 13px; margin-bottom: 18px; }
  .viz-controls { gap: 14px; margin-top: 16px; padding-top: 16px; }
  .viz-control-group { min-width: 0; flex: 1 1 100%; }

  .prob-row { grid-template-columns: 90px 1fr 50px; }

  /* Benchmark grid — was minmax(320px, 1fr), overflowed below 360px viewport */
  .bench-grid { grid-template-columns: 1fr; gap: 14px; }
  .bench-card { padding: 18px 20px; }
  .bench-card-name { font-size: 19px !important; }
  .bench-cat-header { gap: 10px; margin: 36px 0 8px; }
  .bench-cat-tag { width: 38px; height: 38px; font-size: 18px; }

  /* Bench chart already has 640px breakpoint, add intermediate */
  .bench-chart-name { font-size: 13.5px; }
  .bench-chart-pct { font-size: 13.5px; }
  .bench-chart-track { height: 18px; }

  /* RLHF / comparison grids */
  .rlhf { grid-template-columns: 1fr; }

  /* Matrix — fixed aspect ratio caused overflow */
  .matrix {
    aspect-ratio: auto;
    grid-template-columns: 60px 1fr 1fr;
    grid-template-rows: auto auto 56px;
  }
  .matrix-cell { padding: 14px; }
  .matrix-cell h5 { font-size: 15px; }
  .matrix-cell p { font-size: 12.5px !important; }

  /* Thermometer */
  .thermo { flex-wrap: wrap; gap: 16px; }
  .thermo-bar { height: 160px; }

  /* Timeline */
  .timeline::before { left: 10px; }
  .tl-item { padding-left: 40px; margin-bottom: 22px; }
  .tl-dot { left: 3px; }
  .tl-year { font-size: 19px; }

  /* Context bar */
  .ctx-bar { height: 48px; padding: 0 16px; }
  .ctx-bar-label { font-size: 14px; }

  /* Embedding scatter */
  .embed-vis { aspect-ratio: 4/3; }
}

@media (max-width: 480px) {
  .viz { padding: 14px; margin: 24px 0; }
  .viz-title { font-size: 16px; }

  .prob-row { grid-template-columns: 72px 1fr 42px; gap: 8px; font-size: 13px; }
  .prob-word { font-size: 14px; }
  .prob-bar-track { height: 18px; }

  .bench-chart-row { grid-template-columns: 90px 1fr 40px; gap: 8px; font-size: 12.5px; }
  .bench-chart-name { font-size: 12.5px; }
  .bench-chart-pct { font-size: 12.5px; }

  .token-cascade { font-size: 15px; }

  .matrix { grid-template-columns: 48px 1fr 1fr; }
  .matrix-cell { padding: 10px; }
  .matrix-cell h5 { font-size: 14px; margin-bottom: 4px; }
  .matrix-cell p { font-size: 11.5px !important; }

  .tl-year { font-size: 17px; }
  .tl-event { font-size: 14px; }
}
