/* Spotify Azure DE Visualizer — Iteration 0/1
   Pure CSS, no framework. Theme aligned with the NewVisual monorepo. */

:root {
  --bg-0: #07090f;
  --bg-1: #0c1220;
  --bg-2: #111827;
  --bg-3: #16203400;
  --panel: #0e1626;
  --border: #1e2d42;
  --border-2: #27384f;
  --text: #e2e8f4;
  --muted: #8a9ab8;
  --faint: #61708d;
  --brand: #1DB954;      /* Spotify green */
  --brand2: #22D3EE;     /* cyan accent  */
  --blue: #3B82F6;
  --amber: #F59E0B;
  --red: #ef4444;
  --violet: #a78bfa;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  --mono: "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --shadow: 0 12px 40px rgba(0,0,0,.5);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  background: radial-gradient(1400px 700px at 60% -10%, #0d1524, var(--bg-0));
  color: var(--text);
  font-family: var(--font);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

a { color: var(--brand2); text-decoration: none; }
code, .mono { font-family: var(--mono); }

/* ---------- Top bar ---------- */
header.appbar {
  display: flex; align-items: center; gap: 16px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  background: rgba(9,13,22,.85);
  backdrop-filter: blur(8px);
  z-index: 20;
}
.brand-mark { display: flex; align-items: center; gap: 11px; }
.brand-mark .dot {
  width: 30px; height: 30px; border-radius: 9px; flex: none;
  background: linear-gradient(135deg, var(--brand), #128a3e);
  display: grid; place-items: center; font-size: 17px;
  box-shadow: 0 0 0 1px rgba(29,185,84,.35), 0 6px 18px rgba(29,185,84,.25);
}
.brand-mark h1 { font-size: 15px; font-weight: 700; letter-spacing: .2px; line-height: 1.15; }
.brand-mark .sub { font-size: 11px; color: var(--muted); font-weight: 500; }
.appbar .spacer { flex: 1; }
.appbar .homelink { font-size: 12.5px; color: var(--muted); border: 1px solid var(--border); padding: 6px 12px; border-radius: 8px; }
.appbar .homelink:hover { border-color: var(--brand); color: var(--text); }
.appbar .search {
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); padding: 7px 12px; width: 210px; font-size: 13px; font-family: var(--font);
}
.appbar .search::placeholder { color: var(--faint); }

/* ---------- Mode rail ---------- */
nav.modes {
  display: flex; gap: 6px; padding: 9px 20px; overflow-x: auto;
  border-bottom: 1px solid var(--border); background: rgba(11,16,28,.6); z-index: 15;
}
nav.modes::-webkit-scrollbar { height: 0; }
.mode-chip {
  white-space: nowrap; font-size: 12.5px; color: var(--muted); font-weight: 600;
  padding: 7px 13px; border-radius: 999px; border: 1px solid transparent; cursor: pointer;
  display: flex; align-items: center; gap: 7px; transition: all .14s ease;
}
.mode-chip:hover { color: var(--text); background: var(--bg-2); }
.mode-chip.active { color: #04160b; background: linear-gradient(90deg, var(--brand), #3ad673); border-color: var(--brand); }
.mode-chip .num { font-size: 10px; opacity: .7; font-family: var(--mono); }
.mode-chip.locked { opacity: .5; }
.mode-chip.locked::after { content: "soon"; font-size: 9px; text-transform: uppercase; letter-spacing: .08em; padding: 2px 6px; border: 1px solid var(--border-2); border-radius: 6px; color: var(--faint); }

/* ---------- Main split ---------- */
main.stage { flex: 1; display: flex; min-height: 0; position: relative; }

/* Canvas area */
.canvas-wrap { flex: 1; position: relative; overflow: hidden; }
.canvas-toolbar {
  position: absolute; top: 14px; left: 14px; z-index: 8;
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap; max-width: calc(100% - 28px);
}
.tbtn {
  background: rgba(14,22,38,.9); border: 1px solid var(--border); color: var(--text);
  font-size: 12.5px; font-weight: 600; padding: 8px 12px; border-radius: 9px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 7px; transition: all .14s ease;
}
.tbtn:hover { border-color: var(--brand); }
.tbtn.primary { background: linear-gradient(90deg, rgba(29,185,84,.9), rgba(34,211,238,.85)); color: #04160b; border: none; }
.tbtn small { color: var(--faint); font-weight: 500; }
.zoomgroup { display: inline-flex; border: 1px solid var(--border); border-radius: 9px; overflow: hidden; }
.zoomgroup .tbtn { border: none; border-radius: 0; background: rgba(14,22,38,.9); }
.zoomgroup .tbtn + .tbtn { border-left: 1px solid var(--border); }

.hint {
  position: absolute; bottom: 14px; left: 14px; z-index: 6; font-size: 11.5px; color: var(--faint);
  background: rgba(9,13,22,.6); border: 1px solid var(--border); padding: 6px 11px; border-radius: 8px;
}

#diagram { width: 100%; height: 100%; display: block; cursor: grab; }
#diagram.panning { cursor: grabbing; }

/* SVG node styling */
.node-box { cursor: pointer; }
.node-box .nb-bg {
  fill: var(--bg-2); stroke: var(--border-2); stroke-width: 1.5;
  transition: stroke .15s ease, fill .15s ease;
}
.node-box:hover .nb-bg { stroke: var(--brand2); }
.node-box.selected .nb-bg { stroke: var(--brand); stroke-width: 2.5; fill: #10203a; }
.node-box.dim { opacity: .28; }
.node-box .nb-title { fill: var(--text); font-size: 15px; font-weight: 700; font-family: var(--font); }
.node-box .nb-tech { fill: var(--brand2); font-size: 11px; font-family: var(--mono); }
.node-box .nb-tag  { fill: var(--muted); font-size: 10.5px; font-family: var(--font); }
.node-box .nb-icon { font-size: 20px; }
.node-box .nb-accent { transition: opacity .15s ease; }

.edge { stroke: var(--border-2); stroke-width: 2; fill: none; }
.edge.hot { stroke: var(--brand); stroke-width: 3; }
.edge.dim { opacity: .18; }
.edge-label { fill: var(--faint); font-size: 10px; font-family: var(--mono); }
.flow-dot { fill: var(--brand2); }

.layer-band { fill: rgba(255,255,255,.015); stroke: var(--border); stroke-dasharray: 4 5; }
.layer-band-text { fill: var(--faint); font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; font-family: var(--font); }

/* ---------- Side panel ---------- */
aside.panel {
  width: 0; flex: none; background: var(--panel); border-left: 1px solid var(--border);
  display: flex; flex-direction: column; transition: width .22s ease; overflow: hidden;
}
aside.panel.open { width: 440px; }
@media (max-width: 900px) { aside.panel.open { width: 100%; position: absolute; inset: 0; z-index: 30; } }

.panel-head { padding: 16px 18px 12px; border-bottom: 1px solid var(--border); position: relative; }
.panel-head .kicker { font-size: 10.5px; text-transform: uppercase; letter-spacing: .14em; color: var(--brand2); font-weight: 700; }
.panel-head h2 { font-size: 20px; margin-top: 6px; line-height: 1.15; }
.panel-head .tech { font-size: 12px; color: var(--muted); font-family: var(--mono); margin-top: 5px; }
.panel-close { position: absolute; top: 14px; right: 14px; background: var(--bg-2); border: 1px solid var(--border); color: var(--muted); width: 30px; height: 30px; border-radius: 8px; cursor: pointer; font-size: 16px; }
.panel-close:hover { color: var(--text); border-color: var(--brand); }

.panel-body { overflow-y: auto; padding: 6px 18px 40px; flex: 1; }
.panel-body::-webkit-scrollbar { width: 9px; }
.panel-body::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 6px; }

/* Source + tag badges */
.src-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 10.5px; font-weight: 600; padding: 4px 9px; border-radius: 7px; border: 1px solid var(--border-2); color: var(--muted); margin: 12px 0 4px; }
.src-badge .mod { color: var(--brand2); }
.tag-pill { display: inline-block; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; padding: 3px 8px; border-radius: 6px; margin: 4px 6px 4px 0; }
.tag-handbook { background: rgba(29,185,84,.14); color: #5be48a; border: 1px solid rgba(29,185,84,.3); }
.tag-general  { background: rgba(59,130,246,.14); color: #7fb0ff; border: 1px solid rgba(59,130,246,.3); }
.tag-hypo     { background: rgba(245,158,11,.14); color: #f7c463; border: 1px solid rgba(245,158,11,.3); }
.tag-unspec   { background: rgba(148,163,184,.12); color: var(--muted); border: 1px solid var(--border-2); }

/* Explanation contract — the 9-layer block */
.xlayer { border: 1px solid var(--border); border-radius: 12px; margin: 10px 0; overflow: hidden; background: var(--bg-1); }
.xlayer > summary { list-style: none; cursor: pointer; padding: 12px 14px; display: flex; align-items: center; gap: 11px; user-select: none; }
.xlayer > summary::-webkit-details-marker { display: none; }
.xlayer > summary:hover { background: rgba(255,255,255,.02); }
.xlayer .chev { color: var(--faint); font-size: 12px; transition: transform .16s ease; }
.xlayer[open] .chev { transform: rotate(90deg); }
.xlayer .xnum { font-family: var(--mono); font-size: 10px; color: #04160b; background: var(--brand2); padding: 2px 6px; border-radius: 5px; font-weight: 700; }
.xlayer .xname { font-size: 13px; font-weight: 700; letter-spacing: .02em; }
.xlayer .xhint { font-size: 11px; color: var(--faint); margin-left: auto; font-weight: 500; }
.xbody { padding: 2px 16px 15px 41px; font-size: 13.5px; line-height: 1.62; color: #d3ddf0; }
.xbody p { margin: 8px 0; }
.xbody ul { margin: 8px 0 8px 2px; padding-left: 18px; }
.xbody li { margin: 4px 0; }
.xbody strong { color: #fff; }
.xbody .k { color: var(--brand2); font-family: var(--mono); font-size: 12.5px; background: rgba(34,211,238,.08); padding: 1px 5px; border-radius: 4px; }
.xbody pre { background: #0a0f1a; border: 1px solid var(--border); border-radius: 9px; padding: 12px 14px; overflow-x: auto; font-family: var(--mono); font-size: 12px; line-height: 1.55; margin: 10px 0; color: #cfe3ff; }
.xbody .qa { border-left: 2px solid var(--border-2); padding-left: 12px; margin: 10px 0; }
.xbody .qa .q { color: var(--violet); font-weight: 600; }
.xbody .callout { border-left: 3px solid var(--amber); background: rgba(245,158,11,.06); padding: 8px 12px; border-radius: 0 8px 8px 0; margin: 10px 0; font-size: 12.5px; }

/* WHY / WHAT-IF quick buttons */
.qbtns { display: flex; gap: 8px; margin: 12px 0 4px; }
.qbtn { flex: 1; text-align: center; font-size: 12px; font-weight: 700; padding: 9px; border-radius: 9px; cursor: pointer; border: 1px solid var(--border-2); background: var(--bg-2); color: var(--text); }
.qbtn.why:hover { border-color: var(--blue); }
.qbtn.whatif:hover { border-color: var(--amber); }

.expand-all { font-size: 11.5px; color: var(--muted); cursor: pointer; margin: 8px 0 2px; display: inline-block; border-bottom: 1px dashed var(--border-2); }
.expand-all:hover { color: var(--brand2); }

.related { margin-top: 14px; }
.related h4 { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--faint); margin-bottom: 8px; }
.related .chip { display: inline-block; font-size: 12px; padding: 5px 10px; border: 1px solid var(--border); border-radius: 8px; margin: 0 6px 6px 0; cursor: pointer; color: var(--muted); }
.related .chip:hover { border-color: var(--brand2); color: var(--text); }

/* Walkthrough overlay */
.overlay-scrim { position: absolute; inset: 0; background: rgba(4,7,13,.72); z-index: 40; display: none; align-items: center; justify-content: center; padding: 24px; }
.overlay-scrim.show { display: flex; }
.walk-card { width: min(680px, 100%); max-height: 86vh; overflow-y: auto; background: var(--panel); border: 1px solid var(--border-2); border-radius: 16px; box-shadow: var(--shadow); }
.walk-head { padding: 18px 22px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; }
.walk-head .step-dots { display: flex; gap: 6px; margin-left: auto; }
.walk-head .step-dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--border-2); display: block; }
.walk-head .step-dots i.on { background: var(--brand); }
.walk-body { padding: 20px 22px; }
.walk-body h3 { font-size: 19px; margin-bottom: 4px; }
.walk-foot { padding: 14px 22px 20px; display: flex; gap: 10px; align-items: center; }
.walk-foot .spacer { flex: 1; }

/* Locked-mode placeholder */
.locked-view { position: absolute; inset: 0; display: none; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 40px; z-index: 5; }
.locked-view.show { display: flex; }
.locked-view .big { font-size: 40px; margin-bottom: 14px; }
.locked-view h3 { font-size: 22px; margin-bottom: 8px; }
.locked-view p { color: var(--muted); max-width: 480px; line-height: 1.6; font-size: 14px; }
.locked-view .rmap { margin-top: 20px; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; max-width: 620px; }
.locked-view .rmap span { font-size: 12px; padding: 6px 11px; border: 1px solid var(--border); border-radius: 8px; color: var(--faint); }
.locked-view .rmap span.done { border-color: var(--brand); color: #5be48a; }

.empty-hero { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; opacity: .0; }

/* ============================================================
   Mode views (Iterations 2 & 3)
   ============================================================ */
.mode-view { position: absolute; inset: 0; overflow-y: auto; padding: 20px 26px 60px; display: none; }
.mode-view.show { display: block; }
.mode-view::-webkit-scrollbar { width: 10px; }
.mode-view::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 6px; }

.mv-head { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 14px; }
.mv-kicker { font-size: 10.5px; text-transform: uppercase; letter-spacing: .14em; color: var(--brand2); font-weight: 700; }
.mv-title { font-size: 22px; margin-top: 5px; }
.mv-head .tag-pill { margin-left: auto; }
.mv-lead { color: var(--muted); font-size: 14px; line-height: 1.6; margin: 4px 0 16px; max-width: 720px; }
.mv-lead code, .mv-note code { font-family: var(--mono); font-size: 12.5px; color: var(--brand2); background: rgba(34,211,238,.08); padding: 1px 5px; border-radius: 4px; }
.mv-body { max-width: 860px; }
.mv-note { border-left: 3px solid var(--brand2); background: rgba(34,211,238,.05); padding: 11px 15px; border-radius: 0 10px 10px 0; margin: 16px 0; font-size: 13px; line-height: 1.6; color: #cfe0f2; }

/* sub-tabs */
.subtabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; border-bottom: 1px solid var(--border); padding-bottom: 12px; }
.subtab { font-size: 12.5px; font-weight: 600; color: var(--muted); background: var(--bg-2); border: 1px solid var(--border); padding: 8px 13px; border-radius: 9px; cursor: pointer; transition: all .14s ease; }
.subtab:hover { color: var(--text); border-color: var(--border-2); }
.subtab.active { color: #04160b; background: linear-gradient(90deg, var(--brand), #3ad673); border-color: var(--brand); }

/* pipeline steps */
.pipeline { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; margin: 10px 0; }
.pstep { display: flex; align-items: center; gap: 14px; background: var(--bg-2); border: 1px solid var(--border-2); border-radius: 12px; padding: 13px 18px; cursor: pointer; min-width: 340px; transition: all .14s ease; }
.pstep:hover { border-color: var(--brand2); transform: translateX(3px); }
.pstep.fail { border-color: rgba(239,68,68,.4); }
.pnum { width: 30px; height: 30px; border-radius: 8px; background: var(--brand); color: #04160b; font-weight: 800; display: grid; place-items: center; flex: none; }
.pstep.fail .pnum { background: var(--red); color: #fff; }
.pt { font-weight: 700; font-size: 14px; }
.ps { font-size: 12px; color: var(--muted); font-family: var(--mono); }
.parrow { color: var(--faint); font-size: 15px; margin-left: 18px; }
.parrow.branch { color: var(--red); font-size: 12px; }

/* flow columns / boxes */
.flowcol { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; margin: 12px 0; }
.fbox { background: var(--bg-2); border: 1px solid var(--border-2); border-radius: 10px; padding: 11px 16px; font-size: 13.5px; min-width: 300px; }
.fbox.ok { border-color: var(--brand); background: rgba(29,185,84,.08); }

/* toggle row */
.toggle-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0 14px; }
.tog { font-size: 13px; font-weight: 600; color: var(--muted); background: var(--bg-2); border: 1px solid var(--border); padding: 9px 15px; border-radius: 10px; cursor: pointer; }
.tog.active { color: #04160b; background: linear-gradient(90deg, var(--brand2), #67e8f9); border-color: var(--brand2); }

/* watermark simulator */
.wm-controls { display: flex; gap: 16px; flex-wrap: wrap; margin: 8px 0 16px; }
.wm-controls label, .concept-link { font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: 6px; font-weight: 600; }
.wm-controls input, .wm-controls select { background: var(--bg-2); border: 1px solid var(--border-2); color: var(--text); border-radius: 8px; padding: 8px 10px; font-family: var(--mono); font-size: 13px; }
.wm-table { width: 100%; border-collapse: collapse; margin: 6px 0; font-size: 13px; }
.wm-table th { text-align: left; color: var(--faint); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.wm-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); }
.wm-table td.mono { font-family: var(--mono); color: var(--brand2); }
.wm-table input { background: var(--bg-1); border: 1px solid var(--border); color: var(--text); border-radius: 7px; padding: 5px 8px; font-family: var(--mono); font-size: 12px; }
.wm-table tr.hot td { background: rgba(29,185,84,.09); }
.wm-table tr.hot td.sel { color: #5be48a; font-weight: 700; }
.wm-result { margin: 14px 0 4px; padding: 12px 16px; background: var(--bg-2); border: 1px solid var(--border-2); border-radius: 10px; font-size: 14px; }
.wm-result .k, .k { font-family: var(--mono); color: var(--brand2); }

/* stepper */
.stepper { display: flex; flex-direction: column; gap: 8px; margin: 8px 0; }
.sstep { display: flex; gap: 13px; align-items: flex-start; background: var(--bg-2); border: 1px solid var(--border-2); border-left-width: 3px; border-radius: 10px; padding: 12px 15px; animation: slideIn .25s ease; }
.sstep.ok { border-left-color: var(--brand); }
.sstep.bad { border-left-color: var(--red); }
.sstep.warn { border-left-color: var(--amber); }
.sn { width: 26px; height: 26px; border-radius: 7px; background: var(--bg-1); border: 1px solid var(--border-2); display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; }
.sd { color: var(--muted); font-size: 12.5px; margin-top: 3px; line-height: 1.5; }
.stepper-ctl { display: flex; gap: 10px; margin: 14px 0; flex-wrap: wrap; }
@keyframes slideIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* auto loader flow */
.al-flow { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; margin: 12px 0; }
.alnode { background: var(--bg-2); border: 1px solid var(--border-2); border-radius: 11px; padding: 12px 16px; min-width: 340px; opacity: .55; transition: all .2s ease; }
.alnode.done { opacity: 1; border-color: var(--brand); }
.alnode.active { box-shadow: 0 0 0 2px rgba(34,211,238,.4); }
.alt { font-weight: 700; font-size: 14px; }
.ald { font-size: 12px; color: var(--muted); margin-top: 3px; line-height: 1.5; }

/* checkpoint tree */
.ck-wrap { display: grid; grid-template-columns: 240px 1fr; gap: 18px; margin: 10px 0; }
@media (max-width: 700px) { .ck-wrap { grid-template-columns: 1fr; } }
.ck-tree { background: var(--bg-1); border: 1px solid var(--border); border-radius: 12px; padding: 14px; font-family: var(--mono); font-size: 13px; }
.ckroot { color: var(--brand2); margin-bottom: 8px; }
.cknode { padding: 8px 10px; margin: 3px 0 3px 16px; border-radius: 7px; cursor: pointer; border: 1px solid transparent; color: var(--text); }
.cknode:hover { background: var(--bg-2); }
.cknode.active { background: rgba(29,185,84,.12); border-color: var(--brand); color: #5be48a; }
.ck-detail { background: var(--bg-2); border: 1px solid var(--border-2); border-radius: 12px; padding: 16px 18px; font-size: 13.5px; line-height: 1.6; }

/* micro-batch timeline */
.mb-timeline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 14px 0; }
.mb-batch { width: 42px; height: 42px; border-radius: 9px; background: linear-gradient(135deg, var(--brand2), #0891b2); color: #04160b; font-weight: 800; font-size: 13px; display: grid; place-items: center; animation: pop .3s ease backwards; }
@keyframes pop { from { opacity: 0; transform: scale(.4); } to { opacity: 1; transform: none; } }
.mb-cont { color: var(--amber); font-weight: 700; }
.mb-stop { color: var(--faint); font-weight: 700; }
.mb-lines { margin: 10px 0 0 2px; padding-left: 18px; font-size: 13px; color: var(--muted); line-height: 1.7; }

/* delta internals */
.delta-wrap { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 10px 0; }
@media (max-width: 700px) { .delta-wrap { grid-template-columns: 1fr; } }
.delta-col { background: var(--bg-1); border: 1px solid var(--border); border-radius: 12px; padding: 14px; min-height: 140px; }
.delta-col h4 { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); margin-bottom: 10px; }
.dfile { font-family: var(--mono); font-size: 12.5px; padding: 6px 0; }
.dcommit { border-left: 2px solid var(--border-2); padding: 4px 0 4px 10px; margin: 6px 0; }
.dv { font-family: var(--mono); font-size: 11px; color: #04160b; background: var(--brand2); padding: 1px 6px; border-radius: 5px; font-weight: 700; }
.dop { font-weight: 700; font-size: 12px; margin-left: 6px; }
.dact { font-family: var(--mono); font-size: 11.5px; color: var(--muted); margin-top: 3px; }

/* spectrum + vs */
.spectrum { display: flex; flex-direction: column; gap: 6px; margin: 12px 0; }
.spx { background: var(--bg-2); border: 1px solid var(--border-2); border-radius: 10px; padding: 11px 15px; position: relative; }
.spx.here { border-color: var(--brand); background: rgba(29,185,84,.08); }
.spxt { font-weight: 700; font-size: 14px; }
.spxd { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.spxl { font-size: 11px; color: var(--faint); font-family: var(--mono); margin-top: 3px; }
.spxbadge { position: absolute; top: 11px; right: 15px; font-size: 11px; font-weight: 700; color: #5be48a; }
.vs-two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 18px 0; }
@media (max-width: 700px) { .vs-two { grid-template-columns: 1fr; } }
.vs-card { background: var(--bg-2); border: 1px solid var(--border-2); border-radius: 12px; padding: 16px; }
.vs-flow { font-family: var(--mono); font-size: 12.5px; color: var(--brand2); margin: 10px 0; line-height: 1.6; }
.vs-card p { font-size: 12.5px; color: var(--muted); line-height: 1.6; }
.concept-link { margin-top: 16px; }

/* ============================================================
   Mode views 4–10 (Iterations 4–6)
   ============================================================ */
/* lineage */
.lineage { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 14px 0; }
.lnode { display: inline-flex; align-items: center; gap: 8px; background: var(--bg-2); border: 1px solid var(--border-2); border-radius: 10px; padding: 10px 14px; cursor: pointer; font-size: 13px; font-weight: 600; transition: all .14s ease; }
.lnode:hover { border-color: var(--brand2); transform: translateY(-2px); }
.lnicon { font-size: 16px; }
.lnarrow { color: var(--faint); font-weight: 700; }
.lnarrow.down { display: block; margin: 2px 0 2px 20px; }

/* trace */
.trace-rec { background: rgba(29,185,84,.08); border: 1px solid rgba(29,185,84,.3); border-radius: 12px; padding: 13px 16px; margin: 6px 0 14px; font-size: 13.5px; }
.trace-flow { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; margin-top: 8px; }
.tstage { background: var(--bg-2); border: 1px solid var(--border-2); border-radius: 11px; padding: 12px 16px; min-width: 360px; cursor: pointer; transition: all .18s ease; animation: slideIn .25s ease; }
.tstage:hover { border-color: var(--brand2); }
.tstage.active { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(29,185,84,.25); }
.tsh { font-size: 14px; display: flex; align-items: center; gap: 8px; }
.tsopen { margin-left: auto; font-size: 11px; color: var(--brand2); font-weight: 600; }
.tsw { font-size: 12.5px; color: var(--muted); margin: 5px 0; line-height: 1.5; }
.tsf { font-size: 11.5px; color: var(--brand2); background: rgba(34,211,238,.06); padding: 4px 8px; border-radius: 6px; display: inline-block; }

/* failure playbook */
.fail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; margin: 8px 0 16px; }
.failbtn { text-align: left; font-size: 13px; font-weight: 600; color: var(--text); background: var(--bg-2); border: 1px solid var(--border-2); border-radius: 10px; padding: 12px 14px; cursor: pointer; transition: all .14s ease; }
.failbtn:hover { border-color: var(--red); }
.failbtn.active { border-color: var(--red); background: rgba(239,68,68,.08); }
.playbook { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.pbrow { display: grid; grid-template-columns: 160px 1fr; gap: 14px; background: var(--bg-2); border: 1px solid var(--border-2); border-left-width: 3px; border-radius: 10px; padding: 11px 15px; }
.pbrow.ok { border-left-color: var(--brand); }
.pbrow.bad { border-left-color: var(--red); }
.pbrow.warn { border-left-color: var(--amber); }
.pbh { font-size: 10.5px; font-weight: 800; letter-spacing: .08em; color: var(--faint); text-transform: uppercase; }
.pbd { font-size: 13px; color: #d3ddf0; line-height: 1.55; }
@media (max-width: 640px) { .pbrow { grid-template-columns: 1fr; gap: 4px; } }

/* incident */
.incident { background: var(--bg-1); border: 1px solid var(--border); border-radius: 12px; padding: 15px 18px; margin: 8px 0; font-size: 14px; }
.inc-signals { margin: 10px 0 0 2px; padding-left: 18px; font-size: 12.5px; color: var(--muted); line-height: 1.8; font-family: var(--mono); }
.inc-q { font-size: 15px; font-weight: 700; margin: 16px 0 10px; }

/* decisions */
.decisions { display: flex; flex-direction: column; gap: 8px; }
.decision { background: var(--bg-1); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.decision > summary { list-style: none; cursor: pointer; padding: 14px 16px; font-size: 14.5px; display: flex; align-items: center; gap: 8px; }
.decision > summary::-webkit-details-marker { display: none; }
.decision .chev { color: var(--faint); font-size: 12px; transition: transform .16s ease; }
.decision[open] .chev { transform: rotate(90deg); }
.dchosen { color: #5be48a; font-weight: 700; }
.dbody { padding: 4px 18px 16px; font-size: 13px; line-height: 1.6; color: #d3ddf0; }
.dbody p { margin: 7px 0; }
.doptions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.dopt { font-size: 12px; padding: 5px 11px; border-radius: 8px; border: 1px solid var(--border-2); color: var(--muted); }
.dopt.win { border-color: var(--brand); color: #5be48a; background: rgba(29,185,84,.1); font-weight: 700; }
.dwhen { border-left: 3px solid var(--amber); background: rgba(245,158,11,.06); padding: 8px 12px; border-radius: 0 8px 8px 0; }

/* interview */
.iv { background: var(--bg-1); border: 1px solid var(--border); border-radius: 12px; margin: 8px 0; overflow: hidden; }
.iv > summary { list-style: none; cursor: pointer; padding: 13px 16px; font-size: 14px; display: flex; align-items: center; gap: 9px; }
.iv > summary::-webkit-details-marker { display: none; }
.iv .chev { color: var(--faint); font-size: 12px; transition: transform .16s ease; }
.iv[open] .chev { transform: rotate(90deg); }
.ivlvl { font-size: 10px; font-weight: 800; color: #04160b; background: var(--brand2); padding: 2px 7px; border-radius: 6px; }
.ivcomp { font-size: 11px; color: var(--violet); font-weight: 700; }
.ivbody { padding: 4px 18px 16px; font-size: 13px; line-height: 1.62; color: #d3ddf0; }
.ivbody p { margin: 8px 0; }
.ivmiss { color: #f7c463; }
.ivfu { border-left: 2px solid var(--border-2); padding-left: 12px; margin-top: 10px; }
.ivfu ul { margin: 6px 0 0; padding-left: 18px; }

/* whiteboard */
.wb-palette { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 14px; }
.wbchip { font-size: 12.5px; font-weight: 600; color: var(--text); background: var(--bg-2); border: 1px solid var(--border-2); border-radius: 999px; padding: 8px 14px; cursor: pointer; }
.wbchip:hover { border-color: var(--brand2); }
.wb-board { min-height: 70px; background: var(--bg-1); border: 1px dashed var(--border-2); border-radius: 12px; padding: 16px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 14px; }
.wb-empty { color: var(--faint); font-size: 13px; }
.wbnode { display: inline-flex; align-items: center; gap: 6px; background: var(--bg-2); border: 1px solid var(--brand); border-radius: 9px; padding: 8px 12px; font-size: 12.5px; font-weight: 600; }
.wbarrow { color: var(--faint); font-weight: 700; }

/* quiz */
.quiz-progress { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.qtype { color: var(--brand2); font-weight: 700; }
.quiz-q { font-size: 17px; font-weight: 700; margin-bottom: 16px; line-height: 1.4; }
.quiz-opts { display: flex; flex-direction: column; gap: 8px; }
.qopt { text-align: left; font-size: 13.5px; color: var(--text); background: var(--bg-2); border: 1px solid var(--border-2); border-radius: 10px; padding: 12px 15px; cursor: pointer; transition: all .12s ease; }
.qopt:hover { border-color: var(--brand2); }
.qopt.right { border-color: var(--brand); background: rgba(29,185,84,.12); }
.qopt.wrong { border-color: var(--red); background: rgba(239,68,68,.1); }
.qopt.muted { opacity: .5; }
.quiz-fb { margin: 14px 0; padding: 14px 16px; border-radius: 12px; border: 1px solid var(--border-2); background: var(--bg-2); font-size: 13.5px; line-height: 1.6; }
.quiz-fb.ok { border-left: 3px solid var(--brand); }
.quiz-fb.bad { border-left: 3px solid var(--red); }
.qwrong { color: var(--muted); font-size: 12.5px; }
.quiz-fb .tbtn { margin-top: 10px; }
.quiz-done { text-align: center; padding: 30px; }
.quiz-done h3 { font-size: 28px; margin-bottom: 8px; }

/* ============================================================
   Iteration 7 — polish (search, progress, learn, code)
   ============================================================ */
.search-wrap { position: relative; }
.search-drop { position: absolute; top: 40px; right: 0; width: 340px; max-height: 380px; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--border-2); border-radius: 12px; box-shadow: var(--shadow);
  z-index: 50; display: none; padding: 6px; }
.search-drop.show { display: block; }
.sd-item { display: flex; align-items: center; gap: 10px; padding: 9px 11px; border-radius: 9px; cursor: pointer; font-size: 13px; }
.sd-item:hover { background: var(--bg-2); }
.sd-icon { font-size: 16px; }
.sd-title { font-weight: 600; }
.appbar .homelink { cursor: pointer; background: var(--bg-2); font-family: var(--font); }

/* progress */
.prog-grid { display: flex; flex-direction: column; gap: 12px; margin: 14px 0; }
.prog-row { display: grid; grid-template-columns: 130px 1fr 44px; align-items: center; gap: 12px; }
.prog-label { font-size: 13px; font-weight: 600; }
.prog-bar { height: 12px; background: var(--bg-2); border: 1px solid var(--border-2); border-radius: 999px; overflow: hidden; }
.prog-fill { height: 100%; background: linear-gradient(90deg, var(--brand), var(--brand2)); border-radius: 999px; transition: width .4s ease; }
.prog-val { font-size: 12.5px; font-weight: 700; color: var(--brand2); text-align: right; font-family: var(--mono); }

/* learn */
.learn-list { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.learn-row { display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 12px; background: var(--bg-1); border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; }
.learn-n { width: 26px; height: 26px; border-radius: 7px; background: var(--brand2); color: #04160b; font-weight: 800; font-size: 12px; display: grid; place-items: center; }
.learn-t { font-size: 13px; font-weight: 600; }
.learn-go { display: flex; gap: 6px; }
.learn-go .chip { cursor: pointer; font-size: 11.5px; padding: 5px 9px; border: 1px solid var(--border-2); border-radius: 8px; color: var(--muted); white-space: nowrap; }
.learn-go .chip:hover { border-color: var(--brand2); color: var(--text); }

/* code explorer */
.code-list { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.codeblk { background: var(--bg-1); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.codeblk > summary { list-style: none; cursor: pointer; padding: 13px 15px; font-size: 14px; display: flex; align-items: center; gap: 9px; }
.codeblk > summary::-webkit-details-marker { display: none; }
.codeblk .chev { color: var(--faint); font-size: 12px; transition: transform .16s ease; }
.codeblk[open] .chev { transform: rotate(90deg); }
.csrc { margin-left: auto; font-size: 10.5px; color: var(--faint); font-family: var(--mono); }
.codebody { padding: 4px 16px 16px; font-size: 12.5px; line-height: 1.6; color: #d3ddf0; }
.codebody p { margin: 7px 0; }
.codebody ul { margin: 6px 0 6px; padding-left: 18px; }
pre.code { background: #0a0f1a; border: 1px solid var(--border); border-radius: 9px; padding: 13px 15px; overflow-x: auto; font-family: var(--mono); font-size: 12px; line-height: 1.6; color: #cfe3ff; margin: 4px 0 12px; white-space: pre; }
.cwrong { color: #f7c463; }
#modal .walk-card { width: min(720px, 100%); }
#modal .walk-body { max-height: 74vh; overflow-y: auto; }
