:root {
  --bg: #f7f8fa;
  --panel: #ffffff;
  --text: #1f2a36;
  --muted: #5b6673;
  --line: #d9dee5;
  --trace: #1f2a36;
  --seizure: rgba(255, 170, 80, 0.35);
  --alarm: #d9480f;
  --accent: #2b6cb0;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1419;
    --panel: #161d24;
    --text: #dfe6ee;
    --muted: #97a3b0;
    --line: #2a343e;
    --trace: #cfd8e3;
    --seizure: rgba(255, 150, 60, 0.28);
    --alarm: #ff6b3d;
    --accent: #6aa9f0;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

header, main, footer { max-width: 1100px; margin: 0 auto; padding: 0 16px; }
header { padding-top: 20px; }
h1 { margin: 0 0 6px; font-size: 24px; }
header p, .note, footer { color: var(--muted); }

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 12px 0;
}

select, button {
  font: inherit;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--text);
}

button { cursor: pointer; }
button:hover { border-color: var(--accent); }
button:focus-visible, select:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
button[aria-pressed="true"] { background: var(--accent); color: #fff; border-color: var(--accent); }
.rate { display: flex; gap: 2px; }
.status { font-weight: 600; }
.status.alarm { color: var(--alarm); }

canvas {
  display: block;
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
}

#eeg { height: 560px; }
#score { height: 90px; margin-top: 6px; }
#scrub { width: 100%; margin: 8px 0 0; }
footer { padding-bottom: 24px; font-size: 13px; }
footer a { color: var(--accent); }

@media (max-width: 700px) {
  #eeg { height: 460px; }
}
