/* Live Interpreter: OLED-dark, restrained cyan. Technical first; calm enough for church. */
:root {
  --bg: #000;
  --surface: #071015;
  --surface-2: #0b1820;
  --line: #16303c;
  --line-strong: #23516a;
  --text: #dcebf2;
  --muted: #7d98a6;
  --accent: #5fd4ff;
  --accent-soft: rgba(95, 212, 255, 0.12);
  --ok: #52e3a4;
  --warn: #ffc857;
  --bad: #ff6b7a;
  --radius: 14px;
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
/* `hidden` must win over layout classes such as .stack / .row (display: grid / flex). */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', system-ui, sans-serif;
  padding: max(12px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}
main { max-width: 760px; margin: 0 auto; }
a { color: var(--accent); }
h1 { font-size: 1.35rem; font-weight: 650; letter-spacing: 0.01em; margin: 6px 0 4px; }
h2 { font-size: 0.82rem; font-weight: 650; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); margin: 0 0 10px; }
h3 { font-size: 0.95rem; margin: 14px 0 6px; }
p { margin: 6px 0; }
small, .muted { color: var(--muted); }
code, .mono { font-family: var(--mono); font-size: 0.85em; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--accent); box-shadow: 0 0 12px rgba(95, 212, 255, 0.35) inset; }
.nav a { color: var(--muted); text-decoration: none; font-size: 0.9rem; margin-left: 12px; }

.card {
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin: 12px 0;
}
.notice { border-color: var(--line-strong); background: var(--accent-soft); font-size: 0.92rem; }
.warning { border-color: var(--warn); background: rgba(255, 200, 87, 0.08); }
.danger { border-color: var(--bad); background: rgba(255, 107, 122, 0.08); }

.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.stack { display: grid; gap: 8px; }
label { font-size: 0.9rem; color: var(--muted); display: grid; gap: 4px; }
label.inline { display: flex; align-items: center; gap: 8px; color: var(--text); }

button, select, input[type='text'], input[type='password'], textarea {
  font: inherit;
  color: var(--text);
  background: #08141a;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 10px 12px;
  min-height: 44px;
}
select { width: 100%; }
textarea { width: 100%; min-height: 120px; font-family: var(--mono); font-size: 12px; }
button { cursor: pointer; font-weight: 600; touch-action: manipulation; }
button:disabled { opacity: 0.4; cursor: default; }
button.primary { background: #0d3445; border-color: var(--accent); color: #eafaff; }
button.big { min-height: 56px; padding: 14px 22px; font-size: 1.05rem; flex: 1 1 160px; }
button.stop { border-color: var(--bad); background: #2a0d12; color: #ffe3e6; }
button.attention { border-color: var(--warn); background: #2f2508; color: #fff2cc; animation: pulse 1.6s ease-in-out infinite; }
input[type='checkbox'] { width: 22px; height: 22px; accent-color: var(--accent); }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line-strong); font-size: 0.8rem; color: var(--muted); white-space: nowrap; }
.pill::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.pill[data-state='ok']::before { background: var(--ok); }
.pill[data-state='warn']::before { background: var(--warn); }
.pill[data-state='bad']::before { background: var(--bad); }
.pill[data-state='active']::before { background: var(--accent); box-shadow: 0 0 8px var(--accent); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.metric { background: #050c10; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; min-width: 0; }
.metric .k { font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.metric .v { font-family: var(--mono); font-size: 0.95rem; overflow-wrap: anywhere; }
.metric[data-state='ok'] .v { color: var(--ok); }
.metric[data-state='warn'] .v { color: var(--warn); }
.metric[data-state='bad'] .v { color: var(--bad); }

.meter { height: 10px; background: #061015; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; position: relative; }
.meter > .fill { position: absolute; inset: 0 auto 0 0; width: 0; background: linear-gradient(90deg, #1b6f8f, var(--accent)); }
.meter > .mark { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--warn); left: 0; }

table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
th, td { text-align: left; padding: 6px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; }
td.num { font-family: var(--mono); }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.captions { min-height: 4.5em; font-size: 1.25rem; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.captions.source { font-size: 1rem; color: var(--muted); min-height: 3em; }
.log { max-height: 260px; overflow-y: auto; font-family: var(--mono); font-size: 11.5px; color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere; }
.log .entry { padding: 2px 0; border-bottom: 1px dashed #0f2229; }
.countdown { font-family: var(--mono); font-size: 2rem; color: var(--accent); text-align: center; }

details > summary { cursor: pointer; color: var(--muted); padding: 6px 0; }
details.card > summary { list-style: none; display: flex; align-items: center; gap: 8px; padding: 0; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary::before { content: 'â–¸'; color: var(--accent); }
details.card[open] > summary::before { content: 'â–¾'; }
details.card > summary h2 { margin: 0; }
details.card[open] > summary { margin-bottom: 10px; }
#health { margin-top: 10px; }
.trial { border-color: var(--line-strong); }
.trial h4 { margin: 12px 0 4px; font-size: 0.85rem; color: var(--muted); font-weight: 600; }
.checks { list-style: none; padding: 0; margin: 8px 0; display: grid; gap: 6px; }
.checks li { padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); background: #050c10; font-size: 0.92rem; }
.checks li small { display: block; color: var(--muted); margin-top: 2px; }
.checks li[data-status='fail'] { border-color: var(--bad); }
.checks li[data-status='warn'] { border-color: var(--warn); }
.checks li[data-status='pass'] { border-color: #1f5a44; }
.transcript { max-height: 11em; overflow-y: auto; white-space: pre-wrap; overflow-wrap: anywhere; background: #050c10; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 0.95rem; line-height: 1.45; }
.transcript.empty { color: var(--muted); font-style: italic; }
.trial audio { width: 100%; margin: 4px 0; }
.trial td.num { white-space: nowrap; }
.trial tr[data-status='not-in-captions'] td { color: var(--bad); }
.trial tr[data-status='partly-in-captions'] td { color: var(--warn); }
.trial tr[data-status='omitted'] td, .trial tr[data-status='not-spoken'] td, .trial tr[data-status='not-captured'] td { color: var(--bad); }
.trial tr[data-status='incomplete'] td { color: var(--warn); }
input[type='text'] { width: 100%; }
input[type='number'] { font: inherit; color: var(--text); background: #08141a; border: 1px solid var(--line-strong); border-radius: 8px; padding: 6px 8px; width: 5em; }
td input[type='text'] { min-height: 36px; padding: 6px 8px; min-width: 8em; }
td select { min-height: 36px; padding: 4px 6px; }
.orb { width: 64px; height: 64px; border-radius: 50%; border: 1px solid var(--line-strong); background: radial-gradient(circle at 50% 45%, rgba(95, 212, 255, 0.35), rgba(95, 212, 255, 0.02) 65%); flex: none; }
.orb[data-state='listening'], .orb[data-state='interpreting'] { animation: breathe 3.2s ease-in-out infinite; border-color: var(--accent); }
.orb[data-state='error'] { background: radial-gradient(circle, rgba(255, 107, 122, 0.4), transparent 65%); border-color: var(--bad); }
.orb[data-state='reconnecting'] { background: radial-gradient(circle, rgba(255, 200, 87, 0.35), transparent 65%); border-color: var(--warn); }

@keyframes breathe { 0%, 100% { transform: scale(1); opacity: 0.85; } 50% { transform: scale(1.06); opacity: 1; } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.6; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---- Church pressure test ---- */
.church-timer { font-family: var(--mono); font-size: 3.2rem; font-weight: 600; text-align: center; letter-spacing: 0.02em; }
#church-after .verdict { font-weight: 600; font-size: 1.05rem; }
.chart-figure { margin: 10px 0; }
.chart-figure figcaption { font-size: 0.9rem; }
svg.chart { width: 100%; height: auto; display: block; }
svg.chart text { fill: var(--muted); font-size: 12px; } svg.chart text.empty { font-size: 14px; }
svg.chart .ax { stroke: var(--muted); }
svg.chart .grid { stroke: var(--line); }
svg.chart .line { fill: none; stroke-width: 2; }
svg.chart path.s0 { stroke: #5fd4ff; } svg.chart path.s1 { stroke: #ffa45c; } svg.chart path.s2 { stroke: #52e3a4; }
svg.chart circle.s0 { fill: #5fd4ff; } svg.chart circle.s1 { fill: #ffa45c; } svg.chart circle.s2 { fill: #52e3a4; }
svg.chart .c0 { fill: #3a8fd6; } svg.chart .c1 { fill: #6f8494; } svg.chart .c2 { fill: #a77bd1; } svg.chart .c3 { fill: #2a3a44; } svg.chart .c4 { fill: #c97a73; }
svg.chart .sev-info { fill: #7d98a6; } svg.chart .sev-low { fill: #5b8fc7; } svg.chart .sev-medium { fill: #ffc857; } svg.chart .sev-high { fill: #ff8a5c; } svg.chart .sev-critical { fill: #ff4d5e; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 0.8rem; color: var(--muted); }
.legend .key { display: inline-block; width: 11px; height: 11px; border-radius: 2px; margin-right: 4px; vertical-align: -1px; }
.key.s0 { background: #5fd4ff; } .key.s1 { background: #ffa45c; } .key.s2 { background: #52e3a4; }
.key.c0 { background: #3a8fd6; } .key.c1 { background: #6f8494; } .key.c2 { background: #a77bd1; } .key.c3 { background: #2a3a44; } .key.c4 { background: #c97a73; }
.key.sev-info { background: #7d98a6; } .key.sev-low { background: #5b8fc7; } .key.sev-medium { background: #ffc857; } .key.sev-high { background: #ff8a5c; } .key.sev-critical { background: #ff4d5e; }
details.incident { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: #050c10; }
details.incident[data-severity='high'] summary, details.incident[data-severity='critical'] summary { color: var(--bad); }
details.incident[data-severity='medium'] summary { color: var(--warn); }
details.incident ul.evidence { margin: 4px 0; padding-left: 18px; font-family: var(--mono); font-size: 0.82rem; }
.row.history span { flex: 1 1 200px; }
