/* AXIS Mirror — editor shell in the style of a desktop design tool. */
:root,
:root[data-theme="dark"] {
  --app: #1b1d21;
  --chrome: #24272c;
  --chrome-2: #2c3036;
  --panel: #26292e;
  --panel-2: #1f2226;
  --field: #18191c;
  --line: #34383f;
  --line-soft: #2d3137;
  --text: #dfe3e8;
  --text-2: #a7afba;
  --muted: #7d8592;
  --accent: #3b8eea;
  --accent-2: #2f74c4;
  --accent-ink: #ffffff;
  --brand: #f2a93b;
  --ok: #4cc38a;
  --warn: #f0b43c;
  --bad: #ef6461;
  --guide: #ff3df5;
  --snap: #22d3ee;
  --canvas: #141518;
  --canvas-dot: #1c1e22;
  --shadow: 0 10px 40px rgba(0, 0, 0, .45);
  --radius: 6px;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --app: #e9ebee;
  --chrome: #f6f7f8;
  --chrome-2: #eceef1;
  --panel: #f8f9fa;
  --panel-2: #eef0f3;
  --field: #ffffff;
  --line: #cdd2d9;
  --line-soft: #dde1e6;
  --text: #1d232b;
  --text-2: #46505d;
  --muted: #6b7482;
  --accent: #1f6fd1;
  --accent-2: #195db0;
  --brand: #c97a0a;
  --ok: #1f8a5b;
  --warn: #a86400;
  --bad: #c63b38;
  --canvas: #d7dbe1;
  --canvas-dot: #ccd1d8;
  --shadow: 0 10px 40px rgba(20, 30, 40, .22);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--app);
  color: var(--text);
  font: 12.5px/1.4 "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  overflow: hidden;
}
[hidden] { display: none !important; }
button, input, select { font: inherit; color: inherit; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}
.muted-icon { color: var(--muted); }

.app {
  height: 100vh;
  height: 100dvh;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
}

/* ---------------------------------------------------------- buttons */
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--chrome-2);
  cursor: pointer;
  white-space: nowrap;
}
button:hover { border-color: var(--muted); }
button:disabled { opacity: .4; cursor: default; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
button.primary:hover { background: var(--accent-2); }
button.wide { width: 100%; margin-top: 8px; }
.icon-button, .text-button { background: transparent; border-color: transparent; padding: 4px 6px; color: var(--text-2); }
.icon-button:hover, .text-button:hover { background: var(--chrome-2); border-color: var(--line); color: var(--text); }
.icon-button.small { min-height: 26px; padding: 3px 4px; }
.icon-button.on { color: var(--accent); }
.text-button { font-weight: 600; min-width: 34px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ---------------------------------------------------------- title bar */
.titlebar {
  display: flex;
  align-items: center;
  gap: 14px;
  height: 44px;
  padding: 0 10px 0 12px;
  background: var(--chrome);
  border-bottom: 1px solid var(--line);
  min-width: 0;
}
.logo { display: flex; align-items: center; gap: 8px; flex: none; }
.logo-text { font-size: 14px; letter-spacing: .02em; }
.logo-text b { color: var(--brand); }
.menubar { display: flex; gap: 2px; flex: none; }
.menu-root { position: relative; }
.menu-button { background: transparent; border-color: transparent; padding: 4px 9px; }
.menu-button:hover, .menu-button[aria-expanded="true"] { background: var(--chrome-2); border-color: var(--line); }
.menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 40;
  min-width: 260px;
  padding: 5px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: grid;
}
.menu button {
  justify-content: space-between;
  border: 0;
  background: transparent;
  padding: 6px 10px;
  border-radius: 5px;
  text-align: left;
}
.menu button:hover, .menu button:focus-visible { background: var(--accent); color: var(--accent-ink); outline: none; }
.menu button[aria-checked="true"] span::before { content: "✓ "; }
.menu kbd { font: inherit; color: var(--muted); font-size: 11px; }
.menu button:hover kbd { color: inherit; opacity: .8; }
.menu hr { border: 0; border-top: 1px solid var(--line-soft); margin: 4px 2px; }
.doc-title { flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px; min-width: 0; }
.doc-title input {
  width: min(280px, 100%);
  min-width: 80px;
  text-align: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 4px 8px;
  font-weight: 600;
}
.doc-title input:hover, .doc-title input:focus { border-color: var(--line); background: var(--field); }
.doc-meta { color: var(--muted); white-space: nowrap; background: transparent; border-color: transparent; min-height: 24px; padding: 2px 8px; }
.doc-meta:hover { color: var(--text); background: var(--chrome-2); border-color: var(--line); }
.title-actions { display: flex; align-items: center; gap: 4px; flex: none; }

/* ---------------------------------------------------------- options bar */
.optionsbar {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 40px;
  padding: 0 10px;
  background: var(--chrome);
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none;
}
.opt-group { display: flex; align-items: center; gap: 6px; padding: 0 10px; border-right: 1px solid var(--line-soft); flex: none; }
.opt-group:first-child { padding-left: 0; }
.opt-right { margin-left: auto; border-right: 0; }
.opt-readout { color: var(--text-2); font-variant-numeric: tabular-nums; }
.mini-field { display: flex; align-items: center; gap: 5px; color: var(--muted); }
.mini-field input { width: 62px; }
.mini-field i { font-style: normal; }
input[type=number], input[type=text], select {
  min-height: 26px;
  padding: 3px 6px;
  border-radius: 5px;
  border: 1px solid var(--line);
  background: var(--field);
  font-variant-numeric: tabular-nums;
}
input[type=number]:focus, input[type=text]:focus, select:focus { border-color: var(--accent); outline: none; }
input[type=range] { accent-color: var(--accent); }

.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 2px; padding: 2px; border-radius: 7px; background: var(--field); border: 1px solid var(--line); }
.segmented button { border: 0; background: transparent; min-height: 24px; padding: 2px 10px; color: var(--text-2); }
.segmented button[aria-pressed="true"], .segmented button[aria-selected="true"] { background: var(--chrome-2); color: var(--text); box-shadow: 0 0 0 1px var(--line); font-weight: 600; }
.segmented.compact button { padding: 2px 12px; }

/* ---------------------------------------------------------- work area */
.workarea { display: grid; grid-template-columns: 46px minmax(0, 1fr) 320px; min-height: 0; }
.toolbar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 0;
  background: var(--chrome);
  border-right: 1px solid var(--line);
}
.tool { width: 34px; height: 34px; padding: 0; background: transparent; border-color: transparent; color: var(--text-2); }
.tool:hover { background: var(--chrome-2); color: var(--text); }
.tool[aria-pressed="true"] { background: var(--chrome-2); border-color: var(--line); color: var(--accent); }
.tool-sep { width: 22px; border-top: 1px solid var(--line); margin: 4px 0; }

.canvas-area { display: grid; grid-template-rows: auto 1fr; min-width: 0; min-height: 0; }
.doc-tabs { display: flex; background: var(--chrome-2); border-bottom: 1px solid var(--line); height: 30px; }
.doc-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  background: var(--app);
  border-right: 1px solid var(--line);
  border-top: 2px solid var(--accent);
  color: var(--text);
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.dirty { color: var(--brand); font-size: 10px; }
.viewport {
  position: relative;
  overflow: auto;
  background-color: var(--canvas);
  background-image: radial-gradient(var(--canvas-dot) 1px, transparent 1px);
  background-size: 16px 16px;
  min-height: 0;
}
.viewport[data-tool="hand"], .viewport.panning { cursor: grab; }
.viewport.panning:active { cursor: grabbing; }
.viewport[data-tool="zoom"] { cursor: zoom-in; }
.viewport[data-tool="zoom"].zoom-out { cursor: zoom-out; }
.canvas-pad { display: grid; place-items: center; min-width: 100%; min-height: 100%; padding: 32px; width: max-content; }
.stage {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(180deg, transparent 58%, rgba(0, 0, 0, .5) 58%, rgba(0, 0, 0, .72) 100%),
    radial-gradient(ellipse at 50% 35%, #34414f, #12161c 72%);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .06), 0 18px 50px rgba(0, 0, 0, .5);
  touch-action: none;
  user-select: none;
  outline: none;
}
.backdrop { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: fill; pointer-events: none; }
.guide-layer, .hud-layer, .shape-layer, .mirrors, .snap-layer { position: absolute; inset: 0; }
.guide-layer, .hud-layer, .shape-layer, .snap-layer { pointer-events: none; }
.margin-box { position: absolute; border: 1px dashed rgba(56, 189, 248, .45); }
.hud-outside { position: absolute; background: repeating-linear-gradient(135deg, rgba(0, 0, 0, .42) 0 6px, rgba(0, 0, 0, .22) 6px 12px); }
.center-line { position: absolute; background: rgba(56, 189, 248, .35); }
.center-line.v { width: 1px; top: 0; bottom: 0; }
.center-line.h { height: 1px; left: 0; right: 0; }
.hud-box {
  position: absolute;
  border: 1px solid rgba(255, 255, 255, .3);
  background: rgba(255, 255, 255, .05);
  border-radius: 2px;
  color: rgba(255, 255, 255, .6);
  font-size: inherit;
  line-height: 1.15;
  padding: 1px 3px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.hud-box.sometimes { border-style: dashed; background: transparent; }
.hud-box.tiny { color: transparent; padding: 0; }
.hud-box.hit { border-color: var(--bad); color: #ffd2d1; background: rgba(239, 100, 97, .16); }
.shape-outline { position: absolute; border: 1px dashed rgba(242, 169, 59, .75); }
.snap { position: absolute; background: var(--guide); }
.snap.v { width: 1px; top: 0; bottom: 0; }
.snap.h { height: 1px; left: 0; right: 0; }

.mirror { position: absolute; cursor: move; }
.viewport[data-tool="hand"] .mirror, .viewport.panning .mirror { cursor: inherit; }
.viewport[data-tool="zoom"] .mirror { cursor: inherit; }
.mirror.locked { cursor: not-allowed; }
.mirror .frame { position: absolute; inset: 0; }
.mirror .reflection {
  position: absolute;
  overflow: hidden;
  background: linear-gradient(180deg, #8fb4d9 0%, #c8dbe9 45%, #6f7a6a 46%, #4a4f4a 70%, #2f3236 100%);
}
.mirror .reflection::after {
  content: "";
  position: absolute;
  left: 15%;
  right: 15%;
  top: 46%;
  bottom: 0;
  background: linear-gradient(90deg, transparent 0 46%, rgba(255, 255, 255, .7) 46% 54%, transparent 54%);
  clip-path: polygon(45% 0, 55% 0, 100% 100%, 0 100%);
}
.mirror .reflection::before {
  content: "";
  position: absolute;
  top: 20%;
  bottom: 12%;
  width: 28%;
  background: linear-gradient(180deg, #d9dde2, #9aa3ad);
  border-radius: 2px;
}
.mirror.left .reflection::before { right: 0; }
.mirror.right .reflection::before { left: 0; }
.mirror.selected::after { content: ""; position: absolute; inset: -2px; border: 1.5px solid var(--accent); pointer-events: none; }
.mirror .label {
  position: absolute;
  top: calc(100% + 4px);
  font-size: 10.5px;
  color: #fff;
  background: var(--accent);
  padding: 1px 6px;
  border-radius: 3px;
  white-space: nowrap;
  pointer-events: none;
  display: none;
}
.mirror.selected .label { display: block; }
.mirror.right .label { right: 0; }
.handle {
  position: absolute;
  width: 10px;
  height: 10px;
  background: #fff;
  border: 1.5px solid var(--accent);
  bottom: -6px;
  display: none;
  touch-action: none;
}
.mirror.selected:not(.locked) .handle { display: block; }
.mirror.left .handle { right: -6px; cursor: nwse-resize; }
.mirror.right .handle { left: -6px; cursor: nesw-resize; }

/* ---------------------------------------------------------- dock */
.dock {
  display: grid;
  grid-template-rows: minmax(0, 2.4fr) minmax(0, 1fr) auto;
  background: var(--app);
  border-left: 1px solid var(--line);
  min-height: 0;
  gap: 1px;
}
.panel { display: grid; grid-template-rows: auto minmax(0, 1fr); background: var(--panel); min-height: 0; }
.panel[data-panel="checks"] { max-height: 26vh; }
.panel-tabs { display: flex; background: var(--panel-2); border-bottom: 1px solid var(--line); height: 30px; }
.panel-tabs button { border: 0; border-radius: 0; background: transparent; padding: 0 14px; color: var(--muted); min-height: 30px; border-bottom: 2px solid transparent; }
.panel-tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); background: var(--panel); }
.panel-tabs.single { align-items: center; padding: 0 12px; gap: 8px; color: var(--text); font-weight: 600; }
.count { font-weight: 600; font-size: 10.5px; padding: 0 7px; border-radius: 999px; background: var(--chrome-2); color: var(--text-2); }
.count.warn { background: rgba(240, 180, 60, .18); color: var(--warn); }
.count.bad { background: rgba(239, 100, 97, .18); color: var(--bad); }
.panel-body { overflow-y: auto; padding: 4px 12px 12px; min-height: 0; scrollbar-width: thin; }

.prop-section { padding: 8px 0 10px; border-bottom: 1px solid var(--line-soft); }
.prop-section:last-child { border-bottom: 0; }
.prop-section h3 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 2px 0 8px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-2);
}
.field { display: grid; gap: 3px; margin: 6px 0; min-width: 0; }
.field > span { font-size: 11px; color: var(--muted); }
.field input { width: 100%; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.slider-row { display: flex; align-items: center; gap: 8px; margin: 6px 0; }
.slider-row input[type=range] { flex: 1; min-width: 0; }
.slider-row input[type=number] { width: 62px; flex: none; }
.slider-label { width: 52px; flex: none; color: var(--muted); font-size: 11px; }
.check { display: flex; align-items: center; gap: 8px; margin: 8px 0; cursor: pointer; }
.check input { accent-color: var(--accent); width: 14px; height: 14px; margin: 0; }
.hint { color: var(--muted); font-size: 11px; margin: 4px 0; }
.warn-text { color: var(--warn); }
.badge {
  font-size: 9.5px;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  padding: 1px 6px;
  border-radius: 999px;
  border: 1px solid currentColor;
  white-space: nowrap;
}
.badge.ok { color: var(--ok); }
.badge.warn { color: var(--warn); }
.badge.info { color: var(--accent); }

.shape-picker { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.shape-picker button { flex-direction: column; gap: 3px; padding: 6px 2px 4px; min-height: 64px; background: var(--field); font-size: 10.5px; color: var(--text-2); }
.shape-picker button[aria-pressed="true"] { border-color: var(--accent); color: var(--text); }
.shape-picker .shape { display: block; background: linear-gradient(180deg, #8fb4d9, #4a4f4a); border: 2px solid #111; }

.swatches { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0 6px; }
.swatch { width: 22px; height: 22px; min-height: 22px; padding: 0; border-radius: 5px; border: 1px solid var(--line); }
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--accent); }
input[type=color] { width: 34px; height: 26px; padding: 1px; border: 1px solid var(--line); border-radius: 5px; background: var(--field); }

.chips { display: flex; flex-wrap: wrap; gap: 4px; padding: 8px 0; }
.chip { min-height: 24px; padding: 2px 9px; border-radius: 999px; font-size: 11px; background: var(--field); color: var(--text-2); }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.library { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.card {
  position: relative;
  display: grid;
  gap: 4px;
  padding: 6px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  cursor: pointer;
  text-align: left;
  min-width: 0;
}
.card:hover { border-color: var(--accent); }
.card.current { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.card strong { font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card small { color: var(--muted); font-size: 10.5px; line-height: 1.25; }
.card .tags { display: flex; gap: 4px; flex-wrap: wrap; }
.card .delete { position: absolute; top: 3px; right: 3px; min-height: 22px; padding: 2px; opacity: 0; }
.card:hover .delete, .card:focus-within .delete { opacity: 1; }
.thumb { width: 100%; aspect-ratio: 16 / 9; display: block; border-radius: 4px; background: #182029; }
.thumb.large { border-radius: 6px; }
.empty { color: var(--muted); font-size: 11px; grid-column: 1 / -1; padding: 8px 0; }

.layers { display: grid; gap: 2px; padding-top: 6px; }
.layer {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  border-radius: 5px;
  min-height: 30px;
}
.layer.selectable { cursor: pointer; }
.layer.selectable:hover { background: var(--chrome-2); }
.layer.selected { background: rgba(59, 142, 234, .18); }
.layer .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.layer .name small { color: var(--muted); margin-left: 6px; }
.layer.child { padding-left: 28px; color: var(--text-2); font-size: 11.5px; }
.layer .icon-button { min-height: 24px; padding: 2px 4px; }
.layer .icon-button.off { opacity: .35; }
.layer .chevron { width: 14px; height: 14px; transition: transform .15s; }
.layer .chevron.open { transform: rotate(90deg); }
.layer-sub { display: flex; align-items: center; gap: 8px; padding: 2px 6px 6px 28px; }
.layer-sub input[type=range] { flex: 1; }
.history { list-style: none; margin: 0; padding: 6px 0 0; display: grid; gap: 1px; }
.history button { width: 100%; justify-content: flex-start; border: 0; background: transparent; padding: 4px 8px; color: var(--text-2); }
.history button:hover { background: var(--chrome-2); }
.history li.current button { background: rgba(59, 142, 234, .18); color: var(--text); }
.history li.future button { opacity: .45; }

.checks { display: grid; gap: 6px; padding-top: 8px; }
.check-item { display: flex; gap: 8px; align-items: flex-start; font-size: 11.5px; color: var(--text-2); }
.check-item .icon { width: 15px; height: 15px; margin-top: 1px; }
.check-item.ok .icon { color: var(--ok); }
.check-item.warn .icon { color: var(--warn); }
.check-item.bad .icon { color: var(--bad); }

/* ---------------------------------------------------------- status bar */
.statusbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  height: 28px;
  padding: 0 8px;
  background: var(--chrome);
  border-top: 1px solid var(--line);
  color: var(--text-2);
  font-size: 11.5px;
  min-width: 0;
}
.status-group { display: flex; align-items: center; gap: 12px; min-width: 0; }
.status-item { white-space: nowrap; font-variant-numeric: tabular-nums; }
.status-item b { font-weight: 600; color: var(--text); }
.status-select { min-height: 22px; padding: 1px 4px; font-size: 11.5px; background: transparent; border-color: transparent; }
.status-select:hover { border-color: var(--line); }
.status-button { min-height: 22px; padding: 1px 8px; font-size: 11.5px; background: transparent; border-color: transparent; color: var(--text-2); }
.status-button:hover { border-color: var(--line); }
.status-button.warn { color: var(--warn); }
.status-button.bad { color: var(--bad); }
.status-button.ok { color: var(--ok); }
.credit a { color: var(--text); text-decoration: none; font-weight: 600; }
.credit a:hover, .credit a:focus-visible { color: var(--accent); text-decoration: underline; }
.status-credit { padding-left: 12px; border-left: 1px solid var(--line); }
.about-credit { color: var(--text-2); font-size: 12px; }

/* ---------------------------------------------------------- dialogs, toast */
.dialog {
  width: min(520px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--text);
  box-shadow: var(--shadow);
}
.dialog.small { width: min(380px, calc(100vw - 32px)); }
.dialog.wide { width: min(900px, calc(100vw - 32px)); }
.export-grid { display: grid; grid-template-columns: 276px 1fr; gap: 14px; align-items: start; }
.mod-icon { width: 100%; max-width: 276px; aspect-ratio: 276 / 162; display: block; border-radius: 6px; border: 1px solid var(--line); }
textarea {
  width: 100%;
  resize: vertical;
  min-height: 52px;
  padding: 5px 7px;
  border-radius: 5px;
  border: 1px solid var(--line);
  background: var(--field);
  font: inherit;
}
textarea:focus { border-color: var(--accent); outline: none; }
.share-row { display: flex; gap: 6px; }
.share-row input { flex: 1; min-width: 0; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 11px; }
.screens-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.screen-tile { display: grid; gap: 4px; padding: 6px; text-align: left; background: var(--panel-2); justify-items: stretch; white-space: normal; }
.screen-tile.current { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.screen-tile .thumb { aspect-ratio: auto; height: 100px; }
.screen-tile .meta { display: flex; justify-content: space-between; gap: 6px; align-items: center; font-size: 11.5px; }
.screen-tile .ok { color: var(--ok); }
.screen-tile .warn { color: var(--warn); }
.screen-tile .bad { color: var(--bad); }
.menu.context { position: fixed; top: 0; left: 0; z-index: 70; }
.dialog::backdrop { background: rgba(0, 0, 0, .55); }
.dialog form { display: grid; grid-template-rows: auto 1fr auto; max-height: calc(100vh - 34px); }
.dialog header { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.dialog h2 { margin: 0; font-size: 14px; }
.dialog h3 { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-2); margin: 14px 0 4px; }
.dialog-body { padding: 12px 14px; overflow-y: auto; }
.dialog footer { display: flex; justify-content: flex-end; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.export-preview { margin-bottom: 8px; }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 11.5px; color: var(--text-2); }
.list { margin: 4px 0; padding-left: 18px; }
.list li { margin: 3px 0; }
.keys li { margin: 6px 0; }
.steps { padding-left: 18px; }
.steps li { margin: 6px 0; }
.welcome-steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.welcome-steps li { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 8px; background: var(--panel-2); border: 1px solid var(--line-soft); }
.welcome-steps .icon { color: var(--accent); width: 22px; height: 22px; }
.about-logo { display: flex; align-items: center; gap: 12px; font-size: 16px; }
.about-logo b { color: var(--brand); }
.notice { display: flex; gap: 8px; padding: 8px 10px; border-radius: 6px; background: rgba(240, 180, 60, .1); color: var(--warn); margin: 8px 0; font-size: 11.5px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 44px;
  transform: translateX(-50%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  padding: 9px 14px;
  border-radius: 7px;
  box-shadow: var(--shadow);
  max-width: calc(100vw - 32px);
  z-index: 60;
}
.toast.error { border-left-color: var(--bad); }
.noscript { padding: 16px; }

/* ---------------------------------------------------------- small screens */
@media (max-width: 1100px) {
  .workarea { grid-template-columns: 46px minmax(0, 1fr) 280px; }
  .doc-meta, .hide-narrow { display: none; }
}
@media (max-width: 820px) {
  .export-grid { grid-template-columns: 1fr; }
  body { overflow: auto; }
  .app { height: auto; min-height: 100dvh; grid-template-rows: auto auto auto auto; }
  .titlebar { flex-wrap: wrap; height: auto; padding: 6px 16px; gap: 8px; }
  .doc-title { order: 3; flex-basis: 100%; }
  .logo-text { display: none; }
  .optionsbar { padding: 0 16px; }
  .workarea { grid-template-columns: 1fr; }
  .toolbar { flex-direction: row; justify-content: center; padding: 4px 16px; border-right: 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
  .tool-sep { width: 0; height: 22px; border-top: 0; border-left: 1px solid var(--line); margin: 0 4px; }
  .viewport { height: min(56vh, calc(56.25vw + 40px)); }
  .canvas-pad { padding: 12px; }
  .dock { border-left: 0; grid-template-rows: auto auto auto; }
  .panel-body { max-height: none; }
  .panel[data-panel="checks"] { max-height: none; }
  .statusbar { flex-wrap: wrap; height: auto; padding: 4px 16px; }
  .status-credit { padding-left: 0; border-left: 0; }
}

/* ---------------------------------------------------------- convoy choice, screen panel */
.section-title { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--text); font-size: 12px; }
.choice-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 4px; }
.choice-cards button {
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 10px;
  padding: 10px 12px;
  white-space: normal;
  text-align: left;
  background: var(--panel-2);
  border-width: 1.5px;
}
.choice-cards button .icon { width: 26px; height: 26px; color: var(--muted); margin-top: 1px; }
.choice-cards button span { display: grid; gap: 3px; }
.choice-cards button small { color: var(--muted); font-size: 11px; line-height: 1.35; }
.choice-cards button[aria-checked="true"] { border-color: var(--accent); background: rgba(59, 142, 234, .12); }
.choice-cards button[aria-checked="true"] .icon { color: var(--accent); }
.screen-now { display: flex; align-items: center; gap: 10px; padding: 10px 0 6px; }
.screen-now .icon { width: 28px; height: 28px; color: var(--accent); }
.screen-now strong { display: block; font-size: 15px; font-variant-numeric: tabular-nums; }
.screen-now small { color: var(--muted); font-size: 11px; }
.ratio-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.ratio-grid button { flex-direction: column; gap: 4px; padding: 6px 2px; min-height: 58px; background: var(--field); font-size: 11px; color: var(--text-2); }
.ratio-grid button[aria-pressed="true"] { border-color: var(--accent); color: var(--text); box-shadow: inset 0 0 0 1px var(--accent); }
.ratio-shape { display: block; border: 1.5px solid currentColor; border-radius: 2px; }
.resolution-list { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.resolution-list button { justify-content: space-between; background: var(--field); font-variant-numeric: tabular-nums; padding: 5px 9px; }
.resolution-list button small { color: var(--muted); font-size: 10.5px; }
.resolution-list button[aria-pressed="true"] { border-color: var(--accent); background: rgba(59, 142, 234, .12); }
.custom-screen { display: flex; align-items: end; gap: 6px; }
.custom-screen .field { flex: 1; margin: 0; }
.custom-screen .times { padding-bottom: 6px; color: var(--muted); }
@media (max-width: 820px) {
  .choice-cards { grid-template-columns: 1fr; }
}
