/* Direction: a federal briefing instrument. USWDS palette and Public Sans, quiet chrome, color only
   where it carries a result (red = executed stolen command, green = refused, gold = live). One rich
   moment: the Benti zero, its ring and its per-second trace. Roboto Mono for server data only. */
:root {
  /* Federal palette from the U.S. Web Design System (USWDS): navy surfaces, base grays for text,
     USWDS red for an executed stolen command, USWDS green for a refusal, gold as the one accent. */
  --bg: #0B0F19;
  --card: #111A2B;
  --raised: #182540;
  --line: rgba(223, 225, 226, .10);
  --line-2: rgba(223, 225, 226, .18);
  --text: #F0F0F0;
  --text-2: #BCC2CA;
  --muted: #8D949E;
  --neg: #E8483B;
  --neg-tint: rgba(232, 72, 59, .10);
  --neg-line: rgba(232, 72, 59, .42);
  --pos: #00A91C;
  --pos-hi: #3FC45A;
  --pos-tint: rgba(0, 169, 28, .09);
  --pos-line: rgba(0, 169, 28, .45);
  --gold: #FFBE2E;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --sans: "Public Sans", -apple-system, "Segoe UI", Arial, sans-serif;
  --mono: "Roboto Mono", ui-monospace, Menlo, monospace;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { width: 100%; height: 100%; background: var(--bg); color: var(--text); overflow: hidden;
  font: 400 14px/20px var(--sans); -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; cursor: pointer; }
h1, h2, h3 { font-weight: 600; }
.timer, .card-num, .hero-num, .stat-value, #result-text { font-variant-numeric: tabular-nums; }
.ic { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }

/* Fixed 1920x1080 stage, scaled to fit the window */
#stage { position: absolute; left: 0; top: 0; width: 1920px; height: 1080px; transform-origin: 0 0; padding: 0 32px;
  display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: 96px 2px 72px minmax(0, 1fr) 48px; }

/* ---- Command bar ---- */
#command { display: flex; align-items: center; justify-content: space-between; gap: 32px; }
.brand-top { display: flex; align-items: center; gap: 16px; }
.phase { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; line-height: 16px; color: var(--text-2); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
body.running .dot { background: var(--gold); animation: live 1.2s var(--ease) infinite; }
body.running .phase { color: var(--text); }
body.done .dot { background: var(--pos); }
@keyframes live { 50% { opacity: .3; } }
h1 { font-size: 32px; line-height: 40px; font-weight: 700; letter-spacing: .02em; margin-top: 6px; }
.subtitle { font-size: 16px; line-height: 24px; color: var(--text-2); margin-top: 2px; }
.live-meta { display: none; }

.controls { display: flex; align-items: center; gap: 12px; }
.timer-box { text-align: right; margin-right: 12px; }
.timer { font-size: 56px; line-height: 56px; font-weight: 500; letter-spacing: -.03em; }
.timer small { font-size: 22px; font-weight: 400; color: var(--muted); margin-left: 4px; letter-spacing: 0; }
.timer-label { font-size: 12px; line-height: 16px; color: var(--muted); margin-top: 4px; }
.btn { display: inline-flex; align-items: center; gap: 10px; height: 40px; padding: 0 16px; border-radius: 10px;
  border: 1px solid var(--line-2); background: var(--raised); font-weight: 500;
  transition: background-color .15s var(--ease), border-color .15s var(--ease), opacity .15s var(--ease), transform .12s var(--ease); }
.btn:hover { background: #222736; }
.btn:active { transform: scale(.98); }
.btn:focus-visible, .switch:focus-within { outline: 2px solid var(--gold); outline-offset: 2px; }
.btn-launch { height: 56px; padding: 0 24px; background: var(--neg); border-color: var(--neg); color: #fff; font-size: 16px; font-weight: 600;
  letter-spacing: .01em; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18); }
.btn-launch:hover { background: #EE5D61; }
.btn-launch .ic { fill: currentColor; stroke: none; width: 16px; height: 16px; }
.btn-launch:disabled { background: var(--raised); border-color: var(--line-2); color: var(--muted); box-shadow: none; cursor: default; transform: none; }
.btn-secondary { height: 56px; padding: 0 20px; font-size: 15px; }
.switch { display: flex; align-items: center; gap: 16px; height: 56px; padding: 0 16px 0 20px; border-radius: 10px;
  background: var(--card); border: 1px solid var(--line-2); cursor: pointer; transition: border-color .15s var(--ease), background-color .15s var(--ease); }
.switch-text { width: 236px; font-size: 14px; line-height: 18px; font-weight: 500; color: var(--text-2); }
.toggle { position: relative; width: 52px; height: 28px; flex: none; }
.toggle input { position: absolute; opacity: 0; }
.knob { position: absolute; inset: 0; border-radius: 14px; background: #2A2F3C; transition: background-color .18s var(--ease); }
.knob::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--text);
  transition: transform .18s var(--ease); }
.toggle input:checked + .knob { background: var(--pos); }
.toggle input:checked + .knob::after { transform: translateX(24px); background: #fff; }
.switch-state { width: 28px; font-size: 15px; font-weight: 600; color: var(--muted); }
body.protect .switch { border-color: var(--pos-line); background: var(--pos-tint); }
body.protect .switch-text { color: var(--text); }
body.protect .switch-state { color: var(--pos); }
body.viewer #reset, body.viewer .switch { opacity: .4; pointer-events: none; }

.progress { background: var(--line); }
#progress-fill { height: 100%; width: 0; background: var(--muted); }
body.running #progress-fill, body.done #progress-fill { background: var(--gold); }

/* ---- Mandate ribbon: one strip, one cell per mandate ---- */
#ribbon { display: flex; align-self: center; height: 60px; min-width: 0; border: 1px solid var(--line); border-radius: 12px; background: var(--card); overflow: hidden; }
.pill { flex: 1 1 auto; min-width: 0; padding: 6px 14px; display: flex; flex-direction: column; justify-content: center; gap: 2px;
  border-left: 1px solid var(--line); transition: background-color .3s var(--ease); }
.pill:first-child { border-left: 0; }
.pill-name { font-size: 13px; line-height: 16px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pill-state { display: flex; flex-direction: column; gap: 0; font-size: 12px; line-height: 15px; color: var(--muted); white-space: nowrap; overflow: hidden; }
.pill-state span { display: inline-flex; align-items: center; gap: 6px; }
.pill-state span::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.pill-state .bad { color: var(--neg); }
.pill-state .good { color: var(--pos-hi); }
.pill.exposed { background: var(--neg-tint); }
.pill.enforced { background: var(--pos-tint); }

/* ---- Main split ---- */
main { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px; padding: 4px 0 12px; min-height: 0; }
#industry { display: flex; flex-direction: column; min-height: 0; }
.section-head { display: flex; align-items: baseline; gap: 12px; }
.section-head h2 { font-size: 20px; line-height: 28px; font-weight: 700; }
.section-sub { font-size: 14px; color: var(--muted); }

.result { display: flex; align-items: center; gap: 12px; height: 48px; margin: 8px 0 12px; padding: 0 16px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--card); color: var(--text-2); font-size: 18px; font-weight: 700; letter-spacing: .03em;
  transition: background-color .3s var(--ease), border-color .3s var(--ease); }
.result-icon { width: 20px; height: 20px; color: var(--muted); }
.result.idle .result-icon { opacity: 0; width: 0; margin-right: -12px; }
.result.breach { background: var(--neg); border-color: var(--neg); color: #fff; }
.result.breach .result-icon { color: #fff; stroke-width: 2.5; }
.result.protected { background: var(--pos); border-color: var(--pos); color: #fff; }
.result.protected .result-icon { color: #fff; stroke-width: 2.5; }

#grid { flex: 1; min-height: 0; display: grid; gap: 12px;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: repeat(5, minmax(0, 1fr)); }
.card { min-width: 0; min-height: 0; overflow: hidden; display: flex; flex-direction: column; padding: 10px 16px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--card);
  transition: background-color .4s var(--ease), border-color .4s var(--ease); transition-delay: calc(var(--i) * 45ms); }
.card-num, .card-status, .card-impact .v, .bar-fill { transition-delay: calc(var(--i) * 45ms); }
.card-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-pre { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 12px; line-height: 16px; color: var(--muted); white-space: nowrap; overflow: hidden; }
.card-status { flex: none; font-size: 12px; line-height: 16px; font-weight: 500; color: var(--muted); }
.card.breach .card-status { color: var(--neg); }
.card.protected .card-status { color: var(--pos-hi); }
.card-pre .ic { width: 14px; height: 14px; color: var(--pos); stroke-width: 2.25; }
.card-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex: none; margin-top: 6px; }
.card-info { min-width: 0; }
.card-title { font-size: 17px; line-height: 22px; font-weight: 700; letter-spacing: .03em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-sub { font-size: 12px; line-height: 16px; color: var(--text-2); margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-mand { font-size: 12px; line-height: 16px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-count { flex: none; text-align: right; }
.card-num { font-size: 32px; line-height: 34px; font-weight: 600; letter-spacing: -.01em; color: var(--text); transition: color .3s var(--ease); }
.card-of { font-size: 12px; line-height: 16px; color: var(--muted); white-space: nowrap; margin-top: 2px; }
.bar { height: 6px; background: var(--line); margin-top: auto; overflow: hidden; flex: none;
  -webkit-mask: repeating-linear-gradient(90deg, #000 0 calc(100% / 60 - 2px), transparent calc(100% / 60 - 2px) calc(100% / 60));
          mask: repeating-linear-gradient(90deg, #000 0 calc(100% / 60 - 2px), transparent calc(100% / 60 - 2px) calc(100% / 60)); }
.bar-fill { height: 100%; width: 100%; background: var(--muted); transform-origin: left; transform: scaleX(0); }
.card-impact { display: flex; gap: 8px; margin-top: 8px; font-size: 13px; line-height: 16px; flex: none; white-space: nowrap; overflow: hidden; }
.card-impact .k { color: var(--muted); flex: none; }
.card-impact .v { color: var(--text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.card.breach { background: linear-gradient(var(--neg-tint), var(--neg-tint)), var(--card); border-color: var(--neg-line); }
.card.breach .card-num, .card.breach .card-impact .v { color: var(--neg); }
.card.breach .bar-fill { background: var(--neg); }
.card.protected { background: linear-gradient(var(--pos-tint), var(--pos-tint)), var(--card); border-color: var(--pos-line); }
.card.protected .card-num { color: var(--pos); }
.card.protected .card-impact .v { color: var(--pos-hi); }
.card.protected .bar-fill { background: var(--pos); }

/* ---- Benti: the one rich moment ---- */
#benti { min-height: 0; }
.benti-card { height: 100%; display: flex; flex-direction: column; padding: 28px 32px; border-radius: 16px;
  background: var(--card); border: 1px solid var(--pos-line); }
.benti-head { display: flex; align-items: center; gap: 16px; }
.benti-mark { width: 44px; height: 44px; flex: none; fill: none; stroke: var(--pos); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.benti-head h2 { font-size: 32px; line-height: 40px; font-weight: 700; }
.benti-sub { font-size: 16px; line-height: 24px; color: var(--pos-hi); font-weight: 500; }
.benti-check { display: flex; align-items: center; gap: 8px; margin-top: 16px; font-size: 13px; line-height: 18px; color: var(--text-2); }
.benti-check .ic { width: 16px; height: 16px; color: var(--pos); stroke-width: 2.25; }

.hero { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; gap: 48px; }
.ring-wrap { position: relative; width: 300px; height: 300px; flex: none; }
#ring { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
#ring .track { fill: none; stroke: var(--line); stroke-width: 10; }
#ring .arc { fill: none; stroke: var(--pos); stroke-width: 10; stroke-linecap: round; transform: rotate(-90deg); transform-origin: 160px 160px; }
#ring .tick { stroke: var(--line-2); stroke-width: 2; stroke-linecap: round; }
#ring .tick.on { stroke: var(--pos); }
.hero-num { position: absolute; inset: 0; display: grid; place-items: center; font-size: 168px; line-height: 1; font-weight: 600;
  letter-spacing: -.04em; color: var(--pos); padding-bottom: 8px; }
.hero-side { display: flex; flex-direction: column; gap: 6px; }
.hero-label { font-size: 44px; line-height: 52px; font-weight: 700; }
.hero-of { font-size: 20px; line-height: 28px; color: var(--text-2); }
.hero-pct { font-size: 20px; line-height: 28px; color: var(--pos-hi); font-weight: 600; }

.trace { margin: 0 0 20px; }
.trace figcaption { display: flex; justify-content: space-between; font-size: 13px; line-height: 16px; color: var(--muted); margin-bottom: 8px; }
.legend { display: inline-flex; align-items: center; gap: 8px; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-left: 8px; }
.sw-pos { background: var(--pos); }
.sw-neg { background: var(--neg); height: 2px; }
#trace { display: block; width: 100%; height: 132px; border-bottom: 1px solid var(--line-2); }
#trace .bucket { fill: var(--pos); opacity: .72; }
#trace .bucket.empty { fill: var(--line); opacity: 1; }
#trace .grid { stroke: var(--line); stroke-width: 1; }
#trace .zero { stroke: var(--neg); stroke-width: 2; }
.trace-axis { display: flex; justify-content: space-between; margin-top: 6px; font: 400 12px/16px var(--mono); color: var(--muted); }

.stats { display: grid; grid-template-columns: 1.3fr 1fr 1fr; border-top: 1px solid var(--line); padding-top: 16px; }
.stat { min-width: 0; padding-right: 16px; }
.stat + .stat { padding-left: 20px; border-left: 1px solid var(--line); }
.stat-label { font-size: 13px; line-height: 16px; color: var(--muted); }
.stat-value { font-size: 30px; line-height: 36px; font-weight: 600; margin-top: 8px; white-space: nowrap; }
.stat-value small { font-size: 15px; color: var(--muted); font-weight: 400; margin-left: 8px; }
.stat-value.pos { color: var(--pos-hi); }
.stat-note { font-size: 12px; line-height: 16px; color: var(--muted); margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---- Bottom bar and proof drawer ---- */
#bottom { display: flex; align-items: center; justify-content: space-between; gap: 24px; border-top: 1px solid var(--line); }
.foot-left { display: flex; align-items: center; gap: 16px; flex: none; }
.run-proof { display: inline-flex; align-items: center; gap: 8px; font: 400 12px/16px var(--mono); color: var(--text-2); }
.run-proof[hidden] { display: none; }
.run-proof .ic { width: 16px; height: 16px; color: var(--pos); }
.btn-icon { width: 32px; padding: 0; justify-content: center; flex: none; }
.btn-quiet { height: 32px; padding: 0 12px; font-size: 13px; color: var(--text-2); background: transparent; }
.btn-quiet .ic { width: 16px; height: 16px; }
.footer-note { flex: 1; min-width: 0; max-width: 820px; font-size: 12px; line-height: 16px; color: var(--muted); text-align: right; }

.drawer { position: absolute; left: 32px; right: 32px; bottom: 52px; height: 600px; padding: 20px 24px;
  background: #0E121B; border: 1px solid var(--line-2); border-radius: 16px 16px 0 0; box-shadow: 0 -16px 48px rgba(0, 0, 0, .5); }
.drawer-grid { display: grid; grid-template-columns: 1.65fr 1fr; gap: 20px; height: 100%; }
.panel { min-height: 0; display: flex; flex-direction: column; }
.panel.side { overflow: auto; padding-right: 4px; }
.panel h3 { font-size: 15px; line-height: 20px; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.table-wrap { flex: 1; overflow: auto; border: 1px solid var(--line); border-radius: 12px; }
.telemetry table { width: 100%; border-collapse: collapse; font: 400 12px/20px var(--mono); }
.telemetry th { position: sticky; top: 0; text-align: left; padding: 8px 12px; background: #131824; color: var(--muted); font: 500 12px/16px var(--sans); border-bottom: 1px solid var(--line); }
.telemetry td { padding: 2px 12px; white-space: nowrap; color: var(--text-2); }
.telemetry tr:nth-child(even) td { background: rgba(238, 240, 245, .02); }
.telemetry td.ok { color: var(--neg); }
.telemetry td.no { color: var(--pos); }
.block { padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
.block + .block { margin-top: 12px; }
.block h3 { margin-bottom: 8px; }
.muted { font-size: 13px; line-height: 20px; color: var(--muted); }
.btn-small { height: 32px; padding: 0 12px; font-size: 13px; margin-top: 12px; border-radius: 8px; }
.btn-primary { background: var(--text); border-color: var(--text); color: #0B0F19; }
.btn-primary:hover { background: #fff; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.proof-out { font: 400 12px/18px var(--mono); color: var(--text-2); margin-top: 12px; white-space: pre-wrap; word-break: break-all; }
.proof-out:empty { display: none; }
.proof-out.code { max-height: 180px; overflow: auto; padding: 12px; border-radius: 8px; background: var(--bg); border: 1px solid var(--line); }
.vendor-list { display: flex; flex-wrap: wrap; gap: 6px; }
.vendor-list button { height: 28px; padding: 0 10px; border-radius: 6px; border: 1px solid var(--line-2); background: transparent; font-size: 12px; color: var(--text-2); }
.vendor-list button:hover { background: var(--raised); }
.vendor-list button.on { background: var(--raised); color: var(--text); border-color: var(--text-2); }
.refs { list-style: none; font-size: 13px; line-height: 20px; }
.refs li + li { margin-top: 8px; }
.refs a { color: var(--text-2); text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; }
.refs a:hover { color: var(--text); }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---- Phones in portrait: stack in reading order ---- */
@media (max-aspect-ratio: 1/1) {
  html, body { overflow: auto; }
  #stage { position: static; width: auto; height: auto; transform: none !important; display: block; padding: 16px; }
  #command { flex-direction: column; align-items: stretch; gap: 16px; padding-bottom: 16px; }
  h1 { font-size: 26px; line-height: 32px; }
  .subtitle { font-size: 14px; line-height: 20px; }
  .controls { flex-wrap: wrap; gap: 8px; }
  .timer-box { text-align: left; flex: 1; margin: 0; }
  .timer { font-size: 44px; line-height: 44px; }
  .btn-launch { flex: 1 1 100%; justify-content: center; height: 52px; font-size: 15px; }
  .btn-secondary { height: 44px; }
  .switch { flex: 1 1 100%; min-width: 0; }
  .switch-text { width: auto; flex: 1; }
  .progress { height: 2px; margin-bottom: 16px; }
  #ribbon { height: auto; flex-wrap: wrap; margin-bottom: 16px; }
  .pill { flex: 1 1 50%; border-left: 0; border-top: 1px solid var(--line); }
  main { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  #benti { order: -1; }
  .benti-card { padding: 20px; }
  .benti-head h2 { font-size: 24px; line-height: 28px; }
  .benti-sub { font-size: 14px; }
  .hero { padding: 16px 0; gap: 20px; }
  .hero-num { font-size: 140px; line-height: 120px; }
  .hero-label { font-size: 28px; line-height: 32px; }
  .hero-of, .hero-pct { font-size: 15px; line-height: 20px; }
  .stats { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .stat + .stat { padding-left: 0; border-left: 0; padding-top: 12px; border-top: 1px solid var(--line); }
  .section-head { flex-direction: column; gap: 0; }
  .result { height: auto; padding: 12px 16px; font-size: 15px; line-height: 20px; }
  #grid { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; }
  .card { min-height: 136px; }
  #bottom { flex-direction: column; align-items: flex-start; gap: 8px; padding: 16px 0; }
  .footer-note { text-align: left; }
  .drawer { position: static; height: auto; }
  .drawer-grid { grid-template-columns: minmax(0, 1fr); }
  .table-wrap { max-height: 320px; }
}
.btn[hidden] { display: none; }
.meta { display: inline-flex; align-items: center; gap: 6px; font: 400 12px/16px var(--mono); color: var(--muted); }
.meta b { color: var(--text-2); font-weight: 500; }
.meta[hidden] { display: none; }

/* Kept from the v6 pass: the per-second trace sits in its own panel, and the ring scales on phones. */
.trace{background:#0F1726;border:1px solid rgba(223, 225, 226, .12);border-radius:8px;padding:12px 16px}
@media(max-aspect-ratio:1/1){
 .ring-wrap{width:clamp(116px,38vw,240px);height:auto;aspect-ratio:1}
 .hero-num{font-size:clamp(60px,18vw,112px)}
 .hero{justify-content:flex-start;gap:16px}
 .hero-label{font-size:24px}
 .trace figcaption{flex-wrap:wrap;gap:4px}
}

/* Report key: the hash breaks at any character, and the checker downloads from the drawer. */
#report-key .hash { font-family: var(--mono); font-size: 12px; color: var(--text-2); overflow-wrap: anywhere; }
#report-key a { color: var(--text); text-decoration: underline; text-underline-offset: 2px; }

/* Phones in portrait: card text wraps instead of being cut at the right edge. */
@media (max-aspect-ratio: 1/1) {
  .card { overflow: visible; }
  .card-top { align-items: flex-start; }
  .card-pre { white-space: normal; align-items: flex-start; }
  .card-pre .ic { flex: none; margin-top: 1px; }
  .card-title, .card-sub, .card-mand { white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: anywhere; }
  .card-title { font-size: 16px; line-height: 20px; }
  .card-num { font-size: 28px; line-height: 30px; }
  .card-impact { flex-wrap: wrap; row-gap: 2px; white-space: normal; }
}
