/* qp-vpp demo dashboard — Qrypt portal-inspired theme
   Palette mirrors portal.qrypt.com:
   - Brand navy   #171629   (sourced directly from Qrypt portal CSS)
   - Surface     #242335
   - Brand green #41D478   (Qrypt signature accent)
   - Cyan accent #22d3ee
   Typography: system font stack (Inter when present locally, otherwise the
   platform default sans). No third-party fonts are bundled — the Aeonik
   typeface used by the public Qrypt portal is licensed (CT Type) and is
   intentionally not shipped here. */

:root {
  --bg: #0f0e1d;
  --bg-2: #171629;          /* Qrypt brand navy */
  --panel: #1d1c30;
  --panel-2: #242335;       /* Qrypt portal surface */
  --panel-hi: #2d2c44;
  --line: #34334a;
  --line-soft: #2a2940;
  --fg: #F1F1F1;
  --fg-dim: #D2D2D5;
  --muted: #94949B;
  --accent: #41D478;        /* Qrypt brand green */
  --accent-soft: rgba(65, 212, 120, 0.15);
  --accent-2: #22d3ee;      /* portal cyan */
  --accent-2-soft: rgba(34, 211, 238, 0.15);
  --indigo: #6366F1;
  --danger: #f43f5e;
  --warn: #fbbf24;
  --ok: #41D478;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background:
    radial-gradient(1200px 600px at 85% -10%, rgba(99, 102, 241, 0.08), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(34, 211, 238, 0.06), transparent 60%),
    var(--bg);
  color: var(--fg);
  font: 15px/1.5 "Inter", -apple-system, "SF Pro Text", "Segoe UI", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  letter-spacing: 0.005em;
}
.bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 28px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--line-soft);
  box-shadow: 0 1px 0 rgba(255,255,255,0.02);
}
.bar h1 { font-size: 20px; margin: 0; font-weight: 600; letter-spacing: -0.01em; display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 26px; height: 26px; color: var(--accent); flex: 0 0 auto; filter: drop-shadow(0 0 6px rgba(65,212,120,0.4)); }
.brand-mark svg { width: 100%; height: 100%; display: block; }
.brand-divider { width: 1px; height: 20px; background: var(--line); margin: 0 4px; }
.partner-badge { display: inline-flex; align-items: center; gap: 8px; margin-left: 12px; padding: 4px 10px 4px 12px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,0.02); }
.partner-label { font-size: 11px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.partner-logo { height: 18px; width: auto; display: block; filter: brightness(0) invert(1) opacity(0.9); }
.muted { color: var(--muted); font-weight: 400; }
.bar-right { display: flex; gap: 28px; align-items: center; }
.metric { text-align: right; }
.metric-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); font-weight: 500; }
.metric-value { font-size: 22px; font-weight: 600; color: var(--accent); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }

.pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 14px; border-radius: 9999px; background: var(--panel-2);
  border: 1px solid var(--line); font-size: 13px; font-weight: 500;
  color: var(--fg-dim);
}
.pill-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.pill[data-state="ok"]   .pill-dot { background: var(--ok); box-shadow: 0 0 10px var(--ok); }
.pill[data-state="ok"]   { border-color: rgba(65,212,120,0.35); color: var(--accent); background: var(--accent-soft); }
.pill[data-state="down"] .pill-dot { background: var(--danger); box-shadow: 0 0 10px var(--danger); }
.pill[data-state="down"] { border-color: rgba(244,63,94,0.4); color: #fda4af; background: rgba(244,63,94,0.08); }
.mode-pill[data-mode="mock"] { border-color: rgba(34,211,238,0.4); color: var(--accent-2); background: var(--accent-2-soft); }
.mode-pill[data-mode="mock"] .pill-dot { background: var(--accent-2); box-shadow: 0 0 10px var(--accent-2); }
.mode-pill[data-mode="real"] { border-color: rgba(65,212,120,0.35); color: var(--accent); background: var(--accent-soft); }
.mode-pill[data-mode="real"] .pill-dot { background: var(--accent); box-shadow: 0 0 10px var(--accent); }

.grid {
  display: grid; gap: 16px; padding: 16px;
  grid-template-columns: 2fr 1fr;
  grid-template-areas:
    "setup     setup"
    "topology  tour"
    "topology  psk"
    "readiness peers"
    "pings     events"
    "actions   events";
}
.setup { grid-area: setup; }
.topology { grid-area: topology; }
.tour { grid-area: tour; }
.psk-strip { grid-area: psk; }
.readiness { grid-area: readiness; }
.pings { grid-area: pings; }
.peers { grid-area: peers; }
.events { grid-area: events; }
.actions { grid-area: actions; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  padding: 18px 20px;
  box-shadow: 0 1px 0 rgba(255,255,255,0.02), 0 8px 24px rgba(9,9,17,0.25);
}
.panel h2 {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--muted); margin: 0 0 14px; font-weight: 600;
}
.panel h2 .muted { text-transform: none; letter-spacing: 0; font-size: 12px; }

/* Setup launcher */
.setup {
  position: relative;
  overflow: hidden;
  border-color: rgba(65,212,120,0.20);
  background:
    radial-gradient(520px 220px at 92% -20%, rgba(65,212,120,0.14), transparent 70%),
    linear-gradient(135deg, rgba(34,211,238,0.08), transparent 44%),
    var(--panel);
}
.setup::after {
  content: "";
  position: absolute;
  inset: auto -12% -55% 42%;
  height: 160px;
  pointer-events: none;
  background: radial-gradient(closest-side, rgba(34,211,238,0.14), transparent);
  transform: rotate(-8deg);
}
.setup > * { position: relative; z-index: 1; }
.setup-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 22px;
  align-items: start;
}
.setup-kicker {
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}
.setup-title {
  margin-top: 4px;
  color: var(--fg);
  font-size: clamp(24px, 3vw, 38px);
  line-height: 1;
  font-weight: 700;
  letter-spacing: -0.035em;
  max-width: 880px;
}
.setup-detail {
  max-width: 880px;
  margin: 12px 0 0;
  color: var(--fg-dim);
  font-size: 14px;
  line-height: 1.55;
}
.setup-detail code,
.setup-card-command code,
.setup-command code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
}
.setup-detail code {
  color: var(--accent);
  background: rgba(65,212,120,0.10);
  border: 1px solid rgba(65,212,120,0.18);
  border-radius: 5px;
  padding: 1px 5px;
}
.setup-command {
  min-width: 230px;
  padding: 14px;
  border: 1px solid rgba(34,211,238,0.28);
  border-radius: 12px;
  background: rgba(15,14,29,0.52);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
}
.setup-command span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.setup-command code {
  display: block;
  color: var(--accent-2);
  font-size: 15px;
  white-space: nowrap;
}
.setup-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}
.setup-card {
  min-height: 154px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 14px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: rgba(255,255,255,0.025);
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}
.setup-card.active {
  transform: translateY(-2px);
  border-color: rgba(65,212,120,0.48);
  background: rgba(65,212,120,0.08);
  box-shadow: 0 10px 28px rgba(65,212,120,0.08);
}
.setup-card-label {
  color: var(--accent-2);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}
.setup-card h3 {
  margin: 0;
  color: var(--fg);
  font-size: 18px;
  letter-spacing: -0.01em;
}
.setup-card p {
  flex: 1;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}
.setup-card-proof {
  color: var(--fg-dim);
  font-size: 12px;
  line-height: 1.35;
}
.setup-card-command {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.setup-card-command code {
  display: inline-flex;
  width: max-content;
  max-width: 100%;
  padding: 6px 9px;
  border-radius: 7px;
  border: 1px solid rgba(34,211,238,0.18);
  background: rgba(34,211,238,0.08);
  color: var(--accent-2);
  font-size: 12px;
}
.dashboard-insights {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.8fr);
  gap: 12px;
  margin-top: 16px;
}
.now-summary,
.next-actions {
  border: 1px solid rgba(34,211,238,0.20);
  border-radius: 12px;
  background: rgba(15,14,29,0.46);
  padding: 14px;
}
.insight-label {
  color: var(--accent-2);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.now-summary h3 {
  margin: 6px 0 5px;
  color: var(--fg);
  font-size: 20px;
  line-height: 1.15;
  letter-spacing: -0.015em;
}
.now-summary p {
  margin: 0;
  color: var(--fg-dim);
  font-size: 13px;
  line-height: 1.45;
}
.now-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
}
.now-facts li {
  min-width: 0;
  padding: 8px 9px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: rgba(255,255,255,0.025);
}
.now-fact-name {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.now-fact-value {
  display: block;
  min-width: 0;
  margin-top: 2px;
  color: var(--fg);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.next-command-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}
.next-command {
  display: grid;
  grid-template-columns: minmax(110px, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  padding: 8px 9px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: rgba(255,255,255,0.025);
}
.next-command[hidden] { display: none; }
.next-command span {
  color: var(--fg-dim);
  font-size: 12px;
}
.next-command code {
  color: var(--accent-2);
  font: 12px/1.2 ui-monospace, "SF Mono", Menlo, monospace;
  white-space: nowrap;
}
.next-command-link {
  padding: 6px 9px;
  border: 1px solid rgba(34,211,238,0.28);
  border-radius: 7px;
  background: rgba(34,211,238,0.08);
  color: var(--accent-2);
  font: 700 11px/1 "Inter", -apple-system, sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
}
.next-command-link:hover {
  background: rgba(34,211,238,0.14);
  border-color: rgba(34,211,238,0.42);
}
.copy-command {
  padding: 6px 9px;
  border: 1px solid rgba(65,212,120,0.25);
  border-radius: 7px;
  background: rgba(65,212,120,0.08);
  color: var(--accent);
  font: 700 11px/1 "Inter", -apple-system, sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
}
.copy-command:hover {
  background: rgba(65,212,120,0.14);
  border-color: rgba(65,212,120,0.42);
}
.copy-command:active { transform: translateY(1px); }
.copy-command.copied {
  color: var(--bg-2);
  background: var(--accent);
  border-color: var(--accent);
}
.setup-checklist {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}
.setup-check-section {
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: rgba(15,14,29,0.38);
  padding: 14px;
}
.setup-check-section h3 {
  margin: 0 0 4px;
  color: var(--fg);
  font-size: 15px;
}
.setup-check-section p {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}
.setup-check-list {
  list-style: none;
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
}
.setup-check-item {
  display: grid;
  grid-template-columns: 10px minmax(120px, 0.9fr) minmax(120px, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 8px 9px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: rgba(255,255,255,0.02);
}
.setup-check-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
  box-shadow: 0 0 9px rgba(244,63,94,0.45);
}
.setup-check-item.ok .setup-check-dot {
  background: var(--ok);
  box-shadow: 0 0 9px rgba(65,212,120,0.5);
}
.setup-check-name {
  color: var(--fg);
  font-size: 13px;
  font-weight: 600;
}
.setup-check-detail {
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.setup-check-action {
  color: var(--accent-2);
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 11px;
  white-space: nowrap;
}
.support-summary {
  margin-top: 16px;
  border: 1px solid rgba(34,211,238,0.22);
  border-radius: 12px;
  background: rgba(15,14,29,0.48);
  overflow: hidden;
}
.support-summary-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  padding: 14px;
  border-bottom: 1px solid var(--line-soft);
}
.support-summary h3 {
  margin: 0 0 4px;
  color: var(--fg);
  font-size: 15px;
}
.support-summary p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}
#support-summary-text {
  max-height: 260px;
  margin: 0;
  padding: 14px;
  overflow: auto;
  color: var(--fg-dim);
  background: rgba(0,0,0,0.12);
  font: 12px/1.5 ui-monospace, "SF Mono", Menlo, monospace;
  white-space: pre-wrap;
}

/* Topology */
#topo { width: 100%; height: 400px; }
.cluster-bg { fill: rgba(56, 189, 248, 0.05); stroke: var(--accent-2); stroke-width: 1; stroke-dasharray: 4 3; }
.cluster-label { fill: var(--accent-2); font-size: 12px; text-anchor: middle; letter-spacing: 0.05em; text-transform: uppercase; transition: fill 0.3s; }

/* Outage overlays — hidden by default, revealed when body.qrypt-down */
.cluster-outage { fill: url(#warn-stripes); stroke: var(--warn); stroke-width: 2.5; stroke-dasharray: 8 4; opacity: 0; pointer-events: none; transition: opacity 0.3s; }
#outage-banner { opacity: 0; pointer-events: none; transition: opacity 0.3s; }
.outage-banner-bg   { fill: #2a1d05; stroke: var(--warn); stroke-width: 2; }
.outage-banner-text { fill: var(--warn); font-size: 18px; font-weight: 800; text-anchor: middle; letter-spacing: 0.08em; }
.outage-banner-sub  { fill: #fde68a; font-size: 11px; text-anchor: middle; letter-spacing: 0.04em; }

body.qrypt-down .cluster-outage { opacity: 1; animation: outage-pulse 1.6s ease-in-out infinite; }
body.qrypt-down #outage-banner  { opacity: 1; animation: outage-pulse 1.6s ease-in-out infinite; }
body.qrypt-down .cluster-bg     { stroke: var(--warn); }
body.qrypt-down .cluster-label  { fill: var(--warn); }
body.qrypt-down .qdea-bg        { stroke: var(--danger); fill: #2a1416; filter: grayscale(0.4); }
body.qrypt-down .edge.entropy   { stroke: var(--danger); stroke-opacity: 0.18; }
body.qrypt-down .edge.metadata  { stroke: var(--danger); }
body.qrypt-down .edge-label.strong { fill: var(--danger); }
body.qrypt-down #node-init .node-fp,
body.qrypt-down #node-sync .node-fp { fill: var(--warn); opacity: 0.55; }
body.qrypt-down #btn-up { animation: restore-glow 1.2s ease-in-out infinite; border-color: var(--warn); color: var(--warn); }
body.qrypt-down .metric-value#countdown { color: var(--warn); }

@keyframes outage-pulse {
  0%, 100% { filter: drop-shadow(0 0 4px rgba(251,191,36,0.4)); }
  50%      { filter: drop-shadow(0 0 14px rgba(251,191,36,0.85)); }
}
@keyframes restore-glow {
  0%, 100% { box-shadow: 0 0 0 rgba(251,191,36,0); background: var(--panel-2); }
  50%      { box-shadow: 0 0 14px rgba(251,191,36,0.7); background: #3a2a08; }
}
.node-bg { fill: var(--panel-2); stroke: var(--line); stroke-width: 1.5; }

/* "This rotation" annotation card. Lives below the topology SVG inside
   the topology panel so it carries live, time-varying detail without
   sitting on top of the QDEA → endpoint connector lines. */
.rot-annot-card {
  margin: 12px auto 0;
  max-width: 360px;
  padding: 12px 16px;
  border: 1px dashed var(--accent-2);
  border-radius: 10px;
  background: rgba(34, 211, 238, 0.06);
  text-align: center;
}
.rot-annot-card .rot-annot-kicker {
  color: var(--accent-2);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
}
.rot-annot-card .rot-annot-title {
  color: var(--fg);
  font-size: 16px;
  font-weight: 700;
  margin-top: 4px;
}
.rot-annot-card .rot-annot-detail {
  color: var(--fg-dim);
  font-size: 12px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  margin-top: 2px;
}
body.qrypt-down .rot-annot-card                   { background: rgba(244,63,94,0.06); border-color: var(--danger); }
body.qrypt-down .rot-annot-card .rot-annot-kicker { color: var(--warn); }
body.qrypt-down .rot-annot-card .rot-annot-title  { color: var(--warn); }
body.qrypt-down .rot-annot-card .rot-annot-detail { color: var(--warn); opacity: 0.75; }
.qdea-bg { fill: var(--panel-hi); stroke: var(--accent-2); stroke-width: 1.5; transition: stroke 0.2s, stroke-width 0.2s, filter 0.2s; }
.qdea-bg.selected { stroke: var(--accent); stroke-width: 3; filter: drop-shadow(0 0 8px var(--accent)); }
.node-label { fill: var(--fg); font-size: 18px; font-weight: 600; text-anchor: middle; }
.node-sub { fill: var(--muted); font-size: 12px; text-anchor: middle; }
.node-mini { fill: var(--fg); font-size: 11px; text-anchor: middle; dominant-baseline: middle; font-family: ui-monospace, monospace; }
.node-fp { fill: var(--accent); font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 16px; text-anchor: middle; }
.edge { stroke: var(--line); stroke-width: 1.5; }
.edge.entropy { stroke: var(--accent-2); stroke-opacity: 0.28; }
.edge.entropy.pulse { stroke-opacity: 1; stroke-width: 3; filter: drop-shadow(0 0 6px var(--accent-2)); }
.edge.metadata { stroke: var(--warn); stroke-width: 2; stroke-dasharray: 6 4; }
.edge.metadata.pulse { stroke-width: 4; filter: drop-shadow(0 0 6px var(--warn)); }
.edge-label { fill: var(--muted); font-size: 11px; text-anchor: middle; }
.edge-label.strong { fill: var(--warn); font-weight: 600; font-size: 12px; }
.flash { animation: flash 0.6s ease-out; }
@keyframes flash {
  0%   { filter: drop-shadow(0 0 0 var(--accent)); }
  50%  { filter: drop-shadow(0 0 12px var(--accent)); }
  100% { filter: drop-shadow(0 0 0 var(--accent)); }
}
.topo-note { font-size: 12px; margin: 8px 4px 0; line-height: 1.5; }

/* PSK chips */
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 13px;
  padding: 6px 10px; border-radius: 6px; background: var(--panel-2);
  border: 1px solid var(--line); color: var(--fg-dim);
}
.chip.latest {
  background: var(--accent); color: var(--bg-2); border-color: var(--accent);
  font-weight: 700; box-shadow: 0 0 14px rgba(65,212,120,0.45);
}

/* Presenter tour */
.tour {
  position: relative;
  overflow: hidden;
}
.tour::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(360px 160px at 90% 0%, rgba(65,212,120,0.10), transparent 64%),
    linear-gradient(135deg, rgba(34,211,238,0.06), transparent 42%);
}
.tour > * { position: relative; }
.tour-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
}
.tour-kicker {
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.tour-title {
  margin-top: 3px;
  color: var(--fg);
  font-size: 22px;
  line-height: 1.1;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.tour-phase {
  flex: 0 0 auto;
  border: 1px solid rgba(65,212,120,0.32);
  border-radius: 999px;
  padding: 5px 10px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.tour-detail {
  margin: 0 0 14px;
  color: var(--fg-dim);
  font-size: 13px;
  line-height: 1.45;
}
.tour-steps {
  list-style: none;
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
}
.tour-step {
  display: grid;
  grid-template-columns: 16px 1fr;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
  transition: color 0.2s, transform 0.2s;
}
.tour-step-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--line);
  border: 1px solid var(--line);
  transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.tour-step.done { color: var(--fg-dim); }
.tour-step.done .tour-step-dot {
  background: var(--ok);
  border-color: var(--ok);
  box-shadow: 0 0 8px rgba(65,212,120,0.45);
}
.tour-step.active {
  color: var(--fg);
  transform: translateX(2px);
}
.tour-step.active .tour-step-dot {
  background: var(--accent-2);
  border-color: var(--accent-2);
  box-shadow: 0 0 10px rgba(34,211,238,0.75);
}
body.qrypt-down .tour-phase {
  border-color: rgba(251,191,36,0.45);
  color: var(--warn);
  background: rgba(251,191,36,0.10);
}

/* Pings */
.ping-row { display: grid; grid-template-columns: 200px 1fr 80px; align-items: center; gap: 12px; margin: 6px 0; }
.ping-label { color: var(--muted); font-size: 13px; }
.ping-bar { display: flex; gap: 2px; height: 22px; align-items: stretch; }
.ping-cell { flex: 1; border-radius: 2px; background: var(--line); }
.ping-cell.ok { background: var(--ok); }
.ping-cell.bad { background: var(--danger); }
.ping-rtt { font-family: ui-monospace, monospace; font-size: 14px; text-align: right; color: var(--accent); }

/* Readiness */
.readiness-mode {
  margin: -4px 0 12px;
  color: var(--fg-dim);
  font-size: 13px;
  line-height: 1.45;
}
.readiness-list {
  list-style: none;
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
}
.readiness-item {
  display: grid;
  grid-template-columns: 10px minmax(120px, 0.9fr) minmax(120px, 1fr);
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: rgba(255,255,255,0.02);
}
.readiness-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
}
.readiness-item.ok .readiness-dot { background: var(--ok); box-shadow: 0 0 9px var(--ok); }
.readiness-item.bad .readiness-dot { background: var(--danger); box-shadow: 0 0 9px var(--danger); }
.readiness-name { color: var(--fg); font-size: 13px; font-weight: 600; }
.readiness-detail {
  color: var(--muted);
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Peers */
.peers table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.peers th, .peers td { text-align: left; padding: 6px 8px; font-size: 14px; border-bottom: 1px solid var(--line); }
.peers th { color: var(--muted); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; }
.psk-yes { color: var(--ok); font-weight: 600; }
.psk-no  { color: var(--danger); font-weight: 600; }

/* Peers summary footer (rotations / countdown / uptime / PSK pair) */
.peers-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 16px;
  margin: 12px 0 0;
  padding: 12px 0 0;
  border-top: 1px solid var(--line-soft);
}
.peers-summary > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.peers-summary dt { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; }
.peers-summary dd { margin: 0; color: var(--fg); font-size: 14px; font-variant-numeric: tabular-nums; font-family: ui-monospace, "SF Mono", Menlo, monospace; }

/* Failure-injection panel */
.actions-explainer { margin: 0 0 12px; line-height: 1.45; }
.actions-row { display: flex; flex-wrap: wrap; gap: 8px; }
.actions-status {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px 16px;
  margin: 12px 0 0;
  padding: 12px 0 0;
  border-top: 1px solid var(--line-soft);
}
.actions-status > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.actions-status dt { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; }
.actions-status dd { margin: 0; color: var(--fg); font-size: 13px; font-variant-numeric: tabular-nums; word-break: break-word; }
body.qrypt-down .actions-status dd#inject-health { color: var(--warn); }
body.qrypt-down .actions-status dd#inject-missed { color: var(--warn); font-weight: 600; }

/* Events */
.panel-head.split {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}
.panel-head.split h2 { margin: 0; }
.event-filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}
.event-filter {
  padding: 5px 8px;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  background: rgba(255,255,255,0.025);
  color: var(--muted);
  font: 700 10px/1 "Inter", -apple-system, sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}
.event-filter:hover { color: var(--fg-dim); border-color: var(--line); }
.event-filter.active {
  color: var(--bg-2);
  background: var(--accent-2);
  border-color: var(--accent-2);
}
#event-log { list-style: none; margin: 0; padding: 0; max-height: 320px; overflow: hidden; }
#event-log li { font-size: 13px; padding: 4px 0; border-bottom: 1px solid var(--line); color: var(--fg); }
#event-log li.fade { opacity: 0.5; }
#event-log li.error { color: var(--danger); }
.ev-time { color: var(--muted); font-family: ui-monospace, monospace; font-size: 12px; margin-right: 8px; }
.ev-fp { color: var(--accent); font-family: ui-monospace, monospace; }

/* Actions */
.actions button {
  padding: 10px 18px; font-size: 14px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--panel-2); color: var(--fg); cursor: pointer; margin-right: 10px;
  font-weight: 600; font-family: inherit; letter-spacing: 0.01em;
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
}
.actions button:hover { background: var(--panel-hi); border-color: var(--line); }
.actions button:active { transform: translateY(1px); }
.actions button.danger {
  background: var(--danger); border-color: var(--danger); color: #fff;
}
.actions button.danger:hover { filter: brightness(1.08); }
.actions button:disabled { opacity: 0.48; cursor: not-allowed; filter: none; }
.actions button:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 2px;
}

@media (max-width: 1100px) {
  body { font-size: 14px; }
  .bar { align-items: flex-start; flex-direction: column; gap: 12px; padding: 14px 18px; }
  .bar h1 { flex-wrap: wrap; row-gap: 6px; }
  .bar-right { width: 100%; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
  .grid {
    grid-template-columns: 1fr;
    grid-template-areas:
      "setup"
      "topology"
      "tour"
      "psk"
      "readiness"
      "pings"
      "peers"
      "events"
      "actions";
    padding: 12px;
  }
  .setup-hero { grid-template-columns: 1fr; }
  .setup-command { min-width: 0; }
  .setup-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-insights { grid-template-columns: 1fr; }
  .setup-checklist { grid-template-columns: 1fr; }
  .setup-check-item { grid-template-columns: 10px minmax(120px, 0.8fr) minmax(120px, 1fr); }
  .setup-check-action { grid-column: 2 / -1; }
  #topo { height: auto; max-height: 60vh; }
  .ping-row { grid-template-columns: minmax(130px, 180px) 1fr 70px; }
  .peers { overflow-x: auto; }
}

@media (max-width: 640px) {
  .panel { padding: 14px; border-radius: 10px; }
  .setup-title { font-size: 26px; }
  .setup-cards { grid-template-columns: 1fr; }
  .setup-check-item { grid-template-columns: 10px 1fr; }
  .setup-check-detail,
  .setup-check-action { grid-column: 2; white-space: normal; }
  .now-facts { grid-template-columns: 1fr; }
  .next-command { grid-template-columns: 1fr; }
  .next-command code { white-space: normal; }
  .support-summary-head { flex-direction: column; }
  .metric { text-align: left; }
  .ping-row { grid-template-columns: 1fr; gap: 6px; }
  .ping-rtt { text-align: left; }
  .readiness-item { grid-template-columns: 10px 1fr; }
  .readiness-detail { grid-column: 2; white-space: normal; }
  .panel-head.split { flex-direction: column; }
  .event-filters { justify-content: flex-start; }
  .actions button { width: 100%; margin: 0 0 8px; }
}

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