/* Tokens first; the two series colours were run through the dataviz validator
   for both surfaces (CHANGELOG v0.1.0). Text never wears a series colour. */
:root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #6f6d68;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --border: rgba(11, 11, 11, 0.1);
  --series-rtc: #2a78d6;
  --series-ws: #eb6834;
  --accent: #2a78d6;
  --accent-ink: #ffffff;
  --danger: #c0392b;
  --waiting: #8a5a00;
  --stall: #898781;
  /* The dialog's two voices: Lyra's first two speaker colours (books/web/app.css). */
  --voice-1: #154a7c;
  --voice-2: #7f3d06;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface: #1a1a19;
    --ink: #ffffff;
    --ink-2: #c3c2b7;
    --muted: #9c9a93;
    --grid: #2c2c2a;
    --axis: #383835;
    --border: rgba(255, 255, 255, 0.1);
    --series-rtc: #3987e5;
    --series-ws: #d95926;
    --accent: #3987e5;
    --accent-ink: #ffffff;
    --danger: #e66767;
    --waiting: #e0a530;
    --stall: #898781;
    --voice-1: #79b8ec;
    --voice-2: #f0a35e;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d;
  --surface: #1a1a19;
  --ink: #ffffff;
  --ink-2: #c3c2b7;
  --muted: #9c9a93;
  --grid: #2c2c2a;
  --axis: #383835;
  --border: rgba(255, 255, 255, 0.1);
  --series-rtc: #3987e5;
  --series-ws: #d95926;
  --accent: #3987e5;
  --accent-ink: #ffffff;
  --danger: #e66767;
  --waiting: #e0a530;
  --stall: #898781;
  --voice-1: #79b8ec;
  --voice-2: #f0a35e;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--page);
  color: var(--ink);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 20px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.brand { font-weight: 650; }
nav { display: flex; flex-wrap: wrap; gap: 4px 16px; }
nav[hidden] { display: none; }
nav a { color: var(--ink-2); text-decoration: none; padding: 2px 0; }
nav a.current { color: var(--ink); border-bottom: 2px solid var(--accent); }
main { max-width: 1040px; margin: 0 auto; padding: 16px; }
footer { text-align: center; color: var(--muted); font-size: 12px; padding: 16px; }
[hidden] { display: none !important; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 20px;
}
.narrow { max-width: 420px; margin: 32px auto; display: grid; gap: 12px; }
h1 { font-size: 20px; margin: 0 0 8px; font-weight: 650; }
label { display: grid; gap: 4px; color: var(--ink-2); font-size: 14px; }
input, select {
  font: inherit;
  color: var(--ink);
  background: var(--page);
  border: 1px solid var(--axis);
  border-radius: 6px;
  padding: 8px 10px;
}
button {
  font: inherit;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--axis);
  border-radius: 6px;
  padding: 7px 14px;
  cursor: pointer;
}
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
button.danger { color: var(--danger); border-color: var(--danger); }
button.link { border: none; color: var(--ink-2); text-decoration: underline; padding: 4px 0; }
button:disabled { opacity: 0.5; cursor: default; }
a { color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.error { color: var(--danger); min-height: 1em; margin: 0; }
.badge {
  display: inline-block;
  font-size: 11px;
  padding: 1px 6px;
  margin-left: 6px;
  border-radius: 8px;
  border: 1px solid var(--border);
  color: var(--ink-2);
}
.badge.waiting { color: var(--waiting); border-color: var(--waiting); }

.controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 12px 0; }
.controls .label { flex: 1 1 14em; min-width: 0; }
/* A room's link: one tap selects all of it, and a long one wraps rather than widening the page. */
.room-link .link { user-select: all; overflow-wrap: anywhere; font-family: ui-monospace, monospace; font-size: 0.9em; }
.paths { list-style: none; padding: 0; margin: 0 0 8px; display: flex; flex-wrap: wrap; gap: 4px 24px; }
/* Calls: the devices that can be rung, and the banner a ringing call shows on
   any screen. */
.devices { list-style: none; padding: 0; margin: 8px 0; display: grid; gap: 8px; }
.devices li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.devices li > span:first-child { flex: 1 1 12em; min-width: 0; overflow-wrap: anywhere; }
.devices input { flex: 1 1 10em; min-width: 0; }
.ring {
  position: sticky; top: 0; z-index: 10;
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  padding: 12px 16px; background: var(--accent); color: var(--accent-ink);
}
.ring span { flex: 1 1 12em; font-weight: 600; }
/* A room waiting: told, not rung. */
.ring.quiet { background: var(--surface); color: var(--ink); border-bottom: 1px solid var(--border); }/* The app's update notice (app.js offerUpdate). */
.notice {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.notice span { flex: 1 1 12em; }
/* The call's routes in the app (call/ui.js), and the sound card's mode
   (call/sound.js): the one in use is pressed. */
.routes button[aria-pressed="true"], .sound button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.paths li { display: flex; align-items: center; gap: 8px; }
.status { color: var(--ink-2); font-size: 13px; }
.status[data-state="failed"], .status[data-state="the"], .status[data-state="nothing"] { color: var(--danger); }

/* ---- chart ---- */
.chart { margin-top: 12px; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 20px; color: var(--ink-2); font-size: 13px; margin-bottom: 4px; }
.legend > span { display: inline-flex; align-items: center; gap: 6px; }
.key { display: inline-block; width: 14px; height: 2px; border-radius: 1px; vertical-align: middle; }
.key-rtc { background: var(--series-rtc); }
.key-ws { background: var(--series-ws); }
.row { display: grid; grid-template-columns: 1fr; gap: 8px 16px; }
.row-split { grid-template-columns: 1fr 1fr; }
@media (max-width: 640px) {
  .row-split { grid-template-columns: 1fr; }
}
.panel { position: relative; margin: 8px 0 0; min-width: 0; }
.panel figcaption { font-size: 13px; color: var(--ink-2); }
.panel svg { display: block; width: 100%; height: auto; touch-action: pan-y; }
.panel svg:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.grid { stroke: var(--grid); stroke-width: 1; }
.axis { stroke: var(--axis); stroke-width: 1; }
.tick { fill: var(--muted); font-size: 11px; }
.line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.line.s-rtc { stroke: var(--series-rtc); }
.line.s-ws { stroke: var(--series-ws); }
.dot { stroke: var(--surface); stroke-width: 2; }
.dot.s-rtc { fill: var(--series-rtc); }
.dot.s-ws { fill: var(--series-ws); }
.cross { stroke: var(--axis); stroke-width: 1; }

/* The call screen's graphs (call/graph.js): up to three lines a panel, named in
   its caption. The third is the grey of a reference, dashed where it is a limit. */
.call-graph { margin-top: 8px; }
.call-graph .legend-item { display: inline-flex; align-items: center; gap: 4px; margin-left: 10px; }
.key.c1 { background: var(--series-rtc); }
.key.c2 { background: var(--series-ws); }
.key.c3 { background: var(--stall); }
.line.c1 { stroke: var(--series-rtc); }
.line.c2 { stroke: var(--series-ws); }
.line.c3 { stroke: var(--stall); stroke-width: 1.5; }
.line.dashed { stroke-dasharray: 4 3; }
.call-graph h3 { font-size: 15px; margin: 16px 0 0; }
/* The spectrograms: a canvas each, scaled to the card. The strip's colours are
   web/call/spectrum.js's KINDS, which draws them. */
.spectra { display: grid; gap: 4px; }
/* What was said, under each spectrogram (web/transcribe/). */
/* The call's dialog (web/call/words.js), as Lyra shows a diarized book: each
   voice's words in its colour, inline, a paragraph at each long pause. The
   shading is the owner's: grey until the listener reports, the voice's colour
   once heard, none when not heard, so the lost words stay the easiest to read.
   Italic is a draft. */
.scribe { margin: 8px 0; }
.dialog { max-height: 22em; overflow-y: auto; font-size: 15px; line-height: 1.7; }
.dialog p { margin: 0 0 0.7em; }
.voice[data-who="you"] { --voice: var(--voice-1); }
.voice[data-who="them"] { --voice: var(--voice-2); }
.voice { color: var(--voice); }
.voice.draft { font-style: italic; }
.w { border-radius: 3px; padding: 0 1px; }
.w.unknown { background: color-mix(in srgb, var(--muted) 18%, transparent); }
.w.heard { background: color-mix(in srgb, var(--voice) 18%, transparent); }
/* A typed note: in its writer's colour, set apart from speech by a rule. */
.dialog p.note { border-left: 3px solid var(--voice); padding-left: 8px; font-size: 14px; }
.note-form { display: flex; gap: 8px; margin: 8px 0; }
.note-form input { flex: 1; min-width: 0; }
.spectrogram canvas { display: block; width: 100%; height: auto; color: var(--ink-2); }
.spectrogram .legend-item { display: inline-flex; align-items: center; gap: 4px; margin-left: 10px; }
.key.k-speech { background: #3aa655; height: 6px; }
.key.k-silent { background: #7a7a7a; height: 6px; }
.key.k-rebuilt { background: #e0a030; height: 6px; }
.key.k-concealed { background: #e04848; height: 6px; }
.key.k-added { background: #4a88e0; height: 6px; }
.key.k-played { background: #3aa655; height: 6px; }
.key.k-cut { background: #7a7a7a; height: 6px; }
.key.k-dropped { background: #9a5cd0; height: 6px; }
.spectrogram .legend-line { display: block; }
.spectrogram .legend-line .legend-item:first-child { margin-left: 6px; }
#mute[aria-pressed="true"] { background: var(--danger); border-color: var(--danger); color: #ffffff; }
.ceiling { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 8px 0; }
.ceiling input { flex: 1 1 12em; min-width: 0; }
.ceiling output { min-width: 5em; font-variant-numeric: tabular-nums; }
.hidden { display: none; }
.stall { fill: var(--stall); }
.tip {
  position: absolute;
  top: 24px;
  left: calc(var(--x, 0px) + 12px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 12px;
  pointer-events: none;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}
.tip.tip-left { left: auto; right: calc(100% - var(--x, 0px) + 12px); }
.tip > div { display: flex; align-items: center; gap: 6px; }
.tip-head { color: var(--muted); }

/* ---- tables ---- */
table { border-collapse: collapse; width: 100%; margin-top: 16px; font-size: 14px; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--grid); vertical-align: top; }
thead th { color: var(--ink-2); font-weight: 550; }
caption { caption-side: bottom; text-align: left; color: var(--muted); font-size: 13px; padding-top: 8px; }
.list, .summary { display: block; overflow-x: auto; }
.list.small { font-size: 12px; }
.actions { display: flex; flex-wrap: wrap; gap: 6px; }
details { margin-top: 16px; }
.sound-log textarea { width: 100%; box-sizing: border-box; font: 12px/1.4 ui-monospace, monospace; }
h2 { font-size: 16px; margin: 24px 0 4px; font-weight: 650; }
.minted { border: 1px solid var(--accent); border-radius: 6px; padding: 8px 12px; margin-top: 12px; }
.minted code { display: block; word-break: break-all; font-size: 13px; user-select: all; }
