/* Laberampel web. Brand magenta oklch(0.52 0.12 345) = #984979 (DEVELOPMENT_PLAN.md §38; the
   owner's cross-project colour system, BRANDING.md). Every token below is derived at hue 345 by
   tools/brand_palette.py -- regenerate with that, never nudge one value. oklch() is written
   directly, as the system asks; the hex after each is the fallback for anything that cannot parse
   it. Light first, dark under prefers-color-scheme. Sized to be read from a beamer: large
   figures, high contrast, nothing that depends on hover. */
:root {
  color-scheme: light dark;
  --brand: #984979;            --brand: oklch(0.52 0.12 345);
  --primary: #984979;          --primary: oklch(0.52 0.12 345);
  --on-primary: #FFFFFF;
  --primary-container: #FEE7F3; --primary-container: oklch(0.95 0.03 345);
  --on-primary-container: #400B2E; --on-primary-container: oklch(0.26 0.09 345);
  --secondary: #78616E;        --secondary: oklch(0.52 0.035 345);
  --secondary-container: #F2E3EB; --secondary-container: oklch(0.93 0.02 345);
  --bg: #FDF9FB;               --bg: oklch(0.985 0.006 345);
  --surface: #FFFFFF;
  --surface-2: #FCEDF5;        --surface-2: oklch(0.96 0.02 345);
  --on-surface: #25151E;       --on-surface: oklch(0.22 0.03 345);
  --muted: #6C5F66;            --muted: oklch(0.50 0.02 345);
  --outline: #CDB6C2;          --outline: oklch(0.80 0.03 345);
  --danger: #B3261E;
  --track: rgba(152, 73, 121, 0.14);
  --focus: #0072B2;
  --radius: 14px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --primary: #E48EBF;        --primary: oklch(0.75 0.12 345);
    --on-primary: #42062F;     --on-primary: oklch(0.26 0.10 345);
    --primary-container: #66294E; --primary-container: oklch(0.38 0.10 345);
    --on-primary-container: #FEE7F3; --on-primary-container: oklch(0.95 0.03 345);
    --secondary: #CDB6C2;      --secondary: oklch(0.80 0.03 345);
    --secondary-container: #5A4751; --secondary-container: oklch(0.42 0.03 345);
    --bg: #170D12;             --bg: oklch(0.175 0.02 345);
    --surface: #261820;        --surface: oklch(0.23 0.025 345);
    --surface-2: #34232C;      --surface-2: oklch(0.28 0.03 345);
    --on-surface: #EFE0E8;     --on-surface: oklch(0.92 0.02 345);
    --muted: #B5A6AE;          --muted: oklch(0.74 0.02 345);
    --outline: #5A4751;        --outline: oklch(0.42 0.03 345);
    --track: rgba(228, 142, 191, 0.18);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--on-surface);
  line-height: 1.4;
  min-height: 100vh;
  font-size: 17px;
}
a { color: var(--primary); }
button, select, input { font: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 16px; background: var(--brand); color: #fff;
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-weight: 700; font-size: 1.15rem; }
.brand img { width: 30px; height: 30px; }
.status { display: flex; align-items: center; gap: 8px; margin-left: 4px; flex: 1; min-width: 140px; }
.dot { width: 14px; height: 14px; border-radius: 50%; background: #B5A6AE; display: inline-block; transition: transform 120ms, background 120ms; }
.dot.listening { background: #E48EBF; }
.dot.speech { background: #F0E442; animation: pulse 900ms ease-in-out infinite; }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.45); } }
@media (prefers-reduced-motion: reduce) { .dot.speech { animation: none; transform: scale(1.3); } }
.toolbar { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.toolbar button, .toolbar a.button, .toolbar select {
  background: rgba(255,255,255,0.12); color: #fff; border: 1px solid rgba(255,255,255,0.3);
  border-radius: 10px; padding: 7px 11px; cursor: pointer; text-decoration: none; font-size: 0.95rem;
}
.toolbar button[aria-pressed="true"] { background: rgba(255,255,255,0.32); }
.toolbar select option { color: #000; }

main { max-width: 980px; margin: 0 auto; padding: 18px 16px 40px; }
footer { max-width: 980px; margin: 0 auto; padding: 0 16px 24px; color: var(--muted); font-size: 0.95rem; }

h1 { font-size: 1.6rem; margin: 0 0 4px; }
h2 { font-size: 1.15rem; margin: 22px 0 6px; }
.hint { color: var(--muted); margin: 0 0 8px; }
.notice { background: var(--surface-2); border-radius: var(--radius); padding: 10px 14px; margin: 10px 0; }
.notice.error { background: color-mix(in srgb, var(--danger) 14%, var(--surface)); }
.notice.warn { border: 2px solid #F0E442; font-weight: 600; }

/* ---------- chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 4px; }
.chip {
  border: 2px solid var(--outline); background: var(--surface); color: var(--on-surface);
  border-radius: 999px; padding: 9px 16px; cursor: pointer; font-size: 1.05rem; min-width: 52px;
}
.chip[aria-checked="true"], .chip[aria-pressed="true"] { background: var(--primary-container); border-color: var(--primary); color: var(--on-primary-container); font-weight: 700; }
.chip:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- enrolment tiles ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; margin-top: 8px; }
.tile { display: grid; grid-template-columns: 22px 1fr auto auto; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--outline); border-radius: var(--radius); padding: 8px 10px; }
.tile .swatch { width: 22px; height: 22px; border-radius: 50%; background: var(--c, #999); }
.tile input { min-width: 0; border: 1px solid var(--outline); border-radius: 8px; padding: 7px 8px; background: var(--bg); color: var(--on-surface); }
.tile .mic, .tile .clear { border: 1px solid var(--outline); background: var(--surface-2); color: var(--on-surface); border-radius: 50%; width: 40px; height: 40px; cursor: pointer; font-size: 1.1rem; }
.tile .mic.done { background: var(--primary-container); border-color: var(--primary); }
.tile .mic.recording { background: #F0E442; color: #000; animation: pulse 900ms ease-in-out infinite; }
.tile .tile-status { grid-column: 1 / -1; font-size: 0.9rem; color: var(--muted); min-height: 1.2em; }

/* ---------- microphone ---------- */
.mic-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.mic-row select { flex: 1; min-width: 220px; padding: 9px 10px; border-radius: 10px; border: 1px solid var(--outline); background: var(--surface); color: var(--on-surface); }

/* ---------- primary actions ---------- */
.actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 20px; }
.btn { border: 0; border-radius: 12px; padding: 14px 26px; font-size: 1.15rem; font-weight: 700; cursor: pointer; background: var(--surface-2); color: var(--on-surface); }
.btn.primary { background: var(--primary); color: var(--on-primary); }
.btn.danger { background: var(--danger); color: #fff; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* ---------- session ---------- */
.elapsed { font-variant-numeric: tabular-nums; font-size: 3.2rem; font-weight: 700; line-height: 1; margin: 6px 0 0; letter-spacing: 0.02em; }
.elapsed-caption { color: var(--muted); margin: 2px 0 14px; }
.rows { display: flex; flex-direction: column; gap: 10px; }
.row {
  background: var(--surface); border: 2px solid transparent; border-radius: var(--radius); padding: 12px 14px;
  display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center;
}
.row.current { border-color: var(--c); box-shadow: 0 0 0 2px color-mix(in srgb, var(--c) 40%, transparent); }
.row .name { font-size: 1.25rem; font-weight: 700; background: none; border: 0; color: inherit; text-align: left; padding: 0; cursor: pointer; display: flex; align-items: center; gap: 10px; }
.row .name .swatch { width: 16px; height: 16px; border-radius: 50%; background: var(--c); flex: none; }
.row .figures { font-variant-numeric: tabular-nums; font-size: 1.25rem; font-weight: 700; }
.row .bar { grid-column: 1 / -1; height: 18px; border-radius: 9px; background: var(--track); overflow: hidden; }
.row .bar > div { height: 100%; width: 0; background: var(--c); border-radius: 9px; transition: width 400ms ease-out; }
.row .sub { grid-column: 1 / -1; color: var(--muted); font-size: 0.95rem; display: flex; gap: 14px; flex-wrap: wrap; }
.row .row-hint { grid-column: 1 / -1; font-size: 0.95rem; color: var(--on-primary-container); background: var(--primary-container); border-radius: 8px; padding: 4px 8px; }
.placeholder { color: var(--muted); font-style: italic; padding: 12px 0; }
.placeholder-hint { display: flex; align-items: center; gap: 8px; font-size: 0.95rem; color: var(--muted); margin: -4px 0 12px; }
.placeholder-hint .dot.small { width: 10px; height: 10px; flex: none; }
.placeholder-hint.warn { color: var(--danger); font-weight: 600; }
.subtle { color: var(--muted); font-size: 0.95rem; }

/* ---------- ring ---------- */
.ring-wrap { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.ring-wrap canvas { width: min(70vw, 360px); height: min(70vw, 360px); }
.legend { display: flex; flex-wrap: wrap; gap: 8px 18px; justify-content: center; }
.legend .item { display: flex; align-items: center; gap: 8px; font-size: 1.05rem; }
.legend .swatch { width: 16px; height: 16px; border-radius: 50%; background: var(--c); }
.legend .item.current { font-weight: 700; }

/* ---------- level meter ---------- */
.level { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.meter { width: 100%; max-width: 640px; height: 64px; border-radius: 14px; background: var(--track); position: relative; overflow: hidden; }
.meter .fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--band, #2E7D32); transition: width 120ms linear, background 200ms; }
.meter .line { position: absolute; top: 0; bottom: 0; width: 4px; background: var(--on-surface); left: 70%; }
.meter .line-6 { position: absolute; top: 0; bottom: 0; width: 2px; background: color-mix(in srgb, var(--on-surface) 50%, transparent); left: 60%; }
.band-label { font-size: 2.2rem; font-weight: 800; }
.band-label.BELOW { color: #2E7D32; }
.band-label.NEAR { color: #B37A00; }
.band-label.ABOVE { color: #C62828; }
@media (prefers-color-scheme: dark) { .band-label.BELOW { color: #6FD38A; } .band-label.NEAR { color: #F9A825; } .band-label.ABOVE { color: #FF6B6B; } }

/* ---------- dialogs ---------- */
dialog { border: 0; border-radius: 16px; padding: 0; background: var(--surface); color: var(--on-surface); max-width: min(92vw, 560px); width: 100%; }
dialog::backdrop { background: rgba(0,0,0,0.45); }
.dialog-body { padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; }
.dialog-body h2 { margin: 0; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; }
fieldset { border: 1px solid var(--outline); border-radius: 10px; padding: 8px 12px 10px; margin: 0; }
legend { padding: 0 6px; font-weight: 700; }
label.opt { display: flex; gap: 10px; align-items: flex-start; padding: 6px 0; cursor: pointer; }
label.opt input { margin-top: 4px; }
.range-row { display: flex; align-items: center; gap: 12px; }
.range-row input[type="range"] { flex: 1; }
.range-row output { font-variant-numeric: tabular-nums; min-width: 3.5em; text-align: right; font-weight: 700; }
input[type="text"], input[type="number"] { border: 1px solid var(--outline); border-radius: 8px; padding: 9px 10px; background: var(--bg); color: var(--on-surface); width: 100%; }
.colour-grid { display: grid; grid-template-columns: repeat(4, 48px); gap: 12px; justify-content: center; }
.colour-grid button { width: 48px; height: 48px; border-radius: 50%; border: 3px solid transparent; background: var(--c); cursor: pointer; font-size: 1.3rem; }
.colour-grid button[aria-pressed="true"] { border-color: var(--on-surface); }

/* ---------- dimming (keep-screen-on companion, §29.4 W3) ---------- */
body.dimmed main, body.dimmed .topbar, body.dimmed footer { opacity: 0.45; transition: opacity 800ms; }

/* ---------- big screen (§34.7) ---------- */
body.bigscreen { background: #000; color: #fff; }
body.bigscreen .topbar, body.bigscreen footer, body.bigscreen .actions, body.bigscreen .setup-only { display: none !important; }
body.bigscreen main { max-width: none; padding: 3vh 4vw; }
body.bigscreen .elapsed { font-size: 9vh; }
body.bigscreen .elapsed-caption { font-size: 2.6vh; color: #ccc; }
body.bigscreen .row { background: #111; padding: 2vh 2.5vw; }
body.bigscreen .row .name, body.bigscreen .row .figures { font-size: 4.4vh; }
body.bigscreen .row .bar { height: 3.6vh; }
body.bigscreen .row .sub { font-size: 2.4vh; color: #ccc; }
body.bigscreen .row .row-hint { font-size: 2.2vh; }
body.bigscreen .ring-wrap canvas { width: min(60vw, 72vh); height: min(60vw, 72vh); }
body.bigscreen .legend .item { font-size: 3.4vh; }
body.bigscreen .meter { height: 14vh; max-width: none; }
body.bigscreen .band-label { font-size: 9vh; }
body.bigscreen .placeholder { font-size: 4vh; }
body.bigscreen .bigscreen-hint { position: fixed; right: 1.5vw; bottom: 1vh; font-size: 1.8vh; color: #777; }
.bigscreen-hint { display: none; }
body.bigscreen .bigscreen-hint { display: block; }

/* ---------- For the room page ---------- */
.room { max-width: 760px; margin: 0 auto; padding: 24px 20px 60px; font-size: 1.35rem; }
.room h1 { font-size: 2.2rem; }
.room p { margin: 0 0 1.1em; }
