:root {
  --bg: #111;
  --fg: #eee;
  --muted: #888;
  --panel: #1c1c1c;
  --accent: #4fb3ff;
  --danger: #ff5a5a;
  --warn: #ffb347;
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 16px;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.4 system-ui, sans-serif;
}

header { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
h1 { font-size: 1.2rem; margin: 0 0 12px; }
h2 { font-size: 1rem; margin: 0 0 8px; color: var(--muted); }
.status { color: var(--muted); font-size: .9rem; }
.status.ok { color: var(--accent); }

main { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }

.panel { background: var(--panel); border-radius: 10px; padding: 12px; display: grid; gap: 10px; }

label { display: grid; gap: 4px; }
input[type=range] { width: 100%; }
input, select, button { font: inherit; }
select, input[type=number] { padding: 6px; background: #000; color: var(--fg); border: 1px solid #333; border-radius: 6px; }

button { padding: 12px; border: 0; border-radius: 8px; background: #333; color: var(--fg); touch-action: manipulation; }
button.big { padding: 28px; font-size: 1.2rem; }
button.active { background: var(--accent); color: #000; }
button.danger { background: var(--danger); color: #000; }

.row { display: flex; gap: 8px; align-items: end; flex-wrap: wrap; }

.muted { color: var(--muted); margin: 0; min-height: 1.4em; }
.stat { font-size: 1.4rem; font-variant-numeric: tabular-nums; }
.meter { height: 24px; background: #000; border-radius: 6px; overflow: hidden; }
.meter > div { height: 100%; width: 50%; background: var(--accent); transition: width 50ms linear; }
.stats { border-collapse: collapse; font-variant-numeric: tabular-nums; }
.stats th { text-align: left; font-weight: normal; color: var(--muted); padding: 2px 12px 2px 0; }
.stats td { text-align: right; }

/* Audience page */
body.audience { min-height: 100dvh; display: grid; grid-template-rows: 1fr auto; text-align: center; transition: background 200ms; }
body.audience main { display: flex; flex-direction: column; justify-content: center; gap: 24px; }
body.audience.lit { background: #0b3550; }
.crowd { font-size: 1.4rem; margin: 0; }
.spot { font-size: 1.6rem; color: var(--accent); margin: 0; }
.hint { color: var(--muted); margin: 0; }
/* No fill from the left edge: the slider is bipolar, so only the thumb's
   position relative to the centre mark means anything. */
.big-slider { width: 100%; height: 64px; margin: 0; appearance: none; -webkit-appearance: none; background: transparent; }
.big-slider::-webkit-slider-runnable-track { height: 8px; background: #333; border-radius: 4px; }
.big-slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 48px; height: 48px; margin-top: -20px;
  border: 0; border-radius: 50%; background: var(--accent);
}
.big-slider::-moz-range-track { height: 8px; background: #333; border-radius: 4px; }
.big-slider::-moz-range-thumb { width: 48px; height: 48px; border: 0; border-radius: 50%; background: var(--accent); }
.slider-wrap { position: relative; }
/* Centre mark: the neutral point, so the left edge doesn't read as zero. */
.slider-wrap::before {
  content: ""; position: absolute; left: 50%; top: 8px; height: 48px; width: 2px;
  background: var(--muted); transform: translateX(-50%); pointer-events: none;
}
.slider-scale { display: flex; justify-content: space-between; color: var(--muted); font-size: 1.4rem; padding: 0 8px; }

#timer { container-type: inline-size; }
.clock { font-size: clamp(3rem, 30cqi, 10rem); font-variant-numeric: tabular-nums; text-align: center; }
.clock.warn { color: var(--warn); }
.clock.over { color: var(--danger); }
