
/* Layout: a drafting-table workspace. Gallery of specimens first; then a tool panel beside a dotted board holding the chart. */
:root {
  --bg: #ECEFEA; --surface: #FFFFFF; --surface-2: #F5F7F3; --ink: #141B18; --muted: #56615B; --line: #D3D9D1; --line-strong: #B9C1B7;
  --accent: #2741D3; --accent-ink: #FFFFFF; --accent-soft: #E2E6FB; --dot: #C7CEC4; --danger: #B3261E;
  --f-display: "Archivo", "Helvetica Neue", Arial, sans-serif; --f-body: "Archivo", "Helvetica Neue", Arial, sans-serif; --f-mono: "Fragment Mono", ui-monospace, Menlo, Consolas, monospace;
  --r: 10px; --head: 60px;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #0E1210; --surface: #161B18; --surface-2: #1C221F; --ink: #E4EAE6; --muted: #98A49D; --line: #2A322E; --line-strong: #3A443F;
  --accent: #8E9DFF; --accent-ink: #0E1210; --accent-soft: #232A4E; --dot: #29312D; --danger: #FF8A80; color-scheme: dark } }
:root[data-theme="dark"] {
  --bg: #0E1210; --surface: #161B18; --surface-2: #1C221F; --ink: #E4EAE6; --muted: #98A49D; --line: #2A322E; --line-strong: #3A443F;
  --accent: #8E9DFF; --accent-ink: #0E1210; --accent-soft: #232A4E; --dot: #29312D; --danger: #FF8A80; color-scheme: dark }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { background: var(--bg); color: var(--ink); font-family: var(--f-body); font-size: 14px; line-height: 1.5; margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
h1, h2, h3 { text-wrap: balance; margin: 0; }

/* top bar */
.top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: var(--bg); border-bottom: 1px solid var(--line);
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); padding-block: 10px;
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.mark { display: flex; align-items: center; gap: 10px; font-family: var(--f-display); font-stretch: 125%; font-weight: 800; font-size: 19px; letter-spacing: -0.01em; white-space: nowrap; }
.mark svg { width: 26px; height: 26px; flex: none; }
.helplink { margin-left: auto; color: var(--muted); font-size: 13.5px; font-weight: 600; }
.helplink:hover { color: var(--ink); }
.steps { display: flex; gap: 4px; margin: 0; padding: 0; list-style: none; flex-wrap: wrap; }
.step { display: flex; align-items: center; gap: 8px; border: 0; background: none; padding: 7px 12px 7px 8px; border-radius: 999px; cursor: pointer; color: var(--muted); font-weight: 600; }
.step b { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid currentColor; font-size: 11px; font-family: var(--f-mono); font-weight: 400; }
.step[aria-current="step"] { background: var(--ink); color: var(--bg); }
.step[aria-current="step"] b { border-color: var(--bg); }
.step:disabled { opacity: .45; cursor: default; }
.step:not(:disabled):not([aria-current="step"]):hover { color: var(--ink); background: var(--surface); }

/* gallery */
.wrap { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); max-width: 1480px; margin: 0 auto; }
.intro { padding-block: 34px 18px; display: grid; gap: 18px; grid-template-columns: minmax(0, 1fr) auto; align-items: end; }
.intro h1 { font-family: var(--f-display); font-stretch: 118%; font-weight: 800; font-size: clamp(28px, 4.2vw, 46px); line-height: 1.02; letter-spacing: -0.02em; }
.intro p { color: var(--muted); margin: 10px 0 0; max-width: 58ch; font-size: 15px; }
.intro .num { font-family: var(--f-mono); color: var(--accent); }
.resume { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px 10px 16px; }
.resume span { color: var(--muted); font-size: 13px; }
.resume strong { display: block; color: var(--ink); font-size: 14px; max-width: 24ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filters { position: sticky; top: calc(env(safe-area-inset-top, 0px) + var(--head)); z-index: 10; background: var(--bg); padding-block: 10px 12px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; border-bottom: 1px solid var(--line); }
.search { flex: 1 1 240px; max-width: 360px; position: relative; }
.search input { width: 100%; padding: 9px 12px 9px 36px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line-strong); background: var(--surface); padding: 6px 12px; border-radius: 999px; cursor: pointer; font-size: 13px; font-weight: 600; }
.chip span { font-family: var(--f-mono); font-weight: 400; color: var(--muted); margin-left: 2px; }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chip[aria-pressed="true"] span { color: inherit; }
.keep { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--muted); margin-left: auto; }
.keep input { accent-color: var(--accent); width: 16px; height: 16px; }
.group { padding-block: 26px 6px; }
.group-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 14px; }
.group-head h2 { font-family: var(--f-display); font-stretch: 112%; font-weight: 750; font-size: 20px; letter-spacing: -0.01em; }
.group-head .count { font-family: var(--f-mono); color: var(--muted); font-size: 12px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); gap: 14px; }
.card { display: flex; flex-direction: column; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 0; cursor: pointer; overflow: hidden; transition: border-color .15s, transform .15s; min-width: 0; }
.card:hover { border-color: var(--accent); }
.card:hover .nm { color: var(--accent); }
.thumb { display: block; aspect-ratio: 360 / 236; border-bottom: 1px solid var(--line); background: var(--surface); max-width: 100%; }
.thumb svg { display: block; width: 100%; height: 100%; }
.card-text { padding: 10px 12px 12px; display: grid; gap: 2px; }
.nm { font-weight: 700; font-size: 14px; line-height: 1.3; }
.ds { color: var(--muted); font-size: 12.5px; line-height: 1.4; }
.nores { padding: 40px 0; color: var(--muted); }
.foot { color: var(--muted); font-size: 12.5px; padding-block: 36px 40px; }

/* editor */
.editor { display: grid; grid-template-columns: min(var(--panel-w, 440px), calc(100% - 370px)) 10px minmax(0, 1fr); min-height: calc(100vh - var(--head)); }
.splitter { position: sticky; top: var(--head); height: calc(100vh - var(--head)); cursor: col-resize; touch-action: none; display: flex; justify-content: center; margin-left: -5px; margin-right: -5px; width: 20px; z-index: 5; }
.splitter::before { content: ""; width: 1px; height: 100%; background: var(--line); transition: background .15s, width .15s; }
.splitter::after { content: ""; position: absolute; top: 50%; width: 6px; height: 42px; margin-top: -21px; border-radius: 3px; background: var(--line-strong); transition: background .15s; }
.splitter:hover::before, .splitter:focus-visible::before, body.resizing .splitter::before { width: 2px; background: var(--accent); }
.splitter:hover::after, .splitter:focus-visible::after, body.resizing .splitter::after { background: var(--accent); }
.splitter:focus-visible { outline: none; }
body.resizing { cursor: col-resize; user-select: none; }
body.resizing #chart { pointer-events: none; }
.panel { background: var(--surface); min-width: 0; display: flex; flex-direction: column; }
.panel-scroll { padding: 20px max(16px, env(safe-area-inset-left, 0px)) 28px 20px; overflow: auto; position: sticky; top: var(--head); max-height: calc(100vh - var(--head)); }
.pane h2 { font-family: var(--f-display); font-stretch: 112%; font-weight: 750; font-size: 22px; letter-spacing: -0.01em; }
.pane .lede { color: var(--muted); margin: 6px 0 14px; font-size: 13.5px; max-width: 60ch; }
.next { display: flex; justify-content: flex-end; margin-top: 18px; }
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line-strong); background: var(--surface); border-radius: 8px; padding: 7px 12px; font-weight: 600; font-size: 13px; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--ink); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.quiet { border-color: transparent; background: transparent; color: var(--muted); }
.btn.quiet:hover { color: var(--ink); }
.tools { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; background: var(--accent-soft); color: var(--accent); padding: 3px 10px; border-radius: 999px; margin-bottom: 10px; }
.sheet-hint { color: var(--muted); font-size: 12.5px; margin: 0 0 8px; display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.sheet-hint .mono { font-family: var(--f-mono); }
.sheet-wrap { overflow: auto; border: 1px solid var(--line-strong); border-radius: 8px; max-height: 58vh; background: var(--surface); }
table.sheet { border-collapse: separate; border-spacing: 0; font-family: var(--f-mono); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.sheet th { position: sticky; top: 0; background: var(--surface-2); color: var(--muted); font-weight: 400; font-size: 11px; padding: 4px 6px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); z-index: 2; min-width: 34px; }
.sheet tbody th { position: sticky; left: 0; z-index: 1; text-align: right; }
.sheet th.corner { left: 0; z-index: 3; }
.sheet td { padding: 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.sheet td input { width: 112px; border: 0; padding: 6px 8px; background: transparent; outline: none; font: inherit; }
.sheet td:first-of-type input { width: 132px; }
.sheet tr.hdr td { background: var(--surface-2); }
.sheet tr.hdr td input { font-weight: 700; color: var(--ink); }
.sheet td.sel { box-shadow: inset 0 0 0 2px var(--accent); }
.fsec { padding-block: 16px; border-top: 1px solid var(--line); }
.fsec:first-child { border-top: 0; padding-top: 4px; }
.fsec h3 { font-size: 11.5px; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); font-weight: 700; margin-bottom: 12px; }
.fgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.fld { display: grid; gap: 5px; min-width: 0; }
.fld > label { font-size: 12.5px; font-weight: 600; }
.fld input[type=text], .fld input[type=number], .fld select, .fld textarea { width: 100%; border: 1px solid var(--line-strong); border-radius: 7px; padding: 7px 9px; background: var(--surface); min-width: 0; }
.fld textarea { resize: vertical; }
.fsec .fgrid > .fld:has(textarea), .fsec .fgrid > .fld:has(#f-title), .fsec .fgrid > .fld:has(#f-source) { grid-column: 1 / -1; }
.chk { display: flex !important; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; align-self: end; padding-bottom: 6px; cursor: pointer; }
.chk input { width: 16px; height: 16px; accent-color: var(--accent); }
.range { display: flex; align-items: center; gap: 8px; }
.range input { flex: 1; accent-color: var(--accent); min-width: 0; }
.range output { font-family: var(--f-mono); font-size: 12px; color: var(--muted); min-width: 3ch; text-align: right; }
.cpick { display: flex; align-items: center; gap: 6px; min-width: 0; }
.cbtn { width: 34px; height: 32px; flex: none; border: 1px solid var(--line-strong); border-radius: 7px; padding: 3px; background: var(--surface); cursor: pointer; }
.cbtn::before { content: ""; display: block; width: 100%; height: 100%; border-radius: 4px; background: var(--c); box-shadow: inset 0 0 0 1px rgba(0,0,0,.12); }
.cbtn.auto::before { background: repeating-linear-gradient(135deg, var(--surface-2) 0 4px, var(--line) 4px 6px); }
.cbtn:hover, .cbtn[aria-expanded="true"] { border-color: var(--accent); }
.cnative { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.cpick { position: relative; }
.cpop { position: absolute; z-index: 50; width: 274px; max-width: calc(100vw - 24px); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 10px; padding: 12px; box-shadow: 0 14px 34px -10px rgba(20,27,24,.35); display: grid; gap: 10px; }
.cp-h { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; margin-bottom: 5px; }
.cp-row { display: flex; flex-wrap: wrap; gap: 6px; }
.cp-sw { width: 34px; height: 34px; border-radius: 7px; border: 1px solid rgba(0,0,0,.14); background: var(--c); cursor: pointer; padding: 0; }
.cp-sw:hover { transform: scale(1.08); }
.cp-sw[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent); }
.cp-note { margin: 0; font-size: 12px; color: var(--muted); }
.cp-foot { display: flex; gap: 6px; justify-content: space-between; border-top: 1px solid var(--line); padding-top: 10px; }
.cpick input.cnative { position: absolute; left: 0; bottom: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; border: 0; padding: 0; }
.cpick .hex { width: 100%; min-width: 0; max-width: 110px; font-family: var(--f-mono); font-size: 12.5px; border: 1px solid var(--line-strong); border-radius: 7px; padding: 6px 8px; background: var(--surface); text-transform: uppercase; }
.hex[aria-invalid="true"] { border-color: var(--danger); color: var(--danger); }
.palettes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin-bottom: 14px; }
.pal { display: grid; gap: 5px; text-align: left; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 7px 8px; cursor: pointer; font-size: 12px; font-weight: 600; }
.pal[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.pal-sw { display: flex; height: 12px; border-radius: 3px; overflow: hidden; }
.pal-sw i { flex: 1; }
.logos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin-bottom: 10px; }
.logo-opt { border: 1px solid var(--line); background: #FFFFFF; border-radius: 8px; padding: 0; cursor: pointer; overflow: hidden; min-width: 0; }
.logo-opt.on-dark { background: #1D2126; }
.logo-opt.none { background: var(--surface); color: var(--muted); font-size: 12.5px; font-weight: 600; }
.logo-opt[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 2px var(--accent); }
.logo-sw { display: flex; align-items: center; justify-content: center; height: 46px; padding: 6px 10px; }
.logo-sw img { max-height: 100%; max-width: 100%; display: block; }
.logo-tools { margin-bottom: 4px; }
.fld-label { font-size: 12.5px; font-weight: 600; }
.datatools { border: 1px solid var(--line); border-radius: 8px; padding: 10px; margin-bottom: 10px; background: var(--surface-2); display: grid; gap: 8px; }
.datatools .tools { margin: 0; }
.col-label { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.btn-select { border: 1px solid var(--line-strong); background: var(--surface); border-radius: 8px; padding: 7px 10px; font-weight: 600; font-size: 13px; max-width: 100%; }
.filter { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.filter input { flex: 1 1 200px; min-width: 0; border: 1px solid var(--line-strong); border-radius: 7px; padding: 7px 9px; background: var(--surface); }
#tools-note:empty, #import-note:empty { display: none; }
#tools-note, #import-note { margin: 0; }
.sheet-pick { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-weight: 600; font-size: 13px; }
.sheet-pick select { border: 1px solid var(--line-strong); border-radius: 7px; padding: 6px 8px; background: var(--surface); }
.pane.dropping .sheet-wrap { outline: 2px dashed var(--accent); outline-offset: 3px; }
.hist { display: inline-flex; gap: 4px; }
.btn.icon:disabled { opacity: .4; cursor: default; }
.filter-badge { margin: 0; }
.colors-head { display: flex; justify-content: space-between; font-size: 12.5px; font-weight: 600; margin-bottom: 6px; }
.link { border: 0; background: none; color: var(--accent); font-weight: 600; cursor: pointer; padding: 0; font-size: 12.5px; }
.crow { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 4px 0; border-bottom: 1px dashed var(--line); }
.cname { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note { color: var(--muted); font-size: 12.5px; }
.exrow { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 8px; }
.exrow select { border: 1px solid var(--line-strong); border-radius: 7px; padding: 6px 8px; background: var(--surface); }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; margin-bottom: 10px; }
.seg label { padding: 6px 12px; font-size: 13px; font-weight: 600; cursor: pointer; }
.seg input { position: absolute; opacity: 0; }
.seg label.on, .seg label:has(input:checked) { background: var(--ink); color: var(--bg); }
.seg label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: -2px; }
#embed { width: 100%; height: 150px; font-family: var(--f-mono); font-size: 11.5px; border: 1px solid var(--line-strong); border-radius: 8px; padding: 8px; background: var(--surface-2); resize: vertical; }
.status { min-height: 1.5em; font-size: 13px; color: var(--muted); margin: 8px 0 0; }
.status.err { color: var(--danger); }
.preview img { max-width: 100%; border: 1px solid var(--line); border-radius: 8px; margin-top: 8px; }
.stage { min-width: 0; display: flex; flex-direction: column; background-color: var(--bg); background-image: radial-gradient(var(--dot) 1px, transparent 1.2px); background-size: 18px 18px; }
.stage-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 14px 22px 0; }
.stage-head .what { min-width: 0; }
.stage-head .eyebrow { font-size: 11px; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); font-weight: 700; }
.stage-head h2 { font-family: var(--f-display); font-stretch: 112%; font-weight: 750; font-size: 18px; }
.stage-head .size { font-family: var(--f-mono); font-size: 12px; color: var(--muted); margin-left: auto; }
.board { flex: 1; padding: 22px; display: flex; align-items: flex-start; justify-content: center; min-width: 0; }
.chart-frame { width: fit-content; max-width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 14px; box-shadow: 0 1px 0 var(--line), 0 12px 30px -18px rgba(20, 27, 24, .35); min-width: 0; }
#chart { margin: 0 auto; min-width: 0; }
.pw-ctrl input[type=search], .pw-ctrl select, .pw-btn, .pw-chip { background: var(--surface) !important; color: var(--ink) !important; border-color: var(--line-strong) !important; }
.pw-chip span { color: var(--ink) !important; }
.hint { position: absolute; z-index: 80; max-width: 260px; background: var(--ink); color: var(--bg); font-size: 12.5px; line-height: 1.4; font-weight: 500; padding: 7px 10px; border-radius: 7px; box-shadow: 0 8px 22px -8px rgba(20,27,24,.45); pointer-events: none; animation: hint-in .12s ease-out; }
.hint::after { content: ""; position: absolute; left: var(--ax, 50%); bottom: -5px; width: 10px; height: 10px; margin-left: -5px; background: inherit; transform: rotate(45deg); border-radius: 2px; }
.hint.below::after { bottom: auto; top: -5px; }
@keyframes hint-in { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .hint { animation: none; } }
.startdata { margin: 0 0 22px; }
.sd-box { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 18px; align-items: start; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; }
.startdata.dropping .sd-box { outline: 2px dashed var(--accent); outline-offset: 3px; }
.sd-text h2 { font-family: var(--f-display); font-stretch: 112%; font-weight: 750; font-size: 18px; }
.sd-text p { color: var(--muted); margin: 6px 0 0; font-size: 14px; }
.sd-input textarea { width: 100%; min-height: 64px; resize: vertical; border: 1.5px dashed var(--line-strong); border-radius: 8px; padding: 10px 12px; background: var(--surface-2); font-family: var(--f-mono); font-size: 12.5px; }
.sd-input textarea:focus { border-style: solid; border-color: var(--accent); outline: none; }
.sd-actions { display: flex; align-items: center; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
#sd-note { margin: 6px 0 0; }
#sd-note.err { color: var(--danger); }
.sd-result { margin-top: 10px; background: var(--surface); border: 1px solid var(--accent); border-radius: var(--r); padding: 12px 16px; }
.sd-sum { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sd-sum .btn { margin-left: auto; }
.sd-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; margin-top: 8px; }
.sd-h { margin: 0 0 4px; font-size: 12.5px; font-weight: 700; color: var(--muted); }
.sd-fix { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; padding: 3px 0; }
.sd-fix input { margin-top: 3px; }
.sd-preview { overflow-x: auto; }
.sd-preview table { border-collapse: collapse; font-size: 12px; font-family: var(--f-mono); }
.sd-preview td { border: 1px solid var(--line); padding: 3px 7px; white-space: nowrap; max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
.sd-preview tr.hdr td { font-weight: 700; background: var(--surface-2); }
.sd-preview .note { margin: 4px 0 0; font-size: 12px; }
.group.fits .group-head { flex-wrap: wrap; }
.group.fits .group-head .note { flex-basis: 100%; margin: 2px 0 0; font-size: 13px; }
.group.fits { border: 1px solid var(--accent); border-radius: var(--r); padding: 12px; background: var(--accent-soft); margin-bottom: 18px; }
.card.nofit { opacity: .45; }
.card.nofit:hover { opacity: .8; }
.tidy-box { border: 1px solid var(--accent); background: var(--accent-soft); border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; }
.tidy-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; font-size: 13.5px; }
.tidy-box ul { list-style: none; margin: 0; padding: 0; }
.tidy-box li { display: flex; align-items: center; gap: 10px; justify-content: space-between; padding: 6px 0; border-top: 1px solid color-mix(in srgb, var(--accent) 25%, transparent); font-size: 13px; }
.tidy-box li:first-child { border-top: 0; }
.tidy-acts { display: inline-flex; gap: 4px; flex: none; }
@media (max-width: 760px) { .sd-box, .sd-cols { grid-template-columns: minmax(0, 1fr); } }
.refs-list { display: grid; gap: 8px; margin-bottom: 10px; }
.ref-card { border: 1px solid var(--line); border-radius: 8px; padding: 8px; background: var(--surface-2); display: grid; gap: 6px; }
.ref-top { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) auto; gap: 6px; align-items: center; }
.ref-top:not(:has(select:nth-of-type(3))) { grid-template-columns: repeat(2, minmax(0, 1fr)) auto; }
.ref-vals { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.4fr); gap: 6px; }
.ref-vals:not(:has(input:nth-of-type(3))) { grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); }
.ref-card select, .ref-card input { min-width: 0; border: 1px solid var(--line-strong); border-radius: 7px; padding: 6px 8px; background: var(--surface); font-size: 13px; }
.ref-card .ref-del { padding: 5px 8px; }
#alt-sec .fgrid > .fld { grid-column: 1 / -1; }
.preset-fld { grid-column: 1 / -1; }
.library { margin: 6px 0 22px; }
.lib-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.lib-head h2 { font-family: var(--f-display); font-stretch: 112%; font-weight: 750; font-size: 18px; }
.lib-head .btn { margin-left: auto; }
.lib-head .count { font-family: var(--f-mono); font-size: 12px; color: var(--muted); }
.lib-cards { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(200px, 230px); gap: 12px; overflow-x: auto; padding-bottom: 6px; scroll-snap-type: x proximity; }
.lib-cards:empty { display: none; }
.lcard { position: relative; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; scroll-snap-align: start; min-width: 0; }
.lcard:hover, .lcard:focus-within { border-color: var(--accent); }
.lopen { display: flex; flex-direction: column; text-align: left; border: 0; background: none; padding: 0; cursor: pointer; color: inherit; min-width: 0; }
.lopen .card-text { padding: 9px 12px 10px; display: grid; gap: 2px; min-width: 0; }
.lopen .nm { font-weight: 700; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lopen .ds { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lopen:hover .nm { color: var(--accent); }
.lacts { position: absolute; top: 6px; right: 6px; display: flex; gap: 2px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 2px; opacity: 0; transition: opacity .15s; }
.lcard:hover .lacts, .lcard:focus-within .lacts { opacity: 1; }
@media (hover: none) { .lacts { opacity: 1; } }
.lacts .btn { padding: 3px 7px; font-size: 13px; }
.share-row { display: flex; gap: 8px; margin: 8px 0 4px; }
.share-row input { flex: 1; min-width: 0; font-family: var(--f-mono); font-size: 12px; border: 1px solid var(--line-strong); border-radius: 7px; padding: 7px 9px; background: var(--surface-2); }
.note.warn { color: var(--ink); background: var(--accent-soft); border-radius: 7px; padding: 7px 10px; }
.toast { position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 60; display: flex; align-items: center; gap: 10px; max-width: min(560px, calc(100vw - 32px)); background: var(--ink); color: var(--bg); padding: 10px 10px 10px 16px; border-radius: 10px; box-shadow: 0 14px 34px -10px rgba(20,27,24,.45); font-size: 13.5px; }
.toast .btn { background: transparent; color: var(--bg); border-color: color-mix(in srgb, var(--bg) 45%, transparent); }
.toast .btn.quiet { border-color: transparent; }
.notes-list { display: grid; gap: 8px; margin-bottom: 10px; }
.note-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 6px; align-items: center; }
.note-row input, .note-row select { min-width: 0; border: 1px solid var(--line-strong); border-radius: 7px; padding: 7px 9px; background: var(--surface); }
.note-row .note-del { padding: 6px 9px; }
#note-add[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }
#chart.placing svg { cursor: crosshair; }
#chart .pw-nh { cursor: move; touch-action: none; }
#chart.dragging, #chart.dragging * { cursor: grabbing !important; user-select: none; }
.place-hint { font-size: 12.5px; font-weight: 600; color: var(--accent-ink); background: var(--accent); padding: 4px 10px; border-radius: 999px; }
@media (max-width: 900px) {
  .editor { grid-template-columns: minmax(0, 1fr); }
  .splitter { display: none; }
  .stage { order: -1; }
  .panel { border-right: 0; border-top: 1px solid var(--line); }
  .panel-scroll { position: static; max-height: none; padding: 18px max(16px, env(safe-area-inset-right, 0px)) 32px max(16px, env(safe-area-inset-left, 0px)); }
  .board { padding: 14px max(16px, env(safe-area-inset-right, 0px)) 14px max(16px, env(safe-area-inset-left, 0px)); }
  .stage-head { padding: 12px max(16px, env(safe-area-inset-right, 0px)) 0 max(16px, env(safe-area-inset-left, 0px)); }
  .chart-frame { padding: 8px; }
  .intro { grid-template-columns: minmax(0, 1fr); }
  .sheet-wrap { max-height: 50vh; }
}
@media (max-width: 560px) {
  .step span { display: none; }
  .step { padding: 6px; }
  .fgrid, .palettes { grid-template-columns: minmax(0, 1fr); }
  .top { gap: 12px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

a.mark { color: inherit; text-decoration: none; }
