:root {
  --bg: #16110d;
  --panel: #221a14;
  --line: #3a2e24;
  --text: #f6ece0;
  --muted: #b3a291;
  --red: #e5372b;
  --red-dim: #4a1d17;
  --gold: #f2b84b;
  --green: #5fbf7f;
  --radius: 14px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: radial-gradient(ellipse at top, #2c1f15 0%, var(--bg) 60%) fixed, var(--bg);
  color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  -webkit-text-size-adjust: 100%;
}

main {
  max-width: 640px;
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) 16px 48px;
}

header { text-align: center; padding: 8px 0 16px; }

h1 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.6rem, 6vw, 2.2rem);
  margin: 14px 0 2px;
  letter-spacing: 0.01em;
}

.tag { margin: 0; color: var(--muted); font-style: italic; }

.onair {
  display: inline-block;
  padding: 6px 18px;
  border: 2px solid var(--red-dim);
  border-radius: 8px;
  color: var(--red-dim);
  font-weight: 800;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  font-size: 0.85rem;
  transition: all 0.2s;
}
.onair.on {
  color: #fff;
  background: var(--red);
  border-color: var(--red);
  box-shadow: 0 0 24px rgba(229, 55, 43, 0.7);
  animation: glow 2.4s ease-in-out infinite;
}
.onair.paused { color: var(--gold); border-color: var(--gold); background: transparent; box-shadow: none; animation: none; }
@keyframes glow { 50% { box-shadow: 0 0 10px rgba(229, 55, 43, 0.4); } }

.banner {
  background: #4a1d17;
  border: 1px solid var(--red);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 16px;
  overflow-wrap: anywhere;
}

.stage { text-align: center; }

button {
  font: inherit;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 16px;
  cursor: pointer;
  touch-action: manipulation;
}
button:active { transform: scale(0.98); }
button:disabled { opacity: 0.5; cursor: default; }
button.primary { background: var(--gold); color: #1d140c; border-color: var(--gold); font-weight: 700; }
button.ghost { background: transparent; }
button.small { padding: 4px 10px; font-size: 0.85rem; }

button.big {
  display: block;
  width: 100%;
  padding: 26px 16px;
  font-size: 1.6rem;
  font-weight: 800;
  border-radius: 20px;
  letter-spacing: 0.02em;
}
.roll { background: var(--red); border-color: var(--red); color: #fff; box-shadow: 0 8px 30px rgba(229, 55, 43, 0.35); }
.mute { background: #2d241c; }
.mute.on { background: var(--gold); border-color: var(--gold); color: #1d140c; }
.live-controls { display: grid; gap: 10px; }
.wrap { width: 100%; padding: 14px; font-weight: 700; }

.status { color: var(--muted); min-height: 3em; margin: 14px 0 8px; }
.status.cut { color: var(--gold); font-weight: 700; }

.heard { margin: 12px 0 0; font-size: 0.95rem; color: var(--muted); min-height: 1.4em; }
.heard q { color: var(--text); font-style: italic; }
.heard .tag-state { font-size: 0.8rem; margin-left: 6px; }
.heard .thinking { color: var(--gold); }
.heard .react { color: var(--green); }
.say { display: flex; gap: 8px; margin-top: 12px; }
#codeRow { margin: 0 0 12px; }
.notice { margin: 12px 0 0; }
.say input { flex: 1; min-width: 0; padding: 12px; }
.say button { flex: none; }

.meter {height: 6px; background: var(--panel); border-radius: 3px; overflow: hidden; }
#meterFill { height: 100%; width: 0; background: var(--green); transition: width 60ms linear; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-top: 18px;
}
.panel h2 { font-size: 1.05rem; margin: 0; }
.test-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 10px 0; }
.row button { flex: 1; }

blockquote {
  font-family: Georgia, serif;
  font-size: 1.35rem;
  margin: 12px 0;
  padding: 14px;
  border-left: 4px solid var(--gold);
  background: #1a140f;
  border-radius: 8px;
}

.summary { margin: 8px 0; }
.summary .pass { color: var(--green); font-weight: 700; }
.summary .fail { color: var(--red); font-weight: 700; }

table { width: 100%; border-collapse: collapse; font-size: 0.85rem; margin: 8px 0; }
th, td { text-align: left; padding: 6px 4px; border-bottom: 1px solid var(--line); vertical-align: top; }
td:nth-child(2) { color: var(--muted); }
tr.current td { background: #2c2219; }
.ok { color: var(--green); }
.bad { color: var(--red); }

.log { list-style: none; padding: 0; margin: 8px 0 0; max-height: 360px; overflow: auto; }
.log li { padding: 8px 0; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: auto 1fr auto; gap: 2px 10px; }
.log .when { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 0.85rem; }
.log .what { font-weight: 700; }
.log .lat { font-variant-numeric: tabular-nums; font-size: 0.85rem; }
.log .why { grid-column: 2 / 4; color: var(--muted); font-size: 0.85rem; }
.log .suppressed .what { color: var(--muted); font-weight: 400; text-decoration: line-through; }
.log .spoke .what { color: var(--red); }

.settings summary { cursor: pointer; font-weight: 700; }
.settings label { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 12px 0; }
.settings label.check { justify-content: flex-start; }
.settings input[type="text"], .settings select { flex: 1; min-width: 0; max-width: 60%; }
input, select { font: inherit; color: var(--text); background: #1a140f; border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; }
input[type="number"] { width: 4.5em; }
input[type="range"] { flex: 1; max-width: 60%; }
.debug { margin-top: 12px; }
.debug pre { max-height: 200px; overflow: auto; font-size: 0.75rem; color: var(--muted); white-space: pre-wrap; }
