:root {
  color-scheme: dark;
  --bg: #1a1a1e;
  --card: #25252c;
  --text: #e8e8ec;
  --muted: #9a9aa3;
  --accent: #6ea8fe;
  --border: #3a3a44;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
  padding: 1rem 1.5rem 2rem;
  max-width: 960px;
}
body.spectator-page {
  max-width: 1100px;
}
body.operator-page {
  max-width: 960px;
}
body.editor-page {
  max-width: 1100px;
}
.hero h1 { margin: 0.25rem 0 0.75rem; font-size: 1.85rem; line-height: 1.2; }
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.75rem;
  color: #95d5b2;
  margin: 0;
}
.lead { color: var(--muted); max-width: 42rem; margin: 0 0 1rem; }
.lead code { color: #c9d1d9; }
.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.stat {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.85rem 1rem;
}
.stat-label { display: block; color: var(--muted); font-size: 0.8rem; }
.stat-value { font-size: 1.25rem; font-weight: 600; }
.how-list { margin: 0; padding-left: 1.25rem; color: var(--muted); }
.how-list li { margin: 0.35rem 0; }
.scenario-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  gap: 0.5rem;
}
.scenario-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  min-height: 4rem;
}
.scenario-label { font-weight: 600; }
.scenario-meta { color: var(--muted); font-size: 0.8rem; margin-top: 0.25rem; }
.feed-wrap { max-height: 420px; }
.decision-pill {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}
.decision-allow { background: rgba(126, 231, 135, 0.15); color: #7ee787; }
.decision-block { background: rgba(255, 123, 114, 0.15); color: #ff7b72; }
.decision-warn { background: rgba(255, 166, 87, 0.15); color: #ffa657; }
.empty-row { color: var(--muted); text-align: center; }
.muted-inline { font-weight: normal; color: var(--muted); font-size: 0.85rem; }
header h1 { margin: 0 0 0.25rem; font-size: 1.5rem; }
.sub { color: var(--muted); margin: 0 0 0.5rem; }
.demo-banner {
  background: #1e3a2f;
  border: 1px solid #2d6a4f;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}
.demo-banner strong { color: #95d5b2; }
.demo-meta { color: var(--muted); }
.nav { display: flex; gap: 1rem; margin-bottom: 1rem; font-size: 0.9rem; }
.nav a { color: var(--accent); text-decoration: none; }
.hint { color: var(--muted); font-size: 0.85rem; margin: 0 0 0.75rem; }
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
}
h2 { margin: 0 0 0.75rem; font-size: 1.1rem; }
dl { display: grid; grid-template-columns: 8rem 1fr; gap: 0.35rem 0.75rem; margin: 0 0 0.75rem; }
dt { color: var(--muted); }
dd { margin: 0; word-break: break-all; font-family: ui-monospace, monospace; font-size: 0.85rem; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.grid label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.85rem; color: var(--muted); }
.grid label.wide { grid-column: 1 / -1; }
input, select {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.45rem 0.55rem;
  border-radius: 4px;
  font: inherit;
}
.flags { display: flex; flex-wrap: wrap; gap: 0.75rem 1.25rem; margin: 0.75rem 0; font-size: 0.9rem; }
.actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.5rem; }
button {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.45rem 0.85rem;
  border-radius: 4px;
  cursor: pointer;
}
button.primary { background: var(--accent); color: #111; border-color: var(--accent); font-weight: 600; }
button:hover { filter: brightness(1.08); }
.status { color: var(--muted); font-size: 0.9rem; margin: 0.75rem 0 0; }
.log-card pre {
  background: #121216;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.75rem;
  max-height: 320px;
  overflow: auto;
  font-size: 0.8rem;
  margin: 0;
  white-space: pre-wrap;
}
#decisions { font-weight: normal; color: var(--muted); font-size: 0.85rem; }
.split-card { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.table-wrap { overflow: auto; max-height: 360px; border: 1px solid var(--border); border-radius: 4px; }
table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
th, td { padding: 0.4rem 0.5rem; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
th { position: sticky; top: 0; background: #121216; color: var(--muted); }
tbody tr { cursor: pointer; }
tbody tr:hover { background: rgba(255,255,255,0.03); }
.standing { font-weight: 600; margin: 0 0 0.5rem; }
.standing.ok { color: #7ee787; }
.standing.warn { color: #ffa657; }
.standing.bad { color: #ff7b72; }
.standing.muted { color: var(--muted); font-weight: normal; }
.status.muted { color: var(--muted); }
button.danger { border-color: #ff7b72; color: #ff7b72; }
@media (max-width: 900px) {
  .split-card { grid-template-columns: 1fr; }
  .editor-layout { grid-template-columns: 1fr; }
}
.editor-layout {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 1rem;
  margin-bottom: 1rem;
}
.editor-panel { margin-bottom: 0; min-height: 280px; }
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.panel-head h2 { margin: 0; }
.actions.compact button { padding: 0.35rem 0.55rem; font-size: 0.85rem; }
.event-list, .stmt-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 4px;
  max-height: 240px;
  overflow: auto;
}
.event-list li, .stmt-list li {
  padding: 0.45rem 0.65rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  font-family: ui-monospace, monospace;
  font-size: 0.85rem;
}
.event-list li.selected, .stmt-list li.selected {
  background: rgba(110, 168, 254, 0.15);
  color: var(--accent);
}
.stmt-editor {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}
.stmt-editor h3 { margin: 0 0 0.5rem; font-size: 0.95rem; }
.cond-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  margin-bottom: 0.35rem;
}
.cond-row input, .cond-row select { font-size: 0.85rem; }
.cond-row .cond-left { min-width: 8rem; flex: 1; }
.cond-row .cond-right { width: 5rem; }
.if-branches { margin-top: 0.5rem; }
.nle-preview {
  width: 100%;
  min-height: 220px;
  background: #121216;
  border: 1px solid var(--border);
  color: var(--text);
  font-family: ui-monospace, monospace;
  font-size: 0.8rem;
  padding: 0.65rem;
  border-radius: 4px;
  resize: vertical;
}
.eval-result {
  margin-top: 0.75rem;
  padding: 0.75rem;
  border-radius: 4px;
  border: 1px solid var(--border);
  white-space: pre-wrap;
  font-weight: 600;
}
.eval-allow { background: rgba(126, 231, 135, 0.12); color: #7ee787; }
.eval-block { background: rgba(255, 123, 114, 0.12); color: #ff7b72; }
textarea#eval-props {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: ui-monospace, monospace;
  font-size: 0.85rem;
  padding: 0.45rem;
  border-radius: 4px;
  width: 100%;
}
