/* Distributed Smart Parking - site styles
   Layout: sticky top bar with tabs, overview, Milestone 1 demo, Milestone 2 communication. */

:root {
  --bg: #0b0f1a;
  --bg-2: #0e1322;
  --surface: #121829;
  --surface-2: #19213a;
  --surface-3: #1f2a47;
  --line: #243049;
  --line-2: #30406a;
  --text: #e8edf8;
  --text-2: #c3cbe0;
  --muted: #8f9bb8;
  --accent: #6d8dff;
  --accent-2: #9db3ff;

  --free: #22c55e;
  --occupied: #64748b;
  --reserved: #3b82f6;
  --unknown: #f59e0b;
  --err: #ef4444;

  --sensor: #34d399;
  --client: #93c5fd;
  --peer: #fcd34d;

  --radius: 14px;
  --radius-s: 9px;
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 64px; }
html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-2); }
a:hover { color: #fff; }
code, kbd, .mono { font-family: var(--mono); font-size: .92em; }
code { background: var(--surface-2); padding: 1px 5px; border-radius: 5px; color: var(--text-2); }
kbd { background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 5px; padding: 0 6px; font-size: 12px; }
h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -.01em; }
p { margin: 0; }
button {
  font: inherit;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-s);
  padding: 7px 12px;
  cursor: pointer;
  transition: border-color .12s, background .12s, transform .08s;
}
button:hover { border-color: var(--accent); background: var(--surface-3); }
button:active { transform: translateY(1px); }
button:disabled { opacity: .45; cursor: not-allowed; transform: none; }
button.primary { background: #2448c7; border-color: #3a5de6; }
button.primary:hover { background: #2d55e0; }
button.ok { background: #14532d; border-color: #1f8a46; }
button.danger { background: #6b1a1a; border-color: #b91c1c; }
button.ghost { background: transparent; border-color: transparent; color: var(--muted); }
button.ghost:hover { color: var(--text); background: var(--surface-2); border-color: var(--line-2); }
button.sm { padding: 4px 9px; font-size: 12.5px; }
select, input[type=text], input[type=search] {
  font: inherit;
  font-size: 13.5px;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-s);
  padding: 7px 10px;
}
input:focus, select:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
input[type=range] { accent-color: var(--accent); width: 130px; }

/* ---------- top bar ---------- */
.top {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 18px;
  padding: 0 24px; height: 56px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; font-size: 15px; white-space: nowrap; }
.brand span { color: var(--muted); font-weight: 500; margin-left: 8px; font-size: 13px; }
.tabs { display: flex; gap: 4px; margin-left: 8px; }
.tabs a {
  color: var(--muted); text-decoration: none; font-size: 13.5px; font-weight: 500;
  padding: 6px 12px; border-radius: 999px;
}
.tabs a:hover { color: var(--text); background: var(--surface-2); }
.tabs a.on { color: #fff; background: var(--surface-3); }
.top-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.top-actions a { font-size: 13.5px; text-decoration: none; }

/* ---------- sections ---------- */
.wrap { max-width: 1480px; margin: 0 auto; padding: 0 24px; }
section.ms { padding: 44px 0 20px; }
.ms-head { display: grid; grid-template-columns: 1fr auto; gap: 8px 24px; align-items: end; margin-bottom: 18px; }
.kicker { color: var(--accent-2); font-weight: 600; font-size: 12.5px; letter-spacing: .08em; text-transform: uppercase; }
.ms-head h2 { font-size: 26px; margin-top: 4px; }
.ms-head p { color: var(--muted); max-width: 900px; margin-top: 6px; }
.ms-head .links { color: var(--muted); font-size: 13.5px; }

/* ---------- overview ---------- */
.hero {
  padding: 56px 0 36px;
  border-bottom: 1px solid var(--line);
}
.hero h1 { font-size: 34px; font-weight: 700; letter-spacing: -.01em; }
.hero .lede { font-size: 17px; color: var(--text-2); max-width: 820px; margin-top: 12px; }
.hero .team { color: var(--muted); font-size: 13.5px; margin-top: 10px; }
.hero .team b { color: var(--text-2); font-weight: 600; }
.procstrip { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
.proc {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 12px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line-2);
  font-family: var(--mono); font-size: 12.5px; cursor: pointer; user-select: none;
}
.proc i { width: 8px; height: 8px; border-radius: 50%; background: var(--free); }
.proc.dead { border-color: rgba(239,68,68,.6); color: #fca5a5; }
.proc.dead i { background: var(--err); }
.proc small { color: var(--muted); font-family: var(--font); }
.proc:hover { border-color: var(--accent); }
.try { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 22px; }
.try .card { cursor: pointer; }
.try .card:hover { border-color: var(--accent); }
.try .card h3 { font-size: 15px; }
.try .card p { color: var(--muted); font-size: 13.5px; margin-top: 6px; }
.try .card .go { color: var(--accent-2); font-size: 13px; margin-top: 10px; font-weight: 500; }

/* ---------- cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  min-width: 0;
}
.card-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 4px; }
.card-head h3 { font-size: 16px; font-weight: 650; }
.card-head .r { margin-left: auto; color: var(--muted); font-size: 12.5px; font-family: var(--mono); display: flex; gap: 8px; align-items: center; }
.card-sub { color: var(--muted); font-size: 13px; margin-bottom: 12px; }
.card-foot { color: var(--muted); font-size: 12.5px; margin-top: 12px; }

/* ---------- milestone 1 grid ---------- */
.grid-m1 {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  grid-template-areas:
    "arch lotA lotB"
    "scen lotA lotB"
    "log  log  log";
  gap: 14px;
}
.area-arch { grid-area: arch; }
.area-lotA { grid-area: lotA; }
.area-lotB { grid-area: lotB; }
.area-scen { grid-area: scen; }
.area-log { grid-area: log; }

/* architecture diagram */
#diagram { width: 100%; height: auto; display: block; }
.node { cursor: pointer; }
.node rect { fill: var(--surface-2); stroke: var(--line-2); stroke-width: 1.2; rx: 10; transition: stroke .15s, fill .15s; }
.node:hover rect { stroke: var(--accent); }
.node.dead rect { stroke: var(--err); fill: #2a1420; stroke-dasharray: 4 3; }
.node text { fill: var(--text); font-size: 12px; font-family: var(--font); font-weight: 600; pointer-events: none; }
.node .role { fill: var(--muted); font-weight: 400; font-size: 10.5px; }
.node .st { font-size: 10px; font-family: var(--mono); fill: var(--free); }
.node.dead .st { fill: var(--err); }
.node .hint { fill: var(--muted); font-size: 9.5px; font-weight: 400; opacity: 0; transition: opacity .15s; }
.node:hover .hint { opacity: 1; }
.node.hl rect, .node.hl text { animation: hl-node 1.2s ease-in-out 2; }
@keyframes hl-node { 50% { stroke: var(--accent); fill: #26357a; } }
.edge { stroke: var(--line-2); stroke-width: 1.6; fill: none; transition: stroke .15s; pointer-events: none; }
.edge.cut { stroke: var(--err); stroke-dasharray: 5 4; }
.edge.flash { stroke: var(--accent); stroke-width: 2.4; }
.edge-hit { stroke: transparent; stroke-width: 14; fill: none; cursor: pointer; }
.edge-hit:hover + .edge, .edge.hover { stroke: var(--accent); }
.edge.hl { animation: hl-edge 1.2s ease-in-out 2; }
@keyframes hl-edge { 50% { stroke: var(--accent); stroke-width: 3; } }
.elabel { fill: var(--muted); font-size: 9.5px; font-family: var(--mono); pointer-events: none; }
.disk rect { fill: var(--bg-2); stroke: var(--line-2); rx: 3; }
.disk text { fill: var(--muted); font-size: 9px; font-family: var(--mono); }
.dot { fill: #c7d2fe; }
.dot.sensor { fill: var(--sensor); }
.dot.client { fill: var(--client); }
.dot.peer { fill: var(--peer); }
.dot.dropped { fill: var(--err); }
.sliders { display: grid; grid-template-columns: 1fr; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.sl { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.sl span.v { font-family: var(--mono); color: var(--text-2); min-width: 54px; }
.sl label { min-width: 150px; }
.net-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 10px; }
.net-legend i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; }

/* lots */
.lot-sum { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 10px; font-size: 13px; color: var(--muted); }
.lot-sum b { font-weight: 700; font-size: 15px; color: var(--text); margin-right: 3px; }
.lot-sum .f b { color: var(--free); }
.lot-sum .rv b { color: #93c5fd; }
.lot-sum .u b { color: var(--unknown); }
.grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 7px; }
.tile {
  position: relative;
  aspect-ratio: 1.3;
  border-radius: 10px;
  border: 1.5px solid transparent;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 6px 7px;
  cursor: pointer;
  font-family: var(--mono); font-size: 11.5px;
  background: var(--surface-3); color: var(--text-2);
  user-select: none;
  transition: transform .12s, box-shadow .12s, background .25s;
}
.tile:hover { transform: translateY(-1px); border-color: var(--line-2); }
.tile.sel { border-color: #fff; box-shadow: 0 0 0 3px rgba(255,255,255,.18); }
.tile.free { background: #123d25; color: #bbf7d0; }
.tile.occupied { background: #2b3648; color: #cbd5e1; }
.tile.reserved { background: #1e3a8a; color: #bfdbfe; }
.tile.unknown { background: repeating-linear-gradient(45deg, #4a3410 0 6px, #5c4214 6px 12px); color: #fde68a; }
.tile.changed { animation: tile-pulse .8s ease-out 1; }
@keyframes tile-pulse { 0% { box-shadow: 0 0 0 0 rgba(255,255,255,.55); } 100% { box-shadow: 0 0 0 10px rgba(255,255,255,0); } }
.tile.hl { animation: tile-hl 1.2s ease-in-out 2; }
@keyframes tile-hl { 50% { box-shadow: 0 0 0 4px var(--accent); } }
.tile .id { font-weight: 700; display: flex; justify-content: space-between; align-items: center; }
.tile .ico { font-size: 11px; opacity: .9; font-family: var(--font); }
.tile .meta { font-size: 10px; opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-family: var(--font); }
.tile .car { position: absolute; left: 7px; bottom: 7px; width: 6px; height: 6px; border-radius: 50%; border: 1px solid rgba(255,255,255,.35); }
.tile .car.on { background: #f8fafc; border-color: #f8fafc; }
.tile .meta { padding-left: 11px; }
.lot-legend { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 10px; font-size: 11.5px; color: var(--muted); }
.lot-legend span::before { content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.lot-legend .f::before { background: var(--free); }
.lot-legend .o::before { background: var(--occupied); }
.lot-legend .r::before { background: var(--reserved); }
.lot-legend .u::before { background: var(--unknown); }
.lot-legend .c::before { background: #f8fafc; border-radius: 50%; width: 6px; height: 6px; }
.peerview { margin-top: 8px; font-size: 12.5px; color: var(--muted); }
.peerview .stale { color: var(--unknown); font-weight: 700; }
.lot-down { color: var(--muted); font-size: 13.5px; padding: 30px 10px; text-align: center; }
.lot-down b { color: #fca5a5; }
.actions { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.actions .row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.actions .row + .row { margin-top: 8px; }
.actions .who { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.actions .sel-id { font-family: var(--mono); color: #fff; font-weight: 700; }
.actions .none { color: var(--muted); font-size: 13px; }
.recent { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); font-family: var(--mono); font-size: 11.5px; color: var(--text-2); white-space: pre; }
.recent .lbl { font-family: var(--font); color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.recent .none { color: var(--muted); font-family: var(--font); }
.recent div + div { margin-top: 2px; }

/* scenarios */
.scen-list { display: grid; gap: 6px; }
.scen-list button { text-align: left; display: flex; gap: 10px; align-items: center; padding: 9px 12px; }
.scen-list button .n { background: #2448c7; color: #fff; border-radius: 6px; padding: 0 7px; font-family: var(--mono); font-size: 11.5px; line-height: 20px; }
.scen-list button.running { border-color: var(--accent); background: var(--surface-3); }
.runner { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.runner-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; font-size: 13px; color: var(--muted); }
.runner-head b { color: var(--text); }
.runner-head button { margin-left: auto; }
.steps { display: grid; gap: 4px; }
.step { display: grid; grid-template-columns: 18px 1fr; gap: 8px; padding: 6px 8px; border-radius: 8px; font-size: 13px; color: var(--muted); }
.step i { width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid var(--line-2); display: inline-block; margin-top: 3px; }
.step.done { color: var(--text-2); }
.step.done i { background: var(--free); border-color: var(--free); }
.step.now { background: var(--surface-2); color: #fff; }
.step.now i { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(109,141,255,.25); }
.step .sub { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.wait { height: 4px; background: var(--surface-3); border-radius: 2px; overflow: hidden; margin-top: 6px; }
.wait i { display: block; height: 100%; background: var(--accent); width: 0; }
.reply {
  margin-top: 12px; padding: 10px 12px; border-radius: var(--radius-s);
  background: var(--bg-2); border: 1px solid var(--line);
  font-family: var(--mono); font-size: 12.5px; min-height: 42px; white-space: pre-wrap; color: var(--text-2);
}
.reply .lbl { font-family: var(--font); color: var(--muted); font-size: 11.5px; display: block; margin-bottom: 3px; }
.reply.ok { border-color: #1f8a46; }
.reply.warn { border-color: var(--unknown); }
.reply.err { border-color: var(--err); }

/* log */
.log-tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.log-tools input[type=search] { width: 260px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface-2); font-size: 12px; cursor: pointer; font-family: var(--mono); color: var(--text-2); }
.chip:hover { border-color: var(--accent); }
.chip.on { background: #2448c7; border-color: #3a5de6; color: #fff; }
.log-tools .spacer { flex: 1; }
.logwrap { max-height: 380px; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--bg-2); }
.logwrap.paused { box-shadow: inset 0 0 0 1px var(--unknown); }
table.log { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: 12px; }
table.log th { position: sticky; top: 0; background: #141c30; text-align: left; padding: 6px 10px; color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--line); z-index: 1; }
table.log td { padding: 4px 10px; border-bottom: 1px solid #131b2e; vertical-align: top; white-space: nowrap; }
table.log td.detail { white-space: normal; color: #cbd5e1; }
table.log tr.row { cursor: pointer; }
table.log tr.row:hover td { background: rgba(255,255,255,.03); }
table.log tr.sensor td.type { color: var(--sensor); }
table.log tr.client td.type { color: var(--client); }
table.log tr.peer td.type { color: var(--peer); }
table.log tr.console td.type { color: #c4b5fd; }
table.log tr.dropped td { color: #fca5a5; }
table.log tr.recover td { color: var(--sensor); font-weight: 700; }
table.log tr.warn td.detail { color: #fde68a; }
table.log tr.err td.detail { color: #fca5a5; }
table.log tr.demo td { background: #101a33; color: #c7d2fe; }
table.log tr.exp td { background: #0a0e1a; white-space: pre-wrap; color: var(--text-2); font-size: 11.5px; padding: 8px 10px 10px 34px; }
.log-foot { display: flex; gap: 14px; align-items: center; color: var(--muted); font-size: 12px; margin-top: 8px; }
.log-foot label { display: flex; gap: 6px; align-items: center; }

/* ---------- milestone 2 ---------- */
.viewer { display: grid; grid-template-columns: 1fr 320px; gap: 18px; }
.viewer-main { min-width: 0; }
.vtabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.vtabs button.on { background: #2448c7; border-color: #3a5de6; color: #fff; }
.vpane { display: none; }
.vpane.on { display: block; }
.vpane svg { width: 100%; height: auto; display: block; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius-s); }
.viewer-side h3 { font-size: 16px; margin-bottom: 6px; }
.viewer-side p { color: var(--muted); font-size: 13.5px; }
.viewer-side .vtext { display: none; }
.viewer-side .vtext.on { display: block; }
.viewer-side .dl { margin-top: 14px; display: flex; gap: 8px; flex-wrap: wrap; }
.m2legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 12px; }
.m2legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

/* diagram palette (dark on page; the PNG export swaps these for a light palette) */
.m2svg { --d-bg: #0e1322; --d-ink: #dbe3f5; --d-muted: #8f9bb8; --d-line: #334a7a; --d-note-bg: #2a2410; --d-note-line: #f59e0b; --d-note-ink: #fde68a; --d-fail: #f87171; --d-label-bg: #0e1322; }
.m2svg.light { --d-bg: #ffffff; --d-ink: #1b2338; --d-muted: #5b6680; --d-line: #b8c0d4; --d-note-bg: #fffbeb; --d-note-line: #f59e0b; --d-note-ink: #78350f; --d-fail: #dc2626; --d-label-bg: #ffffff; }
.m2svg .lifeline { stroke: var(--d-line); stroke-dasharray: 4 4; }
.m2svg .actor rect { rx: 8; stroke-width: 1.5; fill: var(--d-bg); }
.m2svg .actor text { font-size: 13px; font-weight: 600; text-anchor: middle; font-family: var(--font); }
.m2svg .actor .sub { fill: var(--d-muted); font-size: 10.5px; font-weight: 400; }
.m2svg .msg line, .m2svg .msg path { stroke: var(--d-ink); stroke-width: 1.5; fill: none; }
.m2svg .msg.dashed line, .m2svg .msg.dashed path { stroke-dasharray: 5 4; }
.m2svg .msg.fail line { stroke: var(--d-fail); }
.m2svg .msg text { font-size: 11.5px; font-family: var(--mono); text-anchor: middle; fill: var(--d-ink); }
.m2svg .msg .sub { font-size: 10.5px; fill: var(--d-muted); font-family: var(--font); }
.m2svg .msg .lbl { font-size: 10.5px; }
.m2svg .msg .lblbg { fill: var(--d-label-bg); }
.m2svg .note rect { fill: var(--d-note-bg); stroke: var(--d-note-line); rx: 4; }
.m2svg .note text { font-size: 11px; fill: var(--d-note-ink); font-family: var(--font); }
.m2svg .arrowhead { fill: var(--d-ink); }
.m2svg .arrowhead.fail { fill: var(--d-fail); }
.m2svg .caption { fill: var(--d-muted); font-size: 11px; font-family: var(--font); text-anchor: middle; }
.m2svg { --c-client: #fbbf24; --c-server: #60a5fa; --c-sensor: #34d399; --c-broker: #a78bfa; --c-registry: #f87171; }
.m2svg.light { --c-client: #b45309; --c-server: #1d4ed8; --c-sensor: #047857; --c-broker: #6d28d9; --c-registry: #b91c1c; }
.m2svg .actor.role-client rect, .m2svg .msg.role-client line, .m2svg .msg.role-client path { stroke: var(--c-client); }
.m2svg .actor.role-server rect, .m2svg .msg.role-server line, .m2svg .msg.role-server path { stroke: var(--c-server); }
.m2svg .actor.role-sensor rect, .m2svg .msg.role-sensor line, .m2svg .msg.role-sensor path { stroke: var(--c-sensor); }
.m2svg .actor.role-broker rect, .m2svg .msg.role-broker line, .m2svg .msg.role-broker path { stroke: var(--c-broker); }
.m2svg .actor.role-registry rect, .m2svg .msg.role-registry line, .m2svg .msg.role-registry path { stroke: var(--c-registry); }
.m2svg .actor.role-client text { fill: var(--c-client); }
.m2svg .actor.role-server text { fill: var(--c-server); }
.m2svg .actor.role-sensor text { fill: var(--c-sensor); }
.m2svg .actor.role-broker text { fill: var(--c-broker); }
.m2svg .actor.role-registry text { fill: var(--c-registry); }
.m2svg .actor text.sub { fill: var(--d-muted); }

.grid-m2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 14px; }
table.plain { border-collapse: collapse; width: 100%; font-size: 13.5px; }
table.plain th, table.plain td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.plain th { color: var(--muted); font-weight: 600; font-size: 12.5px; }
table.plain td:first-child { white-space: nowrap; }
.types { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.type { padding: 8px 10px; border-radius: var(--radius-s); background: var(--surface-2); border: 1px solid var(--line); }
.type b { font-family: var(--mono); font-size: 12.5px; }
.type .pat { float: right; font-size: 11px; padding: 1px 7px; border-radius: 999px; background: var(--surface-3); color: var(--muted); }
.type p { font-size: 12.5px; color: var(--muted); margin-top: 3px; }


/* ---------- milestone 3: overlay simulator ---------- */
.m3sim { display: grid; grid-template-columns: minmax(0, 1fr) 330px; grid-template-areas: "main side" "log side"; gap: 14px 20px; }
.m3-main { grid-area: main; min-width: 0; }
.m3-side { grid-area: side; display: flex; flex-direction: column; gap: 14px; }
.m3-log { grid-area: log; min-width: 0; }
#overlay { width: 100%; height: auto; display: block; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius-s); }
.m3legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 10px; }
.m3legend i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; }
.m3group { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-s); padding: 12px; display: flex; flex-direction: column; gap: 9px; }
.m3label { font-size: 11.5px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.m3row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.m3row button { padding: 6px 10px; font-size: 13px; }
.m3sel { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.m3sel select { padding: 5px 8px; font-family: var(--mono); }
.m3-side .sl label { min-width: 74px; }
.m3-side .sl input[type=range] { width: 120px; }
table.m3metrics { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.m3metrics td { padding: 4px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
table.m3metrics td:first-child { color: var(--muted); width: 42%; }
table.m3metrics td:last-child { font-family: var(--mono); color: var(--text-2); }
table.m3metrics tr:last-child td { border-bottom: 0; }
.olog { height: 168px; overflow: auto; margin-top: 8px; padding: 8px 10px; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius-s); font-family: var(--mono); font-size: 12px; line-height: 1.55; color: var(--text-2); }
.olog div { white-space: pre-wrap; }
.olog .t { color: var(--muted); margin-right: 8px; }
.olog .who { color: var(--accent-2); margin-right: 8px; font-weight: 600; }
.olog .ok { color: var(--sensor); }
.olog .bad { color: #fca5a5; }
.olog .note { color: var(--peer); }

.onode { cursor: pointer; }
.onode circle.body { fill: var(--surface-2); stroke: var(--line-2); stroke-width: 2; transition: fill .25s, stroke .25s; }
.onode:hover circle.body { stroke: var(--accent); }
.onode text.name { fill: var(--text); font: 700 22px var(--font); text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.onode text.sub { fill: var(--muted); font: 500 11.5px var(--font); text-anchor: middle; pointer-events: none; paint-order: stroke; stroke: var(--bg-2); stroke-width: 6px; stroke-linejoin: round; }
.onode text.deg { fill: var(--text-2); font: 600 10.5px var(--mono); text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.onode circle.badge { fill: var(--surface-3); stroke: var(--line-2); }
.onode.asker circle.body { stroke: var(--accent); stroke-width: 3; }
.onode.target circle.body { stroke: var(--sensor); stroke-width: 3; stroke-dasharray: 5 4; }
.onode.informed circle.body { fill: #3b3412; stroke: var(--peer); }
.onode.found circle.body { fill: #123d25; stroke: var(--sensor); }
.onode.ttl0 circle.body { stroke: #fca5a5; }
.onode.dead circle.body { fill: #2a1420; stroke: var(--err); stroke-dasharray: 4 3; }
.onode.dead text.name { fill: #fca5a5; }
.onode.off { opacity: .38; }
.onode.off circle.body { stroke-dasharray: 3 4; fill: transparent; }
.onode .ring { fill: none; stroke: var(--accent); stroke-width: 2; opacity: 0; }
.onode .ring.pulse { animation: ringpulse .9s ease-out 1; }
@keyframes ringpulse { 0% { opacity: .9; r: 34; } 100% { opacity: 0; r: 54; } }
.oedge { stroke: var(--line-2); stroke-width: 2; transition: stroke .3s; }
.oedge.half { stroke-dasharray: 6 5; stroke: #7f2a2a; }
.oedge.fresh { stroke: var(--accent); stroke-width: 3; }
.oedge.tree { stroke: #f472b6; stroke-width: 3.5; }
.odot { r: 6; }
.odot.ctl { fill: #c4b5fd; }
.odot.lookup { fill: #93c5fd; }
.odot.gossip { fill: #fcd34d; }
.odot.found { fill: #34d399; }
.odot.agg { fill: #f472b6; }
.odot.bad { fill: #ef4444; }
.oarc { fill: none; stroke: #34d399; stroke-width: 2; stroke-dasharray: 6 5; opacity: .9; }
.olabel { fill: var(--text); font: 600 11px var(--mono); text-anchor: middle; pointer-events: none; paint-order: stroke; stroke: var(--bg-2); stroke-width: 4px; stroke-linejoin: round; }
.oflash { fill: none; stroke: #ef4444; stroke-width: 2.5; }

.stack { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.layer { display: grid; grid-template-columns: 112px 1fr; gap: 12px; align-items: center; padding: 10px 12px; border-radius: var(--radius-s); border: 1px solid var(--line); font-size: 13px; }
.layer b { font-weight: 650; }
.layer span { color: var(--text-2); }
.layer.l1 { background: rgba(109,141,255,.10); border-color: rgba(109,141,255,.35); }
.layer.l2 { background: rgba(52,211,153,.08); border-color: rgba(52,211,153,.35); }
.layer.l3 { background: rgba(252,211,77,.07); border-color: rgba(252,211,77,.30); }
.layer.l4 { background: var(--surface-2); }
.vpane3 { display: none; }
.vpane3.on { display: block; }
.viewer-side .vtext3 { display: none; }
.viewer-side .vtext3.on { display: block; }
pre.trace { margin: 0; padding: 12px 14px; max-height: 360px; overflow: auto; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius-s); font-family: var(--mono); font-size: 12px; line-height: 1.6; color: var(--text-2); }
pre.trace .t { color: var(--muted); }
pre.trace .who { color: var(--accent-2); font-weight: 600; }
pre.trace .gap { color: var(--peer); }
.qa { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.qa > div { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-s); padding: 12px 14px; }
.qa h4 { margin: 0 0 6px; font-size: 14px; }
.qa p { font-size: 13px; color: var(--muted); }
#milestone-3 .grid-m2 table.plain td:first-child { color: var(--text-2); font-weight: 600; }
table.meshcmp td:nth-child(2), table.meshcmp td:nth-child(3) { white-space: nowrap; }

/* ---------- misc ---------- */
footer { color: var(--muted); font-size: 12.5px; text-align: center; padding: 30px 20px 40px; }
footer code { font-size: 12px; }
#toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%) translateY(20px);
  background: var(--surface-3); border: 1px solid var(--line-2); color: var(--text);
  padding: 10px 16px; border-radius: 12px; font-size: 13.5px; font-family: var(--mono);
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 60;
  max-width: min(90vw, 720px);
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.ok { border-color: #1f8a46; }
#toast.warn { border-color: var(--unknown); }
#toast.err { border-color: var(--err); }
.keys { color: var(--muted); font-size: 12px; margin-top: 10px; }
.keys kbd { margin-right: 2px; }

/* ---------- responsive ---------- */
@media (max-width: 1240px) {
  .m3sim { grid-template-columns: 1fr; grid-template-areas: "main" "side" "log"; }
  .qa { grid-template-columns: 1fr; }
  .grid-m1 {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "arch scen"
      "lotA lotB"
      "log  log";
  }
  .viewer { grid-template-columns: 1fr; }
  .try { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .wrap { padding: 0 16px; }
  .top { padding: 0 12px; gap: 8px; height: auto; flex-wrap: wrap; padding-bottom: 8px; }
  .brand span { display: none; }
  .tabs { order: 3; width: 100%; margin-left: 0; overflow-x: auto; }
  .tabs a { white-space: nowrap; padding: 5px 10px; }
  .hero { padding: 32px 0 24px; }
  .hero h1 { font-size: 28px; }
  .hero .lede { font-size: 15px; }
  .grid-m1 { grid-template-columns: 1fr; grid-template-areas: "arch" "lotA" "lotB" "scen" "log"; }
  .grid { grid-template-columns: repeat(4, 1fr); }
  .grid-m2 { grid-template-columns: 1fr; }
  .types { grid-template-columns: 1fr; }
  .log-tools input[type=search] { width: 100%; }
  .logwrap { max-height: 300px; }
  table.log { min-width: 760px; }
  .sl label { min-width: 0; }
  .ms-head { grid-template-columns: 1fr; }
}
