:root {
  --bg: #091416;
  --panel: #0e1d20;
  --raised: #132629;
  --line: #1f3a3d;
  --line-strong: #2e5357;
  --text: #dceae5;
  --muted: #8ba6a1;
  --faint: #5d7a77;
  --mint: #81ead4;
  --mint-dim: #3f8f82;
  --warm: #fb6b29;
  --cool: #249af2;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Roboto Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }      /* keeps the attribute working on elements with their own display rule */
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--sans); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
h1, h2, h3, p, figure { margin: 0; }
button, select, input { font: inherit; color: inherit; }

/* Paper header: title, authors, affiliations, links. The console follows it directly. */
#paper { padding: 46px 24px 30px; text-align: center; background: radial-gradient(ellipse 70% 120% at 50% -20%, #12282b 0%, var(--bg) 70%); }
.paper-inner { max-width: 980px; margin: 0 auto; }
#paper h1 { font-weight: 600; letter-spacing: -0.015em; line-height: 1.15; }
.paper-name { display: block; font-size: 52px; color: var(--mint); }
.paper-title { display: block; margin-top: 8px; font-size: 25px; font-weight: 500; letter-spacing: -0.005em; color: var(--text); }
/* Names and affiliations wrap as whole items, never inside one. */
.authors, .affiliations { display: flex; flex-wrap: wrap; justify-content: center; }
.authors span, .affiliations span { white-space: nowrap; }
.authors { margin-top: 20px; gap: 2px 18px; font-size: 16px; color: var(--text); }
.affiliations { margin-top: 8px; gap: 2px 20px; font-size: 13.5px; color: var(--muted); }
.authors a { color: inherit; text-decoration: underline; text-decoration-color: var(--line-strong); text-decoration-thickness: 1px; text-underline-offset: 4px; transition: color 0.15s, text-decoration-color 0.15s; }
.authors a:hover, .authors a:focus-visible { color: var(--mint); text-decoration-color: var(--mint); outline: none; }
.authors sup { font-size: 0.7em; color: var(--mint-dim); margin-left: 1px; }
.affiliations sup { font-size: 0.7em; color: var(--mint-dim); margin-right: 2px; }
.links { margin-top: 22px; display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.link { display: inline-flex; align-items: center; gap: 7px; padding: 8px 15px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--panel); color: var(--text); font-size: 13.5px; font-weight: 500; text-decoration: none; transition: border-color 0.15s, color 0.15s; }
.link[href]:hover, .link[href]:focus-visible { border-color: var(--mint); color: var(--mint); outline: none; }
.link:not([href]) { color: var(--faint); border-color: var(--line); cursor: default; }
.soon { font-family: var(--mono); font-size: 10.5px; font-weight: 400; padding: 1px 6px; border: 1px solid var(--line); border-radius: 999px; color: var(--faint); }

#console {
  border-top: 1px solid var(--line);
  display: grid;
  grid-template: "bar bar bar" 52px "stimuli stage panel" minmax(0, 1fr) / 168px minmax(0, 1fr) 348px;
  height: 100vh;
  min-height: 660px;
}

.bar { grid-area: bar; display: flex; align-items: center; gap: 20px; padding: 0 18px; border-bottom: 1px solid var(--line); background: var(--panel); }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 600; font-size: 16px; letter-spacing: 0.01em; white-space: nowrap; }
.brand .mark { width: 11px; height: 11px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 4px rgba(129, 234, 212, 0.14); }
.brand .tag { font-weight: 400; font-size: 12px; color: var(--muted); margin-left: 4px; }
.prompt { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; }
.prompt .token { padding: 3px 9px; border: 1px solid var(--line-strong); border-radius: 5px; color: var(--text); background: var(--raised); }
.prompt .token.source { border-color: var(--mint-dim); color: var(--mint); }
.prompt .arrow { color: var(--faint); }
.status { font-family: var(--mono); font-size: 12px; color: var(--muted); white-space: nowrap; padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px; }
.status.live { color: var(--mint); border-color: var(--mint-dim); }
.status.failed { color: #ff9a8a; border-color: #7d3a32; }

aside h2, .card h2 { font-size: 12px; font-weight: 600; letter-spacing: 0.04em; color: var(--muted); display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.step { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; border: 1px solid var(--mint-dim); color: var(--mint); font-family: var(--mono); font-size: 11px; font-weight: 500; }

#stimuli { grid-area: stimuli; border-right: 1px solid var(--line); background: var(--panel); padding: 14px 10px 10px 14px; display: flex; flex-direction: column; min-height: 0; }
.gallery { display: flex; flex-wrap: wrap; align-content: flex-start; gap: 6px; flex: 1; min-height: 0; overflow-y: auto; padding-right: 6px; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.gallery button { flex: none; width: calc(50% - 3px); aspect-ratio: 1; padding: 0; border: 1px solid transparent; border-radius: 6px; background: none; cursor: pointer; overflow: hidden; opacity: 0.72; transition: opacity 0.15s, border-color 0.15s; }
.gallery button:hover, .gallery button:focus-visible { opacity: 1; border-color: var(--line-strong); outline: none; }
.gallery button[aria-pressed="true"] { opacity: 1; border-color: var(--mint); }
.gallery img { display: block; width: 100%; height: 100%; object-fit: cover; }

#stage { grid-area: stage; position: relative; min-width: 0; min-height: 0; overflow: hidden; background: radial-gradient(ellipse at 50% 46%, #12282b 0%, var(--bg) 72%); }
#cortex { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; }
#cortex:active { cursor: grabbing; }
.labels { position: absolute; inset: 0; pointer-events: none; }
.labels span { position: absolute; transform: translate(-50%, -50%); font-family: var(--mono); font-size: 11px; font-weight: 500; color: #f2faf7; text-shadow: 0 0 4px #000, 0 0 2px #000; padding: 1px 4px; }
.labels span.source { color: var(--mint); }
.tooltip { position: fixed; z-index: 5; pointer-events: none; padding: 5px 9px; border-radius: 6px; background: rgba(9, 20, 22, 0.94); border: 1px solid var(--line-strong); font-size: 12px; white-space: nowrap; }
.tooltip b { font-weight: 600; }
.tooltip span { font-family: var(--mono); color: var(--muted); margin-left: 8px; }

.stage-top { position: absolute; top: 14px; left: 16px; right: 16px; display: flex; justify-content: space-between; gap: 10px; pointer-events: none; }
.stage-bottom { position: absolute; bottom: 16px; left: 16px; right: 16px; display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; pointer-events: none; }
.stage-top > *, .stage-bottom > * { pointer-events: auto; }
.segmented { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; background: rgba(14, 29, 32, 0.86); }
.segmented button { border: 0; background: none; padding: 6px 13px; font-size: 12px; color: var(--muted); cursor: pointer; }
.segmented button + button { border-left: 1px solid var(--line); }
.segmented button:hover { color: var(--text); }
.segmented button[aria-pressed="true"] { background: var(--raised); color: var(--mint); }
.segmented button:disabled { color: var(--faint); cursor: default; }
.segmented.quiet { border-color: var(--line); }
.legend { min-width: 250px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; background: rgba(14, 29, 32, 0.86); }
.legend-title { font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.legend-row { display: flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: 11px; color: var(--text); }
.legend-bar { flex: 1; height: 8px; border-radius: 4px; }
.inflate { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); padding: 7px 12px; border: 1px solid var(--line); border-radius: 8px; background: rgba(14, 29, 32, 0.86); }
.inflate input { width: 110px; }
.hint { position: absolute; top: 58px; left: 0; right: 0; text-align: center; font-size: 12px; color: var(--faint); pointer-events: none; transition: opacity 0.4s; }
.scroll-cue { position: absolute; bottom: 24px; left: 50%; transform: translateX(-50%); font-size: 12px; color: var(--faint); text-decoration: none; }
.scroll-cue::after { content: " \2193"; }
.scroll-cue:hover { color: var(--mint); }

#panel { grid-area: panel; border-left: 1px solid var(--line); background: var(--panel); overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.card { border: 1px solid var(--line); border-radius: 10px; background: var(--raised); padding: 12px 13px; }
.note { font-size: 12px; color: var(--muted); line-height: 1.5; }
.stim { display: flex; gap: 12px; align-items: center; }
.stim img { width: 68px; height: 68px; border-radius: 8px; object-fit: cover; border: 1px solid var(--line-strong); background: var(--bg); }
.stim-name { font-weight: 600; font-size: 14px; margin-bottom: 3px; text-transform: capitalize; }
.chips { display: grid; grid-template-columns: repeat(6, 1fr); gap: 5px; }
.chips button { border: 1px solid var(--line-strong); border-radius: 6px; background: none; padding: 5px 0; font-family: var(--mono); font-size: 11.5px; white-space: nowrap; cursor: pointer; color: var(--text); }
.chips button:hover { border-color: var(--mint-dim); }
.chips button[aria-pressed="true"] { border-color: var(--mint); color: var(--mint); background: rgba(129, 234, 212, 0.08); }
.region-info { margin-top: 10px; font-size: 12px; color: var(--muted); }
.region-info table { width: 100%; border-collapse: collapse; margin-top: 6px; font-family: var(--mono); font-size: 11.5px; }
.region-info th { font-weight: 400; color: var(--faint); text-align: right; padding: 2px 0; }
.region-info th:first-child, .region-info td:first-child { text-align: left; font-family: var(--sans); }
.region-info td { text-align: right; padding: 2px 0; color: var(--text); }
.region-info p { margin: 8px 0 0; }
.field { display: grid; gap: 5px; font-size: 12px; color: var(--muted); margin-bottom: 12px; }
select { background: var(--panel); border: 1px solid var(--line-strong); border-radius: 6px; padding: 6px 8px; font-size: 13px; }
.dose-row { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.dose-row output { font-family: var(--mono); color: var(--mint); }
input[type="range"] { width: 100%; accent-color: var(--mint); margin: 6px 0 4px; }
input[type="range"]:disabled { opacity: 0.4; }
.buttons { display: flex; gap: 8px; margin: 8px 0; }
.buttons button { border: 1px solid var(--line-strong); border-radius: 6px; background: var(--panel); padding: 6px 12px; font-size: 12px; cursor: pointer; }
.buttons button:hover:not(:disabled) { border-color: var(--mint-dim); color: var(--mint); }
.buttons button:disabled { opacity: 0.45; cursor: default; }
.bars { display: grid; gap: 7px; }
.bar-row { display: grid; grid-template-columns: 46px 1fr 58px; align-items: center; gap: 8px; font-family: var(--mono); font-size: 11.5px; }
.bar-row .name { color: var(--text); }
.bar-row.source .name { color: var(--mint); }
.bar-row .track { position: relative; height: 9px; border-radius: 5px; background: var(--panel); }
.bar-row .track::before { content: ""; position: absolute; left: 50%; top: -2px; bottom: -2px; width: 1px; background: var(--line-strong); }
.bar-row .fill { position: absolute; top: 0; bottom: 0; border-radius: 5px; }
.bar-row .value { text-align: right; color: var(--muted); }
.decode { display: grid; gap: 10px; transition: opacity 0.15s; }
.decode.stale { opacity: 0.5; }
.decode:empty { display: none; }
.decode-row h3 { margin: 0 0 5px; font-size: 11.5px; font-weight: 500; color: var(--muted); }
.decode-strip { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.decode-item { display: grid; gap: 3px; justify-items: center; font-family: var(--mono); font-size: 10.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.decode-thumb { display: block; width: 100%; aspect-ratio: 1; border-radius: 6px; border: 1px solid var(--line); background-color: var(--bg); background-repeat: no-repeat; }
.decode-thumb.match { border-color: var(--mint); box-shadow: 0 0 0 1px var(--mint); }
.decode + .note { margin-top: 10px; }
.matrices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 10px 0 8px; }
.matrices canvas { width: 100%; height: auto; display: block; border-radius: 6px; }
.matrices figcaption { font-size: 11px; color: var(--muted); margin-top: 4px; text-align: center; }

#about { border-top: 1px solid var(--line); background: #0b1719; padding: 64px 24px 88px; }
.about-inner { max-width: 980px; margin: 0 auto; }
#about h2 { font-size: 22px; font-weight: 600; letter-spacing: -0.01em; margin: 60px 0 16px; scroll-margin-top: 24px; }
#about h2:first-child { margin-top: 0; }
.abstract { font-size: 16px; line-height: 1.75; color: #c9d9d4; max-width: 820px; }
.section-note { margin: -8px 0 18px; font-size: 13px; color: var(--faint); }
/* Paper figures are drawn for a white page: keep them on one. */
.paper-figure { margin: 0 0 36px; }
.paper-figure a { display: block; padding: 16px 18px; border-radius: 12px; background: #fff; border: 1px solid var(--line-strong); transition: border-color 0.15s; }
.paper-figure a:hover, .paper-figure a:focus-visible { border-color: var(--mint); outline: none; }
.paper-figure img { display: block; width: 100%; height: auto; }
.paper-figure figcaption { margin-top: 12px; max-width: 900px; font-size: 13.5px; line-height: 1.65; color: var(--muted); }
.paper-figure figcaption b { color: var(--text); font-weight: 600; }
.columns { display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px; }
.bibtex { position: relative; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.bibtex pre { margin: 0; padding: 18px 20px; overflow-x: auto; font-family: var(--mono); font-size: 12.5px; line-height: 1.7; color: #c9d9d4; }
.bibtex button { position: absolute; top: 10px; right: 10px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--raised); padding: 5px 12px; font-size: 12px; cursor: pointer; }
.bibtex button:hover, .bibtex button:focus-visible { border-color: var(--mint-dim); color: var(--mint); outline: none; }
.bib-note { margin-top: 10px; font-size: 12.5px; color: var(--faint); }
.columns h3 { font-size: 13px; font-weight: 600; color: var(--mint); letter-spacing: 0.03em; margin-bottom: 8px; }
.columns p { color: var(--muted); font-size: 14px; line-height: 1.65; }
.columns em { font-style: normal; font-family: var(--mono); font-size: 12.5px; color: var(--text); }
.credits { margin-top: 56px; padding-top: 20px; border-top: 1px solid var(--line); font-size: 12px; color: var(--faint); }
.credits a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.credits a:hover { color: var(--text); }

@media (max-width: 980px) {
  #console { grid-template: "bar" 52px "stage" 58vh "stimuli" auto "panel" auto / minmax(0, 1fr); height: auto; }
  .prompt { display: none; }
  #stimuli { border-right: 0; border-top: 1px solid var(--line); }
  .gallery { flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; padding-bottom: 6px; }
  .gallery button { width: 64px; }
  #panel { border-left: 0; border-top: 1px solid var(--line); overflow: visible; }
  .columns { grid-template-columns: 1fr; gap: 22px; }
  .scroll-cue, .inflate, #views { display: none; }
  .bar { gap: 10px; padding: 0 14px; justify-content: space-between; }
  .brand .tag { display: none; }
  #paper { padding: 34px 18px 24px; }
  .paper-name { font-size: 40px; }
  .paper-title { font-size: 19px; }
  .authors { font-size: 14.5px; }
  .bibtex pre { padding-top: 44px; }
  .paper-figure a { padding: 8px; border-radius: 8px; }
}
