:root {
  --bg: #0f1216;
  --panel: #161a20;
  --panel-2: #1b2027;
  --line: #262d36;
  --line-soft: #1f252d;
  --text: #d8dee7;
  --muted: #8a94a3;
  --dim: #5f6a78;
  --accent: #4da3ff;
  --accent-2: #7cc0ff;
  --accent-dim: rgba(77, 163, 255, 0.14);
  --warn: #ffb454;
  --danger: #ff6b6b;
  --ok: #4ade80;
  --canvas: #0f1216;
  --title-1: #171c23;
  --title-2: #12161b;
  --mono: "Cascadia Code", "JetBrains Mono", Consolas, "SF Mono", monospace;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font: 12px/1.45 -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, select { font: inherit; color: inherit; }
svg { display: block; }

#app {
  height: 100vh;
  display: grid;
  grid-template-rows: 36px auto auto 1fr auto;
  grid-template-columns: minmax(0, 1fr);
}

/* ---------- title bar ---------- */
#titlebar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 12px;
  background: linear-gradient(180deg, var(--title-1), var(--title-2));
  border-bottom: 1px solid var(--line);
  user-select: none;
}
.brand { display: flex; align-items: center; gap: 8px; cursor: pointer; border-radius: 6px; padding: 2px 6px 2px 2px; margin-left: -2px; }
.brand:hover { background: var(--hover, rgba(255,255,255,.06)); }
.brand .logo { width: 20px; height: 20px; display: block; }
.brand-name { font-weight: 650; letter-spacing: 0.2px; font-size: 13px; }
.brand-tag { color: var(--dim); font-size: 10.5px; letter-spacing: 0.3px; text-transform: uppercase; }
.doc-name { color: var(--muted); font-size: 11.5px; padding-left: 14px; border-left: 1px solid var(--line); }
.title-actions { margin-left: auto; display: flex; gap: 6px; }
.chip {
  font-size: 10.5px;
  color: var(--muted);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 9px;
  letter-spacing: 0.2px;
}
.chip.ok { color: var(--ok); border-color: rgba(74, 222, 128, 0.25); background: rgba(74, 222, 128, 0.07); }
.chip.warn { color: var(--warn); border-color: rgba(255, 180, 84, 0.3); background: rgba(255, 180, 84, 0.08); }
.chip.err { color: var(--danger); border-color: rgba(255, 107, 107, 0.3); background: rgba(255, 107, 107, 0.08); }

/* ---------- ribbon ---------- */
#ribbon { background: var(--panel); border-bottom: 1px solid var(--line); user-select: none; }
.tabs { display: flex; gap: 2px; padding: 0 8px; border-bottom: 1px solid var(--line-soft); }
.tab {
  padding: 7px 14px 6px;
  color: var(--muted);
  font-size: 11.5px;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent-2); border-bottom-color: var(--accent); }

.ribbon-body { height: 84px; display: flex; overflow: hidden; min-width: 0; }
.tab-panel { display: none; align-items: stretch; padding: 0 4px; flex: 1 1 auto; min-width: 0; overflow: hidden; }
.tab-panel.active { display: flex; }
.group { display: flex; flex-direction: column; padding: 5px 10px 4px; border-right: 1px solid var(--line-soft); }
.group.grow { flex: 1; }
.group-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--dim);
  margin-bottom: 3px;
  padding-left: 2px;
}
.group-items { display: flex; gap: 2px; align-items: flex-start; }
.hint-text { color: var(--muted); font-size: 11px; max-width: 330px; line-height: 1.5; padding: 4px 2px; }

.rb {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  width: 58px;
  height: 48px;
  border-radius: 6px;
  color: var(--muted);
  border: 1px solid transparent;
}
.rb svg { flex: none; width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.rb svg.fill { fill: currentColor; stroke: none; }
.rb span { font-size: 10px; letter-spacing: 0.1px; white-space: nowrap; }
.rb:hover { background: var(--panel-2); color: var(--text); border-color: var(--line); }
.rb:active { transform: translateY(1px); }
.rb.active { background: var(--accent-dim); color: var(--accent-2); border-color: rgba(77, 163, 255, 0.35); }
.rb.primary { background: linear-gradient(180deg, #2f7fd6, #2568b3); color: #fff; border-color: #3d8fe0; }
.rb.primary:hover { background: linear-gradient(180deg, #3a8ee6, #2b74c4); }
.rb.primary svg { stroke: none; fill: #fff; }
.rb:disabled { opacity: 0.35; cursor: default; }
.rb:disabled:hover { background: none; border-color: transparent; color: var(--muted); }

.slider-wrap { display: flex; align-items: center; gap: 8px; padding: 12px 2px 0; }
input[type="range"] { width: 130px; accent-color: var(--accent); }
.slider-val { font-family: var(--mono); font-size: 11px; color: var(--muted); min-width: 34px; }

/* ---------- workspace ---------- */
#workspace { display: grid; grid-template-columns: 232px minmax(0, 1fr) 286px; min-height: 0; }

.panel { background: var(--panel); display: flex; flex-direction: column; min-height: 0; }
#left-panel { border-right: 1px solid var(--line); }
#right-panel { border-left: 1px solid var(--line); }
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.9px;
  color: var(--dim);
  border-bottom: 1px solid var(--line-soft);
  background: var(--panel-2);
  flex: none;
}
.panel-head .count { color: var(--muted); font-family: var(--mono); font-size: 10px; letter-spacing: 0; }
.panel-body { overflow: auto; flex: 1; min-height: 0; }
#right-panel .panel-body { flex: 0 1 auto; max-height: 46%; }
#right-panel .panel-body:last-child { flex: 1 1 auto; max-height: none; }

/* ---------- viewport ---------- */
#viewport { position: relative; min-width: 0; background: var(--canvas); overflow: hidden; }
#canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: crosshair; }
#canvas.tool-select { cursor: default; }
#canvas.panning { cursor: grabbing; }

.hud {
  position: absolute;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.6px;
  color: var(--dim);
  pointer-events: none;
  user-select: none;
}
.hud-tl { top: 10px; left: 12px; color: var(--muted); }
.hud-tr { top: 10px; right: 12px; }
.hud-bl { bottom: 10px; left: 12px; display: flex; gap: 14px; }
.legend-item { display: flex; align-items: center; gap: 5px; }
.legend-swatch { width: 14px; height: 3px; border-radius: 2px; }

.empty-state {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
  color: var(--muted);
  background: radial-gradient(ellipse at center, rgba(77, 163, 255, 0.05), transparent 60%);
}
.empty-state h2 { margin: 0; font-size: 17px; font-weight: 600; color: var(--text); }
.empty-state p { margin: 0 0 10px; font-size: 12px; }
.empty-state kbd { background: var(--panel-2); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; font-family: var(--mono); font-size: 10.5px; }

.btn {
  padding: 7px 14px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  font-size: 12px;
}
.btn:hover { border-color: var(--dim); }
.btn.primary { background: linear-gradient(180deg, #2f7fd6, #2568b3); border-color: #3d8fe0; color: #fff; }
.btn.primary:hover { background: linear-gradient(180deg, #3a8ee6, #2b74c4); }

/* ---------- tree ---------- */
.tree-section { border-bottom: 1px solid var(--line-soft); }
.tree-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--dim);
  cursor: default;
}
.tree-head .n { margin-left: auto; font-family: var(--mono); letter-spacing: 0; }
.tree-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 18px;
  color: var(--muted);
  cursor: pointer;
  border-left: 2px solid transparent;
}
.tree-item:hover { background: var(--panel-2); color: var(--text); }
.tree-item.selected { background: var(--accent-dim); color: var(--accent-2); border-left-color: var(--accent); }
.tree-item .id { font-family: var(--mono); font-size: 10.5px; color: var(--dim); min-width: 22px; }
.tree-item.selected .id { color: var(--accent-2); }
.tree-item .meta { margin-left: auto; font-family: var(--mono); font-size: 10px; color: var(--dim); }
.tree-empty { padding: 6px 18px 8px; color: var(--dim); font-size: 11px; font-style: italic; }

/* ---------- properties ---------- */
.prop-empty { padding: 14px 12px; color: var(--dim); font-size: 11.5px; line-height: 1.6; }
.prop-title { display: flex; align-items: center; gap: 8px; padding: 10px 12px 6px; }
.prop-title .badge {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--accent-2);
  background: var(--accent-dim);
  border: 1px solid rgba(77, 163, 255, 0.3);
  border-radius: 4px;
  padding: 1px 6px;
}
.prop-title .name { font-weight: 600; font-size: 12px; }
.field { display: flex; align-items: center; gap: 8px; padding: 3px 12px; }
.field label { flex: 0 0 74px; color: var(--muted); font-size: 11px; }
.field input, .field select {
  flex: 1;
  min-width: 0;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 4px 7px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text);
  outline: none;
}
.field input:focus, .field select:focus { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(77, 163, 255, 0.15); }
.field input[readonly] { color: var(--dim); background: transparent; border-color: transparent; }
.field .unit { flex: 0 0 auto; color: var(--dim); font-size: 10px; font-family: var(--mono); }
.prop-actions { padding: 8px 12px 12px; display: flex; gap: 6px; }
.prop-actions .btn { padding: 4px 10px; font-size: 11px; }
.prop-actions .btn.danger { color: var(--danger); border-color: rgba(255, 107, 107, 0.3); }
.prop-actions .btn.danger:hover { background: rgba(255, 107, 107, 0.1); }

/* ---------- results ---------- */
.res-empty { padding: 14px 12px; color: var(--dim); font-size: 11.5px; line-height: 1.6; }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line-soft); margin: 8px 10px; border: 1px solid var(--line-soft); border-radius: 6px; overflow: hidden; }
.stat { background: var(--panel); padding: 7px 9px; }
.stat .k { display: block; font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.6px; color: var(--dim); }
.stat .v { display: block; font-family: var(--mono); font-size: 12.5px; color: var(--text); margin-top: 1px; }
.stat .v small { color: var(--dim); font-size: 9.5px; }
.res-table-wrap { padding: 0 10px 10px; }
.res-table-title { font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.7px; color: var(--dim); margin: 8px 0 4px; }
table.res { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: 10px; }
table.res th { text-align: right; color: var(--dim); font-weight: 500; padding: 3px 4px; border-bottom: 1px solid var(--line); }
table.res th:first-child, table.res td:first-child { text-align: left; }
table.res td { text-align: right; padding: 3px 4px; color: var(--muted); border-bottom: 1px solid var(--line-soft); }
table.res tr:hover td { color: var(--text); background: var(--panel-2); }
table.res td.pos { color: var(--accent-2); }
table.res td.neg { color: var(--warn); }

/* ---------- footer ---------- */
#footer { border-top: 1px solid var(--line); background: var(--panel); }
#cmdline {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  height: 30px;
  border-bottom: 1px solid var(--line-soft);
}
#cmdline .prompt { color: var(--accent); font-family: var(--mono); font-size: 14px; }
#cmdInput {
  flex: 1;
  background: transparent;
  border: 0;
  outline: none;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text);
  padding: 4px 0;
}
#cmdInput::placeholder { color: var(--dim); }
.cmd-hint { color: var(--dim); font-size: 10px; font-family: var(--mono); }

#statusbar {
  display: flex;
  align-items: center;
  gap: 14px;
  height: 24px;
  padding: 0 10px;
  font-size: 10.5px;
  color: var(--dim);
  font-family: var(--mono);
}
#statusbar .spacer { flex: 1; }
.sb-item { color: var(--dim); }
.sb-item.on { color: var(--accent-2); }
#statusMsg { color: var(--muted); font-family: -apple-system, "Segoe UI", Roboto, sans-serif; font-size: 11px; }

/* ---------- toasts ---------- */
#toasts { position: fixed; right: 16px; bottom: 64px; display: flex; flex-direction: column; gap: 8px; z-index: 50; }
.toast {
  min-width: 220px;
  max-width: 360px;
  padding: 9px 12px;
  border-radius: 7px;
  background: #1e242c;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  color: var(--text);
  font-size: 11.5px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  animation: toast-in 0.18s ease-out;
}
.toast { display: flex; align-items: center; gap: 10px; font-size: 12.5px; transform-origin: bottom right; }
.toast .toast-msg { flex: 1; }
.toast .toast-act { padding: 4px 10px; font-size: 11.5px; white-space: nowrap; }
.toast .toast-x { opacity: .6; }
.toast.out { animation: toast-out .12s ease-in forwards; }
@keyframes toast-out { to { opacity: 0; transform: translateY(4px) scale(.97); } }
.toast.warn { border-left-color: var(--warn); }
.toast.error { border-left-color: var(--danger); }
.toast.ok { border-left-color: var(--ok); }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- modal ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 12, 0.6);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
/* dialogs ship with [hidden]; .open (set by open*()) must beat it */
.modal-backdrop.open { display: flex !important; }
.modal {
  width: 560px;
  max-width: calc(100vw - 40px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  font-weight: 600;
}
.modal-body { padding: 14px 16px 18px; color: var(--muted); font-size: 12px; }
.modal-body h4 { margin: 12px 0 6px; color: var(--text); font-size: 11px; text-transform: uppercase; letter-spacing: 0.8px; }
.modal-body h4:first-child { margin-top: 0; }
.modal-body p { margin: 3px 0; }
.modal-body kbd { background: var(--panel-2); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; font-family: var(--mono); font-size: 10.5px; color: var(--text); }
.modal-body .mono { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.help-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 24px; }
.icon-btn { width: 26px; height: 26px; border-radius: 5px; color: var(--muted); font-size: 16px; line-height: 1; }
.icon-btn:hover { background: var(--panel-2); color: var(--text); }

/* ---------- load cases & factors ---------- */
.case-bar { display: flex; align-items: flex-end; gap: 6px; padding-top: 4px; }
.case-bar select {
  height: 30px;
  min-width: 132px;
  max-width: 190px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  font-family: inherit;
  font-size: 11.5px;
  padding: 0 6px;
}
.case-bar select:focus { outline: none; border-color: var(--accent); }
.rb.small { padding: 4px 7px 3px; }
.rb.small svg { width: 15px; height: 15px; }
.rb.small span { font-size: 9px; }
.mini-field {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 0 6px 2px;
  font-size: 10.5px;
  color: var(--dim);
}
.mini-field input {
  width: 52px;
  height: 26px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 11px;
  padding: 0 5px;
}
.mini-field input:focus { outline: none; border-color: var(--accent); }

.modal.narrow { width: 470px; }
.modal-note { color: var(--dim); font-size: 11px; line-height: 1.55; margin: 0 0 10px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.btn.ghost { background: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); border-color: var(--dim); }
table.factors { width: 100%; border-collapse: collapse; font-size: 11.5px; }
table.factors th {
  text-align: left;
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--dim);
  font-weight: 500;
  padding: 0 6px 5px;
}
table.factors td { padding: 3px 6px; border-top: 1px solid var(--line-soft); color: var(--text); }
table.factors td:first-child { color: var(--muted); }
table.factors input {
  width: 74px;
  height: 26px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 11px;
  padding: 0 5px;
}
table.factors input:focus { outline: none; border-color: var(--accent); }

.res-view { display: flex; align-items: center; gap: 8px; padding: 9px 10px 2px; }
.res-view label { font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.6px; color: var(--dim); }
.res-view select {
  flex: 1;
  height: 27px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--text);
  font-family: inherit;
  font-size: 11px;
  padding: 0 5px;
}
.res-view select:focus { outline: none; border-color: var(--accent); }
.res-note { padding: 8px 10px 0; color: var(--dim); font-size: 10.5px; line-height: 1.5; }
table.res.env th { padding: 0 3px 4px; font-size: 9px; }
table.res.env td { padding: 3px 3px; }
.env-cell { display: flex; flex-direction: column; line-height: 1.3; }
.env-cell b { font-weight: 500; color: var(--text); font-size: 10.5px; }
.env-cell span { color: var(--dim); font-size: 9.5px; }

/* ================= report ================= */
#reportOverlay { position: fixed; inset: 0; z-index: 60; background: #e8ecf1; display: flex; flex-direction: column; }
.rpt-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 14px; background: var(--panel); border-bottom: 1px solid var(--line); }
.rpt-bar-title { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--dim); }
.rpt-bar-actions { display: flex; gap: 8px; }
#report { flex: 1; width: 100%; border: 0; background: #e5e7eb; display: block; }
#report .rpt-head { display: flex; justify-content: space-between; align-items: flex-end; border-bottom: 2px solid #111827; padding-bottom: 6px; }
#report .rpt-brand { font-size: 19px; font-weight: 700; letter-spacing: -0.02em; }
#report .rpt-sub { font-size: 10px; color: #6b7280; text-transform: uppercase; letter-spacing: 0.1em; }
#report .rpt-stamp { font-size: 10.5px; color: #6b7280; }
#report h1 { font-size: 21px; margin: 14px 0 2px; font-weight: 650; }
#report .rpt-meta { font-size: 10.5px; color: #6b7280; margin-bottom: 6px; }
#report h2 { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.07em; margin: 20px 0 7px; padding-bottom: 3px; border-bottom: 1px solid #d1d5db; color: #111827; }
#report h3 { font-size: 11.5px; margin: 13px 0 4px; font-weight: 600; color: #374151; }
#report .rpt-table { width: 100%; border-collapse: collapse; font-size: 10.5px; margin-bottom: 6px; }
#report .rpt-table th { text-align: left; background: #f3f4f6; border-bottom: 1px solid #cbd5e1; padding: 3px 6px; font-weight: 600; color: #374151; }
#report .rpt-table td { border-bottom: 1px solid #e5e7eb; padding: 3px 6px; font-variant-numeric: tabular-nums; }
#report .rpt-table td.num, #report .rpt-table th.num { text-align: right; }
#report .rpt-fig { border: 1px solid #d1d5db; padding: 4px; margin: 4px 0 8px; background: #fff; }
#report .rpt-fig img { display: block; max-width: 100%; max-height: 88mm; margin: 0 auto; }
#report .rpt-note { font-size: 10.5px; color: #6b7280; margin: 4px 0; }
#report .rpt-foot { margin-top: 20px; border-top: 1px solid #d1d5db; padding-top: 6px; font-size: 9.5px; color: #6b7280; line-height: 1.5; }
#report .rpt-table, #report .rpt-fig { page-break-inside: avoid; }

@media print {
  @page { size: A4; margin: 13mm; }
  html, body { height: auto !important; overflow: visible !important; background: #fff !important; }
  #app, .modal-backdrop, #fileInput, .rpt-bar { display: none !important; }
  #reportOverlay { position: static; background: #fff; display: block !important; }
  #report { width: auto; max-width: none; margin: 0; padding: 0; box-shadow: none; overflow: visible; font-size: 11px; }
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #2a323c; border-radius: 6px; border: 2px solid var(--panel); }
::-webkit-scrollbar-thumb:hover { background: #35404c; }
::-webkit-scrollbar-track { background: transparent; }

/* ================= Framelysis UI extensions ================= */

/* dynamic input tooltip at the cursor */
.dyn-input {
  position: absolute;
  z-index: 6;
  pointer-events: none;
  transform: translate(14px, 14px);
  background: rgba(15, 18, 22, 0.94);
  border: 1px solid var(--accent);
  border-radius: 5px;
  padding: 3px 8px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent-2);
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
  letter-spacing: 0.2px;
}
.dyn-input .dim { color: var(--dim); }
.dyn-input .warn { color: var(--warn); }

/* command autocomplete */
#cmdline { position: relative; }
.cmd-suggest {
  position: absolute;
  left: 22px;
  bottom: 30px;
  min-width: 320px;
  max-width: 620px;
  max-height: 232px;
  overflow: auto;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 7px;
  box-shadow: 0 -8px 26px rgba(0, 0, 0, 0.5);
  z-index: 40;
  padding: 3px;
}
.cmd-suggest .sg {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 11px;
}
.cmd-suggest .sg:hover, .cmd-suggest .sg.sel { background: var(--accent-dim); }
.cmd-suggest .sg b { color: var(--accent-2); font-weight: 600; min-width: 74px; }
.cmd-suggest .sg span { color: var(--dim); font-size: 10.5px; }
.cmd-suggest .sg em { color: var(--muted); font-style: normal; margin-left: auto; font-size: 10px; }

/* ribbon select */
.rb-select {
  height: 30px;
  min-width: 150px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  font-family: inherit;
  font-size: 11.5px;
  padding: 0 6px;
  margin-top: 8px;
}
.rb-select:focus { outline: none; border-color: var(--accent); }

/* status bar tool chip */
.sb-tool {
  color: var(--accent-2);
  background: var(--accent-dim);
  border: 1px solid rgba(77, 163, 255, 0.28);
  border-radius: 4px;
  padding: 0 6px;
  font-size: 9.5px;
  letter-spacing: 0.6px;
  line-height: 16px;
}
.sb-item.on { color: var(--accent-2); }
.sb-item.warn { color: var(--warn); }

/* load editor dialog */
.modal.wide { width: 620px; }
.load-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px 18px;
  margin-bottom: 10px;
}
.load-grid .field { padding: 3px 0; }
.load-grid .field label { flex: 0 0 62px; }
.load-preview {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--warn);
  background: rgba(255, 180, 84, 0.07);
  border: 1px solid rgba(255, 180, 84, 0.22);
  border-radius: 6px;
  padding: 7px 10px;
  margin: 4px 0 12px;
  min-height: 30px;
  line-height: 1.4;
}
.load-list-head {
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--dim);
  margin: 4px 0 5px;
}
.load-list { max-height: 168px; overflow: auto; border: 1px solid var(--line-soft); border-radius: 6px; }
.load-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 11px;
  color: var(--muted);
  cursor: pointer;
}
.load-row:last-child { border-bottom: 0; }
.load-row:hover { background: var(--panel-2); color: var(--text); }
.load-row.sel { background: var(--accent-dim); color: var(--accent-2); }
.load-row .tag {
  font-family: var(--mono);
  font-size: 9.5px;
  color: var(--warn);
  border: 1px solid rgba(255, 180, 84, 0.3);
  border-radius: 3px;
  padding: 0 4px;
  flex: none;
}
.load-row .txt { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.load-row .del { color: var(--dim); font-size: 13px; line-height: 1; padding: 0 3px; }
.load-row .del:hover { color: var(--danger); }
.load-empty { padding: 10px; color: var(--dim); font-size: 11px; font-style: italic; }

/* tree: load rows */
.tree-item .tag {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--warn);
  border: 1px solid rgba(255, 180, 84, 0.28);
  border-radius: 3px;
  padding: 0 3px;
  flex: none;
}
.tree-item .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-item.sub { padding-left: 30px; }

/* properties: load summary */
.prop-desc {
  margin: 2px 12px 8px;
  padding: 6px 9px;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--warn);
  background: rgba(255, 180, 84, 0.06);
  border: 1px solid rgba(255, 180, 84, 0.2);
  border-radius: 5px;
  line-height: 1.45;
}
.prop-sub {
  padding: 8px 12px 2px;
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--dim);
}
.prop-list { padding: 0 12px 8px; }
.prop-list .pl-row {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 4px 6px;
  border-radius: 4px;
  font-size: 11px;
  color: var(--muted);
  cursor: pointer;
}
.prop-list .pl-row:hover { background: var(--panel-2); color: var(--text); }
.prop-list .pl-row.sel { background: var(--accent-dim); color: var(--accent-2); }
.prop-list .pl-row .txt { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--mono); font-size: 10px; }

/* hint text emphasis */
.hint-text b { color: var(--muted); font-weight: 600; }
.hint-text code { font-family: var(--mono); color: var(--accent-2); }

/* results: numeric labels legend */
.res-legend { display: flex; flex-wrap: wrap; gap: 10px; padding: 4px 10px 8px; }
.res-legend .lg { display: flex; align-items: center; gap: 5px; font-size: 10px; color: var(--dim); }
.res-legend .sw { width: 12px; height: 3px; border-radius: 2px; }


/* ---- tabulated results modal ---- */
.table-tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.table-tabs .seg {
  background: var(--panel-2); border: 1px solid var(--line); color: var(--muted);
  border-radius: 6px; padding: 5px 10px; font-size: 11px; cursor: pointer;
}
.table-tabs .seg:hover { color: var(--text); border-color: var(--line-2, var(--line)); }
.table-tabs .seg.on { color: #fff; background: var(--accent); border-color: var(--accent); }
.table-scroll { max-height: 52vh; overflow: auto; border: 1px solid var(--line); border-radius: 6px; }
.table-scroll table.res { width: 100%; }
.table-scroll table.res thead th { position: sticky; top: 0; background: var(--panel-2); z-index: 1; }

/* GRASP member-load window: palette of the ten load types */
.load-types { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin: 10px 0 8px; }
.lt-card { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px 4px; border: 1px solid var(--line); border-radius: 6px; background: transparent; color: var(--text-dim, #93a1b3); font: 10.5px/1.2 inherit; cursor: pointer; text-align: center; }
.lt-card svg { width: 64px; height: 30px; stroke: #ffb454; fill: none; stroke-width: 1.4; }
.lt-card:hover { border-color: #ffb45488; color: var(--text, #dbe3ec); }
.lt-card.on { border-color: #4da3ff; background: rgba(77,163,255,.12); color: var(--text, #dbe3ec); }

/* ---- v1.2 ribbon: stacked small buttons (Office style), no scrollbars ---- */
.stack { display: flex; flex-direction: column; gap: 1px; }
.rb.sm { flex-direction: row; justify-content: flex-start; gap: 6px; width: auto; min-width: 92px; height: 21px; padding: 0 6px; border-radius: 4px; }
.rb.sm svg { width: 14px; height: 14px; }
.rb.sm span { font-size: 10.5px; white-space: nowrap; }
.group-items { gap: 4px; align-items: center; height: 100%; }
.group { padding: 4px 8px 3px; flex: 0 0 auto; }
.tabs { align-items: center; }
.tab-collapse { margin-left: auto; color: var(--dim); width: 26px; height: 22px; border-radius: 4px; transition: transform .15s; }
.tab-collapse:hover { color: var(--text); background: var(--panel-2); }
#ribbon.collapsed .ribbon-body { display: none; }
#ribbon.collapsed .tab-collapse { transform: rotate(180deg); }
.stack .mini-field { height: 21px; padding: 0 6px; }
.stack .mini-field input { height: 19px; width: 44px; }
/* narrow windows: drop small-button labels to icons, then hide group labels */
/* v1.9.1: desktop keeps every button's name, like phones and tablets (the ribbon scrolls sideways when it is wider than the window) */
@media (max-width: 1360px) and (hover: hover) { .rb.sm { min-width: 0; } }
@media (max-width: 1100px) { .rb { width: 48px; } .group { padding: 4px 5px 3px; } }

/* ---- collapsible side panels ---- */
.panel-toggle { position: absolute; top: 50%; z-index: 5; width: 14px; height: 44px; margin-top: -22px; background: var(--panel); border: 1px solid var(--line); color: var(--muted); font-size: 10px; line-height: 42px; text-align: center; cursor: pointer; padding: 0; }
.panel-toggle:hover { color: var(--accent-2); background: var(--panel-2); }
#toggleLeft { left: 0; border-left: none; border-radius: 0 6px 6px 0; }
#toggleRight { right: 0; border-right: none; border-radius: 6px 0 0 6px; }
#workspace { transition: grid-template-columns .15s; }
#workspace.hide-left { grid-template-columns: 0 minmax(0, 1fr) 286px; }
#workspace.hide-right { grid-template-columns: 232px minmax(0, 1fr) 0; }
#workspace.hide-left.hide-right { grid-template-columns: 0 minmax(0, 1fr) 0; }
#workspace.hide-left #left-panel, #workspace.hide-right #right-panel { overflow: hidden; border: none; }

/* ---- generic GRASP-style dialogs ---- */
.form-grid { display: grid; grid-template-columns: 150px 1fr; gap: 6px 10px; align-items: center; }
.form-grid label { color: var(--muted); font-size: 11.5px; }
.form-grid input, .form-grid select, .wiz input, .wiz select { height: 28px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 5px; color: var(--text); font-family: var(--mono); font-size: 11.5px; padding: 0 7px; min-width: 0; }
.form-grid input:focus, .form-grid select:focus, .wiz input:focus { outline: none; border-color: var(--accent); }
.form-grid input[type=checkbox] { height: 16px; width: 16px; accent-color: var(--accent); }
.wiz-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.wiz-card { border: 1px solid var(--line); border-radius: 8px; padding: 8px; text-align: center; color: var(--muted); font-size: 11px; background: var(--panel-2); cursor: pointer; }
.wiz-card svg { width: 100%; height: 70px; stroke: var(--text); fill: none; stroke-width: 1.3; }
.wiz-card.on { border-color: var(--accent); background: var(--accent-dim); color: var(--accent-2); }
.wiz-cards.sec { grid-template-columns: repeat(4, 1fr); }
.wiz-cards.sec svg { height: 44px; fill: #b06b5a; stroke: none; }
.wiz-row { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px; margin: 10px 0; }
.wiz-row label { display: flex; justify-content: space-between; align-items: center; gap: 8px; color: var(--muted); font-size: 11.5px; }
.wiz-row input { width: 90px; }
.wiz-list { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0 8px; }
.wiz-list input { width: 64px; }
.wiz-sub { font-size: 10px; text-transform: uppercase; letter-spacing: .8px; color: var(--dim); margin-top: 8px; }
.wiz-steps { color: var(--dim); font-size: 10.5px; margin-left: 10px; font-weight: 400; }
.wiz-prev { display: block; margin: 8px auto 0; background: var(--canvas); border: 1px solid var(--line); border-radius: 6px; }

/* ---------- v1.3 settings menu, light theme, accents, animations ---------- */
body.light {
  --bg: #e6eaf0; --panel: #f3f5f9; --panel-2: #e9edf3; --line: #c9d1dc; --line-soft: #d9dfe8;
  --text: #1f2a3a; --muted: #4a5668; --dim: #6f7b8c; --canvas: #edf0f5; --title-1: #f3f5f9; --title-2: #e9edf3; --hover: rgba(20,40,80,.07);
  --warn: #c27400; --danger: #d33a3a; --ok: #15994a;
}
body.accent-teal { --accent: #2dd4bf; --accent-2: #5eead4; --accent-dim: rgba(45,212,191,.14); }
body.accent-violet { --accent: #a78bfa; --accent-2: #c4b5fd; --accent-dim: rgba(167,139,250,.15); }
body.accent-amber { --accent: #f5a524; --accent-2: #fbbf24; --accent-dim: rgba(245,165,36,.15); }
body.accent-rose { --accent: #fb7185; --accent-2: #fda4af; --accent-dim: rgba(251,113,133,.15); }
body.light.accent-blue, body.light:not([class*=accent-]) { --accent: #1f74d1; --accent-2: #1f74d1; --accent-dim: rgba(31,116,209,.12); }
body.light .rb.primary, body.light .btn.primary { background: var(--accent); border-color: var(--accent); }
body:not(.accent-blue):not(.light) .rb.primary, body[class*=accent-]:not(.accent-blue) .btn.primary { background: var(--accent); border-color: var(--accent); color: #0b0e12; }

.hamburger { width: 28px; height: 24px; border-radius: 6px; display: grid; place-items: center; color: var(--muted); border: 1px solid transparent; }
.hamburger:hover, .hamburger[aria-expanded=true] { background: var(--panel-2); border-color: var(--line); color: var(--text); }
.hamburger svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
#titlebar { position: relative; }
.settings-menu { position: absolute; top: 34px; right: 8px; z-index: 120; width: 236px; padding: 10px 12px 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 16px 40px rgba(0,0,0,.35); transform-origin: top right; }
.sm-head { font-weight: 650; margin-bottom: 6px; }
.sm-label { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--dim); margin: 8px 0 5px; }
.sm-seg { display: flex; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; }
.sm-seg button { flex: 1; padding: 5px 0; color: var(--muted); font-size: 11px; }
.sm-seg button.on { background: var(--accent-dim); color: var(--accent-2); }
.sm-swatches { display: flex; gap: 8px; }
.sm-swatches button { width: 22px; height: 22px; border-radius: 50%; background: var(--sw); border: 2px solid transparent; box-shadow: 0 0 0 1px var(--line); }
.sm-swatches button.on { border-color: var(--panel); box-shadow: 0 0 0 2px var(--sw); }
.sm-row { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; cursor: pointer; }
.sm-switch { appearance: none; width: 30px; height: 17px; border-radius: 9px; background: var(--line); position: relative; cursor: pointer; margin: 0; }
.sm-switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 13px; height: 13px; border-radius: 50%; background: #fff; transition: left .15s; }
.sm-switch:checked { background: var(--accent); }
.sm-switch:checked::after { left: 15px; }
.sm-foot { margin-top: 10px; padding-top: 7px; border-top: 1px solid var(--line-soft); color: var(--dim); font-size: 10.5px; }

/* subtle motion, only when Animations is on (also honours the OS reduced-motion setting) */
body.anim .rb, body.anim .btn, body.anim .tab, body.anim .tree-item, body.anim .hamburger, body.anim .lt-card { transition: background-color .14s, color .14s, border-color .14s, transform .1s; }
body.anim .tab-panel.active { animation: fl-fade .18s ease-out; }
body.anim .modal-backdrop.open { animation: fl-fade .16s ease-out; }
body.anim .modal-backdrop.open .modal { animation: fl-pop .2s cubic-bezier(.16,1,.3,1); }
body.anim .settings-menu:not([hidden]) { animation: fl-pop .16s ease-out; }
body.anim #reportOverlay:not([hidden]) { animation: fl-fade .2s ease-out; }
body.anim #workspace { transition: grid-template-columns .22s ease; }
body.anim .chip { transition: color .2s, background-color .2s, border-color .2s; }
body:not(.anim) *, body:not(.anim) *::before, body:not(.anim) *::after { animation: none !important; transition: none !important; }
@keyframes fl-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes fl-pop { from { opacity: 0; transform: translateY(-4px) scale(.95); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { body.anim *, body.anim *::before, body.anim *::after { animation-duration: 1ms !important; transition-duration: 1ms !important; } }
body.light .chip { background: var(--panel-2); color: var(--muted); border-color: var(--line); }
body.light.accent-teal { --accent: #0f9488; --accent-2: #0f766e; --accent-dim: rgba(15,148,136,.12); }
body.light.accent-violet { --accent: #7c3aed; --accent-2: #6d28d9; --accent-dim: rgba(124,58,237,.10); }
body.light.accent-amber { --accent: #c26a00; --accent-2: #a35900; --accent-dim: rgba(194,106,0,.12); }
body.light.accent-rose { --accent: #e11d48; --accent-2: #be123c; --accent-dim: rgba(225,29,72,.10); }
body.light[class*=accent-] .rb.primary, body.light[class*=accent-] .btn.primary { color: #fff; }

/* status bar toggles (v1.4) */
.sb-btn { background: none; border: 1px solid transparent; border-radius: 4px; padding: 1px 6px; font: inherit; cursor: pointer; }
.sb-btn:hover { border-color: var(--line); color: var(--text); }
.sb-btn:active { transform: scale(.97); }
.sb-units { color: var(--dim); background: transparent; appearance: none; -webkit-appearance: none; }
.sb-units option { background: var(--panel, #1b2027); color: var(--text); }

/* Number inputs: no native spinners; the value is edited by typing, arrow keys,
   or Alt+drag / wheel (see app.js nudge). */
input[type=number] { -moz-appearance: textfield; appearance: textfield; }
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.field input[type=number] { font-family: var(--mono); text-align: right; cursor: text; }
.field input[type=number]:hover:not(:focus) { border-color: var(--line-2, #3a4350); cursor: ns-resize; }
#canvas.xhair { cursor: none; }
#canvas.xhair.panning { cursor: grabbing; }
body.accent-green { --accent: #4ade80; --accent-2: #86efac; --accent-dim: rgba(74,222,128,.14); }
body.light.accent-green { --accent: #15994a; --accent-2: #15803d; --accent-dim: rgba(21,153,74,.10); }

/* ---------- Settings dialog (v1.4) ---------- */
.modal.settings-dlg { width: min(720px, 94vw); max-width: none; }
.set-wrap { display: flex; min-height: 360px; border-top: 1px solid var(--line-soft, var(--line)); }
.set-nav { width: 170px; padding: 10px 8px; border-right: 1px solid var(--line-soft, var(--line)); display: flex; flex-direction: column; gap: 2px; }
.set-nav button { text-align: left; padding: 7px 10px; border-radius: 6px; color: var(--muted); font-size: 12px; position: relative; }
.set-nav button:hover { background: var(--panel-2); color: var(--text); }
.set-nav button.on { background: var(--accent-dim); color: var(--accent-2); }
.set-body { flex: 1; padding: 6px 18px 12px; overflow: auto; max-height: 60vh; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 11px 0; border-bottom: 1px solid var(--line-soft, var(--line)); }
.set-row:last-child { border-bottom: 0; }
.set-lab { color: var(--text); font-size: 12.5px; }
.set-lab small { display: block; color: var(--dim); font-size: 11px; margin-top: 2px; }
.set-ctl { display: flex; align-items: center; gap: 8px; }
.set-ctl input[type=range] { width: 150px; accent-color: var(--accent); }
.set-ctl input[type=number], .set-ctl select { width: 120px; background: var(--panel-2); border: 1px solid var(--line); color: var(--text); border-radius: 6px; padding: 4px 7px; font-size: 12px; }
.set-ctl input[type=number] { width: 70px; }
.set-val { min-width: 44px; color: var(--dim); font-family: var(--mono); font-size: 11px; }
.set-actions { display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-top: 1px solid var(--line-soft, var(--line)); }
.set-actions .set-ver { flex: 1; text-align: center; color: var(--dim); font-size: 10.5px; }
body.anim .set-row { animation: fl-rise .2s ease-out both; animation-delay: calc(var(--i) * 30ms); }
@keyframes fl-rise { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
body.density-compact .rb span { font-size: 10px; }
body.density-compact .rb { padding-top: 2px; padding-bottom: 2px; }
body.density-comfy .rb { padding-top: 6px; padding-bottom: 6px; }
body.density-comfy .tree-item, body.density-comfy .field { padding-top: 3px; padding-bottom: 3px; }

/* v1.4 motion (from "UI Improvement" notes): ease-out entrances, no bounce,
   press scale .97, popovers grow from .95 at their trigger, 30 ms list stagger,
   success pulse, exits ~20 % shorter than entrances, mouse leaves canvas quietly. */
body.anim .rb:active, body.anim .btn:active, body.anim .tab:active, body.anim .sb-btn:active { transform: scale(.97); }
body.anim .rb { transition: background-color .14s ease-out, color .14s ease-out, transform .08s ease-out; }
body.anim select, body.anim .cmd-suggest:not([hidden]) { transform-origin: top; }
body.anim .cmd-suggest:not([hidden]) { animation: fl-pop .16s cubic-bezier(.16,1,.3,1); transform-origin: bottom left; }
body.anim .toast { animation: toast-in .2s cubic-bezier(.16,1,.3,1); }
body.anim .toast.out { animation: toast-out .14s ease-in forwards; }
body.anim .sm-switch::after { transition: left .16s cubic-bezier(.16,1,.3,1), width .16s; }
body.anim .sm-switch:active::after { width: 15px; }   /* knob stretches while pressed */
body.anim .stat .v { transition: color .2s; }
@media (prefers-reduced-motion: reduce) { body.anim *, body.anim *::before, body.anim *::after { animation: none !important; transition: none !important; } }

/* ---------- Start page (v1.4) ---------- */
.start { position: fixed; inset: 0; z-index: 900; display: grid; grid-template-columns: 340px 1fr; background: var(--bg); }
.start[hidden] { display: none; }
body.anim .start:not([hidden]) { animation: fl-fade .2s ease-out; }
body.anim .start.out { animation: start-out .16s ease-in forwards; }
@keyframes start-out { to { opacity: 0; transform: scale(.99); } }
.start-side { background: var(--panel); border-right: 1px solid var(--line); padding: 26px 22px; display: flex; flex-direction: column; gap: 6px; overflow: auto; }
.start-brand { display: flex; gap: 12px; align-items: center; margin-bottom: 18px; }
.start-brand img { width: 44px; height: 44px; }
.start-brand b { display: block; font-size: 19px; letter-spacing: .3px; }
.start-brand span { color: var(--dim); font-size: 11px; text-transform: uppercase; letter-spacing: .6px; }
.start-sec { color: var(--dim); font-size: 10.5px; text-transform: uppercase; letter-spacing: .8px; margin: 14px 0 4px; }
.start svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.start-big { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 8px; background: var(--accent); color: #fff; font-size: 13.5px; font-weight: 600; }
.start-big:hover { filter: brightness(1.1); }
.start-link { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 6px; color: var(--text); font-size: 12.5px; text-align: left; }
.start-link:hover { background: var(--panel-2); }
.start-link kbd { margin-left: auto; color: var(--dim); font: 10.5px var(--mono); }
.start-tpl { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.start-tpl button { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 6px 9px; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); font-size: 11.5px; background: var(--panel-2); }
.start-tpl button:hover { border-color: var(--accent); color: var(--text); }
.start-tpl svg { width: 60px; height: 40px; stroke-width: 2.2; color: var(--accent-2); }
.start-foot { margin-top: auto; padding-top: 16px; display: flex; justify-content: space-between; color: var(--dim); font-size: 11px; }
.start-foot label { display: flex; gap: 6px; align-items: center; cursor: pointer; }
.start-main { padding: 34px 44px; overflow: auto; }
.start-head { display: flex; align-items: baseline; justify-content: space-between; margin: 0 0 12px; max-width: 1560px; }
.start-head h2 { font-size: 15px; font-weight: 600; margin: 0; }
.start-clear { color: var(--dim); font-size: 11px; }
.start-clear:hover { color: var(--text); }
.start-recent { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; max-width: 1560px; margin-bottom: 34px; }
.start-card { text-align: left; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); padding: 0; overflow: hidden; }
.start-card:hover { border-color: var(--accent); }
.start-card .thumb { height: 104px; background: var(--canvas-bg, #11151c); display: flex; align-items: center; justify-content: center; }
.start-card .thumb svg { width: 86%; height: 84%; stroke: var(--accent-2); stroke-width: 1.4; }
.start-card .meta { padding: 8px 10px; }
.start-card .meta b { display: block; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.start-card .meta span { color: var(--dim); font-size: 10.5px; }
body.anim .start-card { animation: fl-rise .2s ease-out both; animation-delay: calc(var(--i) * 30ms); }
.start-empty { color: var(--dim); font-size: 12px; padding: 18px 0; }
.start-learn { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; max-width: 1560px; }
.start-learn div { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; background: var(--panel); }
.start-learn b { display: block; font-size: 12.5px; margin-bottom: 4px; }
.start-learn span { color: var(--muted); font-size: 11.5px; line-height: 1.5; }
.start-learn code { font: 11px var(--mono); color: var(--accent-2); }
.set-ctl .sm-seg button { flex: none; padding: 5px 12px; }

/* ---------- v1.4.1 ---------- */
#footer { position: relative; }
#footer.hide-footer { border-top: 0; }
#footer.hide-footer #cmdline, #footer.hide-footer #statusbar { display: none; }
.footer-toggle { position: absolute; top: -11px; left: 50%; transform: translateX(-50%); width: 46px; height: 11px; line-height: 9px; padding: 0; font-size: 8px; color: var(--dim); background: var(--panel); border: 1px solid var(--line); border-bottom: 0; border-radius: 6px 6px 0 0; z-index: 2; }
.footer-toggle:hover { color: var(--text); }
.res-table-wrap { overflow-x: auto; }
.start-sub { color: var(--dim); font-size: 11px; }
.start-cmds { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 6px 14px; max-width: 1560px; margin-bottom: 34px; }
.cmd-row { display: grid; grid-template-columns: 170px 1fr; gap: 10px; align-items: baseline; padding: 6px 0; border-bottom: 1px solid var(--line-soft); }
.cmd-row code { font: 11.5px var(--mono); color: var(--accent-2); white-space: normal; overflow-wrap: anywhere; min-width: 0; }   /* a long command wraps in its column instead of running into the description */
.cmd-row span { color: var(--muted); font-size: 11.5px; min-width: 0; overflow-wrap: anywhere; }
.credit { margin-top: 12px; color: var(--dim); font-size: 10.5px; text-align: center; }
.credit em { font-style: normal; opacity: .8; }
.set-foot-credit { color: var(--dim); font-size: 10.5px; }

/* v1.4.2: tab strip wraps instead of spilling out of the Tabulated results dialog */
.table-tabs { flex-wrap: wrap; }
.table-tabs .seg { white-space: nowrap; }
#tableModal .modal.wide { width: min(960px, 94vw); }
#tableModal .table-scroll { max-width: 100%; }

/* v1.5 structure-type indicator: a glowing chip in the title bar and a glow on the active Frame/Truss button */
.chip.type { font-weight: 700; letter-spacing: .08em; }
.chip.type.frame { color: var(--accent-2); border-color: var(--accent); background: var(--accent-dim); box-shadow: 0 0 10px var(--accent-dim), 0 0 3px var(--accent); }
.chip.type.truss { color: var(--warn); border-color: var(--warn); background: rgba(255,180,84,.12); box-shadow: 0 0 10px rgba(255,180,84,.35), 0 0 3px var(--warn); }
body.light .chip.type.truss { background: rgba(194,116,0,.10); box-shadow: 0 0 10px rgba(194,116,0,.25); }
.rb.glow { box-shadow: 0 0 0 1px var(--accent), 0 0 12px var(--accent-dim); }
body.anim .chip.type { transition: box-shadow .25s, color .2s, border-color .2s, background-color .2s; }

/* v1.5 — tablets and phones */
#canvas { touch-action: none; }
@media (pointer: coarse) {
  .rb { min-height: 34px; }
  .panel-toggle { width: 26px; height: 44px; font-size: 14px; }
  .tab { padding-top: 8px; padding-bottom: 8px; }
}
@media (max-width: 760px) {
  #workspace, #workspace.hide-left, #workspace.hide-right, #workspace.hide-left.hide-right { grid-template-columns: 0 minmax(0, 1fr) 0; position: relative; }
  #left-panel, #right-panel { position: absolute; top: 0; bottom: 0; width: min(82vw, 300px); z-index: 20; box-shadow: 0 0 24px rgba(0,0,0,.45); }
  #left-panel { left: 0; } #right-panel { right: 0; }
  #viewport { grid-column: 2; }
  #workspace.hide-left #left-panel, #workspace.hide-right #right-panel { display: none; }
  .panel-toggle { z-index: 30; }
  .tab-panel.active { overflow-x: auto; scrollbar-width: none; }
  .tabs { overflow-x: auto; scrollbar-width: none; }
}

@media (max-width: 760px) {
  .brand-tag, .doc-name, #dofChip, #statusChip { display: none; }
  #titlebar { gap: 6px; }
  .cmd-hint, #cmdHint { display: none; }
  #statusbar { overflow-x: auto; scrollbar-width: none; white-space: nowrap; }
  #statusbar .sb-tool, #statusMsg, #sbCursor, #sbSel { display: none; }
  #statusbar .spacer { display: none; }
  .hud-tl { right: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .hud-tr { display: none; }
}


/* v1.5.2 — ribbon spacing, phones (Poco F6 Pro) and tablets (Xiaomi Pad 7) */
.group.grow { flex: 0 0 auto; }                       /* no stretched empty groups */
#resultSetSelect { margin-top: 6px; min-width: 170px; }
@media (min-width: 1500px) {                           /* wide screens: use the room, don't leave a void */
  .group { padding: 4px 14px 3px; }
  .rb { width: 66px; }
  .rb.sm { min-width: 124px; height: 22px; }
  .rb.sm span { font-size: 11px; }
  .group-items { gap: 8px; }
}
/* swipe the ribbon sideways on touch screens instead of clipping it */
@media (pointer: coarse), (max-width: 1000px) {
  .tab-panel.active { overflow-x: auto; overflow-y: hidden; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .tab-panel.active::-webkit-scrollbar { display: none; }
  .group { flex-shrink: 0; }
}
@media (pointer: coarse) {
  .rb.sm { height: 26px; }
  .stack { gap: 2px; }
  input, select, textarea { font-size: 16px; }         /* stops mobile browsers zooming on focus */
  .rb-select, .stack .mini-field input { font-size: 13px; }
}
/* phone portrait: compact chrome so the canvas gets the screen */
@media (max-width: 760px) {
  .ribbon-body { height: 76px; }
  .group-label { display: none; }
  .group { padding: 4px 4px; }
  .rb { width: 52px; }
  #cmdline { display: none; }
}
/* phone landscape (short screens): panels become drawers, slim ribbon, no command line */
@media (max-height: 520px) and (pointer: coarse) {
  #workspace, #workspace.hide-left, #workspace.hide-right, #workspace.hide-left.hide-right { grid-template-columns: 0 minmax(0, 1fr) 0; position: relative; }
  #left-panel, #right-panel { position: absolute; top: 0; bottom: 0; width: min(46vw, 300px); z-index: 20; box-shadow: 0 0 24px rgba(0,0,0,.45); }
  #left-panel { left: 0; } #right-panel { right: 0; }
  #viewport { grid-column: 2; }
  #workspace.hide-left #left-panel, #workspace.hide-right #right-panel { display: none; }
  .panel-toggle { z-index: 30; }
  .ribbon-body { height: 62px; }
  .group-label { display: none; }
  .rb { height: 44px; min-height: 0; }
  .tab { padding-top: 5px; padding-bottom: 5px; }
  #cmdline, .brand-tag, .doc-name, #statusMsg, #sbTool { display: none; }
}

/* phones: stacked small buttons don't fit the short ribbon -> lay them out in a row as icon buttons */
@media (max-width: 760px), (max-height: 520px) and (pointer: coarse) {
  .stack { flex-direction: row; gap: 2px; }
  .rb.sm { width: 40px; min-width: 0; height: 44px; justify-content: center; padding: 0; }
  .rb.sm svg { width: 18px; height: 18px; }
  .rb.sm span { display: none; }
  .stack .mini-field { height: 34px; }
  .hud-tl { display: none; }
}


/* v1.6 — document tabs (AutoCAD-style file tabs under the ribbon) */
.doc-tabs { display: flex; align-items: flex-end; gap: 2px; padding: 4px 8px 0; background: var(--bg); border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; min-height: 31px; user-select: none; }
.doc-tabs::-webkit-scrollbar { display: none; }
.doc-tab { display: flex; align-items: center; gap: 7px; flex: 0 0 auto; max-width: 220px; height: 27px; padding: 0 6px 0 10px; border: 1px solid transparent; border-bottom: 0; border-radius: 7px 7px 0 0; color: var(--muted); font-size: 12px; cursor: pointer; position: relative; top: 1px; }
.doc-tab:hover { background: var(--panel-2); color: var(--text); }
.doc-tab.on { background: var(--panel); border-color: var(--line); color: var(--text); }
.doc-tab.on::before { content: ''; position: absolute; left: 8px; right: 8px; top: -1px; height: 2px; border-radius: 2px; background: var(--accent); }
.doc-tab svg { width: 13px; height: 13px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; opacity: .7; }
.doc-tab span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-tab .dot { display: none; width: 7px; height: 7px; border-radius: 50%; background: var(--warn); flex: none; }
.doc-tab.dirty .dot { display: block; }
.doc-tab.dirty:hover .dot, .doc-tab.dirty.on .dot { display: none; }
.doc-x { width: 20px; height: 20px; border-radius: 5px; display: grid; place-items: center; color: var(--dim); font-size: 15px; line-height: 1; flex: none; opacity: 0; }
.doc-tab:hover .doc-x, .doc-tab.on .doc-x { opacity: 1; }
.doc-x:hover { background: var(--line); color: var(--text); }
.doc-new { flex: none; width: 27px; height: 25px; margin-left: 2px; border-radius: 6px; color: var(--muted); font-size: 17px; line-height: 1; align-self: center; }
.doc-new:hover { background: var(--panel-2); color: var(--text); }
body.anim .doc-tab { transition: background .12s ease-out, color .12s ease-out; }

/* v1.6 — start page examples */
.start-hint { color: var(--dim); font-size: 11px; padding: 0 10px 6px 38px; line-height: 1.4; }
.ex-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.ex-grid .start-card .thumb { height: 84px; }
.ex-grid .start-card .meta span { font-size: 10px; }

/* v1.6 — tablets, phones, web */
@media (pointer: coarse) {
  .doc-tab { height: 34px; font-size: 13px; }
  .doc-x { opacity: 1; width: 26px; height: 26px; }
  .doc-new { width: 36px; height: 32px; }
}
@media (max-width: 1000px) {
  .start { grid-template-columns: minmax(0, 1fr); grid-auto-rows: max-content; overflow: auto; }
  .start > * { min-width: 0; }
  .start-cmds { grid-template-columns: repeat(auto-fill, minmax(min(330px, 100%), 1fr)); }
  .start-side { border-right: 0; border-bottom: 1px solid var(--line); overflow: visible; }
  .start-main { padding: 22px 18px 40px; overflow: visible; }
  .start-foot { margin-top: 12px; }
}
@media (max-width: 760px) {
  .doc-tabs { padding: 3px 4px 0; }
  .doc-tab { max-width: 150px; padding: 0 4px 0 8px; }
  .start-side { padding: 18px 16px; }
  .ex-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .start-cmds { grid-template-columns: 1fr; }
  .start-learn { grid-template-columns: 1fr; }
}
@media (max-height: 520px) and (pointer: coarse) {
  .doc-tab { height: 28px; }
  .doc-tabs { min-height: 0; }
}


/* v1.6 — web device prompt and per-device layout (body.dev-phone / dev-tablet / dev-pc) */
.dev-ask { position: fixed; inset: 0; z-index: 2000; display: grid; place-items: center; padding: 16px; background: rgba(5, 9, 18, .62); backdrop-filter: blur(6px); }
body.anim .dev-ask { animation: fl-fade .18s ease-out both; }
body.anim .dev-ask .dev-card { animation: fl-pop .2s ease-out both; }
.dev-ask.out { opacity: 0; transition: opacity .14s ease-in; }
.dev-card { width: min(640px, 100%); max-height: 100%; overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 26px 26px 22px; text-align: center; box-shadow: 0 24px 60px rgba(0,0,0,.5); }
.dev-logo { width: 48px; height: 48px; }
.dev-card h2 { margin: 10px 0 6px; font-size: 20px; }
.dev-card p { margin: 0 0 18px; color: var(--muted); font-size: 13px; }
.dev-opts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.dev-opts button { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 18px 10px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); color: var(--text); }
.dev-opts button:hover, .dev-opts button:focus-visible { border-color: var(--accent); outline: none; }
.dev-opts button.sug { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.dev-opts svg { width: 40px; height: 40px; fill: none; stroke: var(--accent-2); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.dev-opts b { font-size: 14px; }
.dev-opts span { color: var(--dim); font-size: 11.5px; line-height: 1.4; }
.dev-opts i { position: absolute; top: 8px; right: 8px; font-style: normal; font-size: 10px; color: var(--accent-2); }
body.anim .dev-opts button { transition: border-color .12s ease-out, transform .1s ease-out; }
body.anim .dev-opts button:active { transform: scale(.97); }
@media (max-width: 520px) { .dev-opts { grid-template-columns: 1fr; } .dev-opts button { flex-direction: row; text-align: left; padding: 12px 14px; } .dev-opts button span { flex: 1; } .dev-opts svg { width: 30px; height: 30px; } .dev-opts i { top: 4px; } .dev-card { padding: 20px 16px 16px; } }

/* phone + tablet: touch-sized controls even when the browser reports a mouse */
body.dev-phone .rb, body.dev-tablet .rb { min-height: 34px; }
body.dev-phone .panel-toggle, body.dev-tablet .panel-toggle { width: 26px; height: 44px; font-size: 14px; }
body.dev-phone .tab, body.dev-tablet .tab { padding-top: 8px; padding-bottom: 8px; }
body.dev-phone .tab-panel.active, body.dev-tablet .tab-panel.active { overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
body.dev-phone input, body.dev-phone select, body.dev-tablet input, body.dev-tablet select { font-size: 16px; }
body.dev-phone .doc-tab, body.dev-tablet .doc-tab { height: 34px; font-size: 13px; }
body.dev-phone .doc-x, body.dev-tablet .doc-x { opacity: 1; width: 26px; height: 26px; }
/* phone: canvas first — drawer panels, compact ribbon, no command line or hints */
body.dev-phone #workspace, body.dev-phone #workspace.hide-left, body.dev-phone #workspace.hide-right, body.dev-phone #workspace.hide-left.hide-right { grid-template-columns: 0 minmax(0, 1fr) 0; position: relative; }
body.dev-phone #left-panel, body.dev-phone #right-panel { position: absolute; top: 0; bottom: 0; width: min(82vw, 300px); z-index: 20; box-shadow: 0 0 24px rgba(0,0,0,.45); }
body.dev-phone #left-panel { left: 0; } body.dev-phone #right-panel { right: 0; }
body.dev-phone #viewport { grid-column: 2; }
body.dev-phone #workspace.hide-left #left-panel, body.dev-phone #workspace.hide-right #right-panel { display: none; }
body.dev-phone .panel-toggle { z-index: 30; }
body.dev-phone .group-label, body.dev-phone #cmdline, body.dev-phone .brand-tag, body.dev-phone .doc-name, body.dev-phone #dofChip, body.dev-phone .hud-tr, body.dev-phone #statusMsg, body.dev-phone #sbCursor { display: none; }
body.dev-phone .ribbon-body { height: 76px; }
body.dev-phone .group { padding: 4px; }
/* pc: keyboard-first — command line always on, smaller hit targets */
body.dev-pc #cmdline { display: flex; }

/* v1.6 web — GitHub links (title bar + device prompt) */
.gh-link { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border: 1px solid var(--line); border-radius: 12px; color: var(--muted); font-size: 11.5px; text-decoration: none; }
.gh-link svg { width: 14px; height: 14px; }
.gh-link:hover { color: var(--text); border-color: var(--accent); }
.gh-link[hidden] { display: none; }
body.anim .gh-link { transition: color .12s ease-out, border-color .12s ease-out; }
@media (max-width: 760px) { .gh-link span { display: none; } .gh-link { padding: 0 6px; } }
.dev-gh { display: flex; align-items: center; gap: 12px; margin-top: 16px; padding: 12px 14px; border: 1px dashed var(--line); border-radius: 10px; color: var(--muted); font-size: 12px; text-align: left; text-decoration: none; line-height: 1.45; }
.dev-gh svg { width: 22px; height: 22px; flex: none; color: var(--text); }
.dev-gh b { color: var(--text); }
.dev-gh span { flex: 1; }
.dev-gh em { font-style: normal; color: var(--accent-2); font-size: 15px; }
.dev-gh:hover { border-color: var(--accent); border-style: solid; color: var(--text); }

/* v1.6 — ribbon auto-fit (fitRibbon in app.js): never clip the last group at the window edge */
.tab-panel.fit-1 .group { padding-left: 7px; padding-right: 7px; }
.tab-panel.fit-1 .rb:not(.sm) { width: 54px; }          /* v1.9.1: small buttons keep the width of their label */
.tab-panel.fit-1 .group-items { gap: 2px; }
.tab-panel.fit-2 .rb.sm { width: 26px; min-width: 0; justify-content: center; padding: 0; }
.tab-panel.fit-2 .rb.sm span, .tab-panel.fit-2 .stack .mini-field span { display: none; }
.tab-panel.fit-2 .rb:not(.sm) { width: 50px; }
.tab-panel.fit-scroll { overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; }
.tab-panel.fit-scroll .group { flex-shrink: 0; }

/* groups never squeeze into each other; fitRibbon measures the real width and steps down instead */
#ribbon .tab-panel .group { flex-shrink: 0; }
#ribbon .tab-panel .group.grow { flex: 0 0 auto; }
#ribbon .group-items > *, #ribbon .stack { flex-shrink: 0; }

/* v1.6.1 — phones: keep clear of the notch / status bar / home indicator, and give the title bar room to breathe */
#app { height: 100dvh; padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); box-sizing: border-box; }
@media (max-width: 760px), (max-height: 520px) and (pointer: coarse) {
  #app { padding-top: max(env(safe-area-inset-top), 6px); grid-template-rows: 44px auto auto 1fr auto; }
  #titlebar { padding: 0 12px; }
}
body.dev-phone #app { padding-top: max(env(safe-area-inset-top), 6px); grid-template-rows: 44px auto auto 1fr auto; }
.start { padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
@media (max-width: 760px) { .start-side { padding-top: 26px; } }

/* v1.6.2 update reminder (installed apps) */
.upd-bar { position: fixed; top: 10px; left: 50%; transform: translateX(-50%); z-index: 60; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center;
  max-width: calc(100vw - 24px); padding: 9px 12px 9px 16px; background: var(--panel-2); color: var(--text); border: 1px solid var(--line); border-left: 3px solid var(--accent);
  border-radius: 10px; box-shadow: 0 10px 30px rgba(0, 0, 0, .35); font-size: 12.5px; }
.upd-bar .upd-msg b { color: var(--accent-2); font-weight: 600; }
.upd-bar .btn { padding: 5px 12px; font-size: 12px; white-space: nowrap; }
@media (pointer: coarse) { .upd-bar { top: calc(8px + env(safe-area-inset-top)); } .upd-bar .btn { padding: 8px 14px; } }

/* v1.7 run analysis loading screen */
.run-ov { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; background: rgba(8, 10, 14, .45); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); animation: run-in .16s ease-out; }
.run-ov.out { animation: run-out .18s ease-in forwards; }
.run-card { width: min(320px, calc(100vw - 48px)); padding: 22px 24px 18px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 18px 50px rgba(0, 0, 0, .45); text-align: center; color: var(--text); }
.run-title { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.run-step { font-size: 12.5px; color: var(--muted); min-height: 18px; }
.run-bar { height: 4px; margin: 14px 0 10px; background: var(--line); border-radius: 4px; overflow: hidden; }
.run-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), #ff3b3b); animation: run-fill var(--run-ms, .9s) cubic-bezier(.3, .7, .4, 1) forwards; }
.run-meta { font-size: 11.5px; color: var(--dim); font-family: var(--mono); }
@keyframes run-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes run-out { to { opacity: 0; } }
@keyframes run-fill { to { width: 100%; } }
body.light .run-ov { background: rgba(240, 244, 248, .55); }

/* Android app: MainActivity pads the WebView by the system bars, so the page must not add the same
   safe-area inset again (that was a status-bar-sized gap above the start page and the title bar,
   and the same at the bottom). The web build and the desktop app are unaffected. */
html.android-app body #app, html.android-app .start { padding: 0; }
html.android-app body.dev-phone #app { padding-top: 0; }
html.android-app .upd-bar { top: 8px; }

/* v1.8 touch screens (iPad, phones): there are no hover tooltips, so every ribbon button keeps
   its name and the ribbon scrolls sideways instead (a tester on iPad could not tell what the
   icon-only buttons did). Tablets: icon with the label beside it; phones: label under the icon. */
@media (hover: none) {
  #ribbon .rb.sm span, #ribbon .tab-panel.fit-2 .rb.sm span { display: inline; }
  #ribbon .stack .mini-field span, #ribbon .tab-panel.fit-2 .stack .mini-field span { display: inline; }
  #ribbon .rb.sm { width: auto; min-width: 0; padding: 0 8px; justify-content: flex-start; }
}
@media (hover: none) and (max-width: 760px), (hover: none) and (max-height: 520px) and (pointer: coarse) {
  #ribbon .rb.sm { flex-direction: column; justify-content: center; gap: 2px; min-width: 46px; padding: 0 6px; }
  #ribbon .rb.sm span { display: block; font-size: 9.5px; }
}

/* v1.8.1 load combination factors: the table scrolls inside the dialog instead of spilling out of it
   (NSCP 2015 adds ten or more combination columns). The case names stay pinned on the left. */
.modal.factors-modal { width: min(980px, calc(100vw - 24px)); max-width: calc(100vw - 24px); max-height: calc(100dvh - 24px); display: flex; flex-direction: column; }
.modal.factors-modal .modal-body { min-height: 0; overflow-y: auto; }
#factorsTable { max-width: 100%; overflow-x: auto; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; padding-bottom: 4px; }
#factorsTable table.factors { width: max-content; min-width: 100%; }
#factorsTable table.factors th:first-child, #factorsTable table.factors td:first-child { position: sticky; left: 0; z-index: 1; background: var(--panel); }
#factorsTable table.factors .combo-name { width: auto; min-width: 96px; }
/* v1.8.1 the factors table is a list: combinations down, loads across */
#factorsTable table.factors-list th:not(:first-child) { text-align: center; max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#factorsTable table.factors-list td input[type="number"] { width: 68px; }
#factorsTable table.factors-list tr.fixed-set td:first-child { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .5px; }
#factorsTable table.factors-list tr.fixed-set + tr:not(.fixed-set) td { border-top: 1px solid var(--line); }
@media (max-width: 600px) {
  #factorsTable table.factors-list .combo-name { width: 124px; min-width: 0; }
  #factorsTable table.factors-list td input[type="number"] { width: 50px; }
  #factorsTable table.factors-list td, #factorsTable table.factors-list th { padding-left: 3px; padding-right: 3px; }
}

/* ======================================================================
   v1.8.2 — Liquid Glass (body.glass; Settings > Appearance > Liquid Glass)
   Floating, rounded, translucent surfaces over soft colour glows. Without
   body.glass nothing below applies and the flat look is unchanged. The canvas
   (#viewport) stays opaque: only its frame is rounded, so panning costs the same.
   ====================================================================== */
body.glass {
  --g-fill: rgba(28, 34, 46, .52);
  --g-fill-strong: rgba(26, 32, 44, .80);
  --g-hover: rgba(255, 255, 255, .07);
  --g-border: rgba(255, 255, 255, .10);
  --g-line: rgba(255, 255, 255, .07);
  --g-hi: inset 0 1px 0 rgba(255, 255, 255, .18);
  --g-shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --g-blur: blur(22px) saturate(170%);
  --g-bg:
    radial-gradient(60vmax 50vmax at 0% 0%, color-mix(in srgb, var(--ga) 34%, transparent), transparent 62%),
    radial-gradient(55vmax 45vmax at 100% 0%, color-mix(in srgb, var(--gb) 28%, transparent), transparent 60%),
    radial-gradient(70vmax 40vmax at 50% 110%, color-mix(in srgb, var(--gc) 18%, transparent), transparent 62%),
    #0b0e14;
  background: var(--g-bg);
}
body.glass.light {
  --g-fill: rgba(255, 255, 255, .55);
  --g-fill-strong: rgba(255, 255, 255, .82);
  --g-hover: rgba(255, 255, 255, .55);
  --g-border: rgba(255, 255, 255, .75);
  --g-line: rgba(20, 40, 80, .08);
  --g-hi: inset 0 1px 0 rgba(255, 255, 255, .9);
  --g-shadow: 0 10px 30px rgba(30, 50, 90, .14), 0 0 0 1px rgba(20, 40, 80, .05);
  --g-bg:
    radial-gradient(60vmax 50vmax at 0% 0%, color-mix(in srgb, var(--ga) 38%, transparent), transparent 62%),
    radial-gradient(55vmax 45vmax at 100% 0%, color-mix(in srgb, var(--gb) 34%, transparent), transparent 60%),
    radial-gradient(70vmax 40vmax at 50% 110%, color-mix(in srgb, var(--gc) 28%, transparent), transparent 62%),
    #e9edf4;
}
/* phones, tablets and low-power devices: lighter blur (the costly part); glass-lite: none at all */
@media (max-width: 760px), (pointer: coarse) { body.glass { --g-blur: blur(12px) saturate(140%); } }
body.glass.dev-phone, body.glass.dev-tablet { --g-blur: blur(12px) saturate(140%); }
body.glass.glass-lite { --g-blur: none; --g-fill: rgba(28, 34, 46, .92); }
body.glass.glass-lite.light { --g-fill: rgba(250, 251, 253, .92); }

/* the floating layout */
body.glass #app { padding: 8px; row-gap: 8px; background: transparent; }
html.android-app body.glass #app, html.android-app body.glass.dev-phone #app { padding: 6px; }
@media (max-width: 760px), (max-height: 520px) and (pointer: coarse) { body.glass #app { padding: max(env(safe-area-inset-top), 6px) 6px max(env(safe-area-inset-bottom), 6px); row-gap: 6px; } }
body.glass.dev-phone #app { padding: max(env(safe-area-inset-top), 6px) 6px max(env(safe-area-inset-bottom), 6px); row-gap: 6px; }

body.glass #titlebar, body.glass #ribbon, body.glass .panel, body.glass #footer, body.glass .toast, body.glass .upd-bar,
body.glass .settings-menu, body.glass .cmd-suggest, body.glass .panel-toggle {
  background: var(--g-fill);
  -webkit-backdrop-filter: var(--g-blur); backdrop-filter: var(--g-blur);
  border: 1px solid var(--g-border);
  box-shadow: var(--g-hi), var(--g-shadow);
}
body.glass #titlebar { border-radius: 16px; }
body.glass #ribbon { border-radius: 18px; overflow: hidden; }
body.glass #footer { border-radius: 14px; overflow: hidden; }
body.glass .panel { border-radius: 18px; overflow: hidden; }
body.glass #left-panel, body.glass #right-panel { border: 1px solid var(--g-border); }
body.glass .panel-head { background: transparent; border-bottom-color: var(--g-line); }
body.glass .tabs { border-bottom-color: var(--g-line); }
body.glass .group { border-right-color: var(--g-line); }
body.glass #cmdline { border-bottom-color: var(--g-line); }
body.glass #footer.hide-footer { border: 0; box-shadow: none; background: transparent; }

/* workspace: panels float beside a framed canvas */
body.glass #workspace { column-gap: 8px; }
body.glass #workspace.hide-left #viewport { margin-left: -8px; }
body.glass #workspace.hide-right #viewport { margin-right: -8px; }
body.glass #workspace.hide-left #left-panel, body.glass #workspace.hide-right #right-panel { visibility: hidden; box-shadow: none; }
body.glass #viewport { border-radius: 18px; border: 1px solid var(--g-border); box-shadow: var(--g-shadow); }
body.glass .panel-toggle { border-radius: 10px; }
body.glass #toggleLeft { left: 4px; border: 1px solid var(--g-border); }
body.glass #toggleRight { right: 4px; border: 1px solid var(--g-border); }
@media (max-width: 760px), (max-height: 520px) and (pointer: coarse) {
  body.glass #workspace { column-gap: 0; }
  body.glass #app #workspace #viewport { margin: 0; }
  body.glass #left-panel, body.glass #right-panel { top: 6px; bottom: 6px; background: var(--g-fill-strong); }
  body.glass #left-panel { left: 6px; } body.glass #right-panel { right: 6px; }
}
body.glass.dev-phone #workspace { column-gap: 0; }
body.glass.dev-phone #app #workspace #viewport { margin: 0; }
body.glass.dev-phone #left-panel, body.glass.dev-phone #right-panel { top: 6px; bottom: 6px; background: var(--g-fill-strong); }

/* document tabs: glass pills on the glow */
body.glass .doc-tabs { background: transparent; border-bottom: 0; padding: 0 4px; min-height: 0; }
body.glass .doc-tab { border-radius: 999px; border: 1px solid transparent; top: 0; }
body.glass .doc-tab:hover { background: var(--g-hover); }
body.glass .doc-tab.on { background: var(--g-fill); -webkit-backdrop-filter: var(--g-blur); backdrop-filter: var(--g-blur); border-color: var(--g-border); box-shadow: var(--g-hi), 0 4px 14px rgba(0, 0, 0, .18); }
body.glass .doc-tab.on::before { left: 50%; right: auto; width: 14px; margin-left: -7px; top: auto; bottom: 2px; height: 2px; }
body.glass .doc-new { border-radius: 999px; }
body.glass .doc-new:hover { background: var(--g-hover); }

/* ribbon: glass pills, accent glow on the active tool, glossy Run capsule */
body.glass .rb { border-radius: 12px; }
body.glass .rb:hover { background: var(--g-hover); border-color: var(--g-border); box-shadow: var(--g-hi); }
body.glass .rb.active {
  background: color-mix(in srgb, var(--accent) 20%, transparent);
  border-color: color-mix(in srgb, var(--accent) 50%, transparent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 0 16px color-mix(in srgb, var(--accent) 38%, transparent);
}
body.glass .rb.primary, body.glass.light .rb.primary {
  position: relative; overflow: hidden; border-radius: 16px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 72%, #fff), var(--accent) 52%, color-mix(in srgb, var(--accent) 78%, #000));
  border-color: color-mix(in srgb, var(--accent) 65%, #fff);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5), 0 6px 18px color-mix(in srgb, var(--accent) 45%, transparent);
}
body.glass .rb.primary::before { content: ""; position: absolute; left: 3px; right: 3px; top: 2px; height: 45%; border-radius: 13px 13px 10px 10px; background: linear-gradient(180deg, rgba(255, 255, 255, .45), rgba(255, 255, 255, 0)); pointer-events: none; }
body.glass .rb.primary:hover { filter: brightness(1.08); }
body.glass .sb-btn, body.glass .chip { border-radius: 999px; }
body.glass .btn { border-radius: 10px; }
body.glass .btn:not(.primary) { background: var(--g-hover); border-color: var(--g-border); box-shadow: var(--g-hi); }
body.glass .btn.primary { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), 0 4px 12px color-mix(in srgb, var(--accent) 35%, transparent); }

/* dialogs, menus, toasts */
body.glass .modal-backdrop { background: rgba(5, 8, 12, .38); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
body.glass.light .modal-backdrop { background: rgba(200, 210, 225, .35); }
body.glass .modal, body.glass .dev-card, body.glass .run-card {
  background: var(--g-fill-strong);
  -webkit-backdrop-filter: var(--g-blur); backdrop-filter: var(--g-blur);
  border: 1px solid var(--g-border);
  border-radius: 22px;
  box-shadow: var(--g-hi), 0 24px 60px rgba(0, 0, 0, .45);
}
body.glass.light .modal, body.glass.light .dev-card, body.glass.light .run-card { box-shadow: var(--g-hi), 0 24px 60px rgba(30, 50, 90, .22); }
body.glass .modal-head { border-bottom-color: var(--g-line); }
body.glass .settings-menu, body.glass .cmd-suggest { border-radius: 16px; background: var(--g-fill-strong); }
body.glass .toast { border-radius: 14px; border-left: 3px solid var(--accent); background: var(--g-fill-strong); }
body.glass .toast.warn { border-left-color: var(--warn); }
body.glass .toast.error { border-left-color: var(--danger); }
body.glass .toast.ok { border-left-color: var(--ok); }
body.glass .upd-bar { border-radius: 16px; border-left: 3px solid var(--accent); background: var(--g-fill-strong); }

/* start page sits on the same glow */
body.glass .start { background: var(--g-bg); }
body.glass .start-side { background: var(--g-fill); -webkit-backdrop-filter: var(--g-blur); backdrop-filter: var(--g-blur); border-right-color: var(--g-border); }
body.glass .start-card { border-radius: 14px; background: var(--g-fill); border-color: var(--g-border); box-shadow: var(--g-hi); }

/* ======================================================================
   v1.8.2 — motion. All of it only with body.anim (Settings > Animations);
   the reduced-motion rules above switch it off too.
   ====================================================================== */
/* ribbon tab indicator (moveTabIndicator in app.js) slides between tabs */
.tabs { position: relative; }
.tabs .tab { position: relative; z-index: 1; }
.tabs .tab-ind { position: absolute; left: 0; top: 0; z-index: 0; pointer-events: none; display: block;
  background: linear-gradient(var(--accent), var(--accent)) center bottom / calc(100% - 8px) 2px no-repeat; }
.tabs:has(.tab-ind) .tab.active { border-bottom-color: transparent; }
body.glass .tabs .tab-ind { background: color-mix(in srgb, var(--accent) 16%, var(--g-hover)); border: 1px solid var(--g-border); border-radius: 999px; box-shadow: var(--g-hi), 0 0 12px color-mix(in srgb, var(--accent) 22%, transparent); transform-origin: left; }
body.glass .tabs .tab { border-bottom-color: transparent; }
body.glass .tabs { padding-top: 4px; padding-bottom: 4px; }
body.anim .tabs .tab-ind { transition: transform .34s cubic-bezier(.34, 1.36, .64, 1), width .34s cubic-bezier(.34, 1.36, .64, 1), height .2s; }

/* ribbon panel fades and slides in */
body.anim .tab-panel.active { animation: fl-panel .24s cubic-bezier(.16, 1, .3, 1); }
@keyframes fl-panel { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }

/* buttons spring when pressed */
body.anim .rb, body.anim .btn, body.anim .tab, body.anim .sb-btn, body.anim .doc-tab, body.anim .start-card {
  transition: background-color .14s ease-out, color .14s ease-out, border-color .14s, box-shadow .2s, transform .38s cubic-bezier(.34, 1.56, .64, 1);
}
body.anim .rb:active, body.anim .btn:active, body.anim .tab:active, body.anim .sb-btn:active, body.anim .doc-tab:active, body.anim .start-card:active { transform: scale(.94); transition-duration: .14s, .14s, .14s, .2s, .07s; }

/* dialogs and menus: spring open, fade closed (.closing: see the observer in app.js) */
body.anim .modal-backdrop.open { animation: fl-fade .18s ease-out; }
body.anim .modal-backdrop.open .modal { animation: fl-spring .38s cubic-bezier(.34, 1.4, .64, 1); }
.modal-backdrop.closing { display: flex !important; pointer-events: none; animation: fl-fade-out .15s ease-in forwards; }
.modal-backdrop.closing .modal { animation: fl-shrink .15s ease-in forwards; }
body.anim .settings-menu:not([hidden]), body.anim .cmd-suggest:not([hidden]) { animation: fl-spring .3s cubic-bezier(.34, 1.4, .64, 1); }
body.anim .dev-ask .dev-card { animation: fl-spring .38s cubic-bezier(.34, 1.4, .64, 1) both; }
@keyframes fl-spring { from { opacity: 0; transform: translateY(8px) scale(.92); } 60% { opacity: 1; } to { opacity: 1; transform: none; } }
@keyframes fl-fade-out { from { opacity: 1; } to { opacity: 0; } }
@keyframes fl-shrink { to { transform: scale(.97); } }

/* toasts slide in from the side with a little spring */
body.anim .toast { animation: toast-spring .36s cubic-bezier(.34, 1.4, .64, 1); }
body.anim .toast.out { animation: toast-out .14s ease-in forwards; }
@keyframes toast-spring { from { opacity: 0; transform: translateX(24px) scale(.96); } to { opacity: 1; transform: none; } }

/* side panels: smoother width change; drawers on phones slide in */
body.anim #workspace { transition: grid-template-columns .3s cubic-bezier(.22, 1, .36, 1); }
@keyframes drawer-l { from { transform: translateX(-24px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes drawer-r { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (max-width: 760px), (max-height: 520px) and (pointer: coarse) {
  body.anim #workspace:not(.hide-left) #left-panel { animation: drawer-l .26s cubic-bezier(.22, 1, .36, 1); }
  body.anim #workspace:not(.hide-right) #right-panel { animation: drawer-r .26s cubic-bezier(.22, 1, .36, 1); }
}

/* result overlays crossfade (crossfadeCanvas in app.js) */
.canvas-xfade { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1; animation: fl-fade-out .22s ease-out forwards; }

/* ======================================================================
   v1.8.2 — Run screen built from the Framelysis mark (RUN_LOGO in app.js)
   ====================================================================== */
.run-logo-wrap { position: relative; width: 104px; height: 104px; margin: 2px auto 14px; display: grid; place-items: center; }
@property --rl-a { syntax: '<angle>'; inherits: false; initial-value: 0deg; }
.run-halo { position: absolute; inset: 5px; border-radius: 24px; padding: 2px;
  background: conic-gradient(from var(--rl-a), transparent 0 55%, color-mix(in srgb, var(--accent) 85%, #fff) 80%, transparent 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude;
  animation: run-spin 1.1s linear infinite; opacity: .9; }
.run-logo { width: 92px; height: 92px; overflow: visible; filter: drop-shadow(0 8px 20px rgba(0, 0, 0, .35)); }
.run-logo .rl-s1 { stop-color: #1d2f55; } .run-logo .rl-s2 { stop-color: #0b1427; }
.run-logo .rl-tile { stroke: color-mix(in srgb, var(--accent) 45%, transparent); stroke-width: .8; }
.run-logo .rl-wedge { fill: color-mix(in srgb, var(--accent) 38%, transparent); }
.run-logo .rl-defl { fill: none; stroke: color-mix(in srgb, var(--accent) 70%, #fff); stroke-width: 1.3; stroke-dasharray: 2 1.7; stroke-linecap: round; }
.run-logo .rl-load path { fill: none; stroke: #b9d8ff; stroke-width: 1.15; stroke-linecap: round; stroke-linejoin: round; }
.run-logo .rl-frame { fill: none; stroke: #f2f7ff; stroke-width: 5.6; stroke-linecap: round; stroke-linejoin: round; }
.run-logo .rl-base { stroke: #f2f7ff; stroke-width: 3.2; stroke-linecap: round; }
.run-logo .rl-hatch { stroke: #f2f7ff; stroke-opacity: .7; stroke-width: 1.8; stroke-linecap: round; }
.run-logo .rl-react { fill: none; stroke: #ffd08a; stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round; }
.run-logo .rl-node { fill: #fff; }
.run-logo .rl-sheen { fill: rgba(255, 255, 255, .14); }
body.light .run-logo { filter: drop-shadow(0 8px 18px rgba(30, 60, 120, .18)); }
body.light .run-logo .rl-s1 { stop-color: #ffffff; } body.light .run-logo .rl-s2 { stop-color: #e4edf9; }
body.light .run-logo .rl-tile { stroke: color-mix(in srgb, var(--accent) 30%, transparent); }
body.light .run-logo .rl-wedge { fill: color-mix(in srgb, var(--accent) 18%, transparent); }
body.light .run-logo .rl-defl { stroke: color-mix(in srgb, var(--accent) 70%, transparent); }
body.light .run-logo .rl-load path { stroke: color-mix(in srgb, var(--accent) 75%, transparent); }
body.light .run-logo .rl-frame, body.light .run-logo .rl-base { stroke: var(--accent); }
body.light .run-logo .rl-hatch { stroke: var(--accent); }
body.light .run-logo .rl-react { stroke: #c26a00; }
body.light .run-logo .rl-node { fill: var(--accent); }
body.light .run-logo .rl-sheen { fill: rgba(255, 255, 255, .7); }
/* the sequence: tile pops, frame draws, load drops, wedges grow, arms deflect, reactions answer */
.run-ov .run-logo { animation: rl-pop .42s cubic-bezier(.34, 1.56, .64, 1) both; }
.run-ov .rl-frame { stroke-dasharray: 100; stroke-dashoffset: 100; animation: rl-draw .42s .08s cubic-bezier(.65, 0, .35, 1) forwards; }
.run-ov .rl-base, .run-ov .rl-hatch { animation: rl-in .2s .04s both; }
.run-ov .rl-udl { transform-box: fill-box; transform-origin: left; animation: rl-grow .2s .42s ease-out both; }
.run-ov .rl-arr { animation: rl-drop .22s calc(.48s + var(--i) * .05s) cubic-bezier(.34, 1.56, .64, 1) both; }
.run-ov .rl-wedge { transform-box: fill-box; transform-origin: left top; animation: rl-wedge .28s .62s ease-out both; }
.run-ov .rl-defl { animation: rl-in .2s .66s both, rl-flow .6s .66s linear infinite; }
.run-ov .rl-react { animation: rl-in .18s .74s both, rl-pulse .5s .74s ease-in-out infinite alternate; }
.run-ov .rl-node { transform-box: fill-box; transform-origin: center; animation: rl-pop .3s .46s cubic-bezier(.34, 1.56, .64, 1) both; }
.run-ov .rl-sheen { animation: rl-sheen 1.1s .15s ease-in-out infinite; }
@keyframes rl-pop { from { opacity: 0; transform: scale(.6); } to { opacity: 1; transform: none; } }
@keyframes rl-draw { to { stroke-dashoffset: 0; } }
@keyframes rl-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes rl-grow { from { transform: scaleX(0); } to { transform: none; } }
@keyframes rl-drop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
@keyframes rl-wedge { from { opacity: 0; transform: scale(.2, .2); } to { opacity: 1; transform: none; } }
@keyframes rl-flow { to { stroke-dashoffset: -7.4; } }
@keyframes rl-pulse { from { stroke-opacity: .55; } to { stroke-opacity: 1; } }
@keyframes rl-sheen { from { transform: rotate(20deg) translateX(0); } to { transform: rotate(20deg) translateX(120px); } }
@keyframes run-spin { to { --rl-a: 360deg; } }
.run-ov .run-card { animation: fl-spring .38s cubic-bezier(.34, 1.4, .64, 1); }
body.glass .run-ov { background: rgba(8, 10, 14, .28); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
body.glass.light .run-ov { background: rgba(230, 236, 245, .35); }

/* ======================================================================
   v1.9.0 — boot and start-up intro
   html.booting (set in <head>) hides the app until bootDone() in app.js, so the half-built
   shell never flashes. html.intro shows #intro on top: the mark is drawn in blueprint lines
   (column up, arms out, load drops, wedges, deflection, reactions), then the blue tile
   materialises behind it and the lines turn white: the real logo. ~1.5 s, tap to skip.
   ====================================================================== */
html.booting #app, html.booting .start, html.booting .dev-ask, html.booting #toasts { visibility: hidden; }
html.booting body { background: #0b0e14; }
html.booting.boot-light body { background: #e9edf4; }
#intro { display: none; }
html.intro #intro {
  display: grid; place-items: center; position: fixed; inset: 0; z-index: 3000; cursor: pointer;
  background:
    radial-gradient(60vmax 50vmax at 0% 0%, color-mix(in srgb, var(--ga) 30%, transparent), transparent 62%),
    radial-gradient(55vmax 45vmax at 100% 0%, color-mix(in srgb, var(--gb) 24%, transparent), transparent 60%),
    radial-gradient(70vmax 40vmax at 50% 110%, color-mix(in srgb, var(--gc) 16%, transparent), transparent 62%),
    #0b0e14;
  --il-line: #6fb2ff; --il-text: #e8eef7; --il-sub: #8a94a3;
}
html.intro.boot-light #intro {
  background:
    radial-gradient(60vmax 50vmax at 0% 0%, color-mix(in srgb, var(--ga) 34%, transparent), transparent 62%),
    radial-gradient(55vmax 45vmax at 100% 0%, color-mix(in srgb, var(--gb) 30%, transparent), transparent 60%),
    radial-gradient(70vmax 40vmax at 50% 110%, color-mix(in srgb, var(--gc) 24%, transparent), transparent 62%),
    #e9edf4;
  --il-line: #1f74d1; --il-text: #1f2a3a; --il-sub: #4a5668;
}
html.intro.boot-flat #intro { background: #0f1216; }
html.intro.boot-flat.boot-light #intro { background: #e6eaf0; }
#intro.out { opacity: 0; transform: scale(1.04); transition: opacity .36s ease-in, transform .36s ease-in; pointer-events: none; }
.intro-stage { display: flex; flex-direction: column; align-items: center; gap: 18px; }
.intro-logo { width: min(150px, 34vw); height: auto; overflow: visible; }
.intro-logo path, .intro-logo g { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.il-tile { opacity: 0; transform-box: fill-box; transform-origin: center; animation: il-tile .42s .86s cubic-bezier(.34, 1.4, .64, 1) forwards; filter: drop-shadow(0 14px 30px rgba(26, 79, 192, .45)); }
.il-grid path { stroke: var(--il-line); stroke-width: .25; stroke-dasharray: 1 1.4; opacity: 0; animation: il-grid 1.1s .02s ease-out forwards; }
.il-base { stroke-width: 3.2; stroke-dasharray: 100; stroke-dashoffset: 100; animation: il-draw .22s .08s ease-out forwards, il-white .3s .95s forwards; stroke: var(--il-line); }
.il-hatch { stroke-width: 1.8; opacity: 0; animation: il-in .2s .26s forwards, il-white .3s .95s forwards; stroke: var(--il-line); }
.il-col { stroke-width: 5.6; stroke-dasharray: 100; stroke-dashoffset: 100; animation: il-draw .46s .26s cubic-bezier(.65, 0, .35, 1) forwards, il-white .3s .95s forwards; stroke: var(--il-line); }
.il-arm { stroke-width: 5.6; stroke-dasharray: 100; stroke-dashoffset: 100; animation: il-draw .22s .58s ease-out forwards, il-white .3s .95s forwards; stroke: var(--il-line); }
.il-udl { stroke-width: 1.15; transform-box: fill-box; transform-origin: left; transform: scaleX(0); animation: il-grow .2s .66s ease-out forwards, il-white .3s .95s forwards; stroke: var(--il-line); }
.il-arr { stroke-width: 1.15; opacity: 0; animation: il-drop .22s calc(.72s + var(--i) * .05s) cubic-bezier(.34, 1.56, .64, 1) forwards, il-white .3s .95s forwards; stroke: var(--il-line); }
.il-wedge { fill: rgba(10, 31, 85, .38) !important; stroke: none !important; opacity: 0; transform-box: fill-box; transform-origin: left top; animation: il-wedge .3s .9s ease-out forwards; }
.il-defl { stroke: #fff; stroke-opacity: .55; stroke-width: 1.3; stroke-dasharray: 2 1.7; opacity: 0; animation: il-in .25s 1.02s forwards; }
.il-react { stroke: #ffd08a; stroke-opacity: .9; stroke-width: 1.3; opacity: 0; animation: il-in .2s 1.08s forwards; }
.il-node { fill: var(--il-line); transform-box: fill-box; transform-origin: center; transform: scale(0); animation: il-pop .3s .6s cubic-bezier(.34, 1.56, .64, 1) forwards, il-white-fill .3s .95s forwards; }
.il-sheen { fill: rgba(255, 255, 255, .22); stroke: none; opacity: 0; animation: il-sheen .7s 1.12s ease-in-out forwards; }
.intro-word { text-align: center; opacity: 0; transform: translateY(8px); animation: il-word .4s 1.05s cubic-bezier(.16, 1, .3, 1) forwards; }
.intro-word b { display: block; font-size: 26px; font-weight: 700; letter-spacing: .3px; color: var(--il-text); }
.intro-word span { display: block; margin-top: 3px; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--il-sub); }
@keyframes il-draw { to { stroke-dashoffset: 0; } }
@keyframes il-in { to { opacity: 1; } }
@keyframes il-grow { to { transform: none; } }
@keyframes il-drop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
@keyframes il-wedge { from { opacity: 0; transform: scale(.2); } to { opacity: 1; transform: none; } }
@keyframes il-pop { to { transform: none; } }
@keyframes il-tile { from { opacity: 0; transform: scale(.82); } to { opacity: 1; transform: none; } }
@keyframes il-grid { 0% { opacity: 0; } 30% { opacity: .55; } 80% { opacity: .4; } 100% { opacity: 0; } }
@keyframes il-white { to { stroke: #fff; } }
@keyframes il-white-fill { to { fill: #fff; } }
@keyframes il-sheen { 0% { opacity: 1; transform: rotate(20deg) translateX(0); } 100% { opacity: 1; transform: rotate(20deg) translateX(120px); } }
@keyframes il-word { to { opacity: 1; transform: none; } }

/* ======================================================================
   v1.9.0 — polish
   ====================================================================== */
/* no blue tap box on Android / iOS, no text-selection box on a long press, focus ring for keyboards only */
* { -webkit-tap-highlight-color: transparent; }
button, .rb, .tab, .doc-tab, .sb-btn, .chip, .tree-item, .start-card, .start-link, .start-big, label { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
button:focus:not(:focus-visible), [role="button"]:focus:not(:focus-visible), select:focus:not(:focus-visible) { outline: none; }
button:focus-visible, [role="button"]:focus-visible { outline: 2px solid color-mix(in srgb, var(--accent) 70%, transparent); outline-offset: 2px; }
/* scrollbars of the sideways-scrolling strips stay hidden on every WebView (scrollbar-width needs Chrome 121+) */
.tabs::-webkit-scrollbar, #statusbar::-webkit-scrollbar, .tab-panel::-webkit-scrollbar, .doc-tabs::-webkit-scrollbar { display: none; width: 0; height: 0; }
.tabs, #statusbar { scrollbar-width: none; }
/* phones: the stacked small buttons (Snap, Ortho, …) are as tall as the big ones, so the row lines up */
@media (max-width: 760px) { #ribbon .rb.sm { height: 48px; } #ribbon .group-items { align-items: center; } }
body.dev-phone #ribbon .rb.sm { height: 48px; }
body.dev-phone #ribbon .group-items { align-items: center; }
/* phones: the status bar fits instead of scrolling (it was scrolled sideways, cutting "PREC") */
@media (max-width: 760px) { #statusbar { gap: 8px; justify-content: space-between; padding: 0 10px; } }
body.dev-phone #statusbar { gap: 8px; justify-content: space-between; }
/* v1.9.0 pen button test pad (Settings > Pen & touch) */
.pen-test { width: 230px; min-height: 76px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; text-align: center;
  border: 1.5px dashed color-mix(in srgb, var(--accent) 55%, transparent); border-radius: 14px; background: var(--accent-dim); padding: 10px; touch-action: none; cursor: crosshair; }
.pen-test b { font-size: 12px; color: var(--text); }
.pen-test span { font-size: 11.5px; color: var(--accent-2); font-family: var(--mono); }
.pen-test.hit { border-style: solid; }
body.anim .pen-test.hit { animation: pen-hit .4s cubic-bezier(.34, 1.56, .64, 1); }
@keyframes pen-hit { from { transform: scale(.94); } to { transform: none; } }
@media (max-width: 600px) { .pen-test { width: 100%; } }
.start-pen b b, .start-pen span b { display: inline; color: var(--accent-2); font-weight: 600; }
#setBody .set-ctl select { min-width: 190px; }
/* v1.9.0 tappable structure-type chip + Frame/Truss question */
button.chip.type { font: inherit; font-size: 10.5px; font-weight: 700; letter-spacing: .08em; cursor: pointer; }
button.chip.type:hover { filter: brightness(1.15); }
.mode-ask .modal-head h3 { margin: 0; font-size: 15px; }
.mode-ask-msg { color: var(--text) !important; font-size: 13px !important; line-height: 1.55; margin: 0 0 16px !important; }
.mode-ask-msg b { color: var(--accent-2); }
.mode-ask-btns { display: flex; gap: 10px; flex-wrap: wrap; }
.mode-ask-btns .btn { flex: 1; min-width: 160px; padding: 10px 14px; }
.mode-ask-ack { display: flex; align-items: center; gap: 8px; margin-top: 14px; font-size: 12px; color: var(--muted); cursor: pointer; }

/* ======================================================================
   v1.9.0 — Structure Wizard redesign
   ====================================================================== */
#wizModal .modal { width: min(760px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); display: flex; flex-direction: column; }
#wizModal .modal-body.wiz { overflow-y: auto; min-height: 0; display: flex; flex-direction: column; }
#wizBody { flex: 1; min-height: 0; overflow-x: hidden; }
.wiz-stepper { display: flex; align-items: center; margin: 2px 0 16px; }
.wiz-dot { display: flex; flex-direction: column; align-items: center; gap: 4px; flex: none; color: var(--dim); font-size: 11px; cursor: default; background: none; border: 0; }
.wiz-dot b { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; border: 1.5px solid var(--line); color: var(--muted); background: var(--panel-2); }
.wiz-dot.cur { color: var(--accent-2); }
.wiz-dot.cur b { border-color: var(--accent); background: var(--accent); color: #fff; box-shadow: 0 0 0 4px var(--accent-dim); }
.wiz-dot.done { color: var(--text); cursor: pointer; }
.wiz-dot.done b { border-color: var(--accent); color: var(--accent-2); background: var(--accent-dim); }
.wiz-bar { flex: 1; height: 2px; margin: 0 6px 18px; background: var(--line); border-radius: 2px; position: relative; overflow: hidden; }
.wiz-bar.done::after { content: ""; position: absolute; inset: 0; background: var(--accent); }
body.anim .wiz-bar.done::after { animation: wiz-fill .35s ease-out both; transform-origin: left; }
@keyframes wiz-fill { from { transform: scaleX(0); } to { transform: none; } }
.wiz-lead { color: var(--text); font-size: 13px; margin: 0 0 10px; }
.wiz-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.wiz-card { display: flex; flex-direction: column; align-items: center; gap: 4px; border: 1px solid var(--line); border-radius: 14px; padding: 12px 10px; text-align: center; color: var(--muted); font-size: 11.5px; background: var(--panel-2); cursor: pointer; }
.wiz-card b { color: var(--text); font-size: 13px; font-weight: 600; }
.wiz-card small { color: var(--dim); font-size: 11px; line-height: 1.35; }
.wiz-card svg { width: 100%; height: 76px; stroke: var(--text); fill: none; stroke-width: 1.3; }
.wiz-card:hover { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); }
.wiz-card.on { border-color: var(--accent); background: var(--accent-dim); box-shadow: 0 0 0 3px var(--accent-dim), 0 0 18px color-mix(in srgb, var(--accent) 22%, transparent); }
.wiz-card.on b { color: var(--accent-2); }
.wiz-card.on svg { stroke: var(--accent-2); }
.wiz-cards.sec { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.wiz-cards.sec .wiz-card { padding: 8px 6px; }
.wiz-cards.sec .wiz-card b { font-size: 11px; font-weight: 500; }
.wiz-cards.sec svg { height: 42px; fill: #c27a63; stroke: none; }
.wiz-two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.wiz-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; margin: 8px 0 12px; }
.wiz-row.one { grid-template-columns: 1fr; max-width: 320px; }
.wiz-num { display: flex; flex-direction: column; align-items: stretch; gap: 5px; color: var(--muted); font-size: 11.5px; }
.wiz-step { display: flex; align-items: stretch; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--panel-2); }
.wiz-step button { width: 36px; flex: none; font-size: 17px; color: var(--accent-2); background: transparent; }
.wiz-step button:active { background: var(--accent-dim); }
.wiz-step input { flex: 1; min-width: 0; width: auto !important; text-align: center; border: 0 !important; border-left: 1px solid var(--line) !important; border-right: 1px solid var(--line) !important; border-radius: 0 !important; background: transparent; padding: 7px 4px; font-size: 13.5px; }
.wiz-unit { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); padding-right: 10px; }
.wiz-unit:focus-within, .wiz-step:focus-within { border-color: var(--accent); }
.wiz-unit input { flex: 1; min-width: 0; width: auto !important; border: 0 !important; background: transparent; padding: 7px 10px; font-size: 13.5px; }
.wiz-unit em { font-style: normal; color: var(--dim); font-size: 11px; }
.wiz-list { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 10px; }
.wiz-list label { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.wiz-list small { font-size: 9.5px; color: var(--dim); }
.wiz-list input { width: 62px; text-align: center; }
.wiz-sub { font-size: 10px; text-transform: uppercase; letter-spacing: .8px; color: var(--dim); margin-top: 6px; }
.wiz-prev-wrap { position: sticky; top: 0; }
.wiz-prev { display: block; width: 100%; height: auto; margin: 4px 0 0; background: var(--canvas); border: 1px solid var(--line); border-radius: 14px; }
.wiz-prev .wp-mem { fill: none; stroke: var(--accent-2); stroke-width: 2.2; stroke-linecap: round; }
.wiz-prev .wp-sup { stroke: var(--accent); stroke-width: 2.4; stroke-linecap: round; fill: none; }
.wiz-prev .wp-hatch { stroke: var(--accent); stroke-width: 1; fill: none; opacity: .7; }
.wiz-prev .wp-dim { fill: var(--muted); font-size: 10.5px; font-family: var(--mono); }
body.anim .wiz-page.fwd { animation: wiz-in-r .3s cubic-bezier(.16, 1, .3, 1); }
body.anim .wiz-page.back { animation: wiz-in-l .3s cubic-bezier(.16, 1, .3, 1); }
@keyframes wiz-in-r { from { opacity: 0; transform: translateX(28px); } to { opacity: 1; transform: none; } }
@keyframes wiz-in-l { from { opacity: 0; transform: translateX(-28px); } to { opacity: 1; transform: none; } }
body.anim .wiz-card { transition: border-color .15s, background-color .15s, box-shadow .2s, transform .3s cubic-bezier(.34, 1.56, .64, 1); }
body.anim .wiz-card:active { transform: scale(.96); }
#wizModal .modal-actions { position: sticky; bottom: 0; margin-top: 14px; padding-top: 10px; background: inherit; }
#wizModal .modal-actions #wizNext { min-width: 120px; }
@media (max-width: 640px) {
  #wizModal .modal-backdrop, #wizModal { align-items: flex-end; }
  #wizModal .modal { width: 100vw; max-width: 100vw; max-height: 94dvh; border-radius: 22px 22px 0 0; margin: 0; }
  .wiz-two { grid-template-columns: 1fr; }
  .wiz-prev-wrap { position: static; order: -1; }
  .wiz-cards { gap: 8px; }
  .wiz-card svg { height: 58px; }
  .wiz-cards.sec { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .wiz-dot span { font-size: 10px; }
  .wiz-step input, .wiz-unit input, .wiz-list input { font-size: 16px; }
  #wizModal .modal-actions { padding-bottom: max(env(safe-area-inset-bottom), 6px); }
}
.wiz-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.wiz-row.one { grid-template-columns: minmax(0, 1fr); }
.wiz-fields, .wiz-row > *, .wiz-num { min-width: 0; }
.wiz-num, .wiz-lead, .wiz-sub { text-align: left; }
.wiz-row label.wiz-num { display: flex; flex-direction: column; align-items: stretch; justify-content: flex-start; }
.wiz-step input, .wiz-unit input { width: 0 !important; flex: 1 1 0; }

/* ======================================================================
   v1.9.0 — Show solution panel (solution.js + Sol in app.js)
   Desktop: floats over the right side of the workspace; phones: a bottom sheet.
   ====================================================================== */
#workspace { position: relative; }
.sol-panel { position: absolute; top: 0; right: 0; bottom: 0; width: min(400px, 46%); z-index: 25; display: flex; flex-direction: column;
  background: var(--panel); border-left: 1px solid var(--line); box-shadow: -12px 0 30px rgba(0, 0, 0, .3); color: var(--text); }
.sol-panel[hidden] { display: none; }
body.glass .sol-panel { background: var(--g-fill-strong); -webkit-backdrop-filter: var(--g-blur); backdrop-filter: var(--g-blur); border: 1px solid var(--g-border); border-radius: 18px; box-shadow: var(--g-hi), var(--g-shadow); }
.sol-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 14px 8px; }
.sol-tt b { display: block; font-size: 15px; }
.sol-tt span { color: var(--muted); font-size: 11.5px; }
.sol-bar { display: flex; align-items: center; gap: 8px; padding: 4px 14px 8px; }
.sol-bar .btn { padding: 7px 12px; }
.sol-bar .btn:disabled { opacity: .4; }
.sol-count { flex: 1; text-align: center; font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.sol-opts { display: flex; gap: 16px; padding: 0 14px 8px; font-size: 11.5px; color: var(--muted); border-bottom: 1px solid var(--line-soft); }
.sol-opts label { display: flex; align-items: center; gap: 7px; cursor: pointer; }
.sol-body { flex: 1; min-height: 0; overflow-y: auto; padding: 10px 14px 18px; -webkit-overflow-scrolling: touch; }
.sol-step { padding: 2px 0 12px; }
.sol-step + .sol-step { border-top: 1px solid var(--line-soft); padding-top: 12px; }
.sol-h { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 13.5px; }
.sol-n { width: 22px; height: 22px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 700; color: #fff; background: var(--accent); }
.sol-step.check .sol-n { background: var(--ok); }
.sol-step.bad .sol-n { background: var(--danger); }
.sol-tag { font-style: normal; font-size: 10px; color: var(--warn); border: 1px solid currentColor; border-radius: 999px; padding: 0 6px; }
.sol-b { font-size: 12.5px; line-height: 1.55; color: var(--text); }
.sol-b p { margin: 0 0 8px; }
.sol-note { color: var(--muted); font-size: 11.5px; margin: 2px 0 8px; }
.sol-eq { font-family: var(--mono); font-size: 12px; background: var(--panel-2); border: 1px solid var(--line-soft); border-radius: 8px; padding: 6px 9px; margin: 4px 0; overflow-x: auto; white-space: nowrap; }
.sol-eq.sol-num { color: var(--muted); background: transparent; border-style: dashed; }
.sol-list { margin: 4px 0 8px; padding-left: 18px; }
.sol-list li { margin: 3px 0; }
.sol-ans { margin-top: 10px; padding: 9px 11px; border-radius: 10px; font-size: 12.5px; line-height: 1.6;
  background: color-mix(in srgb, var(--accent) 14%, transparent); border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); }
.sol-ans b { color: var(--accent-2); }
.sol-reveal { margin-top: 10px; width: 100%; border-style: dashed !important; }
.sol-warn { color: var(--danger); font-size: 11.5px; padding: 4px 14px; }
.sol-ans .sol-warn { padding: 4px 0 0; }
.sol-table { border-collapse: collapse; width: 100%; font-size: 11.5px; margin: 4px 0; }
.sol-table th, .sol-table td { padding: 3px 6px; border-bottom: 1px solid var(--line-soft); text-align: left; }
.sol-table .num { text-align: right; font-family: var(--mono); }
.sol-table .sol-why { color: var(--muted); font-size: 10.5px; }
.sol-table tr.sol-peak td { color: var(--accent-2); }
.sol-t { color: #ff6b6b; } .sol-c { color: #4d9dff; }
body.light .sol-t { color: #d33a3a; } body.light .sol-c { color: #1f74d1; }
body.anim .sol-panel:not([hidden]) { animation: sol-in .3s cubic-bezier(.16, 1, .3, 1); }
body.anim .sol-panel.out { animation: sol-out .18s ease-in forwards; }
body.anim .sol-body.fwd { animation: wiz-in-r .26s cubic-bezier(.16, 1, .3, 1); }
body.anim .sol-body.back { animation: wiz-in-l .26s cubic-bezier(.16, 1, .3, 1); }
@keyframes sol-in { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: none; } }
@keyframes sol-out { to { opacity: 0; transform: translateX(30px); } }
@media (max-width: 760px), (max-height: 520px) and (pointer: coarse) {
  .sol-panel { top: auto; left: 0; right: 0; bottom: 0; width: auto; height: 52%; border-left: 0; border-top: 1px solid var(--line); border-radius: 18px 18px 0 0; box-shadow: 0 -12px 30px rgba(0, 0, 0, .35); }
  body.glass .sol-panel { border-radius: 18px; }
  @keyframes sol-in { from { opacity: 0; transform: translateY(40px); } to { opacity: 1; transform: none; } }
  @keyframes sol-out { to { opacity: 0; transform: translateY(40px); } }
}
@media (max-height: 520px) and (pointer: coarse) { .sol-panel { top: 0; left: auto; width: min(380px, 55%); height: auto; border-radius: 18px; } }
body.dev-phone .sol-panel { top: auto; left: 0; right: 0; bottom: 0; width: auto; height: 52%; }
@media (max-width: 760px), (max-height: 520px) and (pointer: coarse) { body.sol-open .panel-toggle { display: none; } }
body.dev-phone.sol-open .panel-toggle { display: none; }
/* v1.9.0 dimension properties */
.dim-props { display: grid; gap: 6px; padding: 10px 12px; font-size: 12px; }
.dim-props div { display: flex; justify-content: space-between; gap: 10px; }
.dim-props span { color: var(--muted); }
.dim-props b { font-family: var(--mono); font-weight: 600; text-align: right; }
.prop-empty.dim-hint { padding: 4px 12px 8px; text-align: left; }

/* ======================================================================
   v1.9.1 — the background glows follow the accent colour (Settings > Appearance).
   --ga main glow (top left) = the accent; --gb top right and --gc bottom = companion tints
   chosen to suit it. Registered as colours so a change of accent fades smoothly.
   ====================================================================== */
@property --ga { syntax: '<color>'; inherits: true; initial-value: rgb(56, 132, 255); }
@property --gb { syntax: '<color>'; inherits: true; initial-value: rgb(139, 92, 246); }
@property --gc { syntax: '<color>'; inherits: true; initial-value: rgb(245, 158, 11); }
html { --ga: rgb(56, 132, 255); --gb: rgb(139, 92, 246); --gc: rgb(245, 158, 11); }
body.accent-teal, html.boot-accent-teal   { --ga: rgb(45, 212, 191);  --gb: rgb(56, 132, 255);  --gc: rgb(132, 204, 22); }
body.accent-violet, html.boot-accent-violet { --ga: rgb(139, 92, 246); --gb: rgb(236, 72, 153);  --gc: rgb(56, 132, 255); }
body.accent-amber, html.boot-accent-amber { --ga: rgb(245, 158, 11);  --gb: rgb(244, 63, 94);   --gc: rgb(56, 189, 248); }
body.accent-rose, html.boot-accent-rose   { --ga: rgb(244, 63, 94);   --gb: rgb(168, 85, 247);  --gc: rgb(251, 146, 60); }
body.accent-green, html.boot-accent-green { --ga: rgb(34, 197, 94);   --gb: rgb(20, 184, 166);  --gc: rgb(234, 179, 8); }
body.anim.glass { transition: --ga .7s ease, --gb .7s ease, --gc .7s ease; }

/* ======================================================================
   v1.9.1 — Show solution: method picker, matrices and distribution tables
   ====================================================================== */
.sol-methods { display: flex; gap: 6px; padding: 0 14px 8px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.sol-methods::-webkit-scrollbar { display: none; }
.sol-mth { flex: none; display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 6px 11px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); font-size: 12px; white-space: nowrap; text-align: left; }
.sol-mth i { font-style: normal; font-size: 9.5px; letter-spacing: .04em; text-transform: uppercase; }
.sol-mth i.ex { color: var(--ok); }
.sol-mth i.ap { color: var(--warn); }
.sol-mth.on { border-color: var(--accent); background: var(--accent-dim); box-shadow: 0 0 0 2px var(--accent-dim); }
.sol-mth.on { color: var(--accent-2); }
.sol-mth.off { opacity: .45; }
body.glass .sol-mth { border-radius: 999px; padding: 6px 14px; }
body.anim .sol-mth { transition: background-color .15s, border-color .15s, transform .3s cubic-bezier(.34, 1.56, .64, 1); }
body.anim .sol-mth:active { transform: scale(.95); }
.sol-scroll { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 4px 0 8px; }
.sol-mat { border-collapse: collapse; font-family: var(--mono); font-size: 11px; }
.sol-mat th, .sol-mat td { padding: 3px 7px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--line-soft); }
.sol-mat th { color: var(--muted); font-weight: 500; font-family: inherit; }
.sol-mat tr:first-child th { border-bottom: 1px solid var(--line); }
.sol-mat td:first-of-type { border-left: 2px solid var(--line); }
.sol-mat td:last-child { border-right: 2px solid var(--line); }
.sol-md td, .sol-md th { text-align: center; }
.sol-md td:first-of-type, .sol-md td:last-child { border-left: 0; border-right: 0; }
.sol-md tr.sol-df td { color: var(--accent-2); }
.sol-md tr.sol-sum td { font-weight: 700; color: var(--text); border-top: 2px solid var(--line); }
.sol-table td.num, .sol-table th.num { white-space: nowrap; }
details.sol-more { margin: 4px 0 8px; }
details.sol-more summary { cursor: pointer; color: var(--accent-2); font-size: 12px; padding: 4px 0; }
.sol-methods { flex-wrap: wrap; overflow: visible; }
.sol-mth { padding: 5px 10px; font-size: 11.5px; }
body.glass .sol-mth { padding: 5px 12px; }

.sol-mselect { display: none; align-items: center; gap: 8px; padding: 0 14px 8px; font-size: 12px; color: var(--muted); }
.sol-mselect select { flex: 1; min-width: 0; padding: 7px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); font-size: 14px; }
@media (max-width: 760px), (max-height: 520px) and (pointer: coarse) { .sol-methods { display: none; } .sol-mselect { display: flex; } }
body.dev-phone .sol-methods { display: none; }
body.dev-phone .sol-mselect { display: flex; }
/* v1.9.1 — Settings on phones: sections become a sideways tab strip, rows stack (no sideways scrolling) */
@media (max-width: 600px) {
  .set-wrap { flex-direction: column; min-height: 0; }
  .set-nav { width: auto; flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line-soft, var(--line)); padding: 6px 8px; scrollbar-width: none; }
  .set-nav::-webkit-scrollbar { display: none; }
  .set-nav button { flex: none; white-space: nowrap; }
  .set-body { padding: 4px 14px 12px; max-height: 62vh; }
  .set-row { flex-wrap: wrap; gap: 8px 12px; }
  .set-lab { flex: 1 1 160px; min-width: 0; }
  .set-ctl { flex-wrap: wrap; max-width: 100%; min-width: 0; }
  #setBody .set-ctl select { min-width: 0; max-width: 100%; }
  .set-ctl input[type=range] { width: min(150px, 100%); }
}

/* ======================================================================
   v1.9.1 - Downloads page ("the drafting sheet"). Web build: the title-bar Download button
   replaces the GitHub link; the page lists every file with its OS, live GitHub download
   counts and a heart. Everything reads the theme variables, so it follows dark / light and
   the accent colour; Liquid Glass tokens apply when body.glass is on.
   ====================================================================== */
.dl-link { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 11px; border: 1px solid var(--accent); border-radius: 13px; color: var(--accent-2); background: var(--accent-dim); font-size: 11.5px; font-weight: 600; cursor: pointer; }
.dl-link svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.dl-link:hover { filter: brightness(1.18); }
.dl-link[hidden], .dl-link .dl-badge[hidden] { display: none; }
.dl-link .dl-badge { font-weight: 700; font-size: 10.5px; padding: 1px 7px; border-radius: 9px; background: color-mix(in srgb, var(--accent) 30%, transparent); font-variant-numeric: tabular-nums; }
body.anim .dl-link { transition: filter .12s ease-out, transform .08s ease-out; }
body.anim .dl-link:active { transform: scale(.96); }
@media (max-width: 760px) { .dl-link span { display: none; } .dl-link { padding: 0 9px; } }

.dl { position: fixed; inset: 0; z-index: 940; overflow-x: hidden; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; background: var(--bg); color: var(--text);
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
.dl[hidden] { display: none; }
body.anim .dl:not([hidden]) { animation: fl-fade .22s ease-out; }
.dl::before { content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background: radial-gradient(900px 520px at 88% -8%, color-mix(in srgb, var(--ga, var(--accent)) 30%, transparent), transparent 62%),
              radial-gradient(760px 480px at 0% 20%, color-mix(in srgb, var(--gb, var(--accent)) 20%, transparent), transparent 60%); }
.dl-grid { position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image: linear-gradient(color-mix(in srgb, var(--accent) 9%, transparent) 1px, transparent 1px), linear-gradient(90deg, color-mix(in srgb, var(--accent) 9%, transparent) 1px, transparent 1px);
  background-size: 40px 40px; -webkit-mask-image: radial-gradient(ellipse at 50% 0%, #000 28%, transparent 80%); mask-image: radial-gradient(ellipse at 50% 0%, #000 28%, transparent 80%); }
:where(.dl button) { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
.dl :focus-visible { outline: 2px solid var(--accent-2); outline-offset: 3px; border-radius: 10px; }
.dl code { font-family: var(--mono); font-size: .92em; padding: 1px 6px; border-radius: 6px; background: var(--accent-dim); color: var(--accent-2); overflow-wrap: anywhere; }
.dl-wrap { position: relative; z-index: 1; max-width: 1120px; margin: 0 auto; padding: 10px clamp(14px, 3vw, 28px) 44px; }
.dl-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.dl-top { position: sticky; top: 8px; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 8px; border-radius: 18px; border: 1px solid var(--g-line, var(--line));
  background: var(--g-fill-strong, color-mix(in srgb, var(--panel) 90%, transparent)); backdrop-filter: var(--g-blur, blur(14px)); -webkit-backdrop-filter: var(--g-blur, blur(14px)); }
.dl-back { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 16px 0 8px; border-radius: 13px; font-size: 13.5px; font-weight: 600; }
.dl-back svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.dl-back:hover { background: var(--accent-dim); color: var(--accent-2); }

.dl-hero { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, .75fr); gap: clamp(20px, 4vw, 44px); align-items: center; padding: clamp(26px, 6vw, 56px) 0 28px; }
.dl-eyebrow { display: inline-flex; align-items: center; gap: 8px; margin: 0 0 16px; padding: 5px 13px; border-radius: 99px; border: 1px solid var(--g-line, var(--line)); background: var(--g-fill, var(--panel)); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.dl-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
body.anim .dl-dot { animation: dl-pulse 2.2s ease-out infinite; }
@keyframes dl-pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 55%, transparent); } 70%, 100% { box-shadow: 0 0 0 9px transparent; } }
.dl h1:focus, .dl h1:focus-visible { outline: none; }
.dl h1 { margin: 0 0 14px; font-size: clamp(34px, 6.2vw, 64px); line-height: 1.04; letter-spacing: -.02em; font-weight: 800; outline: none; }
.dl-g { background: linear-gradient(100deg, var(--accent-2), var(--accent) 50%, var(--warn)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.dl-lead { margin: 0 0 24px; max-width: 54ch; font-size: clamp(15px, 1.7vw, 18px); line-height: 1.6; color: var(--muted); }
.dl-hero-cta { display: flex; flex-wrap: wrap; gap: 12px; }
.dl-detected { margin: 12px 0 0; font-size: 12.5px; color: var(--muted); }

.dl-btn { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 44px; padding: 0 18px; border-radius: 14px; border: 1px solid #3b82d9; color: #fff !important; font-weight: 700; font-size: 14px; text-decoration: none;
  background: linear-gradient(180deg, #2f7fd6, #1f58a8); box-shadow: 0 8px 22px color-mix(in srgb, var(--accent) 30%, transparent), inset 0 1px 0 rgba(255, 255, 255, .26); }
.dl-btn svg { width: 19px; height: 19px; flex: none; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.dl-btn small { font-weight: 500; font-size: 11.5px; opacity: .92; font-variant-numeric: tabular-nums; }
.dl-btn.big { min-height: 58px; padding: 0 26px; font-size: 16px; border-radius: 17px; }
.dl-btn:hover { filter: brightness(1.1); }
body.anim .dl-btn { transition: filter .14s ease-out, transform .1s ease-out, box-shadow .2s; }
body.anim .dl-btn:hover { transform: translateY(-1px); }
body.anim .dl-btn:active { transform: scale(.98); }
.dl-btn.is-busy { pointer-events: none; filter: brightness(.9); }
body.anim .dl-btn.is-busy svg { animation: dl-bob .8s ease-in-out infinite; }
@keyframes dl-bob { 50% { transform: translateY(3px); } }

.dl-tb { position: relative; border: 1.5px solid color-mix(in srgb, var(--accent) 55%, var(--line)); border-radius: 6px; font-family: var(--mono); background: color-mix(in srgb, var(--panel) 88%, transparent); backdrop-filter: var(--g-blur, none); -webkit-backdrop-filter: var(--g-blur, none);
  outline: 1px dashed color-mix(in srgb, var(--accent) 38%, transparent); outline-offset: 6px; }
.dl-tb-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); }
.dl-tb-c { min-width: 0; padding: 10px 13px; background: color-mix(in srgb, var(--panel) 94%, transparent); }
.dl-tb-c.wide { grid-column: 1 / -1; }
.dl-tb-c small { display: block; font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.dl-tb-c b { display: block; margin-top: 3px; font-size: 15px; font-variant-numeric: tabular-nums; }
.dl-tb-c.big b { font-size: clamp(32px, 4.6vw, 48px); line-height: 1.1; letter-spacing: -.02em; color: var(--accent-2); }

.dl-plates { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 18px; padding: 8px 0 4px; }
.dl-card { display: flex; flex-direction: column; overflow: hidden; border-radius: 22px; border: 1px solid var(--g-line, var(--line)); background: var(--g-fill, var(--panel)); backdrop-filter: var(--g-blur, none); -webkit-backdrop-filter: var(--g-blur, none); box-shadow: 0 14px 34px rgba(0, 0, 0, .22); }
body.anim .dl-card { opacity: 0; transform: translateY(14px); transition: opacity .5s ease-out, transform .5s cubic-bezier(.16, 1, .3, 1), border-color .2s, box-shadow .2s; transition-delay: calc(var(--i, 0) * 45ms); }
body.anim .dl-card.in { opacity: 1; transform: none; }
.dl-card.is-rec { order: -1; border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 16px 42px color-mix(in srgb, var(--accent) 24%, transparent); }
.dl-card-art { display: flex; justify-content: center; padding: 20px 20px 0; color: var(--accent-2); background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 11%, transparent), transparent); }
.dl-art { width: min(100%, 260px); height: auto; overflow: visible; }
.dl-dim path { stroke: var(--muted); stroke-width: 1.2; }
.dl-dimtxt { fill: var(--muted); stroke: none; font: 600 9px var(--mono); }
body.anim .dl-draw path { stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset 1s cubic-bezier(.4, 0, .2, 1); }
body.anim .dl-card.in .dl-draw path { stroke-dashoffset: 0; }
.dl-draw path:nth-child(2), .dl-draw rect:nth-child(2) { transition-delay: .08s; } .dl-draw path:nth-child(3) { transition-delay: .16s; } .dl-draw path:nth-child(4) { transition-delay: .24s; }
.dl-draw path:nth-child(5) { transition-delay: .32s; } .dl-draw path:nth-child(6), .dl-draw circle { transition-delay: .4s; }
.dl-card-body { display: flex; flex: 1; flex-direction: column; gap: 10px; padding: 16px 20px 20px; }
.dl-os { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.dl-os h2 { margin: 0; font-size: 23px; letter-spacing: -.01em; }
.dl-rec-tag { font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 3px 10px; border-radius: 99px; background: var(--accent-dim); color: var(--accent-2); border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); }
.dl-rec-tag[hidden] { display: none; }
.dl-what { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; margin: 0; font-size: 13.5px; }
.dl-file { flex-basis: 100%; font-family: var(--mono); font-size: 11.5px; color: var(--muted); overflow-wrap: anywhere; }
.dl-file:empty { display: none; }
.dl-blurb { margin: 0; font-size: 13.5px; line-height: 1.55; color: var(--muted); }
.dl-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.dl-chips li { font-size: 11.5px; padding: 3px 10px; border-radius: 99px; border: 1px solid var(--line); color: var(--muted); }
.dl-cta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 14px; margin-top: auto; padding-top: 8px; }
.dl-n-wrap { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.dl-n-wrap svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.dl-n { font-size: 16px; color: var(--text); font-variant-numeric: tabular-nums; }
.dl-size:empty { display: none; }
.dl-steps { margin-top: 4px; padding-top: 6px; border-top: 1px solid var(--line-soft, var(--line)); }
.dl-steps summary { display: flex; align-items: center; min-height: 44px; cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--accent-2); list-style: none; }
.dl-steps summary::-webkit-details-marker { display: none; }
.dl-steps summary::before { content: "+"; width: 18px; font-weight: 700; }
.dl-steps[open] summary::before { content: "\2212"; }
.dl-steps ol { margin: 4px 0 2px; padding-left: 20px; font-size: 12.5px; line-height: 1.65; color: var(--muted); }
.dl-steps li { margin: 3px 0; }
.dl-steps b { color: var(--text); }

.dl-status { margin: 12px 0 0; padding: 10px 14px; border-radius: 12px; border: 1px solid color-mix(in srgb, var(--warn) 55%, transparent); background: color-mix(in srgb, var(--warn) 10%, transparent); font-size: 13px; }
.dl-status[hidden] { display: none; }
.dl-status a, .dl-box a, .dl-foot a { color: var(--accent-2); }
.dl-more { display: grid; gap: 12px; padding: 20px 0 22px; }
.dl-box { border-radius: 18px; border: 1px solid var(--g-line, var(--line)); background: var(--g-fill, var(--panel)); }
.dl-box summary { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 0 18px; cursor: pointer; font-size: 14px; font-weight: 600; list-style: none; }
.dl-box summary::-webkit-details-marker { display: none; }
.dl-box summary svg { width: 18px; height: 18px; fill: none; stroke: var(--accent-2); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.dl-box-in { padding: 2px 18px 18px; font-size: 13px; line-height: 1.6; color: var(--muted); }
.dl-box-in p { margin: 0 0 8px; }
.dl-sum { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line-soft, var(--line)); }
.dl-sum > span { flex: 1; min-width: 0; }
.dl-sum b { display: block; font-size: 12.5px; color: var(--text); overflow-wrap: anywhere; }
.dl-sum code, .dl-cert code { display: block; padding: 0; background: none; font-size: 11px; color: var(--muted); }
.dl-copy { flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line); color: var(--muted); }
.dl-copy svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.dl-copy:hover { color: var(--text); border-color: var(--accent); }
.dl-copy.ok { color: var(--ok); border-color: var(--ok); }
.dl-cert { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 12px 0 0 !important; }
.dl-cert b { flex-basis: 100%; color: var(--text); }
.dl-cert code { flex: 1; min-width: 0; }
.dl-old h3 { margin: 12px 0 2px; font-size: 14px; color: var(--text); }
.dl-old h3 small { margin-left: 6px; font-weight: 400; color: var(--muted); }
.dl-old ul { margin: 0; padding: 0; list-style: none; }
.dl-old li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 12px; padding: 6px 0; border-top: 1px solid var(--line-soft, var(--line)); }
.dl-old a { overflow-wrap: anywhere; }
.dl-old li span { color: var(--muted); font-variant-numeric: tabular-nums; }
.dl-muted { color: var(--muted); }

.dl-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; padding: 18px 4px 0; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted); }
.dl-foot p { margin: 0; }
.dl-foot b { color: var(--text); }

.dl-heart { position: relative; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 17px; border-radius: 99px; border: 1px solid var(--g-line, var(--line)); background: var(--g-fill, var(--panel)); font-size: 13px; font-weight: 600; overflow: visible; }
.dl-heart svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
body.anim .dl-heart { transition: border-color .15s, background-color .2s, color .2s; }
.dl-heart:hover { border-color: #f43f5e; }
.dl-heart.is-liked { color: #fb7185; border-color: color-mix(in srgb, #f43f5e 60%, transparent); background: color-mix(in srgb, #f43f5e 13%, var(--panel)); }
.dl-heart.is-liked svg { fill: #f43f5e; stroke: #f43f5e; }
body.light .dl-heart.is-liked { color: #be123c; }
.dl-heart-n { font-weight: 700; font-variant-numeric: tabular-nums; }
.dl-heart-n:empty { display: none; }
.dl-fx { position: absolute; pointer-events: none; }
.dl-ring { width: 26px; height: 26px; border-radius: 50%; border: 2px solid #f43f5e; }
.dl-bit { border-radius: 50%; background: hsl(350 90% 62%); }

@media (min-width: 700px) {      /* the web card is wide: art on the left, text on the right */
  .dl-card[data-kind="ios"] { grid-column: span 2; flex-direction: row; }
  .dl-card[data-kind="ios"] .dl-card-art { flex: 0 0 42%; align-items: center; padding: 20px; }
}
@media (max-width: 860px) { .dl-hero { grid-template-columns: 1fr; padding-top: 24px; } .dl-tb { max-width: 520px; } }
@media (max-width: 520px) {
  .dl-back span { display: none; } .dl-back { padding: 0 10px 0 6px; }
  .dl-hero-cta .dl-btn.big { width: 100%; }
  .dl-card-body { padding: 14px 16px 18px; }
  .dl-tb-c { padding: 8px 12px; } .dl-tb-c.big b { font-size: 34px; }
  .dl-cta .dl-btn { flex: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .dl *, .dl *::before { animation: none !important; transition: none !important; }
  .dl-card { opacity: 1 !important; transform: none !important; }
  .dl-draw path { stroke-dashoffset: 0 !important; }
  .dl { scroll-behavior: auto; }
}

/* v1.9.1 - Downloads page: the background demo video, the transition screen, the scroll cue */
.run-ov.dl-load { z-index: 960; }
.dl-bg { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.dl-bgvid { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .44; background: #0b1020; filter: blur(16px) saturate(1.15); transform: scale(1.08);
  -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 42%, transparent 92%); mask-image: linear-gradient(180deg, #000 0%, #000 42%, transparent 92%); }
body.anim .dl-bgvid { animation: dl-bgin 1.2s ease-out both; }
@keyframes dl-bgin { from { opacity: 0; } to { opacity: .44; } }
.dl-bgvid.is-bad { display: none; }
.dl-scrim { position: absolute; inset: 0; background: linear-gradient(180deg, color-mix(in srgb, var(--bg) 46%, transparent), color-mix(in srgb, var(--bg) 70%, transparent) 55%, var(--bg) 100%); }
body.light .dl-bgvid { opacity: .3; filter: blur(16px) invert(1) hue-rotate(180deg) saturate(.7); }
body.light .dl-scrim { background: linear-gradient(180deg, color-mix(in srgb, var(--bg) 40%, transparent), color-mix(in srgb, var(--bg) 72%, transparent) 55%, var(--bg) 100%); }
.dl-top-r { display: flex; align-items: center; gap: 8px; }
.dl-bgbtn { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 14px 0 10px; border-radius: 99px; border: 1px solid var(--g-line, var(--line)); font-size: 12.5px; font-weight: 600; color: var(--muted); }
.dl-bgbtn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.dl-bgbtn:hover { color: var(--text); border-color: var(--accent); }
body.anim .dl-bgbtn { transition: color .14s, border-color .14s; }
@media (max-width: 520px) { .dl-bgbtn span { display: none; } .dl-bgbtn { padding: 0 11px; } }
.dl-cue { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; padding: 0 6px; font-size: 12.5px; font-weight: 600; color: var(--accent-2); }
.dl-cue svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
body.anim .dl-cue svg { animation: dl-nudge 1.8s ease-in-out infinite; }
@keyframes dl-nudge { 50% { transform: translateY(3px); } }
.dl-detected { display: flex; flex-wrap: wrap; align-items: center; gap: 0 6px; }
@media (prefers-reduced-motion: reduce) { .dl-bgvid { animation: none !important; } }

/* v1.9.1 - download numbers: this platform and all platforms */
.dl-counts { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.dl-counts[hidden] { display: none; }
.dl-stat { padding: 9px 16px; border-radius: 16px; border: 1px solid var(--g-line, var(--line)); background: var(--g-fill, var(--panel)); }
.dl-stat b { display: block; font-size: 24px; line-height: 1.1; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.dl-stat span { display: block; margin-top: 2px; font-size: 12px; color: var(--muted); }
.dl-stat.is-mine { border-color: color-mix(in srgb, var(--accent) 65%, transparent); background: var(--accent-dim); }
.dl-stat.is-mine b { color: var(--accent-2); }
.dl-stats { margin: 4px 0 26px; padding: 20px 22px 12px; border-radius: 22px; border: 1px solid var(--g-line, var(--line)); background: var(--g-fill, var(--panel)); backdrop-filter: var(--g-blur, none); -webkit-backdrop-filter: var(--g-blur, none); }
.dl-stats[hidden] { display: none; }
.dl-stats h2 { margin: 0; font-size: 19px; letter-spacing: -.01em; }
.dl-stats-sub { margin: 3px 0 12px; font-size: 12.5px; color: var(--muted); }
.dl-bars { margin: 0; padding: 0; list-style: none; }
.dl-bar-row { display: grid; grid-template-columns: 170px minmax(0, 1fr) 92px 46px; grid-template-areas: "name track n pct" ". note note note"; align-items: center; gap: 0 16px; padding: 11px 10px; margin: 0 -10px; border-top: 1px solid var(--line-soft, var(--line)); border-radius: 12px; }
.dl-bar-row:first-child { border-top: 0; }
.dl-bar-name { grid-area: name; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-weight: 600; }
.dl-you { font-style: normal; font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 2px 9px; border-radius: 99px; background: var(--accent-dim); color: var(--accent-2); border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); }
.dl-you[hidden] { display: none; }
.dl-bar-track { grid-area: track; height: 10px; border-radius: 6px; background: var(--line); overflow: hidden; }
.dl-bar-track i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transform-origin: left center; transform: scaleX(var(--p, 0)); }
body.anim .dl-bar-track i { transition: transform 1s cubic-bezier(.16, 1, .3, 1) .15s; }
body.anim .dl-stats:not(.in) .dl-bar-track i { transform: scaleX(0); }
.dl-bar-n { grid-area: n; text-align: right; font-size: 18px; font-variant-numeric: tabular-nums; }
.dl-bar-pct { grid-area: pct; text-align: right; color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.dl-bar-note { grid-area: note; margin-top: 3px; font-size: 11.5px; color: var(--muted); }
.dl-bar-note:empty { display: none; }
.dl-bar-row.is-mine { background: linear-gradient(90deg, var(--accent-dim), transparent 80%); border-top-color: transparent; }
.dl-bar-row.total { border-top: 1px solid var(--line); }
.dl-bar-row.total .dl-bar-track i { background: linear-gradient(90deg, var(--warn), var(--accent-2)); }
.dl-bar-row.total .dl-bar-n { color: var(--accent-2); font-size: 21px; }
@media (max-width: 620px) {
  .dl-stats { padding: 16px 16px 8px; }
  .dl-bar-row { grid-template-columns: minmax(0, 1fr) auto 42px; grid-template-areas: "name n pct" "track track track" "note note note"; row-gap: 6px; }
  .dl-stat { flex: 1 1 140px; }
}
@media (prefers-reduced-motion: reduce) { .dl-bar-track i { transition: none !important; transform: scaleX(var(--p, 0)) !important; } }

/* v1.9.1 - the front page: logo + name in the header, "Try the web version" beside the download button */
.dl-top-l { display: flex; align-items: center; gap: 2px; min-width: 0; }
.dl-brand { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 14px 0 8px; border-radius: 14px; color: var(--text); font-size: 17px; font-weight: 800; letter-spacing: .01em; text-decoration: none; }
.dl-brand img { flex: none; width: 30px; height: 30px; border-radius: 8px; }
.dl-brand:hover { background: var(--accent-dim); }
.dl.is-landing .dl-back { display: none; }
.dl-btn.ghost { color: var(--text) !important; background: var(--g-fill, color-mix(in srgb, var(--panel) 88%, transparent)); border-color: color-mix(in srgb, var(--accent) 62%, transparent); box-shadow: none; }
.dl-btn.ghost svg { color: var(--accent-2); }
.dl-btn.ghost:hover { filter: none; background: var(--accent-dim); }
body.light .dl-btn.ghost { background: rgba(255, 255, 255, .7); }
@media (max-width: 520px) { .dl-brand { padding: 0 8px 0 4px; font-size: 16px; } .dl-hero-cta .dl-btn.big.ghost { width: 100%; } }

/* v1.9.1 - the wordmark is built on the logo: the logo tile is the capital F, "ramelysis" carries on in the same heavy,
   round-ended strokes, and the logo's amber support hatch becomes the underline */
.dl-brand { gap: 0; padding: 0 14px 0 6px; }
.dl-brand img { width: 34px; height: 34px; border-radius: 9px; margin-right: 1px; }
.dl-wm { position: relative; font-family: ui-rounded, "SF Pro Rounded", "Nunito", "Segoe UI Variable Display", "Segoe UI", system-ui, sans-serif; font-size: 26px; font-weight: 800; letter-spacing: .012em; line-height: 1; color: var(--text); }
.dl-wm::after { content: ""; position: absolute; left: 1px; right: 0; bottom: -7px; height: 5px; opacity: .9;
  background: linear-gradient(var(--warn), var(--warn)) top / 100% 1.7px no-repeat, repeating-linear-gradient(-58deg, var(--warn) 0 1.5px, transparent 1.5px 5px);
  -webkit-mask-image: linear-gradient(90deg, #000 62%, transparent); mask-image: linear-gradient(90deg, #000 62%, transparent); }
@media (max-width: 520px) { .dl-wm { font-size: 24px; } }


/* v1.9.1 - landing page: sections that magnet-snap, What it is, Framelysis in action, Changelog, phone layout */
.dl { scroll-snap-type: y mandatory; }                  /* touch: native flings snap to the next section */
@media (pointer: fine) { .dl { scroll-snap-type: none; } }   /* the mouse/trackpad magnet is scripted (downloads.js wireMagnet); CSS snapping snaps back on a wheel tick */
.dl-sec { scroll-snap-align: start; box-sizing: border-box; min-height: 100vh; min-height: 100svh; padding: 86px 0 36px; display: flex; flex-direction: column; justify-content: center; }
.dl-top { margin-bottom: -66px; }                      /* the sticky header floats over the sections instead of pushing the first one down */
.dl-hero.dl-sec { display: grid; padding-top: 86px; align-content: center; }
.dl-sec-head { max-width: 760px; margin: 0 0 26px; }
.dl-kicker { margin: 0 0 8px; font-size: 11.5px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--accent-2); }
.dl-sec h2 { margin: 0 0 12px; font-size: clamp(26px, 4.4vw, 44px); line-height: 1.1; letter-spacing: -.02em; font-weight: 800; }
.dl-sec-lead { margin: 0; font-size: clamp(14.5px, 1.6vw, 17px); line-height: 1.6; color: var(--muted); }
.dl-get > .dl-stats, .dl-get > .dl-plates, .dl-get > .dl-more { margin-top: 0; }
.dl-get { justify-content: flex-start; }

.dl-feats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 14px; }
.dl-feat { padding: 20px 20px 22px; border-radius: 20px; border: 1px solid var(--g-line, var(--line)); background: var(--g-fill, var(--panel)); backdrop-filter: var(--g-blur, none); -webkit-backdrop-filter: var(--g-blur, none); }
.dl-feat svg { width: 30px; height: 30px; margin-bottom: 12px; fill: none; stroke: var(--accent-2); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.dl-feat h3 { margin: 0 0 6px; font-size: 17px; }
.dl-feat p { margin: 0; font-size: 13.5px; line-height: 1.6; color: var(--muted); }

.dl-stage { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, .8fr); gap: clamp(16px, 3vw, 32px); align-items: center; }
.dl-player { position: relative; margin: 0; overflow: hidden; border-radius: 18px; border: 1px solid var(--g-line, var(--line)); background: #0b1020; box-shadow: 0 26px 64px rgba(0, 0, 0, .42); }
.dl-player-bar { display: flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; background: color-mix(in srgb, var(--panel) 92%, #000); border-bottom: 1px solid var(--line); font-size: 11.5px; color: var(--muted); }
.dl-player-bar i { width: 9px; height: 9px; border-radius: 50%; background: var(--line); }
.dl-player-bar i:nth-child(1) { background: #f87171; } .dl-player-bar i:nth-child(2) { background: #fbbf24; } .dl-player-bar i:nth-child(3) { background: #4ade80; }
.dl-player-bar span { margin-left: 8px; }
.dl-player video { display: block; width: 100%; aspect-ratio: 1100 / 618; object-fit: cover; background: #0b1020; }
.dl-play { position: absolute; right: 12px; bottom: 12px; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .28); background: rgba(10, 14, 28, .62); color: #fff; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.dl-play svg { width: 20px; height: 20px; fill: currentColor; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.dl-play:hover { background: var(--accent); }
.dl-demo-steps { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; counter-reset: st; }
.dl-demo-steps li { position: relative; padding: 14px 16px 14px 56px; border-radius: 16px; border: 1px solid var(--g-line, var(--line)); background: var(--g-fill, var(--panel)); counter-increment: st; }
.dl-demo-steps li::before { content: counter(st); position: absolute; left: 14px; top: 14px; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--accent-dim); color: var(--accent-2); font-weight: 800; font-size: 13px; }
.dl-demo-steps b { display: block; font-size: 15px; }
.dl-demo-steps span { display: block; margin-top: 2px; font-size: 13px; line-height: 1.5; color: var(--muted); }
body.anim .dl-rev { transition: opacity .5s ease, transform .5s cubic-bezier(.2, .8, .2, 1); }
body.anim .dl-rev:not(.in) { opacity: 0; transform: translateY(16px); }
.dl-feat:nth-child(2) { transition-delay: .05s; } .dl-feat:nth-child(3) { transition-delay: .1s; } .dl-feat:nth-child(4) { transition-delay: .15s; } .dl-feat:nth-child(5) { transition-delay: .2s; } .dl-feat:nth-child(6) { transition-delay: .25s; }

.dl-log { justify-content: flex-start; }
.dl-log-list { display: grid; gap: 10px; max-width: 860px; }
.dl-log-item { border-radius: 16px; border: 1px solid var(--g-line, var(--line)); background: var(--g-fill, var(--panel)); }
.dl-log-item summary { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; min-height: 52px; padding: 8px 18px; cursor: pointer; list-style: none; }
.dl-log-item summary::-webkit-details-marker { display: none; }
.dl-log-item summary::after { content: "+"; margin-left: auto; font-weight: 700; color: var(--accent-2); }
.dl-log-item[open] summary::after { content: "\2212"; }
.dl-log-tag { font-size: 16px; font-weight: 800; }
.dl-log-item time { font-size: 12.5px; color: var(--muted); }
.dl-log-new { padding: 2px 9px; border-radius: 99px; font-size: 10.5px; font-style: normal; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; background: var(--accent-dim); color: var(--accent-2); border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); }
.dl-log-body { padding: 0 18px 16px; font-size: 13.5px; line-height: 1.65; color: var(--muted); }
.dl-log-body h3 { margin: 12px 0 4px; font-size: 14.5px; color: var(--text); }
.dl-log-body h4 { margin: 10px 0 2px; font-size: 13.5px; color: var(--text); }
.dl-log-body p { margin: 4px 0; }
.dl-log-body ul { margin: 4px 0; padding-left: 20px; }
.dl-log-body li { margin: 3px 0; }
.dl-log-body b { color: var(--text); }
.dl-log-link { margin-top: 10px !important; }
.dl-log-link a { color: var(--accent-2); }

.dl-dots { position: fixed; right: 14px; top: 50%; z-index: 6; display: flex; flex-direction: column; gap: 2px; transform: translateY(-50%); }
.dl-dots button { position: relative; display: flex; align-items: center; justify-content: flex-end; gap: 10px; width: 44px; height: 32px; color: var(--muted); }
.dl-dots button i { flex: none; width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid currentColor; background: transparent; }
.dl-dots button.on i { background: var(--accent); border-color: var(--accent); transform: scale(1.25); }
.dl-dots button span { position: absolute; right: 30px; padding: 3px 9px; border-radius: 8px; background: var(--panel); border: 1px solid var(--line); font-size: 11.5px; font-weight: 600; white-space: nowrap; opacity: 0; pointer-events: none; transform: translateX(4px); }
.dl-dots button:hover span, .dl-dots button:focus-visible span { opacity: 1; transform: none; }
.dl-dots button:hover { color: var(--text); }
body.anim .dl-dots button i, body.anim .dl-dots button span { transition: transform .18s, background .18s, opacity .16s; }

@media (max-width: 900px) { .dl-stage { grid-template-columns: 1fr; } .dl-demo-steps { grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); } }
@media (max-width: 760px) {
  .dl-dots { display: none; }
  .dl-sec { padding: 78px 0 28px; justify-content: flex-start; }
  .dl-hero.dl-sec { padding-top: 78px; }
  .dl-top { margin-bottom: -62px; }
  .dl-sec-head { margin-bottom: 18px; }
}
@media (max-width: 520px) { .dl-feat { padding: 16px; } .dl-log-item summary { padding: 8px 14px; } .dl-log-body { padding: 0 14px 14px; } }
@media (prefers-reduced-motion: reduce) { .dl-rev { opacity: 1 !important; transform: none !important; } .dl { scroll-behavior: auto; } }
.dl-foot { scroll-snap-align: end; }                   /* the very bottom stays reachable with the magnet on */
.dl-play[hidden] { display: none; }
.dl-player video { cursor: pointer; }

/* v1.9.1 - Changelog is its own page; Privacy and terms close the front page */
.dl-dots[hidden], .dl-main[hidden] { display: none; }
.dl-subback { display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; min-height: 44px; margin: 0 0 14px -8px; padding: 0 16px 0 8px; border-radius: 13px; font-size: 13.5px; font-weight: 600; color: var(--muted); }
.dl-subback svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.dl-subback:hover { background: var(--accent-dim); color: var(--accent-2); }
.dl-flink { display: inline; min-height: 44px; padding: 0 2px; color: var(--accent-2); font: inherit; text-decoration: underline; text-underline-offset: 3px; }
.dl-doc { justify-content: flex-start; max-width: 720px; }
.dl-doc h2 { margin: 0 0 4px; font-size: clamp(22px, 3vw, 30px); }
.dl-doc-date { margin: 0 0 18px; font-size: 12px; color: var(--muted); }
.dl-doc h3 { margin: 18px 0 4px; font-size: 14.5px; }
.dl-doc p { margin: 0; font-size: 13.5px; line-height: 1.7; color: var(--muted); }

.dl-bgbtn.is-primary { border-color: var(--accent); background: var(--accent-dim); color: var(--accent-2); }
.dl-bgbtn.is-primary:hover { background: var(--accent); color: #fff; }
.dl-top-r { flex-wrap: nowrap; }
@media (max-width: 760px) { .dl-top-r { gap: 6px; } .dl-top-r .dl-bgbtn { padding: 0; width: 44px; justify-content: center; } .dl-top-r .dl-bgbtn span { display: none; } }
@media (max-width: 440px) { .dl-heart-top .dl-heart-l { display: none; } .dl-heart-top { padding: 0 12px; } .dl-wm { display: none; } }
