:root { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: #26352e; background: #fff; font-synthesis: none; --muted: #647069; --line: #e4e9e5; --green: #3d742e; }
* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .5; }
a { color: inherit; text-underline-offset: 3px; }
button, a, input, select, summary, canvas { outline-offset: 4px; }
:focus-visible { outline: 3px solid #3476af; }
header { max-width: 1040px; margin: auto; min-height: 76px; padding: 16px 24px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 12px; font-weight: 750; font-size: 20px; text-decoration: none; }
.brand img { image-rendering: pixelated; }
nav { display: flex; gap: 24px; font-size: 14px; }
nav a { text-decoration: none; }
nav a:hover { text-decoration: underline; }
main { max-width: 960px; margin: auto; padding: 24px 24px 0; }
.intro { text-align: center; margin-bottom: 22px; }
h1 { font-size: 26px; letter-spacing: -.6px; margin: 0 0 8px; }
p { font-size: 16px; line-height: 1.65; }
.intro p { color: var(--muted); margin: 0; }
.tabs { display: flex; justify-content: center; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; }
.tabs button { padding: 12px 16px; border: 0; border-bottom: 3px solid transparent; background: none; color: var(--muted); font-size: 14px; white-space: nowrap; }
.tabs button[aria-selected="true"] { color: var(--green); border-color: var(--green); font-weight: 650; }
.mode-note { text-align: center; font-size: 14px; color: var(--muted); margin: -4px 0 20px; }
.workspace { display: grid; grid-template-columns: minmax(0,360px) minmax(0,320px); justify-content: center; align-items: start; gap: 32px; }
body[data-mode="play"] .workspace { grid-template-columns: minmax(0,360px); }
.arena { min-width: 0; width: min(100%, max(260px, (100svh - 280px) * .5625)); justify-self: center; }
.arena-head, .game-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 14px; }
.arena-head { margin-bottom: 10px; }
.arena-head > div { display: flex; gap: 12px; }
.text-button { border: 0; padding: 6px 0; background: none; font-size: 14px; color: var(--muted); }
.text-button:hover { color: var(--green); }
.game-wrap { position: relative; width: 100%; aspect-ratio: 288 / 512; background: #4ec0ca; overflow: hidden; border: 1px solid #526945; }
#game { display: block; width: 100%; height: 100%; image-rendering: pixelated; touch-action: manipulation; }
#overlay { position: absolute; inset: 0; pointer-events: none; display: flex; align-items: center; flex-direction: column; }
#ready-image { position: absolute; width: 63.89%; height: auto; top: 18%; image-rendering: pixelated; }
#gameover-image { position: absolute; width: 66.67%; height: auto; top: 23%; image-rendering: pixelated; }
.primary { pointer-events: auto; position: absolute; top: 83%; min-width: 116px; padding: 10px 20px; border: 3px solid #543c27; background: #e8792f; color: #fff; box-shadow: inset 0 0 0 2px #fff2c9, 0 3px 0 #543c27; text-shadow: 1px 2px #82442c; font-size: 20px; font-weight: 800; }
.primary:active { transform: translateY(2px); box-shadow: inset 0 0 0 2px #fff2c9; }
#end-card { position: absolute; top: 36%; width: 78%; background: #ded895; border: 3px solid #543c27; box-shadow: inset 0 0 0 3px #f5edbe; padding: 16px 20px; color: #795335; }
#end-card span { display: flex; align-items: center; justify-content: space-between; margin: 6px 0; font-size: 18px; font-weight: 700; }
#end-card b { color: #fff; font: bold 28px monospace; text-shadow: 2px 2px #543c27; }
#overlay-copy { position: absolute; top: 35%; width: 80%; padding: 12px; background: #fff6dceF; border: 2px solid #543c27; text-align: center; font-size: 16px; color: #543c27; }
#overlay.experiment #ready-image { display: none; }
#overlay.experiment h2 { position: absolute; top: 20%; margin: 0; color: white; text-shadow: 2px 2px #543c27; font-size: 30px; }
.game-foot { margin-top: 12px; color: var(--muted); font-size: 13px; }
.game-foot b { color: #26352e; }
.instrument { padding: 20px; border: 1px solid var(--line); border-radius: 8px; margin-top: 42px; }
.instrument-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
h2 { font-size: 19px; margin: 0 0 12px; }
.instrument h2 { font-size: 17px; margin: 0; }
.live-tag { color: var(--green); font-size: 12px; }
.instrument p { color: var(--muted); font-size: 14px; line-height: 1.6; }
#neural { display: block; width: 100%; height: auto; background: #172435; border-radius: 4px; }
.activity-key { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin: 10px 0 22px; }
.activity-key > span:first-child { display: flex; align-items: center; gap: 5px; }
.activity-key i { display: inline-block; width: 40px; height: 6px; background: linear-gradient(90deg,#718dd9,#2b3c4a,#c5f376); }
.prob { display: flex; justify-content: space-between; font-size: 14px; }
.prob-track { height: 5px; background: #e5eadf; margin: 10px 0 22px; }
.prob-track i { display: block; height: 100%; width: 0; background: #6da843; }
.controller-controls label { display: block; font-size: 14px; margin-top: 16px; }
select, input { display: block; width: 100%; padding: 9px; border: 1px solid #cbd3cd; background: white; color: #26352e; border-radius: 4px; margin-top: 6px; font-size: 16px; }
dl { padding-top: 12px; border-top: 1px solid var(--line); }
dl > div { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; margin: 10px 0; }
dt { color: var(--muted); } dd { margin: 0; font-variant-numeric: tabular-nums; }
.fine, .instrument .fine { font-size: 13px; color: var(--muted); }
.about, .results, footer { max-width: 720px; margin-left: auto; margin-right: auto; }
.about { margin-top: 48px; border-top: 1px solid var(--line); padding-top: 28px; }
.about p, .results p { color: var(--muted); }
.results { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 20px 0; margin-top: 28px; }
summary { cursor: pointer; font-weight: 650; font-size: 16px; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 14px; text-align: right; }
th, td { padding: 12px 8px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
th { font-size: 13px; color: var(--muted); font-weight: 500; }
th:first-child, td:first-child { text-align: left; }
.experiment-panel { max-width: 720px; margin: 28px auto; }
.experiment-panel p { color: var(--muted); }
#comparison-results { font-weight: 650; color: #26352e; }
#prob-chart { width: 100%; height: auto; }
footer { padding: 20px 0 24px; color: var(--muted); }
footer p { font-size: 12px; line-height: 1.7; }
.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0,0,0,0) !important; white-space: nowrap !important; border: 0 !important; }
@media (max-width: 680px) {
  header { min-height: 64px; padding: 14px 16px; }
  nav { gap: 18px; }
  main { padding: 20px 12px 0; }
  h1 { font-size: 24px; }
  .intro p { font-size: 14px; }
  .tabs { justify-content: flex-start; overflow-x: auto; }
  .tabs button { padding: 12px; }
  .workspace { grid-template-columns: minmax(0,360px); gap: 24px; }
  .instrument { margin-top: 0; }
  .about { margin-top: 32px; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto; } }

#overlay.game-ended .primary, #overlay.experiment .primary { top: 65%; }

/* The fly, the live game, and the model activity share one view. */
header { max-width: 1480px; }
main { max-width: 1480px; }
.intro { margin-bottom: 18px; }
.watch-toolbar { display: flex; align-items: center; justify-content: space-between; margin: 0 0 14px; gap: 16px; }
.watch-state, .watch-buttons { display: flex; align-items: center; gap: 12px; font-size: 14px; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: #428773; }
.watch-buttons button { border: 1px solid #cbd3cd; border-radius: 5px; background: white; color: #26352e; padding: 7px 18px; min-width: 86px; }
.watch-buttons label { display: flex; align-items: center; gap: 8px; }
.watch-buttons select { margin: 0; width: 78px; padding: 6px; font-size: 14px; }
body:not([data-mode="play"]) .workspace { grid-template-columns: minmax(300px, 1fr) 252px minmax(360px, 1.05fr); gap: 20px; align-items: start; background: #111a20; border: 1px solid #2d3e48; border-radius: 10px; padding: 20px; color: #e1edf2; }
body:not([data-mode="play"]) .arena { width: 100%; margin-top: 0; }
body:not([data-mode="play"]) .arena-head { min-height: 30px; margin-bottom: 12px; gap: 8px; font-size: 13px; }
body:not([data-mode="play"]) .arena-head > div { gap: 10px; }
body:not([data-mode="play"]) .text-button { color: #a2b4bf; font-size: 12px; }
body:not([data-mode="play"]) .game-wrap { border-color: #344852; }
body:not([data-mode="play"]) .game-foot { color: #a2b4bf; gap: 8px; font-size: 12px; flex-wrap: wrap; }
body:not([data-mode="play"]) .game-foot b { color: #fff; }
body:not([data-mode="play"]) .instrument { margin: 0; padding: 0; border: 0; border-radius: 0; min-width: 0; }
.instrument-head, .panel-heading { min-height: 30px; margin-bottom: 12px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.panel-heading h2 { font-size: 17px; margin: 0; }
.panel-heading > span { font-size: 12px; color: #98abb8; }
.fly-stage { min-width: 0; }
.fly-canvas-wrap { position: relative; }
#fly-scene { width: 100%; aspect-ratio: 1 / 1.1; display: block; touch-action: pan-y; border: 1px solid #253640; border-radius: 6px; cursor: grab; }
#fly-loading { position: absolute; inset: 0; display: grid; align-content: center; text-align: center; padding: 22px; color: #a2b4bf; background: #111a20; margin: 0; font-size: 14px; }
.action-strip { border-top: 1px solid #2a3c46; padding: 14px 0 0; margin-top: 14px; display: flex; justify-content: space-between; gap: 12px; font-size: 13px; color: #95a9b6; font-variant-numeric: tabular-nums; }
#fly-action { color: #d3e3ea; min-width: 70px; }
.pressing #fly-action { color: #ff9e7b; }
.stage-note { font-size: 13px; line-height: 1.55; color: #95a9b6; margin: 12px 0 0; }
.instrument p { color: #95a9b6; }
.instrument .live-tag { color: #68e6d2; }
#activity-copy { margin-top: 0; min-height: 42px; }
#neural { border: 1px solid #253640; touch-action: pan-y; cursor: grab; }
.activity-key { color: #9aaebb; margin-bottom: 12px; }
.activity-key i { background: linear-gradient(90deg, #ff996c, #23333e, #68e6d2); }
.brain-legend { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 12px; color: #a2b4bf; }
.brain-legend span { display: flex; align-items: center; gap: 5px; }
.brain-legend i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.input-ring { border: 1px solid #b8eaff; }
.output-ring { border: 1px solid #ffcd89; }
.instrument .neuron-readout, .instrument .path-readout { font-size: 12px; line-height: 1.7; font-variant-numeric: tabular-nums; margin: 12px 0; min-height: 40px; }
.instrument .neuron-readout { color: #dce9ef; }
.instrument .path-readout { margin-top: 0; }
.prob-track { background: #273a42; }
.prob-track i { background: #68e6d2; }
.controller-settings { border-top: 1px solid #2a3c46; padding-top: 14px; margin-top: 18px; }
.controller-settings summary { color: #b3c3cc; font-size: 14px; font-weight: 500; }
.controller-settings input, .controller-settings select { background: #17252f; color: #e4edf2; border-color: #344954; }
.instrument dl { border-color: #2a3c46; }
.instrument dt, .instrument .fine { color: #95a9b6; }
body[data-mode="play"] .intro h1 { font-size: 26px; }
body[data-mode="play"] #fly-stage, body[data-mode="play"] #watch-toolbar { display: none; }
body[data-mode="play"] .workspace { margin-top: 20px; }
@media (max-width: 1150px) {
  body:not([data-mode="play"]) .workspace { grid-template-columns: minmax(0,1fr) minmax(0,252px); max-width: 800px; margin: auto; }
  .instrument { grid-column: 1 / -1; }
  #neural { max-height: 400px; object-fit: contain; }
  #fly-scene { aspect-ratio: 1 / 1; }
}
@media (max-width: 600px) {
  body:not([data-mode="play"]) .workspace { grid-template-columns: minmax(0,1fr) minmax(0,.78fr); gap: 12px; padding: 12px; }
  .panel-heading h2, .instrument h2 { font-size: 15px; }
  .panel-heading > span { display: none; }
  #fly-scene { aspect-ratio: 1 / 1.55; }
  .action-strip { flex-direction: column; gap: 6px; }
  .stage-note { font-size: 12px; }
  body:not([data-mode="play"]) .arena-head { flex-wrap: wrap; margin-bottom: 12px; font-size: 12px; }
  body:not([data-mode="play"]) .arena-head > div { gap: 8px; }
  .workspace .primary { font-size: 14px; min-width: 86px; padding: 8px 12px; }
  .workspace #overlay.experiment h2 { font-size: 17px; }
  .workspace #overlay-copy { font-size: 12px; padding: 5px; }
  .workspace #end-card { padding: 6px 10px; }
  .workspace #end-card span { font-size: 13px; }
  .workspace #end-card b { font-size: 18px; }
  .mode-note { font-size: 12px; line-height: 1.5; }
}
