/* Shared look for every study. Dark lab-bench, one accent per meaning. */
:root {
  --bg: #0e1116;
  --panel: #151a21;
  --panel-2: #1b222b;
  --line: #2a323d;
  --text: #dfe5ec;
  --muted: #8b96a3;
  --accent: #f2b84b;   /* gold  = teacher / truth / target */
  --accent-2: #4fc3d9; /* cyan  = student / you / current estimate */
  --dx: #ff6b6b;       /* red   = x direction, ∂/∂x */
  --dy: #6b9bff;       /* blue  = y direction, ∂/∂y */
  --good: #7bd88f;
  --bad: #ff7a7a;
  --mono: ui-monospace, "JetBrains Mono", "Fira Code", monospace;
  --sans: system-ui, -apple-system, "Inter", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 14px/1.5 var(--sans); }
a { color: var(--accent-2); }
header {
  display: flex; align-items: baseline; gap: 14px; padding: 10px 16px;
  border-bottom: 1px solid var(--line); background: var(--panel);
}
header h1 { font-size: 16px; margin: 0; font-weight: 600; }
header .back { color: var(--muted); text-decoration: none; }
header .tags { color: var(--muted); font-size: 12px; margin-left: auto; }
main { display: grid; grid-template-columns: 1fr 380px; height: calc(100% - 45px); }
#stage { position: relative; min-width: 0; min-height: 0; overflow: hidden; }
#stage canvas { display: block; }
.hud {
  position: absolute; left: 12px; top: 12px; pointer-events: none;
  font: 12px/1.6 var(--mono); background: #0e1116cc; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 6px; white-space: pre;
}
.hint { position: absolute; left: 12px; bottom: 10px; color: var(--muted); font-size: 12px; pointer-events: none; }
aside { background: var(--panel); border-left: 1px solid var(--line); overflow-y: auto; padding: 12px 14px 40px; }
aside h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 4px 0 8px; }
details { border-top: 1px solid var(--line); padding: 8px 0; }
summary { cursor: pointer; font-weight: 600; color: var(--text); }
summary::marker { color: var(--muted); }
details p, details li { color: #c3ccd6; }
.math {
  font: 13px/1.7 var(--mono); background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 6px; padding: 8px 10px; margin: 6px 0; overflow-x: auto; white-space: pre;
}
pre.code { font: 12px/1.5 var(--mono); background: #0b0e12; border: 1px solid var(--line); border-radius: 6px; padding: 10px; overflow-x: auto; }
.gold { color: var(--accent); } .cyan { color: var(--accent-2); }
.red { color: var(--dx); } .blue { color: var(--dy); } .muted { color: var(--muted); }

/* knobs */
.knob { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; margin: 8px 0; }
.knob label { font-size: 13px; }
.knob .val { font: 12px var(--mono); color: var(--accent-2); }
.knob input[type=range] { grid-column: 1 / -1; width: 100%; accent-color: var(--accent-2); }
.knob select { grid-column: 1 / -1; background: var(--panel-2); color: var(--text); border: 1px solid var(--line); border-radius: 5px; padding: 4px; }
.row { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
button {
  background: var(--panel-2); color: var(--text); border: 1px solid var(--line); border-radius: 6px;
  padding: 5px 10px; cursor: pointer; font: inherit;
}
button:hover { border-color: var(--accent-2); }
button.primary { border-color: var(--accent-2); color: var(--accent-2); }
.check { display: flex; align-items: center; gap: 8px; margin: 6px 0; font-size: 13px; }
.check input { accent-color: var(--accent-2); }
canvas.plot { width: 100%; height: 130px; background: #0b0e12; border: 1px solid var(--line); border-radius: 6px; display: block; margin: 6px 0; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 4px; vertical-align: -1px; }

@media (max-width: 900px) {
  main { grid-template-columns: 1fr; grid-template-rows: 60vh auto; height: auto; }
  #stage { height: 60vh; }
  aside { border-left: 0; border-top: 1px solid var(--line); }
}
