/*
 * SysDesign FDE Ops Simulator: StudyTonight embedded stylesheet.
 * Why: styles play.html (.sd root) as a dark NOC ops dashboard
 *      with the shared StudyTonight brand strip (purple #4D38B2 / gold #FFB800).
 * Sections:
 *   01 Tokens & base            09 Hardware drawer (controls, routing, budget)
 *   02 StudyTonight strip       10 Map: LIVE header, SVG nodes/edges, canvas controls
 *   03 .sd grid layout          11 Side telemetry: charts + feed
 *   04 Buttons                  12 Footer, requirement chips
 *   05 Top bar                  13 Overlays, cards, modals (hint, dossier, share)
 *   06 Dropdowns (mode/cloud)   14 Report card, banner, popover
 *   07 Pips, stat pills         15 Mobile nav + responsive breakpoints
 *   08 Metric tiles             16 Reduced motion
 */

/* ── 01 Tokens & base ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0a0c11;
  --pn: #11141b;
  --pn2: #0d1016;
  --pn3: #151a24;
  --ln: #1f2431;
  --ln2: #2a3142;
  --tx: #e6e9f2;
  --tx2: #8a93a8;
  --tx3: #c5cbda;
  --cy: #3ee0d0;
  --pu: #8b7bff;
  --ok: #3ddc97;
  --warn: #ffb547;
  --bad: #ff5c7a;
  --st-purple: #4D38B2;
  --st-purple-soft: #c4b5fd;
  --st-gold: #FFB800;
  --st-strip-h: 40px;
  --r: 12px;
  --r-sm: 8px;
  --ease: cubic-bezier(0.23, 1, 0.32, 1);
  --shadow-pop: 0 20px 50px rgba(0, 0, 0, 0.6);
  --head: "Outfit", "Plus Jakarta Sans", system-ui, sans-serif;
  --sys: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, system-ui, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
}

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--tx);
  font: 13px/1.4 var(--sys);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body.st-embedded { overflow-y: auto; }

button { font: inherit; color: inherit; cursor: pointer; background: none; border: 0; }
button:disabled { cursor: not-allowed; }
a { color: inherit; }
ol, ul { list-style: none; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--cy); outline-offset: 2px; }

.num { font-variant-numeric: tabular-nums; }
.grow { flex: 1; }
.clickable { cursor: pointer; }

@keyframes sd-pulse { 50% { opacity: 0.35; } }
@keyframes st-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.55); }
  50% { box-shadow: 0 0 0 5px rgba(16, 185, 129, 0); }
}
@keyframes sd-in { from { opacity: 0; transform: translateY(6px) scale(0.98); } }
@keyframes sd-hot { 50% { stroke-opacity: 0.4; } }
@keyframes sd-feed-in { from { opacity: 0; transform: translateY(-4px); } }

#confettiCanvas { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1100; }

/* ── 02 StudyTonight brand strip (fixed, 40px) ────────────────────────────── */
.st-strip {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 999;
  height: var(--st-strip-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 16px;
  background: linear-gradient(90deg, #0D111D 0%, #14142B 100%);
  border-bottom: 1px solid rgba(77, 56, 178, 0.35);
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.5);
  font: 600 12px var(--sys);
  color: #e8ecf6;
}

.st-strip-left, .st-strip-right { display: flex; align-items: center; gap: 10px; min-width: 0; }
.st-strip-right { gap: 8px; }

.st-strip-logo {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #fff;
  text-decoration: none;
  font: 700 13px var(--head);
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.st-strip-logo .st-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--st-gold); box-shadow: 0 0 8px rgba(255, 184, 0, 0.6); }
.st-strip-logo span { color: var(--st-gold); }

.st-strip-sep { width: 1px; height: 16px; background: rgba(255, 255, 255, 0.12); }

.st-strip-label { display: flex; align-items: center; gap: 6px; font-size: 11px; color: #8e98af; white-space: nowrap; }
.st-strip-label .st-live { width: 6px; height: 6px; border-radius: 50%; background: #10b981; animation: sd-pulse 1.6s infinite; }

.st-strip-xp {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 10px;
  border-radius: var(--r-sm);
  background: rgba(255, 184, 0, 0.1);
  border: 1px solid rgba(255, 184, 0, 0.3);
  color: var(--st-gold);
  font: 700 11px var(--mono);
  white-space: nowrap;
}

.st-strip-chat-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 10px;
  border-radius: var(--r-sm);
  background: rgba(18, 22, 36, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #fff;
  font: 700 11px var(--sys);
  user-select: none;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.st-strip-chat-btn:hover { background: rgba(77, 56, 178, 0.4); border-color: rgba(77, 56, 178, 0.7); box-shadow: 0 0 10px rgba(77, 56, 178, 0.4); }
.st-chat-pulse { width: 6px; height: 6px; border-radius: 50%; background: #10b981; animation: st-pulse 1.8s infinite; }
.st-chat-icon { font-size: 12px; line-height: 1; }
.st-chat-badge { font: 700 10px var(--mono); color: #10b981; background: rgba(16, 185, 129, 0.14); border: 1px solid rgba(16, 185, 129, 0.25); padding: 1px 6px; border-radius: 6px; }
.st-chat-unread { margin-left: 2px; padding: 1px 5px; border-radius: 999px; background: #f43f5e; color: #fff; font: 800 9px var(--mono); }

.st-strip-back {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: var(--r-sm);
  background: rgba(77, 56, 178, 0.18);
  border: 1px solid rgba(77, 56, 178, 0.4);
  color: var(--st-purple-soft);
  font: 600 11px var(--sys);
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.st-strip-back:hover { background: var(--st-purple); border-color: var(--st-purple); color: #fff; box-shadow: 0 0 14px rgba(77, 56, 178, 0.45); }

/* ── 03 .sd grid layout ───────────────────────────────────────────────────── */
.sd {
  --drawer-w: 300px;
  height: 100vh;
  min-height: 700px;
  display: grid;
  gap: 12px;
  padding: calc(var(--st-strip-h) + 12px) 14px 14px; /* clears the 40px fixed strip */
  grid-template-columns: var(--drawer-w) minmax(0, 1fr) clamp(260px, 23vw, 340px);
  grid-template-rows: auto auto minmax(0, 1fr) 52px;
  grid-template-areas:
    "top top top"
    "tiles tiles tiles"
    "drawer map side"
    "foot foot foot";
  transition: grid-template-columns 0.3s var(--ease);
}
.sd.drawer-collapsed { --drawer-w: 60px; }

.sd > .top { grid-area: top; }
.sd > .tiles { grid-area: tiles; }
.sd > .drawer-wrapper { grid-area: drawer; }
.sd > .map { grid-area: map; }
.sd > .side { grid-area: side; }
.sd > .foot { grid-area: foot; }

.panel { background: var(--pn); border: 1px solid var(--ln); border-radius: var(--r); min-height: 0; min-width: 0; }

/* Section label used by panels, drawer, modals */
.h {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font: 600 11px var(--sys);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--tx2);
}

/* ── 04 Buttons ───────────────────────────────────────────────────────────── */
.btn {
  padding: 10px 18px;
  border-radius: 9px;
  border: 1px solid var(--ln2);
  background: var(--pn);
  font-weight: 600;
  transition: border-color 0.15s, transform 0.1s var(--ease), background 0.15s;
}
.btn:hover:not(:disabled) { border-color: var(--cy); }
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; }
.btn.pri { background: var(--cy); border-color: var(--cy); color: #04110f; }
.btn.pri:hover:not(:disabled) { background: #5ff0e1; }
.btn.hint-btn { border-color: rgba(255, 184, 0, 0.4); color: var(--st-gold); background: rgba(255, 184, 0, 0.06); }
.btn.hint-btn:hover:not(:disabled) { border-color: var(--st-gold); background: rgba(255, 184, 0, 0.12); }

.btn-icon {
  width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  border-radius: 9px;
  border: 1px solid var(--ln);
  background: var(--pn2);
  font-size: 14px;
  line-height: 1;
  transition: border-color 0.15s, background 0.15s, transform 0.1s var(--ease);
}
.btn-icon:hover { border-color: var(--cy); }
.btn-icon:active { transform: scale(0.94); }
.btn-icon.active { border-color: rgba(62, 224, 208, 0.45); background: rgba(62, 224, 208, 0.08); }

/* Labeled tool buttons (Share / Challenge / Explain / Sound) */
.btn-tool {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--ln);
  background: var(--pn2);
  color: var(--tx2);
  font: 600 11px var(--sys);
  white-space: nowrap;
  transition: border-color 0.15s, background 0.15s, color 0.15s, transform 0.1s var(--ease);
}
.btn-tool:hover { border-color: var(--cy); color: var(--tx); background: rgba(62, 224, 208, 0.06); }
.btn-tool:active { transform: scale(0.96); }
.btn-tool.active { border-color: rgba(62, 224, 208, 0.5); background: rgba(62, 224, 208, 0.1); color: var(--cy); }
.btn-tool-ico { font-size: 12px; line-height: 1; }
.btn-tool-label { letter-spacing: 0.02em; }

.btn-brief {
  padding: 7px 12px;
  border-radius: 9px;
  border: 1px solid rgba(139, 123, 255, 0.4);
  background: rgba(139, 123, 255, 0.1);
  color: #cfc8ff;
  font-weight: 600;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
}
.btn-brief:hover { background: rgba(139, 123, 255, 0.2); border-color: var(--pu); }

.close-btn { position: absolute; top: 12px; right: 14px; width: 30px; height: 30px; border-radius: 8px; font-size: 16px; color: var(--tx2); transition: background 0.15s, color 0.15s; }
.close-btn:hover { background: var(--pn3); color: var(--tx); }

/* ── 05 Top bar (mission row + centered tools) ────────────────────────────── */
.sd > .top {
  position: relative;
  z-index: 60; /* dropdown menus must float above tiles and map */
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  padding: 8px 16px 10px;
  background: linear-gradient(90deg, var(--pn), #12141f);
  border: 1px solid var(--ln);
  border-radius: var(--r);
}
.top-main {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  min-height: 40px;
  min-width: 0;
}
.top-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.top-progress {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: nowrap;
  margin-left: auto;
}
.top-tools {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  width: 100%;
  padding-top: 2px;
  border-top: 1px solid var(--ln);
}
.top-sep { width: 1px; height: 20px; background: var(--ln2); }

.brand { display: flex; align-items: center; gap: 10px; font: 800 15px var(--head); letter-spacing: 0.08em; white-space: nowrap; }
.brand i { width: 10px; height: 10px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 10px var(--ok); animation: sd-pulse 1.6s infinite; }
.brand span { color: var(--cy); }
.sd.boss .brand i { background: var(--bad); box-shadow: 0 0 12px var(--bad); }

.case-badge { max-width: clamp(140px, 22vw, 320px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--tx2); }
.case-badge b { color: var(--tx); font-weight: 600; }

.rank-badge-btn {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 184, 0, 0.3);
  background: rgba(255, 184, 0, 0.07);
  color: var(--tx2);
  white-space: nowrap;
  transition: border-color 0.15s, background 0.15s;
}
.rank-badge-btn:hover { border-color: var(--st-gold); background: rgba(255, 184, 0, 0.14); }
.rank-badge-btn b { color: var(--tx); }
.rank-badge-btn .stars-num { color: var(--st-gold); font: 700 12px var(--mono); }

.timer { display: none; padding: 5px 10px; border-radius: 6px; background: var(--bad); color: #fff; font: 700 14px var(--mono); }
.sd.boss .timer { display: inline-block; animation: sd-pulse 1s infinite; }

/* ── 06 Dropdowns: game mode + cloud provider ─────────────────────────────── */
.mode-dropdown-wrap, .cloud-dropdown-wrap { position: relative; }

.mode-drop-btn, .cloud-drop-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 9px;
  border: 1px solid var(--ln2);
  background: var(--pn2);
  font-weight: 600;
  white-space: nowrap;
  transition: border-color 0.15s, background 0.15s;
}
.mode-drop-btn:hover, .cloud-drop-btn:hover { border-color: var(--cy); }

.prov-dot { width: 8px; height: 8px; border-radius: 50%; background: #ff9900; box-shadow: 0 0 8px currentColor; color: #ff9900; }
.cloud-drop-btn[data-prov="gcp"] .prov-dot { background: #4285f4; color: #4285f4; }
.cloud-drop-btn[data-prov="azure"] .prov-dot { background: #0078d4; color: #0078d4; }
.cloud-drop-btn[data-prov="digitalocean"] .prov-dot { background: #0080ff; color: #0080ff; }

.mode-menu, .cloud-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 70;
  display: none;
  min-width: 270px;
  padding: 6px;
  border-radius: var(--r);
  border: 1px solid var(--ln2);
  background: #161a23;
  box-shadow: var(--shadow-pop);
}
.mode-menu.open, .cloud-menu.open { display: grid; gap: 2px; animation: sd-in 0.15s var(--ease); }

.mode-opt, .cloud-opt { display: grid; gap: 2px; padding: 9px 11px; border-radius: 9px; border: 1px solid transparent; cursor: pointer; transition: background 0.12s, border-color 0.12s; }
.mode-opt:hover, .cloud-opt:hover { background: var(--pn3); }
.mode-opt b, .cloud-opt b { font-size: 13px; font-weight: 600; }
.mode-opt span, .cloud-opt span { font-size: 11px; color: var(--tx2); }
.mode-opt.active, .cloud-opt.active { background: rgba(62, 224, 208, 0.08); border-color: rgba(62, 224, 208, 0.35); }
.mode-opt.active b, .cloud-opt.active b { color: var(--cy); }

/* ── 07 Stage pips + level/streak pill ────────────────────────────────────── */
.pips { display: flex; gap: 6px; }
.pip { min-width: 26px; padding: 3px 8px; border-radius: 999px; border: 1px solid var(--ln2); color: var(--tx2); font: 600 11px var(--sys); text-align: center; cursor: pointer; transition: border-color 0.15s, color 0.15s; }
.pip:hover { border-color: var(--cy); }
.pip.on { border-color: var(--cy); color: var(--tx); background: rgba(62, 224, 208, 0.08); }
.pip.done { color: var(--ok); border-color: rgba(61, 220, 151, 0.4); }
.pip.on.done { border-color: var(--ok); }

.stat-pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--ln2); background: var(--pn2); color: var(--tx2); white-space: nowrap; }
.stat-pill .xp-txt { color: var(--cy); font: 700 12px var(--mono); }
.stat-pill .streak-txt { color: var(--warn); font: 700 12px var(--mono); }

/* ── 08 Metric tiles ──────────────────────────────────────────────────────── */
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)) minmax(0, 1.7fr); gap: 12px; }
.tile { padding: 11px 16px; transition: border-color 0.2s, box-shadow 0.2s, transform 0.12s var(--ease); }
.tile.clickable:hover { border-color: rgba(62, 224, 208, 0.45); }
.tile.clickable:active { transform: scale(0.99); }
.tile .k { font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--tx2); }
.tile .v { margin-top: 3px; font: 700 26px/1.2 var(--head); font-variant-numeric: tabular-nums; }
.tile .t { font-size: 12px; color: var(--tx2); }
.tile.pass .t { color: var(--ok); }
.tile.pass .t::before { content: "✓ "; }
.tile.fail { border-color: rgba(255, 92, 122, 0.5); box-shadow: inset 0 0 30px rgba(255, 92, 122, 0.12); }
.tile.fail .v, .tile.fail .t { color: var(--bad); }
.tile.fail .t::before { content: "✗ "; }

.tile.brief { background: linear-gradient(135deg, rgba(77, 56, 178, 0.14), var(--pn)); border-color: rgba(77, 56, 178, 0.35); }
.tile.brief .k { color: var(--cy); }
.tile.brief .v {
  font: 500 13.5px/1.45 var(--sys);
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
}
.sd.boss .tile.brief { border-color: var(--bad); background: linear-gradient(135deg, #2a0d14, var(--pn)); }
.sd.boss .tile.brief .k { color: #ffb3c0; }

/* ── 09 Hardware drawer (foldable) ────────────────────────────────────────── */
.drawer-wrapper { position: relative; display: flex; flex-direction: column; }

.drawer-toggle {
  position: absolute;
  top: 50%;
  right: -13px;
  z-index: 5;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--ln2);
  background: var(--pn3);
  color: var(--tx2);
  font-size: 16px;
  line-height: 1;
  transform: translateY(-50%);
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.drawer-toggle:hover { border-color: var(--cy); color: var(--cy); background: var(--pn); }

.design { flex: 1; min-height: 0; padding: 14px; display: flex; flex-direction: column; gap: 6px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--ln2) transparent; }
.design > .h { margin-bottom: 4px; }
.design > .h span:last-child { color: var(--cy); }

.grp { margin: 12px 0 2px; font: 600 11px var(--sys); letter-spacing: 0.12em; text-transform: uppercase; color: var(--tx2); }

.ctl { padding: 9px 10px; border-radius: 10px; border: 1px solid var(--ln); background: var(--pn2); animation: sd-in 0.2s var(--ease); transition: border-color 0.15s; }
.ctl:hover { border-color: var(--ln2); }
.ctl .row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.ctl .lbl { font-weight: 600; }
.ctl .note { margin-top: 3px; font-size: 11px; color: var(--tx2); line-height: 1.4; }
.ctl input[type="range"] { width: 100%; margin-top: 6px; accent-color: var(--cy); }

.seg { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--ln2); border-radius: var(--r-sm); overflow: hidden; }
.seg button { padding: 5px 9px; font: 600 11px var(--mono); color: var(--tx2); transition: background 0.12s, color 0.12s; }
.seg button:hover:not(.on) { background: var(--pn3); color: var(--tx); }
.seg button.on { background: var(--cy); color: #04110f; }

.step { display: inline-flex; align-items: center; gap: 2px; }
.step button { width: 26px; height: 26px; border-radius: 7px; border: 1px solid var(--ln2); font-weight: 700; transition: border-color 0.12s, opacity 0.12s; }
.step button:hover:not(:disabled) { border-color: var(--cy); }
.step button:disabled { opacity: 0.3; }
.step span { min-width: 26px; text-align: center; font: 700 14px var(--mono); }

.tog { position: relative; flex: none; width: 38px; height: 22px; border-radius: 999px; background: var(--ln2); transition: background 0.15s; }
.tog::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform 0.15s var(--ease); }
.tog.on { background: var(--cy); }
.tog.on::after { transform: translateX(16px); }

/* Network routing box: delink/relink each wire */
.routing-box { margin-top: 8px; padding: 10px; border-radius: 10px; border: 1px solid rgba(139, 123, 255, 0.28); background: rgba(139, 123, 255, 0.05); }
.routing-header { margin-bottom: 8px; font: 600 10.5px var(--sys); letter-spacing: 0.1em; text-transform: uppercase; color: var(--pu); }
.routing-links { display: grid; gap: 5px; max-height: 170px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--ln2) transparent; }
.routing-link-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 5px 8px; border-radius: 8px; border: 1px solid var(--ln); background: var(--pn2); font: 500 11.5px var(--mono); transition: border-color 0.15s; }
.routing-link-item > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.routing-link-item.disconnected { border-color: rgba(255, 92, 122, 0.4); background: rgba(255, 92, 122, 0.06); }
.routing-link-item.disconnected > span { color: var(--bad); text-decoration: line-through; text-decoration-color: rgba(255, 92, 122, 0.6); }

.delink-btn, .relink-btn { flex: none; padding: 3px 9px; border-radius: 7px; font: 600 11px var(--sys); white-space: nowrap; transition: background 0.12s, color 0.12s; }
.delink-btn { border: 1px solid rgba(255, 92, 122, 0.45); color: var(--bad); background: rgba(255, 92, 122, 0.08); }
.delink-btn:hover { background: var(--bad); color: #1a0509; }
.relink-btn { border: 1px solid rgba(61, 220, 151, 0.45); color: var(--ok); background: rgba(61, 220, 151, 0.08); }
.relink-btn:hover { background: var(--ok); color: #04150d; }

.upcoming-box { margin-top: 6px; padding: 9px 11px; border-radius: 10px; border: 1px dashed var(--ln2); color: var(--tx2); font-size: 11.5px; line-height: 1.5; }
.upcoming-box b { display: block; margin-bottom: 2px; color: var(--st-gold); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; }

.budget { margin-top: auto; padding-top: 10px; cursor: pointer; }
.budget .row.h { margin: 0; }
.budget .bar { height: 6px; margin-top: 6px; border-radius: 3px; background: #222938; overflow: hidden; }
.budget .bar i { display: block; height: 100%; background: var(--ok); transition: width 0.3s var(--ease), background 0.2s; }
.budget.over .bar i { background: var(--bad); }
.budget.over .num { color: var(--bad); }

.sd.running .design .ctl,
.sd.running .design .routing-box { pointer-events: none; opacity: 0.65; }

/* Collapsed rail (hidden until .drawer-collapsed) */
.collapsed-bar { display: none; flex-direction: column; align-items: center; gap: 10px; padding: 14px 0; }
.collapsed-expand-btn, .collapsed-bar-item { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; border: 1px solid var(--ln); background: var(--pn2); font-size: 16px; cursor: pointer; transition: border-color 0.15s, background 0.15s; }
.collapsed-expand-btn { color: var(--cy); font-size: 18px; border-color: rgba(62, 224, 208, 0.35); }
.collapsed-expand-btn:hover, .collapsed-bar-item:hover { border-color: var(--cy); background: var(--pn3); }

.sd.drawer-collapsed .design,
.sd.drawer-collapsed .drawer-toggle { display: none; }
.sd.drawer-collapsed .collapsed-bar { display: flex; }

/* ── 10 Map: LIVE topology header, SVG canvas, controls ───────────────────── */
.map { position: relative; display: flex; flex-direction: column; overflow: hidden; transition: border-color 0.3s, box-shadow 0.3s; }
.sd.running .map { border-color: rgba(62, 224, 208, 0.45); box-shadow: 0 0 24px rgba(62, 224, 208, 0.08); }

.map > .h {
  margin: 0;
  padding: 11px 16px;
  background: linear-gradient(90deg, rgba(62, 224, 208, 0.07), transparent 60%);
  border-bottom: 1px solid var(--ln);
}
.map > .h > span:first-child { display: flex; align-items: center; gap: 10px; min-width: 0; color: var(--tx3); }
.map > .h > span:first-child::before {
  content: "LIVE";
  flex: none;
  padding: 2px 8px 2px 18px;
  border-radius: 999px;
  border: 1px solid rgba(61, 220, 151, 0.4);
  background:
    radial-gradient(circle at 9px 50%, var(--ok) 0 3px, transparent 4px),
    rgba(61, 220, 151, 0.1);
  color: var(--ok);
  font: 800 10px var(--mono);
  letter-spacing: 0.14em;
  animation: sd-pulse 2s infinite;
}
.sd.boss .map > .h > span:first-child::before { border-color: rgba(255, 92, 122, 0.5); background: radial-gradient(circle at 9px 50%, var(--bad) 0 3px, transparent 4px), rgba(255, 92, 122, 0.1); color: var(--bad); }

.legend { display: flex; flex-wrap: wrap; gap: 14px; text-transform: none; letter-spacing: 0.02em; font-size: 11px; }
.legend span { display: inline-flex; align-items: center; }
.legend i { display: inline-block; width: 8px; height: 8px; margin-right: 5px; border-radius: 50%; }

.map svg[data-topo] {
  flex: 1;
  width: 100%;
  min-height: 0;
  cursor: grab;
  touch-action: none;
  user-select: none;
  background:
    radial-gradient(circle at 1px 1px, rgba(138, 147, 168, 0.13) 1px, transparent 0) 0 0 / 22px 22px,
    var(--pn2);
}
.map svg[data-topo].panning { cursor: grabbing; }

/* Edges: click to remove (wire disappears; reconnect via port drag) */
.edge-hit {
  fill: none;
  stroke: transparent;
  stroke-width: 18;
  stroke-linecap: round;
  cursor: pointer;
  pointer-events: stroke;
}
.edge {
  fill: none;
  stroke: #7a849c;
  stroke-width: 3.5;
  stroke-linecap: round;
  pointer-events: none;
  transition: stroke 0.15s, stroke-width 0.15s;
}
.edge-hit:hover { stroke: rgba(62, 224, 208, 0.14); }
g.edges path.edge-hit:hover + path.edge { stroke: var(--cy); stroke-width: 4.5; }
.edge.dead { stroke-dasharray: 6 6; opacity: 0.5; }
.wire-ghost {
  fill: none;
  stroke: var(--cy);
  stroke-width: 3;
  stroke-dasharray: 6 6;
  pointer-events: none;
  opacity: 0.9;
}
.port {
  fill: var(--cy);
  stroke: #04110f;
  stroke-width: 2;
  cursor: crosshair;
  pointer-events: all;
  transition: r 0.12s, filter 0.12s;
}
.port:hover { filter: drop-shadow(0 0 8px rgba(62, 224, 208, 0.8)); }

/* Traffic dots flowing along edges */
.flow circle { r: 3.4; pointer-events: none; }
.dot { r: 3.4; }
.dot.s-ok { fill: var(--ok); }
.dot.s-warn { fill: var(--warn); }
.dot.s-hot { fill: var(--bad); }

/* Node cards (190x68): icon + title, subtitle, status value, load bar */
.node { --kind: var(--tx2); color: var(--kind); cursor: grab; }
.node[data-id="users"] { --kind: #8e98af; }
.node[data-id="cdn"] { --kind: #d6e36b; }
.node[data-id="lb"] { --kind: #3ee0d0; }
.node[data-id^="app"] { --kind: #8b7bff; }
.node[data-id="cache"] { --kind: #ffb547; }
.node[data-id="db"], .node[data-id^="rep"] { --kind: #3ddc97; }
.node[data-id="queue"] { --kind: #ff8fb1; }
.node[data-id="worker"] { --kind: #c3e36b; }
.node[data-id="search"] { --kind: #9ad0ff; }

.node rect.box { fill: var(--pn3); stroke: var(--ln2); stroke-width: 1.5; transition: stroke 0.2s, filter 0.2s; }
.node:hover rect.box { stroke: var(--kind); }
.node.dragging { cursor: grabbing; }
.node.dragging rect.box { stroke: var(--cy); filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.55)); }

.node text { stroke: none; }
.node .title-txt { fill: var(--tx); font: 600 13px var(--head); }
.node .sub-txt { fill: var(--tx2); font: 500 10px var(--sys); letter-spacing: 0.04em; text-transform: uppercase; }
.node .val-txt { fill: var(--tx); font: 600 10.5px var(--mono); }
.node .track { fill: #222938; }
.node .bar { fill: var(--ok); transition: width 0.2s linear, fill 0.2s; }

.node[data-state="ok"] rect.box { stroke: rgba(61, 220, 151, 0.45); }
.node[data-state="warn"] rect.box { stroke: var(--warn); }
.node[data-state="warn"] .bar { fill: var(--warn); }
.node[data-state="hot"] rect.box { stroke: var(--bad); filter: drop-shadow(0 0 10px rgba(255, 92, 122, 0.75)); animation: sd-hot 0.9s infinite; }
.node[data-state="hot"] .bar { fill: var(--bad); }
.node[data-state="dead"] { opacity: 0.45; }
.node[data-state="dead"] .val-txt { fill: var(--bad); }
.node.promoted rect.box { stroke: var(--cy); filter: drop-shadow(0 0 8px rgba(62, 224, 208, 0.5)); }
.node.promoted .val-txt { fill: var(--cy); }

/* Floating zoom + layout toolbar */
.canvas-controls {
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border-radius: 10px;
  border: 1px solid var(--ln2);
  background: rgba(17, 20, 27, 0.92);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}
.canvas-btn { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 7px; font-size: 15px; line-height: 1; color: var(--tx3); transition: background 0.12s, color 0.12s; }
.canvas-btn:hover { background: var(--pn3); color: var(--cy); }
.canvas-btn:active { transform: scale(0.92); }
.canvas-zoom-val { min-width: 44px; text-align: center; font: 700 11px var(--mono); color: var(--tx2); }

/* ── 11 Side telemetry: charts + feed ─────────────────────────────────────── */
.side { display: grid; grid-template-rows: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.4fr); gap: 12px; min-height: 0; }
.side .panel { display: flex; flex-direction: column; padding: 12px 14px; overflow: hidden; }
.side .h { margin-bottom: 8px; }
.side .h span:last-child { color: var(--tx3); font: 600 10.5px var(--mono); letter-spacing: 0.04em; text-transform: none; }
.side canvas { display: block; flex: 1 1 0; width: 100%; height: 0; min-height: 50px; }

.feed { flex: 1; min-height: 0; overflow: hidden; font: 12px/1.45 var(--mono); }
.feed li { display: flex; gap: 10px; padding: 5px 0; border-bottom: 1px dashed var(--ln); color: var(--tx2); }
.feed li:first-child { animation: sd-feed-in 0.25s var(--ease); }
.feed li > span { flex: none; min-width: 42px; color: #5d6780; }
.feed li b { min-width: 0; font-weight: 600; color: var(--tx); overflow-wrap: anywhere; }
.feed .lvl-bad b { color: var(--bad); }
.feed .lvl-ok b { color: var(--ok); }
.feed .lvl-hint b { color: var(--warn); }
.feed .lvl-info b { color: var(--cy); }

/* ── 12 Footer + requirement chips ────────────────────────────────────────── */
.foot { display: flex; align-items: center; gap: 12px; color: var(--tx2); min-width: 0; }
.foot > span:first-child { flex: none; font: 600 11px var(--sys); letter-spacing: 0.1em; text-transform: uppercase; }
.foot .btn { padding: 11px 20px; }
.foot .btn.pri { font-family: var(--head); font-size: 14px; box-shadow: 0 0 18px rgba(62, 224, 208, 0.25); }

.reqs { display: flex; flex-wrap: wrap; gap: 8px; min-width: 0; }
.req { padding: 5px 11px; border-radius: 999px; border: 1px solid var(--ln2); background: var(--pn); color: var(--tx); font-size: 12px; white-space: nowrap; }

/* ── 13 Overlays, cards, modals ───────────────────────────────────────────── */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: none;
  place-items: center;
  padding: 16px;
  overflow: auto;
  background: rgba(5, 7, 10, 0.74);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
body.st-embedded .overlay { top: var(--st-strip-h); }
.overlay.on { display: grid; }

.card {
  position: relative;
  width: min(600px, 94vw);
  max-height: calc(100vh - var(--st-strip-h) - 32px);
  overflow-y: auto;
  padding: 24px;
  border-radius: 16px;
  border: 1px solid var(--ln);
  background: var(--pn);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  animation: sd-in 0.25s var(--ease);
  scrollbar-width: thin;
  scrollbar-color: var(--ln2) transparent;
}
.card h2 { margin: 6px 0 10px; font: 700 24px/1.2 var(--head); }
.card p { color: var(--tx3); font-size: 14px; line-height: 1.55; }
.card .eyebrow { font: 600 11px var(--sys); letter-spacing: 0.14em; text-transform: uppercase; color: var(--cy); }
.card.boss { border-color: rgba(255, 92, 122, 0.5); }
.card.boss .eyebrow { color: var(--bad); }
.card .chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0; }
.card .chip { padding: 5px 10px; border-radius: 999px; background: rgba(62, 224, 208, 0.12); color: var(--cy); font: 600 12px var(--sys); }
.card .reqs { margin: 8px 0 4px; }
.card .acts { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; margin-top: 18px; }

.eli5-box { margin: 14px 0; padding: 11px 14px; border-radius: 10px; border: 1px solid rgba(255, 184, 0, 0.25); background: rgba(255, 184, 0, 0.06); color: var(--tx3); font-size: 13.5px; line-height: 1.55; }
.eli5-box b { display: block; margin-bottom: 3px; color: var(--st-gold); font-size: 12px; letter-spacing: 0.04em; }

.scripted { margin-top: 10px; padding: 8px 12px; border-left: 3px solid var(--bad); border-radius: 4px; background: rgba(255, 92, 122, 0.08); color: #ffd4dc !important; }

/* Hint modal */
.hint-modal-card { width: min(520px, 94vw); border-color: rgba(77, 56, 178, 0.45); }
.hint-header { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; padding-right: 36px; }
.hint-badge { padding: 4px 10px; border-radius: 999px; background: rgba(77, 56, 178, 0.25); border: 1px solid rgba(77, 56, 178, 0.5); color: var(--st-purple-soft); font: 700 11px var(--sys); }
.ad-badge { padding: 4px 10px; border-radius: 999px; background: rgba(255, 184, 0, 0.1); border: 1px solid rgba(255, 184, 0, 0.3); color: var(--st-gold); font: 700 10.5px var(--mono); letter-spacing: 0.06em; }

/* ELI5 tutorial perks */
.ad-perk { display: grid; grid-template-columns: 40px 1fr; gap: 12px; align-items: start; padding: 11px 13px; border-radius: 12px; border: 1px solid var(--ln); background: var(--pn2); }
.ad-perk-icon { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 10px; background: var(--pn3); font-size: 20px; }
.ad-perk h4 { margin-bottom: 2px; font: 600 14px var(--head); }
.ad-perk p { font-size: 13px; line-height: 1.5; }

/* Share + challenge modals */
.challenge-card { width: min(520px, 94vw); }
.share-preview { margin: 14px 0; padding: 13px 15px; border-radius: 12px; border: 1px solid rgba(77, 56, 178, 0.4); background: linear-gradient(135deg, rgba(77, 56, 178, 0.16), var(--pn2)); }
.share-preview-head { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 10px; font: 600 14px var(--head); }
.share-preview-head span:last-child { color: var(--st-gold); letter-spacing: 2px; }
.share-preview-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.share-metric { padding: 8px 10px; border-radius: 9px; background: var(--pn); border: 1px solid var(--ln); }
.share-metric span { display: block; font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--tx2); }
.share-metric b { display: block; margin-top: 2px; font: 700 14px var(--mono); }

.copy-input-group { display: flex; gap: 8px; margin: 14px 0; }
.copy-input { flex: 1; min-width: 0; padding: 10px 12px; border-radius: 9px; border: 1px solid var(--ln2); background: var(--pn2); color: var(--tx); font: 12px var(--mono); }
.copy-input:focus { outline: none; border-color: var(--cy); }

.share-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.share-btn { flex: 1; min-width: 100px; padding: 10px 14px; border-radius: 9px; border: 1px solid var(--ln2); text-align: center; font-weight: 600; text-decoration: none; transition: transform 0.1s var(--ease), filter 0.15s; }
.share-btn:hover { filter: brightness(1.15); }
.share-btn:active { transform: scale(0.97); }
.share-btn.wa { background: rgba(37, 211, 102, 0.14); border-color: rgba(37, 211, 102, 0.5); color: #4ee38a; }
.share-btn.li { background: rgba(10, 102, 194, 0.18); border-color: rgba(10, 102, 194, 0.6); color: #6db3f2; }
.share-btn.x { background: rgba(255, 255, 255, 0.06); color: var(--tx); }

/* Career dossier modal (radar + skill matrix) */
.query-noir-modal { width: min(780px, 95vw); }
.qn-eyebrow { font: 600 11px var(--sys); letter-spacing: 0.14em; text-transform: uppercase; color: #ff5e1a; }
.qn-title { margin: 6px 0 16px; padding-right: 36px; font: 700 24px/1.2 var(--head); }
.qn-hero { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 20px; align-items: center; padding: 16px; border-radius: 14px; border: 1px solid var(--ln); background: var(--pn2); }
.qn-radar-box { display: grid; place-items: center; }
.qn-big-score { display: flex; align-items: baseline; gap: 6px; }
.qn-big-score b { font: 800 56px/1 var(--head); color: #ff5e1a; }
.qn-big-score span { color: var(--tx2); font-size: 16px; }
.qn-sub-rank { margin: 4px 0 12px; color: var(--tx3); font-size: 13px; }
.qn-stat-grid { display: grid; gap: 4px; }
.qn-stat-row { display: flex; justify-content: space-between; gap: 10px; padding: 5px 0; border-bottom: 1px dashed var(--ln); font-size: 13px; }
.qn-stat-row span { color: var(--tx2); }
.qn-stat-row b { font-family: var(--mono); }
.qn-signin-note { margin-top: 10px; color: var(--tx2); font-size: 12px; line-height: 1.5; }

.qn-skills-section { display: grid; gap: 10px; margin: 16px 0; }
.qn-tier-row { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 12px; align-items: start; }
.qn-tier-label { padding: 5px 10px; border-radius: 8px; border: 1px solid var(--ln2); font: 700 11px var(--sys); letter-spacing: 0.06em; text-align: center; text-transform: uppercase; }
.qn-tier-label.intern { color: #8e98af; }
.qn-tier-label.junior { color: var(--cy); border-color: rgba(62, 224, 208, 0.4); }
.qn-tier-label.senior { color: var(--pu); border-color: rgba(139, 123, 255, 0.4); }
.qn-tier-label.staff { color: var(--st-gold); border-color: rgba(255, 184, 0, 0.4); }
.qn-tier-label.principal { color: #ff5e1a; border-color: rgba(255, 94, 26, 0.5); }
.qn-tags-wrap { display: flex; flex-wrap: wrap; gap: 6px; }
.qn-skill-tag { padding: 4px 10px; border-radius: 999px; border: 1px solid var(--ln2); color: #5d6780; font: 600 11.5px var(--sys); }
.qn-skill-tag.mastered { border-color: rgba(61, 220, 151, 0.4); background: rgba(61, 220, 151, 0.08); color: var(--ok); }

.qn-bottom-acts { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }
.qn-btn-secondary, .qn-btn-orange { padding: 10px 16px; border-radius: 9px; font-weight: 600; transition: filter 0.15s, transform 0.1s var(--ease), border-color 0.15s; }
.qn-btn-secondary { border: 1px solid var(--ln2); background: var(--pn2); }
.qn-btn-secondary:hover { border-color: var(--cy); }
.qn-btn-orange { background: #ff5e1a; color: #fff; border: 1px solid #ff5e1a; }
.qn-btn-orange:hover { filter: brightness(1.1); }
.qn-btn-secondary:active, .qn-btn-orange:active { transform: scale(0.97); }

/* ── 14 Report card, banner, popover ──────────────────────────────────────── */
.report { position: absolute; top: 58px; right: 16px; z-index: 5; display: none; width: min(410px, 92%); max-height: calc(100% - 74px); overflow-y: auto; }
.report.on { display: block; }
.report .card { width: 100%; max-height: none; padding: 18px; }
.report h2 { font-size: 22px; }
.report.pass .card { border-color: rgba(61, 220, 151, 0.45); box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6), 0 0 28px rgba(61, 220, 151, 0.12); }
.report.fail .card { border-color: rgba(255, 92, 122, 0.45); box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6), 0 0 28px rgba(255, 92, 122, 0.12); }
.report.pass .eyebrow { color: var(--ok); }
.report.fail .eyebrow { color: var(--bad); }

.checks { margin: 10px 0; }
.checks li { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px dashed var(--ln); font-size: 13px; }
.checks li span:last-child { font-family: var(--mono); white-space: nowrap; }
.checks small { color: var(--tx2); }
.checks .ok span:last-child { color: var(--ok); }
.checks .no span:last-child { color: var(--bad); }

.stars { color: var(--warn); font-size: 22px; letter-spacing: 4px; }
.stars s { color: var(--ln2); text-decoration: none; }

.tips { display: grid; gap: 6px; margin-top: 10px; }
.tips p { padding: 7px 10px; border-left: 3px solid var(--warn); border-radius: 4px; background: rgba(255, 181, 71, 0.08); font-size: 13px; }
.tips p.lesson { border-color: var(--ok); background: rgba(61, 220, 151, 0.08); }

.banner { position: absolute; top: 58px; left: 50%; z-index: 4; display: none; padding: 9px 16px; border-radius: 9px; border: 1px solid var(--bad); background: #3a0f18; color: #ffd4dc; font-weight: 600; text-align: center; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); transform: translateX(-50%); animation: sd-pulse 1.2s 2; }
.banner.on { display: block; }

.pop { position: fixed; z-index: 950; display: none; width: 320px; max-width: calc(100vw - 32px); padding: 14px; border-radius: var(--r); border: 1px solid var(--ln2); background: #161a23; box-shadow: var(--shadow-pop); font-size: 13px; }
.pop.on { display: block; animation: sd-in 0.15s var(--ease); }
.pop > b { display: block; margin-bottom: 6px; font-family: var(--head); font-size: 14px; }
.pop ul { margin: 6px 0; }
.pop li { display: flex; justify-content: space-between; gap: 10px; padding: 5px 0; border-bottom: 1px dashed var(--ln); font-variant-numeric: tabular-nums; }
.pop li.top { color: var(--warn); font-weight: 600; }
.pop p { margin-top: 6px; color: var(--tx3); line-height: 1.5; }
.pop p.bad { color: var(--bad); }

/* ── 15 Mobile nav + responsive ───────────────────────────────────────────── */
.mobile-nav-bar { display: none; }

@media (max-width: 1280px) {
  .sd { --drawer-w: 270px; }
  .sd > .top, .top-main, .top-left { gap: 8px; }
  .top-progress { gap: 8px; }
  .pips { display: none; }
  .tile .v { font-size: 22px; }
}

@media (max-width: 1024px), (max-height: 699px) {
  body.st-embedded { overflow-y: auto; }
  .sd, .sd.drawer-collapsed {
    height: auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: calc(var(--st-strip-h) + 10px) 10px 130px;
  }
  .sd { transition: none; }

  .sd > .top { gap: 6px; padding: 8px 12px; }
  .top-main { flex-wrap: wrap; gap: 8px; align-items: flex-start; }
  .top-left { flex-wrap: wrap; gap: 8px; }
  .top-sep, .case-badge, .pips { display: none; }
  .grow { display: none; }
  .top-progress { margin-left: auto; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
  .top-tools { justify-content: center; gap: 6px; }
  .btn-tool { height: 26px; padding: 0 8px; font-size: 10px; }

  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .tile.brief { grid-column: 1 / -1; }

  /* One panel visible at a time, switched by .tab-*-active */
  .sd .drawer-wrapper, .sd .map, .sd .side { display: none; }
  .sd.tab-map-active .map { display: flex; min-height: 62vh; }
  .sd.tab-hardware-active .drawer-wrapper { display: flex; }
  .sd.tab-telemetry-active .side { display: grid; grid-template-rows: 170px 170px 260px; }

  .drawer-toggle, .collapsed-bar { display: none !important; }
  .sd.drawer-collapsed .design { display: flex; }
  .design { overflow: visible; }

  .legend { display: none; }
  .report { position: fixed; top: auto; right: 10px; bottom: 126px; left: 10px; width: auto; max-height: 55vh; z-index: 800; }
  .banner { top: 50px; max-width: 92%; }

  .foot {
    position: sticky;
    bottom: 56px;
    z-index: 40;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 -10px;
    padding: 8px 10px;
    border-top: 1px solid var(--ln);
    background: rgba(10, 12, 17, 0.96);
  }
  .foot > span:first-child { display: none; }
  .foot .reqs { flex-wrap: nowrap; overflow-x: auto; width: 100%; padding-bottom: 2px; scrollbar-width: none; }
  .foot .grow { display: none; }
  .foot .btn { flex: 1; }

  .mobile-nav-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 900;
    display: flex;
    height: 56px;
    border-top: 1px solid var(--ln2);
    background: rgba(13, 16, 22, 0.97);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
  }
  .m-nav-tab { flex: 1; display: grid; place-items: center; color: var(--tx2); font: 600 12px var(--sys); border-top: 2px solid transparent; transition: color 0.15s, background 0.15s; }
  .m-nav-tab.active { color: var(--cy); border-top-color: var(--cy); background: rgba(62, 224, 208, 0.06); }

  .qn-hero { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .qn-tier-row { grid-template-columns: 1fr; gap: 6px; }
  .qn-tier-label { justify-self: start; }
}

@media (max-width: 640px) {
  .st-strip { padding: 0 10px; }
  .st-strip-sep, .st-strip-label, .st-chat-text, .st-chat-badge { display: none; }
  .st-strip-back { padding: 5px 9px; }
  .brand { font-size: 13px; }
  .btn-brief { padding: 7px 9px; }
  .rank-badge-btn { padding: 6px 9px; }
  .tile .v { font-size: 20px; }
  .card { padding: 18px; }
  .card h2, .qn-title { font-size: 20px; }
  .share-preview-grid { grid-template-columns: 1fr; }
  .copy-input-group { flex-direction: column; }
  .mode-menu, .cloud-menu { min-width: min(270px, calc(100vw - 32px)); }
}

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

/* Selection declutter */
.design-tip{font-size:12px;color:var(--tx2);line-height:1.45;margin:0 0 12px;padding:10px 12px;background:var(--pn2);border:1px dashed var(--ln);border-radius:10px}
.design .sd-x,.routing-header .sd-x{margin-left:auto;width:28px;height:28px;border-radius:8px;border:1px solid var(--ln);background:var(--pn2);color:var(--tx2);font-size:16px;line-height:1}
.design .sd-x:hover,.routing-header .sd-x:hover{border-color:var(--cy);color:var(--tx)}
.routing-header{display:flex;align-items:center;gap:8px;margin-bottom:8px}
.node.sel rect,.node.sel>rect:first-child{stroke:var(--cy)!important;stroke-width:2.5!important;filter:drop-shadow(0 0 8px rgba(62,224,208,.35))}
.edge.sel{stroke:var(--cy)!important;stroke-width:4.5!important}
.edge-hit.sel{stroke:rgba(62,224,208,.18)}
