:root {
  --bg: #131315;
  --bg-2: #191a1d;
  --bg-3: #1f2024;
  --line: #2c2e33;
  --line-2: #3a3d44;
  --fg: #e8e8ea;
  --fg-2: #a5a7ad;
  --fg-3: #74777e;
  --accent: #6f8fd0;
  --danger: #d08a8a;
  --ok: #7fb08a;
  --warn: #d0b184;
  --radius: 4px;
  --stage-bg: #0d0d0f;
  --check-a: #232327;
  --check-b: #2a2a2e;
  --tools-w: 46px;
  --panels-w: 370px;
  --controls-w: 264px;
  --rail-w: 42px;
  --bar-h: 40px;
  --bleed: 32px;
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
}
body {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: var(--bar-h) minmax(0, 1fr) auto 26px;
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.45;
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
h2 { font-size: 11px; font-weight: 600; margin: 0; }
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.spacer { flex: 1; }
.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 12px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
}
.wordmark {
  font-weight: 600;
  letter-spacing: 0.02em;
}
.doc-name {
  color: var(--fg-3);
  font-size: 12px;
  padding-left: 14px;
  border-left: 1px solid var(--line);
  max-width: 40ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.btn {
  height: 26px;
  padding: 0 12px;
  font: inherit;
  font-size: 12px;
  color: var(--fg);
  background: var(--bg-3);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  cursor: pointer;
}
.btn:hover { background: #26272c; }
.btn:active { transform: translateY(1px); }
.btn.primary {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line-2));
  background: color-mix(in srgb, var(--accent) 18%, var(--bg-3));
}
.btn.primary:hover { background: color-mix(in srgb, var(--accent) 28%, var(--bg-3)); }
.account { position: relative; display: flex; align-items: center; margin-right: 8px; }
.account[hidden] { display: none; }
.account-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  min-width: 220px;
  padding: 4px;
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgb(0 0 0 / 45%);
}
.account-menu[hidden] { display: none; }
.account-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 7px 9px;
  font: inherit;
  color: var(--fg);
  text-align: left;
  text-decoration: none;
  background: none;
  border: 0;
  border-radius: 3px;
  cursor: pointer;
}
.account-item:hover { background: var(--bg-3); }
.account-sub { font-size: 11px; color: var(--fg-3); }
.account-out { margin-top: 4px; border-top: 1px solid var(--line); border-radius: 0 0 3px 3px; }
.account-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 24ch;
  overflow: hidden;
}
.account-btn[hidden] { display: none; }
.account-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-avatar { display: block; width: 16px; height: 16px; border-radius: 50%; object-fit: cover; }
.account-avatar[hidden] { display: none; }
.work {
  display: grid;
  grid-template-columns: var(--tools-w) var(--controls-w) minmax(0, 1fr) 5px var(--panels-w);
  min-width: 0;
  min-height: 0;
}
.col-resize {
  position: relative;
  z-index: 3;
  background: var(--line);
  cursor: col-resize;
  touch-action: none;
}
.col-resize::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: -4px;
  right: -4px;
}
.col-resize:hover,
.col-resize:focus-visible,
.col-resize.is-dragging { background: var(--accent); outline: none; }
body.is-resizing { cursor: col-resize; user-select: none; }
body.is-resizing * { cursor: col-resize !important; }
.tools {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 0;
  background: var(--bg-2);
  border-right: 1px solid var(--line);
}
.tool {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  color: var(--fg-2);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
}
.tool svg { width: 20px; height: 20px; fill: currentColor; }
.tool:hover:not(:disabled) { background: var(--bg-3); color: var(--fg); }
.tool.is-active {
  background: color-mix(in srgb, var(--accent) 22%, var(--bg-3));
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  color: var(--fg);
}
.tool:disabled { opacity: 0.3; cursor: default; }
.tool-gap {
  width: 22px;
  height: 1px;
  margin: 6px 0;
  background: var(--line);
}
.controls {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  background: var(--bg-2);
  border-right: 1px solid var(--line);
}
.ctl-block {
  padding: 12px;
  border-bottom: 1px solid var(--line);
}
.ctl-h {
  margin: 0 0 6px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-2);
}
.ctl-note {
  margin: 0 0 9px;
  font-size: 11.5px;
  line-height: 1.4;
  color: var(--fg-3);
}
.ctl-hint {
  margin: 0 0 8px;
  padding: 7px 9px;
  font-size: 11px;
  line-height: 1.45;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border-radius: 3px;
}
.ctl-hint b { color: var(--fg); }
.guide-lead {
  margin: 0;
  padding: 10px 12px;
  font-size: 11px;
  line-height: 1.45;
  color: var(--fg-3);
  border-bottom: 1px solid var(--line);
}
.step { border-bottom: 1px solid var(--line); }
.step-h { margin: 0; font-size: inherit; font-weight: inherit; }
.step-toggle {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 10px 12px;
  font: inherit;
  text-align: left;
  color: var(--fg-2);
  background: none;
  border: 0;
  cursor: pointer;
}
.step-toggle:hover { background: var(--bg-3); color: var(--fg); }
.step-n {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 19px;
  height: 19px;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--fg-3);
  background: var(--bg-3);
  border: 1px solid var(--line-2);
  border-radius: 50%;
}
.step-label { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.step-title {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}
.step-sum {
  font-size: 10.5px;
  color: var(--fg-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.step-sum:empty { display: none; }
.step.is-open > .step-h > .step-toggle { color: var(--fg); background: var(--bg-3); }
.step.is-open > .step-h > .step-toggle .step-n {
  color: var(--fg);
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 45%, transparent);
}
.step.is-done > .step-h > .step-toggle .step-n {
  color: var(--bg);
  background: var(--accent);
  border-color: var(--accent);
}
.step.is-done > .step-h > .step-toggle .step-sum { color: var(--fg-2); }
.step-body { padding: 0 12px 12px; }
.step-body[hidden] { display: none; }
.step-gate {
  margin: 0 0 9px;
  padding: 7px 9px;
  color: var(--fg-2);
  background: var(--bg-3);
  border-left: 2px solid var(--line-2);
  border-radius: 0 3px 3px 0;
}
.step-gate[hidden] { display: none; }
.step-body .move-frames { margin-top: 0; padding-top: 0; border-top: 0; }
.step-body .ctl-sub:first-child { margin-top: 0; }
.gallery {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
.gal-grid {
  display: grid;
  gap: 6px;
  margin: 0 0 9px;
}
.gal-grid[hidden] { display: none; }
.gal-note[hidden] { display: none; }
.gal-local[hidden] { display: none; }
.gal-clear[hidden] { display: none; }
.publish-btn { display: block; margin: 0 0 6px; }
.publish-btn[hidden] { display: none; }
.publish-hint[hidden] { display: none; }
.publish-hint:empty { display: none; }
.gal-local {
  margin: 9px 0 0;
  font-size: 10.5px;
  color: var(--fg-3);
}
.gal-item {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: stretch;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.gal-item:hover { border-color: var(--line-2); }
.gal-open {
  display: grid;
  grid-template-columns: 48px 1fr;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 5px;
  font: inherit;
  color: var(--fg-2);
  text-align: left;
  background: none;
  border: 0;
  border-radius: 3px 0 0 3px;
  cursor: pointer;
}
.gal-open:hover { background: var(--bg-3); color: var(--fg); }
.gal-shot {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  overflow: hidden;
  background: var(--bg-3);
  border-radius: 3px;
}
.gal-shot img { display: block; max-width: 100%; max-height: 100%; }
.gal-shot.is-blank { border: 1px dashed var(--line-2); }
.gal-meta { display: grid; gap: 2px; min-width: 0; }
.gal-name {
  font-size: 11.5px;
  color: var(--fg);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.gal-facts {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--fg-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.gal-dl {
  padding: 0 9px;
  font: inherit;
  font-size: 13px;
  line-height: 1;
  color: var(--fg-3);
  background: none;
  border: 0;
  border-left: 1px solid var(--line);
  cursor: pointer;
}
.gal-dl:hover { color: var(--fg); background: var(--bg-3); }
.gal-x {
  padding: 0 9px;
  font: inherit;
  font-size: 14px;
  line-height: 1;
  color: var(--fg-3);
  background: none;
  border: 0;
  border-left: 1px solid var(--line);
  border-radius: 0 3px 3px 0;
  cursor: pointer;
}
.gal-x:hover { color: var(--danger); background: var(--bg-3); }
.ctl-select {
  width: 100%;
  height: 28px;
  padding: 0 8px;
  margin-bottom: 8px;
  font: inherit;
  font-size: 12px;
  color: var(--fg);
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: 3px;
  cursor: pointer;
}
.ctl-select:disabled { color: var(--fg-3); cursor: default; }
.ctl-result {
  margin: 8px 0 0;
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--fg-2);
}
.ctl-result[data-tone='ok'] { color: var(--ok); }
.ctl-result[data-tone='error'] { color: var(--danger); }
.ctl-result[hidden] { display: none; }
.modal-card.con-card {
  width: min(1100px, 100%);
  height: min(780px, 100%);
}
.cp-body {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  min-height: 0;
  flex: 1;
}
.cp-preview {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border-right: 1px solid var(--line);
  min-height: 0;
  overflow-y: auto;
}
.cp-stage {
  background:
    repeating-conic-gradient(var(--check-a) 0 25%, var(--check-b) 0 50%) 0 0 / 16px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.cp-stage canvas { display: block; width: 100%; height: auto; }
.cp-rolls { display: flex; gap: 6px; }
.cp-rolls .ctl-btn { width: auto; flex: 1; min-width: 0; }
.cp-rarity { margin: 0; font-size: 12.5px; color: var(--fg); }
.cp-rarity-sub { margin: 0; font-size: 11px; color: var(--fg-3); font-family: var(--mono); }
.cp-breakdown {
  margin: 2px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 2px;
  font-size: 10.5px;
  color: var(--fg-3);
}
.cp-breakdown li { display: flex; justify-content: space-between; gap: 8px; }
.cp-breakdown li span:first-child { color: var(--fg-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cp-breakdown li span:last-child { font-family: var(--mono); flex: none; }
.cp-choices { display: flex; flex-direction: column; min-height: 0; }
.cp-pickers { overflow-y: auto; padding: 12px 14px; display: grid; gap: 14px; min-height: 0; }
.cp-picker { display: grid; gap: 6px; }
.cp-head { display: flex; align-items: baseline; gap: 8px; }
.cp-name { font-size: 11.5px; font-weight: 600; color: var(--fg); }
.cp-value { font-size: 11px; color: var(--fg-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cp-occluded {
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--danger);
  border: 1px solid var(--danger);
  border-radius: 2px;
  padding: 0 4px;
  flex: none;
  cursor: help;
}
.cp-occluded[hidden] { display: none; }
.cp-picker.is-occluded .cp-list { opacity: 0.35; }
.cp-picker.is-occluded .cp-name { color: var(--fg-3); }
.cp-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 5px;
}
.cp-swatch {
  display: grid;
  gap: 2px;
  justify-items: center;
  padding: 4px 3px 5px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--fg-3);
  font: inherit;
  text-align: center;
}
.cp-swatch:hover { background: var(--bg-3); }
.cp-swatch.is-selected {
  border-color: var(--accent);
  background: var(--bg-3);
  color: var(--fg);
}
.cp-thumb {
  width: 100%;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  background:
    repeating-conic-gradient(var(--check-a) 0 25%, var(--check-b) 0 50%) 0 0 / 10px 10px;
  border-radius: 2px;
  overflow: hidden;
}
.cp-thumb img { display: block; width: 100%; height: 100%; object-fit: contain; }
.cp-thumb.is-none { color: var(--fg-3); font-size: 14px; background: var(--bg); }
.cp-swatch-name {
  font-size: 9.5px;
  line-height: 1.2;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cp-share { font-family: var(--mono); font-size: 8.5px; color: var(--fg-3); }
.cp-share.is-empty { font-family: var(--font); font-style: italic; }
.cp-missing { margin: 0; padding: 10px 14px; border-top: 1px solid var(--line); flex: none; }
.modal-card.export-card {
  width: min(1100px, 100%);
  height: min(760px, 100%);
}
.ex-body {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 0;
  flex: 1;
  min-height: 0;
}
.ex-preview {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px;
  border-right: 1px solid var(--line);
  overflow-y: auto;
}
.ex-stage {
  display: grid;
  place-items: center;
  padding: 8px;
  background-color: var(--check-a);
  background-image:
    linear-gradient(45deg, var(--check-b) 25%, transparent 25%),
    linear-gradient(-45deg, var(--check-b) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--check-b) 75%),
    linear-gradient(-45deg, transparent 75%, var(--check-b) 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  border: 1px solid var(--line);
  border-radius: 4px;
}
.ex-stage canvas { display: block; max-width: 100%; height: auto; }
.ex-transport {
  display: flex;
  align-items: center;
  gap: 10px;
}
.ex-transport .ctl-btn { width: auto; min-width: 92px; }
.ex-pos { font-family: var(--mono); font-size: 11px; color: var(--fg-3); }
.ex-field { display: grid; gap: 4px; font-size: 11.5px; color: var(--fg-3); }
.ex-field .ctl-select { margin-bottom: 0; }
.ex-warn {
  color: var(--warn);
  background: color-mix(in srgb, var(--warn) 12%, transparent);
}
.ex-warn b { color: var(--fg); }
.ex-frames { display: flex; flex-direction: column; min-height: 0; }
.ex-frames-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--line);
}
.ex-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 6px;
  padding: 12px 16px;
  overflow-y: auto;
  min-height: 0;
  align-content: start;
}
.ex-grid.is-muted { opacity: 0.45; }
.ex-cell {
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: 4px;
  background: none;
  border: 1px solid var(--line);
  border-radius: 4px;
  cursor: pointer;
}
.ex-cell:hover { background: var(--bg-3); }
.ex-cell.is-picked {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 20%, var(--bg-3));
}
.ex-shot {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  overflow: hidden;
}
.ex-shot canvas { display: block; max-width: 100%; max-height: 100%; }
.ex-n { font-family: var(--mono); font-size: 9.5px; color: var(--fg-3); }
.ex-cell.is-picked .ex-n { color: var(--fg); }
.modal-foot .ctl-result { margin: 0; }
.ctl-block.staging {
  background: color-mix(in srgb, var(--accent) 10%, var(--bg-2));
  border-left: 2px solid var(--accent);
}
.ctl-block.staging .ctl-h { color: var(--fg); }
.ctl-block.staging .ctl-btn { margin-bottom: 6px; }
.ctl-block[hidden] { display: none; }
.ctl-sub {
  margin: 12px 0 6px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--fg-3);
}
.ctl-sub:first-of-type { margin-top: 8px; }
.ctl-fine {
  margin: 0 0 8px;
  font-size: 10.5px;
  line-height: 1.4;
  color: var(--fg-3);
}
.ctl-slider {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  font-size: 10.5px;
  color: var(--fg-3);
}
.ctl-slider output { font-family: var(--mono); color: var(--fg-2); min-width: 22px; }
.ctl-slider input { flex: 1; accent-color: var(--accent); }
.ctl-turn {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}
.ctl-turn-field {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
  font-size: 10.5px;
  color: var(--fg-3);
}
.ctl-turn-field input {
  flex: 1;
  min-width: 0;
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 5px 6px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--fg);
  accent-color: var(--accent);
}
.ctl-turn-field input:focus-visible { outline: 1px solid var(--accent); outline-offset: 0; }
.ctl-turn-field input:disabled { opacity: 0.4; cursor: default; }
.ctl-turn-field:has(input:disabled) { opacity: 0.4; }
.ctl-turn-deg { font-family: var(--mono); color: var(--fg-2); }
.ctl-turn .ctl-btn { width: auto; flex: 0 0 auto; }
.ctl-size {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}
.ctl-size-field {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
  font-size: 10.5px;
  color: var(--fg-3);
}
.ctl-size-field input {
  flex: 1;
  min-width: 0;
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 5px 6px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--fg);
  accent-color: var(--accent);
}
.ctl-size-field input:focus-visible { outline: 1px solid var(--accent); outline-offset: 0; }
.ctl-size-field input:disabled { opacity: 0.4; cursor: default; }
.ctl-size-field:has(input:disabled) { opacity: 0.4; }
.ctl-size-x { font-family: var(--mono); color: var(--fg-2); }
.ctl-fade {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}
.ctl-fade-field {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
  font-size: 10.5px;
  color: var(--fg-3);
}
.ctl-fade-field input[type='range'] {
  flex: 1;
  min-width: 0;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
}
.ctl-fade-field input:focus-visible { outline: 1px solid var(--accent); outline-offset: 2px; }
.ctl-fade-field input:disabled { opacity: 0.4; cursor: default; }
.ctl-fade-field:has(input:disabled) { opacity: 0.4; }
.ctl-fade-value {
  min-width: 34px;
  text-align: right;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--fg-2);
}
.ctl-fade .ctl-btn { width: auto; flex: 0 0 auto; }
.nft-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}
.nft-collection {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11.5px;
  color: var(--fg-2);
}
.nft-collection[hidden] { display: none; }
.nft-select {
  flex: 1 1 auto;
  min-width: 0;
  height: 28px;
  padding: 0 6px;
  font: inherit;
  font-size: 12px;
  color: var(--fg);
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
}
.nft-select[hidden] { display: none; }
.nft-field {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  font-size: 10.5px;
  color: var(--fg-3);
}
.nft-field input {
  width: 76px;
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 5px 6px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--fg);
}
.nft-field input:focus-visible { outline: 1px solid var(--accent); outline-offset: 0; }
.nft-field input:disabled { opacity: 0.4; cursor: default; }
.nft-field:has(input:disabled) { opacity: 0.4; }
#nftNote.is-bad { color: var(--danger); }
#nftDetail:empty { display: none; }
.ctl-steps { margin-top: 10px; }
.ctl-steps[hidden] { display: none; }
.ctl-count {
  margin: 0 0 8px;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--fg-3);
}
.ctl-row {
  display: flex;
  gap: 6px;
  margin-bottom: 6px;
}
.ctl-row[hidden] { display: none; }
.ctl-note:empty { display: none; margin: 0; }
.ctl-row .ctl-btn { width: auto; flex: 1; }
.move-frames {
  margin-top: 12px;
  padding-top: 4px;
  border-top: 1px solid var(--line);
}
.ctl-btn {
  width: 100%;
  height: 30px;
  padding: 0 10px;
  font: inherit;
  font-size: 12px;
  color: var(--fg);
  background: var(--bg-3);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  cursor: pointer;
}
.ctl-btn:hover:not(:disabled) { background: #26272c; }
.ctl-btn:disabled { opacity: 0.4; cursor: default; }
.ctl-btn.primary {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line-2));
  background: color-mix(in srgb, var(--accent) 18%, var(--bg-3));
}
.ctl-btn.primary:hover:not(:disabled) { background: color-mix(in srgb, var(--accent) 28%, var(--bg-3)); }
.ctl-btn.is-on {
  border-color: var(--accent);
  color: var(--fg);
  box-shadow: inset 2px 0 0 var(--accent);
}
.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  grid-template-columns: minmax(0, 1fr);
  place-items: center;
  padding: 20px;
  background: rgb(0 0 0 / 72%);
}
.modal[hidden] { display: none; }
.modal-card {
  display: flex;
  flex-direction: column;
  width: min(880px, 100%);
  max-height: 100%;
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  border-radius: 6px;
  box-shadow: 0 12px 48px rgb(0 0 0 / 60%);
}
.modal-head { padding: 14px 16px; border-bottom: 1px solid var(--line); }
.modal-head h2 { font-size: 14px; }
.modal-sub { margin: 5px 0 0; font-size: 11.5px; color: var(--fg-3); }
.modal-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 16px;
  border-top: 1px solid var(--line);
}
.modal-foot .ctl-btn { width: auto; min-width: 96px; }
.fp-count { font-size: 11.5px; color: var(--fg-3); }
.edit-card {
  width: min(1720px, 100%);
  height: 100%;
}
.step-tag {
  margin: 0 0 4px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}
.edit-body {
  display: grid;
  grid-template-columns: 252px minmax(0, 1fr);
  gap: 18px;
  padding: 16px;
  flex: 1;
  min-height: 0;
  min-width: 0;
}
.edit-stage { display: flex; min-width: 0; min-height: 0; }
.edit-view {
  position: relative;
  flex: 1;
  min-width: 0;
  min-height: 0;
  background: #0d0d0f;
  border: 1px solid var(--line);
  border-radius: 4px;
}
.edit-view canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
}
.edit-view canvas.is-grabbing { cursor: grabbing; }
.edit-view.is-cropping canvas { cursor: crosshair; }
.edit-view.is-cutting canvas { cursor: crosshair; }
.edit-modes { display: flex; gap: 5px; margin-bottom: 6px; }
.edit-rail {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow-y: auto;
  border-right: 1px solid var(--line);
  padding-right: 18px;
}
.edit-rail .ctl-btn { margin-bottom: 6px; }
.edit-rail .ctl-sub:first-child { margin-top: 0; }
.edit-cta {
  font-size: 12px;
  color: var(--fg-2);
}
.fp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 8px;
  padding: 14px 16px;
  overflow-y: auto;
  min-height: 0;
}
.fp-cell {
  display: grid;
  justify-items: center;
  gap: 3px;
  padding: 5px;
  background: none;
  border: 1px solid var(--line);
  border-radius: 4px;
  cursor: pointer;
}
.fp-cell:hover { background: var(--bg-3); }
.fp-cell.is-picked {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 18%, var(--bg-3));
}
.fp-shot {
  display: grid;
  place-items: center;
  width: 92px;
  height: 92px;
  overflow: hidden;
  background-color: var(--check-a);
  background-image:
    linear-gradient(45deg, var(--check-b) 25%, transparent 25%),
    linear-gradient(-45deg, var(--check-b) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--check-b) 75%),
    linear-gradient(-45deg, transparent 75%, var(--check-b) 75%);
  background-size: 8px 8px;
  background-position: 0 0, 0 4px, 4px -4px, -4px 0;
}
.fp-shot canvas { display: block; max-width: 100%; max-height: 100%; }
.fp-num { font-family: var(--mono); font-size: 9.5px; color: var(--fg-3); }
.fp-cell.is-picked .fp-num { color: var(--accent); }
.stage-wrap {
  position: relative;
  display: grid;
  direction: rtl;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  padding: 24px;
  background: var(--stage-bg);
}
.stage-wrap.dropping::after {
  content: '';
  position: absolute;
  inset: 8px;
  border: 2px dashed var(--accent);
  border-radius: 6px;
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  pointer-events: none;
}
.viewer {
  display: flex;
  direction: ltr;
  align-items: stretch;
  gap: 18px;
  padding: 18px;
  margin: auto 0 auto auto;
}
.artboard {
  position: relative;
  box-shadow: 0 2px 16px rgb(0 0 0 / 55%);
  background-color: var(--check-a);
  background-image:
    linear-gradient(45deg, var(--check-b) 25%, transparent 25%),
    linear-gradient(-45deg, var(--check-b) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--check-b) 75%),
    linear-gradient(-45deg, transparent 75%, var(--check-b) 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}
.artboard.is-empty { display: none; }
.artboard canvas {
  display: block;
  width: 100%;
  height: 100%;
}
.artboard canvas.overlay {
  position: absolute;
  left: calc(var(--bleed) * -1);
  top: calc(var(--bleed) * -1);
  right: auto;
  bottom: auto;
  width: auto;
  height: auto;
  pointer-events: auto;
}
.frame-arrow {
  flex: none;
  width: var(--rail-w);
  display: grid;
  place-items: center;
  padding: 0;
  color: var(--fg-2);
  background: color-mix(in srgb, var(--bg-2) 70%, transparent);
  border: 1px solid var(--line);
  border-radius: 5px;
  opacity: 0.4;
  cursor: pointer;
  transition: opacity 0.14s ease, background 0.14s ease, color 0.14s ease;
}
.frame-arrow[hidden] { display: none; }
.frame-arrow svg { width: 26px; height: 26px; transition: transform 0.1s ease; }
.frame-arrow:hover,
.frame-arrow:focus-visible {
  opacity: 1;
  background: var(--bg-3);
  color: var(--fg);
}
.frame-arrow:active svg { transform: scale(0.85); }
@media (pointer: coarse) {
  .frame-arrow {
    width: 56px;
    opacity: 0.75;
  }
}
.frame-flag {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  padding: 2px 8px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  color: #1a1206;
  background: #e0a33f;
  border-radius: 3px;
  pointer-events: none;
}
.frame-flag[hidden] { display: none; }
.empty-state {
  position: absolute;
  inset: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 2px;
  color: var(--fg-3);
  cursor: pointer;
  user-select: none;
}
.empty-state:hover { color: var(--fg-2); }
.empty-state[hidden] { display: none; }
.empty-mark svg {
  width: 56px;
  height: 56px;
  margin-bottom: 14px;
  color: var(--line-2);
}
.empty-state:hover .empty-mark svg { color: var(--fg-3); }
.empty-title { margin: 0; font-size: 15px; color: var(--fg-2); }
.empty-sub { margin: 4px 0 0; font-size: 12px; }
.empty-formats {
  margin: 14px 0 0;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.04em;
  color: var(--line-2);
}
.panels {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto auto auto;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: var(--bg-2);
  border-left: 1px solid var(--line);
}
.panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-bottom: 1px solid var(--line);
}
.panel-h {
  padding: 9px 12px;
  color: var(--fg-2);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
}
.panel-h-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 5px;
  padding-bottom: 5px;
}
.panel-h-row h2 {
  margin: 0;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-2);
}
.panel-h-actions { display: flex; gap: 4px; }
.panel-reset { color: var(--fg-3); }
.panel-reset:hover { color: var(--fg); }
.ctl-tally {
  margin-left: 4px;
  padding: 1px 5px;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0;
  color: var(--fg-2);
  background: var(--bg-3);
  border-radius: 8px;
}
.ctl-tally:empty { display: none; }
.shape-list { display: flex; flex-direction: column; gap: 3px; }
.shape-list[hidden] { display: none; }
.shape-row { display: flex; align-items: stretch; gap: 3px; }
.shape-go {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
  padding: 4px 8px;
  background: var(--bg-3);
  border: 1px solid var(--line-2);
  border-radius: 3px;
  color: var(--fg-2);
  font: inherit;
  font-size: 11.5px;
  text-align: left;
  cursor: pointer;
}
.shape-go:hover:not(:disabled) { background: #26272c; color: var(--fg); }
.shape-go:disabled { opacity: 0.45; cursor: default; }
.shape-thumb {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  background: var(--bg);
  border-radius: 2px;
}
.shape-thumb path {
  fill: color-mix(in srgb, var(--accent) 45%, transparent);
  stroke: var(--accent);
  stroke-width: 1.2;
  stroke-linejoin: round;
}
.shape-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shape-del {
  flex: 0 0 auto;
  width: 22px;
  background: none;
  border: 1px solid transparent;
  border-radius: 3px;
  color: var(--fg-3);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}
.shape-del:hover { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.topbar-history { display: flex; gap: 2px; margin-right: 8px; }
.top-icon { color: var(--fg-2); }
.top-icon:hover:not(:disabled) { color: var(--fg); }
.top-icon:disabled { color: var(--fg-3); opacity: 0.45; cursor: default; }
.panel-history { flex: 0 0 auto; min-height: 0; }
.panel-history.is-open { display: flex; flex-direction: column; min-height: 0; max-height: 40vh; }
.history-twist {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  background: none;
  border: 0;
  color: inherit;
  cursor: pointer;
  font: inherit;
}
.history-twist h2 {
  margin: 0;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-2);
}
.history-twist:hover h2 { color: var(--fg); }
.history-twist-mark { display: flex; align-items: center; color: var(--fg-3); }
.history-pos { font-family: var(--mono); font-size: 10px; color: var(--fg-3); }
.history-list {
  overflow-y: auto;
  min-height: 0;
}
.history-list[hidden] { display: none; }
.history-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 5px 12px;
  background: none;
  border: 0;
  border-left: 2px solid transparent;
  color: var(--fg-2);
  font: inherit;
  font-size: 11.5px;
  text-align: left;
  cursor: pointer;
}
.history-row:hover { background: var(--bg-3); color: var(--fg); }
.history-dot {
  flex: 0 0 auto;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--fg-3);
}
.history-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-row.is-current {
  color: var(--fg);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  border-left-color: var(--accent);
}
.history-row.is-current .history-dot { background: var(--accent); }
.history-row.is-undone { color: var(--fg-3); opacity: 0.6; }
.history-row.is-undone .history-dot { background: transparent; box-shadow: inset 0 0 0 1px var(--fg-3); }
.panel-empty {
  margin: 0;
  padding: 14px 12px;
  color: var(--fg-3);
  font-size: 12px;
}
.panel-empty[hidden] { display: none; }
.panel-hint {
  margin: 0;
  padding: 7px 12px;
  font-size: 11px;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border-bottom: 1px solid var(--line);
}
.panel-hint[hidden] { display: none; }
.panel-library { flex: 0 0 auto; min-height: 0; }
.panel-library.is-open { display: flex; flex-direction: column; min-height: 0; max-height: 40vh; }
.library-twist {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  background: none;
  border: 0;
  color: inherit;
  cursor: pointer;
  font: inherit;
}
.library-twist h2 {
  margin: 0;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-2);
}
.library-twist:hover h2 { color: var(--fg); }
.library-twist-mark { display: flex; align-items: center; color: var(--fg-3); }
.library-source {
  display: flex;
  flex: 0 0 auto;
  gap: 2px;
  padding: 2px;
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.library-source[hidden] { display: none; }
.library-src {
  padding: 1px 7px;
  font: inherit;
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--fg-3);
  background: none;
  border: 0;
  border-radius: 2px;
  cursor: pointer;
}
.library-src:hover { color: var(--fg); }
.library-src[aria-pressed='true'] { color: var(--fg); background: var(--bg); }
.library-list {
  overflow-y: auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px;
}
.library-list[hidden] { display: none; }
.layer-list.drop-library {
  outline: 1.5px dashed var(--accent);
  outline-offset: -1.5px;
  background: color-mix(in srgb, var(--accent) 6%, transparent);
}
.library-item {
  position: relative;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: grab;
}
.library-item:hover { background: var(--bg-3); border-color: var(--line-2); }
.library-item:active { cursor: grabbing; }
.library-thumb {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-2);
  border-radius: 2px;
  background-color: var(--check-a);
  background-image:
    linear-gradient(45deg, var(--check-b) 25%, transparent 25%),
    linear-gradient(-45deg, var(--check-b) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--check-b) 75%),
    linear-gradient(-45deg, transparent 75%, var(--check-b) 75%);
  background-size: 8px 8px;
  background-position: 0 0, 0 4px, 4px -4px, -4px 0;
  overflow: hidden;
}
.library-thumb canvas,
.library-thumb img { display: block; width: 100%; height: 100%; object-fit: contain; }
.library-meta { display: grid; gap: 2px; min-width: 0; }
.library-name {
  font-size: 11.5px;
  color: var(--fg);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.library-facts {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--fg-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.library-by {
  font-size: 10px;
  color: var(--fg-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.library-star,
.library-del {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  padding: 0;
  color: var(--fg-3);
  background: none;
  border: none;
  border-radius: 3px;
  cursor: pointer;
}
.library-star svg,
.library-del svg { display: block; }
.library-star:hover { background: var(--line); color: var(--warn); }
.library-star[aria-pressed='true'] { color: var(--warn); }
.library-del:hover { background: color-mix(in srgb, var(--danger) 28%, transparent); color: var(--fg); }
.library-clear[hidden] { display: none; }
.library-publish {
  display: block;
  width: 100%;
  margin-top: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.library-publish[hidden] { display: none; }
.inv-h { border-top: 1px solid var(--line); }
.panel-library.inv-open { display: flex; flex-direction: column; min-height: 0; max-height: 55vh; }
.inv-lists {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  padding: 0 12px 6px;
}
.inv-lists[hidden] { display: none; }
.inv-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 0 12px 6px;
}
.inv-bar[hidden] { display: none; }
.inv-bar .chip:disabled { opacity: 0.45; cursor: not-allowed; }
.inv-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 0 6px 6px;
  overflow-y: auto;
  min-height: 0;
  max-height: 26vh;
}
.inv-list[hidden] { display: none; }
.inv-note {
  margin: 0;
  padding: 0 12px 8px;
  font-size: 10.5px;
  line-height: 1.45;
  color: var(--fg-3);
}
.inv-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
}
.inv-actions { display: flex; align-items: center; gap: 1px; }
.inv-item:hover { background: var(--bg-3); border-color: var(--line-2); }
.inv-meta { display: grid; gap: 1px; min-width: 0; }
.inv-name {
  font-size: 11.5px;
  color: var(--fg);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.inv-facts {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--fg-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.inv-act { flex: 0 0 auto; }
.inv-act:disabled { opacity: 0.55; cursor: not-allowed; }
.inv-act:disabled:hover { background: none; color: var(--fg-3); }
.inv-star[aria-pressed='true'] { color: var(--warn); }
.inv-mark[aria-pressed='true'] { color: var(--accent); }
.inv-forget:hover { background: color-mix(in srgb, var(--danger) 28%, transparent); color: var(--fg); }
.drafts { position: relative; }
.drafts-btn { color: var(--fg-2); }
.drafts-pop {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 30;
  width: 320px;
  max-width: 86vw;
  display: flex;
  flex-direction: column;
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  box-shadow: 0 10px 28px rgb(0 0 0 / 45%);
  overflow: hidden;
}
.drafts-pop[hidden] { display: none; }
.drafts-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
}
.drafts-head h2 {
  margin: 0;
  flex: 1 1 auto;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-2);
}
.drafts-count { font-family: var(--mono); font-size: 10px; color: var(--fg-3); }
.drafts-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 6px;
  overflow-y: auto;
  min-height: 0;
  max-height: 46vh;
}
.drafts-list[hidden] { display: none; }
.drafts-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
}
.drafts-item:hover { background: var(--bg-3); border-color: var(--line-2); }
.drafts-item.is-current { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.drafts-meta { display: grid; gap: 1px; min-width: 0; }
.drafts-name {
  font-size: 12px;
  color: var(--fg);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.drafts-facts {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--fg-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.drafts-actions { display: flex; align-items: center; gap: 1px; }
.drafts-act { flex: 0 0 auto; }
.drafts-star[aria-pressed='true'] { color: var(--warn); }
.drafts-del:hover { background: color-mix(in srgb, var(--danger) 28%, transparent); color: var(--fg); }
.group-row {
  display: grid;
  grid-template-columns: 18px 22px 22px 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  padding: 5px 8px 5px 2px;
  background: color-mix(in srgb, var(--fg) 4%, var(--bg-2));
  border-bottom: 1px solid color-mix(in srgb, var(--line) 55%, transparent);
  border-left: 2px solid transparent;
  cursor: pointer;
}
.group-row:hover { background: color-mix(in srgb, var(--fg) 8%, var(--bg-2)); }
.group-row.is-selected { border-left-color: var(--accent); }
.group-thumb {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line-2);
  border-radius: 2px;
  overflow: hidden;
  background-color: var(--check-a);
  background-image:
    linear-gradient(45deg, var(--check-b) 25%, transparent 25%),
    linear-gradient(-45deg, var(--check-b) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--check-b) 75%),
    linear-gradient(-45deg, transparent 75%, var(--check-b) 75%);
  background-size: 8px 8px;
  background-position: 0 0, 0 4px, 4px -4px, -4px 0;
}
.group-thumb canvas { display: block; }
.group-name { font-weight: 600; }
.group-count { font-size: 10px; color: var(--fg-3); font-family: var(--mono); }
.group-twist { color: var(--fg-3); }
.layer-row.is-grouped {
  padding-left: 14px;
  box-shadow: inset 2px 0 0 color-mix(in srgb, var(--fg) 14%, transparent);
}
.layer-tick { color: var(--fg-3); }
.layer-tick:hover { color: var(--ok); }
.layer-row.is-ticked .layer-tick { color: var(--ok); }
.layer-row.is-ticked {
  outline: 1.5px solid var(--ok);
  outline-offset: -1.5px;
  background: color-mix(in srgb, var(--ok) 10%, transparent);
}
.layer-list.has-ties .layer-row,
.layer-list.has-ties .group-row { padding-left: 22px; }
.layer-list.has-ties .layer-row.is-grouped { padding-left: 34px; }
.layer-list .layer-row,
.layer-list .group-row { position: relative; }
.tie-top::before,
.tie-bottom::before,
.tie-full::before {
  content: '';
  position: absolute;
  left: 8px;
  width: 1.5px;
  background: var(--ok);
}
.tie-full::before { top: 0; bottom: 0; }
.tie-bottom::before { top: 50%; bottom: 0; border-radius: 1px 1px 0 0; }
.tie-top::before { top: 0; height: 50%; border-radius: 0 0 1px 1px; }
.tie-arm::after {
  content: '';
  position: absolute;
  left: 8px;
  top: 50%;
  width: 13px;
  height: 8px;
  margin-top: -4px;
  background: var(--ok);
  clip-path: polygon(0 40%, 62% 40%, 62% 6%, 100% 50%, 62% 94%, 62% 60%, 0 60%);
}
.tie-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: color-mix(in srgb, var(--ok) 14%, var(--bg-2));
  border-bottom: 1px solid color-mix(in srgb, var(--ok) 40%, transparent);
}
.tie-bar[hidden] { display: none; }
.tie-bar-count {
  flex: 1;
  font-size: 11px;
  color: var(--fg-2);
  font-family: var(--mono);
}
.tie-bar-go {
  width: auto;
  margin: 0;
  padding: 4px 10px;
  font-size: 11.5px;
  background: color-mix(in srgb, var(--ok) 30%, var(--bg-3));
  border-color: color-mix(in srgb, var(--ok) 55%, transparent);
}
.tie-bar-go:hover:not(:disabled) { background: color-mix(in srgb, var(--ok) 42%, var(--bg-3)); }
.panel-layers { min-height: 0; }
.layer-list {
  overflow-y: auto;
  min-height: 0;
}
.layer-row {
  position: relative;
  display: grid;
  grid-template-columns: 22px 22px 22px 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  padding: 5px 8px 5px 4px;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 55%, transparent);
  border-left: 2px solid transparent;
  cursor: pointer;
}
.layer-row:hover { background: var(--bg-3); }
.layer-row.is-selected {
  background: color-mix(in srgb, var(--accent) 16%, var(--bg-3));
  border-left-color: var(--accent);
}
.layer-row.is-locked { cursor: default; }
.layer-row.is-base { border-left-color: var(--fg-3); }
.layer-row.is-dragging { opacity: 0.4; }
.layer-row.drop-above::before,
.layer-row.drop-below::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
  pointer-events: none;
}
.layer-row.drop-above::before { top: -1px; }
.layer-row.drop-below::after { bottom: -1px; }
.icon-btn {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  padding: 0;
  color: var(--fg-3);
  background: none;
  border: none;
  border-radius: 3px;
  cursor: pointer;
}
.icon-btn svg { display: block; }
.icon-btn:hover { background: var(--line); color: var(--fg); }
.layer-eye[aria-pressed='true'] { color: var(--fg-2); }
.layer-eye[aria-pressed='false'] { color: var(--line-2); }
.layer-lock[aria-pressed='true'] { color: var(--accent); }
.layer-base[aria-pressed='true'] { color: var(--accent); }
.layer-del:hover { background: color-mix(in srgb, var(--danger) 28%, transparent); color: var(--fg); }
.layer-up svg { transform: rotate(180deg); }
.layer-up:disabled,
.layer-down:disabled { opacity: 0.3; cursor: default; }
.layer-up:disabled:hover,
.layer-down:disabled:hover { background: none; color: var(--fg-3); }
.layer-actions {
  display: flex;
  gap: 1px;
  opacity: 0;
}
.layer-row:hover .layer-actions,
.layer-row.is-selected .layer-actions,
.group-row:hover .layer-actions,
.group-row.is-selected .layer-actions { opacity: 1; }
.layer-actions .icon-btn[aria-pressed='true'] { opacity: 1; }
.layer-row .layer-base[aria-pressed='true'] { opacity: 1; }
.layer-label {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.layer-badge {
  flex: none;
  padding: 1px 4px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.06em;
  color: var(--fg-3);
  border: 1px solid var(--line-2);
  border-radius: 2px;
}
.layer-rename {
  width: 100%;
  min-width: 0;
  height: 20px;
  padding: 0 5px;
  font: inherit;
  font-size: 12px;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--accent);
  border-radius: 3px;
}
.layer-rename:focus { outline: none; }
.layer-thumb {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-2);
  border-radius: 2px;
  background-color: var(--check-a);
  background-image:
    linear-gradient(45deg, var(--check-b) 25%, transparent 25%),
    linear-gradient(-45deg, var(--check-b) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--check-b) 75%),
    linear-gradient(-45deg, transparent 75%, var(--check-b) 75%);
  background-size: 8px 8px;
  background-position: 0 0, 0 4px, 4px -4px, -4px 0;
  overflow: hidden;
}
.layer-thumb canvas { display: block; width: 100%; height: 100%; object-fit: contain; }
.layer-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}
.layer-name.is-dim { color: var(--fg-3); }
.panel-transform { flex: 0 0 auto; }
.panel-body { padding: 11px 12px 12px; }
.panel-body .ctl-hint { margin-bottom: 0; }
.filmstrip {
  min-width: 0;
  background: var(--bg-2);
  border-top: 1px solid var(--line);
}
.filmstrip[hidden] { display: none; }
.film-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--line);
}
.film-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-2);
}
.film-count {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--fg-3);
}
.film-hint {
  font-size: 10.5px;
  color: var(--line-2);
}
.film-sizes { display: flex; gap: 2px; }
.film-sizes .chip { min-width: 22px; }
.chip.is-on {
  color: var(--fg);
  background: color-mix(in srgb, var(--accent) 22%, var(--bg-3));
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
}
.chip.play {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 20px;
  min-width: 62px;
}
.play-glyph { font-size: 9px; line-height: 1; }
.goto {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10.5px;
  color: var(--fg-3);
}
.goto-input {
  width: 52px;
  height: 18px;
  padding: 0 4px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--line-2);
  border-radius: 3px;
}
.goto-input:focus { outline: none; border-color: var(--accent); }
.marks-chip { color: #e0a33f; border-color: color-mix(in srgb, #e0a33f 40%, var(--line)); }
.marks-chip[hidden] { display: none; }
#btnMark.is-on {
  color: #1a1206;
  background: #e0a33f;
  border-color: #e0a33f;
}
.film-track {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  min-width: 0;
  max-width: 100%;
  padding: 8px 10px 10px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
}
.film-cell {
  flex: none;
  display: grid;
  justify-items: center;
  gap: 3px;
  padding: 3px;
  background: none;
  border: 1px solid transparent;
  border-radius: 3px;
  cursor: pointer;
}
.film-cell:hover { background: var(--bg-3); }
.film-cell.is-current {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, var(--bg-3));
}
.film-shot {
  display: grid;
  place-items: center;
  overflow: hidden;
  background-color: var(--check-a);
  background-image:
    linear-gradient(45deg, var(--check-b) 25%, transparent 25%),
    linear-gradient(-45deg, var(--check-b) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--check-b) 75%),
    linear-gradient(-45deg, transparent 75%, var(--check-b) 75%);
  background-size: 8px 8px;
  background-position: 0 0, 0 4px, 4px -4px, -4px 0;
  border: 1px solid var(--line);
}
.film-shot canvas { display: block; }
.film-num {
  font-family: var(--mono);
  font-size: 9.5px;
  color: var(--fg-3);
}
.film-cell.is-current .film-num { color: var(--accent); }
.film-cell.is-marked .film-shot { border-color: #e0a33f; box-shadow: inset 0 -3px 0 #e0a33f; }
.film-cell.is-marked .film-num { color: #e0a33f; }
.film-cell.has-key .film-shot { position: relative; }
.film-cell.has-key .film-shot::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 5px;
  height: 5px;
  background: var(--fg);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.55);
  transform: rotate(45deg);
  pointer-events: none;
}
.statusbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 10px;
  font-size: 11px;
  color: var(--fg-3);
  background: var(--bg-2);
  border-top: 1px solid var(--line);
}
.zoom-group {
  display: flex;
  align-items: center;
  gap: 3px;
}
.chip {
  height: 18px;
  min-width: 20px;
  padding: 0 6px;
  font: inherit;
  font-size: 11px;
  color: var(--fg-2);
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: 3px;
  cursor: pointer;
}
.chip:hover { background: #26272c; color: var(--fg); }
.zoom-label {
  min-width: 42px;
  text-align: center;
  font-family: var(--mono);
}
.doc-size {
  font-family: var(--mono);
  padding-left: 12px;
  border-left: 1px solid var(--line);
}
.frame-label {
  font-family: var(--mono);
  color: var(--accent);
}
.frame-label:empty { display: none; }
.status { font-size: 11.5px; }
.status[data-tone='ok'] { color: var(--ok); }
.status[data-tone='warn'] { color: var(--warn); }
.status[data-tone='error'] { color: var(--danger); }
.save-state {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--fg-3);
  cursor: help;
  border-bottom: 1px dotted var(--line);
}
.save-state[data-state='saving'] { color: var(--fg-2); }
.save-state[data-state='unsaved'] { color: var(--accent); }
.save-state[data-state='error'] { color: var(--danger); border-bottom-color: var(--danger); }
.save-over[data-armed] {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 55%, transparent);
}
.tour-btn[data-cue='new'] {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line-2));
}
.tour-btn[data-cue='new']::after {
  content: '';
  display: inline-block;
  width: 5px;
  height: 5px;
  margin-left: 6px;
  vertical-align: 1px;
  border-radius: 50%;
  background: var(--accent);
}
.tour {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: block;
  pointer-events: none;
}
.tour[hidden] { display: none; }
.tour-ring {
  position: absolute;
  pointer-events: none;
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  box-shadow:
    0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent),
    0 0 0 9999px rgb(0 0 0 / 55%);
  transition: left 120ms ease, top 120ms ease, width 120ms ease, height 120ms ease;
}
.tour-ring[hidden] { display: none; }
.tour-card {
  position: absolute;
  pointer-events: auto;
  width: 280px;
  max-width: calc(100vw - 24px);
  padding: 12px 14px 10px;
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  box-shadow: 0 10px 28px rgb(0 0 0 / 45%);
}
.tour-card:focus { outline: none; }
.tour-count {
  margin: 0 0 6px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--fg-3);
}
.tour-count[hidden] { display: none; }
.tour-title {
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--fg);
}
.tour-text {
  margin: 0 0 10px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--fg-2);
}
.tour-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.tour-gap { flex: 1; }
.tour-row .ctl-btn { width: auto; padding: 0 12px; }
.tour-row .ctl-btn[hidden] { display: none; }
.tour-quit { color: var(--fg-3); }
.drafts-transfer { border-top: 1px solid var(--line, #2a2a33); margin-top: 10px; padding-top: 10px; }
.drafts-transfer h3 { font-size: 12px; font-weight: 600; margin: 0 0 6px; opacity: .8; }
.drafts-transfer-row { display: flex; gap: 8px; flex-wrap: wrap; }
#backupStatus[data-state="error"] { color: var(--danger, #ff6b6b); }
.artboard canvas { touch-action: pinch-zoom; }
.mobile-tabs { display: none; }
@media (max-width: 900px) {
  :root {
    --mtabs-h: 52px;
    --msheet-h: 45vh;
  }
  body {
    grid-template-rows: auto minmax(0, 1fr) auto auto auto;
  }
  .topbar {
    flex-wrap: wrap;
    gap: 6px 8px;
    padding: 5px 8px;
  }
  .wordmark { display: none; }
  .doc-name {
    max-width: 16ch;
    padding-left: 0;
    border-left: none;
  }
  .btn { height: 44px; padding: 0 14px; }
  .topbar .icon-btn { width: 44px; height: 44px; }
  .work {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) auto;
  }
  .stage-wrap { grid-column: 1; grid-row: 1; padding: 8px; }
  .tools { grid-column: 1; grid-row: 2; }
  .col-resize { display: none; }
  .viewer {
    margin: auto;
    padding: 6px;
    gap: 8px;
  }
  .frame-arrow { width: 44px; }
  .tools {
    flex-direction: row;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    overflow-x: auto;
    border-right: none;
    border-top: 1px solid var(--line);
  }
  .tool { width: 44px; height: 44px; flex: 0 0 auto; }
  .tool svg { width: 22px; height: 22px; }
  .tool-gap { width: 1px; height: 24px; margin: 0 5px; flex: 0 0 auto; }
  .controls,
  .panels {
    grid-column: 1;
    grid-row: 3;
    display: none;
    border-right: none;
    border-top: 1px solid var(--line-2);
  }
  body.sheet-controls .work,
  body.sheet-panels .work {
    grid-template-rows: minmax(0, 1fr) auto minmax(0, var(--msheet-h));
    grid-template-rows: minmax(0, 1fr) auto minmax(0, 45dvh);
  }
  body.sheet-controls .controls { display: flex; }
  body.sheet-panels .panels { display: grid; }
  body.sheet-panels .panels {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }
  body.sheet-panels .panels > .panel {
    flex: 0 0 auto;
    min-height: 0;
  }
  body.sheet-panels .panels .layer-list {
    max-height: none;
    overflow: visible;
  }
  body.sheet-panels .panels .layer-list:not(:empty) {
    min-height: 132px;
  }
  body.sheet-panels .work {
    grid-template-rows: minmax(0, 1fr) auto minmax(0, 58vh);
    grid-template-rows: minmax(0, 1fr) auto minmax(0, 58dvh);
  }
  .mobile-tabs {
    display: flex;
    gap: 8px;
    align-items: stretch;
    padding: 0 8px;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    height: calc(var(--mtabs-h) + env(safe-area-inset-bottom, 0px));
    background: var(--bg-2);
    border-top: 1px solid var(--line);
  }
  .mtab {
    flex: 1 1 0;
    min-height: 44px;
    font: inherit;
    font-size: 13px;
    color: var(--fg-2);
    background: var(--bg-3);
    border: 1px solid var(--line-2);
    border-radius: var(--radius);
    cursor: pointer;
  }
  .mtab[aria-expanded='true'] {
    background: color-mix(in srgb, var(--accent) 22%, var(--bg-3));
    border-color: color-mix(in srgb, var(--accent) 45%, transparent);
    color: var(--fg);
  }
  .layer-row .layer-actions,
  .group-row .layer-actions { opacity: 1; }
  .panels .icon-btn,
  .controls .icon-btn {
    width: 24px;
    height: 44px;
  }
  .layer-row,
  .group-row { min-height: 44px; }
  .panels .panel-h-actions .icon-btn { width: 44px; }
  .step-toggle { min-height: 44px; }
  .controls .ctl-btn,
  .panels .ctl-btn { min-height: 44px; }
  .library-twist,
  .history-twist { min-height: 44px; }
  .controls input,
  .controls select,
  .panels input,
  .panels select { min-height: 44px; }
  .statusbar {
    flex-wrap: wrap;
    gap: 6px 10px;
    padding: 5px 8px;
  }
  .chip {
    height: 44px;
    min-width: 44px;
    padding: 0 12px;
    font-size: 12px;
  }
  .statusbar .spacer { flex-basis: 100%; height: 0; }
  .film-bar { flex-wrap: wrap; }
  .film-hint { display: none; }
  .modal { padding: 8px; }
}
.library-list.is-picking,
.layer-list.is-picking {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
  gap: 6px;
}
.library-list.is-picking .library-item,
.layer-list.is-picking .layer-row {
  grid-template-columns: 1fr;
  justify-items: center;
  gap: 4px;
  padding: 6px 4px;
  cursor: pointer;
  border-color: var(--line-2);
}
.library-list.is-picking .library-thumb,
.layer-list.is-picking .layer-thumb {
  width: 72px;
  height: 72px;
}
.library-list.is-picking .library-name,
.layer-list.is-picking .layer-name {
  font-size: 10px;
  text-align: center;
  max-width: 76px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.library-list.is-picking .library-item button,
.library-list.is-picking .library-item input,
.layer-list.is-picking .layer-row button,
.layer-list.is-picking .layer-row input { display: none; }
.library-list.is-picking .library-item:hover,
.layer-list.is-picking .layer-row:hover {
  border-color: var(--accent, #6ea8fe);
  background: var(--bg-3);
}
.panel-library.is-picking > .panel-h,
.library-list.is-picking,
.layer-list.is-picking { outline: 1px dashed var(--accent, #6ea8fe); outline-offset: 2px; }
.ctl-more { margin: 0 0 6px; }
.ctl-more > summary {
  cursor: pointer;
  list-style: none;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--fg-2, #a8a8b0);
  font-size: 11px;
  user-select: none;
}
.ctl-more > summary::-webkit-details-marker { display: none; }
.ctl-more > summary::before { content: '▸ '; }
.ctl-more[open] > summary::before { content: '▾ '; }
.ctl-more > summary:hover { background: var(--bg-3); color: var(--fg); }
.ctl-more[open] > summary { margin-bottom: 6px; }
.layer-thumb { width: 48px; height: 48px; }
.layer-row { grid-template-columns: 22px 22px 22px 48px minmax(0, 1fr) auto; }
.layer-name { font-size: 11px; }
.layer-row .layer-actions { opacity: 0; transition: opacity .12s ease; }
.layer-row:hover .layer-actions,
.layer-row:focus-within .layer-actions,
.layer-row.is-selected .layer-actions { opacity: 1; }
.layer-frames { opacity: .75; font-variant-numeric: tabular-nums; }
.edit-view canvas.is-over-dot { cursor: move; }
