/* K8s Quest · a KodeKloud experience
   One deliberate dark look (a night-shift operations console), so every
   colour is set explicitly and the page reads the same on any host. */

:root {
  color-scheme: dark;

  /* KodeKloud palette */
  --ink: #0a0d14;
  --ink-2: #0e131d;
  --panel: #121926;
  --panel-2: #172031;
  --panel-3: #1d283d;
  --line: #243149;
  --line-2: #31405f;
  --text: #e7ecf7;
  --text-2: #b8c2d9;
  --muted: #8491ad;
  --faint: #5d6a86;

  --brand: #3566f1;
  --brand-2: #5b86ff;
  --cyan: #29ddff;
  --violet: #af67f6;
  --ok: #95e4b7;
  --ok-strong: #4fd18b;
  --warn: #e99937;
  --bad: #ff5c7a;
  --gold: #f5c451;

  --grad: linear-gradient(100deg, #3566f1 0%, #1ea7f5 55%, #29ddff 100%);

  --font-display: "Poppins", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-body: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;

  --r-sm: 6px;
  --r: 10px;
  --r-lg: 16px;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  --hud-h: 56px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font: 400 14px/1.55 var(--font-body);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--cyan); }
img, svg { max-width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; border-radius: 4px; }
::selection { background: rgba(53, 102, 241, 0.55); }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); border: 0; }

.screen { position: fixed; inset: 0; display: flex; flex-direction: column; padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }

/* ---- buttons ---------------------------------------------------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 0 18px; border-radius: 999px;
  border: 1px solid var(--line-2); background: var(--panel-2); color: var(--text);
  font-weight: 600; font-size: 14px; text-decoration: none; white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.btn:hover { background: var(--panel-3); border-color: var(--faint); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-2); border-color: var(--brand-2); }
.btn-lg { min-height: 50px; padding: 0 26px; font-size: 16px; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--panel-2); border-color: var(--line); color: var(--text); }
.btn-sm { min-height: 32px; padding: 0 12px; font-size: 13px; }
.btn-danger { border-color: rgba(255, 92, 122, 0.5); color: var(--bad); background: transparent; }
.btn-danger:hover { background: rgba(255, 92, 122, 0.12); border-color: var(--bad); }
.icon-btn {
  display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 10px;
  border: 1px solid transparent; background: transparent; color: var(--text-2);
}
.icon-btn:hover { background: var(--panel-2); border-color: var(--line); color: var(--text); }
.icon-btn svg { width: 20px; height: 20px; }

.kbd { font: 500 12px var(--font-mono); padding: 1px 6px; border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 5px; background: var(--panel-2); color: var(--text-2); }

.eyebrow { font: 600 12px/1 var(--font-body); letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }

/* inline command chips in story text */
.cmd {
  font: 500 0.92em var(--font-mono); color: var(--cyan);
  background: rgba(41, 221, 255, 0.08); border: 1px solid rgba(41, 221, 255, 0.22);
  border-radius: 6px; padding: 1px 6px; cursor: pointer; overflow-wrap: anywhere;
}
.cmd:hover { background: rgba(41, 221, 255, 0.16); border-color: rgba(41, 221, 255, 0.5); }
.cmd.plain { cursor: default; color: var(--text); background: var(--panel-3); border-color: var(--line); }

/* ---- title screen ------------------------------------------------------ */

#screen-title { overflow-y: auto; background:
  radial-gradient(1200px 600px at 85% -10%, rgba(53, 102, 241, 0.18), transparent 60%),
  radial-gradient(800px 500px at -10% 110%, rgba(175, 103, 246, 0.12), transparent 60%),
  var(--ink); }
.title-wrap { width: 100%; max-width: 1200px; margin: 0 auto; padding-inline: 24px; padding-block: 28px 40px; display: flex; flex-direction: column; gap: 40px; min-height: 100%; }
.title-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brandmark { display: flex; align-items: center; gap: 10px; font: 700 18px var(--font-display); letter-spacing: -0.01em; color: var(--text); text-decoration: none; }
.brandmark .logo { width: 34px; height: 34px; }
.brandmark small { font: 500 12px var(--font-body); color: var(--muted); letter-spacing: 0; margin-left: 4px; }
.title-hero { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 48px; align-items: center; flex: 1; }
.hero-copy { display: flex; flex-direction: column; gap: 22px; }
.hero-copy h1 {
  margin: 0; font: 700 clamp(56px, 8vw, 104px)/0.95 var(--font-display); letter-spacing: -0.035em;
  text-wrap: balance;
}
.hero-copy h1 .k8s { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-tagline { margin: 0; font: 600 clamp(22px, 2.6vw, 30px)/1.2 var(--font-display); letter-spacing: -0.01em; color: var(--text); }
.hero-tagline span { display: inline-block; margin-right: 0.35em; }
.hero-tagline span:nth-child(1) { color: var(--ok); }
.hero-tagline span:nth-child(2) { color: var(--bad); }
.hero-tagline span:nth-child(3) { color: var(--cyan); }
.hero-lede { margin: 0; max-width: 34em; font-size: 17px; color: var(--text-2); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.hero-note { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.hero-note svg { width: 16px; height: 16px; color: var(--ok); }
.hero-stats { display: flex; gap: 28px; flex-wrap: wrap; padding-top: 6px; }
.hero-stats div { display: flex; flex-direction: column; }
.hero-stats b { font: 700 24px var(--font-display); }
.hero-stats span { font-size: 12px; color: var(--muted); }

.loop { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.loop li { list-style: none; padding: 18px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.loop ol { margin: 0; padding: 0; display: contents; }
.loop .n { font: 600 12px var(--font-mono); color: var(--cyan); }
.loop b { font: 600 16px var(--font-display); }
.loop p { margin: 0; color: var(--text-2); font-size: 14px; }
.title-foot { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; color: var(--muted); font-size: 13px; border-top: 1px solid var(--line); padding-top: 18px; }
.title-foot a { color: var(--text-2); }

/* hero demo: a tiny live cluster */
.demo { position: relative; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--ink-2); box-shadow: var(--shadow); overflow: hidden; }
.demo-board { padding: 18px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; background-image: radial-gradient(rgba(132, 145, 173, 0.16) 1px, transparent 1px); background-size: 18px 18px; }
.demo-node { border: 1px solid var(--line); border-radius: var(--r); background: rgba(18, 25, 38, 0.92); padding: 10px; min-height: 132px; display: flex; flex-direction: column; gap: 10px; }
.demo-node header { display: flex; align-items: center; gap: 6px; font: 600 12px var(--font-mono); color: var(--text-2); }
.demo-node header i { width: 7px; height: 7px; border-radius: 50%; background: var(--ok-strong); box-shadow: 0 0 8px var(--ok-strong); }
.demo-pods { display: flex; flex-wrap: wrap; gap: 10px; }
.demo-term { border-top: 1px solid var(--line); background: #070a10; padding: 14px 18px; font: 13px/1.6 var(--font-mono); color: var(--text-2); min-height: 132px; }
.demo-term .p { color: var(--ok); }
.demo-term .c { color: var(--text); }
.demo-term .caret { display: inline-block; width: 8px; height: 15px; background: var(--cyan); vertical-align: -2px; animation: blink 1s steps(1) infinite; }
.demo-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--line); font: 12px var(--font-mono); color: var(--muted); }
.demo-head b { color: var(--text-2); font-weight: 600; }
.demo-status { white-space: nowrap; font: 600 11px var(--font-mono); padding: 4px 8px; border-radius: 999px; background: rgba(149, 228, 183, 0.12); color: var(--ok); border: 1px solid rgba(149, 228, 183, 0.3); transition: all 0.3s; }
.demo-status.bad { background: rgba(255, 92, 122, 0.12); color: var(--bad); border-color: rgba(255, 92, 122, 0.35); }
@keyframes blink { 50% { opacity: 0; } }

/* ---- HUD --------------------------------------------------------------- */

.hud {
  height: var(--hud-h); flex: none; display: flex; align-items: center; gap: 12px; padding-inline: 12px 10px;
  border-bottom: 1px solid var(--line); background: var(--ink-2);
}
.hud .brandmark { font-size: 16px; }
.hud .brandmark .logo { width: 28px; height: 28px; }
.hud-mission { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding-left: 12px; border-left: 1px solid var(--line); }
.hud-mission .stage-chip { flex: none; }
.hud-mission .t { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.hud-mission .n { color: var(--muted); font: 500 12px var(--font-mono); flex: none; }
.hud-right { display: flex; align-items: center; gap: 4px; }
.xp { display: flex; align-items: center; gap: 10px; padding: 4px 12px 4px 4px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); margin-right: 6px; }
.xp-ring { --p: 0; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--cyan) calc(var(--p) * 1%), var(--line) 0); }
.xp-ring span { width: 24px; height: 24px; border-radius: 50%; background: var(--panel); display: grid; place-items: center; font: 700 11px var(--font-mono); }
.xp-text { display: flex; flex-direction: column; line-height: 1.15; }
.xp-text b { font: 600 13px var(--font-mono); font-variant-numeric: tabular-nums; }
.xp-text span { font-size: 11px; color: var(--muted); white-space: nowrap; }
.xp.bump { animation: bump 0.6s ease; }
@keyframes bump { 30% { transform: scale(1.08); border-color: var(--cyan); } }
.downtime { font: 600 13px var(--font-mono); color: var(--bad); padding: 6px 10px; border-radius: 8px; background: rgba(255, 92, 122, 0.1); border: 1px solid rgba(255, 92, 122, 0.35); display: flex; gap: 8px; align-items: center; font-variant-numeric: tabular-nums; }
.downtime.ok { color: var(--ok); background: rgba(149, 228, 183, 0.08); border-color: rgba(149, 228, 183, 0.3); }
.downtime i { width: 8px; height: 8px; border-radius: 50%; background: currentColor; animation: pulse 1.2s infinite; }

.stage-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 6px; border-radius: 999px; font: 600 12px var(--font-body); color: var(--text-2); background: var(--panel-2); border: 1px solid var(--line); }
.stage-chip svg { width: 15px; height: 15px; color: var(--cyan); }

/* ---- game layout ------------------------------------------------------- */

.game { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(320px, 400px) minmax(0, 1fr); }
.side-toggle { position: relative; flex: none; }
.side-toggle .dot { position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--bad); }
.side-toggle[aria-pressed="false"] { color: var(--cyan); }
.side { min-height: 0; border-right: 1px solid var(--line); display: flex; flex-direction: column; background: var(--ink-2); }
.main { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.splitter { height: 8px; flex: none; cursor: row-resize; background: var(--ink-2); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); display: grid; place-items: center; touch-action: none; }
.splitter::after { content: ""; width: 40px; height: 3px; border-radius: 3px; background: var(--line-2); }
.splitter:hover::after { background: var(--cyan); }

/* mission panel */
.mp-head { padding: 16px 18px 12px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.mp-head .row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.mp-head h2 { margin: 0; font: 600 20px/1.2 var(--font-display); letter-spacing: -0.01em; text-wrap: balance; }
.mp-head p { margin: 0; color: var(--text-2); font-size: 13px; }
.mp-num { font: 500 12px var(--font-mono); color: var(--muted); }
.incident-tag { font: 700 11px var(--font-mono); letter-spacing: 0.08em; color: var(--bad); border: 1px solid rgba(255, 92, 122, 0.45); background: rgba(255, 92, 122, 0.1); padding: 2px 8px; border-radius: 999px; }

.objectives { padding: 12px 12px 10px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; max-height: 46%; overflow-y: auto; flex: none; }
.objectives h3 { margin: 0; }
.obj-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 6px 4px; }
.obj-toggle { border: 0; background: none; padding: 2px 0; font-size: 12px; color: var(--muted); text-decoration: underline; text-underline-offset: 2px; }
.obj-toggle:hover { color: var(--cyan); }
.objectives.collapsed .obj.done, .objectives.collapsed .obj.locked { display: none; }
.obj { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 8px; padding: 8px 8px; border-radius: 10px; color: var(--muted); }
.obj .box { width: 20px; height: 20px; border-radius: 6px; border: 1.5px solid var(--line-2); display: grid; place-items: center; margin-top: 1px; }
.obj .box svg { width: 14px; height: 14px; opacity: 0; }
.obj .txt { font-size: 14px; line-height: 1.45; }
.obj .detail { margin-top: 6px; font-size: 13px; color: var(--text-2); }
.obj .opt { font: 600 10px var(--font-body); letter-spacing: 0.08em; text-transform: uppercase; color: var(--gold); margin-left: 6px; }
.obj.active { background: var(--panel-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-2); }
.obj.active .box { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(41, 221, 255, 0.15); }
.obj.done { color: var(--text-2); }
.obj.done .txt { text-decoration: line-through; text-decoration-color: rgba(149, 228, 183, 0.5); }
.obj.done .box { background: var(--ok-strong); border-color: var(--ok-strong); color: #06240f; }
.obj.done .box svg { opacity: 1; }
.obj.just-done { animation: flash 1s ease; }
@keyframes flash { 0% { background: rgba(149, 228, 183, 0.25); } 100% { background: transparent; } }
.obj.locked .txt { color: var(--faint); }
.choices { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.choice { padding: 6px 12px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--panel); font-size: 13px; text-align: left; }
.choice:hover { border-color: var(--cyan); background: var(--panel-3); }
.choice.wrong { border-color: var(--bad); animation: shake 0.4s; }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.finish-bar { margin: 6px 4px 2px; padding: 10px 12px; border-radius: 10px; background: rgba(149, 228, 183, 0.08); border: 1px solid rgba(149, 228, 183, 0.3); display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13px; }

.chat { flex: 1; min-height: 0; overflow-y: auto; padding: 14px 14px 18px; display: flex; flex-direction: column; gap: 12px; }
.msg { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 10px; animation: rise 0.35s ease both; }
.msg .av { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font: 700 12px var(--font-display); color: #fff; }
.msg .av svg { width: 16px; height: 16px; }
.msg .who { font-size: 12px; color: var(--muted); margin-bottom: 3px; display: flex; gap: 6px; align-items: baseline; }
.msg .who b { color: var(--text-2); font-weight: 600; }
.msg .body { font-size: 14px; color: var(--text); overflow-wrap: anywhere; }
.msg .body strong { color: #fff; }
.msg.pager .body { color: #ffd4dc; }
.msg.pager .bubble { border-left: 2px solid var(--bad); padding-left: 10px; }
.msg.nudge .bubble { border-left: 2px solid var(--warn); padding-left: 10px; }
.msg.success .bubble { border-left: 2px solid var(--ok-strong); padding-left: 10px; }
.msg.reaction .bubble { border-left: 2px solid var(--violet); padding-left: 10px; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }

.concept-card { border: 1px solid rgba(41, 221, 255, 0.28); background: linear-gradient(180deg, rgba(41, 221, 255, 0.07), rgba(53, 102, 241, 0.04)); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; animation: rise 0.35s ease both; }
.concept-card .eyebrow { color: var(--cyan); display: flex; align-items: center; gap: 6px; }
.concept-card .eyebrow svg { width: 14px; height: 14px; }
.concept-card h4 { margin: 0; font: 600 17px var(--font-display); }
.concept-card p { margin: 0; font-size: 13.5px; color: var(--text-2); }
.concept-card .short { color: var(--text); font-size: 14px; }
.concept-card .analogy { font-style: italic; color: var(--muted); }

.mp-foot { flex: none; border-top: 1px solid var(--line); padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; background: var(--ink-2); }
.hints { display: flex; flex-direction: column; gap: 6px; }
.hint { font-size: 13px; padding: 8px 10px; border-radius: 8px; background: rgba(245, 196, 81, 0.07); border: 1px solid rgba(245, 196, 81, 0.25); color: var(--text); display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px; }
.hint .lv { font: 700 11px var(--font-mono); color: var(--gold); padding-top: 2px; }
.foot-row { display: flex; gap: 8px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.foot-row .btn { padding-inline: 10px; }
.foot-row .reset-btn { margin-left: auto; }
.hint-btn .cost { font: 600 11px var(--font-mono); color: var(--gold); }

/* ---- cluster map ---------------------------------------------------------- */

.map { flex: 1; min-height: 120px; position: relative; overflow: auto; background-color: var(--ink); background-image: radial-gradient(rgba(132, 145, 173, 0.14) 1px, transparent 1px); background-size: 22px 22px; container: map / inline-size; }
.board { position: relative; min-width: 600px; padding: 12px 16px 60px; display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 16px; align-items: start; }
.board-main { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.board-side { display: flex; flex-direction: column; gap: 12px; position: sticky; top: 0; min-width: 0; }
.board-side .shelf { flex-direction: column; align-items: stretch; }
.board-side .res { justify-content: flex-start; }
.board-side .res .sub { margin-left: auto; }
.lanes-svg { position: absolute; left: 0; top: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; z-index: 2; }
.board > *:not(svg) { position: relative; z-index: 1; }

.lane-label { font: 600 11px var(--font-body); letter-spacing: 0.12em; text-transform: uppercase; color: var(--faint); display: flex; align-items: center; gap: 8px; }
.lane-label::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, var(--line), transparent); }

.cp { border: 1px solid var(--line); border-radius: 12px; background: rgba(14, 19, 29, 0.9); padding: 6px 8px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.cp-title { display: flex; align-items: center; gap: 8px; font: 600 12px var(--font-mono); color: var(--text-2); margin-right: 6px; }
.cp-title svg { width: 16px; height: 16px; color: var(--violet); }
.cp-comp { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px; font: 500 11px var(--font-mono); color: var(--muted); border: 1px solid var(--line); background: var(--panel); transition: all 0.2s; cursor: help; }
.cp-comp i { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); transition: all 0.2s; }
.cp-comp.on { color: var(--text); border-color: rgba(175, 103, 246, 0.6); background: rgba(175, 103, 246, 0.14); }
.cp-comp.on i { background: var(--violet); box-shadow: 0 0 10px var(--violet); }

.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: stretch; }
.workloads { min-height: 10px; }
.wl { border: 1px solid var(--line); border-radius: 12px; background: rgba(18, 25, 38, 0.92); padding: 7px 10px; display: flex; flex-direction: column; gap: 4px; min-width: 170px; cursor: pointer; transition: border-color 0.15s, transform 0.15s; text-align: left; }
.wl:hover { border-color: var(--line-2); }
.wl.sel { border-color: var(--cyan); }
.wl-top { display: flex; align-items: center; gap: 8px; }
.wl-dot { width: 10px; height: 10px; border-radius: 3px; background: var(--app); flex: none; }
.wl-name { font: 600 13px var(--font-mono); }
.wl-kind { font-size: 11px; color: var(--muted); margin-left: auto; }
.wl-img { font: 12px var(--font-mono); color: var(--text-2); }
.wl-meta { display: flex; align-items: center; gap: 8px; font: 12px var(--font-mono); color: var(--muted); }
.wl-meta .ready.ok { color: var(--ok); }
.wl-meta .ready.bad { color: var(--bad); }
.wl-meta .ready.warn { color: var(--warn); }
.rs-list { display: flex; gap: 4px; flex-wrap: wrap; }
.rs { font: 11px var(--font-mono); padding: 1px 6px; border-radius: 5px; border: 1px solid var(--line); color: var(--muted); }
.rs.cur { color: var(--text); border-color: var(--line-2); background: var(--panel-2); }

.nodes { display: grid; grid-template-columns: repeat(3, minmax(170px, 1fr)); gap: 10px; }
.node { border: 1px solid var(--line); border-radius: 14px; background: rgba(18, 25, 38, 0.92); display: flex; flex-direction: column; min-height: 132px; transition: border-color 0.2s, opacity 0.2s; }
.node.cordoned { border-style: dashed; opacity: 0.8; }
.node header { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-bottom: 1px solid var(--line); cursor: pointer; min-width: 0; }
.node { min-width: 0; }
.node header svg { width: 16px; height: 16px; color: var(--text-2); }
.node header b { font: 600 13px var(--font-mono); }
.node header .ip { font: 11px var(--font-mono); color: var(--faint); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.node header .st { margin-left: auto; font: 600 11px var(--font-mono); color: var(--ok); display: flex; align-items: center; gap: 5px; }
.node header .st i { width: 7px; height: 7px; border-radius: 50%; background: var(--ok-strong); box-shadow: 0 0 8px var(--ok-strong); }
.node.cordoned header .st { color: var(--warn); }
.node.cordoned header .st i { background: var(--warn); box-shadow: none; }
.node .pods { flex: 1; padding: 10px 8px; display: flex; flex-wrap: wrap; gap: 10px 6px; align-content: flex-start; }
.node footer { padding: 5px 10px; font: 11px var(--font-mono); color: var(--faint); border-top: 1px solid var(--line); display: flex; justify-content: space-between; }
.node .empty { color: var(--faint); font-size: 12px; margin: auto; }
.node.pulse { animation: nodepulse 0.8s ease; }
@keyframes nodepulse { 40% { border-color: var(--violet); box-shadow: 0 0 0 3px rgba(175, 103, 246, 0.2); } }

/* pods: an orb with a status ring */
.pod { --app: var(--brand); position: relative; width: 64px; display: flex; flex-direction: column; align-items: center; gap: 4px; background: none; border: 0; padding: 0; color: var(--text); animation: podin 0.45s cubic-bezier(0.2, 1.4, 0.4, 1) both; }
@keyframes podin { from { opacity: 0; transform: scale(0.4); } }
.orb { position: relative; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; }
.orb::before { content: ""; position: absolute; inset: 6px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--app) 55%, #fff) 0%, var(--app) 55%, color-mix(in srgb, var(--app) 60%, #000) 100%); box-shadow: 0 0 16px color-mix(in srgb, var(--app) 55%, transparent); }
.orb .ring { position: absolute; inset: 0; width: 100%; height: 100%; }
.orb .ring circle { fill: none; stroke-width: 3; }
.orb .ring .track { stroke: var(--line); }
.orb .ring .arc { stroke: var(--ok-strong); stroke-linecap: round; transform-origin: 50% 50%; transition: stroke 0.25s; }
.orb .glyph { position: relative; font: 700 12px var(--font-display); color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4); }
.pod .pname { font: 10px/1.2 var(--font-mono); color: var(--text-2); max-width: 66px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pod .pstat { font: 600 9.5px/1.2 var(--font-mono); color: var(--ok); max-width: 70px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pod.s-starting .arc { stroke: var(--warn); stroke-dasharray: 30 100; animation: spin 1s linear infinite; }
.pod.s-starting .pstat { color: var(--warn); }
.pod.s-starting .orb::before { filter: saturate(0.5) brightness(0.8); }
.pod.s-error .arc { stroke: var(--bad); animation: pulse 1s ease-in-out infinite; }
.pod.s-error .pstat { color: var(--bad); }
.pod.s-error .orb { animation: jitter 2.4s ease-in-out infinite; }
.pod.s-error .orb::before { filter: saturate(0.6) brightness(0.75); }
.pod.s-terminating { opacity: 0.45; }
.pod.s-terminating .arc { stroke: var(--faint); stroke-dasharray: 6 8; }
.pod.s-terminating .pstat { color: var(--faint); }
.pod.s-done .arc { stroke: var(--faint); }
.pod.s-done .pstat { color: var(--muted); }
.pod.sel .orb { outline: 2px solid var(--cyan); outline-offset: 3px; border-radius: 50%; }
.pod.dim { opacity: 0.25; }
.pod:hover .pname { color: var(--text); }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: 0.35; } }
@keyframes jitter { 0%, 88%, 100% { transform: none; } 90% { transform: translateX(-2px); } 94% { transform: translateX(2px); } }

.services .svc { border: 1px solid var(--line); border-radius: 12px; background: rgba(18, 25, 38, 0.95); padding: 8px 12px; display: flex; flex-direction: column; gap: 4px; min-width: 180px; cursor: pointer; text-align: left; transition: border-color 0.15s; }
.svc:hover { border-color: var(--line-2); }
.svc.sel { border-color: var(--cyan); }
.svc-top { display: flex; align-items: center; gap: 8px; }
.svc-top svg { width: 16px; height: 16px; color: var(--cyan); }
.svc-top b { font: 600 13px var(--font-mono); }
.svc-type { font: 600 10px var(--font-mono); padding: 1px 6px; border-radius: 5px; background: var(--panel-3); color: var(--text-2); margin-left: auto; }
.svc-type.np { background: rgba(41, 221, 255, 0.12); color: var(--cyan); }
.svc-ports { font: 12px var(--font-mono); color: var(--text-2); }
.svc-ep { font: 11px var(--font-mono); color: var(--ok); }
.svc-ep.none { color: var(--bad); }
.svc.broken { border-color: rgba(255, 92, 122, 0.55); }

.shelf { display: flex; flex-wrap: wrap; gap: 8px; align-content: flex-start; }
.res { display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 10px; border: 1px solid var(--line); background: rgba(18, 25, 38, 0.95); font: 12px var(--font-mono); color: var(--text-2); cursor: pointer; animation: podin 0.35s ease both; }
.res:hover { border-color: var(--line-2); color: var(--text); }
.res svg { width: 16px; height: 16px; flex: none; }
.res.cm svg { color: var(--gold); }
.res.secret svg { color: var(--violet); }
.res.pvc svg { color: var(--ok); }
.res.pvc.pending svg { color: var(--warn); }
.res .sub { color: var(--faint); }
.res.sel { border-color: var(--cyan); }
.shelf-empty { color: var(--faint); font-size: 12px; }

/* customer preview */
.preview { border: 1px solid var(--line); border-radius: 14px; background: var(--panel); overflow: hidden; display: flex; flex-direction: column; }
.pv-head { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-bottom: 1px solid var(--line); font-size: 12px; color: var(--text-2); }
.pv-head svg { width: 16px; height: 16px; color: var(--ok); }
.pv-head.down svg { color: var(--bad); }
.pv-head b { font-weight: 600; color: var(--text); }
.pv-bar { display: flex; align-items: center; gap: 6px; padding: 6px 10px; background: var(--ink-2); border-bottom: 1px solid var(--line); }
.pv-bar i { width: 8px; height: 8px; border-radius: 50%; background: var(--line-2); }
.pv-url { flex: 1; margin-left: 4px; font: 11px var(--font-mono); color: var(--muted); background: var(--panel-2); border-radius: 6px; padding: 3px 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pv-body { min-height: 150px; background: #faf7f0; color: #1d1b16; position: relative; }
.pv-body.err { background: #f2f3f6; color: #3d4252; display: grid; place-items: center; text-align: center; padding: 18px; }
.pv-err { display: flex; flex-direction: column; gap: 6px; align-items: center; font-size: 13px; }
.pv-err svg { width: 34px; height: 34px; color: #9aa1b3; }
.pv-err b { font: 600 15px var(--font-display); color: #2a2f3d; }
.pv-err code { font: 11px var(--font-mono); color: #6b7285; }
.store-debug { background: repeating-linear-gradient(45deg, #ffcf3f, #ffcf3f 10px, #1d1b16 10px, #1d1b16 20px); padding: 3px; }
.store-debug span { display: block; background: #1d1b16; color: #ffcf3f; font: 700 10px var(--font-mono); text-align: center; padding: 2px; letter-spacing: 0.08em; }
.store-top { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px 6px; }
.store-logo { font: 700 15px var(--font-display); color: #3a2a10; display: flex; align-items: center; gap: 6px; }
.store-logo svg { width: 20px; height: 20px; }
.store-env { font: 600 10px var(--font-mono); padding: 2px 6px; border-radius: 4px; background: #e9e3d4; color: #6b5f45; }
.store-items { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 4px 12px; }
.store-item { background: #fff; border: 1px solid #ece5d6; border-radius: 8px; padding: 6px; font-size: 10.5px; line-height: 1.25; }
.store-item .sw { height: 26px; border-radius: 5px; margin-bottom: 4px; }
.store-item b { display: block; font-weight: 600; }
.store-cart { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 12px 10px; font-size: 12px; }
.store-cart .total { font: 600 12px var(--font-mono); }
.store-cart .total.bug { color: #c2263c; }
.store-cart button { font: 600 11px var(--font-body); border: 0; border-radius: 6px; padding: 6px 10px; background: #2e7d4f; color: #fff; }
.store-cart button[disabled] { background: #c9c3b6; color: #6b665c; cursor: not-allowed; }
.store-orders { font: 10px var(--font-mono); color: #6b5f45; padding: 0 12px 8px; }
.store-maint { padding: 26px 16px; text-align: center; display: flex; flex-direction: column; gap: 6px; align-items: center; }
.store-maint svg { width: 34px; height: 34px; color: #b0862b; }
.store-maint b { font: 700 16px var(--font-display); }
.pv-foot { padding: 6px 10px; font: 11px var(--font-mono); color: var(--muted); border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 6px; }
.rewards-page { padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.rewards-page .mode { align-self: flex-start; font: 700 10px var(--font-mono); padding: 2px 6px; border-radius: 4px; }
.rewards-page .mode.live { background: #d7f5e4; color: #1f6b43; }
.rewards-page .mode.test { background: #ffe7b3; color: #7a5200; }
.rewards-page b { font: 700 18px var(--font-display); }
.rewards-page .pts { font: 700 26px var(--font-display); color: #3a2a10; }
.load { padding: 14px 12px; display: flex; flex-direction: column; gap: 8px; background: var(--panel); color: var(--text); }
.gauge { height: 12px; border-radius: 999px; background: var(--line); overflow: hidden; }
.gauge i { display: block; height: 100%; border-radius: 999px; background: var(--ok-strong); transition: width 0.5s, background 0.3s; }
.gauge.over i { background: var(--bad); }
.load-row { display: flex; justify-content: space-between; font: 12px var(--font-mono); color: var(--text-2); }
.load-status { font: 600 13px var(--font-display); }
.load-status.over { color: var(--bad); }
.load-status.fine { color: var(--ok); }

/* activity ticker */
.events-wrap { display: flex; flex-direction: column; gap: 8px; }
.activity { display: flex; flex-direction: column; gap: 4px; }
.act { font: 11px/1.4 var(--font-mono); color: var(--text-2); background: rgba(14, 19, 29, 0.92); border: 1px solid var(--line); border-radius: 8px; padding: 5px 8px; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px; animation: rise 0.3s ease both; transition: opacity 0.6s; overflow-wrap: anywhere; }
.act b { color: var(--violet); font-weight: 600; }
.act.warn b { color: var(--bad); }
.act.old { opacity: 0.55; }

/* inspector */
.inspector { position: absolute; top: 12px; right: 12px; z-index: 5; width: min(340px, calc(100% - 24px)); border: 1px solid var(--line-2); border-radius: 14px; background: rgba(18, 25, 38, 0.98); box-shadow: var(--shadow); display: flex; flex-direction: column; animation: rise 0.2s ease both; }
.map-wrap { position: relative; flex: 1; min-height: 120px; display: flex; flex-direction: column; }
.ins-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.ins-head .kind { font: 600 11px var(--font-body); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.ins-head b { font: 600 13px var(--font-mono); overflow-wrap: anywhere; }
.ins-head .icon-btn { margin-left: auto; width: 30px; height: 30px; }
.ins-body { padding: 10px 12px; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 12px; font-size: 12.5px; }
.ins-body dt { color: var(--muted); }
.ins-body dd { margin: 0; font-family: var(--font-mono); font-size: 12px; overflow-wrap: anywhere; }
.ins-explain { padding: 0 12px 10px; font-size: 12.5px; color: var(--text-2); }
.ins-actions { padding: 10px 12px 12px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.ins-actions .lbl { font-size: 11px; color: var(--muted); }
.ins-act { display: flex; align-items: center; gap: 8px; text-align: left; padding: 7px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel-2); font: 12px var(--font-mono); color: var(--text); }
.ins-act:hover { border-color: var(--cyan); }
.ins-act.danger:hover { border-color: var(--bad); }
.ins-act svg { width: 14px; height: 14px; color: var(--cyan); flex: none; }
.ins-act.danger svg { color: var(--bad); }

/* ---- terminal ---------------------------------------------------------------- */

.term { flex: none; height: 38%; min-height: 140px; display: flex; flex-direction: column; background: #070a10; }
.term-bar { flex: none; display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 12px; border-bottom: 1px solid var(--line); font: 12px var(--font-mono); color: var(--muted); }
.term-bar svg { width: 15px; height: 15px; color: var(--ok); }
.term-bar .sp { flex: 1; }
.term-bar .icon-btn { width: 28px; height: 28px; }
.term-bar .icon-btn svg { color: var(--muted); width: 16px; height: 16px; }
.term-out { flex: 1; min-height: 0; overflow: auto; padding: 10px 14px 4px; font: 13px/1.5 var(--font-mono); color: #d7deea; }
.tl { white-space: pre; min-height: 1.5em; }
.tl.wrap { white-space: pre-wrap; overflow-wrap: anywhere; }
.tl-cmd { color: #fff; margin-top: 6px; }
.tl-cmd .ps { color: var(--ok); }
.tl-err { color: #ff8da1; white-space: pre-wrap; }
.tl-tip { color: #ffe3a3; white-space: pre-wrap; margin: 2px 0 4px; padding: 4px 10px; border-left: 2px solid var(--gold); background: rgba(245, 196, 81, 0.06); font-family: var(--font-body); font-size: 13px; }
.tl-ok { color: var(--ok); }
.tl-sys { color: var(--muted); white-space: pre-wrap; }
.tl .g { color: var(--ok-strong); }
.tl .r { color: #ff7a93; font-weight: 600; }
.tl .y { color: var(--warn); }
.tl .h { color: #8fa6d6; }
.term-in { flex: none; display: flex; align-items: center; gap: 8px; padding: 6px 14px 10px; font: 13px var(--font-mono); position: relative; }
.term-in .ps { color: var(--ok); white-space: nowrap; }
.term-in .ps .d { color: var(--cyan); }
.term-in input { flex: 1; min-width: 0; background: transparent; border: 0; outline: none; color: #fff; font: 13px var(--font-mono); caret-color: var(--cyan); padding: 4px 0; }
.term-in input::placeholder { color: #4a5570; }
.term-opts { padding: 0 14px 6px; font: 12px var(--font-mono); color: var(--text-2); display: flex; flex-wrap: wrap; gap: 4px 14px; }
.stream-note { padding: 0 14px 8px; font: 12px var(--font-mono); color: var(--warn); }

/* ---- modals ------------------------------------------------------------------ */

.modal-back { position: fixed; inset: 0; z-index: 50; background: rgba(5, 7, 12, 0.72); backdrop-filter: blur(3px); display: grid; place-items: center; padding: 16px; animation: fade 0.2s ease both; }
@keyframes fade { from { opacity: 0; } }
.modal { width: min(560px, 100%); max-height: calc(100% - 16px); overflow: auto; border: 1px solid var(--line-2); border-radius: 18px; background: var(--panel); box-shadow: var(--shadow); display: flex; flex-direction: column; animation: pop 0.25s cubic-bezier(0.2, 1.2, 0.4, 1) both; }
.modal.wide { width: min(920px, 100%); }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(0.98); } }
.modal-head { padding: 20px 22px 4px; display: flex; align-items: flex-start; gap: 12px; }
.modal-head h2 { margin: 0; font: 600 24px/1.2 var(--font-display); letter-spacing: -0.01em; text-wrap: balance; }
.modal-head .icon-btn { margin-left: auto; }
.modal-body { padding: 12px 22px 18px; display: flex; flex-direction: column; gap: 14px; }
.modal-body p { margin: 0; color: var(--text-2); }
.modal-foot { padding: 14px 22px 18px; display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; border-top: 1px solid var(--line); position: sticky; bottom: 0; background: var(--panel); z-index: 2; }

.choice-card { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 12px; text-align: left; padding: 14px 16px; border-radius: 14px; border: 1px solid var(--line-2); background: var(--panel-2); }
.choice-card:hover { border-color: var(--cyan); background: var(--panel-3); }
.choice-card svg { width: 26px; height: 26px; color: var(--cyan); margin-top: 2px; }
.choice-card b { font: 600 16px var(--font-display); display: block; }
.choice-card span { color: var(--text-2); font-size: 13.5px; }
.choice-card .rec { font: 600 10px var(--font-body); letter-spacing: 0.1em; text-transform: uppercase; color: var(--ok); margin-left: 6px; }

.complete-hero { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 22px 22px 4px; }
.complete-hero .badge { width: 60px; height: 60px; border-radius: 50%; display: grid; place-items: center; background: radial-gradient(circle at 35% 30%, #b9f5d2, var(--ok-strong)); color: #06240f; box-shadow: 0 0 40px rgba(79, 209, 139, 0.45); animation: pop 0.5s cubic-bezier(0.2, 1.6, 0.4, 1) both; }
.complete-hero .badge svg { width: 38px; height: 38px; }
.complete-hero h2 { margin: 4px 0 0; font: 700 28px/1.15 var(--font-display); letter-spacing: -0.02em; text-wrap: balance; }
.complete-hero p { margin: 0; color: var(--text-2); max-width: 36em; }
.stars { display: flex; gap: 6px; }
.stars svg { width: 26px; height: 26px; color: var(--line-2); }
.stars svg.on { color: var(--gold); filter: drop-shadow(0 0 6px rgba(245, 196, 81, 0.5)); }
.xp-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.xp-table td { padding: 6px 0; border-bottom: 1px solid var(--line); }
.xp-table td:last-child { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.xp-table tr.total td { border-bottom: 0; font-weight: 700; font-size: 16px; color: #fff; padding-top: 10px; }
.xp-table .neg { color: var(--bad); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--panel-2); font-size: 13px; }
.chip svg { width: 14px; height: 14px; color: var(--cyan); }
.chip.gold svg { color: var(--gold); }
.cta { border-radius: 14px; padding: 16px 18px; border: 1px solid rgba(53, 102, 241, 0.5); background: linear-gradient(120deg, rgba(53, 102, 241, 0.18), rgba(175, 103, 246, 0.12)); display: flex; flex-direction: column; gap: 8px; }
.cta b { font: 600 16px var(--font-display); }
.cta p { margin: 0; color: var(--text-2); font-size: 14px; }
.cta .row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.cta .kk { font: 600 12px var(--font-body); color: var(--text-2); display: flex; gap: 6px; align-items: center; }
.cta .kk svg { width: 16px; height: 16px; flex: none; }

.editor { display: flex; flex-direction: column; gap: 8px; }
.editor-area { display: grid; grid-template-columns: auto minmax(0, 1fr); border: 1px solid var(--line-2); border-radius: 10px; background: #070a10; overflow: hidden; height: min(56vh, 520px); }
.editor-gutter { padding: 10px 8px 10px 10px; font: 13px/1.5 var(--font-mono); color: var(--faint); text-align: right; user-select: none; overflow: hidden; white-space: pre; border-right: 1px solid var(--line); }
.editor-area textarea { resize: none; border: 0; outline: none; background: transparent; color: #e6ecf7; font: 13px/1.5 var(--font-mono); padding: 10px 12px; white-space: pre; overflow: auto; tab-size: 2; }
.editor-err { color: #ff8da1; font: 12.5px var(--font-mono); white-space: pre-wrap; padding: 8px 10px; border-radius: 8px; background: rgba(255, 92, 122, 0.08); border: 1px solid rgba(255, 92, 122, 0.3); }
.editor-tip { font-size: 12.5px; color: var(--muted); }

.guide-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.guide-card { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: var(--panel-2); display: flex; flex-direction: column; gap: 6px; }
.guide-card .eyebrow { font-size: 10.5px; }
.guide-card h4 { margin: 0; font: 600 16px var(--font-display); }
.guide-card p { margin: 0; font-size: 13px; color: var(--text-2); }
.guide-card.locked { background: transparent; border-style: dashed; }
.guide-card.locked h4, .guide-card.locked p { color: var(--faint); }
.ach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.ach { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 10px; align-items: center; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel-2); }
.ach .ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: rgba(245, 196, 81, 0.12); color: var(--gold); }
.ach .ic svg { width: 20px; height: 20px; }
.ach b { font-size: 14px; display: block; }
.ach span { font-size: 12px; color: var(--muted); }
.ach.locked { opacity: 0.45; }
.ach.locked .ic { background: var(--panel-3); color: var(--faint); }

/* toasts */
#toast-root { position: fixed; z-index: 60; left: 50%; top: calc(var(--hud-h) + 12px + env(safe-area-inset-top, 0px)); transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: max-content; max-width: calc(100% - 32px); }
.toast { display: flex; align-items: center; gap: 10px; padding: 10px 16px 10px 10px; border-radius: 14px; background: var(--panel-2); border: 1px solid var(--line-2); box-shadow: var(--shadow); animation: toastin 0.4s cubic-bezier(0.2, 1.4, 0.4, 1) both; font-size: 14px; }
.toast .ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: rgba(245, 196, 81, 0.14); color: var(--gold); flex: none; }
.toast .ic svg { width: 18px; height: 18px; }
.toast small { display: block; color: var(--muted); font-size: 12px; }
.toast.out { animation: toastout 0.3s ease both; }
@keyframes toastin { from { opacity: 0; transform: translateY(-10px) scale(0.95); } }
@keyframes toastout { to { opacity: 0; transform: translateY(-8px); } }

/* ---- quest map screen --------------------------------------------------------- */

#screen-map { overflow-y: auto; background: radial-gradient(900px 500px at 100% 0%, rgba(53, 102, 241, 0.12), transparent 60%), var(--ink); }
.qm { width: 100%; max-width: 1180px; margin: 0 auto; padding-inline: 24px; padding-block: 20px 60px; display: flex; flex-direction: column; gap: 26px; }
.qm-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.qm-welcome { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 20px; align-items: end; }
.qm-welcome h1 { margin: 0; font: 700 clamp(28px, 4vw, 40px)/1.1 var(--font-display); letter-spacing: -0.02em; text-wrap: balance; }
.qm-welcome p { margin: 6px 0 0; color: var(--text-2); }
.progress-line { display: flex; flex-direction: column; gap: 6px; min-width: 260px; }
.progress-line .bar { height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; }
.progress-line .bar i { display: block; height: 100%; background: var(--grad); border-radius: 999px; }
.progress-line .meta { display: flex; justify-content: space-between; font: 12px var(--font-mono); color: var(--muted); }
.stage { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.stage-info { display: flex; flex-direction: column; gap: 6px; }
.stage-info .ic { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--panel-2); border: 1px solid var(--line); color: var(--cyan); }
.stage-info .ic svg { width: 20px; height: 20px; }
.stage-info .num { font: 500 12px var(--font-mono); color: var(--muted); }
.stage-info h3 { margin: 0; font: 600 18px var(--font-display); }
.stage-info p { margin: 0; color: var(--text-2); font-size: 13px; }
.stage.incident .stage-info .ic { color: var(--bad); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.tile { position: relative; text-align: left; padding: 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--panel); display: flex; flex-direction: column; gap: 6px; min-height: 124px; transition: border-color 0.15s, transform 0.15s, background 0.15s; }
.tile:hover:not([disabled]) { border-color: var(--line-2); background: var(--panel-2); transform: translateY(-2px); }
.tile .top { display: flex; align-items: center; gap: 8px; }
.tile .mn { font: 600 12px var(--font-mono); color: var(--muted); }
.tile .st { margin-left: auto; display: flex; gap: 2px; }
.tile .st svg { width: 14px; height: 14px; color: var(--line-2); }
.tile .st svg.on { color: var(--gold); }
.tile b { font: 600 15px/1.3 var(--font-display); }
.tile p { margin: 0; font-size: 12.5px; color: var(--text-2); }
.tile .foot { margin-top: auto; display: flex; gap: 10px; font: 11px var(--font-mono); color: var(--faint); }
.tile.next { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(53, 102, 241, 0.18); }
.tile.next .mn { color: var(--brand-2); }
.tile[disabled] { cursor: not-allowed; opacity: 0.5; }
.tile .lock { width: 14px; height: 14px; color: var(--faint); margin-left: auto; }
.tile.done .mn::after { content: " ✓"; color: var(--ok); }
.save-note { display: flex; gap: 14px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); font-size: 13.5px; color: var(--text-2); }
.save-note b { color: var(--text); }

/* ---- end screen ------------------------------------------------------------------- */

#screen-end { overflow-y: auto; background: radial-gradient(900px 600px at 50% -10%, rgba(41, 221, 255, 0.14), transparent 60%), var(--ink); }
.end { width: 100%; max-width: 980px; margin: 0 auto; padding-inline: 24px; padding-block: 28px 60px; display: flex; flex-direction: column; gap: 28px; }
.end-hero { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.end-hero h1 { margin: 0; font: 700 clamp(44px, 7vw, 80px)/1 var(--font-display); letter-spacing: -0.035em; }
.end-hero h1 span { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.end-hero p { margin: 0; font-size: 17px; color: var(--text-2); max-width: 40em; }
.end-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.learned { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 16px; padding: 0; margin: 0; }
.learned li { list-style: none; display: flex; align-items: center; gap: 8px; font-size: 15px; }
.learned li svg { width: 18px; height: 18px; color: var(--ok-strong); flex: none; }
.stat-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.stat { padding: 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); display: flex; flex-direction: column; gap: 2px; }
.stat b { font: 700 22px var(--font-display); font-variant-numeric: tabular-nums; }
.stat span { font-size: 12px; color: var(--muted); }
.share-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---- mobile tabs --------------------------------------------------------------------- */

.tabs { display: none; }

@media (max-width: 1100px) {
  .game { grid-template-columns: minmax(290px, 340px) minmax(0, 1fr); }
  .hud .brandmark span.word { display: none; }
  .xp-text span { display: none; }
}

@media (max-width: 820px) {
  :root { --hud-h: 52px; }
  .title-hero { grid-template-columns: 1fr; gap: 28px; }
  .loop { grid-template-columns: 1fr; gap: 0; }
  .stage { grid-template-columns: 1fr; gap: 10px; }
  .qm-welcome { grid-template-columns: 1fr; }
  .end-grid { grid-template-columns: minmax(0, 1fr); }
  .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .learned { grid-template-columns: 1fr; }
  .modal-head h2 { font-size: 21px; }
}

@media (max-width: 820px), (max-height: 500px) and (orientation: landscape) {
  .hud-mission .t, .hud-mission .n { display: none; }
  .hud-mission { border-left: 0; padding-left: 0; }
  .game { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr); }
  .game > .side, .game > .main { grid-row: 1; grid-column: 1; }
  .game[data-tab="mission"] .main { display: none; }
  .game[data-tab="cluster"] .side, .game[data-tab="terminal"] .side { display: none; }
  .game[data-tab="cluster"] .term, .game[data-tab="cluster"] .splitter { display: none; }
  .game[data-tab="terminal"] .map-wrap, .game[data-tab="terminal"] .splitter { display: none; }
  .game[data-tab="terminal"] .term { height: auto; flex: 1; }
  .side { border-right: 0; }
  .objectives { max-height: 50%; }
  .tabs { display: grid; grid-template-columns: repeat(3, 1fr); flex: none; border-top: 1px solid var(--line); background: var(--ink-2); padding-bottom: env(safe-area-inset-bottom, 0px); }
  .tabs button { position: relative; background: none; border: 0; padding: 9px 0 10px; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; color: var(--muted); }
  .tabs button svg { width: 20px; height: 20px; }
  .tabs button[aria-selected="true"] { color: var(--cyan); }
  .tabs .dot { position: absolute; top: 6px; left: calc(50% + 8px); width: 8px; height: 8px; border-radius: 50%; background: var(--bad); }
  .term-in input, .term-out { font-size: 16px; }
  .inspector { position: fixed; top: auto; bottom: 70px; right: 12px; left: 12px; width: auto; }
  .xp { padding-right: 4px; }
  .xp-text { display: none; }
}

/* landscape phones: little height, so tabs get slimmer and text smaller */
@media (max-height: 500px) and (orientation: landscape) {
  :root { --hud-h: 48px; }
  .tabs button { flex-direction: row; justify-content: center; gap: 6px; padding: 7px 0; font-size: 12px; }
  .tabs button svg { width: 17px; height: 17px; }
  .term-in input, .term-out { font-size: 14px; }
  .mp-head { padding: 6px 14px; gap: 2px; }
  .mp-head p, .mp-head .row { display: none; }
  .mp-head h2 { font-size: 16px; }
  .objectives { max-height: 44%; padding-block: 6px; }
  .obj { padding: 5px 8px; }
  .mp-foot { padding: 6px 12px; }
  .chat { padding-block: 8px; }
}

@media (max-height: 820px) and (min-width: 821px) {
  .objectives { max-height: 40%; }
}

@media (max-width: 480px) {
  .title-wrap, .qm, .end { padding-inline: 16px; }
  .hero-actions .btn { flex: 1 1 100%; }
  .hud-right .icon-btn.hide-sm { display: none; }
}

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

/* ---- map connection lines ---------------------------------------------------- */
.lanes-svg path { fill: none; stroke-width: 1.6; }
.ln-ep { stroke: rgba(41, 221, 255, 0.45); }
.ln-ep.flow { stroke: rgba(41, 221, 255, 0.85); stroke-dasharray: 5 7; animation: dashflow 0.9s linear infinite; }
.ln-nr { stroke: rgba(132, 145, 173, 0.4); stroke-dasharray: 3 5; }
.ln-cust { stroke: rgba(149, 228, 183, 0.8); stroke-width: 2; }
.ln-cust.flow { stroke-dasharray: 6 8; animation: dashflow 0.9s linear infinite reverse; }
.ln-cust.down { stroke: rgba(255, 92, 122, 0.6); stroke-dasharray: 4 6; }
@keyframes dashflow { to { stroke-dashoffset: -24; } }

/* ---- map layout by available width (after the base rules so they win) ---- */
@container map (max-width: 900px) {
  .board { grid-template-columns: minmax(0, 1fr); }
  .board-side { position: static; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
  .board-side.no-preview { grid-template-columns: minmax(0, 1fr); }
  .board-side .shelf { flex-direction: row; flex-wrap: wrap; }
}
@container map (max-width: 640px) {
  .board { min-width: 0; padding-inline: 10px; }
  .board-side { grid-template-columns: minmax(0, 1fr); }
  .nodes { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}

/* ---- Cluster Lab ------------------------------------------------------------------ */

#screen-lab { background: var(--ink); }
.lab-hud { gap: 10px; }
.lab-chip svg { color: var(--violet); }
.lab-hud .sp { flex: 1; }
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); flex: none; }
.seg button { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; color: var(--text-2); padding: 5px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.seg button svg { width: 15px; height: 15px; }
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"] { background: var(--brand); color: #fff; }
.seg-view button[aria-pressed="true"] { background: var(--panel-3); color: var(--cyan); box-shadow: inset 0 0 0 1px var(--line-2); }
.ns-pick { display: inline-flex; align-items: center; gap: 6px; font: 12px var(--font-mono); color: var(--muted); }
.ns-pick select { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 5px 8px; font: 12.5px var(--font-mono); color: var(--text); max-width: 150px; }
.lab-actions { display: flex; align-items: center; gap: 2px; }
.menu-wrap { position: relative; margin-right: 4px; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; width: 300px; padding: 6px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--panel); box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 2px; }
.menu button { text-align: left; border: 0; background: none; border-radius: 8px; padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; }
.menu button:hover { background: var(--panel-3); }
.menu b { font-size: 14px; }
.menu span { font-size: 12px; color: var(--muted); }

.lab { --lw: 240px; --rw: minmax(300px, 380px); flex: 1; min-height: 0; display: grid; grid-template-columns: var(--lw) minmax(0, 1fr) var(--rw); }
.lab-left { min-height: 0; overflow-y: auto; border-right: 1px solid var(--line); background: var(--ink-2); padding: 14px 10px 20px; display: flex; flex-direction: column; gap: 14px; }
.lab-center { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.lab-view { position: relative; flex: 1; min-height: 120px; display: flex; flex-direction: column; }
.lab-right { min-height: 0; border-left: 1px solid var(--line); background: var(--ink-2); display: flex; flex-direction: column; }
.lab-term { height: 34%; }
.lab[data-mode="commands"] .lab-term { height: 46%; }
.lab[data-mode="commands"] { --lw: 280px; }

.lp-head { padding: 0 4px; display: flex; flex-direction: column; gap: 6px; }
.lp-head p { margin: 0; font-size: 12.5px; color: var(--text-2); }
.lp-group { display: flex; flex-direction: column; gap: 4px; }
.lp-g { font: 600 11px var(--font-body); letter-spacing: 0.1em; text-transform: uppercase; color: var(--faint); padding: 4px 4px 2px; }
.lp-cmd { display: block; font-size: 11.5px; padding: 5px 8px; line-height: 1.4; overflow-wrap: break-word; }
.pal { --c: var(--brand-2); display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 8px; align-items: center; text-align: left; padding: 7px 8px; border-radius: 10px; border: 1px solid transparent; background: none; }
.pal:hover, .pal:focus-visible { background: var(--panel-2); border-color: var(--line-2); }
.pal svg { width: 26px; height: 26px; padding: 5px; border-radius: 8px; color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent); }
.pal b { display: block; font-size: 13px; font-weight: 600; }
.pal small { display: block; font-size: 11.5px; color: var(--muted); line-height: 1.35; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

/* groups share a colour between palette, cards and arrows */
.g-wl { --c: var(--brand-2); }
.g-net { --c: var(--cyan); }
.g-sec { --c: #ff8da1; }
.g-sec2 { --c: var(--gold); }
.g-scale { --c: var(--violet); }
.g-cfg { --c: var(--ok); }
.g-sto { --c: var(--warn); }
.g-ext { --c: var(--text-2); }

/* architecture canvas */
.arch { position: relative; flex: 1; min-height: 0; overflow: auto; background-color: var(--ink); background-image: radial-gradient(rgba(132, 145, 173, 0.13) 1px, transparent 1px); background-size: 20px 20px; outline: none; }
.arch-sizer { position: relative; min-width: 100%; min-height: 100%; }
.arch-stage { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.arch-edges { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; }
.arch-edges .ae-hit, .arch-edges .ae-label { pointer-events: auto; cursor: pointer; }
.arch-cols { position: absolute; inset: 0 auto auto 0; }
.arch-col-label { position: absolute; top: 12px; width: 200px; font: 600 10.5px var(--font-body); letter-spacing: 0.12em; text-transform: uppercase; color: var(--faint); white-space: nowrap; }
.arch-cards { position: absolute; inset: 0; pointer-events: none; }
.arch-card { --c: var(--brand-2); position: absolute; width: 200px; pointer-events: auto; cursor: grab; user-select: none; touch-action: none; padding: 9px 11px 10px; border-radius: 12px; border: 1px solid var(--line-2); border-top: 3px solid var(--c); background: rgba(18, 25, 38, 0.97); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35); display: flex; flex-direction: column; gap: 3px; transition: box-shadow 0.15s, border-color 0.15s, opacity 0.2s; animation: rise 0.3s ease both; }
.arch-card:hover { border-color: var(--faint); border-top-color: var(--c); }
.arch-card.sel { box-shadow: 0 0 0 2px var(--cyan), 0 8px 24px rgba(0, 0, 0, 0.5); }
.arch-card.rel { box-shadow: 0 0 0 2px rgba(41, 221, 255, 0.5); }
.arch-card.dragging { cursor: grabbing; z-index: 5; box-shadow: 0 14px 34px rgba(0, 0, 0, 0.6); animation: none; }
.arch-card.s-error { border-color: rgba(255, 92, 122, 0.55); border-top-color: var(--c); }
.arch-card.ghost { background: rgba(255, 92, 122, 0.05); border: 1.5px dashed rgba(255, 92, 122, 0.6); cursor: pointer; }
.arch-card.ghost .ac-name { color: #ff8da1; }
.arch-card.ghost::after { content: "missing"; position: absolute; top: 8px; right: 10px; font: 600 9.5px var(--font-body); letter-spacing: 0.1em; text-transform: uppercase; color: var(--bad); }
.arch-stage.linking .arch-card:not(.can-drop):not(.link-src) { opacity: 0.35; }
.arch-card.can-drop { box-shadow: 0 0 0 1.5px rgba(41, 221, 255, 0.55); }
.arch-card.drop-over { box-shadow: 0 0 0 3px var(--cyan), 0 0 24px rgba(41, 221, 255, 0.35); }
.arch-card.link-src { box-shadow: 0 0 0 2px var(--violet); }
.ac-head { display: flex; align-items: center; gap: 6px; font: 600 10.5px var(--font-body); letter-spacing: 0.08em; text-transform: uppercase; color: var(--c); }
.ac-head svg { width: 14px; height: 14px; flex: none; }
.ac-kind { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ac-ns { font: 500 10px var(--font-mono); letter-spacing: 0; text-transform: none; color: var(--muted); border: 1px solid var(--line); border-radius: 5px; padding: 0 4px; }
.ac-dot { margin-left: auto; width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--ok-strong); box-shadow: 0 0 6px var(--ok-strong); }
.s-pending .ac-dot { background: var(--warn); box-shadow: 0 0 6px var(--warn); }
.s-error .ac-dot { background: var(--bad); box-shadow: 0 0 6px var(--bad); animation: pulse 1.2s infinite; }
.ghost .ac-dot { display: none; }
.ac-name { font: 600 14px var(--font-mono); color: var(--text); overflow-wrap: anywhere; line-height: 1.3; }
.ac-sub { font-size: 12px; color: var(--text-2); line-height: 1.35; }
.s-error .ac-sub { color: #ff8da1; }
.s-pending .ac-sub { color: var(--warn); }
.ac-img { font: 11px var(--font-mono); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ac-warn { display: flex; gap: 5px; align-items: flex-start; font-size: 11.5px; color: #ff8da1; line-height: 1.35; }
.ac-warn svg { width: 13px; height: 13px; flex: none; margin-top: 1px; }
.ac-note { font-size: 11px; color: var(--muted); }
.ac-pods { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin-top: 3px; }
.ac-pod { width: 12px; height: 12px; border-radius: 4px; background: var(--ok-strong); }
.ac-pod.h-starting { background: var(--warn); animation: pulse 1.2s infinite; }
.ac-pod.h-error { background: var(--bad); }
.ac-pod.h-terminating { background: var(--faint); opacity: 0.6; }
.ac-pod.h-done { background: var(--line-2); box-shadow: inset 0 0 0 1.5px var(--ok); }
.ac-more { font: 11px var(--font-mono); color: var(--muted); }
.ac-job { font: 700 10px var(--font-mono); width: 16px; height: 16px; border-radius: 4px; display: grid; place-items: center; background: var(--panel-3); color: var(--warn); }
.ac-job.j-complete { color: var(--ok-strong); }
.ac-job.j-failed { color: var(--bad); }
.ac-link { position: absolute; right: -11px; top: 50%; transform: translateY(-50%); width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--c); background: var(--ink-2); color: var(--c); font: 700 15px/1 var(--font-body); display: grid; place-items: center; padding: 0; cursor: crosshair; opacity: 0; transition: opacity 0.15s, transform 0.15s; touch-action: none; }
.arch-card:hover .ac-link, .arch-card.sel .ac-link, .arch-card:focus-within .ac-link { opacity: 1; }
.ac-link:hover { transform: translateY(-50%) scale(1.15); background: var(--c); color: var(--ink); }
@media (hover: none) { .ac-link { opacity: 1; } }

.arch-empty { position: absolute; inset: 0; display: grid; place-items: center; padding: 20px; pointer-events: none; }
.arch-empty > div { pointer-events: auto; max-width: 440px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 26px; border-radius: 16px; border: 1px dashed var(--line-2); background: rgba(14, 19, 29, 0.85); }
.arch-empty svg { width: 34px; height: 34px; color: var(--cyan); }
.arch-empty b { font: 600 18px var(--font-display); }
.arch-empty p { margin: 0; color: var(--text-2); font-size: 14px; }
.arch-empty .row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 4px; }

/* arrows */
.ae .ae-line { fill: none; stroke: var(--ec, rgba(132, 145, 173, 0.7)); stroke-width: 1.7; transition: opacity 0.2s, stroke-width 0.15s; }
.ae .ae-hit { fill: none; stroke: transparent; stroke-width: 14; }
.ae:hover .ae-line { stroke-width: 2.6; }
.ae.flow .ae-line { stroke-dasharray: 6 6; animation: dashflow 1.1s linear infinite; }
.ae.broken .ae-line { stroke: var(--bad); stroke-dasharray: 4 5; animation: none; }
.ae.sel .ae-line, .ae.touch .ae-line { stroke-width: 2.8; }
.ae.dim { opacity: 0.25; }
.ae.t-selects, .ae.t-exposes { --ec: rgba(41, 221, 255, 0.8); }
.ae.t-routes, .ae.t-http { --ec: rgba(91, 134, 255, 0.9); }
.ae.t-envFrom, .ae.t-env { --ec: rgba(149, 228, 183, 0.75); }
.ae.t-volume, .ae.t-mount, .ae.t-bound, .ae.t-provisioned, .ae.t-class { --ec: rgba(233, 153, 55, 0.8); }
.ae.t-scales { --ec: rgba(175, 103, 246, 0.85); }
.ae.t-protects, .ae.t-allowed { --ec: rgba(255, 141, 161, 0.8); }
.ae.t-identity { --ec: rgba(149, 228, 183, 0.6); }
.ae.t-template { --ec: rgba(132, 145, 173, 0.7); }
.arrow-ok { fill: rgba(184, 194, 217, 0.85); }
.arrow-bad { fill: var(--bad); }
.ae-label { font: 500 10.5px var(--font-mono); fill: var(--text-2); paint-order: stroke; stroke: var(--ink); stroke-width: 4px; stroke-linejoin: round; }
.ae-label.broken { fill: #ff8da1; }
.ae-label.sel { fill: var(--cyan); }
.arch-edges .temp { fill: none; stroke: var(--violet); stroke-width: 2; stroke-dasharray: 5 5; }

/* right panel */
.lr-tabs { flex: none; display: flex; border-bottom: 1px solid var(--line); padding: 0 8px; }
.lr-tabs button { border: 0; background: none; padding: 11px 12px 10px; font-weight: 600; font-size: 13px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.lr-tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--cyan); }
.lr-body { flex: 1; min-height: 0; overflow-y: auto; }
.lr-pad { padding: 14px 14px 24px; display: flex; flex-direction: column; gap: 12px; }
.lr-title { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.lr-title h3 { margin: 0; font: 600 18px/1.25 var(--font-mono); overflow-wrap: anywhere; }
.lr-pill { font: 600 11.5px var(--font-mono); padding: 2px 9px; border-radius: 999px; border: 1px solid rgba(149, 228, 183, 0.35); background: rgba(149, 228, 183, 0.08); color: var(--ok); }
.lr-pill.warn { color: var(--warn); border-color: rgba(233, 153, 55, 0.4); background: rgba(233, 153, 55, 0.08); }
.lr-pill.bad { color: #ff8da1; border-color: rgba(255, 92, 122, 0.45); background: rgba(255, 92, 122, 0.08); }
.lr-explain { margin: 0; color: var(--text-2); font-size: 13.5px; }
.lr-note { margin: 0; color: var(--muted); font-size: 12.5px; }
.lr-warn { margin: 0; display: flex; gap: 8px; align-items: flex-start; font-size: 13px; color: #ffc2cd; padding: 8px 10px; border-radius: 8px; background: rgba(255, 92, 122, 0.08); border: 1px solid rgba(255, 92, 122, 0.3); }
.lr-warn svg { width: 16px; height: 16px; flex: none; color: var(--bad); margin-top: 1px; }
.lr-acts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.lr-act { display: flex; align-items: center; gap: 7px; padding: 7px 9px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel-2); font-size: 12.5px; text-align: left; color: var(--text); }
.lr-act:hover { border-color: var(--cyan); }
.lr-act svg { width: 14px; height: 14px; color: var(--cyan); flex: none; }
.lr-act.danger svg { color: var(--bad); }
.lr-act.danger:hover { border-color: var(--bad); }
.lr-connect { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; align-items: center; padding: 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); }
.lr-connect label { grid-column: 1 / -1; font-size: 12px; font-weight: 600; color: var(--text-2); }
.lr-connect select { min-width: 0; background: var(--ink-2); border: 1px solid var(--line-2); border-radius: 8px; padding: 6px 8px; font: 12.5px var(--font-mono); }
.lr-conns { list-style: none; margin: -4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.lr-conns button { width: 100%; display: grid; grid-template-columns: 16px minmax(0, 1fr); gap: 2px 6px; text-align: left; padding: 7px 9px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); }
.lr-conns button:hover { border-color: var(--cyan); }
.lr-conns button.bad { border-color: rgba(255, 92, 122, 0.4); }
.lr-conns .dir { grid-row: span 2; color: var(--cyan); font-weight: 700; }
.lr-conns .bad .dir, .lr-conns .bad .lbl { color: #ff8da1; }
.lr-conns .lbl { font-size: 12px; color: var(--text-2); }
.lr-conns .oth { font: 12.5px var(--font-mono); color: var(--text); overflow-wrap: anywhere; }
.lr-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.lr-toggle { display: inline-flex; gap: 6px; align-items: center; font-size: 12px; color: var(--muted); cursor: pointer; }
.lr-tips { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.lr-tips li { display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 10px; font-size: 13px; color: var(--text-2); }
.lr-tips svg { width: 18px; height: 18px; color: var(--cyan); }
.lr-tips b { color: var(--text); }
.lr-side { display: flex; flex-direction: column; gap: 6px; }
.lr-obj { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--panel); border-radius: 8px; padding: 4px 9px; font-size: 12.5px; color: var(--text-2); }
button.lr-obj:hover { border-color: var(--cyan); }
.lr-obj svg { width: 14px; height: 14px; color: var(--cyan); }
.lr-obj b { font-family: var(--font-mono); color: var(--text); }
.lr-obj em { color: #ff8da1; font-style: normal; }

.yaml-view { margin: 0; padding: 8px 0; border-radius: 10px; border: 1px solid var(--line); background: #070a10; font: 12px/1.55 var(--font-mono); color: #d7deea; overflow-x: auto; }
.yaml-view .yl { display: block; white-space: pre; padding: 0 12px 0 0; min-height: 1.55em; border-left: 3px solid transparent; }
.yaml-view .yl i { display: inline-block; width: 30px; padding-right: 8px; text-align: right; font-style: normal; color: var(--faint); user-select: none; }
.yaml-view.manifest .yl { padding-left: 10px; }
.yaml-view .yl.hl { background: rgba(41, 221, 255, 0.13); border-left-color: var(--cyan); color: #fff; }
.yaml-view .yl.soft { background: rgba(41, 221, 255, 0.06); border-left-color: rgba(41, 221, 255, 0.45); }
.yaml-view .yl.gap { color: var(--faint); }
.yaml-view .yl.cm { color: var(--ok); opacity: 0.85; }
.yaml-view .yl.sep { color: var(--violet); }

/* component form */
.lab-form .lf-blurb { margin: 0 0 12px; color: var(--text-2); }
.lf-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 18px; align-items: start; }
.lf-fields { display: flex; flex-direction: column; gap: 10px; }
.lf-row { display: flex; flex-direction: column; gap: 5px; }
.lf-row > span { font-size: 13px; font-weight: 600; color: var(--text); }
.lf-row small { display: block; font-weight: 400; font-size: 12px; color: var(--muted); }
.lf-row input:not([type="checkbox"]), .lf-row select, .lf-row textarea { width: 100%; background: var(--ink-2); border: 1px solid var(--line-2); border-radius: 8px; padding: 8px 10px; font: 13px var(--font-mono); }
.lf-row input:focus, .lf-row select:focus, .lf-row textarea:focus { outline: none; border-color: var(--cyan); }
.lf-row textarea { resize: vertical; }
.lf-row.cb { flex-direction: row-reverse; justify-content: flex-end; align-items: center; gap: 8px; }
.lf-row.cb input { width: 16px; height: 16px; accent-color: var(--brand); }
.lf-preview { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.lf-yaml { margin: 0; max-height: 330px; overflow: auto; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: #070a10; font: 12px/1.5 var(--font-mono); color: #d7deea; white-space: pre; }
.lf-cmd { display: flex; flex-direction: column; gap: 6px; }
.lf-cmd p { margin: 0; font-size: 12.5px; color: var(--text-2); }
.lf-cmd .cmd { display: block; font-size: 12px; padding: 5px 8px; }

.lab-tabs { display: none; }

@media (max-width: 1280px) {
  .lab, .lab[data-mode="commands"] { --lw: 220px; --rw: minmax(280px, 330px); }
  .seg button span { display: none; }
  .seg button { padding: 6px 9px; }
}

@media (max-width: 1100px) {
  .lab-hud .lab-chip { display: none; }
}

@media (min-width: 821px) and (min-height: 501px), (min-width: 821px) and (orientation: portrait) {
  /* collapsible panels (desktop and tablet) */
  .lab-left { grid-column: 1; } .lab-center { grid-column: 2; } .lab-right { grid-column: 3; }
  .lab[data-left="rail"] { --lw: 60px; }
  .lab[data-left="hidden"] { --lw: 0px; }
  .lab[data-right="hidden"] { --rw: 0px; }
  .lab[data-left="hidden"] .lab-left, .lab[data-right="hidden"] .lab-right { display: none; }
  .lab[data-left="rail"] .lab-left { padding: 10px 7px 16px; gap: 8px; overflow-x: hidden; scrollbar-width: none; }
  .lab[data-left="rail"] .lp-head p, .lab[data-left="rail"] .lp-head .eyebrow, .lab[data-left="rail"] .lp-g, .lab[data-left="rail"] .pal > span { display: none; }
  .lab[data-left="rail"] .lp-head { padding: 0; }
  .lab[data-left="rail"] .lp-top { justify-content: center; }
  .lab[data-left="rail"] .lp-group { gap: 4px; padding-top: 8px; border-top: 1px solid var(--line); }
  .lab[data-left="rail"] .pal { grid-template-columns: 1fr; justify-items: center; padding: 5px; }
  .lab[data-left="rail"] .pal svg { width: 32px; height: 32px; padding: 6px; }
  .lab[data-left="rail"] .lp-hide svg { transform: scaleX(-1); }
  .lab[data-term="min"] .lab-term { height: auto !important; min-height: 0; flex: none; }
  .lab[data-term="min"] .lab-term > :not(.term-bar), .lab[data-term="min"] .splitter { display: none; }
  .lab[data-term="min"] .term-bar { border-bottom: 0; }
  .lab-focus .lab-hud { display: none; }
  .lab-focus .lab-left, .lab-focus .lab-right { box-shadow: var(--shadow); }
}

@media (max-width: 820px), (max-height: 500px) and (orientation: landscape) {
  .lab-hud { gap: 6px; padding-inline: 8px 4px; }
  .lab-hud .brandmark span.word, .lab-hud .ns-pick span { display: none; }
  .lab-hud .menu-wrap .btn span { display: none; }
  .lab-hud .menu-wrap .btn { padding: 0 9px; }
  .lab-hud [data-act="tidy"], .lab-hud [data-act="help"] { display: none; }
  .ns-pick select { max-width: 92px; }
  .lab, .lab[data-mode="commands"] { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr); }
  .at-panels { display: none !important; }
  .lab-focus .lab-hud, .lab-focus .lab-tabs { display: none !important; }
  .lr-hide, .lp-hide, .lab-term .term-bar [data-tool="term"] { display: none; }
  .arch-tools { bottom: 10px; right: 10px; }
  .lab > * { grid-row: 1; grid-column: 1; border: 0; }
  .lab:not([data-tab="build"]) .lab-left { display: none; }
  .lab:not([data-tab="yaml"]) .lab-right { display: none; }
  .lab[data-tab="build"] .lab-center, .lab[data-tab="yaml"] .lab-center { display: none; }
  .lab[data-tab="diagram"] .lab-term, .lab[data-tab="diagram"] .splitter { display: none; }
  .lab[data-tab="terminal"] .lab-view, .lab[data-tab="terminal"] .splitter { display: none; }
  .lab[data-tab="terminal"] .lab-term { height: auto; flex: 1; }
  .lab-tabs { display: grid; grid-template-columns: repeat(4, 1fr); }
  .lf-grid { grid-template-columns: 1fr; }
  .lf-row input:not([type="checkbox"]), .lf-row select, .lf-row textarea { font-size: 16px; }
  .menu { position: fixed; right: 12px; left: 12px; top: 60px; width: auto; }
}

@media (max-width: 480px) {
  .lab-hud .seg-view { display: none; }
  .lab-hud .icon-btn { width: 32px; height: 32px; }
}

.lab-promo { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 16px 18px; border-radius: 14px; border: 1px solid rgba(175, 103, 246, 0.4); background: linear-gradient(120deg, rgba(175, 103, 246, 0.14), rgba(41, 221, 255, 0.06)); }
.lab-promo .ic { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: rgba(175, 103, 246, 0.18); color: var(--violet); }
.lab-promo .ic svg { width: 24px; height: 24px; }
.lab-promo b { font: 600 16px var(--font-display); }
.lab-promo p { margin: 2px 0 0; color: var(--text-2); font-size: 13.5px; }
@media (max-width: 820px) { .lab-promo { grid-template-columns: 44px minmax(0, 1fr); } .lab-promo .btn { grid-column: 1 / -1; } }
.qm-actions { display: flex; gap: 4px; align-items: center; }
@media (max-width: 620px) {
  .qm-actions .btn { padding: 0 9px; }
  .qm-actions .btn span { display: none; }
}

/* ---- Lab: diagram toolbar, selection bar, panel toggles ------------------------ */
.lab-view { position: relative; }
.arch-tools { position: absolute; right: 14px; bottom: 14px; z-index: 6; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; pointer-events: none; }
.at-group { pointer-events: auto; display: flex; align-items: center; gap: 1px; padding: 3px; border-radius: 12px; border: 1px solid var(--line-2); background: rgba(18, 25, 38, 0.94); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4); backdrop-filter: blur(6px); }
.at-group button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 34px; height: 34px; padding: 0 7px; border: 0; border-radius: 9px; background: none; color: var(--text-2); font: 600 12.5px var(--font-body); }
.at-group button:hover { background: var(--panel-3); color: var(--text); }
.at-group button svg { width: 18px; height: 18px; flex: none; }
.at-group button[aria-pressed="true"] { color: var(--cyan); }
.at-pct { font: 600 12px var(--font-mono) !important; min-width: 50px !important; font-variant-numeric: tabular-nums; }
.at-focus { color: var(--text) !important; padding: 0 11px 0 9px !important; }
.lab-focus .at-focus { background: var(--brand) !important; color: #fff !important; }
.lp-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.lp-hide, .lr-hide { width: 30px; height: 30px; flex: none; }
.lp-hide svg, .lr-hide svg { width: 18px; height: 18px; }
.lr-hide { margin-left: auto; align-self: center; }
.lab-term .term-bar [data-tool="term"][aria-pressed] { color: var(--cyan); }
.lab[data-term="min"] .lab-term .term-bar [data-tool="term"] svg { transform: scaleY(-1); }
.lab-selbar { position: absolute; left: 14px; bottom: 14px; z-index: 6; max-width: calc(100% - 28px); display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 14px; border-radius: 999px; border: 1px solid rgba(41, 221, 255, 0.45); background: rgba(18, 25, 38, 0.96); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45); animation: rise 0.2s ease both; }
.sb-what { font-size: 13px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.sb-what b { font-family: var(--font-mono); color: var(--text); }
.lab-selbar .icon-btn { width: 32px; height: 32px; }
/* keep the toolbar clear of the selection bar */
.lab-selbar:not([hidden]) ~ .arch-tools, .lab-view:has(.lab-selbar:not([hidden])) .arch-tools { bottom: 64px; }
.linkish { border: 0; background: none; padding: 0; color: var(--cyan); text-decoration: underline; text-underline-offset: 2px; font: inherit; }
.ae-others { font-size: 13px !important; }

@media (min-width: 821px) and (min-height: 501px), (min-width: 821px) and (orientation: portrait) {
  .game > .side { grid-column: 1; } .game > .main { grid-column: 2; }
  .game[data-side="hidden"] { grid-template-columns: 0 minmax(0, 1fr); }
  .game[data-side="hidden"] > .side { display: none; }
}
@media (max-width: 820px), (max-height: 500px) and (orientation: landscape) {
  .side-toggle { display: none; }
}
@media (max-width: 1100px) { .reset-btn .rm { display: none; } }

/* ---- Cluster Defense ------------------------------------------------------------------ */

#screen-defense { background: var(--ink); }
.save-note > span > svg { width: 16px; height: 16px; vertical-align: -3px; color: var(--ok); }
.def-promo { border-color: rgba(41, 221, 255, 0.4); background: linear-gradient(120deg, rgba(41, 221, 255, 0.12), rgba(53, 102, 241, 0.1)); margin-bottom: 12px; }
.def-promo .ic { background: rgba(41, 221, 255, 0.16); color: var(--cyan); }
.def-hud { gap: 10px; }
.def-hud .sp { flex: 1; }
.def-chip svg { color: var(--cyan); }
.def-level { display: inline-flex; align-items: center; gap: 8px; min-width: 0; padding: 5px 10px 5px 12px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--panel); font-size: 13px; }
.def-level:hover { border-color: var(--cyan); }
.def-level .n { font: 600 12px var(--font-mono); color: var(--cyan); flex: none; }
.def-level .t { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.def-level svg { width: 14px; height: 14px; color: var(--muted); transform: rotate(90deg); flex: none; }
.def-pts { display: flex; align-items: baseline; gap: 6px; padding: 5px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); flex: none; }
.def-pts b { font: 700 17px var(--font-mono); color: var(--gold); font-variant-numeric: tabular-nums; }
.def-pts span { font-size: 12px; color: var(--muted); white-space: nowrap; }
.def-pts.over b { color: var(--bad); }
.def-runbar { display: flex; align-items: center; gap: 6px; flex: none; }
.def-go { min-width: 108px; }
.def-go.paused { background: var(--panel-2); border-color: var(--line-2); color: var(--text); }
.def-go:disabled { opacity: 0.5; cursor: not-allowed; }
.def-speed { min-width: 44px; min-height: 40px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--panel); font: 600 13px var(--font-mono); color: var(--text-2); }
.def-speed:hover { border-color: var(--cyan); color: var(--text); }

/* situation picker (Choose your situation) */
#screen-defense[data-view="pick"] :is(.def-time, .def, .def-tabs, .def-level, .def-pts, .def-runbar, [data-act="help"]) { display: none; }
.def-chip { cursor: pointer; }
.def-chip:hover { border-color: var(--cyan); color: var(--text); }
#screen-defense[data-view="pick"] .def-chip { cursor: default; }
#screen-defense[data-view="pick"] .def-hud .def-chip span { display: inline; }
.def-pick { flex: 1; min-height: 0; overflow-y: auto; }
.dp-wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 22px 24px 60px; display: flex; flex-direction: column; gap: 20px; }
.dp-head h1 { margin: 4px 0 6px; font: 700 clamp(26px, 3.6vw, 36px)/1.1 var(--font-display); letter-spacing: -0.02em; }
.dp-head h1:focus { outline: none; }
.dp-head p { margin: 0; max-width: 760px; color: var(--text-2); }
.sc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; align-items: start; }
.sc-card { --sc: var(--brand); display: flex; flex-direction: column; gap: 10px; padding: 18px; border-radius: 16px; border: 1px solid var(--line); border-top: 3px solid var(--sc); background: var(--panel); }
.sc-card.done { border-color: color-mix(in srgb, var(--sc) 45%, var(--line)); }
.sc-top { display: flex; align-items: center; gap: 10px; }
.sc-ic { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: color-mix(in srgb, var(--sc) 18%, transparent); color: var(--sc); }
.sc-ic svg { width: 24px; height: 24px; }
.sc-badge { margin-left: auto; padding: 3px 9px; border-radius: 999px; font: 600 11.5px var(--font-body); color: var(--text-2); background: var(--panel-2); border: 1px solid var(--line); }
.sc-card h2 { margin: 2px 0 0; font: 650 20px/1.2 var(--font-display); }
.sc-sit { margin: 0; color: var(--text); font-weight: 500; }
.sc-sum { margin: 0; color: var(--text-2); font-size: 13.5px; }
.sc-learn { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.sc-learn li { padding: 2px 8px; border-radius: 999px; font-size: 12px; color: var(--text-2); background: var(--panel-2); border: 1px solid var(--line); }
.sc-meta { display: flex; flex-wrap: wrap; gap: 12px; font: 12px var(--font-mono); color: var(--muted); }
.sc-prog { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; font-size: 12.5px; color: var(--muted); }
.sc-prog .bar { height: 6px; border-radius: 6px; background: var(--panel-3); overflow: hidden; }
.sc-prog .bar i { display: block; height: 100%; background: var(--sc); border-radius: 6px; }
.sc-levels summary { cursor: pointer; font-size: 13px; color: var(--text-2); padding: 4px 0; }
.sc-levels ol { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.sc-lv { width: 100%; display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; gap: 8px; align-items: center; text-align: left; padding: 6px 8px; border-radius: 10px; border: 1px solid transparent; background: none; color: var(--text); }
.sc-lv:hover:not([disabled]) { background: var(--panel-2); border-color: var(--line); }
.sc-lv[disabled] { opacity: 0.5; cursor: not-allowed; }
.sc-lv .n { width: 24px; height: 24px; border-radius: 8px; display: grid; place-items: center; font: 600 12px var(--font-mono); background: var(--panel-2); color: var(--muted); }
.sc-lv.won .n { background: color-mix(in srgb, var(--sc) 22%, transparent); color: var(--text); }
.sc-lv .t { display: flex; flex-direction: column; min-width: 0; }
.sc-lv .t b { font-size: 13px; font-weight: 600; }
.sc-lv .t small { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sc-lv .lock { width: 14px; height: 14px; color: var(--faint); }
.sc-go { align-self: flex-start; }
.dl-switch { margin: 14px 0 0; }
.dr-others h3 { display: flex; align-items: center; gap: 8px; }
.dr-others h3 svg { width: 18px; height: 18px; color: var(--cyan); }
.sc-mini { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.sc-mini-card { --sc: var(--brand); display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 10px; align-items: start; text-align: left; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); border-left: 3px solid var(--sc); background: var(--panel-2); color: var(--text); }
@media (hover: hover) { .sc-mini-card:hover { border-color: var(--line-2); border-left-color: var(--sc); background: var(--panel-3); } }
.sc-mini-card > svg { width: 22px; height: 22px; color: var(--sc); margin-top: 2px; }
.sc-mini-card span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sc-mini-card b { font-size: 14px; }
.sc-mini-card small { font-size: 12px; color: var(--text-2); }
.sc-mini-card em { font: normal 11.5px var(--font-mono); color: var(--muted); }
.qm-def { display: flex; flex-direction: column; gap: 12px; padding-top: 18px; border-top: 1px solid var(--line); }
.qm-def-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.qm-def-head > div { flex: 1; min-width: 240px; }
.qm-def-head b { font: 600 18px var(--font-display); }
.qm-def-head p { margin: 2px 0 0; color: var(--text-2); font-size: 13.5px; }
.qm-def .sc-mini { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }

/* timeline + error budget */
.def-time { flex: none; display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(180px, 280px); align-items: center; gap: 14px; padding: 6px 14px; border-bottom: 1px solid var(--line); background: var(--ink-2); }
.def-time .clock { font: 600 13px var(--font-mono); color: var(--text-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.def-time .track { position: relative; height: 34px; border-radius: 8px; background: var(--panel); border: 1px solid var(--line); overflow: hidden; }
.def-time .fill { position: absolute; inset: 0 auto 0 0; width: 0; background: linear-gradient(90deg, rgba(53, 102, 241, 0.25), rgba(41, 221, 255, 0.3)); border-right: 2px solid var(--cyan); }
.def-time .marks { position: absolute; inset: 0; }
.def-time .wave { position: absolute; top: 0; bottom: 0; border-left: 1px solid var(--line-2); padding: 2px 0 0 5px; display: flex; align-items: flex-start; }
.def-time .wave b { font: 500 10.5px/1.2 var(--font-body); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; max-width: 100%; }
.def-time .ev { position: absolute; bottom: 2px; width: 16px; height: 16px; margin: 0 0 0 -8px; border-radius: 50%; display: grid; place-items: center; background: rgba(233, 153, 55, 0.18); border: 1px solid rgba(233, 153, 55, 0.6); color: var(--warn); z-index: 1; }
.def-time .ev svg { width: 10px; height: 10px; }
.def-time .budget { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.def-time .budget .lbl { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.def-time .budget .lbl b { font-family: var(--font-mono); color: var(--text); }
.def-time .budget .bar { position: relative; height: 8px; border-radius: 6px; background: var(--panel-3); overflow: visible; }
.def-time .budget .bar i { position: absolute; inset: 0 auto 0 0; border-radius: 6px; background: var(--ok-strong); transition: width 0.2s; }
.def-time .budget.low .bar i { background: var(--warn); }
.def-time .budget .tick { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--gold); border-radius: 2px; }

/* layout */
.def { flex: 1; min-height: 0; display: grid; grid-template-columns: 250px minmax(0, 1fr) minmax(320px, 380px); }
.def-left { min-height: 0; overflow-y: auto; border-right: 1px solid var(--line); background: var(--ink-2); padding: 14px 10px 20px; display: flex; flex-direction: column; gap: 12px; }
.def-center { position: relative; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.def-right { min-height: 0; border-left: 1px solid var(--line); background: var(--ink-2); display: flex; flex-direction: column; }
.def-right .lr-tabs .dot { display: inline-block; width: 7px; height: 7px; margin-left: 5px; border-radius: 50%; background: var(--warn); vertical-align: 2px; }
.def[data-mode="run"] .def-left .pal, .def[data-mode="done"] .def-left .pal { opacity: 0.55; }
.dp-budget { display: flex; align-items: baseline; gap: 6px; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); }
.dp-budget b { font: 700 20px var(--font-mono); color: var(--gold); }
.dp-budget span { font-size: 12.5px; color: var(--muted); }
.dp-budget.over b { color: var(--bad); }
.def-left .pal { grid-template-columns: 26px minmax(0, 1fr) auto; }
.def-left .pal:disabled { cursor: default; }
.def-left .pal:disabled:hover { background: none; border-color: transparent; }
.def-left .pal.locked svg { color: var(--faint); background: var(--panel-2); }
.def-left .pal.locked b { color: var(--faint); }
.def-left .pal.full { opacity: 0.6; }
.pal-cost { font: 600 12px var(--font-mono); color: var(--gold); padding: 2px 7px; border-radius: 999px; background: rgba(245, 196, 81, 0.1); }
.pal .new { font: 700 9.5px var(--font-body); letter-spacing: 0.08em; text-transform: uppercase; font-style: normal; color: #06240f; background: var(--ok); border-radius: 999px; padding: 1px 6px; margin-left: 6px; vertical-align: 1px; }
.dp-reset { align-self: flex-start; margin-top: 4px; }
.lr-empty { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; color: var(--muted); padding: 30px 16px; }
.lr-empty svg { width: 34px; height: 34px; color: var(--faint); }
.lr-empty p { margin: 0; font-size: 13.5px; max-width: 26em; }

/* board */
.db-scroll { flex: 1; min-height: 0; overflow: auto; background-color: var(--ink); background-image: radial-gradient(rgba(132, 145, 173, 0.13) 1px, transparent 1px); background-size: 20px 20px; }
.db-sizer { position: relative; }
.db-stage { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.db-edges, .db-particles { position: absolute; left: 0; top: 0; pointer-events: none; }
.db-edges { z-index: 0; overflow: visible; }
.db-particles { z-index: 2; }
.db-grid { position: relative; z-index: 1; display: grid; grid-template-columns: 124px repeat(calc(var(--cols, 4) - 1), minmax(164px, 182px)); gap: 40px; padding: 14px 40px 28px 18px; align-items: start; justify-content: start; width: max-content; }
.db-col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.db-col h4 { margin: 0 0 -4px; font: 600 10.5px var(--font-body); letter-spacing: 0.12em; text-transform: uppercase; color: var(--faint); }
.db-empty { margin: 0; padding: 14px 10px; border: 1px dashed var(--line); border-radius: 12px; font-size: 12px; color: var(--faint); text-align: center; }
.dc { --c: var(--brand-2); position: relative; display: flex; flex-direction: column; gap: 6px; padding: 9px 10px 10px; border-radius: 12px; border: 1px solid var(--line-2); border-left: 3px solid var(--c); background: var(--panel); cursor: pointer; text-align: left; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25); transition: border-color 0.15s, box-shadow 0.15s; }
.dc:hover { border-color: var(--faint); border-left-color: var(--c); }
.dc.sel { border-color: var(--cyan); border-left-color: var(--c); box-shadow: 0 0 0 2px rgba(41, 221, 255, 0.35), 0 6px 18px rgba(0, 0, 0, 0.25); }
.dc.warn { border-color: rgba(233, 153, 55, 0.6); border-left-color: var(--warn); }
.dc.provided { background: color-mix(in srgb, var(--panel) 80%, var(--ink)); border-style: dashed; border-left-style: solid; }
.dc.hl { animation: dchl 1.4s ease-in-out infinite; }
@keyframes dchl { 50% { box-shadow: 0 0 0 3px rgba(149, 228, 183, 0.45); } }
.dc-h { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.dc-h > svg { width: 22px; height: 22px; padding: 3px; border-radius: 7px; color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent); }
.dc-h b { display: block; font: 600 13.5px var(--font-mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dc-h small { display: block; font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dc-cost { font: 600 11.5px var(--font-mono); color: var(--gold); }
.dc-cost.free { color: var(--faint); font-family: var(--font-body); font-weight: 500; }
.dc-badges { display: flex; flex-wrap: wrap; gap: 4px; }
.dc-badges:empty { display: none; }
.dc-badges span { font: 500 10.5px var(--font-mono); padding: 1px 6px; border-radius: 6px; background: var(--panel-3); color: var(--text-2); }
.dc-warn { display: flex; gap: 6px; align-items: flex-start; font-size: 11.5px; color: #ffcf96; }
.dc-warn svg { width: 13px; height: 13px; flex: none; margin-top: 2px; color: var(--warn); }
.dc-live:empty { display: none; }
.dc-live { display: flex; flex-direction: column; gap: 5px; }
.dc-live .pods { display: flex; flex-wrap: wrap; gap: 3px; }
.dc-live .pods em { font: 500 10.5px var(--font-mono); color: var(--muted); font-style: normal; }
.lvrow { display: flex; flex-wrap: wrap; gap: 4px 8px; }
.lv { font: 500 11px var(--font-mono); color: var(--text-2); font-variant-numeric: tabular-nums; }
.lv.bad { color: var(--warn); }
.lv.bot { color: var(--violet); }
.dc-net { border-left-color: var(--text-2); }
.dc-net .dc-live { flex-direction: row; flex-wrap: wrap; gap: 4px 8px; }
.dc-acts { display: flex; gap: 4px; flex-wrap: wrap; }
.dc-acts button { min-width: 30px; min-height: 28px; padding: 0 8px; border-radius: 7px; border: 1px solid var(--line-2); background: var(--panel-2); font: 600 13px var(--font-mono); color: var(--text); display: inline-flex; align-items: center; gap: 4px; }
.dc-acts button:hover { border-color: var(--cyan); }
.dc-acts .rb { font: 600 11.5px var(--font-body); color: var(--gold); }
.dc-acts svg { width: 13px; height: 13px; }

/* arrows */
.de { fill: none; stroke-width: 1.6; }
.de.e-traffic { stroke: rgba(41, 221, 255, 0.55); stroke-width: 2; }
.de.e-config { stroke: rgba(149, 228, 183, 0.55); stroke-dasharray: 5 4; }
.de.e-data { stroke: rgba(233, 153, 55, 0.6); }
.de.e-control { stroke: rgba(175, 103, 246, 0.6); stroke-dasharray: 2 4; }
.de.e-policy { stroke: rgba(255, 141, 161, 0.6); stroke-dasharray: 6 3; }
.de.on { stroke-width: 2.6; filter: brightness(1.35); }
.de.failing { stroke: rgba(233, 153, 55, 0.95); stroke-width: 2.4; stroke-dasharray: 7 4; }
.mk-traffic { fill: rgba(41, 221, 255, 0.8); } .mk-config { fill: rgba(149, 228, 183, 0.8); } .mk-data { fill: rgba(233, 153, 55, 0.85); }
.mk-control { fill: rgba(175, 103, 246, 0.85); } .mk-policy { fill: rgba(255, 141, 161, 0.85); } .mk-fail { fill: var(--warn); }
.dl rect { fill: var(--ink-2); stroke: var(--line-2); }
.dl text { font: 500 10.5px var(--font-mono); fill: var(--text-2); text-anchor: middle; }
.dl.failing rect { stroke: rgba(233, 153, 55, 0.7); } .dl.failing text { fill: #ffcf96; }
.dl.on rect { stroke: var(--cyan); }

/* incident callout */
.db-callout { position: absolute; z-index: 5; bottom: calc(var(--strip-h, 110px) + 12px); left: 50%; transform: translateX(-50%); max-width: calc(100% - 24px); display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 12px; background: var(--panel-2); border: 1px solid rgba(233, 153, 55, 0.6); box-shadow: var(--shadow); font-size: 13.5px; animation: toastin 0.35s cubic-bezier(0.2, 1.4, 0.4, 1) both; }
.db-callout svg { width: 17px; height: 17px; color: var(--warn); flex: none; }
.db-callout.bad { border-color: rgba(255, 92, 122, 0.6); }
.db-callout.bad svg { color: var(--bad); }

/* cluster strip */
.db-strip { flex: none; display: flex; gap: 14px; align-items: stretch; overflow-x: auto; padding: 8px 14px 10px; border-top: 1px solid var(--line); background: var(--ink-2); min-height: 112px; max-height: 40%; }
.db-strip:empty::before { content: "Nodes appear here."; color: var(--faint); font-size: 12px; align-self: center; }
.dz { display: flex; flex-direction: column; gap: 5px; flex: none; }
.dz h5 { margin: 0; display: flex; align-items: center; gap: 5px; font: 600 10.5px var(--font-body); letter-spacing: 0.12em; text-transform: uppercase; color: var(--faint); }
.dz h5 svg { width: 12px; height: 12px; }
.dz-nodes { display: flex; gap: 8px; }
.dn { width: 152px; display: flex; flex-direction: column; gap: 4px; padding: 7px 8px 8px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); text-align: left; cursor: pointer; }
.dn:hover { border-color: var(--line-2); }
.dn.sel { border-color: var(--cyan); }
.dn-h { display: flex; align-items: center; gap: 6px; min-width: 0; }
.dn-h svg { width: 14px; height: 14px; color: var(--muted); flex: none; }
.dn-h b { font: 600 12px var(--font-mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dn-st { margin-right: 6px; font: 600 10px var(--font-body); text-transform: uppercase; letter-spacing: 0.06em; padding: 1px 6px; border-radius: 6px; background: rgba(255, 92, 122, 0.15); color: #ff8da1; }
.dn-k { font-size: 10.5px; color: var(--muted); line-height: 1.3; }
.dn-bar { position: relative; height: 6px; border-radius: 4px; background: var(--panel-3); overflow: hidden; }
.dn-bar i { position: absolute; inset: 0 auto 0 0; border-radius: 4px; }
.dn-bar .rq { background: rgba(91, 134, 255, 0.55); }
.dn-bar .us { background: var(--cyan); height: 50%; top: auto; }
.dn-cpu { font: 500 10px var(--font-mono); color: var(--muted); }
.dn .pods { display: flex; flex-wrap: wrap; gap: 3px; }
.dn.st-notready, .dn.st-down { border-color: rgba(255, 92, 122, 0.5); background: rgba(255, 92, 122, 0.05); }
.dn.st-draining .dn-st { background: rgba(233, 153, 55, 0.15); color: var(--warn); }
.dn.st-pending { border-style: dashed; border-color: rgba(233, 153, 55, 0.6); width: 190px; cursor: default; }
.dn.st-booting { border-style: dashed; opacity: 0.7; cursor: default; }
.dn-ca { border-style: dashed; border-color: rgba(175, 103, 246, 0.5); }
.dn-ca .dn-h svg { color: var(--violet); }
.dz-pending h5 { color: var(--warn); }

/* Pods: shape + glyph, never colour alone */
.pd { --pc: var(--brand-2); position: relative; display: inline-grid; place-items: center; width: 14px; height: 14px; padding: 0; border-radius: 4px; border: 2px solid var(--pc); background: var(--pc); font: 700 9px/1 var(--font-mono); color: #fff; flex: none; }
button.pd { cursor: pointer; }
button.pd:hover { outline: 2px solid var(--cyan); outline-offset: 1px; }
.pd sup { position: absolute; top: -7px; right: -6px; font: 700 8px/1 var(--font-mono); color: var(--warn); }
.pd.warming { background: transparent; }
.pd.creating { background: transparent; border-style: dotted; }
.pd.notready, .pd.stuck { background: transparent; border-style: dashed; border-color: var(--warn); }
.pd.notready::after, .pd.stuck::after { content: "!"; color: var(--warn); font-size: 9px; }
.pd.crash { background: rgba(255, 92, 122, 0.25); border-color: var(--bad); }
.pd.crash::after { content: "×"; color: #ff8da1; font-size: 11px; }
.pd.pending { background: transparent; border-style: dashed; border-color: var(--faint); }
.pd.pending::after { content: "…"; color: var(--muted); font-size: 9px; line-height: 0.6; }
.pd.term { opacity: 0.35; }
.pd[data-l].ready::after, .pd[data-l].warming::after, .pd[data-l].creating::after, .pd[data-l].term::after { content: attr(data-l); font: 700 8px/1 var(--font-mono); color: #fff; }
.pd[data-l].warming::after, .pd[data-l].creating::after { color: var(--pc); }
.pd.done { opacity: 0.55; }
.pd.done::after { content: "✓"; font-size: 9px; }
i.pd { width: 11px; height: 11px; border-radius: 3px; }
.dc-live .pd.notready::after, .dc-live .pd.stuck::after, .dc-live .pd.crash::after, .dc-live .pd.pending::after, .dc-live .pd.done::after { font-size: 8px; }

/* mission panel */
.dm-title { font-family: var(--font-display) !important; font-size: 21px !important; }
.dm h4 { margin: 0 0 8px; display: flex; align-items: center; gap: 7px; font: 600 12px var(--font-body); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.dm h4 svg { width: 15px; height: 15px; color: var(--cyan); }
.dm h4 small { margin-left: auto; font-size: 11px; letter-spacing: 0; text-transform: none; color: var(--faint); font-weight: 500; }
.dm-brief { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 10px; padding: 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); }
.dm-brief .av { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--brand); color: #fff; font: 700 14px var(--font-display); }
.dm-brief b { font-size: 13.5px; }
.dm-brief small { margin-left: 6px; font-size: 11.5px; color: var(--muted); }
.dm-brief p { margin: 4px 0 0; font-size: 13.5px; color: var(--text-2); }
.dm-new .chips .chip { font-size: 12px; }
button.chip:hover { border-color: var(--cyan); }
.dm-goals ul, .dm-threats ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.dm-goals li { display: grid; grid-template-columns: 42px minmax(0, 1fr); gap: 8px; font-size: 13px; color: var(--text-2); }
.dm-goals li > b { color: var(--gold); font-size: 12px; letter-spacing: 1px; }
.dm-goals li > b svg { width: 15px; height: 15px; color: var(--ok); }
.dm-goals li span b { color: var(--text); }
.dm-when ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.dm-when li { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 8px; font-size: 13px; color: var(--text-2); }
.dm-when li span { font: 500 12px var(--font-mono); color: var(--muted); }
.dm-when li.event { color: #ffcf96; }
.dt { padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.dt.bonus { border-style: dashed; }
.dt-h { display: grid; grid-template-columns: 16px minmax(0, 1fr); gap: 8px; font-size: 13.5px; }
.dt-h svg { width: 16px; height: 16px; color: var(--warn); margin-top: 2px; }
.dt.bonus .dt-h svg { color: var(--gold); }
.dt-hints { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; width: 100%; }
.dt-hints li { display: flex; flex-direction: column; gap: 3px; padding: 8px 10px; border-radius: 9px; background: var(--ink-2); border-left: 3px solid var(--violet); }
.dt-hints li.tier-2 { border-left-color: var(--brand-2); }
.dt-hints li.tier-3 { border-left-color: var(--ok); }
.dt-hints .tier { font: 700 10px var(--font-body); letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.dt-hints p { margin: 0; font-size: 13px; color: var(--text-2); }

/* inspector */
.di-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.di-meta small { font-size: 11.5px; color: var(--muted); }
.lr-title .eyebrow { color: var(--c, var(--muted)); }
.df { display: flex; flex-direction: column; gap: 12px; }
.df-row { display: flex; flex-direction: column; gap: 5px; }
.df-row > label, .df-row.cb > span { font-size: 13px; font-weight: 600; color: var(--text); }
.df-row small { display: block; font-weight: 400; font-size: 12px; color: var(--muted); }
.df-row small.lock { display: flex; gap: 5px; align-items: center; color: var(--faint); }
.df-row small.lock svg { width: 12px; height: 12px; }
.df-row.locked > label, .df-row.locked.cb > span { color: var(--faint); }
.df-row select, .df-row input[type="number"], .df-rule select { width: 100%; min-width: 0; background: var(--ink); border: 1px solid var(--line-2); border-radius: 8px; padding: 7px 9px; font: 13px var(--font-mono); }
.df-row select:focus, .df-row input[type="number"]:focus { outline: none; border-color: var(--cyan); }
.df-row input[type="checkbox"]:focus-visible, .df-multi input:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.df-row.cb:focus-within, .df-multi label:focus-within { border-radius: 8px; background: rgba(41, 221, 255, 0.06); }
.df-row select:disabled, .df-row input:disabled { opacity: 0.55; }
.df-row.cb { flex-direction: row; align-items: flex-start; gap: 9px; cursor: pointer; }
.df-row.cb input { width: 17px; height: 17px; margin-top: 2px; accent-color: var(--brand); flex: none; }
.df-later { margin: 0; display: grid; grid-template-columns: 14px minmax(0, 1fr); gap: 7px; font-size: 12px; color: var(--faint); }
.df-later svg { width: 13px; height: 13px; margin-top: 2px; }
.df-later i { font-style: normal; font-family: var(--font-mono); font-size: 11px; color: var(--muted); }
.df-num { display: grid; grid-template-columns: 36px minmax(0, 1fr) 36px; gap: 6px; }
.df-num button { border-radius: 8px; border: 1px solid var(--line-2); background: var(--panel-2); font: 600 16px var(--font-mono); }
.df-num button:hover:not(:disabled) { border-color: var(--cyan); }
.df-num button:disabled { opacity: 0.45; cursor: not-allowed; }
.df-num input { text-align: center; }
.df-multi { display: flex; flex-direction: column; gap: 4px; }
.df-multi label { display: flex; align-items: center; gap: 8px; font: 12.5px var(--font-mono); padding: 5px 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); cursor: pointer; }
.df-multi input { accent-color: var(--brand); }
.df-rules { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.df-rule { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) 32px; gap: 6px; align-items: center; width: 100%; }
.df-rule > span { color: var(--muted); }
.df-rule .icon-btn { width: 32px; height: 32px; }
.di-learn { border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.di-learn summary { cursor: pointer; padding: 9px 12px; display: flex; gap: 8px; align-items: center; font-weight: 600; font-size: 13px; list-style: none; }
.di-learn summary::-webkit-details-marker { display: none; }
.di-learn summary svg { width: 15px; height: 15px; color: var(--cyan); }
.di-learn dl, .di-dl { margin: 0; padding: 0 12px 12px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; }
.di-dl { padding: 0; }
.di-learn dt, .di-dl dt { font: 700 10.5px var(--font-body); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin-top: 8px; }
.di-learn dd, .di-dl dd { margin: 0; font-size: 13px; color: var(--text-2); }
.di-learn dd .cmd { white-space: normal; overflow-wrap: anywhere; }
.di-yaml h4, .di-live h4 { margin: 0 0 6px; display: flex; align-items: center; gap: 6px; font: 600 12px var(--font-body); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.di-yaml h4 svg, .di-live h4 svg { width: 14px; height: 14px; color: var(--cyan); }
.di-yaml h4 small { margin-left: auto; letter-spacing: 0; text-transform: none; font-weight: 500; color: var(--faint); }
.di-yaml .lr-note { margin-bottom: 6px; }
.di-live { padding: 10px; border-radius: 12px; border: 1px solid rgba(41, 221, 255, 0.35); background: rgba(41, 221, 255, 0.04); }
.di-live h4 { text-transform: none; letter-spacing: 0; font-size: 12.5px; color: var(--text-2); }
.di-pods { display: flex; flex-direction: column; font: 11.5px var(--font-mono); }
.dp-row { display: grid; grid-template-columns: minmax(0, 1.6fr) 38px minmax(0, 1.4fr) 34px 26px; gap: 6px; align-items: center; padding: 3px 2px; border-bottom: 1px solid var(--line); }
.dp-row.dp-h { color: var(--faint); font-size: 10px; }
.dp-row.sel { background: rgba(41, 221, 255, 0.08); }
.dp-row > span:first-child { display: flex; align-items: center; gap: 5px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dp-row small { display: block; font-size: 10px; color: var(--muted); font-family: var(--font-body); }
.dp-row .st-crash, .dp-row .st-notready, .dp-row .st-stuck { color: #ffcf96; }
.dp-row .st-pending { color: var(--muted); }
.di-del { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 6px; border: 1px solid var(--line); background: var(--panel-2); }
.di-del svg { width: 13px; height: 13px; color: #ff8da1; }
.di-del:hover { border-color: var(--bad); }
.di-remove { align-self: flex-start; }

/* log */
.dlog { list-style: none; margin: 0; padding: 10px 12px 24px; display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; }
.dlog li { display: grid; grid-template-columns: 34px 15px minmax(0, 1fr); gap: 7px; align-items: start; padding: 4px 6px; border-radius: 6px; color: var(--text-2); }
.dlog .t { font: 500 11px var(--font-mono); color: var(--faint); padding-top: 1px; }
.dlog svg { width: 14px; height: 14px; margin-top: 2px; color: var(--muted); }
.dlog .x { overflow-wrap: anywhere; }
.dlog .k-k8s .x { font-family: var(--font-mono); font-size: 11.5px; }
.dlog .k-event { background: rgba(233, 153, 55, 0.08); color: var(--text); }
.dlog .k-event svg, .dlog .k-warn svg { color: var(--warn); }
.dlog .k-bad { background: rgba(255, 92, 122, 0.1); color: #ffc2cd; }
.dlog .k-bad svg { color: var(--bad); }
.dlog .k-good svg { color: var(--ok); }
.dlog .k-page { color: var(--gold); }
.dlog .k-page svg { color: var(--gold); }

/* results */
.dr { gap: 16px; padding-top: 4px; }
.dr-x { position: absolute; top: 12px; right: 12px; z-index: 3; }
.modal:has(.dr) { position: relative; }
.complete-hero .badge.bad { background: radial-gradient(circle at 35% 30%, #ffd2a0, var(--warn)); color: #3a1d00; box-shadow: 0 0 40px rgba(233, 153, 55, 0.4); }
.complete-hero h2:focus { outline: none; }
.dr-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.dr-stats div { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 6px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel-2); text-align: center; }
.dr-stats b { font: 700 19px var(--font-mono); font-variant-numeric: tabular-nums; }
.dr-stats span { font-size: 11.5px; color: var(--muted); }
.dr-crit, .dr-notes { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; }
.dr-crit li, .dr-notes li { display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 8px; font-size: 13.5px; color: var(--text-2); }
.dr-crit svg, .dr-notes svg { width: 17px; height: 17px; color: var(--faint); margin-top: 1px; }
.dr-crit li.ok, .dr-crit li.ok span { color: var(--text); }
.dr-crit li.ok svg, .dr-notes .good svg { color: var(--ok); }
.dr-notes .warn svg, .dr-notes .info svg { color: var(--warn); }
.dr-notes .bad svg { color: var(--bad); }
.dr h3 { margin: 0 0 8px; font: 600 16px var(--font-display); display: flex; align-items: center; gap: 8px; }
.dr h3 svg { width: 17px; height: 17px; color: var(--cyan); }
.dr-diag { display: flex; flex-direction: column; gap: 8px; }
.dr-diag.info h3 { font-size: 14px; color: var(--text-2); }
.dr-card { border: 1px solid rgba(233, 153, 55, 0.45); border-left: 3px solid var(--warn); border-radius: 12px; background: var(--panel-2); }
.dr-card.hard { border-color: rgba(255, 92, 122, 0.5); border-left-color: var(--bad); }
.dr-diag.info .dr-card { border-color: var(--line); border-left-color: var(--faint); }
.dr-card summary { cursor: pointer; padding: 10px 12px; display: flex; gap: 10px; align-items: baseline; justify-content: space-between; list-style: none; }
.dr-card summary::-webkit-details-marker { display: none; }
.dr-card summary b { font-size: 14.5px; }
.dr-card summary .n { font: 600 12px var(--font-mono); color: var(--warn); white-space: nowrap; }
.dr-card dl { margin: 0; padding: 0 12px 10px; display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 6px 12px; font-size: 13px; }
.dr-card dt { color: var(--muted); font-weight: 600; font-size: 12px; }
.dr-card dd { margin: 0; color: var(--text-2); }
.dr-card dd .cmd { white-space: normal; overflow-wrap: anywhere; }
.dr-card .btn { margin: 0 12px 12px; }
.dr-hint { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.dr-later, .dr-yaml { border: 1px dashed var(--line-2); border-radius: 12px; padding: 0 12px; }
.dr-later summary, .dr-yaml summary { cursor: pointer; padding: 10px 0; display: flex; gap: 8px; align-items: center; font-size: 13.5px; color: var(--text-2); }
.dr-later summary svg, .dr-yaml summary svg { width: 16px; height: 16px; color: var(--violet); }
.dr-later ul { margin: 0 0 12px; padding-left: 18px; font-size: 13px; color: var(--text-2); }
.dr-later li span { color: var(--muted); font-family: var(--font-mono); font-size: 12px; }
.dr-yaml .btn { margin-bottom: 10px; }
.dr-yaml pre { max-height: 320px; overflow: auto; margin: 0 0 12px; padding: 10px 12px; white-space: pre; }
.dr-debrief ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; color: var(--text-2); }
.dr-debrief strong { color: var(--text); }

/* level select */
.dl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.dl-tile { display: flex; flex-direction: column; gap: 4px; text-align: left; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line-2); background: var(--panel-2); }
.dl-tile:hover:not(:disabled) { border-color: var(--cyan); background: var(--panel-3); }
.dl-tile.cur { border-color: var(--brand-2); box-shadow: 0 0 0 1px var(--brand-2); }
.dl-tile.locked { opacity: 0.5; cursor: not-allowed; background: transparent; border-style: dashed; }
.dl-n { display: flex; align-items: center; gap: 6px; font: 600 11.5px var(--font-mono); color: var(--cyan); }
.dl-n svg { width: 13px; height: 13px; color: var(--faint); }
.dl-tile b { font: 600 15px var(--font-display); }
.dl-tile small { font-size: 12px; color: var(--muted); line-height: 1.4; }
.dl-foot { margin-top: auto; padding-top: 6px; display: flex; align-items: center; gap: 8px; font: 500 11.5px var(--font-mono); color: var(--text-2); }
.dl-new { color: var(--ok); }
.dl-h { font: 500 10.5px var(--font-body); color: var(--muted); border: 1px solid var(--line-2); border-radius: 999px; padding: 0 6px; }
.stars.sm { gap: 2px; }
.stars.sm svg { width: 14px; height: 14px; }

.def-tabs { display: none; }

/* Touch screens: bigger hit areas without bigger visuals. */
@media (pointer: coarse) {
  .db-strip .pods { gap: 10px; }
  .db-strip .pd::before { content: ""; position: absolute; inset: -5px; }
  .dc-acts button { min-height: 36px; min-width: 40px; }
  .di-del { width: 34px; height: 34px; }
  .def-level { min-height: 36px; }
}

@media (min-width: 821px) and (min-height: 501px), (min-width: 821px) and (orientation: portrait) {
  .def-left { grid-column: 1; } .def-center { grid-column: 2; } .def-right { grid-column: 3; }
  /* While the level runs, the palette makes room for the board. */
  .def:not([data-mode="build"]) { grid-template-columns: 0 minmax(0, 1fr) minmax(320px, 380px); }
  .def:not([data-mode="build"]) .def-left { display: none; }
}

@media (max-width: 1280px) {
  .def { grid-template-columns: 220px minmax(0, 1fr) minmax(300px, 340px); }
  .def-level .t { max-width: 140px; }
}
@media (max-width: 1100px) {
  .def-hud .def-chip span { display: none; }
  .def-time { grid-template-columns: auto minmax(0, 1fr) 190px; }
  .def-time .wave b { display: none; }
}

@media (max-width: 820px), (max-height: 500px) and (orientation: landscape) {
  .def-hud { gap: 6px; padding-inline: 8px 4px; }
  .def-hud .brandmark span.word, .def-hud [data-act="help"] { display: none; }
  /* The way back to the situations: an icon on phones. */
  .def-hud .def-chip { padding: 6px; min-width: 32px; min-height: 32px; justify-content: center; }
  .def-hud .def-chip span { display: none; }
  #screen-defense[data-view="pick"] .def-hud .def-chip { display: inline-flex; }
  #screen-defense[data-view="pick"] .def-hud .def-chip span { display: inline; }
  .dp-wrap { padding: 16px 16px 40px; }
  .sc-grid { grid-template-columns: minmax(0, 1fr); }
  .def-level .t, .def-hud .brandmark { display: none; }
  #screen-defense:not([data-mode="build"]) .def-go span, .def-stop span { display: none; }
  .def-go { min-width: 44px; }
  .def-level { padding: 5px 8px; }
  .def-pts { padding: 4px 8px; }
  .def-pts b { font-size: 15px; }
  .def-pts span { display: none; }
  .def-go, .def-stop { padding: 0 12px; }
  .def-stop { padding: 0 10px; }
  .def-time { grid-template-columns: auto minmax(0, 1fr); gap: 8px; padding: 5px 10px; }
  .def-time .budget { grid-column: 1 / -1; }
  .def-time .track { height: 22px; }
  .def { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr); }
  .def > * { grid-row: 1; grid-column: 1; border: 0; }
  .def:not([data-tab="build"]) .def-left { display: none; }
  .def:not([data-tab="board"]) .def-center { display: none; }
  .def[data-tab="build"] .def-right, .def[data-tab="board"] .def-right { display: none; }
  .def-tabs { display: grid; grid-template-columns: repeat(5, 1fr); }
  .def-right .lr-tabs { display: none; } /* the bottom bar has Mission, Inspect and Log */
  .db-grid { gap: 30px; padding: 12px 24px 20px 12px; grid-template-columns: 120px repeat(calc(var(--cols, 4) - 1), minmax(160px, 200px)); }
  .db-strip { min-height: 96px; padding: 6px 10px 8px; }
  .dn { width: 150px; }
  .df-row select, .df-row input[type="number"], .df-rule select { font-size: 16px; }
  .dr-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dr-card dl { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .dr-card dt { margin-top: 6px; }
}
@media (max-height: 500px) and (orientation: landscape) {
  .def-time { grid-template-columns: auto minmax(0, 1fr) 160px; }
  .def-time .budget { grid-column: auto; }
  .def-time .budget .lbl { font-size: 10.5px; }
  .def-time .budget .lbl .long { display: none; }
  .db-strip { min-height: 80px; max-height: 46%; padding-block: 4px 6px; }
  .dn { padding: 5px 7px 6px; gap: 3px; }
  .dn-cpu { display: none; }
}
@media (max-width: 600px) {
  .db-grid { display: flex; flex-direction: column; gap: 30px; padding: 12px 12px 24px; }
  .db-col { flex-direction: row; flex-wrap: wrap; gap: 10px; width: 100%; }
  .db-col h4 { width: 100%; margin: 0; }
  .db-col .dc { width: calc(50% - 5px); }
  .db-col.db-net .dc { width: 100%; }
  .db-empty { width: 100%; padding: 8px; }
  .dc-h small { display: none; }
}
@media (max-width: 480px) {
  .def-level .w { display: none; }
  .def-hud .icon-btn { width: 34px; height: 34px; }
  .def-speed { min-width: 38px; min-height: 36px; }
  .def-go, .def-stop { min-height: 36px; }
}
