/* AI Fly Brain: only what is particular to this page. Shared layout, type and
   colour live in /css/lab.css.

   page.js reads a few custom properties to draw with. The charts sit on white
   sheets, so --line/--dim/--accent are paper colours; the neuron view sits on a
   pale plate, so --dot is a faint ink. */
:root {
  --line: #e5ded1;
  --dim: #737b83;
  --accent: #8a5a2b;
  --g0: #2f8a7c;            /* odour in */
  --g1: #b86a26;            /* central brain */
  --g2: #9c7b12;            /* descending out */
  --c3: #7d67ad; --c4: #b9577a; --c5: #4a86b8; --c6: #6f9440;
  --dot: rgba(32, 43, 51, .13);
}

/* ------------------------------------------------------------ live stage -- */
.stage { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 20px; align-items: start; }
@media (max-width: 920px) { .stage { grid-template-columns: 1fr; } }
.brainwrap { min-height: 420px; }
#brain { position: absolute; inset: 0; width: 100%; height: 100%; }
.nowbox { position: absolute; left: 16px; top: 12px; }
.now { font: 600 44px/1 var(--f-mono); }
.now.you { color: var(--g0); } .now.fly { color: var(--g1); }
.nowlab { font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--plate-dim); margin-top: 4px; }
.count { position: absolute; right: 16px; top: 14px; text-align: right; }
.count b { display: block; font: 600 22px var(--f-mono); color: var(--plate-ink); font-variant-numeric: tabular-nums; }
.count span { font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--plate-dim); }

.side { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.msgs { min-height: 190px; max-height: 300px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px;
  padding-bottom: 12px; border-bottom: 1px solid var(--rule); }
.msg { padding: 8px 12px; border-radius: 3px; max-width: 94%; word-break: break-word; font-size: 13.5px; }
.msg i { display: block; font-style: normal; font-size: 10px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 2px; }
.msg .txt { font-family: var(--f-mono); color: var(--ink); }
.msg.you { align-self: flex-end; background: var(--paper-2); }
.msg.fly { align-self: flex-start; border-left: 2px solid var(--g1); padding-left: 10px; border-radius: 0; }
.msg.fly.live .txt::after { content: "▍"; color: var(--g1); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { font: 12px var(--f-mono); padding: 5px 9px; border-radius: 3px; border: 1px solid var(--rule);
  background: var(--paper); color: var(--ink-2); cursor: pointer; text-align: left; }
.chips button:hover { border-color: var(--bronze); color: var(--ink); }
#form { display: flex; gap: 8px; }
#inp { flex: 1; min-width: 0; font-family: var(--f-mono); font-size: 13px; }
.opts { display: grid; gap: 8px; font-size: 12px; color: var(--muted); }
.opts label { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.opts select { font-size: 12px; padding: 4px 6px; max-width: 190px; }
.opts input[type=range] { width: 150px; }
.guess .row { display: grid; grid-template-columns: 18px 1fr 36px; gap: 8px; align-items: center; font-size: 12px; margin: 3px 0; }
.guess .row span:first-child { font-family: var(--f-mono); color: var(--ink); }
.guess .t { height: 6px; background: var(--paper-2); border-radius: 1px; overflow: hidden; }
.guess .t i { display: block; height: 100%; background: var(--g1); }
.guess span:last-child { text-align: right; color: var(--muted); font-family: var(--f-mono); font-size: 11px; }

/* ------------------------------------------------------ results, charts -- */
.tasks td:first-child { color: var(--ink); }
.tasks td.ex { font-family: var(--f-mono); font-size: 12px; color: var(--muted); }
.tasks .dim { color: var(--muted); }
.bar { display: inline-block; width: 64px; height: 5px; background: var(--paper-2); margin-right: 8px;
  vertical-align: middle; overflow: hidden; }
.bar b { display: block; height: 100%; background: var(--bronze); }
.bar.base b { background: var(--rule-2); }
.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 20px; margin-bottom: 20px; }
canvas#loss, canvas#curve { width: 100%; height: 200px; display: block; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 11.5px; color: var(--muted); margin-top: 10px; }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; }
.tmrow { display: flex; gap: 14px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.tmrow input { flex: 1; min-width: 180px; }
.tmrow span { font-size: 12px; color: var(--muted); white-space: nowrap; }
.probes div { font-size: 13px; padding: 5px 0; border-bottom: 1px dotted var(--rule); word-break: break-word; }
.probes .q { color: var(--muted); }
.probes b { color: var(--ink); font-weight: 600; }

.lab-list { margin: 0; padding: 0; list-style: none; max-width: 76ch; counter-reset: n; }
.lab-list li { position: relative; padding: 10px 0 10px 34px; border-bottom: 1px solid var(--rule); }
.lab-list li::before { counter-increment: n; content: counter(n, decimal-leading-zero);
  position: absolute; left: 0; top: 12px; font: 11px var(--f-mono); color: var(--bronze); }

/* --------------------------------------------- training status indicator -- */
.livebar { display: inline-flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 12.5px; color: var(--muted); }
.livebar .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--rule-2); flex: none; }
.livebar.live { color: var(--ink-2); }
.livebar.live .dot { background: var(--sig-in); box-shadow: 0 0 0 3px rgba(79, 174, 158, .18); animation: beat 1.8s infinite; }
@keyframes beat { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .livebar.live .dot { animation: none; } }
