/* Dark only. app.js sets --background, --panel, --border, --text and --link from palette.json's "chrome" once it has
   fetched it. Every hex below is a copy of a value in zero2fsd/palette.py (the five chrome colours from CHROME;
   --error and --ok are QUANTITY's perception and delta) and exists only for the first paint before that fetch.
   tests/playground/test_app_css.py pins each one to the palette. */
:root {
  color-scheme: dark;
  --background: #090d16;
  --panel: #0d1117;
  --border: #30363d;
  --text: #c9d1d9;
  --link: #58a6ff;
  --error: #FC6255;
  --ok: #83C167;
  --sans: Inter, system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 12px 16px 24px;
  background: var(--background);
  color: var(--text);
  font: 15px/1.5 var(--sans);
}

a { color: var(--link); }

header h1 { margin: 0 0 4px; font-size: 1.1rem; }
header p { margin: 0 0 4px; }
nav { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 0.9rem; }
nav a { padding: 6px 0; } /* 24 px tall at least: a touch target */

main { display: grid; gap: 16px; margin-top: 12px; }
@media (min-width: 720px) {
  main { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
}
section { min-width: 0; }
[hidden] { display: none !important; }

button, select, input { font: inherit; }
button, select {
  min-height: 36px;
  padding: 4px 12px;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
}
button:not(:disabled) { cursor: pointer; }
button:not(:disabled):hover { border-color: var(--link); }
button:disabled { opacity: 0.45; }
#run:not(:disabled) { border-color: var(--ok); }

#editor { border: 1px solid var(--border); border-radius: 6px; overflow: hidden; background: var(--panel); }
#editor .cm-editor { max-height: 24rem; font-size: 13px; }
#editor .cm-scroller { overflow: auto; font-family: var(--mono); }
#editor-note { margin: 0; padding: 4px 8px; font-size: 0.8rem; border-bottom: 1px solid var(--border); }
#editor-fallback {
  display: block;
  width: 100%;
  min-height: 14rem;
  padding: 8px;
  color: var(--text);
  background: var(--panel);
  border: 0;
  font: 13px/1.5 var(--mono);
  resize: vertical;
}

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 8px 0; }
.toolbar label { margin-left: auto; }

#status { margin: 8px 0 0; padding: 6px 10px; border-left: 3px solid var(--border); background: var(--panel); overflow-wrap: anywhere; }
#status[data-state="running"] { border-left-color: var(--link); }
#status[data-state="done"], #status[data-state="ready"] { border-left-color: var(--ok); }
#status[data-state="error"] { border-left-color: var(--error); }
.status-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-top: 8px; }

pre { margin: 8px 0 0; padding: 8px; overflow-x: auto; background: var(--panel); border: 1px solid var(--border); border-radius: 6px; font: 12px/1.5 var(--mono); }
pre:empty { display: none; }
#stdout { white-space: pre-wrap; overflow-wrap: anywhere; } /* a long error sentence wraps instead of hiding behind a scroll */
details { margin-top: 8px; }

#verdict { margin-top: 8px; padding: 6px 10px; background: var(--panel); border-left: 3px solid var(--error); }
#verdict[data-passed="true"] { border-left-color: var(--ok); }
#verdict ul { margin: 0; padding-left: 1.2em; }
#verdict li { overflow-wrap: anywhere; }

#stats { display: grid; grid-template-columns: max-content 1fr; gap: 2px 16px; margin: 8px 0 0; font-family: var(--mono); }
#stats dd { margin: 0; }

canvas { display: block; width: 100%; background: var(--panel); border: 1px solid var(--border); border-radius: 6px; }
#canvas { aspect-ratio: 4 / 3; }
#strips { height: 180px; margin-top: 8px; }
/* The camera picture; an image exercise shows its masks in a second canvas beside it. */
.camera { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 8px; margin-top: 8px; }
#frame, #mask { aspect-ratio: 16 / 9; image-rendering: pixelated; }

.transport { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
.transport input[type="range"] { flex: 1 1 120px; min-width: 0; }

.readouts { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 4px 12px; margin: 8px 0 0; }
.readouts dt { font-size: 0.75rem; opacity: 0.7; }
.readouts dd { margin: 0; font-family: var(--mono); }
#run-hint { margin: 8px 0 0; font-size: 0.85rem; opacity: 0.7; }

.dashboard { margin-top: 8px; }
#dashboard-error { margin: 8px 0 0; padding: 6px 10px; border-left: 3px solid var(--error); background: var(--panel); overflow-wrap: anywhere; }
#dashboard-img { display: block; width: 100%; margin-top: 8px; border-radius: 6px; }

footer { margin-top: 16px; font-size: 0.75rem; opacity: 0.6; }
footer p { margin: 0; }
