:root {
  --text: #1a1a1a;
  --muted: #555;
  --bg: #ffffff;
  --bg-alt: #f7f7f5;
  --accent: #b54a1f;
  --accent-soft: #e8c9b8;
  --rule: #e6e6e6;
  --code-bg: #f3f3ef;
  --max-w: 880px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Source Sans 3', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  /* Hard guard against horizontal page scroll on mobile. */
  overflow-x: hidden;
  max-width: 100vw;
}

/* Any media element should stay within its container. */
img, video, canvas, svg { max-width: 100%; height: auto; }

.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px;
}

.wide {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- Hero ---------- */
.hero {
  padding: 72px 24px 32px;
  text-align: center;
  border-bottom: 1px solid var(--rule);
}
.hero h1 {
  font-family: 'Source Serif 4', 'Crimson Pro', Georgia, serif;
  font-weight: 600;
  font-size: 2.4rem;
  line-height: 1.2;
  margin: 0 0 8px;
  letter-spacing: -0.01em;
}
.hero .subtitle {
  font-size: 1.05rem;
  color: var(--muted);
  margin: 0 auto 24px;
  max-width: 720px;
}
.hero .authors {
  font-size: 1rem;
  margin: 18px 0 6px;
}
.hero .authors a { color: var(--text); }
.hero .affil {
  color: var(--muted);
  font-size: 0.95rem;
  margin-bottom: 8px;
}
.hero .corresponding {
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 22px;
}
.hero .corresponding sup {
  margin-right: 2px;
}
.hero .badges {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 18px;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--bg-alt);
  color: var(--text);
  font-size: 0.92rem;
  text-decoration: none;
  transition: all 0.15s ease;
}
.badge:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ---------- Sections ---------- */
section {
  padding: 56px 0;
  border-bottom: 1px solid var(--rule);
}
section:last-of-type { border-bottom: none; }

h2 {
  font-family: 'Source Serif 4', Georgia, serif;
  font-weight: 600;
  font-size: 1.7rem;
  margin: 0 0 8px;
  letter-spacing: -0.005em;
}
h2 .num {
  color: var(--accent);
  font-weight: 500;
  margin-right: 10px;
}
h3 {
  font-family: 'Source Serif 4', Georgia, serif;
  font-weight: 600;
  font-size: 1.2rem;
  margin: 32px 0 8px;
}
h2 + .lead, .section-lead {
  margin: 0 0 18px;
}

p { margin: 0 0 14px; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

em { font-style: italic; }
strong { font-weight: 600; }

code {
  font-family: 'JetBrains Mono', 'SF Mono', Menlo, monospace;
  font-size: 0.9em;
  background: var(--code-bg);
  padding: 1px 5px;
  border-radius: 3px;
}

pre {
  background: var(--code-bg);
  padding: 18px 20px;
  border-radius: 6px;
  overflow-x: auto;
  font-size: 0.88rem;
  line-height: 1.5;
  max-width: 100%;
  /* Ensure the pre block itself doesn't widen the page; long lines scroll inside. */
}

/* Block-level math (MathJax display equations) scrolls inside its own row
   instead of pushing the page wider. */
mjx-container[display="true"], .MathJax_Display {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
}
pre code {
  background: none;
  padding: 0;
}

/* ---------- TL;DR callout ---------- */
.tldr {
  background: linear-gradient(180deg, #fdf6f1 0%, #fbf1e9 100%);
  border-left: 3px solid var(--accent);
  padding: 18px 22px;
  border-radius: 4px;
  margin: 24px 0 4px;
}
.tldr-label {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.tldr p { margin: 0; }

/* ---------- Figure ---------- */
figure {
  margin: 28px 0;
  text-align: center;
}
figure img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
}
/* Constrain a figure to roughly half-page width so it doesn't dominate on
   desktop, while still shrinking to fit narrower viewports. */
figure.figure-medium img { max-width: min(520px, 100%); }
figure.figure-medium figcaption { max-width: min(560px, 100%); margin-left: auto; margin-right: auto; }
figcaption {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.92rem;
  text-align: left;
  line-height: 1.5;
}
figcaption strong { color: var(--text); }

.figure-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin: 28px 0;
}
.figure-row figure { margin: 0; }
@media (max-width: 720px) {
  .figure-row { grid-template-columns: 1fr; }
}

/* ---------- Stat strip ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin: 28px 0 8px;
}
.stat {
  background: var(--bg-alt);
  border: 1px solid var(--rule);
  padding: 22px 18px;
  border-radius: 6px;
  text-align: center;
}
.stat .num-big {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 2rem;
  font-weight: 600;
  color: var(--accent);
  line-height: 1.1;
}
.stat .lbl {
  display: block;
  font-size: 0.88rem;
  color: var(--muted);
  margin-top: 6px;
}
@media (max-width: 720px) {
  .stats { grid-template-columns: 1fr; }
}

/* ---------- BibTeX ---------- */
.bibtex pre {
  background: #1a1a1a;
  color: #f0f0f0;
  font-size: 0.85rem;
}

/* ---------- Footer ---------- */
footer {
  padding: 32px 24px 48px;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

/* small inline math symbols */
.sym { font-style: italic; font-family: 'Source Serif 4', Georgia, serif; }

/* ---------- Toy demo ---------- */
.toy {
  margin-top: 24px;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--bg-alt);
  overflow: hidden;
}
.toy-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--rule);
  background: #fff;
  font-size: 0.92rem;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
}
.toy-header strong { color: var(--text); }
.toy-body {
  padding: 18px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr);
  gap: 22px;
}
@media (max-width: 760px) {
  .toy-body { grid-template-columns: 1fr; }
}

/* Coef slider */
.slider-wrap { margin-bottom: 18px; }
.slider-readout {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.05rem;
  color: var(--text);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.slider-readout b { color: var(--accent); font-weight: 700; }
.slider-readout .best-tag {
  font-size: 0.65rem;
  background: var(--accent);
  color: #fff;
  border-radius: 3px;
  padding: 2px 6px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-family: inherit;
}
#coef-slider {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  background: #d8d8d4;
  border-radius: 2px;
  outline: none;
}
#coef-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px var(--accent);
  cursor: pointer;
}
#coef-slider::-moz-range-thumb {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px var(--accent);
  cursor: pointer;
}
.slider-ticks {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  color: var(--muted);
  padding: 0 2px;
}
.slider-ticks .best {
  color: var(--accent);
  font-weight: 700;
}
.slider-ticks .best::after { content: " ★"; }

.score-rows { margin-top: 4px; }
.score-row { margin-bottom: 12px; }
.score-row .lab {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 4px;
}
.score-row .lab b {
  font-family: 'JetBrains Mono', monospace;
  color: var(--text);
}
.bar-track {
  height: 8px;
  background: #ececea;
  border-radius: 4px;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
  transition: width 0.18s ease;
}
.bar-fill.coh   { background: #4a7fb5; }
.bar-fill.steer { background: #2f9e6e; }

.toy-output .qa-q {
  font-size: 0.88rem;
  color: var(--muted);
  margin-bottom: 6px;
}
.toy-output .qa-q b { color: var(--text); }
.toy-output .qa-a {
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 14px 16px;
  font-size: 0.93rem;
  line-height: 1.55;
  max-height: 320px;
  overflow-y: auto;
}

/* Rendered markdown blocks (toy answer + example answers) */
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p  { margin: 0.5em 0; }
.md h1, .md h2, .md h3, .md h4 {
  font-family: 'Source Serif 4', Georgia, serif;
  font-weight: 600;
  margin: 0.9em 0 0.3em;
  line-height: 1.3;
}
.md h1 { font-size: 1.15em; }
.md h2 { font-size: 1.08em; }
.md h3 { font-size: 1.02em; }
.md h4 { font-size: 0.98em; }
.md ul, .md ol { margin: 0.4em 0; padding-left: 1.4em; }
.md li { margin: 0.18em 0; }
.md li > p:first-child { margin: 0; }
.md strong { font-weight: 600; }
.md em { font-style: italic; }
.md code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.88em;
  background: var(--code-bg);
  padding: 1px 5px;
  border-radius: 3px;
}
.md pre {
  background: var(--code-bg);
  padding: 12px 14px;
  border-radius: 5px;
  overflow-x: auto;
  font-size: 0.85rem;
  line-height: 1.45;
}
.md blockquote {
  margin: 0.5em 0;
  padding-left: 12px;
  border-left: 3px solid var(--rule);
  color: var(--muted);
}

.output-note {
  margin-top: 6px;
  font-size: 0.78rem;
  color: var(--muted);
  font-style: italic;
  letter-spacing: 0.01em;
}

/* ---------- Source-CSV debug line (TEMP — for traceability while iterating) ---------- */
.source-trace {
  margin-top: 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  color: var(--muted);
  border-left: 2px solid var(--accent);
  padding: 4px 0 4px 8px;
  word-break: break-all;
  background: rgba(181, 74, 31, 0.04);
}
.source-trace::before {
  content: "TEMP · ";
  color: var(--accent);
  font-weight: 700;
}

/* ---------- Results viewer page ---------- */
.results-nav {
  border-bottom: 1px solid var(--rule);
  padding: 14px 24px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.results-nav .back {
  font-size: 0.92rem;
}
.results-nav h1 {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 1.4rem;
  font-weight: 600;
  margin: 0;
}

.selectors {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  margin: 28px 0 18px;
}
.selectors label {
  display: flex;
  flex-direction: column;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.selectors select {
  margin-top: 6px;
  padding: 8px 12px;
  border: 1px solid var(--rule);
  border-radius: 6px;
  font-size: 0.95rem;
  background: #fff;
  font-family: inherit;
  min-width: 200px;
  cursor: pointer;
  text-transform: none;
  letter-spacing: normal;
  color: var(--text);
}

.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--rule);
  margin: 18px 0 24px;
}
.tab-btn {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 10px 16px;
  font-size: 0.95rem;
  cursor: pointer;
  color: var(--muted);
  font-family: inherit;
  margin-bottom: -1px;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

.pane { display: none; }
.pane.active { display: block; }

.best-summary {
  background: var(--bg-alt);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 14px 18px;
  margin-top: 18px;
  font-size: 0.92rem;
  display: grid;
  gap: 18px;
}
.best-summary table { border-collapse: collapse; width: 100%; }
.best-summary td {
  padding: 4px 12px 4px 0;
  font-family: 'JetBrains Mono', monospace;
}
.best-summary td:first-child {
  color: var(--muted);
  font-family: inherit;
  width: 1%;
  white-space: nowrap;
}
#best-summary {
  grid-template-columns: 1fr 1fr;
}
@media (max-width: 720px) {
  #best-summary { grid-template-columns: 1fr; }
}
.strat-summary .strat-name {
  font-family: 'Source Sans 3', sans-serif;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
  margin-bottom: 6px;
}
.strat-summary table { font-size: 0.9rem; }

.best-summary.overall-best {
  display: block;
  padding: 12px 16px;
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--bg-alt);
  margin-bottom: 18px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}
.best-summary.overall-best .line { line-height: 1.6; }
.best-summary.overall-best .line.scores { color: var(--muted); }
.best-summary.overall-best .line.scores b { color: var(--text); font-family: 'JetBrains Mono', monospace; }

.example-card {
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 16px 18px;
  margin-bottom: 18px;
  background: #fff;
}
.example-card .ex-q {
  font-weight: 600;
  margin-bottom: 8px;
}
.example-card .ex-a {
  line-height: 1.55;
  font-size: 0.93rem;
  margin: 8px 0;
}
.example-card .ex-scores {
  display: flex;
  gap: 14px;
  font-size: 0.82rem;
  color: var(--muted);
  font-family: 'JetBrains Mono', monospace;
  margin-top: 6px;
}
.example-card .ex-scores b { color: var(--text); }

.chart-title {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 1.1rem;
  font-weight: 600;
  margin: 8px 0 4px;
}

.chart-wrap {
  position: relative;
  height: 380px;
  margin: 14px 0 8px;
}

.fallback-note {
  background: var(--bg-alt);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 18px 22px;
  color: var(--muted);
  font-size: 0.95rem;
}

/* ---------- Concept links + tooltip ---------- */
.concept-link, .concept-link-styled {
  color: var(--accent);
  cursor: help;
  text-decoration: none;
  border-bottom: 1px dotted var(--accent);
}
.concept-link:hover, .concept-link-styled:hover {
  border-bottom-style: solid;
}
.concept-link:focus-visible, .concept-link-styled:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

.concept-tooltip {
  display: none;
  position: absolute;
  z-index: 50;
  background: #1a1a1a;
  color: #f0f0f0;
  padding: 12px 14px;
  border-radius: 6px;
  font-size: 0.85rem;
  line-height: 1.5;
  width: 320px;
  max-width: calc(100vw - 32px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
  pointer-events: none;
}
.concept-tooltip .ct-name {
  font-family: 'Source Serif 4', Georgia, serif;
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 6px;
  color: #fff;
}
.concept-tooltip .ct-pos {
  color: #d8d8d8;
  margin-bottom: 8px;
}
.concept-tooltip .ct-cta {
  font-size: 0.75rem;
  color: #f0a47b;
  letter-spacing: 0.04em;
}

/* Info button next to a select */
.select-with-info {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
}
.select-with-info select {
  margin-top: 0 !important;
}
.info-btn {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid var(--rule);
  background: #fff;
  color: var(--accent);
  font-family: 'Source Serif 4', Georgia, serif;
  font-style: italic;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
}
.info-btn:hover {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

/* ---------- Concept definitions page ---------- */
.concept-toc {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 20px 0 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--rule);
}
.toc-chip {
  font-size: 0.85rem;
  padding: 4px 10px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  color: var(--text);
  background: var(--bg-alt);
  text-decoration: none;
}
.toc-chip:hover { border-color: var(--accent); color: var(--accent); }

.concept-entry {
  margin-bottom: 36px;
  scroll-margin-top: 24px;
}
.concept-entry h2 {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 1.35rem;
  font-weight: 600;
  margin: 0 0 10px;
  color: var(--accent);
}
/* Two-column grid: tag column on left, content column on right.
   Prevents wrapped text from sliding under the label. */
.concept-meta {
  display: grid;
  grid-template-columns: 110px 1fr;
  column-gap: 18px;
  row-gap: 14px;
  margin: 4px 0 18px;
}
.concept-meta dt {
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
  padding-top: 4px;
}
.concept-meta dt .sym {
  text-transform: none;
  letter-spacing: normal;
  margin-left: 2px;
}
.concept-meta dd {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.55;
}
@media (max-width: 480px) {
  .concept-meta { grid-template-columns: 1fr; row-gap: 6px; }
  .concept-meta dt { padding-top: 0; }
}
.concept-granularity {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  flex-wrap: wrap;
  margin: 16px 0 18px;
  font-size: 0.9rem;
}
.concept-granularity .lbl {
  display: inline-block;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  width: 70px;
  font-weight: 700;
  padding-top: 6px;
}
.concept-granularity .sym {
  text-transform: none;
  letter-spacing: normal;
  margin-left: 2px;
}
.gran-grid {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.gran-cell {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  background: var(--bg-alt);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 6px 12px;
  min-width: 110px;
}
.gran-cell .gran-model {
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 2px;
}
.gran-cell .gran-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.95rem;
  color: var(--text);
}

.concept-dropdown {
  margin-top: 10px;
  font-size: 0.9rem;
}
.concept-dropdown summary {
  color: var(--muted);
  cursor: pointer;
  list-style: none;
  padding: 4px 0;
}
.concept-dropdown summary::-webkit-details-marker { display: none; }
.concept-dropdown summary::before {
  content: "▸ ";
  display: inline-block;
  transform: translateY(-1px);
}
.concept-dropdown[open] summary::before { content: "▾ "; }
.concept-dropdown ol {
  margin: 8px 0 0 0;
  padding-left: 1.4em;
  color: var(--text);
}
.concept-dropdown li { margin: 6px 0; }

.prompt-list .prompt-pair > div {
  display: grid;
  grid-template-columns: 84px 1fr;
  column-gap: 12px;
  margin-bottom: 4px;
}
.prompt-tag {
  display: inline-block;
  font-size: 0.65rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 3px;
  align-self: start;
  text-align: center;
}
.prompt-tag.pos { background: #e8f0e3; color: #2f6b3a; }
.prompt-tag.neg { background: #f3e5e0; color: #8a3a1f; }
.prompt-list .prompt-pair { padding-bottom: 6px; }

/* ---------- Mobile / narrow-viewport polish ---------- */
@media (max-width: 600px) {
  .container, .wide { padding: 0 16px; }

  .hero { padding: 40px 16px 24px; }
  .hero h1 { font-size: 1.6rem; line-height: 1.18; }
  .hero .subtitle { font-size: 0.97rem; }
  .hero .authors { font-size: 0.92rem; }
  .hero .affil { font-size: 0.85rem; }
  .hero .badges { gap: 8px; }
  .badge { font-size: 0.85rem; padding: 6px 11px; }

  section { padding: 36px 0; }
  h2 { font-size: 1.4rem; }
  h2 .num { margin-right: 6px; }
  h3 { font-size: 1.1rem; margin-top: 24px; }

  /* Word-wrap defensively so long unbroken strings (URLs, citations, etc.)
     don't widen the layout. */
  p, li, figcaption, .lbl, dd, dt, summary { overflow-wrap: anywhere; }

  /* BibTeX block: shrink slightly so it scrolls comfortably. */
  pre { font-size: 0.78rem; padding: 14px 16px; }

  /* Stats cards: single column already kicks in at 720, but pad less here. */
  .stat { padding: 16px 14px; }

  /* Toy demo: tighter padding so output fits the narrow viewport. */
  .toy-header { padding: 12px 14px; font-size: 0.86rem; gap: 8px 12px; }
  .toy-body { padding: 14px; gap: 16px; }
  .toy-output .qa-a { font-size: 0.88rem; padding: 12px 14px; }
  .coef-pill { font-size: 0.85rem; padding: 6px 11px; }
  .slider-ticks { font-size: 0.7rem; }

  /* Concept page tabular layout: stack a hair earlier. */
  .concept-meta { column-gap: 12px; }
  .concept-entry h2 { font-size: 1.2rem; }

  /* Results page: stack model + concept selectors and shrink chart height. */
  .results-nav { flex-direction: column; align-items: flex-start; gap: 6px; }
  .results-nav h1 { font-size: 1.2rem; }
  .selectors { gap: 12px; flex-direction: column; }
  .selectors select { min-width: 0; width: 100%; }
  .select-with-info select { flex: 1; }
  .chart-wrap { height: 280px; }
  .chart-title { font-size: 1rem; }
  .tabs { overflow-x: auto; }
  .tab-btn { padding: 8px 12px; font-size: 0.9rem; white-space: nowrap; }

  /* Granularity cells: smaller min-width so three fit a narrow row. */
  .gran-cell { min-width: 0; flex: 1 1 90px; padding: 5px 10px; }

  /* Concept tooltip: keep within viewport. */
  .concept-tooltip { width: calc(100vw - 24px); padding: 10px 12px; font-size: 0.8rem; }
}

/* Very narrow phones (≤ 380px): squeeze the hero title further. */
@media (max-width: 380px) {
  .hero h1 { font-size: 1.4rem; }
}
