/* ==========================================================================
   UMLEdit prototype styles
   Look: "blueprint". Teal accent, graph-paper backgrounds, Space Grotesk
   headings, engineering-drawing details (dimension lines, title blocks).
   Order: tokens, base, components, landing, projects, editor, overlays.
   ========================================================================== */

:root {
  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --font-display: "Space Grotesk", "Inter", ui-sans-serif, system-ui, sans-serif;
  --r-sm: 8px;
  --r: 10px;
  --r-lg: 14px;
  --r-xl: 18px;
  --shadow-pop: 0 18px 48px -12px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.2);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --sidebar-w: 260px;
  --inspector-w: 336px;
}

/* Dark is the signature look. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #080b11;
  --bg-elev: #0b0f17;
  --panel: #0e131c;
  --panel-2: #121925;
  --panel-3: #18212f;
  --hover: #141c28;
  --line: #172030;
  --line-2: #222d3d;
  --line-3: #324054;
  --text: #e9eef5;
  --text-2: #9eabbd;
  --text-3: #66768c;
  --accent: #2dd4bf;
  --accent-hi: #5eead4;
  --accent-text: #5eead4;
  --accent-ink: #04201c;
  --accent-soft: rgba(45, 212, 191, 0.12);
  --accent-line: rgba(45, 212, 191, 0.45);
  --cyan: #38bdf8;
  --green: #34d399;
  --green-soft: rgba(52, 211, 153, 0.12);
  --amber: #fbbf24;
  --amber-soft: rgba(251, 191, 36, 0.12);
  --red: #f87171;
  --red-soft: rgba(248, 113, 113, 0.12);
  --btn: #e9eef5;
  --btn-ink: #080b11;
  --glow: rgba(45, 212, 191, 0.14);
  --canvas: #090d14;
  --grid-dot: #1f2a3a;
  --grid-minor: rgba(94, 234, 212, 0.045);
  --grid-major: rgba(94, 234, 212, 0.09);
  --scrim: rgba(2, 5, 10, 0.66);
  --ill-fill: #0f141d;
  --ill-stroke: #a9b6c8;
  --ill-blue-fill: #111c33;
  --ill-blue-stroke: #60a5fa;
  --callout-bg: #1d1216;
  --tk-k: #7dd3fc;
  --tk-s: #86efac;
  --tk-st: #fcd34d;
  --tk-a: #5eead4;
  --tk-n: #fdba74;
  --tk-g: #f9a8d4;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #ffffff;
  --bg-elev: #f8fafc;
  --panel: #ffffff;
  --panel-2: #f4f7fa;
  --panel-3: #eaf0f4;
  --hover: #eff4f7;
  --line: #e6ebf1;
  --line-2: #d9e1ea;
  --line-3: #c3cdd9;
  --text: #0b1220;
  --text-2: #475569;
  --text-3: #7b8796;
  --accent: #0d9488;
  --accent-hi: #0f766e;
  --accent-text: #0f766e;
  --accent-ink: #ffffff;
  --accent-soft: rgba(13, 148, 136, 0.09);
  --accent-line: rgba(13, 148, 136, 0.42);
  --cyan: #0284c7;
  --green: #059669;
  --green-soft: rgba(5, 150, 105, 0.1);
  --amber: #b45309;
  --amber-soft: rgba(217, 119, 6, 0.1);
  --red: #dc2626;
  --red-soft: rgba(220, 38, 38, 0.08);
  --btn: #0b1220;
  --btn-ink: #ffffff;
  --glow: rgba(13, 148, 136, 0.1);
  --canvas: #fbfcfd;
  --grid-dot: #d5dde6;
  --grid-minor: rgba(13, 148, 136, 0.06);
  --grid-major: rgba(13, 148, 136, 0.11);
  --scrim: rgba(15, 23, 42, 0.34);
  --shadow-pop: 0 18px 48px -14px rgba(15, 23, 42, 0.22), 0 2px 8px rgba(15, 23, 42, 0.08);
  --ill-fill: #ffffff;
  --ill-stroke: #1b2230;
  --ill-blue-fill: #dbeafe;
  --ill-blue-stroke: #1d4ed8;
  --callout-bg: #fff5f5;
  --tk-k: #0369a1;
  --tk-s: #15803d;
  --tk-st: #a16207;
  --tk-a: #0f766e;
  --tk-n: #c2410c;
  --tk-g: #be185d;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection { background: var(--accent-soft); }
img, svg { display: block; }
[hidden] { display: none !important; }

.mono { font-family: var(--font-mono); }
/* Code must show exactly what was typed: no "-->" → arrow ligatures. */
textarea, pre, .kbd, .mono, .syntax-help, .label, .chip, .eyebrow, .code-hl-inner, .gal-pre { font-variant-ligatures: none; font-feature-settings: "liga" 0, "calt" 0; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.kbd {
  font-family: var(--font-mono); font-size: 11px; line-height: 1;
  padding: 3px 6px; border-radius: 6px; border: 1px solid var(--line-2);
  color: var(--text-2); background: var(--panel-2); white-space: nowrap;
}

/* Section marker: a hollow UML diamond, a number, a name. "◇ 01 TEXT ⇄ DIAGRAM" */
.eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--font-mono); font-size: 11.5px; font-weight: 500;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-2);
}
.eyebrow::before { content: ""; width: 7px; height: 7px; border: 1.5px solid var(--accent); transform: rotate(45deg); flex: none; }
.eyebrow .n { color: var(--accent-text); }

.label {
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--text-3); font-weight: 500;
}
.label em { font-style: normal; text-transform: none; letter-spacing: 0; }

.display {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1.04;
  margin: 0;
  color: var(--text);
}
.accent-text { color: var(--accent-text); }

/* ---------- buttons & chips ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: 10px;
  font-weight: 500; font-size: 14.5px; white-space: nowrap;
  border: 1px solid transparent;
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease), color 0.15s var(--ease), opacity 0.15s, box-shadow 0.15s;
}
.btn svg { width: 16px; height: 16px; flex: none; }
.btn-lg { height: 46px; padding: 0 20px; font-size: 15.5px; border-radius: 11px; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 9px; }
.btn-sm svg { width: 15px; height: 15px; }
.btn-xs { height: 26px; padding: 0 9px; font-size: 12px; border-radius: 7px; gap: 6px; }
.btn-xs svg { width: 13px; height: 13px; }
.btn-primary { background: var(--accent); color: var(--accent-ink); font-weight: 600; box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.12); }
.btn-primary:hover { background: var(--accent-hi); }
:root[data-theme="light"] .btn-primary:hover { background: var(--accent-hi); }
.btn-ghost { border-color: var(--line-3); color: var(--text); background: transparent; }
.btn-ghost:hover { background: var(--hover); border-color: var(--text-3); }
.btn-quiet { color: var(--text-2); }
.btn-quiet:hover { color: var(--text); background: var(--hover); }
.btn-quiet.on { color: var(--accent-text); background: var(--accent-soft); }
.btn-danger { color: var(--red); border-color: color-mix(in srgb, var(--red) 40%, transparent); }
.btn-danger:hover { background: var(--red-soft); }
.btn[disabled] { opacity: 0.45; pointer-events: none; }

.icon-btn {
  display: inline-grid; place-items: center; width: 32px; height: 32px;
  border-radius: 8px; color: var(--text-2); flex: none;
  transition: background 0.12s, color 0.12s;
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn.active { background: var(--accent-soft); color: var(--accent-text); }
.icon-btn[disabled] { opacity: 0.35; pointer-events: none; }
.icon-btn svg { width: 17px; height: 17px; }

.chip {
  display: inline-flex; align-items: center; gap: 5px;
  height: 22px; padding: 0 7px; border-radius: 6px;
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.06em; text-transform: uppercase;
  border: 1px solid var(--line-2); color: var(--text-2); white-space: nowrap;
}
.chip svg { width: 11px; height: 11px; }
.chip-accent { color: var(--accent-text); border-color: var(--accent-line); background: var(--accent-soft); }
.chip-green { color: var(--green); border-color: color-mix(in srgb, var(--green) 45%, transparent); background: var(--green-soft); }
.chip-amber { color: var(--amber); border-color: color-mix(in srgb, var(--amber) 45%, transparent); background: var(--amber-soft); }
.chip-red { color: var(--red); border-color: color-mix(in srgb, var(--red) 45%, transparent); background: var(--red-soft); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; display: inline-block; flex: none; }

.card { background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--r-lg); }

.seg { display: inline-flex; padding: 3px; gap: 2px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--bg); max-width: 100%; }
.seg button {
  height: 30px; padding: 0 13px; border-radius: 7px; font-size: 13px; color: var(--text-2); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; min-width: 0;
}
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--panel-3); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-2); }
.seg-sm button { height: 24px; padding: 0 9px; font-size: 12px; }

/* Logo: two class boxes joined by an elbow connector */
.logo { display: inline-flex; align-items: center; gap: 9px; font-family: var(--font-display); font-weight: 700; font-size: 18px; letter-spacing: -0.03em; }
.logo-tile {
  width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; flex: none;
  color: #04201c; background: linear-gradient(145deg, #5eead4 0%, #2dd4bf 50%, #0ea5a4 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25);
}
.logo-tile svg { width: 17px; height: 17px; }
.logo b { color: var(--accent-text); font-weight: 700; }

.theme-toggle .sun { display: none; }
:root[data-theme="dark"] .theme-toggle .sun { display: block; }
:root[data-theme="dark"] .theme-toggle .moon { display: none; }

/* ==========================================================================
   Marketing site
   ========================================================================== */
.site { min-height: 100vh; }
.wrap { width: min(1120px, calc(100% - 32px)); margin: 0 auto; }

.nav {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  backdrop-filter: saturate(140%) blur(12px);
  -webkit-backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.nav-inner { height: 60px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.nav-left { display: flex; align-items: center; gap: 36px; min-width: 0; }
.nav-links { display: flex; gap: 4px; font-size: 14px; color: var(--text-2); }
.nav-links a { padding: 6px 10px; border-radius: 8px; }
.nav-links a:hover { color: var(--text); background: var(--hover); }
.nav-right { display: flex; align-items: center; gap: 8px; }

/* Graph paper, fading out towards the edges */
.hero { position: relative; overflow: hidden; border-bottom: 1px solid var(--line); }
.hero-grid {
  position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(var(--grid-major) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-major) 1px, transparent 1px),
    linear-gradient(var(--grid-minor) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-minor) 1px, transparent 1px);
  background-size: 96px 96px, 96px 96px, 24px 24px, 24px 24px;
  background-position: -1px -1px;
  -webkit-mask-image: radial-gradient(ellipse 75% 70% at 65% 40%, #000 25%, transparent 78%);
  mask-image: radial-gradient(ellipse 75% 70% at 65% 40%, #000 25%, transparent 78%);
}
.hero-inner { position: relative; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 48px; padding: 84px 0 56px; align-items: center; }
.pill {
  display: inline-flex; align-items: center; gap: 10px; min-height: 32px; padding: 3px 12px 3px 4px; border-radius: 999px; line-height: 1.35;
  border: 1px solid var(--line-2); background: var(--panel); font-size: 13px; color: var(--text-2); margin-bottom: 26px; max-width: 100%;
}
.pill:hover { border-color: var(--accent-line); color: var(--text); }
.pill svg { width: 13px; height: 13px; flex: none; }
.pill-tag { height: 24px; padding: 0 9px; border-radius: 999px; display: inline-grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; flex: none; }
.hero h1 { font-size: clamp(42px, 6.2vw, 78px); }
.hero-sub { font-size: clamp(19px, 2.1vw, 23px); font-weight: 500; letter-spacing: -0.015em; line-height: 1.4; margin: 24px 0 14px; max-width: 560px; }
.wrong { text-decoration: underline wavy var(--red); text-decoration-thickness: 1.5px; text-underline-offset: 6px; text-decoration-skip-ink: none; }
.hero-body { color: var(--text-2); max-width: 540px; margin: 0 0 30px; }
.hero-ctas { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.hero-meta { list-style: none; padding: 0; margin: 22px 0 0; display: flex; flex-wrap: wrap; gap: 8px 20px; font-size: 13.5px; color: var(--text-2); }
.hero-meta li { display: flex; align-items: center; gap: 7px; }
.hero-meta svg { width: 15px; height: 15px; color: var(--accent); }
.hero-art { position: relative; }
.hero-art::before { content: ""; position: absolute; inset: 10% 6% -6% 6%; background: radial-gradient(closest-side, var(--glow), transparent); pointer-events: none; }
.hero-art svg { position: relative; width: 100%; height: auto; filter: drop-shadow(0 30px 60px rgba(0, 0, 0, 0.18)); }

/* The blueprint sheet illustration */
.ill .sheet { fill: var(--panel); stroke: var(--line-2); }
.ill .ticks line { stroke: var(--line-3); stroke-width: 1; }
.ill text { font-family: var(--font-sans); fill: var(--text); }
.ill .box { fill: var(--ill-fill); stroke: var(--ill-stroke); stroke-width: 1.3; }
.ill .c-blue .box { fill: var(--ill-blue-fill); stroke: var(--ill-blue-stroke); }
.ill .c-blue .sep { stroke: var(--ill-blue-stroke); }
.ill .sep { stroke: var(--ill-stroke); stroke-width: 1; }
.ill .nm { font-weight: 600; font-size: 13px; text-anchor: middle; }
.ill .nm.it { font-style: italic; }
.ill .st { font-family: var(--font-mono); font-size: 9.5px; fill: var(--text-3); text-anchor: middle; letter-spacing: 0.06em; }
.ill .mb { font-family: var(--font-mono); font-size: 10.5px; fill: var(--text-2); }
.ill .ln { stroke: var(--ill-stroke); stroke-width: 1.3; }
.ill .lb { font-size: 11.5px; fill: var(--text-2); text-anchor: middle; font-style: italic; }
.ill .mu { font-family: var(--font-mono); font-size: 10.5px; fill: var(--text-2); }
.ill .mu.bad { fill: var(--red); font-weight: 600; }
.ill .wavy { fill: none; stroke: var(--red); stroke-width: 1.3; }
.ill .solid { fill: var(--ill-stroke); }
.ill .hollow { fill: var(--panel); stroke: var(--ill-stroke); stroke-width: 1.3; }
.ill .sel { fill: none; stroke: var(--accent); stroke-width: 1.5; }
.ill .hdl { fill: var(--panel); stroke: var(--accent); stroke-width: 1.5; }
.ill .dim line { stroke: var(--accent); stroke-width: 1; opacity: 0.75; }
.ill .dim text { font-family: var(--font-mono); font-size: 9.5px; fill: var(--accent-text); text-anchor: middle; }
.ill .lead { stroke: var(--red); stroke-width: 1; stroke-dasharray: 3 3; }
.ill .callout rect { fill: var(--callout-bg); stroke: var(--red); stroke-width: 1.2; }
.ill .callout circle { fill: var(--red); }
.ill .callout .bang { fill: #fff; font-weight: 700; font-size: 10px; text-anchor: middle; }
.ill .callout .ct { font-size: 12px; font-weight: 600; }
.ill .callout .cs { font-family: var(--font-mono); font-size: 9.5px; fill: var(--text-2); }
.ill .legend .lg { fill: var(--panel); stroke: var(--line-3); }
.ill .legend .c-blue-sw { fill: var(--ill-blue-fill); stroke: var(--ill-blue-stroke); }
.ill .legend .st { text-anchor: end; }
.ill .tblock rect { fill: none; stroke: var(--line-3); }
.ill .tblock line { stroke: var(--line-3); }
.ill .tblock text { text-anchor: start; }

.formats { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 18px 0 26px; border-top: 1px solid var(--line); }
.formats .label { margin-right: 8px; }
.fmt { font-family: var(--font-mono); font-size: 12px; padding: 4px 10px; border: 1px solid var(--line-2); border-radius: 7px; color: var(--text-2); background: var(--panel); }

.section { padding: 104px 0; border-bottom: 1px solid var(--line); position: relative; }
.section-head { max-width: 700px; margin-bottom: 40px; }
.section-head h2, .h2 { font-family: var(--font-display); font-size: clamp(30px, 4vw, 46px); letter-spacing: -0.035em; line-height: 1.08; margin: 16px 0 14px; font-weight: 600; }
.section-head p { color: var(--text-2); font-size: 17px; margin: 0; }
.center { text-align: center; margin-left: auto; margin-right: auto; }

/* Gallery: code on the left, the real render on the right */
.gallery { border: 1px solid var(--line-2); border-radius: var(--r-xl); background: var(--bg-elev); overflow: hidden; }
.gal-tabs { display: flex; gap: 2px; padding: 8px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.gal-tabs::-webkit-scrollbar { display: none; }
.gal-tabs button { display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px; border-radius: 8px; font-size: 13.5px; color: var(--text-2); white-space: nowrap; flex: none; }
.gal-tabs button svg { width: 15px; height: 15px; }
.gal-tabs button:hover { color: var(--text); background: var(--hover); }
.gal-tabs button.on { color: var(--text); background: var(--panel-3); box-shadow: inset 0 -2px 0 var(--accent); }
.gal-body { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); min-height: 440px; }
.gal-code { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-width: 0; background: var(--panel); }
.gal-bar { display: flex; justify-content: space-between; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.gal-pre { padding: 12px 14px; font-family: var(--font-mono); font-size: 12px; line-height: 19px; color: var(--text); max-height: 470px; overflow-y: auto; }
.gal-pre .cl { white-space: pre-wrap; overflow-wrap: anywhere; min-height: 19px; }
.gal-canvas { position: relative; display: grid; place-items: center; padding: 28px 28px 64px; background: var(--canvas); background-image: radial-gradient(var(--grid-dot) 1px, transparent 1.2px); background-size: 20px 20px; min-width: 0; }
.gal-canvas > svg { width: 100%; height: auto; max-height: 420px; }
.gal-open { position: absolute; right: 14px; bottom: 14px; background: var(--panel); }

/* Diagram type tiles */
.types { display: grid; gap: 26px; }
.tgroup { display: grid; gap: 10px; }
.tgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.ttile { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--bg-elev); transition: border-color 0.15s, background 0.15s; }
.ttile:hover { border-color: var(--accent-line); background: var(--accent-soft); }
.ttile > svg { width: 30px; height: 30px; padding: 6px; border-radius: 8px; color: var(--accent-text); background: var(--accent-soft); flex: none; }
.ttile b { display: block; font-size: 14.5px; }
.ttile small { display: block; color: var(--text-2); font-size: 12.5px; line-height: 1.4; margin-top: 2px; }

/* Checks section */
.split { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 56px; align-items: center; }
.ticks-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; color: var(--text-2); }
.ticks-list li { display: flex; gap: 10px; align-items: flex-start; }
.ticks-list svg { width: 16px; height: 16px; color: var(--accent); margin-top: 3px; flex: none; }
.probstack { display: grid; gap: 10px; padding: 18px; border: 1px solid var(--line-2); border-radius: var(--r-xl); background: var(--bg-elev); background-image: radial-gradient(var(--grid-dot) 1px, transparent 1.2px); background-size: 18px 18px; }
.probcard { border: 1px solid var(--line-2); border-radius: 12px; padding: 12px 14px; background: var(--panel); display: grid; gap: 6px; justify-items: start; }
.probcard-top { display: flex; align-items: center; gap: 8px; width: 100%; }
.probcard-top svg { width: 15px; height: 15px; }
.probcard-top .rule { font-family: var(--font-mono); font-size: 11px; color: var(--text-3); }
.probcard-top .chip { margin-left: auto; }
.probcard .msg { font-size: 14px; }
.probcard .hint { font-size: 13px; color: var(--text-2); }
.sev-error { color: var(--red); }
.sev-warning { color: var(--amber); }
.sev-info { color: var(--cyan); }

/* Comparison table */
.compare { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.compare-wrap { overflow-x: auto; border: 1px solid var(--line-2); border-radius: var(--r-lg); }
.compare th, .compare td { padding: 14px 16px; text-align: center; border-bottom: 1px solid var(--line); white-space: nowrap; }
.compare th:first-child, .compare td:first-child { text-align: left; white-space: normal; min-width: 220px; }
.compare thead th { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-3); font-weight: 500; background: var(--bg-elev); }
.compare thead th.us { color: var(--accent-text); }
.compare td.us { background: var(--accent-soft); }
.compare tr:last-child td { border-bottom: 0; }
.yes { color: var(--green); font-weight: 600; }
.no { color: var(--text-3); }
.part { color: var(--amber); font-family: var(--font-mono); font-size: 12px; }
.footnote { color: var(--text-3); font-size: 12.5px; margin-top: 14px; }

/* Features grid */
.fgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; border: 1px solid var(--line-2); border-radius: var(--r-lg); overflow: hidden; }
.fcard { padding: 26px; background: var(--bg-elev); border-right: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); }
.fcard:nth-child(3n) { border-right: 0; }
.fcard:nth-last-child(-n + 3) { border-bottom: 0; }
.fcard .ic { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; border: 1px solid var(--accent-line); color: var(--accent-text); margin-bottom: 18px; }
.fcard .ic svg { width: 17px; height: 17px; }
.fcard h3 { margin: 0 0 6px; font-size: 16.5px; letter-spacing: -0.01em; }
.fcard p { margin: 0; color: var(--text-2); font-size: 14.5px; }
.fcard .label { display: block; margin-top: 16px; }

/* Pricing */
.billing { display: flex; justify-content: center; margin: 0 0 36px; }
.plans { display: grid; grid-template-columns: repeat(2, minmax(0, 380px)); gap: 20px; justify-content: center; }
.plan { border: 1px solid var(--line-2); border-radius: var(--r-xl); padding: 28px; background: var(--bg-elev); display: flex; flex-direction: column; }
.plan.featured { border-color: var(--accent-line); box-shadow: 0 0 80px -24px var(--glow); }
.plan-top { display: flex; justify-content: space-between; align-items: center; }
.price { display: flex; align-items: baseline; gap: 8px; margin: 18px 0 22px; }
.price .amt { font-family: var(--font-display); font-size: 52px; font-weight: 600; letter-spacing: -0.04em; line-height: 1; }
.plan ul { list-style: none; padding: 0; margin: 0 0 26px; display: grid; gap: 11px; font-size: 14.5px; }
.plan li { display: flex; gap: 10px; align-items: flex-start; }
.plan li svg { width: 15px; height: 15px; color: var(--text-3); margin-top: 4px; flex: none; }
.plan.featured li svg { color: var(--accent); }
.plan .btn { margin-top: auto; width: 100%; }

/* FAQ */
.faq { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); gap: 48px; }
.faq details { border-top: 1px solid var(--line-2); }
.faq details:last-child { border-bottom: 1px solid var(--line-2); }
.faq summary { list-style: none; display: flex; gap: 16px; align-items: baseline; padding: 20px 0; cursor: pointer; font-weight: 600; font-size: 16.5px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary .n { font-family: var(--font-mono); font-weight: 400; font-size: 12px; color: var(--accent-text); }
.faq summary .plus { margin-left: auto; color: var(--text-3); transition: transform 0.2s var(--ease); align-self: center; }
.faq summary .plus svg { width: 16px; height: 16px; }
.faq details[open] summary .plus { transform: rotate(45deg); }
.faq details p { margin: -6px 0 20px 34px; color: var(--text-2); }

/* CTA */
.cta { text-align: center; position: relative; overflow: hidden; }
.cta .hero-grid { -webkit-mask-image: radial-gradient(ellipse 60% 80% at 50% 50%, #000 20%, transparent 75%); mask-image: radial-gradient(ellipse 60% 80% at 50% 50%, #000 20%, transparent 75%); }
.cta-title { font-size: clamp(34px, 5vw, 58px); }
.cta-box {
  margin: 30px auto 14px; width: min(560px, 100%); display: flex; gap: 8px; padding: 6px;
  border: 1px solid var(--line-3); border-radius: 13px; background: var(--panel);
}
.cta-box:focus-within { border-color: var(--accent-line); box-shadow: 0 0 0 4px var(--accent-soft); }
.cta-box input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; padding: 0 12px; font-family: var(--font-mono); font-size: 13.5px; }
.cta-box input::placeholder { color: var(--text-3); }

/* Footer, ending in an engineering-drawing title block */
.footer { padding: 64px 0 0; }
.footer-grid { display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: 32px; }
.footer h4 { margin: 4px 0 18px; }
.footer ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; color: var(--text-2); font-size: 14.5px; }
.footer ul a:hover { color: var(--text); }
.titleblock { display: grid; grid-template-columns: 2fr repeat(5, 1fr); margin-top: 56px; border: 1.5px solid var(--line-3); border-radius: 4px; }
.tb-cell { padding: 10px 14px; border-left: 1px solid var(--line-3); display: grid; gap: 3px; font-size: 13.5px; min-width: 0; }
.tb-cell:first-child { border-left: 0; }
.tb-cell .label { font-size: 9.5px; }
.tb-name b { font-family: var(--font-display); font-size: 20px; letter-spacing: -0.03em; }
.footer-bottom { display: flex; justify-content: space-between; gap: 16px; padding: 22px 0 28px; color: var(--text-3); font-size: 13px; }

/* ==========================================================================
   Projects page
   ========================================================================== */
.topnav { height: 58px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; padding: 0 24px; gap: 16px; }
.topnav-left { display: flex; align-items: center; gap: 28px; min-width: 0; }
.topnav-right { display: flex; align-items: center; gap: 10px; }
.topnav-links { display: flex; gap: 4px; font-size: 14px; color: var(--text-2); }
.topnav-links a { padding: 6px 10px; border-radius: 8px; }
.topnav-links a.on { color: var(--text); background: var(--panel-3); }
.topnav-links a:hover { color: var(--text); }
.page { width: min(1120px, calc(100% - 32px)); margin: 0 auto; padding: 44px 0 80px; position: relative; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 26px; flex-wrap: wrap; }
.page-head h1 { font-size: clamp(36px, 5vw, 52px); margin: 14px 0 6px; }
.page-head p { margin: 0; color: var(--text-2); }
.quick { padding: 18px 20px 10px; margin-bottom: 20px; background: var(--bg-elev); }
.quick-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 8px; }
.qgroup { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 12px; align-items: start; padding: 10px 0; border-top: 1px solid var(--line); }
.qgroup > .label { padding-top: 8px; }
.qrow { display: flex; flex-wrap: wrap; gap: 6px; }
.qbtn { display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 11px; border: 1px solid var(--line-2); border-radius: 9px; font-size: 13px; background: var(--panel); color: var(--text); }
.qbtn svg { width: 15px; height: 15px; color: var(--accent-text); }
.qbtn:hover { border-color: var(--accent-line); background: var(--accent-soft); }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--line-2); border-radius: var(--r-lg); margin-bottom: 26px; }
.stat { padding: 16px 20px; border-right: 1px solid var(--line-2); min-width: 0; }
.stat:last-child { border-right: 0; }
.stat .num { font-family: var(--font-display); font-weight: 600; font-size: 30px; letter-spacing: -0.03em; margin-top: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pgrid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.plist-head { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; }
.plist-head .search { flex: 1; margin: 0; }
.pcards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.pcard { border: 1px solid var(--line-2); border-radius: var(--r-lg); overflow: hidden; background: var(--bg-elev); display: flex; flex-direction: column; transition: border-color 0.15s; cursor: pointer; text-align: left; }
.pcard:hover { border-color: var(--line-3); }
.pcard-thumb { height: 150px; background: var(--canvas); background-image: radial-gradient(var(--grid-dot) 1px, transparent 1.2px); background-size: 16px 16px; display: grid; place-items: center; padding: 14px; border-bottom: 1px solid var(--line); }
.pcard-thumb svg { max-width: 100%; max-height: 122px; width: auto; height: auto; }
.pcard-thumb > .faint svg { width: 28px; height: 28px; }
.pcard-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; }
.pcard-title { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-weight: 600; }
.pcard-title .t { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pcard-meta { display: flex; justify-content: space-between; gap: 8px; color: var(--text-3); font-size: 12.5px; }
.pcard-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 2px; }
.ptypes { display: flex; align-items: center; gap: 6px; color: var(--text-3); }
.ptypes svg { width: 15px; height: 15px; }
.pcard-new { border-style: dashed; display: grid; place-items: center; text-align: center; min-height: 240px; gap: 8px; padding: 20px; }
.plus-circle { width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--accent-line); color: var(--accent-text); display: grid; place-items: center; margin: 0 auto 10px; }
.plus-circle svg { width: 18px; height: 18px; }
.side-col { display: grid; gap: 16px; }
.setup { padding: 20px; }
.setup-bar { height: 4px; border-radius: 4px; background: var(--line-2); margin: 12px 0 14px; overflow: hidden; }
.setup-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--cyan)); }
.setup-item { display: flex; gap: 12px; align-items: center; padding: 9px 0; font-size: 14.5px; }
.setup-item .ck { width: 20px; height: 20px; border-radius: 50%; border: 1px solid var(--line-3); display: grid; place-items: center; flex: none; }
.setup-item.done { color: var(--text-3); text-decoration: line-through; }
.setup-item.done .ck { border-color: var(--green); color: var(--green); }
.setup-item .ck svg { width: 12px; height: 12px; }
.tip { padding: 20px; background: var(--bg-elev); }
.tip h3 { margin: 10px 0 6px; font-size: 16px; }
.tip p { margin: 0; color: var(--text-2); font-size: 14px; }
.deleted { margin-top: 30px; }
.deleted-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px; border: 1px solid var(--line-2); border-radius: var(--r); margin-top: 8px; font-size: 14px; }

/* ==========================================================================
   Editor
   ========================================================================== */
.app { position: fixed; inset: 0; display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); background: var(--bg); }
.app.no-sidebar { grid-template-columns: 0 minmax(0, 1fr); }
.app.no-sidebar .sidebar { visibility: hidden; }

.sidebar { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; background: var(--bg); min-width: 0; }
.sb-top { display: flex; align-items: center; justify-content: space-between; padding: 14px 12px 10px 14px; }
.proj-card { margin: 4px 12px 10px; padding: 9px 10px; border: 1px solid var(--line-2); border-radius: var(--r); display: flex; gap: 10px; align-items: center; background: var(--panel); width: calc(100% - 24px); color: var(--text-2); }
.proj-card:hover { border-color: var(--line-3); }
.proj-card > svg { width: 15px; height: 15px; flex: none; }
.avatar { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; font-weight: 700; font-size: 12.5px; color: #04201c; flex: none; background: linear-gradient(145deg, #5eead4, #0ea5a4); }
.proj-card .nm { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.proj-card .sub { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.08em; color: var(--text-3); text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-section { padding: 4px 12px; display: flex; flex-direction: column; min-height: 0; }
.sb-section.grow { flex: 1; }
.sb-label { display: flex; align-items: center; justify-content: space-between; padding: 8px 6px 6px; }
.sb-label .icon-btn { width: 24px; height: 24px; }
.sb-label .icon-btn svg { width: 14px; height: 14px; }
.diagram-list { max-height: 36vh; overflow-y: auto; scrollbar-width: thin; }
.sb-row { display: flex; align-items: center; position: relative; }
.sb-row .sb-item { flex: 1; min-width: 0; }
.row-more { position: absolute; right: 2px; width: 26px; height: 26px; opacity: 0; background: var(--panel-3); }
.row-more svg { width: 15px; height: 15px; }
.sb-row:hover .row-more, .row-more:focus-visible { opacity: 1; }
.sb-row:hover .cnt { visibility: hidden; }
.sb-item {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 6px 10px; border-radius: 8px; font-size: 13.5px; color: var(--text-2); position: relative;
}
.sb-item:hover { background: var(--hover); color: var(--text); }
.sb-item.on { background: var(--panel-3); color: var(--text); }
.sb-item.on::before { content: ""; position: absolute; left: -12px; top: 7px; bottom: 7px; width: 2px; border-radius: 2px; background: var(--accent); }
.sb-item svg { width: 16px; height: 16px; flex: none; }
.sb-item .nm { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-item .cnt { font-family: var(--font-mono); font-size: 10.5px; color: var(--text-3); }
.sb-item .cnt.unused { color: var(--amber); }
.sb-item input { flex: 1; min-width: 0; background: var(--panel-2); border: 1px solid var(--accent-line); border-radius: 6px; padding: 1px 6px; outline: 0; font-size: 13.5px; }
.search { position: relative; margin: 0 2px 8px; }
.search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 14px; height: 14px; color: var(--text-3); }
.search input { width: 100%; height: 32px; border-radius: 9px; border: 1px solid var(--line-2); background: var(--panel); padding: 0 10px 0 30px; font-size: 13px; outline: 0; }
.search input:focus { border-color: var(--accent-line); }
.tree { overflow-y: auto; min-height: 0; flex: 1; padding-bottom: 8px; scrollbar-width: thin; }
.tree-group { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-3); padding: 10px 10px 4px; }
.tree .sb-item { padding: 5px 10px; font-size: 13px; cursor: grab; }
.tree-empty { padding: 10px; color: var(--text-3); font-size: 13px; }
.sb-bottom { border-top: 1px solid var(--line); padding: 10px 12px 12px; display: grid; gap: 8px; }
.save-status { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-2); padding: 6px 8px; border-radius: 8px; text-align: left; width: 100%; }
.save-status:hover { background: var(--hover); }
.save-status .dot { color: var(--green); }
.save-status.saving .dot { color: var(--amber); }
.save-status.error .dot { color: var(--red); }
.save-status .where { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-3); display: block; }
.sb-actions { display: flex; gap: 4px; }

.main { grid-column: 2; grid-row: 1; display: grid; grid-template-rows: 52px minmax(0, 1fr); min-width: 0; min-height: 0; position: relative; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 0 10px 0 12px; border-bottom: 1px solid var(--line); min-width: 0; }
.crumbs { display: flex; align-items: center; gap: 8px; min-width: 150px; flex: 0 1 auto; font-size: 14px; }
.crumbs .proj { color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px; }
.crumbs .sep { color: var(--line-3); }
.crumbs .dname { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; cursor: text; border-radius: 6px; padding: 2px 4px; }
.crumbs .dname:hover { background: var(--hover); }
.crumbs input { font-weight: 600; background: var(--panel-2); border: 1px solid var(--accent-line); border-radius: 6px; padding: 2px 6px; outline: 0; width: 200px; }
.toolbar { display: flex; align-items: center; gap: 2px; padding: 3px; border: 1px solid var(--line-2); border-radius: 11px; background: var(--panel); margin: 0 auto; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.toolbar::-webkit-scrollbar { display: none; }
.toolbar .icon-btn { width: 34px; height: 32px; position: relative; }
.toolbar .icon-btn .k { position: absolute; right: 3px; bottom: 1px; font-family: var(--font-mono); font-size: 8.5px; color: var(--text-3); }
.toolbar .divider { width: 1px; height: 20px; background: var(--line-2); margin: 0 4px; flex: none; }
.top-right { display: flex; align-items: center; gap: 6px; }
.zoom { display: flex; align-items: center; border: 1px solid var(--line-2); border-radius: 9px; height: 32px; }
.zoom .icon-btn { width: 28px; height: 30px; }
.zoom button.pct { font-family: var(--font-mono); font-size: 11.5px; width: 50px; color: var(--text-2); height: 30px; }
.zoom button.pct:hover { color: var(--text); }
.problems-pill { display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px; border-radius: 9px; border: 1px solid var(--line-2); font-size: 12.5px; color: var(--text-2); white-space: nowrap; }
.problems-pill:hover { background: var(--hover); color: var(--text); }
.problems-pill .cnt-sm { display: none; font-family: var(--font-mono); font-size: 11.5px; }
.problems-pill.ok .dot { color: var(--green); }
.problems-pill.warn .dot { color: var(--amber); }
.problems-pill.err .dot { color: var(--red); }

.stage { display: grid; grid-template-columns: minmax(0, 1fr) var(--inspector-w); min-height: 0; }
.stage.no-inspector { grid-template-columns: minmax(0, 1fr) 0; }
.stage.no-inspector .inspector { visibility: hidden; }
.center-col { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.canvas-wrap { position: relative; overflow: hidden; background: var(--canvas); outline: none; touch-action: none; flex: 1; min-height: 140px; }
.canvas-wrap svg.canvas { position: absolute; inset: 0; width: 100%; height: 100%; user-select: none; -webkit-user-select: none; }
.canvas-wrap.panning, .canvas-wrap.panning * { cursor: grabbing !important; }
.canvas-wrap.tool-hand, .canvas-wrap.space { cursor: grab; }
.canvas-wrap.tool-create { cursor: crosshair; }
.canvas-wrap .node { cursor: default; }
.canvas-wrap [data-hit="handle"] { cursor: crosshair; }
.canvas-wrap [data-hit="lifeline-line"] { cursor: crosshair; }
.canvas-wrap [data-hit="edge"] { cursor: move; }
.canvas-wrap.dragover { box-shadow: inset 0 0 0 2px var(--accent-line); }

.canvas-hud { position: absolute; left: 12px; bottom: 12px; display: flex; gap: 8px; pointer-events: none; }
.canvas-hud .chip { background: var(--panel); pointer-events: auto; text-transform: none; letter-spacing: 0; font-size: 11.5px; height: 26px; padding: 0 10px; }

.empty-hint {
  position: absolute; left: calc(50% + 26px); top: 50%; transform: translate(-50%, -50%);
  width: min(460px, calc(100% - 100px)); padding: 26px; border-radius: var(--r-xl);
  border: 1px solid var(--line-2); background: color-mix(in srgb, var(--panel) 94%, transparent);
  text-align: center; pointer-events: auto; box-shadow: var(--shadow-pop);
}
.empty-hint h3 { font-family: var(--font-display); font-weight: 600; font-size: 26px; margin: 12px 0 8px; letter-spacing: -0.03em; }
.empty-hint p { color: var(--text-2); margin: 0 0 18px; font-size: 14px; }
.empty-hint .row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.canvas-wrap.tool-create .empty-hint { display: none; }

/* ---------- Dock: code + checks under the canvas ---------- */
.dock { flex: none; position: relative; border-top: 1px solid var(--line-2); background: var(--bg); display: flex; flex-direction: column; min-height: 0; }
.dock.open { height: var(--dock-h, 240px); }
.dock-resize { position: absolute; left: 0; right: 0; top: -5px; height: 9px; cursor: ns-resize; z-index: 4; }
.dock-resize::after { content: ""; position: absolute; left: 0; right: 0; top: 4px; height: 2px; background: transparent; transition: background 0.15s; }
.dock-resize:hover::after { background: var(--accent); }
.dock-bar { height: 40px; flex: none; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 8px; }
.dock.open .dock-bar { border-bottom: 1px solid var(--line); }
.dock-tabs { display: flex; gap: 2px; flex: none; }
.dock-tab { height: 28px; padding: 0 10px; border-radius: 7px; display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-2); white-space: nowrap; }
.dock-tab:hover { background: var(--hover); color: var(--text); }
.dock-tab.on { background: var(--panel-3); color: var(--text); }
.dock-tab svg { width: 14px; height: 14px; flex: none; }
.dock-tab .label { font-size: 9.5px; }
.badge { font-family: var(--font-mono); font-size: 10px; padding: 1px 6px; border-radius: 5px; background: var(--red-soft); color: var(--red); display: inline-flex; align-items: center; }
.badge.warn { background: var(--amber-soft); color: var(--amber); }
.badge.ok { background: var(--green-soft); color: var(--green); padding: 2px 4px; }
.badge.ok svg { width: 10px; height: 10px; }
.dock-actions { display: flex; align-items: center; gap: 4px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.dock-actions::-webkit-scrollbar { display: none; }
.dock-actions .btn, .dock-actions .seg { flex: none; }
.dock-body { flex: 1; min-height: 0; overflow: auto; }
.code-body { display: flex; flex-direction: column; overflow: hidden; }

.code-editor { position: relative; flex: 1; min-height: 0; display: grid; grid-template-columns: 44px minmax(0, 1fr); background: var(--panel); }
.code-gutter { overflow: hidden; border-right: 1px solid var(--line); background: var(--bg-elev); user-select: none; }
.gutter-inner { padding: 10px 8px 10px 0; will-change: transform; }
.gl { text-align: right; font-family: var(--font-mono); font-size: 12px; line-height: 20px; color: var(--text-3); }
.gl.err { color: var(--red); font-weight: 600; }
.code-area { position: relative; min-width: 0; min-height: 0; }
.code-hl { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.code-hl-inner, .code-area textarea {
  font-family: var(--font-mono); font-size: 12.5px; line-height: 20px; tab-size: 2; -moz-tab-size: 2; letter-spacing: 0;
}
.code-hl-inner { padding: 10px 12px; color: var(--text); will-change: transform; }
.code-hl-inner .cl { white-space: pre; min-height: 20px; }
.code-editor.wrap .code-hl-inner .cl { white-space: pre-wrap; overflow-wrap: anywhere; }
.code-hl-inner .cl.err { background: var(--red-soft); box-shadow: inset 2px 0 0 var(--red); }
.code-area textarea {
  position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; border: 0; outline: 0; resize: none;
  padding: 10px 12px; background: transparent; color: transparent; caret-color: var(--text);
  white-space: pre; overflow: auto; overflow-wrap: normal;
}
.code-editor.wrap textarea { white-space: pre-wrap; overflow-wrap: anywhere; overflow-x: hidden; }
.code-area textarea::selection { background: var(--accent-soft); color: transparent; }
.code-area textarea::placeholder { color: var(--text-3); }
.tk-k { color: var(--tk-k); }
.tk-s { color: var(--tk-s); }
.tk-st { color: var(--tk-st); }
.tk-a { color: var(--tk-a); font-weight: 600; }
.tk-n { color: var(--tk-n); }
.tk-g { color: var(--tk-g); }
.tk-c { color: var(--text-3); font-style: italic; }
.text-status { border-top: 1px solid var(--line); padding: 7px 12px; font-size: 12px; flex: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.text-status.ok { color: var(--green); }
.text-status.err { color: var(--red); white-space: normal; }
.syntax-help { flex: none; margin: 0; border-bottom: 1px solid var(--line); padding: 10px 14px; font-family: var(--font-mono); font-size: 11.5px; line-height: 1.6; color: var(--text-2); white-space: pre-wrap; overflow-wrap: anywhere; background: var(--bg-elev); max-height: 45%; overflow: auto; }

/* Checks in the dock */
.prob-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 8px; padding: 10px; }
.prob {
  border: 1px solid var(--line-2); border-radius: 11px; padding: 10px 12px; font-size: 13px; cursor: pointer;
  background: var(--panel); transition: border-color 0.12s;
}
.prob:hover { border-color: var(--line-3); }
.prob-head { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; }
.prob-head .rule { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.04em; color: var(--text-3); }
.prob-head svg { width: 15px; height: 15px; flex: none; }
.prob-head .sev { margin-left: auto; }
.prob .msg { color: var(--text); line-height: 1.45; }
.prob .hint { color: var(--text-2); margin-top: 5px; font-size: 12.5px; line-height: 1.45; }
.prob .acts { display: flex; gap: 6px; margin-top: 9px; flex-wrap: wrap; }
.prob-empty { text-align: center; padding: 26px 20px; color: var(--text-2); }
.prob-empty .ok { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto 10px; background: var(--green-soft); color: var(--green); }
.prob-empty .ok svg { width: 18px; height: 18px; }

/* ---------- Inspector ---------- */
.inspector { border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; background: var(--bg); min-width: 0; }
.tabs { display: flex; gap: 2px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.tab { flex: 1; height: 30px; border-radius: 8px; font-size: 12.5px; color: var(--text-2); display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.tab svg { width: 14px; height: 14px; flex: none; }
.tab:hover { background: var(--hover); color: var(--text); }
.tab.on { background: var(--panel-3); color: var(--text); }
.insp-body { overflow-y: auto; min-height: 0; flex: 1; padding: 16px; scrollbar-width: thin; }
.insp-body.flush { padding: 0; display: flex; flex-direction: column; }
.insp-title { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.insp-title .k { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; border: 1px solid var(--accent-line); color: var(--accent-text); flex: none; }
.insp-title .k svg { width: 16px; height: 16px; }
.insp-title .t { font-weight: 600; font-size: 15px; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.insp-title .s { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-3); }
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field > span { font-size: 12px; color: var(--text-2); font-weight: 500; display: flex; justify-content: space-between; gap: 8px; }
.field > span em { font-style: normal; color: var(--text-3); font-weight: 400; text-align: right; }
.input, .select, .textarea {
  width: 100%; border: 1px solid var(--line-2); background: var(--panel); border-radius: 8px;
  padding: 7px 10px; font-size: 13.5px; outline: 0; transition: border-color 0.12s, box-shadow 0.12s;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }
.input.bad { border-color: var(--red); }
.textarea { resize: vertical; min-height: 64px; line-height: 1.5; }
.textarea.code { font-family: var(--font-mono); font-size: 12.5px; min-height: 96px; white-space: pre-wrap; overflow-wrap: anywhere; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--text-2); cursor: pointer; }
.check input { accent-color: var(--accent); width: 15px; height: 15px; flex: none; }
.field-err { color: var(--red); font-size: 12px; }
.help { color: var(--text-3); font-size: 12px; line-height: 1.45; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.used-in { display: flex; flex-wrap: wrap; gap: 6px; }
.used-in button { font-size: 12px; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line-2); color: var(--text-2); }
.used-in button:hover { border-color: var(--accent-line); color: var(--text); }
.used-in button.cur { border-color: var(--accent-line); background: var(--accent-soft); color: var(--text); }
.hr { height: 1px; background: var(--line); margin: 16px 0; }
.align-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.align-grid .icon-btn { width: 100%; border: 1px solid var(--line-2); }
.swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.swatch { width: 26px; height: 26px; border-radius: 7px; border: 1.5px solid var(--line-3); display: grid; place-items: center; color: var(--text-3); background: var(--panel); transition: transform 0.1s; }
.swatch:hover { transform: translateY(-1px); }
.swatch svg { width: 12px; height: 12px; }
.swatch.on { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent); }
.sc-row { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.sc-row .keys { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }

/* Versions */
.ver-save { padding: 14px 16px; border-bottom: 1px solid var(--line); display: grid; gap: 8px; }
.ver-list { padding: 8px; display: grid; gap: 6px; }
.ver { border: 1px solid var(--line-2); border-radius: 11px; padding: 10px 12px; font-size: 13px; display: grid; gap: 4px; background: var(--panel); }
.ver .top { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.ver .nm { font-weight: 600; }
.ver .meta { color: var(--text-3); font-size: 12px; }
.ver .acts { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }

/* Banner */
.banner {
  position: absolute; left: 50%; top: 62px; transform: translateX(-50%); z-index: 30;
  display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 16px; border-radius: 12px;
  background: var(--panel); border: 1px solid var(--amber); box-shadow: var(--shadow-pop); font-size: 13.5px; max-width: calc(100% - 32px);
}
.banner svg { width: 16px; height: 16px; color: var(--amber); flex: none; }

/* ==========================================================================
   Floating UI: menus, inline editor, dialogs, palette, toasts
   ========================================================================== */
.menu {
  position: fixed; z-index: 1000; min-width: 220px; max-width: 320px; padding: 6px;
  background: var(--panel); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: var(--shadow-pop);
  max-height: 70vh; overflow-y: auto;
}
.menu-h { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-3); padding: 8px 10px 4px; }
.menu-sep { height: 1px; background: var(--line); margin: 5px 4px; }
.menu-it {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 7px 10px; border-radius: 8px; font-size: 13.5px; color: var(--text);
}
.menu-it:hover, .menu-it.hot { background: var(--hover); }
.menu-it svg { width: 15px; height: 15px; color: var(--text-2); flex: none; }
.menu-it .lbl { flex: 1; min-width: 0; }
.menu-it .lbl small { display: block; color: var(--text-3); font-size: 11.5px; line-height: 1.3; margin-top: 1px; }
.menu-it .kk { font-family: var(--font-mono); font-size: 10.5px; color: var(--text-3); }
.menu-it.danger { color: var(--red); }
.menu-it.danger svg { color: var(--red); }
.menu-it[disabled] { opacity: 0.4; pointer-events: none; }
.menu-it .tick { width: 15px; color: var(--accent-text); }

.inline-editor { position: fixed; z-index: 900; display: grid; gap: 6px; }
.inline-editor textarea, .inline-editor input {
  border: 1.5px solid var(--accent); border-radius: 8px; background: var(--panel); color: var(--text);
  padding: 8px 10px; outline: 0; box-shadow: 0 0 0 4px var(--accent-soft), var(--shadow-pop); resize: none;
  font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif; line-height: 1.45; width: 100%;
}
.inline-editor textarea.spec { font-family: var(--font-mono); font-size: 12.5px; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 60vh; }
.inline-hint { font-size: 11.5px; color: var(--text-2); background: var(--panel); border: 1px solid var(--line-2); border-radius: 8px; padding: 6px 9px; box-shadow: var(--shadow-pop); }
.inline-hint.err { color: var(--red); border-color: color-mix(in srgb, var(--red) 40%, transparent); }

.scrim { position: fixed; inset: 0; z-index: 1100; background: var(--scrim); display: grid; place-items: start center; padding: 8vh 0 24px; overflow-y: auto; }
.dialog {
  width: min(460px, calc(100% - 32px)); background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--r-xl);
  box-shadow: var(--shadow-pop); padding: 22px; max-height: 86vh; display: flex; flex-direction: column;
}
.dialog h3 { margin: 0 0 8px; font-family: var(--font-display); font-size: 19px; font-weight: 600; letter-spacing: -0.02em; }
.dialog h3:empty { display: none; }
.dialog-body { overflow-y: auto; min-height: 0; }
.dialog p { margin: 0 0 16px; color: var(--text-2); font-size: 14px; }
.dialog > .btn-row { justify-content: flex-end; margin-top: 18px; flex: none; }
.dialog > .btn-row:empty { display: none; }
.dialog.wide { width: min(820px, calc(100% - 32px)); }

/* Export / Import windows */
.dialog.dialog-x { padding: 0; overflow: hidden; }
.dialog.dialog-x .dialog-body { display: flex; flex-direction: column; min-height: 0; }
.xdialog { display: flex; flex-direction: column; min-height: 0; }
.xhead { display: flex; align-items: center; gap: 16px; padding: 12px 12px 12px 22px; border-bottom: 1px solid var(--line); flex: none; }
.xhead h3 { margin: 0; font-family: var(--font-display); font-size: 18px; font-weight: 600; letter-spacing: -0.02em; }
.xtabs { display: flex; gap: 2px; padding: 3px; border: 1px solid var(--line-2); border-radius: 10px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.xtabs button { height: 28px; padding: 0 11px; border-radius: 7px; font-size: 13px; color: var(--text-2); display: inline-flex; gap: 6px; align-items: center; white-space: nowrap; }
.xtabs button svg { width: 14px; height: 14px; }
.xtabs button:hover { color: var(--text); }
.xtabs button.on { background: var(--panel-3); color: var(--text); }
.x-close { margin-left: auto; }
.xbody { padding: 18px 22px 0; display: flex; flex-direction: column; gap: 16px; overflow-y: auto; min-height: 0; }
.xbody > .field, .xbody > .field-row .field { margin-bottom: 0; }
.xbody > .help { margin: 0; }
.xfoot { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 14px 0 18px; margin-top: 2px; border-top: 1px solid var(--line); position: sticky; bottom: 0; background: var(--panel); }
.xfoot .label { text-transform: none; letter-spacing: 0.02em; font-size: 11.5px; }
.fmt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 8px; }
.fmt-tile { border: 1px solid var(--line-2); border-radius: 11px; padding: 11px 12px; text-align: left; display: grid; gap: 2px; background: var(--bg-elev); align-content: start; }
.fmt-tile svg { width: 17px; height: 17px; color: var(--accent-text); margin-bottom: 4px; }
.fmt-tile b { font-size: 13.5px; }
.fmt-tile span { color: var(--text-2); font-size: 11.5px; line-height: 1.35; }
.fmt-tile:hover { border-color: var(--line-3); }
.fmt-tile.on { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.fmt-tile[disabled] { opacity: 0.4; cursor: not-allowed; }
.opt-row { display: flex; flex-wrap: wrap; gap: 10px 22px; align-items: center; }
.opt { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-2); }
.dropzone { display: grid; justify-items: center; gap: 6px; text-align: center; padding: 30px 20px; border: 1.5px dashed var(--line-3); border-radius: 14px; cursor: pointer; color: var(--text-2); background: var(--bg-elev); transition: border-color 0.15s, background 0.15s; }
.dropzone svg { width: 22px; height: 22px; color: var(--accent-text); margin-bottom: 4px; }
.dropzone b { color: var(--text); }
.dropzone span { font-size: 12px; color: var(--text-3); max-width: 460px; }
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.imp-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: -8px; }
.imp-list { display: grid; gap: 6px; max-height: 290px; overflow-y: auto; }
.imp-item { display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 9px 12px; border: 1px solid var(--line-2); border-radius: 10px; cursor: pointer; background: var(--bg-elev); }
.imp-item:hover { border-color: var(--line-3); }
.imp-item input { accent-color: var(--accent); width: 15px; height: 15px; }
.imp-item.bad { opacity: 0.85; }
.imp-ic svg { width: 16px; height: 16px; color: var(--accent-text); }
.imp-main { min-width: 0; }
.imp-main b { display: block; font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.imp-main small { display: block; font-size: 11.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.imp-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.imp-meta .chip-red { white-space: normal; height: auto; padding: 3px 7px; text-transform: none; letter-spacing: 0; }
.gh-status { font-size: 13px; padding: 10px 12px; border-radius: 10px; background: var(--panel-2); color: var(--text-2); }
.gh-status:empty { display: none; }
.gh-status.ok { background: var(--green-soft); color: var(--green); }
.gh-status.err { background: var(--red-soft); color: var(--red); }
.gh-status a { color: inherit; font-weight: 600; text-decoration: underline; }
.gh-private summary { cursor: pointer; font-size: 13px; color: var(--text-2); margin-bottom: 8px; }

/* Diagram-type picker (new diagram / new project) */
.picker { display: grid; gap: 14px; }
.picker > .field { margin-bottom: 0; }
.pick-group { display: grid; gap: 8px; }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
.type-opt { border: 1px solid var(--line-2); border-radius: 11px; padding: 11px 12px; text-align: left; display: grid; gap: 2px; background: var(--bg-elev); align-content: start; }
.type-opt:hover { border-color: var(--line-3); }
.type-opt.on { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.type-opt b { font-size: 13.5px; }
.type-opt span { color: var(--text-2); font-size: 11.5px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.type-opt svg { width: 17px; height: 17px; color: var(--accent-text); margin-bottom: 4px; }
.pick-foot { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; border-top: 1px solid var(--line); padding-top: 14px; }
.wide-opt { flex: 1 1 260px; }

.palette { width: min(600px, calc(100% - 32px)); background: var(--panel); border: 1px solid var(--line-2); border-radius: 16px; box-shadow: var(--shadow-pop); overflow: hidden; }
.palette input { width: 100%; height: 52px; border: 0; border-bottom: 1px solid var(--line); background: transparent; padding: 0 18px; font-size: 15.5px; outline: 0; }
.palette-list { max-height: 52vh; overflow-y: auto; padding: 6px; }
.palette-foot { display: flex; gap: 14px; padding: 9px 14px; border-top: 1px solid var(--line); color: var(--text-3); font-size: 11.5px; }
.palette-foot .kbd { font-size: 10px; padding: 2px 5px; }

.shortcuts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 28px; }
.shortcuts h4 { grid-column: 1 / -1; margin: 14px 0 4px; }

.toasts { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 1200; display: grid; gap: 8px; justify-items: center; pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 12px; padding: 9px 9px 9px 16px; min-height: 44px;
  background: var(--btn); color: var(--btn-ink); border-radius: 12px; box-shadow: var(--shadow-pop); font-size: 13.5px; max-width: min(620px, calc(100vw - 32px));
  animation: toast-in 0.18s var(--ease);
}
.toast-err { background: var(--red); color: #fff; }
.toast-actions { display: flex; gap: 4px; }
.toast-btn { padding: 5px 10px; border-radius: 8px; font-weight: 600; font-size: 13px; color: inherit; background: color-mix(in srgb, currentColor 12%, transparent); white-space: nowrap; }
.toast-btn:hover { background: color-mix(in srgb, currentColor 20%, transparent); }
.toast-x { color: inherit; opacity: 0.6; width: 26px; height: 26px; border-radius: 7px; }
.toast-x:hover { opacity: 1; background: transparent; color: inherit; }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Print / PDF export: only the diagrams are printed, one per page. */
#print-root { display: none; }
@media print {
  @page { margin: 12mm; }
  body.printing > *:not(#print-root) { display: none !important; }
  body.printing #print-root { display: block !important; }
  body.printing { background: #fff !important; }
  .print-page { break-after: page; page-break-after: always; }
  .print-page:last-child { break-after: auto; page-break-after: auto; }
  .print-title { font: 600 14pt "Inter", sans-serif; color: #111; margin: 0 0 6mm; }
  #print-root svg { width: 100%; height: auto; max-height: 250mm; }
}

/* ---------- responsive ---------- */
@media (max-width: 1360px) {
  .crumbs .proj, .crumbs .sep { display: none; }
  .toolbar .icon-btn { width: 30px; }
}
@media (max-width: 1180px) {
  :root { --inspector-w: 300px; --sidebar-w: 232px; }
  .crumbs .chip { display: none; }
  .crumbs .dname { max-width: 130px; }
  .toolbar .icon-btn .k { display: none; }
  .problems-pill { padding: 0 10px; }
  .problems-pill .txt { display: none; }
  .problems-pill .cnt-sm { display: inline; }
  .top-right .btn .hide-sm { display: none; }
  .top-right .btn { padding: 0 10px; }
  .zoom .icon-btn { display: none; }
  .dock-tab .label { display: none; }
}
@media (max-width: 1000px) {
  .hero-inner { grid-template-columns: 1fr; gap: 36px; padding-top: 64px; }
  .hero-art { max-width: 560px; }
  .gal-body { grid-template-columns: 1fr; }
  .gal-code { border-right: 0; border-bottom: 1px solid var(--line); }
  .gal-pre { max-height: 240px; }
}
@media (max-width: 900px) {
  .split, .faq, .pgrid { grid-template-columns: 1fr; }
  .fgrid { grid-template-columns: 1fr 1fr; }
  .fcard:nth-child(3n) { border-right: 1px solid var(--line-2); }
  .fcard:nth-child(2n) { border-right: 0; }
  .fcard:nth-last-child(-n + 3) { border-bottom: 1px solid var(--line-2); }
  .fcard:nth-last-child(-n + 2) { border-bottom: 0; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .titleblock { grid-template-columns: repeat(3, 1fr); }
  .tb-cell:nth-child(4) { border-left: 0; }
  .tb-cell:nth-child(n + 4) { border-top: 1px solid var(--line-3); }
  .nav-links { display: none; }
  .qgroup { grid-template-columns: 1fr; gap: 6px; }
  .qgroup > .label { padding-top: 0; }
  .app { grid-template-columns: 0 minmax(0, 1fr); }
  .app .sidebar { visibility: hidden; position: absolute; }
  .app.sidebar-open .sidebar { visibility: visible; position: absolute; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 40; box-shadow: var(--shadow-pop); }
  .stage { grid-template-columns: minmax(0, 1fr) 0; }
  .stage .inspector { visibility: hidden; position: absolute; }
  .stage.inspector-open .inspector { visibility: visible; position: absolute; right: 0; top: 52px; bottom: 0; width: min(var(--inspector-w), 100%); z-index: 40; box-shadow: var(--shadow-pop); }
}
@media (max-width: 640px) {
  .section { padding: 72px 0; }
  .fgrid, .plans, .pcards, .stats { grid-template-columns: 1fr; }
  .fcard { border-right: 0 !important; border-bottom: 1px solid var(--line-2) !important; }
  .fcard:last-child { border-bottom: 0 !important; }
  .stat { border-right: 0; border-bottom: 1px solid var(--line-2); }
  .stat:last-child { border-bottom: 0; }
  .footer-grid { grid-template-columns: 1fr; }
  .titleblock { grid-template-columns: 1fr 1fr; }
  .tb-cell { border-left: 0 !important; border-top: 1px solid var(--line-3); }
  .tb-cell:nth-child(2n) { border-left: 1px solid var(--line-3) !important; }
  .tb-cell:nth-child(-n + 2) { border-top: 0; }
  .footer-bottom { flex-direction: column; }
  .hide-xs { display: none !important; }
  .topnav { padding: 0 14px; }
  .topnav-links { display: none; }
  .hide-sm { display: none; }
  .topbar { gap: 4px; padding: 0 6px; }
  .toolbar { max-width: 46vw; min-width: 112px; flex: 1 1 auto; }
  .crumbs { min-width: 0; flex: 0 1 auto; }
  .crumbs .dname { max-width: 76px; }
  .top-right { gap: 2px; }
  .top-right [data-act="redo"], .top-right [data-act="code"] { display: none; }
  .problems-pill { padding: 0 8px; }
  .zoom, .top-right .hide-sm { display: none; }
  .shortcuts { grid-template-columns: 1fr; }
  .page-head .btn-row { width: 100%; }
  .xhead { flex-wrap: wrap; padding-left: 16px; }
  .xbody { padding: 14px 16px 0; }
  .field-row { grid-template-columns: 1fr; }
  .imp-item { grid-template-columns: auto auto minmax(0, 1fr); }
  .imp-meta { grid-column: 1 / -1; justify-content: flex-start; }
  .dock-actions .btn-quiet:not(.on) { padding: 0 7px; }
  .plist-head { flex-wrap: wrap; }
}

/* ---------- additions: menu swatches, minimap, growing label boxes ---------- */
.menu-swatches { display: grid; grid-template-columns: repeat(5, 24px); gap: 6px; padding: 4px 10px 8px; }
.menu-row { display: flex; align-items: center; gap: 2px; padding: 2px 6px 2px 10px; }
.menu-row-l { flex: 1; font-size: 13px; color: var(--text-2); }
.menu-row-b { width: 30px; height: 28px; border-radius: 7px; }
.menu-row-b.hot, .menu-row-b:hover { background: var(--hover); color: var(--text); }
.menu-swatches .swatch { width: 22px; height: 22px; border-radius: 6px; }
.minimap {
  position: absolute; right: 12px; bottom: 12px; z-index: 3; border-radius: 10px; overflow: hidden; cursor: pointer;
  background: color-mix(in srgb, var(--panel) 92%, transparent); border: 1px solid var(--line-2); box-shadow: var(--shadow-pop);
}
.minimap svg { width: 100%; height: 100%; display: block; }
.minimap .mm-view { fill: var(--accent-soft); stroke: var(--accent); vector-effect: non-scaling-stroke; }
.textarea.ml { min-height: 0; resize: none; overflow: hidden; line-height: 1.45; }
.inline-editor textarea { overflow: hidden; }

/* ---------- custom colours ---------- */
.swatch.custom { position: relative; overflow: hidden; border-color: var(--line-3); background: conic-gradient(from 90deg, #f43f5e, #f59e0b, #eab308, #22c55e, #06b6d4, #3b82f6, #a855f7, #f43f5e); cursor: pointer; }
.swatch.custom input { position: absolute; inset: -6px; width: calc(100% + 12px); height: calc(100% + 12px); opacity: 0; cursor: pointer; border: 0; padding: 0; }
.tones { display: grid; gap: 6px; }
.tone { display: grid; grid-template-columns: 30px 56px minmax(0, 1fr); align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-2); }
.tone input[type="color"] { width: 30px; height: 26px; padding: 0; border: 1px solid var(--line-3); border-radius: 7px; background: var(--panel); cursor: pointer; }
.tone input[type="color"]::-webkit-color-swatch-wrapper { padding: 2px; }
.tone input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 5px; }
.tone .hex { height: 28px; padding: 3px 8px; font-family: var(--font-mono); font-size: 12px; text-transform: uppercase; }

/* ---------- Marking (lecturer-style feedback) ---------- */
.mark-pill svg { width: 14px; height: 14px; flex: none; }
.mark-pill.ok svg { color: var(--green); }
.mark-pill.warn svg { color: var(--amber); }
.mark-pill.err svg { color: var(--red); }
.mark-pill .txt { font-weight: 600; font-variant-numeric: tabular-nums; }
.badge.mark-ok { background: var(--green-soft); color: var(--green); }
.badge.mark-warn { background: var(--amber-soft); color: var(--amber); }
.badge.mark-err { background: var(--red-soft); color: var(--red); }
.mark-body { display: grid; grid-template-columns: 268px minmax(0, 1fr); overflow: hidden; }
.mark-side { border-right: 1px solid var(--line); padding: 12px; overflow-y: auto; display: grid; gap: 12px; align-content: start; background: var(--bg-elev); }
.mark-main { overflow-y: auto; min-width: 0; }
.mark-score { display: flex; align-items: center; gap: 12px; --c: var(--accent); }
.mark-score.ok { --c: var(--green); }
.mark-score.warn { --c: var(--amber); }
.mark-score.err { --c: var(--red); }
.mark-score.empty { --c: var(--line-3); }
.mark-score .ring { width: 64px; height: 64px; flex: none; border-radius: 50%; display: grid; place-content: center; text-align: center; position: relative;
  background: conic-gradient(var(--c) calc(var(--p) * 1%), var(--line-2) 0); }
.mark-score .ring::before { content: ""; position: absolute; inset: 6px; border-radius: 50%; background: var(--bg-elev); }
.mark-score .ring b, .mark-score .ring span { position: relative; line-height: 1; }
.mark-score .ring b { font-size: 20px; font-family: var(--font-display); letter-spacing: -0.02em; }
.mark-score .ring span { font-size: 10px; color: var(--text-3); margin-top: 2px; }
.mark-band .band { font-family: var(--font-display); font-size: 18px; font-weight: 600; color: var(--c); letter-spacing: -0.01em; }
.mark-band .desc { font-size: 12px; color: var(--text-2); line-height: 1.4; margin-top: 2px; }
.crit-list { display: grid; gap: 2px; }
.crit { display: grid; grid-template-columns: 1fr auto; gap: 3px 8px; padding: 5px 7px; border-radius: 7px; text-align: left; font-size: 12px; color: var(--text-2); border: 1px solid transparent; }
.crit:hover { background: var(--hover); color: var(--text); }
.crit.on { border-color: var(--accent-line); background: var(--accent-soft); color: var(--text); }
.crit .pts { font-family: var(--font-mono); font-size: 11.5px; color: var(--text); }
.crit .pts i { font-style: normal; color: var(--text-3); }
.crit .bar { grid-column: 1 / -1; height: 4px; border-radius: 3px; background: var(--line-2); overflow: hidden; }
.crit .bar i { display: block; height: 100%; border-radius: 3px; background: var(--green); }
.crit .bar i.warn { background: var(--amber); }
.crit .bar i.err { background: var(--red); }
.mark-opts { display: grid; gap: 8px; border-top: 1px solid var(--line); padding-top: 10px; }
.mark-opts .field-row { grid-template-columns: 52px 1fr; align-items: center; gap: 8px; }
.mark-opts .seg { width: 100%; }
.mark-opts .seg button { flex: 1; padding: 0 4px; }
.input-xs { height: 28px; padding: 3px 8px; font-size: 12.5px; }
.mark-comment { padding: 12px 14px 4px; }
.mark-comment p { margin: 0; font-size: 13.5px; line-height: 1.5; color: var(--text); max-width: 760px; }
.mark-good { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.mark-good li { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--green); background: var(--green-soft); border-radius: 7px; padding: 3px 8px; }
.mark-good svg { width: 12px; height: 12px; }
.mark-filter { padding: 8px 14px 0; font-size: 12.5px; color: var(--text-2); }
.link { color: var(--accent-text); font-size: 12.5px; text-decoration: underline; text-underline-offset: 3px; }
.prob.mk.g-major { box-shadow: inset 3px 0 0 var(--red); }
.prob.mk.g-mistake { box-shadow: inset 3px 0 0 var(--amber); }
.prob.mk.g-minor { box-shadow: inset 3px 0 0 var(--line-3); }
.prob.mk.hot { border-color: var(--accent-line); }
.pnum.g-major { color: var(--red); }
.prob .pnum, .mark-focus .pnum { width: 20px; height: 20px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 700; border: 1.5px solid currentColor; color: var(--red); }
.prob.g-mistake .pnum, .pnum.g-mistake { color: var(--amber); }
.prob.g-minor .pnum, .pnum.g-minor { color: var(--text-3); }
.prob-head .sev { margin-left: 0; }
.crit-tag { font-size: 11px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.prob-head .minus { margin-left: auto; font-family: var(--font-mono); font-size: 12px; font-weight: 600; color: var(--red); white-space: nowrap; }
.prob-head .minus i { font-style: normal; font-weight: 400; font-size: 10px; color: var(--text-3); margin-left: 4px; }
.prob .why { margin-top: 6px; font-size: 12px; color: var(--text-3); }
.prob .why summary { cursor: pointer; width: max-content; }
.prob .why summary:hover { color: var(--text-2); }
.prob .why p { margin: 4px 0 0; color: var(--text-2); line-height: 1.45; }
.mark-ignored { padding: 0 14px 12px; }
.ign-list { display: grid; gap: 4px; margin-top: 6px; }
.ign { display: flex; align-items: center; gap: 10px; justify-content: space-between; font-size: 12.5px; color: var(--text-3); padding: 5px 8px; border: 1px dashed var(--line-2); border-radius: 8px; }
.mark-h { margin: 14px 14px 0; font-size: 12px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.05em; }
.pm-list { display: grid; gap: 4px; padding: 10px 12px; }
.pm-row { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto 70px; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 9px; border: 1px solid var(--line-2); background: var(--panel); text-align: left; font-size: 13px; }
.pm-row:hover { border-color: var(--line-3); }
.pm-row.on { border-color: var(--accent-line); }
.pm-row svg { width: 16px; height: 16px; color: var(--text-3); }
.pm-row .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pm-row .nm i { font-style: normal; color: var(--text-3); font-size: 11.5px; margin-left: 8px; }
.pm-row .cm { font-size: 12px; color: var(--text-3); }
.pm-row .sc { font-family: var(--font-mono); font-weight: 600; text-align: right; }
.pm-row .sc i { font-style: normal; font-weight: 400; font-size: 11px; margin-left: 6px; }
.mark-ok { color: var(--green); }
.mark-warn { color: var(--amber); }
.mark-err { color: var(--red); }
.rules-list { display: grid; gap: 4px; }
.rule-h { margin: 16px 0 2px; font-size: 14px; display: flex; gap: 8px; align-items: baseline; }
.rules-list .help { margin: 0 0 6px; }
.rule-row { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: start; padding: 7px 0; border-top: 1px solid var(--line); font-size: 13px; }
.rule-row p { margin: 2px 0 0 !important; font-size: 12.5px !important; color: var(--text-3) !important; }
.rule-row.off { opacity: 0.5; }
/* Marking sheet */
.ms-dialog { width: min(900px, calc(100% - 32px)) !important; }
.ms-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.marksheet { display: grid; gap: 16px; }
.ms-top { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding-bottom: 12px; border-bottom: 2px solid var(--line-2); }
.ms-top h3 { margin: 2px 0 0; font-family: var(--font-display); font-size: 22px; }
.ms-score { display: inline-flex; align-items: baseline; gap: 2px; font-family: var(--font-display); }
.ms-score b { font-size: 26px; }
.ms-score span { color: var(--text-3); font-size: 13px; }
.ms-score em { font-style: normal; font-size: 14px; font-weight: 600; margin-left: 8px; padding: 2px 8px; border-radius: 7px; background: var(--panel-3); }
.ms-score.big b { font-size: 38px; }
.ms-score.ok b, .ms-score.ok em { color: var(--green); }
.ms-score.warn b, .ms-score.warn em { color: var(--amber); }
.ms-score.err b, .ms-score.err em { color: var(--red); }
.ms-diagram { border: 1px solid var(--line-2); border-radius: 12px; padding: 14px 16px; display: grid; gap: 10px; background: var(--panel); break-inside: avoid; }
.ms-diagram header { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.ms-diagram h4 { margin: 0; font-size: 16px; }
.ms-comment { margin: 0 !important; color: var(--text) !important; }
.ms-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ms-table td { padding: 5px 6px; border-top: 1px solid var(--line); vertical-align: middle; }
.ms-table td.num { font-family: var(--font-mono); white-space: nowrap; width: 90px; }
.ms-table td.refs { width: 40%; }
.ms-bar { display: block; width: 110px; height: 5px; border-radius: 3px; background: var(--line-2); overflow: hidden; }
.ms-bar i { display: block; height: 100%; background: var(--accent); }
.ms-n { display: inline-grid; place-items: center; min-width: 19px; height: 19px; border-radius: 50%; border: 1.5px solid var(--red); color: var(--red); font-size: 10.5px; font-weight: 700; margin-right: 4px; flex: none; }
.ms-good ul { margin: 4px 0 0; padding-left: 18px; font-size: 13px; color: var(--text-2); }
.ms-items { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: 13px; }
.ms-items li { display: flex; gap: 8px; align-items: flex-start; line-height: 1.45; }
.ms-items .h { color: var(--text-2); font-size: 12.5px; }
.ms-note { font-size: 12px !important; color: var(--text-3) !important; border-top: 1px solid var(--line); padding-top: 10px; }
@media (max-width: 760px) {
  .mark-body { grid-template-columns: 1fr; overflow-y: auto; }
  .mark-side { border-right: 0; border-bottom: 1px solid var(--line); overflow: visible; }
  .mark-main { overflow: visible; }
  .pm-row { grid-template-columns: 18px minmax(0, 1fr) 64px; }
  .pm-row .cm { display: none; }
  .ms-table td.refs { display: none; }
}
@media print {
  .ms-actions { display: none; }
  .ms-diagram { border-color: #ccc; }
}

.prob-head .minus.zero { color: var(--text-3); font-weight: 400; font-family: inherit; font-size: 11.5px; }
.mark-band .range { font-size: 11.5px; color: var(--text-3); font-family: var(--font-mono); }
.mark-cap { display: flex; gap: 7px; font-size: 11.5px; line-height: 1.45; color: var(--text-2); padding: 7px 9px; border-radius: 8px; background: var(--panel-2); border: 1px solid var(--line); }
.mark-cap svg { width: 13px; height: 13px; flex: none; margin-top: 2px; color: var(--text-3); }
.mark-focus { margin: 10px 12px 0; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: 11px; background: var(--panel); }
.mark-focus b { font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-2); }
.mark-focus ol { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 4px; }
.mark-focus li { display: grid; grid-template-columns: 20px 1fr auto; gap: 8px; align-items: center; font-size: 13px; padding: 4px 6px; border-radius: 7px; cursor: pointer; }
.mark-focus li:hover { background: var(--hover); }
.mark-focus li em { font-style: normal; font-family: var(--font-mono); font-size: 12px; color: var(--red); white-space: nowrap; }
.prob.more { display: grid; place-content: center; text-align: center; gap: 3px; color: var(--accent-text); border-style: dashed; background: transparent; font-size: 13px; }
.prob.more .help { font-size: 11.5px; }
.ms-n.g-mistake { border-color: var(--amber); color: var(--amber); }
.ms-n.g-minor { border-color: var(--text-3); color: var(--text-3); }
b.g-major { color: var(--red); } b.g-mistake { color: var(--amber); } b.g-minor { color: var(--text-2); }
.ms-cap { margin: 0 !important; font-size: 12.5px !important; color: var(--text-3) !important; }
.ms-focus { padding: 8px 12px; border-radius: 9px; background: var(--panel-2); border: 1px solid var(--line); }
.ms-focus b { font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-2); }
.ms-focus ol { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 4px; font-size: 13px; }
.ms-focus li { display: flex; align-items: center; gap: 6px; }
.probcard .pnum { width: 20px; height: 20px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 700; border: 1.5px solid currentColor; }
.probcard-top .rule { margin-left: auto; color: var(--red); font-weight: 600; }
.mark-mini .mm-score { font-family: var(--font-display); font-size: 24px; letter-spacing: -0.02em; }
.mark-mini .mm-score span { font-size: 13px; color: var(--text-3); font-weight: 400; }
.probcard .pnum + .chip { margin-left: 0; }
.rules-how { margin: 0 0 14px; padding-left: 18px; display: grid; gap: 5px; font-size: 13.5px; color: var(--text-2); }
.rules-how b { color: var(--text); font-weight: 600; }
.crit .lv { font-style: normal; font-size: 10.5px; color: var(--text-3); margin-left: 6px; }
.ms-table td.lvl { font-size: 12px; color: var(--text-2); width: 90px; }
.pick-search { position: sticky; top: -1px; z-index: 2; padding: 0 0 12px; background: var(--panel); }
.pick-search .input { height: 38px; font-size: 14px; }
.pick-none { padding: 20px 4px; }
.chart { pointer-events: none; }
.tsearch { display: flex; align-items: center; gap: 10px; max-width: 560px; padding: 0 14px; height: 44px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--bg-elev); }
.tsearch svg { width: 17px; height: 17px; color: var(--text-3); flex: none; }
.tsearch input { flex: 1; min-width: 0; border: 0; background: transparent; outline: 0; font-size: 15px; color: var(--text); }
.tgroup .label em { font-style: normal; margin-left: 6px; }
.tgroup:not(.open):not(.searching) .ttile.more { display: none; }
.tgroup .tmore { justify-self: start; }
.tgroup.searching .tmore { display: none; }
.qall { border-style: dashed !important; }
[hidden] { display: none !important; }
.fsa-runs { display: grid; gap: 3px; margin: -6px 0 14px; }
.fsa-run { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; padding: 4px 8px; border-radius: 7px; background: var(--green-soft); color: var(--green); }
.fsa-run.bad { background: var(--red-soft); color: var(--red); }
.fsa-run .w { font-family: var(--font-mono); color: var(--text); }

/* ==========================================================================
   Feature modules (feat-*.js)
   ========================================================================== */
/* Tools button */
.tools-btn { gap: 4px; }
.tools-btn svg:last-child { width: 13px; height: 13px; opacity: 0.7; }

/* Annotate bar: a slim vertical toolbar on the canvas' left edge */
.anno-bar { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); z-index: 6; display: flex; flex-direction: column; gap: 2px; padding: 5px; background: var(--panel); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: 0 8px 24px -10px rgba(0, 0, 0, 0.45); }
.anno-bar .icon-btn { width: 32px; height: 32px; position: relative; }
.anno-bar .anno-sep { height: 1px; background: var(--line-2); margin: 3px 4px; }
.anno-bar .anno-count { position: absolute; top: 1px; right: 0; min-width: 15px; height: 15px; padding: 0 3px; border-radius: 8px; background: #f59e0b; color: #1a1205; font-size: 10px; font-weight: 700; line-height: 15px; text-align: center; }
.canvas-wrap.tool-draw { cursor: crosshair; }
.canvas-wrap.no-grid #lw-grid-rect { display: none !important; }
@media (max-width: 700px) { .anno-bar { top: auto; bottom: 10px; transform: none; flex-direction: row; left: 50%; transform: translateX(-50%); } .anno-bar .anno-sep { width: 1px; height: auto; margin: 4px 3px; } }

/* Back after following a link */
.link-back { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); z-index: 6; box-shadow: 0 6px 18px -8px rgba(0,0,0,.4); background: var(--panel); }

/* Comments */
.cm-pop { position: fixed; z-index: 60; width: 320px; max-height: 70vh; overflow: auto; background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--r-lg); box-shadow: var(--shadow-pop); padding: 12px; display: grid; gap: 10px; }
.cm-msg { display: grid; gap: 4px; }
.cm-head { display: flex; align-items: center; gap: 7px; font-size: 13px; }
.cm-head .faint { margin-left: auto; font-size: 11.5px; color: var(--text-3); }
.cm-body { font-size: 13.5px; color: var(--text); padding-left: 29px; line-height: 1.45; white-space: normal; overflow-wrap: anywhere; }
.avatar.sm { width: 22px; height: 22px; border-radius: 50%; font-size: 10px; display: inline-grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); font-weight: 700; flex: none; }
.cm-list { display: grid; gap: 6px; max-height: 60vh; overflow: auto; }
.cm-row { display: flex; gap: 10px; align-items: flex-start; text-align: left; padding: 9px 10px; border-radius: var(--r); background: var(--panel-2); border: 1px solid var(--line); font-size: 13px; color: var(--text); }
.cm-row:hover { border-color: var(--accent-line); }
.cm-row.resolved { opacity: 0.6; }
.cm-row .cm-txt { flex: 1; min-width: 0; }
.cm-row .faint { color: var(--text-3); font-size: 12px; white-space: nowrap; }

/* Links */
.lw-link .link-row { display: grid; grid-template-columns: 1fr 120px; gap: 6px; }

/* Icon picker */
.icon-pick { display: grid; gap: 10px; }
.icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 6px; max-height: 52vh; overflow: auto; padding: 2px; }
.icon-cell { display: grid; justify-items: center; gap: 4px; padding: 9px 4px 6px; border-radius: var(--r); border: 1px solid var(--line); background: var(--panel-2); color: var(--text); font-size: 10.5px; }
.icon-cell svg { width: 24px; height: 24px; }
.icon-cell span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-3); }
.icon-cell:hover, .icon-cell.on { border-color: var(--accent); color: var(--accent-text); }
.icon-cell[hidden] { display: none; }

/* Code generation / reverse engineering */
.dialog.dialog-code { width: min(1080px, 96vw); }
.cg { display: grid; gap: 10px; }
.cg-bar .seg { display: flex; flex-wrap: wrap; gap: 4px; }
.seg-btn { padding: 6px 11px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--panel-2); color: var(--text-2); font-size: 13px; font-weight: 500; }
.seg-btn.on { background: var(--accent-soft); color: var(--accent-text); border-color: var(--accent-line); }
.cg-opts { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; font-size: 13px; }
.cg-opts .check { margin: 0; }
.cg-pkg { display: flex; align-items: center; gap: 8px; color: var(--text-2); }
.cg-pkg .input { width: 220px; }
.cg-pkg[hidden] { display: none; }
.cg-main { display: grid; grid-template-columns: 210px 1fr; gap: 10px; min-height: 0; }
.cg-files { display: grid; align-content: start; gap: 3px; max-height: 56vh; overflow: auto; }
.cg-file { display: flex; gap: 7px; align-items: center; padding: 6px 8px; border-radius: 7px; font-size: 13px; color: var(--text-2); text-align: left; }
.cg-file svg { width: 15px; height: 15px; flex: none; }
.cg-file.on { background: var(--accent-soft); color: var(--accent-text); }
.cg-code { margin: 0; max-height: 56vh; overflow: auto; background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; font-family: var(--font-mono); font-size: 12.5px; line-height: 1.55; color: var(--text); white-space: pre; tab-size: 4; }
.cg-note { margin: 0 !important; }
@media (max-width: 700px) { .cg-main { grid-template-columns: 1fr; } .cg-files { max-height: 120px; } }
.rev { display: grid; gap: 10px; }
.rev-row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }

/* Find & replace */
.fr { display: grid; gap: 10px; }
.fr-opts { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; font-size: 13px; }
.fr-opts .check { margin: 0; }
.fr-list { display: grid; gap: 3px; max-height: 46vh; overflow: auto; }
.fr-hit { display: grid; grid-template-columns: 130px 1fr auto; gap: 10px; align-items: center; text-align: left; padding: 6px 9px; border-radius: 7px; font-size: 13px; color: var(--text); border: 1px solid transparent; }
.fr-hit:hover { background: var(--hover); border-color: var(--line-2); }
.fr-hit .k { color: var(--text-3); font-size: 12px; }
.fr-hit .w { color: var(--text-3); font-size: 12px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fr-hit mark { background: var(--amber-soft); color: var(--amber); border-radius: 3px; padding: 0 1px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 600px) { .fr-hit { grid-template-columns: 1fr; } .field-row { grid-template-columns: 1fr; } }

/* Presentation */
.present { position: fixed; inset: 0; z-index: 200; background: var(--pr-bg, #fff); display: grid; grid-template-rows: 1fr; outline: none; color: #e9eef5; }
.present .pr-stage { position: relative; overflow: hidden; }
.present .pr-svg, .present .pr-ink { position: absolute; inset: 0; width: 100%; height: 100%; }
.present .pr-ink { pointer-events: none; }
.present [data-hit] { cursor: inherit !important; }
.present .pr-link { cursor: pointer !important; }
.present .pr-hidden { opacity: 0; transition: opacity .25s; }
.present .pr-dia > * { transition: opacity .25s; }
.present.mode-laser .pr-stage { cursor: none; }
.present.mode-pen .pr-stage { cursor: crosshair; }
.pr-laser { position: fixed; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%; background: #ef4444; box-shadow: 0 0 14px 6px rgba(239, 68, 68, .55); pointer-events: none; z-index: 3; }
.pr-trail { position: fixed; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; background: rgba(239, 68, 68, .5); pointer-events: none; animation: prFade .35s linear forwards; }
@keyframes prFade { to { opacity: 0; transform: scale(.3); } }
.pr-title { position: absolute; top: 14px; left: 18px; font-family: var(--font-display); font-weight: 600; font-size: 18px; color: #64748b; pointer-events: none; }
.pr-bar { position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 2px; padding: 5px 8px; border-radius: 12px; background: rgba(15, 23, 42, .86); color: #e2e8f0; box-shadow: 0 10px 30px -10px rgba(0,0,0,.5); opacity: .25; transition: opacity .2s; }
.pr-bar:hover, .present:focus-within .pr-bar:focus-within { opacity: 1; }
.pr-btn { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 8px; color: inherit; }
.pr-btn svg { width: 17px; height: 17px; }
.pr-btn:hover { background: rgba(255,255,255,.1); }
.pr-btn.on { background: rgba(45, 212, 191, .25); color: #5eead4; }
.pr-count, .pr-time { font-size: 12.5px; font-variant-numeric: tabular-nums; padding: 0 6px; color: #cbd5e1; }
.pr-sep { width: 1px; height: 20px; background: rgba(255,255,255,.18); margin: 0 4px; }
.pr-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(100,116,139,.2); }
.pr-progress i { display: block; height: 100%; background: #2dd4bf; transition: width .3s; }
.pr-notes { position: absolute; left: 18px; bottom: 64px; max-width: min(560px, 80vw); padding: 12px 14px; border-radius: 12px; background: rgba(15, 23, 42, .9); color: #e2e8f0; font-size: 14.5px; line-height: 1.5; }
.pr-notes .faint { color: #94a3b8; }
.pr-countdown { position: absolute; top: 12px; right: 16px; font: 600 28px/1 var(--font-display); color: #0f172a; background: rgba(250, 204, 21, .9); padding: 8px 12px; border-radius: 10px; font-variant-numeric: tabular-nums; }
.pr-countdown.done { background: #ef4444; color: #fff; animation: prPulse 1s infinite; }
@keyframes prPulse { 50% { opacity: .6; } }

/* Share / report */
.share, .report-dlg { display: grid; gap: 12px; }
.share .seg, .report-dlg .seg { display: flex; gap: 4px; flex-wrap: wrap; }
.copy-row { display: flex; gap: 6px; }
.copy-row .input { flex: 1; min-width: 0; font-size: 12px; }
.input.code { font-family: var(--font-mono); }

/* Read-only viewer and embed */
.viewer { position: fixed; inset: 0; display: grid; grid-template-rows: auto 1fr; background: var(--bg); }
.vw-top { display: flex; align-items: center; gap: 14px; padding: 10px 16px; border-bottom: 1px solid var(--line-2); background: var(--panel); flex-wrap: wrap; }
.vw-name { display: flex; align-items: center; gap: 8px; font-size: 15px; }
.vw-tabs { display: flex; gap: 4px; overflow-x: auto; flex: 1; min-width: 0; }
.vw-tab { display: flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 8px; color: var(--text-2); font-size: 13px; white-space: nowrap; }
.vw-tab svg { width: 15px; height: 15px; }
.vw-tab.on { background: var(--accent-soft); color: var(--accent-text); }
.vw-actions { display: flex; gap: 6px; }
.vw-stage { position: relative; overflow: hidden; }
.vw-svg { position: absolute; inset: 0; width: 100%; height: 100%; cursor: grab; }
.vw-svg [data-hit] { cursor: inherit; }
.vw-hint { position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%); font-size: 12px; color: var(--text-3); background: var(--panel); padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); pointer-events: none; }
.viewer.embed .vw-top { padding: 6px 10px; }
.viewer.embed .vw-hint { display: none; }
.viewer-err { max-width: 460px; margin: 18vh auto; text-align: center; padding: 20px; }
.vw-comments { white-space: pre-wrap; font-size: 13px; max-height: 60vh; overflow: auto; }

/* Simulation */
.sim-bar { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); z-index: 7; display: flex; align-items: center; gap: 4px; padding: 5px 8px; border-radius: 12px; background: var(--panel); border: 1px solid var(--accent-line); box-shadow: 0 10px 28px -12px rgba(0,0,0,.5); max-width: calc(100% - 120px); }
.sim-bar .sim-speed { width: auto; height: 30px; padding: 0 8px; font-size: 12.5px; }
.sim-status { font-size: 13px; color: var(--text-2); padding: 0 8px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 520px; }
.sim-status b { color: var(--text); }
.sim-status .ok { color: var(--green); }
.sim-status .bad { color: var(--red); }
.tape { display: inline-flex; gap: 2px; vertical-align: middle; }
.tape-cell { display: inline-grid; place-items: center; min-width: 20px; height: 22px; padding: 0 4px; border: 1px solid var(--line-2); border-radius: 4px; font-family: var(--font-mono); font-size: 12.5px; color: var(--text); }
.tape-cell.read { opacity: .45; }
.tape-cell.cur { background: #16a34a; border-color: #16a34a; color: #fff; }
.sim-ring { animation: simPulse 1.2s ease-in-out infinite; }
@keyframes simPulse { 50% { stroke-opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .sim-ring { animation: none; } }
#lw-layer .sim-future { opacity: .14; }
.sim-log { margin: 0; padding-left: 22px; max-height: 60vh; overflow: auto; font-size: 13.5px; line-height: 1.6; }
/* Truth tables */
.tt-wrap { display: grid; grid-template-columns: auto 1fr; gap: 18px; align-items: start; }
.tt { border-collapse: collapse; font-family: var(--font-mono); font-size: 13px; }
.tt th, .tt td { padding: 3px 10px; text-align: center; border-bottom: 1px solid var(--line); }
.tt .sep { width: 1px; padding: 0; background: var(--line-3); }
.tt td.out.v1, .kmap td.v1 { color: var(--green); font-weight: 700; }
.tt-wrap .tt { display: block; max-height: 58vh; overflow: auto; }
.tt-side { display: grid; gap: 14px; }
.tt-expr { font-family: var(--font-mono); font-size: 13.5px; }
.kmap { border-collapse: collapse; margin-top: 6px; font-family: var(--font-mono); font-size: 13px; }
.kmap th, .kmap td { border: 1px solid var(--line-2); padding: 4px 10px; text-align: center; }
.kmap th { color: var(--text-3); font-weight: 500; }
@media (max-width: 700px) { .tt-wrap { grid-template-columns: 1fr; } }

/* Matrix */
.mx { display: grid; gap: 10px; }
.mx-ctl { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.mx-ctl .field { margin: 0; }
.mx-grid { overflow: auto; max-height: 58vh; border: 1px solid var(--line); border-radius: var(--r); }
.matrix { border-collapse: collapse; font-size: 12.5px; }
.matrix th, .matrix td { border: 1px solid var(--line); padding: 4px 6px; text-align: center; }
.matrix th { background: var(--panel-2); font-weight: 500; color: var(--text-2); position: sticky; top: 0; }
.matrix tr th:first-child { position: sticky; left: 0; text-align: left; white-space: nowrap; z-index: 1; }
.matrix th.none { opacity: .5; }
.matrix th.vert { height: 120px; vertical-align: bottom; white-space: nowrap; }
.matrix th.vert span { writing-mode: vertical-rl; transform: rotate(180deg); display: inline-block; max-height: 112px; overflow: hidden; text-overflow: ellipsis; }
.matrix td.on { background: var(--accent-soft); color: var(--accent-text); font-weight: 700; }
.matrix td.tot { color: var(--text-3); }
@media (max-width: 700px) { .mx-ctl { grid-template-columns: 1fr; } }
/* Use case form */
.uc-form { display: grid; gap: 2px; }
.uc-form .field-row { grid-template-columns: 1fr 1fr 1.4fr; }
.uc-sum { font-size: 13px; color: var(--text-2); }
/* Glossary */
.gl { display: grid; gap: 10px; }
.gl-rows { display: grid; gap: 6px; max-height: 46vh; overflow: auto; }
.gl-row { display: grid; grid-template-columns: 200px 1fr 32px; gap: 6px; align-items: center; }
.gl-sugg { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.gl-sugg .label { width: 100%; }
.gl-sugg .chip { cursor: pointer; }
/* Textual analysis */
.ta { display: grid; gap: 10px; }
.ta-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; max-height: 40vh; overflow: auto; }
.ta-row { display: flex; align-items: center; gap: 8px; padding: 3px 0; font-size: 13.5px; }
.ta-row .select { width: auto; height: 28px; padding: 0 6px; font-size: 12px; margin-left: auto; }
.ta-row .faint, .ta-verbs .faint { color: var(--text-3); font-size: 11.5px; }
.ta-verbs { font-size: 13px; color: var(--text-2); margin: 4px 0 10px !important; }
@media (max-width: 700px) { .ta-cols { grid-template-columns: 1fr; } }
/* Table view */
.tv { display: grid; gap: 8px; }
.tv-top { display: flex; gap: 12px; align-items: center; }
.tv-top .input { max-width: 260px; }
.tv-grid { overflow: auto; max-height: 60vh; border: 1px solid var(--line); border-radius: var(--r); }
.tv-table { border-collapse: collapse; font-size: 13px; min-width: 100%; }
.tv-table th { position: sticky; top: 0; background: var(--panel-2); font-weight: 500; color: var(--text-2); text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
.tv-table td { border-bottom: 1px solid var(--line); padding: 2px 4px; }
.tv-table td.k { color: var(--text-3); font-size: 12px; white-space: nowrap; padding: 0 8px; }
.tv-table td.na { background: repeating-linear-gradient(135deg, transparent 0 5px, var(--line) 5px 6px); }
.tv-table input:not([type=checkbox]), .tv-table select { width: 100%; min-width: 110px; border: 1px solid transparent; background: transparent; color: var(--text); padding: 5px 6px; border-radius: 6px; font: inherit; }
.tv-table input:focus, .tv-table select:focus { border-color: var(--accent-line); background: var(--panel); outline: none; }

/* AI */
.ai-clip { display: grid; gap: 10px; }
.ai-clip textarea { font-size: 12px; }
.ai-ask .pick-search { margin-bottom: 8px; }
.ai-ask .picker-groups, .ai-ask .pick-groups { max-height: 34vh; overflow: auto; }
.ai-prev { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; align-items: start; }
.ai-svg { border: 1px solid var(--line); border-radius: var(--r); background: var(--canvas); padding: 8px; max-height: 60vh; overflow: auto; }
.ai-svg svg { width: 100%; height: auto; }
.ai-side { display: grid; gap: 10px; }
.ai-mark b { font-size: 22px; font-family: var(--font-display); }
.ai-text { max-height: 30vh; overflow: auto; font-size: 12px; background: var(--panel-2); padding: 8px; border-radius: 8px; }
.ai-answer { font-size: 14.5px; line-height: 1.6; max-height: 60vh; overflow: auto; }
.ai-answer ul { margin: 6px 0; padding-left: 20px; }
@media (max-width: 760px) { .ai-prev { grid-template-columns: 1fr; } }

/* Display & accessibility */
:root.hc[data-theme="dark"] { --text: #ffffff; --text-2: #e6edf5; --text-3: #c3cedb; --line: #5a6b82; --line-2: #7d8fa8; --line-3: #a7b6c9; --panel: #000; --panel-2: #0a0a0a; --bg: #000; --canvas: #000; --accent: #5eead4; --accent-text: #99f6e4; --grid-dot: #3a4656; }
:root.hc[data-theme="light"] { --text: #000; --text-2: #1b2230; --text-3: #2f3a4a; --line: #6b7686; --line-2: #4b5563; --line-3: #374151; --panel: #fff; --panel-2: #fff; --bg: #fff; --canvas: #fff; --accent: #0f5f58; --accent-text: #0b4a44; --grid-dot: #9aa4b2; }
:root.hc :focus-visible { outline: 3px solid var(--accent) !important; outline-offset: 2px; }
:root.reduce-motion *, :root.reduce-motion *::before, :root.reduce-motion *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
.a11y { display: grid; gap: 8px; }
.a11y-row { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r); background: var(--panel-2); }
.a11y-row .dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 6px; flex: none; background: var(--cyan); }
.a11y-row.warning .dot { background: var(--amber); }
.a11y-row > div { flex: 1; font-size: 13.5px; }

/* Templates gallery */
.gal { display: grid; gap: 12px; }
.gal .label { margin-top: 4px; }
.gal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.gal-card { display: grid; gap: 4px; text-align: left; padding: 10px; border-radius: var(--r-lg); border: 1px solid var(--line-2); background: var(--panel-2); color: var(--text); }
.gal-card:hover { border-color: var(--accent-line); }
.gal-card[hidden], .gal-item[hidden] { display: none; }
.gal-thumb { height: 120px; border-radius: 8px; background: var(--canvas); border: 1px solid var(--line); display: grid; place-items: center; overflow: hidden; margin-bottom: 4px; }
.gal-thumb svg { width: 100%; height: 100%; }
.gal-card span { font-size: 12.5px; color: var(--text-2); }
.gal-card em { font-size: 11.5px; color: var(--text-3); font-style: normal; }
.gal-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 4px; max-height: 30vh; overflow: auto; }
.gal-item { display: flex; gap: 8px; align-items: center; padding: 6px 8px; border-radius: 8px; color: var(--text-2); font-size: 13px; text-align: left; }
.gal-item:hover { background: var(--hover); color: var(--text); }
.gal-item svg { width: 16px; height: 16px; flex: none; }
/* Tour */
.tour { position: fixed; inset: 0; z-index: 150; }
.tour-hole { position: fixed; border-radius: 10px; box-shadow: 0 0 0 9999px rgba(2, 6, 12, .55); border: 2px solid var(--accent); pointer-events: none; transition: all .2s; }
.tour-pop { position: fixed; width: min(340px, calc(100vw - 24px)); background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--r-lg); box-shadow: var(--shadow-pop); padding: 14px; display: grid; gap: 6px; }
.tour-pop b { font-size: 15px; }
.tour-pop p { margin: 0 0 6px; font-size: 13.5px; color: var(--text-2); }
/* Assignments */
.asg, .brief { display: grid; gap: 4px; }
.brief-due { display: flex; gap: 8px; align-items: center; font-size: 13.5px; color: var(--text-2); margin-bottom: 8px; }
.brief-due svg { width: 16px; height: 16px; }
.brief-due.late { color: var(--red); }
.brief-text { font-size: 14px; line-height: 1.55; padding: 10px 12px; background: var(--panel-2); border-radius: var(--r); border: 1px solid var(--line); margin-bottom: 10px; max-height: 30vh; overflow: auto; }
.brief-checks { display: grid; gap: 4px; }
.brief-check { display: flex; gap: 9px; align-items: center; font-size: 13.5px; padding: 4px 2px; }
.brief-check .tick { width: 18px; text-align: center; color: var(--text-3); font-weight: 700; }
.brief-check.done .tick { color: var(--green); }
.brief-check.done > span:last-child { color: var(--text-2); }
.brief-check em { color: var(--text-3); font-style: normal; font-size: 12px; }
.brief-btn .brief-n { font-size: 11.5px; color: var(--accent-text); margin-left: 2px; }
.subs { width: 100%; border-collapse: collapse; font-size: 13px; }
.subs th, .subs td { padding: 7px 8px; border-bottom: 1px solid var(--line); text-align: left; }
.subs th { color: var(--text-3); font-weight: 500; }
.subs .late { font-size: 11px; color: var(--red); background: var(--red-soft); padding: 1px 6px; border-radius: 999px; }

/* Version compare */
.df { display: grid; gap: 10px; max-height: 62vh; overflow: auto; }
.df-sec { display: grid; gap: 3px; }
.df-sec .label em { font-style: normal; color: var(--text-3); }
.df-row { display: flex; gap: 9px; align-items: baseline; font-size: 13.5px; padding: 3px 0; }
.df-mark { width: 9px; height: 9px; border-radius: 2px; flex: none; transform: translateY(1px); }
.df-row.add .df-mark { background: #16a34a; }
.df-row.rem .df-mark { background: #ef4444; }
.df-row.chg .df-mark { background: #f59e0b; }
.df-row .faint { color: var(--text-3); }

.ln-adv { margin: 4px 0 12px; }
.ln-adv summary { cursor: pointer; font-size: 13px; color: var(--text-2); padding: 4px 0; }
.ln-adv[open] summary { margin-bottom: 8px; }
.sa { display: grid; gap: 10px; }
.sa-list { display: grid; gap: 3px; max-height: 56vh; overflow: auto; }

.undo-list { display: grid; gap: 2px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.undo-step { text-align: left; font-size: 12.5px; color: var(--text-2); padding: 4px 8px; border-radius: 6px; }
.undo-step:hover { background: var(--hover); color: var(--text); }
.undo-step:first-of-type { color: var(--text); font-weight: 500; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.app.zen .sidebar, .app.zen .inspector, .app.zen .dock, .app.zen .anno-bar, .app.zen .minimap { display: none !important; }
.app.zen .stage { grid-template-columns: 1fr !important; }
.rp { display: grid; gap: 8px; }
.rp-svg { width: 100%; height: 56vh; background: var(--canvas); border: 1px solid var(--line); border-radius: var(--r); }
.rp-bar { display: flex; gap: 10px; align-items: center; }
.rp-range { flex: 1; }
.rp-step, .rp-label { font-size: 13px; color: var(--text-2); }
.fb-mark { font: 700 34px/1 var(--font-display); color: var(--accent-text); margin-bottom: 8px; }
.tp { display: grid; gap: 10px; }
.tp-sum, .tp-prob { font-size: 14px; }

.sqlp { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 14px; }
.sqlp-schema { max-height: 58vh; overflow: auto; font-size: 11.5px; background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--r); padding: 10px; margin: 4px 0 0; white-space: pre; }
.sqlp-right { display: grid; gap: 8px; align-content: start; min-width: 0; }
.sqlp-sugg { display: flex; flex-wrap: wrap; gap: 5px; }
.sqlp-sugg .chip { cursor: pointer; font-family: var(--font-mono); font-size: 11px; }
.sqlp-out { max-height: 36vh; overflow: auto; }
.sqlp-err { color: var(--red); font-family: var(--font-mono); font-size: 12.5px; }
.sqlp-status.bad { color: var(--red); }
@media (max-width: 760px) { .sqlp { grid-template-columns: 1fr; } }

/* ---------- live sessions ---------- */
.live-pill { display: inline-flex; align-items: center; gap: 2px; margin-right: 4px; }
.live-state { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--panel); color: var(--text); font-size: 12.5px; font-weight: 600; cursor: pointer; }
.live-state .dot { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2); }
.live-pill.connecting .dot, .live-pill.waiting .dot { background: #f59e0b; box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2); animation: live-pulse 1.2s infinite; }
.live-pill.offline .dot { background: #ef4444; box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2); animation: live-pulse 1.2s infinite; }
@keyframes live-pulse { 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .live-pill .dot { animation: none !important; } }
.live-av { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; color: #fff; font-size: 10.5px; font-weight: 700; border: 2px solid var(--bg); margin-left: -6px; cursor: pointer; flex: none; }
.live-pill .live-av:first-of-type { margin-left: 2px; }
.live-av.more { background: var(--line-2); color: var(--text); cursor: default; }
.live-dlg p { margin: 0 0 12px; }
.live-link { display: flex; gap: 8px; margin: 4px 0 8px; }
.live-link .input { flex: 1; min-width: 0; font-size: 12.5px; }
.live-people { list-style: none; margin: 6px 0 12px; padding: 0; display: grid; gap: 6px; }
.live-people li { display: flex; align-items: center; gap: 10px; }
.live-people .live-av { margin: 0; cursor: default; }
.live-people em { color: var(--text-3); font-style: normal; }
.live-colors { display: flex; gap: 6px; margin: -2px 0 12px; flex-wrap: wrap; }
.live-colors .swatch { width: 22px; height: 22px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; }
.live-colors .swatch.on { border-color: var(--text); box-shadow: 0 0 0 2px var(--bg) inset; }
.live-join { min-height: 100vh; background: var(--bg); }
@media (max-width: 720px) { .live-pill .live-av { display: none; } }

/* ---------- layers ---------- */
.layers-box { margin: 4px 0 14px; }
.layers { list-style: none; margin: 6px 0 8px; padding: 0; border: 1px solid var(--line-2); border-radius: 8px; overflow: hidden; }
.layer-row { display: flex; align-items: center; gap: 2px; padding: 2px 6px; border-top: 1px solid var(--line); font-size: 12.5px; }
.layer-row:first-child { border-top: 0; }
.layer-row .icon-btn { width: 26px; height: 26px; }
.layer-row .icon-btn.active { color: var(--accent-text); }
.layer-row.off .layer-name { opacity: 0.5; text-decoration: line-through; }
.layer-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 4px; cursor: default; }
.layer-row .cnt { color: var(--text-3); font-size: 11.5px; margin-right: 4px; }
.layer-row.on { background: var(--accent-soft); }
.layer-row.on .layer-name { color: var(--accent-text); font-weight: 600; }
.layer-name[data-layer-pick] { cursor: pointer; }
.layer-row .grip { cursor: grab; color: var(--text-3); width: 20px; touch-action: none; }
.layer-row .grip:active { cursor: grabbing; }
.layer-row.dragging { opacity: .55; }
.layer-row.drop-above { box-shadow: inset 0 2px 0 var(--accent); }
.layer-row.drop-below { box-shadow: inset 0 -2px 0 var(--accent); }

/* ---------- top bar fits the space it actually has (side panels open or not) ---------- */
.topbar { container-type: inline-size; container-name: topbar; }
.toolbar .tb-more.active { background: var(--accent-soft); color: var(--accent-text); }
@container topbar (max-width: 900px) {
  .crumbs { min-width: 0; }
  .crumbs .proj, .crumbs .sep, .crumbs .chip { display: none; }
  .crumbs .dname { max-width: 130px; }
  .toolbar .icon-btn { width: 30px; }
  .toolbar .icon-btn .k { display: none; }
  .problems-pill .txt { display: none; }
  .problems-pill .cnt-sm { display: inline; }
  .problems-pill.early .txt { display: inline; }
  .top-right .btn .hide-sm { display: none; }
  .top-right .btn { padding: 0 10px; }
  .zoom .icon-btn { display: none; }
  /* Present and share are also in the Tools menu (and F5); room for the shape tools matters more. */
  .top-right [data-act="present"], .top-right [data-act="share"], .top-right .zoom { display: none; }
  .problems-pill.early .txt { display: none; }
  .problems-pill.early .cnt-sm { display: none; }
}
@container topbar (max-width: 700px) {
  .top-right [data-act="redo"] { display: none; }
  .crumbs .dname { max-width: 90px; }
}
.mark-pill.early svg { color: var(--text-2); }
.mark-score.early { --c: var(--text-3); }
@media (max-width: 700px) { .empty-hint { left: 50%; width: min(460px, calc(100% - 32px)); } }
@container topbar (max-width: 520px) {
  .topbar .top-right { gap: 0; }
  .top-right [data-act="simulate"] { display: none; }
  .tools-btn svg:last-child { display: none; }
  .tools-btn { padding: 0 8px; }
}
/* Phones: the annotation bar scrolls sideways instead of running off the screen. */
@media (max-width: 700px) {
  .anno-bar { max-width: calc(100% - 16px); overflow-x: auto; scrollbar-width: none; }
  .anno-bar::-webkit-scrollbar { display: none; }
  .anno-bar .icon-btn { flex: none; }
}

/* A project card waiting for its thumbnail */
.thumb-wait { display: block; width: 46%; height: 34%; border-radius: 8px; background: linear-gradient(90deg, var(--panel-2), var(--panel-3), var(--panel-2)); background-size: 200% 100%; animation: thumb-wait 1.2s ease-in-out infinite; }
@keyframes thumb-wait { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .thumb-wait { animation: none; } }
/* The marks a checker can't judge: shown so the 85 makes sense. */
.crit.brief { cursor: default; border-top: 1px dashed var(--line-2); border-radius: 0 0 7px 7px; margin-top: 2px; color: var(--text-3); }
.crit.brief:hover { background: none; color: var(--text-3); }
.ms-table tr.brief td { color: var(--text-3); font-style: italic; }

/* Text and line style controls (Appearance) */
.style-box { margin: 6px 0 2px; }
.style-row .field { flex: 1; min-width: 0; }
.seg-icons { display: flex; gap: 2px; padding: 2px; border: 1px solid var(--line-2); border-radius: 8px; width: max-content; }
.seg-icons .icon-btn { width: 30px; height: 26px; font-size: 13.5px; font-family: Georgia, serif; }
.seg-icons .icon-btn.active { background: var(--accent-soft); color: var(--accent-text); }
.style-box input[type="range"] { width: 100%; accent-color: var(--accent); }

/* Turn row (rotate / flip) in Appearance */
.turn-row { display: flex; align-items: center; gap: 6px; }
.turn-row .input { width: 64px; }

/* Mac trackpads: a sideways two-finger swipe over the app scrolls the canvas instead of going
   back a page, and the page never rubber-bands. */
html, body { overscroll-behavior: none; }
.canvas-wrap { overscroll-behavior: contain; }

/* The colour picker (waits for Apply) */
.tone-sw { width: 30px; height: 26px; padding: 0; border: 1px solid var(--line-3); border-radius: 7px; cursor: pointer; box-shadow: inset 0 0 0 2px var(--panel); }
.tone-sw:focus-visible, .swatch.custom:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.cpick { position: fixed; z-index: 1200; width: 260px; padding: 12px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line-2); box-shadow: 0 18px 50px rgba(0, 0, 0, 0.28); display: grid; gap: 10px; }
.cp-title { font-size: 12px; font-weight: 600; color: var(--text-2); }
.cp-sv { position: relative; height: 150px; border-radius: 8px; cursor: crosshair; touch-action: none; outline: none; }
.cp-sv:focus-visible { box-shadow: 0 0 0 2px var(--accent); }
.cp-dot { position: absolute; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.45), 0 1px 4px rgba(0, 0, 0, 0.35); pointer-events: none; }
.cp-row { display: flex; align-items: center; gap: 8px; }
.cp-eye { flex: none; }
.cp-cmp { flex: none; display: flex; width: 36px; height: 24px; border-radius: 6px; overflow: hidden; border: 1px solid var(--line-3); }
.cp-cmp span { flex: 1; }
.cp-hue { position: relative; flex: 1; height: 12px; border-radius: 6px; cursor: pointer; touch-action: none; outline: none; background: linear-gradient(to right, #f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00); }
.cp-hue:focus-visible { box-shadow: 0 0 0 2px var(--accent); }
.cp-knob { position: absolute; top: 50%; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.45); pointer-events: none; }
.cp-fields { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 6px; }
.cp-fields label { display: grid; gap: 3px; text-align: center; font-size: 10.5px; color: var(--text-3); }
.cp-fields .input { height: 28px; padding: 3px 6px; text-align: center; font-family: var(--font-mono); font-size: 12px; }
.cp-fields .input.bad { border-color: var(--danger, #ef4444); }
.cp-btns { display: flex; justify-content: flex-end; gap: 8px; }
.cp-fields .input { padding: 3px 2px; }
.cp-fields input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
.cp-fields input[type="number"]::-webkit-inner-spin-button, .cp-fields input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

/* Export → Other tools: pick the tool your course uses */
.tt-intro { margin: 0; color: var(--text-2); font-size: 13px; line-height: 1.5; }
.tt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.tt-tool { border: 1px solid var(--line-2); border-radius: 10px; padding: 8px 10px; text-align: left; display: grid; gap: 1px; background: var(--bg-elev); }
.tt-tool b { font-size: 13px; }
.tt-tool span { color: var(--text-3); font-size: 11px; line-height: 1.3; }
.tt-tool:hover { border-color: var(--line-3); }
.tt-tool.on { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.tt-card { border: 1px solid var(--line-2); border-radius: 12px; padding: 14px 16px; display: grid; gap: 10px; background: var(--panel-2); }
.tt-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tt-head h4 { margin: 0; font-size: 15px; }
.tt-badge { font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--accent-soft); color: var(--accent-text); }
.tt-badge.layout { background: var(--green-soft); color: var(--green); }
.tt-badge.model, .tt-badge.relayout { background: var(--amber-soft); color: var(--amber); }
.tt-what { margin: 0; font-size: 13px; color: var(--text-2); line-height: 1.5; }
.tt-steps { margin: 0; padding-left: 20px; display: grid; gap: 5px; font-size: 13px; line-height: 1.45; }
.tt-steps b { font-weight: 600; color: var(--text); }
.tt-steps code, .tt-what code { font-family: var(--font-mono); font-size: 12px; background: var(--bg-elev); border: 1px solid var(--line); border-radius: 5px; padding: 0 4px; }
.tt-others { display: grid; gap: 6px; }
.tt-others > span { font-size: 11.5px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }
.tt-alt { display: flex; align-items: center; gap: 8px; text-align: left; padding: 7px 10px; border-radius: 9px; border: 1px solid var(--line-2); background: var(--bg-elev); font-size: 12.5px; }
.tt-alt:hover { border-color: var(--line-3); }
.tt-alt b { font-weight: 600; }
.tt-alt span { color: var(--text-3); }
.tt-skip { margin: 0; font-size: 12px; color: var(--amber); }
.tt-grid.compact { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 5px; }
.tt-grid.compact .tt-tool { padding: 6px 9px; }
.tt-grid.compact .tt-tool b { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tt-grid.compact .tt-tool span { display: none; }

/* Accounts, Pro, teams and the admin panel (feat-account.js) */
.acct-dialog { max-width: 480px; }
.acct-dialog.pp-dialog { max-width: 760px; }
.acct { display: grid; gap: 12px; }
.acct .field { margin: 0; }
.acct-row { display: flex; gap: 6px; align-items: center; }
.acct-row .input { flex: 1; }
.acct-hint { font-style: normal; font-size: 12px; color: var(--text-3); }
.acct-code { font-family: var(--font-mono); font-size: 20px; letter-spacing: 0.3em; text-align: center; }
.acct-intro { margin: 0; color: var(--text-2); font-size: 13.5px; line-height: 1.55; }
.acct-note { padding: 10px 12px; border-radius: 10px; background: var(--accent-soft); border: 1px solid var(--accent-line); font-size: 13px; line-height: 1.5; display: flex; gap: 8px; align-items: flex-start; }
.acct-note svg { width: 16px; height: 16px; flex: none; margin-top: 1px; color: var(--accent-text); }
.acct-note.warn { background: var(--amber-soft); border-color: transparent; }
.acct-note.ok { display: block; }
.acct-msg { margin: 0; min-height: 1em; font-size: 13px; color: var(--text-2); }
.acct-msg.bad { color: var(--red); }
.acct-go { width: 100%; justify-content: center; }
.acct-links { margin: 0; text-align: center; font-size: 13px; color: var(--text-3); }
.acct-check { align-items: flex-start; font-size: 13px; line-height: 1.5; }
.acct-check input { margin-top: 3px; }
.acct-legal { margin: 0; font-size: 12px; color: var(--text-3); text-align: center; line-height: 1.6; }
.acct-legal a, .acct-check a, .acct-intro a { color: var(--accent-text); }
.acct-who { padding: 12px 14px; border-radius: 10px; background: var(--panel-2); display: grid; gap: 4px; font-size: 13.5px; }
.acct-teams { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 4px; }
.acct-teams li { display: flex; gap: 6px; align-items: center; font-size: 13px; color: var(--text-2); }
.acct-teams svg { width: 14px; height: 14px; color: var(--accent-text); }
.acct-actions { display: grid; gap: 6px; }
.acct-actions .btn { justify-content: flex-start; }
.acct-nav { display: inline-flex; gap: 6px; align-items: center; }
.pro-lock { display: inline-flex; align-items: center; gap: 3px; margin-left: 6px; padding: 1px 6px; border-radius: 99px; font-size: 10.5px; font-weight: 700; letter-spacing: 0.02em; background: var(--accent-soft); color: var(--accent-text); vertical-align: middle; }
.pro-lock svg { width: 11px; height: 11px; }
.btn-primary .pro-lock { background: rgba(255, 255, 255, 0.22); color: inherit; }
.prob.pro-more { display: grid; gap: 4px; text-align: left; border: 1px dashed var(--accent-line); background: var(--accent-soft); cursor: pointer; padding: 12px 14px; border-radius: 12px; }
.prob.pro-more svg { width: 16px; height: 16px; color: var(--accent-text); }
.prob.pro-more span { font-size: 12.5px; color: var(--text-2); }
/* the upgrade window */
.pp { display: grid; gap: 14px; }
.pp-feats { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; }
.pp-feats li { display: flex; gap: 8px; font-size: 13px; line-height: 1.45; color: var(--text-2); }
.pp-feats li.on { color: var(--text); }
.pp-feats b { color: var(--text); font-weight: 600; display: block; }
.pp-feats svg { width: 15px; height: 15px; flex: none; color: var(--accent-text); margin-top: 2px; }
.pp-plans { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.pp-plan { position: relative; border: 1px solid var(--line-2); border-radius: 12px; padding: 16px 14px 14px; display: grid; gap: 4px; background: var(--bg-elev); align-content: start; }
.pp-plan.best { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.pp-plan.solo { text-align: center; }
.pp-plan h4 { margin: 0; font-size: 12.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-2); }
.pp-price { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; }
.pp-price span { font-size: 12.5px; font-weight: 500; color: var(--text-3); letter-spacing: 0; }
.pp-per { margin: 0 0 8px; font-size: 12.5px; color: var(--accent-text); }
.pp-plan .btn { justify-content: center; }
.pp-tag { position: absolute; top: -9px; right: 10px; font-size: 10.5px; font-weight: 700; padding: 2px 8px; border-radius: 6px; background: var(--accent); color: var(--accent-ink); }
.pp-team { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border: 1px solid var(--line-2); border-radius: 12px; }
.pp-team > svg { width: 20px; height: 20px; color: var(--accent-text); flex: none; }
.pp-team div { display: grid; gap: 2px; flex: 1; font-size: 13px; }
.pp-team span { color: var(--text-2); font-size: 12.5px; }
.pp-confirm { display: grid; gap: 12px; }
.pp-terms { margin: 0; padding-left: 18px; display: grid; gap: 6px; font-size: 13px; line-height: 1.5; color: var(--text-2); }
.pp-terms b { color: var(--text); }
/* a team's seats */
.team { gap: 16px; }
.team-card { display: grid; gap: 10px; padding: 14px; border: 1px solid var(--line-2); border-radius: 12px; }
.team-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.team-head h4 { margin: 0; font-size: 15px; }
.team-table, .admin-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.team-table th, .team-table td, .admin-table th, .admin-table td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.team-table th, .admin-table th { font-size: 11.5px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.05em; }
.team-act { white-space: nowrap; text-align: right; }
.btn-row-left { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.help.bad { color: var(--red); }
/* the admin panel */
.admin { max-width: 1180px; }
.admin-tabs { display: flex; gap: 4px; flex-wrap: wrap; margin: 6px 0 18px; border-bottom: 1px solid var(--line); }
.admin-tabs a { padding: 8px 12px; color: var(--text-2); text-decoration: none; border-bottom: 2px solid transparent; font-size: 13.5px; font-weight: 500; }
.admin-tabs a.on { color: var(--text); border-color: var(--accent); }
.admin-body { display: grid; gap: 14px; }
.admin-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.admin-card { display: grid; gap: 4px; padding: 14px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--bg-elev); }
.admin-card b { font-size: 24px; letter-spacing: -0.02em; }
.admin-card em { font-style: normal; font-size: 12px; color: var(--text-3); }
.admin-status { display: flex; gap: 8px; flex-wrap: wrap; }
.admin-table-wrap { overflow-x: auto; }
.admin-msg { max-width: 320px; white-space: pre-wrap; font-size: 12.5px; color: var(--text-2); margin: 4px 0 0; }
/* EditFlag's admin: the income line, meters, 30-day charts */
/* where projects are saved */
.store-note { display: flex; gap: 12px; align-items: flex-start; margin: 0 0 16px; padding: 12px 14px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--bg-elev); font-size: 13px; line-height: 1.5; color: var(--text-2); }
.store-note > svg { flex: none; width: 20px; height: 20px; margin-top: 1px; color: var(--text-2); }
.store-note b { color: var(--text); font-weight: 600; }
.store-note em { font-style: normal; color: var(--amber); }
.store-note.pro { border-color: var(--accent-line); background: linear-gradient(90deg, var(--accent-soft), transparent 60%), var(--bg-elev); }
.store-note.pro > svg { color: var(--accent); }
.cloud-mark.ok svg { color: var(--accent); }
.cloud-mark.busy svg { color: var(--accent); animation: cloud-pulse 1.2s ease-in-out infinite; }
.cloud-mark.warn svg { color: var(--amber); }
.cloud-mark.off svg { color: var(--text-3); }
@keyframes cloud-pulse { 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .cloud-mark.busy svg { animation: none; } }
/* a page that failed to open */
.crash { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: var(--bg); }
.crash-box { display: grid; gap: 12px; max-width: 460px; padding: 28px; border: 1px solid var(--line-2); border-radius: 16px; background: var(--bg-elev); }
.crash-box h1 { margin: 8px 0 0; font-size: 22px; }
.crash-box p { margin: 0; color: var(--text-2); }
.admin-hero { display: grid; gap: 4px; padding: 18px 20px; border: 1px solid var(--accent-line); border-radius: 14px; background: linear-gradient(135deg, var(--accent-soft), transparent 70%), var(--bg-elev); }
.admin-hero b { font-size: 38px; letter-spacing: -0.03em; font-family: var(--font-display); }
.admin-hero em, .admin-card em { font-style: normal; font-size: 12px; color: var(--text-3); }
.admin-go { cursor: pointer; transition: border-color 0.15s; }
.admin-go:hover, .admin-go:focus-visible { border-color: var(--accent-line); outline: none; }
.admin-h { margin: 10px 0 0; font-size: 14px; font-weight: 600; }
.admin-meters { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px; }
.admin-meter { display: grid; gap: 6px; padding: 12px 14px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--bg-elev); }
.admin-meter .ml { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--text-2); }
.admin-meter .ml b { color: var(--text); font-weight: 600; }
.admin-meter .mt { height: 8px; border-radius: 99px; background: var(--panel-3); overflow: hidden; }
.admin-meter .mt i { display: block; height: 100%; border-radius: 99px; background: var(--accent); }
.admin-meter.near .mt i { background: var(--amber); }
.admin-meter.full .mt i { background: var(--red); }
.admin-meter .mn { font-size: 12px; color: var(--amber); }
.admin-meter.full .mn { color: var(--red); }
.admin-charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 10px; }
.admin-chart { margin: 0; display: grid; gap: 6px; padding: 12px 14px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--bg-elev); min-width: 0; }
.admin-chart figcaption { font-size: 13px; font-weight: 600; }
.admin-chart .plot { position: relative; }
.admin-chart svg { display: block; width: 100%; height: 130px; }
.admin-chart .grid { stroke: var(--line); stroke-dasharray: 3 4; vector-effect: non-scaling-stroke; }
.admin-chart .axis { stroke: var(--line-3); vector-effect: non-scaling-stroke; }
.admin-chart .bar { fill: var(--accent); opacity: 0.85; }
.admin-chart .bar.on { opacity: 1; fill: var(--accent-hi); }
.admin-chart .hit { fill: transparent; outline: none; }
.admin-chart .ymax { position: absolute; top: 0; left: 0; font-size: 11px; color: var(--text-3); }
.admin-chart .nodata { position: absolute; inset: 0; display: grid; place-items: center; font-size: 12.5px; color: var(--text-3); }
.admin-chart .tip { position: absolute; top: 0; transform: translateX(-50%); display: grid; gap: 1px; padding: 6px 9px; border-radius: 8px; background: var(--panel-3); border: 1px solid var(--line-3); font-size: 12px; white-space: nowrap; pointer-events: none; box-shadow: var(--shadow-pop); }
.admin-chart .tip span { color: var(--text-3); font-size: 11px; }
.admin-chart .xl { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-3); }
.admin-chart details summary { font-size: 12px; color: var(--text-3); cursor: pointer; }
.admin-table .numc, .admin-table th.numc { text-align: right; font-variant-numeric: tabular-nums; }
.admin-warn { display: flex; gap: 8px; align-items: flex-start; margin: 0; padding: 10px 12px; border-radius: 10px; background: var(--amber-soft); color: var(--text); font-size: 13px; }
.admin-warn svg { color: var(--amber); flex: none; margin-top: 1px; }
.admin-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.admin-chips .chip { cursor: pointer; border: 0; font: inherit; font-size: 12px; }
.admin-filters .input { width: auto; }
.admin-filters .input[type=search] { flex: 1; min-width: 240px; }
.admin-pager { justify-content: center; }
.admin-make { display: grid; gap: 10px; padding: 14px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--bg-elev); }
.admin-make .btn-row-left { align-items: flex-end; }
.admin-make .field { margin: 0; }
.admin-make .field.grow { flex: 1; min-width: 200px; }
.admin-codes { font-family: var(--font-mono); font-size: 14px; letter-spacing: 0.04em; }
.admin-refund { display: grid; gap: 8px; padding: 14px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--bg-elev); }
.admin-refund-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.admin-refund .admin-msg { max-width: none; }
.admin-reply { padding-left: 10px; border-left: 2px solid var(--line-3); }
.acct-gift { font-family: var(--font-mono); letter-spacing: 0.06em; text-transform: uppercase; }
/* the free plan's marker: no mark, an invitation instead */
.mark-locked { display: grid; gap: 8px; justify-items: start; padding: 16px; border: 1px dashed var(--accent-line); border-radius: 12px; background: var(--accent-soft); }
.mark-locked > svg { width: 22px; height: 22px; color: var(--accent); }
.mark-locked b { font-size: 15px; }
.mark-locked p { margin: 0; font-size: 12.5px; line-height: 1.5; color: var(--text-2); }
@media (max-width: 640px) {
  .admin-charts { grid-template-columns: 1fr; }
  .admin-hero b { font-size: 30px; }
  .admin-filters .input[type=search] { min-width: 0; width: 100%; }
}
@media (max-width: 640px) {
  .pp-plans, .pp-feats { grid-template-columns: 1fr; }
  .pp-team { flex-wrap: wrap; }
}

/* landing: five plans and what Pro adds */
.plans.plans-5 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; justify-content: stretch; }
.plans-5 .plan { padding: 22px 20px; }
.plans-5 .price { margin: 14px 0 18px; flex-wrap: wrap; }
.plans-5 .price .amt { font-size: 36px; }
.plans-5 .plan ul { font-size: 13.5px; gap: 9px; margin-bottom: 20px; }
.pro-strip { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; justify-content: center; margin: 22px auto 0; max-width: 1000px; font-size: 13.5px; color: var(--text-2); }
.pro-strip span { display: inline-flex; gap: 6px; align-items: center; }
.pro-strip svg { width: 14px; height: 14px; color: var(--accent); }
.footnote a { color: var(--accent-text); }
.plans-5 .plan-top { flex-wrap: wrap; gap: 6px; }

/* ==========================================================================
   Landing: the moving parts (landing-fx.js)
   ========================================================================== */
/* the sheet you can drag */
.hx { display: block; width: 100%; height: auto; outline: none; cursor: crosshair; touch-action: pan-y pinch-zoom; user-select: none; -webkit-user-select: none; }
.hx.over { cursor: grab; }
.hx.dragging { cursor: grabbing; }
.hx .box { touch-action: none; }
.hx:focus-visible .sheet { stroke: var(--accent); stroke-width: 1.5; }
.ill .guide { stroke: var(--accent); stroke-width: 1; stroke-dasharray: 4 4; opacity: 0.9; }
.ill .xhair line { stroke: var(--accent); stroke-width: 1; stroke-dasharray: 2 4; opacity: 0.55; }
.ill .xhair circle { fill: none; stroke: var(--accent); stroke-width: 1.2; }
.ill .xhair .mk { fill: var(--accent); }
.ill .xread { fill: var(--panel-3); stroke: var(--line-3); }
.ill .xtxt { font-family: var(--font-mono); font-size: 9.5px; fill: var(--accent-text); white-space: pre; }
.ill .callout.warn rect { stroke: var(--amber); }
.ill .callout.warn circle { fill: var(--amber); }
.ill .callout.ok rect { fill: var(--green-soft); stroke: var(--green); }
.ill .callout.ok circle { fill: var(--green); }
.ill .fixbtn { cursor: pointer; }
.ill .fixbtn rect { fill: var(--accent); }
.ill .fixbtn text { font-family: var(--font-sans); font-size: 10px; font-weight: 600; fill: var(--accent-ink); text-anchor: middle; }
.ill .fixbtn:hover rect { fill: var(--accent-hi); }
.ill .tblock .score { fill: var(--accent-text); font-weight: 700; font-size: 11px; }
.ill .reset { cursor: pointer; }
.ill .reset:hover text { fill: var(--accent-text); }
.ill .hint rect { fill: var(--accent-soft); stroke: var(--accent-line); }
.ill .hint text { font-size: 11px; fill: var(--accent-text); }

/* the film that plays as you scroll */
.story-sec { padding-bottom: 0; }
.story { position: relative; height: 290vh; margin-top: -20px; }
.story-sticky { position: sticky; top: 0; height: 100vh; display: flex; align-items: center; }
.story-grid { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.4fr); gap: 48px; align-items: center; }
.story-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.story-steps li { display: flex; gap: 14px; padding: 14px 16px; border-radius: 12px; border: 1px solid transparent; cursor: pointer; opacity: 0.45; transition: opacity 0.3s, border-color 0.3s, background 0.3s; }
.story-steps li.done { opacity: 0.7; }
.story-steps li.on { opacity: 1; border-color: var(--line-2); background: var(--bg-elev); }
.story-steps .n { font-family: var(--font-mono); font-size: 12px; color: var(--accent-text); padding-top: 2px; }
.story-steps b { display: block; font-size: 16px; margin-bottom: 4px; }
.story-steps p { margin: 0; font-size: 13.5px; color: var(--text-2); line-height: 1.5; }
.story-steps li:not(.on) p { display: none; }
.story-stage { border: 1px solid var(--line-2); border-radius: 16px; background: var(--panel); overflow: hidden; box-shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.45); }
.ss-bar { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line-2); background: var(--panel-2); }
.ss-dots { display: flex; gap: 6px; }
.ss-dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--line-3); }
.ss-bar .label { flex: 1; }
.ss-mark { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.06em; color: var(--text-2); padding: 3px 9px; border-radius: 99px; border: 1px solid var(--amber); }
.ss-mark b { color: var(--amber); font-size: 12.5px; }
.ss-mark.up { border-color: var(--green); }
.ss-mark.up b { color: var(--green); }
.ss-export { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 8px; font-size: 12px; font-weight: 600; background: var(--panel-3); color: var(--text-2); transition: background 0.3s, color 0.3s; }
.ss-export svg { width: 14px; height: 14px; }
.ss-export.on { background: var(--accent); color: var(--accent-ink); }
.ss-body { display: grid; grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr); height: min(440px, 58vh); }
.ss-code { border-right: 1px solid var(--line-2); overflow: hidden; padding: 14px 0; background: var(--bg-elev); }
.ss-pre { font-family: var(--font-mono); font-size: 11.5px; line-height: 1.65; padding: 0 12px; white-space: pre; }
.ss-pre .cl { min-height: 1.7em; border-radius: 4px; transition: background 0.4s; }
.ss-pre .cl.ss-bad { background: var(--red-soft); box-shadow: inset 2px 0 0 var(--red); }
.ss-pre .cl.ss-good { background: var(--green-soft); box-shadow: inset 2px 0 0 var(--green); }
.ss-caret { display: inline-block; width: 7px; height: 1.15em; margin-left: 1px; vertical-align: -0.2em; background: var(--accent); animation: ss-blink 1s steps(2) infinite; }
@keyframes ss-blink { 50% { opacity: 0; } }
.ss-canvas { position: relative; background-color: var(--canvas); background-image: radial-gradient(var(--grid-dot) 1px, transparent 1px); background-size: 16px 16px; }
.ss-canvas > svg { position: absolute; top: 0; left: 0; right: 0; bottom: 0; width: 100%; height: 100%; transition: height 0.35s ease; }
.ss-canvas.carded > svg { height: calc(100% - 96px); }
.ss-ring { fill: none; stroke: var(--red); stroke-width: 2.4; stroke-linecap: round; stroke-dasharray: 260; animation: ss-draw 0.7s ease-out both; }
@keyframes ss-draw { from { stroke-dashoffset: 260; } to { stroke-dashoffset: 0; } }
.ss-card { position: absolute; left: 16px; right: 16px; bottom: 16px; display: grid; gap: 6px; justify-items: start; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--amber); background: var(--panel-2); box-shadow: var(--shadow-pop); font-size: 13px; animation: ss-up 0.35s ease-out both; }
.ss-card .ss-fix { display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-mono); font-size: 11.5px; color: var(--accent-text); }
.ss-card .ss-fix svg { width: 13px; height: 13px; }
.ss-card.ok { border-color: var(--green); background: linear-gradient(90deg, var(--green-soft), transparent 70%), var(--panel-2); }
.ss-card.ok .chip { background: var(--green-soft); color: var(--green); border-color: transparent; }
.ss-card.ok .chip::after { content: " · fixed"; }
@keyframes ss-up { from { opacity: 0; transform: translateY(10px); } }
.ss-fan { position: absolute; inset: 0; display: flex; flex-wrap: wrap; align-content: center; justify-content: center; gap: 10px; padding: 24px; background: color-mix(in srgb, var(--canvas) 90%, transparent); backdrop-filter: blur(3px); }
.ss-fmt { display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 10px; border: 1px solid var(--line-3); background: var(--panel-2); font-weight: 600; font-size: 14px; animation: ss-up 0.4s ease-out both; animation-delay: calc(var(--i) * 60ms); }
.ss-fmt em { font-style: normal; font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.06em; color: var(--accent-text); padding: 2px 6px; border-radius: 99px; background: var(--accent-soft); }
.ss-stamp { flex-basis: 100%; text-align: center; font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--green); margin-top: 6px; }
.ss-progress { height: 3px; background: var(--line); }
.ss-progress i { display: block; height: 100%; width: 0; background: var(--accent); }

/* every diagram type, on shelves */
.cat { border: 1px solid var(--line-2); border-radius: 16px; background: var(--bg-elev); background-image: radial-gradient(var(--line) 1px, transparent 1px); background-size: 18px 18px; overflow: hidden; }
.cat-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px; border-bottom: 1px solid var(--line-2); background: var(--bg-elev); }
.cat-top .tsearch { flex: 1; max-width: 520px; height: 40px; }
.cat-body { display: grid; grid-template-columns: 210px minmax(0, 1fr) 330px; height: 540px; }
.cat-rail { display: flex; flex-direction: column; gap: 2px; padding: 10px; border-right: 1px solid var(--line-2); background: var(--bg-elev); overflow-y: auto; }
.cat-rail button { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 10px; border: 0; border-radius: 8px; background: none; color: var(--text-2); font: inherit; font-size: 13.5px; text-align: left; cursor: pointer; }
.cat-rail button em { font-style: normal; font-family: var(--font-mono); font-size: 11px; color: var(--text-3); }
.cat-rail button:hover { background: var(--hover); color: var(--text); }
.cat-rail button.on { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.cat-rail button.on em { color: var(--accent-text); }
.cat-rail button.none { opacity: 0.4; }
.cat-list { padding: 14px; overflow-y: auto; }
.cat-sub { display: block; margin: 14px 2px 8px; }
.cat-sub:first-child { margin-top: 0; }
.cat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.cat-item { display: flex; gap: 10px; align-items: flex-start; padding: 9px 10px; border: 1px solid transparent; border-radius: 10px; color: var(--text); text-decoration: none; background: color-mix(in srgb, var(--bg-elev) 80%, transparent); }
.cat-item > svg { flex: none; width: 18px; height: 18px; margin-top: 1px; color: var(--accent-text); }
.cat-item b { display: block; font-size: 13.5px; font-weight: 600; }
.cat-item small { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; font-size: 12px; color: var(--text-3); }
.cat-item:hover, .cat-item.on { border-color: var(--line-3); background: var(--panel-2); }
.cat-item.on { border-color: var(--accent-line); }
.cat-none { padding: 20px 4px; }
.cat-preview { display: grid; grid-template-rows: minmax(0, 1fr) auto; border-left: 1px solid var(--line-2); background: var(--panel); min-width: 0; }
.cat-sheet { display: grid; place-items: center; padding: 18px; min-height: 0; background-color: var(--canvas); background-image: radial-gradient(var(--grid-dot) 1px, transparent 1px); background-size: 14px 14px; border-bottom: 1px solid var(--line-2); overflow: hidden; }
.cat-sheet svg { width: 100%; height: 100%; max-height: 300px; }
.cat-sheet .faint svg { width: 40px; height: 40px; }
.cat-info { display: grid; gap: 10px; padding: 16px; justify-items: start; }
.cat-name { display: flex; align-items: center; gap: 8px; font-size: 16px; }
.cat-name svg { width: 18px; height: 18px; color: var(--accent-text); }
.cat-info p { margin: 0; font-size: 13px; color: var(--text-2); line-height: 1.5; }
.cat-tags { display: flex; flex-wrap: wrap; gap: 6px; }

/* sections slide in once */
[data-reveal] { opacity: 0; transform: translateY(18px); transition: opacity 0.6s ease, transform 0.6s ease; }
[data-reveal].in { opacity: 1; transform: none; }

@media (max-width: 1000px) {
  .cat-body { grid-template-columns: 190px minmax(0, 1fr); }
  .cat-preview { display: none; }
}
@media (max-width: 900px) {
  .story { height: 260vh; }
  .story-grid { grid-template-columns: 1fr; gap: 14px; }
  .story-steps { order: 2; }
  .story-steps li { display: none; padding: 10px 12px; }
  .story-steps li.on { display: flex; }
  .ss-body { grid-template-columns: 1fr; grid-template-rows: 130px minmax(0, 1fr); height: min(460px, 62vh); }
  .ss-code { border-right: 0; border-bottom: 1px solid var(--line-2); padding: 8px 0; }
  .ss-pre { font-size: 11px; }
  .ss-canvas.carded > svg { height: calc(100% - 128px); }
}
@media (max-width: 640px) {
  .cat-top { flex-direction: column; align-items: stretch; }
  .cat-top .label { display: none; }
  .cat-body { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); height: 560px; }
  .cat-rail { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line-2); }
  .cat-rail button { flex: none; }
  .cat-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  [data-reveal] { opacity: 1; transform: none; transition: none; }
  .ss-ring, .ss-card, .ss-fmt, .ss-caret { animation: none; }
  .story-steps li { transition: none; }
}
