/* ============================================================
   Beta Governance — TIMxAI Labs
   self-contained styles. no external assets.
   ============================================================ */

:root {
  color-scheme: dark light;

  --bg:           #080a14;
  --bg-soft:      #0e1224;
  --surface:      #141a32;
  --surface-2:    #1b2244;
  --surface-3:    #232b56;
  --text:         #e8ecff;
  --text-dim:     #97a3cf;
  --text-faint:   #6b75a0;
  --border:       #232a4a;
  --border-strong:#33407a;

  --accent:       #5cf1eb;
  --accent-warm:  #b89dff;
  --accent-soft:  rgba(92, 241, 235, 0.14);

  --ok:           #6cf094;
  --warn:         #ffd066;
  --bad:          #ff6b8a;
  --neutral:      #8c98c4;

  --vela:  #5cf1eb;
  --otto:  #ffd066;
  --ren:   #6cf094;
  --iris:  #b89dff;
  --mira:  #ff6b8a;

  --shadow:       0 18px 50px -22px rgba(0,0,0,0.65);
  --shadow-soft:  0 8px 24px -14px rgba(0,0,0,0.4);

  --radius:    14px;
  --radius-sm: 8px;
  --radius-pill: 999px;

  --gap-2:  4px;
  --gap-3:  8px;
  --gap-4:  12px;
  --gap-5:  16px;
  --gap-6:  24px;
  --gap-7:  32px;
  --gap-8:  48px;

  --max:       1320px;
  --font:      ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono:      ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

/* light mode token overrides — readable, but the product was designed dark-first */
@media (prefers-color-scheme: light) {
  :root {
    --bg:           #f4f6ff;
    --bg-soft:      #ffffff;
    --surface:      #ffffff;
    --surface-2:    #eef1ff;
    --surface-3:    #e2e6ff;
    --text:         #0d1230;
    --text-dim:     #41497a;
    --text-faint:   #6b75a0;
    --border:       #d6dcf2;
    --border-strong:#a8b3dd;
    --accent-soft:  rgba(33, 113, 142, 0.10);
    --shadow:       0 12px 36px -20px rgba(20, 30, 80, 0.25);
    --shadow-soft:  0 6px 16px -12px rgba(20, 30, 80, 0.18);
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(184,157,255,0.18), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(92,241,235,0.15), transparent 60%),
    linear-gradient(180deg, var(--bg) 0%, #050610 100%);
  background-attachment: fixed;
  padding-bottom: 140px;
}

@media (prefers-color-scheme: light) {
  body {
    background:
      radial-gradient(1200px 600px at 80% -10%, rgba(184,157,255,0.12), transparent 60%),
      radial-gradient(900px 500px at -10% 110%, rgba(92,200,200,0.12), transparent 60%),
      linear-gradient(180deg, var(--bg) 0%, #ffffff 100%);
  }
}

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }
p  { margin: 0; }
code, kbd { font-family: var(--mono); font-size: 0.92em; }
button { font: inherit; }
input[type="range"] { accent-color: var(--accent); }

/* ---------- a11y helpers ---------- */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 8px;
  padding: 8px 12px;
  background: var(--accent);
  color: #001;
  border-radius: var(--radius-sm);
  z-index: 100;
  font-weight: 600;
}
.skip-link:focus { left: 12px; outline: none; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------- top bar ---------- */
.topbar {
  max-width: var(--max);
  margin: 0 auto;
  padding: 22px 24px 14px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: var(--gap-5);
}

.brand {
  display: flex; align-items: center; gap: 12px;
}
.brand-mark {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: var(--surface);
  display: grid; place-items: center;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
}
.brand-mark .brand-shackle { transition: transform 700ms cubic-bezier(.6,-0.2,.3,1.4); transform-origin: 16px 12px; }
body[data-gate="open"] .brand-shackle { transform: rotate(-26deg) translate(-3px, -2px); }
.brand-title { display: block; font-weight: 600; letter-spacing: -0.01em; }
.brand-sub { display: block; color: var(--text-dim); font-size: 12px; }

.phase-rail {
  list-style: none;
  margin: 0;
  padding: 6px;
  display: grid;
  grid-auto-flow: column;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-soft);
  justify-self: center;
}
.phase-rail li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  color: var(--text-dim);
  transition: color 200ms, background 200ms;
}
.phase-rail li .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--border-strong);
  transition: background 250ms, box-shadow 250ms, transform 250ms;
}
.phase-rail li.is-active {
  color: var(--text);
  background: var(--accent-soft);
}
.phase-rail li.is-active .dot {
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(92,241,235,0.18);
}
.phase-rail li.is-done .dot {
  background: var(--ok);
}

.gate-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font-size: 13px;
  color: var(--text-dim);
  box-shadow: var(--shadow-soft);
}
.gate-pill .gate-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--bad);
  box-shadow: 0 0 0 4px rgba(255,107,138,0.22);
  transition: background 350ms, box-shadow 350ms;
}
body[data-gate="open"] .gate-pill {
  border-color: var(--ok);
  color: var(--text);
}
body[data-gate="open"] .gate-pill .gate-dot {
  background: var(--ok);
  box-shadow: 0 0 0 4px rgba(108,240,148,0.28);
}
.gate-pill code {
  color: var(--text);
  background: var(--surface-2);
  padding: 1px 6px;
  border-radius: 4px;
}

/* ---------- intro ---------- */
.intro {
  max-width: var(--max);
  margin: 0 auto 12px;
  padding: 0 24px;
  color: var(--text-dim);
  font-size: 14px;
}
.intro > summary {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  color: var(--text);
  font-size: 12px;
  list-style: none;
}
.intro > summary::-webkit-details-marker { display: none; }
.intro > summary::before {
  content: '?';
  display: inline-grid;
  place-items: center;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
}
.intro-body {
  margin-top: 10px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 760px;
  display: grid;
  gap: 10px;
}
.intro-body code {
  background: var(--surface-2);
  padding: 1px 6px;
  border-radius: 4px;
  color: var(--text);
}

/* ---------- grid ---------- */
.grid {
  max-width: var(--max);
  margin: 16px auto 0;
  padding: 0 24px;
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(360px, 1.5fr) minmax(320px, 1.1fr);
  gap: var(--gap-5);
}
@media (max-width: 1100px) {
  .grid { grid-template-columns: 1fr 1fr; }
  .governance { grid-column: span 2; }
}
@media (max-width: 720px) {
  .grid { grid-template-columns: 1fr; }
  .governance { grid-column: auto; }
}

/* ---------- cards ---------- */
.card {
  background: linear-gradient(180deg, var(--surface) 0%, var(--bg-soft) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: var(--gap-5);
  box-shadow: var(--shadow);
  min-height: 360px;
}
.card-h {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}
.card-h h2 {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
}
.card-sub {
  font-size: 12px;
  color: var(--text-faint);
}

/* ---------- testers ---------- */
.tester-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}
.tester {
  position: relative;
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-faint);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: default;
  user-select: none;
  transition: transform 180ms ease, background 200ms, border-color 200ms, color 200ms;
}
.tester[data-status="consented"] {
  background: linear-gradient(160deg, rgba(92,241,235,0.12), var(--surface-2));
  border-color: rgba(92,241,235,0.35);
  color: var(--text);
}
.tester[data-status="active"] {
  background: linear-gradient(160deg, rgba(92,241,235,0.22), var(--surface-3));
  border-color: rgba(92,241,235,0.55);
  color: var(--text);
}
.tester[data-status="dropped"] {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text-faint);
  opacity: 0.55;
  text-decoration: line-through;
  text-decoration-color: rgba(255,107,138,0.55);
}
.tester::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 12px;
  border: 2px solid var(--accent);
  opacity: 0;
  transform: scale(0.9);
  pointer-events: none;
}
.tester.is-pulse::after {
  animation: pulse 600ms ease-out;
}
@keyframes pulse {
  0%   { opacity: 0.9; transform: scale(0.9); }
  60%  { opacity: 0.35; transform: scale(1.15); }
  100% { opacity: 0; transform: scale(1.25); }
}

.legend {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 11px;
  color: var(--text-dim);
  margin: 0;
}
.lg {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.lg::before {
  content: "";
  width: 8px; height: 8px; border-radius: 2px;
  background: currentColor;
  opacity: 0.85;
}
.lg-invited   { color: var(--text-faint); }
.lg-consented { color: var(--accent); }
.lg-active    { color: var(--accent-warm); }
.lg-dropped   { color: var(--bad); }

/* ---------- stream ---------- */
.kpis {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.kpi {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.kpi-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-faint);
}
.kpi-val {
  font-family: var(--mono);
  font-size: 16px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.kpi-val[data-trend="ok"]   { color: var(--ok); }
.kpi-val[data-trend="warn"] { color: var(--warn); }
.kpi-val[data-trend="bad"]  { color: var(--bad); }

.feed {
  list-style: none;
  margin: 0;
  padding: 12px 0 0;
  flex: 1;
  min-height: 200px;
  max-height: 360px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-top: 1px dashed var(--border);
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}
.feed:focus-visible {
  outline-offset: -2px;
}
.feed-item {
  display: grid;
  grid-template-columns: 56px 70px 1fr;
  gap: 8px;
  align-items: baseline;
  padding: 8px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  animation: feed-in 320ms ease both;
}
.feed-item[data-kind="feedback"] { border-left: 3px solid var(--accent-warm); }
.feed-item[data-kind="telemetry"] { border-left: 3px solid var(--accent); }
.feed-item[data-kind="error"]    { border-left: 3px solid var(--warn); }
.feed-item[data-kind="crash"]    { border-left: 3px solid var(--bad); }
.feed-item[data-kind="consent"]  { border-left: 3px solid var(--ok); }
.feed-item[data-kind="drop"]     { border-left: 3px solid var(--text-faint); opacity: 0.85; }
.feed-item[data-kind="system"]   { border-left: 3px solid var(--neutral); color: var(--text-dim); font-style: italic; }
.feed-time {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-faint);
}
.feed-kind {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
}
.feed-who {
  display: none;
}
.feed-body {
  grid-column: 3;
  color: var(--text);
}
.feed-body .who {
  color: var(--text-dim);
  font-weight: 600;
  margin-right: 6px;
}
@keyframes feed-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------- governance ---------- */
.quorum { display: grid; gap: 8px; }
.quorum-track {
  position: relative;
  height: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  overflow: hidden;
}
.quorum-fill {
  position: absolute;
  inset: 0;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-warm));
  transition: width 380ms cubic-bezier(.2,.7,.2,1);
}
.quorum-marks span {
  position: absolute;
  top: 0; bottom: 0;
  width: 1px;
  background: rgba(255,255,255,0.18);
}
.quorum-text {
  font-size: 12px;
  color: var(--text-dim);
}
.quorum-text #quorum-pct {
  color: var(--text);
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

.council {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
.steward {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
  width: 100%;
  transition: border-color 200ms, background 200ms, transform 120ms;
}
.steward:hover { border-color: var(--border-strong); }
.steward:active { transform: translateY(1px); }
.steward.is-selected {
  border-color: var(--accent);
  background: linear-gradient(180deg, var(--accent-soft), var(--surface-2));
}
.steward.is-pulse {
  animation: steward-shift 700ms ease;
}
@keyframes steward-shift {
  0% { box-shadow: 0 0 0 0 currentColor; }
  50% { box-shadow: 0 0 0 4px rgba(184,157,255,0.18); }
  100% { box-shadow: 0 0 0 0 transparent; }
}

.avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  display: grid; place-items: center;
  color: #0a0d18;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 14px;
  position: relative;
  box-shadow: inset 0 0 0 2px rgba(0,0,0,0.06);
}
.avatar[data-id="vela"] { background: radial-gradient(circle at 30% 25%, #b6fefb, var(--vela) 70%); }
.avatar[data-id="otto"] { background: radial-gradient(circle at 30% 25%, #fff1c1, var(--otto) 70%); }
.avatar[data-id="ren"]  { background: radial-gradient(circle at 30% 25%, #c6f9d3, var(--ren) 70%); }
.avatar[data-id="iris"] { background: radial-gradient(circle at 30% 25%, #e0d2ff, var(--iris) 70%); }
.avatar[data-id="mira"] { background: radial-gradient(circle at 30% 25%, #ffcad6, var(--mira) 70%); }

.steward-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.steward-name { font-weight: 600; }
.steward-role {
  font-size: 11px;
  color: var(--text-dim);
  text-overflow: ellipsis; overflow: hidden; white-space: nowrap;
}

.stance {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-weight: 600;
  letter-spacing: 0.02em;
  border: 1px solid var(--border-strong);
  color: var(--text-dim);
  background: var(--surface);
  white-space: nowrap;
}
.stance[data-stance="unknown"]  { color: var(--text-faint); }
.stance[data-stance="lean-yes"] { color: var(--ok);    border-color: rgba(108,240,148,0.4); }
.stance[data-stance="lean-no"]  { color: var(--warn);  border-color: rgba(255,208,102,0.45); }
.stance[data-stance="yes"]      { color: #062a14; background: var(--ok);   border-color: var(--ok); }
.stance[data-stance="no"]       { color: #2a0612; background: var(--bad);  border-color: var(--bad); }

/* ---------- ceremony ---------- */
.ceremony {
  border-top: 1px dashed var(--border);
  padding-top: 14px;
  display: grid;
  gap: 10px;
}
.tally { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.tally li {
  display: grid;
  grid-template-columns: 24px 1fr auto;
  align-items: baseline;
  gap: 10px;
  padding: 8px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  animation: feed-in 280ms ease both;
  font-size: 13px;
}
.tally .t-mark {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--surface);
  display: grid; place-items: center;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
}
.tally li[data-vote="yes"] .t-mark { background: var(--ok); color: #062a14; }
.tally li[data-vote="no"]  .t-mark { background: var(--bad); color: #2a0612; }
.tally .t-who { color: var(--text); font-weight: 600; }
.tally .t-why { color: var(--text-dim); font-size: 12px; grid-column: 2 / -1; }

.verdict {
  padding: 14px 16px;
  border-radius: var(--radius);
  font-weight: 600;
  text-align: center;
  font-family: var(--mono);
  font-size: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
}
.verdict[data-result="pass"] {
  border-color: var(--ok);
  background: linear-gradient(180deg, rgba(108,240,148,0.18), var(--surface));
  color: var(--ok);
}
.verdict[data-result="fail"] {
  border-color: var(--bad);
  background: linear-gradient(180deg, rgba(255,107,138,0.16), var(--surface));
  color: var(--bad);
}
.ceremony-actions {
  display: flex; gap: 8px; flex-wrap: wrap;
  padding-top: 4px;
}

/* ---------- standout (steward reasoning panel) ---------- */
.standout {
  max-width: var(--max);
  margin: 24px auto 0;
  padding: 0 24px;
}
.standout-h { margin-bottom: 12px; }
.steward-panel {
  background: linear-gradient(180deg, var(--surface) 0%, var(--bg-soft) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  min-height: 220px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 18px;
}
.steward-empty {
  color: var(--text-faint);
  text-align: center;
  margin: 32px 0;
  font-size: 13px;
}
.sp-head {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 18px;
  align-items: center;
}
.sp-avatar { width: 64px; height: 64px; font-size: 20px; }
.sp-name {
  display: flex; flex-direction: column; gap: 4px;
}
.sp-name strong { font-size: 18px; letter-spacing: -0.01em; }
.sp-name span { color: var(--text-dim); font-size: 13px; }

.sp-stance {
  font-size: 12px;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  font-weight: 600;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-dim);
}

.sp-reasoning {
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  padding: 14px 16px;
  background: var(--surface-2);
  border-left: 3px solid currentColor;
  border-radius: var(--radius-sm);
}

.sp-concerns {
  display: grid;
  gap: 6px;
}
.sp-concerns h3 {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-dim);
  margin-bottom: 4px;
}
.sp-concern {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
}
.sp-concern .ic {
  width: 18px; height: 18px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-faint);
}
.sp-concern[data-met="true"] .ic { background: var(--ok); color: #062a14; border-color: var(--ok); }
.sp-concern[data-met="false"] .ic { background: var(--bad); color: #2a0612; border-color: var(--bad); }
.sp-concern .target {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-dim);
}
.sp-flip {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px dashed var(--border-strong);
  font-size: 13px;
  color: var(--text-dim);
}
.sp-flip strong { color: var(--text); }

/* ---------- control deck ---------- */
.deck {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  width: min(1100px, calc(100% - 32px));
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 12px 16px;
  box-shadow: 0 24px 60px -28px rgba(0,0,0,0.7);
  backdrop-filter: blur(10px);
}
.deck-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--surface-3);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: background 160ms, border-color 160ms, transform 80ms;
}
.btn:hover  { background: var(--surface-2); border-color: var(--accent); }
.btn:active { transform: translateY(1px); }
.btn.primary {
  background: var(--accent);
  color: #0a0d18;
  border-color: var(--accent);
}
.btn.primary:hover {
  background: #80f8f2;
  color: #04060c;
}
.btn[aria-pressed="true"] .btn-ic { content: "▮▮"; }
.btn[aria-pressed="true"] .btn-ic::before { content: "▮▮"; }
.btn[aria-pressed="true"] .btn-ic { font-size: 0; }
.btn[aria-pressed="true"] .btn-ic::before { font-size: 13px; letter-spacing: -1px; }

.control {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px;
  color: var(--text-dim);
}
.control.wide { min-width: 160px; }
.control label {
  white-space: nowrap;
}
.control input[type="range"] { width: 110px; }
.control input[type="text"] {
  font-family: var(--mono);
  background: var(--bg-soft);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  width: 130px;
  font-size: 12px;
}
.control input[type="text"]:focus-visible {
  border-color: var(--accent);
  outline-offset: 0;
}
.control-val {
  font-family: var(--mono);
  color: var(--text);
  min-width: 60px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.control.toggle label {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.control input[type="checkbox"] { accent-color: var(--accent); width: 14px; height: 14px; }

/* ---------- footer ---------- */
.legal {
  max-width: var(--max);
  margin: 36px auto 0;
  padding: 0 24px 24px;
  text-align: center;
  font-size: 12px;
  color: var(--text-faint);
}

/* ---------- confetti ---------- */
.confetti {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 50;
}
.confetto {
  position: absolute;
  width: 8px; height: 14px;
  border-radius: 2px;
  top: -20px;
  animation: confetto-fall var(--dur, 2.2s) cubic-bezier(.2,.6,.2,1) forwards;
}
@keyframes confetto-fall {
  0%   { transform: translate3d(0, -10vh, 0) rotate(0deg);   opacity: 1; }
  100% { transform: translate3d(var(--dx, 40px), 110vh, 0) rotate(720deg); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .confetto { display: none; }
}

/* ---------- responsive control deck ---------- */
@media (max-width: 720px) {
  .topbar { grid-template-columns: 1fr; padding-bottom: 4px; }
  .phase-rail { order: 3; justify-self: stretch; overflow-x: auto; }
  .phase-rail li { font-size: 11px; padding: 6px 10px; }
  .gate-pill { justify-self: start; font-size: 11px; }
  .gate-pill code { font-size: 10px; }
  .deck { padding: 10px 12px; bottom: 8px; width: calc(100% - 16px); }
  .deck-row { gap: 8px; }
  .control input[type="range"] { width: 84px; }
  .tester-grid { grid-template-columns: repeat(6, 1fr); }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  body { padding-bottom: 220px; }
}

/* hide system feed-who, accessible label exposed via aria-label only */
