:root { --bg: #0d1117; --panel: #161b22; --panel2: #1c2128; --line: #30363d; --text: #e6edf3; --muted: #8b949e; --accent: #58a6ff; --accent2: #1f6feb; --warn: #ff6b6b; }
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { display: flex; flex-direction: column; height: 100dvh; background: var(--bg); color: var(--text);
  font: 14px/1.45 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; overflow: hidden; }
header { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.brand { font-size: 15px; } .spacer { flex: 1; } .muted { color: var(--muted); } .small { font-size: 12px; } .warn { color: var(--warn); }
button, select { background: var(--panel2); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 8px 14px; font: inherit; cursor: pointer; min-height: 40px; }
button:hover { border-color: var(--muted); } button.primary { background: var(--accent2); border-color: var(--accent); }
button.big { width: 100%; font-size: 16px; padding: 12px; margin: 14px 0 8px; }
main { position: relative; flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr auto; grid-template-rows: 1fr auto; }
#stage { grid-column: 1; grid-row: 1; position: relative; min-height: 0; }
#stage canvas { width: 100%; height: 100%; display: block; }
#hud { position: absolute; top: 10px; left: 12px; font: 12px ui-monospace, monospace; background: rgba(13,17,23,0.7); padding: 5px 9px; border-radius: 8px; pointer-events: none; }
#labPanel, #mlpPanel { grid-column: 2; grid-row: 1 / span 2; width: 320px; overflow-y: auto; background: var(--panel); border-left: 1px solid var(--line); padding: 10px 14px; }
.panel-title { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 650; margin: 10px 0 6px; }
.btns { display: flex; gap: 6px; flex-wrap: wrap; }
#stepResult { margin: 8px 0; min-height: 2.6em; } #analytic { margin-top: 6px; }
.group { border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; margin: 6px 0; background: var(--panel2); }
.group-title { font-size: 12px; color: var(--muted); }
.slider { display: grid; grid-template-columns: 64px 1fr 58px; align-items: center; gap: 8px; margin: 4px 0; }
.slider input { width: 100%; accent-color: var(--accent); height: 28px; }
.slider output { text-align: right; font: 12px ui-monospace, monospace; }
#plots { grid-column: 1; grid-row: 2; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 6px; background: var(--panel); border-top: 1px solid var(--line); }
#plots canvas { width: 100%; height: 120px; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; }
body.no-plots #plots { display: none; }
.hidden { display: none !important; }
#menu { position: fixed; inset: 0; z-index: 20; background: rgba(1,4,9,0.82); display: flex; justify-content: center; align-items: flex-start; overflow-y: auto; padding: 24px 12px; }
.menu-inner { width: min(640px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; }
.menu-inner h1 { margin: 0 0 4px; font-size: 22px; } .menu-inner h2 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em; margin: 16px 0 8px; color: var(--muted); }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.card { display: flex; flex-direction: column; gap: 4px; text-align: left; padding: 12px; border-radius: 10px; }
.card span { color: var(--muted); font-size: 12.5px; } .card.on { border-color: var(--accent); background: rgba(31,111,235,0.15); }
.row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; } .row select { flex: 1; }
#designBox .slider { grid-template-columns: 130px 1fr 150px; }
.derived { font-size: 12px; color: var(--muted); margin-top: 6px; }
/* touch sticks: shown on touch screens, in free flight */
#sticks { position: absolute; inset: auto 0 0 0; height: 0; }
.stick { position: absolute; bottom: 18px; width: 128px; height: 128px; border-radius: 50%; border: 2px solid rgba(230,237,243,0.25); background: rgba(22,27,34,0.45); touch-action: none; display: none; }
.stick-left { left: 18px; } .stick-right { right: 18px; }
.knob { position: absolute; left: 39px; top: 39px; width: 50px; height: 50px; border-radius: 50%; background: rgba(88,166,255,0.6); pointer-events: none; }
@media (pointer: coarse) { body[data-mode="free"] .stick, body[data-mode="mlp"] .stick { display: block; } }
.check { display: flex; align-items: center; gap: 8px; margin: 8px 0; min-height: 32px; } .check input { width: 18px; height: 18px; accent-color: var(--accent); }
#mlpBox .small { margin: 6px 0; }
@media (max-width: 820px) {
  main { grid-template-columns: 1fr; grid-template-rows: minmax(40dvh, 1fr) auto auto; }
  #labPanel, #mlpPanel { grid-column: 1; grid-row: 3; width: auto; max-height: 30dvh; border-left: none; border-top: 1px solid var(--line); }
  #plots { grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; } #plots canvas { height: 70px; }
  #modeName { display: none; }
  body[data-mode="free"] #plots { display: none; }
  header button { padding: 6px 10px; }
}
.netshape { font: 12px ui-monospace, monospace; background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; margin: 4px 0 8px; }
.netshape .fixed { color: var(--muted); border: 1px dashed var(--line); border-radius: 4px; padding: 0 4px; }
.mono { font-family: ui-monospace, monospace; } #mlpOut { margin: 8px 0; min-height: 3em; overflow-wrap: anywhere; }
#mlpBox .row { margin: 4px 0; } #mlpBox .check.small { margin: 2px 0; min-height: 26px; }
#learnStats { margin: 6px 0; min-height: 2.6em; overflow-wrap: anywhere; } .learn-btns { margin: 8px 0 4px; } button:disabled { opacity: 0.5; cursor: default; }
