:root {
  --paper: #F2F4FA;
  --card: #FFFFFF;
  --ink: #151735;
  --ink-soft: #4A4D72;
  --ink-faint: #8185A8;
  --cobalt: #2B35F5;
  --cobalt-deep: #1A21B8;
  --cobalt-tint: #E3E6FF;
  --tangerine: #FF8A1F;
  --mint: #3BE3B0;
  --line: #D9DCEC;
  --line-soft: #E8EAF4;
  --danger: #D23B3B;
  --display: "Charis SIL", Charter, "Bitstream Charter", Georgia, serif;
  --body: "Charis SIL", Charter, "Bitstream Charter", Georgia, serif;
  --panel-w: 420px;
  --top-h: 64px;
  --ease: cubic-bezier(.2, .8, .2, 1);
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 15px/1.5 var(--body); -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--tangerine); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Top bar ---------- */
.topbar {
  height: var(--top-h); display: flex; align-items: center; gap: 16px;
  padding: 0 20px; background: var(--card); border-bottom: 1px solid var(--line);
  position: relative; z-index: 5;
}
.logo { display: grid; place-items: center; flex: none; }
/* The product name, small, over the visual's name, which is larger and editable. */
.title-block { display: grid; gap: 1px; flex: none; margin-left: -4px; }
.product-name { padding: 0 11px; font-size: 11px; font-weight: 600; line-height: 1.2; letter-spacing: .02em; color: var(--ink-faint); }
.project-name {
  width: 240px; flex: none; border: 1.5px solid transparent; border-radius: 8px;
  padding: 2px 10px 3px; font: 700 17px/1.2 var(--display); letter-spacing: -0.01em; background: transparent;
  text-overflow: ellipsis;
}
.project-name:hover { border-color: var(--line); }
.project-name:focus { border-color: var(--cobalt); outline: none; background: #fff; }
.stepper { list-style: none; display: flex; gap: 4px; margin: 0 auto; padding: 0; counter-reset: s; }
.stepper li { counter-increment: s; }
.stepper button {
  display: flex; align-items: center; gap: 8px; border: 0; background: transparent;
  padding: 7px 12px 7px 7px; border-radius: 999px; font-weight: 600; font-size: 14px; color: var(--ink-faint);
  transition: background .15s, color .15s;
}
.stepper button::before {
  content: counter(s); width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  font: 700 11px/1 var(--display); border: 1.5px solid currentColor;
}
.stepper button:disabled { cursor: not-allowed; opacity: .55; }
.stepper button:not(:disabled):hover { background: var(--paper); color: var(--ink); }
.stepper .done button { color: var(--ink-soft); }
.stepper .done button::before { content: "✓"; background: var(--ink-soft); border-color: var(--ink-soft); color: #fff; font-family: var(--body); font-size: 13px; }
.stepper .current button { background: var(--cobalt-tint); color: var(--cobalt-deep); }
.stepper .current button::before { background: var(--cobalt); border-color: var(--cobalt); color: #fff; content: counter(s); }
.top-actions { display: flex; align-items: center; gap: 4px; flex: none; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 10px; border: 0; background: transparent; color: var(--ink-soft);
  display: grid; place-items: center;
}
.icon-btn:hover:not(:disabled) { background: var(--paper); color: var(--ink); }
.icon-btn:disabled { opacity: .35; cursor: default; }
.save-state { font-size: 13px; color: var(--ink-faint); min-width: 60px; text-align: right; }
@media (max-width: 1180px) { .stepper button span { display: none; } .stepper button { padding: 7px; } }
@media (max-width: 720px) { .project-name { width: 120px; font-size: 15px; } .save-state { display: none; } }

/* ---------- Workspace ---------- */
.workspace { height: calc(100% - var(--top-h)); display: grid; grid-template-columns: var(--panel-w) minmax(0, 1fr); }
.panel { background: var(--card); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.panel-scroll { flex: 1; overflow-y: auto; padding: 28px 28px 32px; }
/* "Step 2 of 7" and the step's name on one line; a long name wraps beside the step number. */
.step-head { display: flex; align-items: baseline; gap: 12px; }
.step-kicker { margin: 0; flex: none; font-size: 13px; font-weight: 600; color: var(--cobalt); letter-spacing: .02em; white-space: nowrap; }
.step-title { margin: 0; min-width: 0; font: 700 24px/1.15 var(--display); letter-spacing: -0.005em; outline: none; }
.step-intro { margin: 10px 0 0; color: var(--ink-soft); }
#stepBody { margin-top: 24px; display: grid; gap: 26px; }
.panel-nav {
  display: flex; align-items: center; gap: 12px; padding: 14px 20px;
  border-top: 1px solid var(--line); background: var(--card);
}
.nav-hint { flex: 1; margin: 0; font-size: 13px; color: var(--ink-faint); text-align: center; line-height: 1.3; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  font-weight: 600; font-size: 15px; line-height: 1; padding: 12px 20px; border-radius: 999px;
  border: 1.5px solid transparent; text-decoration: none; transition: background .15s, transform .1s;
  white-space: nowrap;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn-primary { background: var(--cobalt); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--cobalt-deep); }
.btn-accent { background: var(--tangerine); color: var(--ink); }
.btn-accent:hover:not(:disabled) { background: #FFA04A; }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-ghost:hover:not(:disabled) { border-color: var(--ink); }
.btn-small { padding: 8px 14px; font-size: 14px; }
.btn-block { width: 100%; }
.link-btn { border: 0; background: none; padding: 0; color: var(--cobalt); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Form bits ---------- */
.group { display: grid; gap: 10px; }
.group-label { font-weight: 600; font-size: 14px; display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.group-label small { font-weight: 500; color: var(--ink-faint); font-size: 13px; }
.help { font-size: 13px; color: var(--ink-faint); margin: -4px 0 0; }
.field {
  width: 100%; border: 1.5px solid var(--line); border-radius: 10px; background: #fff;
  padding: 10px 12px; transition: border-color .15s;
}
.field:hover { border-color: #C3C7DE; }
.field:focus { border-color: var(--cobalt); outline: none; box-shadow: 0 0 0 3px var(--cobalt-tint); }
textarea.field { min-height: 150px; resize: vertical; font: 13px/1.5 ui-monospace, "SF Mono", Menlo, monospace; }
.dd-btn.fixed, .dd-btn.member-role { width: auto; min-width: 120px; }
.row { display: flex; gap: 10px; align-items: center; }
.row > * { flex: 1; min-width: 0; }
.row > .fixed { flex: none; }

.seg { display: inline-flex; background: var(--paper); border-radius: 999px; padding: 3px; gap: 2px; border: 1px solid var(--line-soft); }
.seg button { border: 0; background: transparent; border-radius: 999px; padding: 7px 14px; font-weight: 600; font-size: 14px; color: var(--ink-soft); }
.seg button[aria-pressed="true"] { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(21,23,53,.14); }
/* Options the plan can't export with (see proTag in main.js). */
.pro-tag { display: inline-block; margin-left: 5px; padding: 1px 5px; border-radius: 999px; background: var(--tangerine); color: var(--ink); font-size: 10px; font-weight: 700; line-height: 1.4; letter-spacing: .02em; vertical-align: 1px; }
.seg.full { display: flex; }
.seg.full button { flex: 1; }

.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track {
  width: 40px; height: 24px; border-radius: 999px; background: var(--line); position: relative; flex: none;
  transition: background .15s;
}
.switch .track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform .18s var(--ease);
}
.switch input:checked + .track { background: var(--cobalt); }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch input:focus-visible + .track { outline: 3px solid var(--tangerine); outline-offset: 2px; }

.slider-row { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; }
.slider-row output { font: 600 14px/1 var(--body); font-variant-numeric: tabular-nums; min-width: 44px; text-align: right; }
input[type=range] { width: 100%; accent-color: var(--cobalt); }

details.more { border-top: 1px solid var(--line-soft); padding-top: 14px; }
details.more > summary { cursor: pointer; font-weight: 600; font-size: 14px; color: var(--ink-soft); list-style: none; display: flex; align-items: center; gap: 8px; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::before { content: "+"; width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid currentColor; display: grid; place-items: center; font-size: 14px; line-height: 1; }
details.more[open] > summary::before { content: "–"; }
details.more > .group, details.more > div { margin-top: 16px; }
.stack { display: grid; gap: 22px; }

.notice { border-radius: 12px; padding: 12px 14px; font-size: 14px; background: var(--paper); color: var(--ink-soft); display: grid; gap: 4px; }
.notice strong { color: var(--ink); }
.notice.warn { background: #FFF3E6; color: #7A4A12; }
.notice.warn strong { color: #5E3508; }
.notice.bad { background: #FDECEC; color: #8A2323; }

/* ---------- Accordion (one section open per step) ---------- */
#stepBody { gap: 18px; }
.acc { border: 1px solid var(--line); border-radius: 16px; background: #fff; overflow: hidden; }
.acc-item + .acc-item { border-top: 1px solid var(--line); }
.acc-h { margin: 0; font: inherit; }
.acc-h button {
  width: 100%; display: grid; grid-template-columns: auto minmax(0, 1fr) 20px; align-items: center; gap: 12px;
  border: 0; background: transparent; padding: 15px 16px; text-align: left; transition: background .15s;
}
.acc-h button:hover { background: var(--paper); }
.acc-h button:focus-visible { outline-offset: -3px; border-radius: 0; }
.acc-title { font-weight: 700; font-size: 15px; }
.acc-sum { color: var(--ink-faint); font-size: 13px; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acc-chev { width: 20px; height: 20px; display: grid; place-items: center; color: var(--ink-soft); }
.acc-chev::before {
  content: ""; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: translateY(-2px) rotate(45deg); transition: transform .2s var(--ease);
}
.acc-item.open .acc-h button { background: var(--paper); }
.acc-item.open .acc-title { color: var(--cobalt-deep); }
.acc-item.open .acc-sum { visibility: hidden; }
.acc-item.open .acc-chev::before { transform: translateY(2px) rotate(-135deg); }
.acc-panel { padding: 6px 16px 20px; display: grid; gap: 18px; background: var(--paper); animation: accIn .22s var(--ease); }
@keyframes accIn { from { opacity: 0; transform: translateY(-4px); } }
.acc-panel .field, .acc-panel .seg button[aria-pressed="true"], .acc-panel .dropzone { background-color: #fff; }
.acc-panel .seg { background: #E9EBF5; }
.acc-panel .dropzone { border-color: #C3C7DE; }
.acc-panel .loaded-card { background: #fff; }
.acc-panel .notice { background: #fff; }
.export-cta { display: grid; gap: 12px; padding: 16px; border-radius: 16px; background: var(--cobalt-tint); }
.export-cta .notice { background: #fff; }

/* ---------- Step 1: what are you making ---------- */
.kind-cards { display: grid; gap: 10px; }
.kind-card {
  display: grid; grid-template-columns: 92px 1fr auto; gap: 14px; align-items: center; text-align: left;
  border: 1.5px solid var(--line); border-radius: 16px; background: #fff; padding: 10px 14px 10px 10px;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.kind-card:hover { border-color: #A9AEE8; transform: translateY(-1px); }
.kind-card[aria-checked="true"] { border-color: var(--cobalt); box-shadow: 0 0 0 3px var(--cobalt-tint); }
/* Selection circle: empty ring, filled when chosen. */
.kind-radio { width: 20px; height: 20px; border-radius: 50%; border: 2px solid #C3C7DE; background: #fff; transition: border-color .15s, box-shadow .15s; }
.kind-card:hover .kind-radio { border-color: #A9AEE8; }
.kind-card[aria-checked="true"] .kind-radio { border-color: var(--cobalt); background: var(--cobalt); box-shadow: inset 0 0 0 3px #fff; }
.kind-art { display: grid; place-items: center; background: var(--paper); border-radius: 12px; height: 70px; }
.kind-art svg { width: 84px; height: auto; }
.kind-card[aria-checked="true"] .kind-art { background: var(--cobalt-tint); }
.kind-text { display: grid; gap: 4px; }
.kind-text strong { font: 700 16px/1.25 var(--display); letter-spacing: -0.01em; }
.kind-text span { font-size: 13.5px; color: var(--ink-soft); }
.kind-text small { font-size: 12px; font-weight: 600; color: var(--cobalt); }
.kind-card { position: relative; }
/* "Have data? Throw it here": the data-first way in, under the type cards. */
.kind-or { display: flex; align-items: center; gap: 12px; margin: 14px 0; color: var(--ink-faint); font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.kind-or::before, .kind-or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.dropzone.data-first { width: 100%; cursor: pointer; font: inherit; color: inherit; padding: 18px 20px; gap: 6px; }
.dropzone.data-first svg { color: var(--cobalt); }
.dropzone.data-first:hover, .dropzone.data-first:focus-visible { border-color: var(--cobalt); background: var(--cobalt-tint); }

/* Map picker */
.map-list { display: grid; gap: 8px; max-height: 420px; overflow-y: auto; padding: 2px; }
.map-group { margin: 6px 0 0; font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-faint); }
.map-row {
  display: grid; grid-template-columns: 76px 1fr; gap: 12px; align-items: center; text-align: left;
  border: 1.5px solid var(--line); border-radius: 12px; background: #fff; padding: 8px 10px;
}
.map-row:hover { border-color: #A9AEE8; }
.map-row[aria-selected="true"] { border-color: var(--cobalt); box-shadow: 0 0 0 3px var(--cobalt-tint); }
.map-thumb { width: 76px; height: 52px; object-fit: contain; background: var(--paper); border-radius: 8px; padding: 4px; }
.map-text { display: grid; gap: 2px; min-width: 0; }
.map-text strong { font: 700 14px/1.3 var(--display); letter-spacing: -0.01em; }
.map-level { font-weight: 600; color: var(--ink-soft); }
.map-text > span { font-size: 12.5px; color: var(--ink-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.map-match { font-weight: 600; color: var(--ink-soft) !important; }
.map-match.full { color: #0D6B4F !important; }
.map-match.none { color: var(--ink-faint) !important; }

/* Column checklist (tables) */
.order-list li.off { opacity: .6; }
.order-list .check { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.order-list .check input { width: 16px; height: 16px; accent-color: var(--cobalt); }

/* ---------- Step 2: data sources ---------- */
.dropzone {
  border: 2px dashed #C3C7DE; border-radius: 16px; padding: 26px 20px; text-align: center; background: var(--paper);
  display: grid; gap: 10px; justify-items: center; transition: border-color .15s, background .15s;
}
.dropzone.over, body.dragging .dropzone { border-color: var(--cobalt); background: var(--cobalt-tint); }
.dropzone strong { font-size: 16px; }
.dropzone span { color: var(--ink-faint); font-size: 13px; }
.source-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.source-tabs button {
  border: 1.5px solid var(--line); background: #fff; border-radius: 12px; padding: 12px 8px; font-weight: 600; font-size: 13px;
  display: grid; gap: 6px; justify-items: center; color: var(--ink-soft);
}
.source-tabs button svg { color: var(--cobalt); }
.source-tabs button[aria-pressed="true"] { border-color: var(--cobalt); color: var(--ink); background: var(--cobalt-tint); }
.samples { display: grid; gap: 8px; }
.sample-btn {
  display: grid; grid-template-columns: 40px 1fr; gap: 12px; align-items: center; text-align: left;
  border: 1.5px solid var(--line); background: #fff; border-radius: 12px; padding: 10px 12px;
}
.sample-btn:hover { border-color: var(--cobalt); }
.sample-btn .ico { width: 40px; height: 40px; border-radius: 10px; background: var(--paper); display: grid; place-items: center; }
.sample-btn strong { display: block; font-size: 14px; color: var(--ink); }
.sample-btn span { font-size: 13px; color: var(--ink-faint); }
.loaded-card {
  border-radius: 14px; background: var(--paper); padding: 14px 16px; display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center;
}
.loaded-card strong { font-size: 15px; }
.loaded-card span { color: var(--ink-soft); font-size: 13px; grid-column: 1; }
.loaded-card .btn { grid-row: 1 / span 2; grid-column: 2; }

/* ---------- Table view (stage, step 1) ---------- */
.table-view {
  width: 100%; height: 100%; overflow: auto; background: #fff; border-radius: 16px;
  box-shadow: 0 0 0 1px rgba(21,23,53,.08), 0 24px 48px -28px rgba(26,33,184,.35);
}
.dt { border-collapse: separate; border-spacing: 0; min-width: 100%; font-size: 14px; }
.dt th, .dt td { border-bottom: 1px solid var(--line-soft); border-right: 1px solid var(--line-soft); padding: 0; text-align: left; }
.dt thead th { position: sticky; top: 0; background: #fff; z-index: 1; border-bottom: 1.5px solid var(--line); }
.dt .rownum { width: 44px; min-width: 44px; text-align: center; color: var(--ink-faint); font-size: 12px; background: var(--paper); position: sticky; left: 0; z-index: 1; }
.dt thead .rownum { z-index: 2; }
.dt .cell { display: block; padding: 9px 12px; min-width: 110px; outline: none; white-space: nowrap; }
.dt .cell:focus { box-shadow: inset 0 0 0 2px var(--cobalt); background: #FAFBFF; }
.dt td.num .cell { text-align: right; font-variant-numeric: tabular-nums; }
.dt .colhead { display: flex; align-items: center; gap: 8px; padding: 8px 10px 8px 12px; min-width: 130px; }
.dt .colhead .cell { padding: 2px 0; font-weight: 700; min-width: 0; flex: 1; }
.type-badge {
  border: 0; border-radius: 6px; padding: 3px 7px; font-size: 11px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase;
  background: var(--line-soft); color: var(--ink-soft); flex: none;
}
.type-badge.number { background: var(--cobalt-tint); color: var(--cobalt-deep); }
.type-badge.place { background: #DDF8EE; color: #0D6B4F; }
.type-badge.time { background: #FFF1E0; color: #9A4E07; }
.row-del { width: 100%; height: 100%; border: 0; background: none; color: var(--ink-faint); font-size: 12px; padding: 9px 0; }
.dt tr:hover .row-del { color: var(--danger); }
.dt tr:hover .row-del::after { content: " ×"; }
.dt-foot { display: flex; gap: 8px; padding: 12px; position: sticky; left: 0; }
/* The data view draws only visible rows (see drawRows in main.js), so every row must be the same height. */
.dt tbody td { height: 40px; box-sizing: border-box; }
.dt tbody .cell { line-height: 21px; min-height: 21px; overflow: hidden; text-overflow: ellipsis; }
.dt .dt-spacer td { padding: 0; border: 0; height: auto; }
.dt-foot { align-items: center; }
.dt-count { font-size: 13px; color: var(--ink-faint); margin-right: 4px; font-variant-numeric: tabular-nums; }

/* ---------- Step 2: chart cards ---------- */
.chart-search { position: relative; }
.chart-search .ico { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--ink-faint); display: grid; pointer-events: none; }
.chart-search input { padding-left: 34px; font-size: 14px; }
.chart-search input::-webkit-search-cancel-button { cursor: pointer; }

.chart-cards { display: grid; gap: 10px; }
.chart-card {
  display: grid; grid-template-columns: 76px 1fr; gap: 14px; align-items: center; text-align: left;
  border: 1.5px solid var(--line); background: #fff; border-radius: 14px; padding: 12px; position: relative;
  transition: border-color .15s, box-shadow .15s;
}
.chart-card:hover:not(:disabled) { border-color: #A9AEE8; }
.chart-card[aria-pressed="true"] { border-color: var(--cobalt); box-shadow: 0 0 0 3px var(--cobalt-tint); }
.chart-card:disabled { opacity: .5; cursor: not-allowed; }
.chart-card .thumb { width: 76px; height: 60px; border-radius: 10px; background: var(--paper); display: grid; place-items: center; overflow: hidden; }
.chart-card[aria-pressed="true"] .thumb { background: var(--cobalt-tint); }
.chart-card strong { display: block; font: 700 14px/1.3 var(--display); letter-spacing: -0.01em; }
.chart-card span { display: block; font-size: 13px; color: var(--ink-soft); margin-top: 2px; }
.chart-card .why { color: var(--ink-faint); }
.badge { position: absolute; top: -9px; right: 12px; background: var(--tangerine); color: var(--ink); font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px; }

/* ---------- Step 3: fields ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; border: 1.5px solid var(--line); background: #fff;
  border-radius: 999px; padding: 6px 12px 6px 8px; font-weight: 600; font-size: 14px; cursor: grab; user-select: none;
  touch-action: none;
}
.chip:active { cursor: grabbing; }
.chip .dot { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: 10px; font-weight: 800; }
.chip[data-type="number"] .dot { background: var(--cobalt-tint); color: var(--cobalt-deep); }
.chip[data-type="text"] .dot { background: var(--line-soft); color: var(--ink-soft); }
.chip[data-type="place"] .dot { background: #DDF8EE; color: #0D6B4F; }
.chip[data-type="time"] .dot { background: #FFF1E0; color: #9A4E07; }
.chip.used { opacity: .45; }
.chip[aria-pressed="true"] { border-color: var(--cobalt); box-shadow: 0 0 0 3px var(--cobalt-tint); }
.chip.dragging { opacity: .3; }
.drag-ghost { position: fixed; pointer-events: none; z-index: 50; transform: translate(-50%, -50%) rotate(-3deg); box-shadow: 0 12px 24px -8px rgba(21,23,53,.35); cursor: grabbing; }
.slots { display: grid; gap: 12px; }
.slot {
  border: 2px dashed var(--line); border-radius: 14px; padding: 12px 14px; display: grid; gap: 8px;
  transition: border-color .15s, background .15s;
}
.slot.filled { border-style: solid; border-color: var(--line-soft); background: var(--paper); }
.slot.over { border-color: var(--cobalt); background: var(--cobalt-tint); border-style: dashed; }
.slot.can-drop { border-color: #A9AEE8; }
.slot.bad { border-color: #F0B5B5; }
.slot-head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.slot-head strong { font-size: 14px; }
.slot-head small { color: var(--ink-faint); font-size: 12px; }
.slot-body { display: flex; align-items: center; gap: 8px; min-height: 36px; }
.slot-body .placeholder { color: var(--ink-faint); font-size: 14px; flex: 1; }
.slot-body .slot-pick.wide { flex: 1; }
.slot-body .chip { cursor: default; }
.slot-clear { border: 0; background: none; color: var(--ink-faint); font-size: 18px; width: 28px; height: 28px; border-radius: 8px; flex: none; }
.slot-clear:hover { background: #fff; color: var(--danger); }
.slot-preview { font-size: 12px; color: var(--ink-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Step 4: style ---------- */
.themes { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.theme-btn { border: 1.5px solid var(--line); border-radius: 12px; padding: 6px 6px 8px; background: #fff; display: grid; gap: 6px; font-size: 12px; font-weight: 600; color: var(--ink-soft); }
.theme-btn i { display: block; height: 42px; border-radius: 8px; position: relative; overflow: hidden; }
.theme-btn i::after { content: ""; position: absolute; left: 10px; bottom: 8px; width: 8px; height: 22px; border-radius: 2px; background: var(--c1); box-shadow: 12px 6px 0 var(--c1), 24px -4px 0 var(--c2); }
.theme-btn[aria-pressed="true"] { border-color: var(--cobalt); box-shadow: 0 0 0 3px var(--cobalt-tint); color: var(--ink); }
.themes.looks { grid-template-columns: repeat(3, 1fr); }
.themes.looks .theme-btn i { height: 54px; }
.themes.looks .theme-btn small { display: block; font-size: 11px; font-weight: 500; line-height: 1.3; color: var(--ink-faint); }
.checker { background-color: #fff; background-image: linear-gradient(45deg, #E4E6F0 25%, transparent 25%), linear-gradient(-45deg, #E4E6F0 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #E4E6F0 75%), linear-gradient(-45deg, transparent 75%, #E4E6F0 75%); background-size: 14px 14px; background-position: 0 0, 0 7px, 7px -7px, -7px 0; }
.palettes { display: flex; flex-wrap: wrap; gap: 8px; }
.pal-btn { border: 1.5px solid var(--line); border-radius: 999px; padding: 5px; background: #fff; display: flex; gap: 0; }
.pal-btn i { width: 20px; height: 20px; border-radius: 50%; display: block; margin-left: -5px; border: 2px solid #fff; }
.pal-btn i:first-child { margin-left: 0; }
.pal-btn[aria-pressed="true"] { border-color: var(--cobalt); box-shadow: 0 0 0 3px var(--cobalt-tint); }
.color-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
/* ---------- Our dropdowns and color picker (nothing drawn by the browser) ---------- */
.dd-btn {
  display: flex; align-items: center; gap: 8px; width: 100%; min-height: 42px; text-align: left;
  border: 1.5px solid var(--line); border-radius: 10px; background: #fff; padding: 9px 12px; font-size: 14px; color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
.dd-btn:hover { border-color: #C3C7DE; }
.dd-btn:focus-visible, .dd-btn[aria-expanded="true"] { border-color: var(--cobalt); outline: none; box-shadow: 0 0 0 3px var(--cobalt-tint); }
.dd-value { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.dd-value.empty { color: var(--ink-faint); font-weight: 400; }
.dd-arrow { display: grid; color: var(--ink-soft); transition: transform .15s; }
.dd-btn[aria-expanded="true"] .dd-arrow { transform: rotate(180deg); }
.dd-btn.icon { width: 36px; min-height: 36px; padding: 0; justify-content: center; flex: none; }
.pop {
  position: fixed; z-index: 60; background: #fff; border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 18px 40px -12px rgba(21,23,53,.35), 0 2px 6px rgba(21,23,53,.08);
}
.dd-list { list-style: none; margin: 0; padding: 6px; overflow-y: auto; outline: none; max-width: min(360px, calc(100vw - 16px)); }
.dd-opt { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding: 9px 10px; border-radius: 8px; cursor: pointer; font-size: 15px; }
.dd-opt small { color: var(--ink-faint); font-size: 12px; font-family: var(--body); white-space: nowrap; }
.dd-opt.active { background: var(--paper); }
.dd-opt[aria-selected="true"] { color: var(--cobalt); font-weight: 600; }
.dd-opt[aria-selected="true"]::after { content: "✓"; font-weight: 700; }
.dd-opt[aria-selected="true"] small { display: none; }
.cp-btn {
  display: flex; align-items: center; gap: 10px; width: 100%; border: 1.5px solid var(--line); border-radius: 10px;
  background: #fff; padding: 6px 12px 6px 6px; font-size: 14px; font-weight: 500; color: var(--ink); text-align: left;
}
.cp-btn:hover { border-color: #C3C7DE; }
.cp-btn:focus-visible, .cp-btn[aria-expanded="true"] { border-color: var(--cobalt); outline: none; box-shadow: 0 0 0 3px var(--cobalt-tint); }
.cp-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cp-code { font: 600 12px/1 ui-monospace, "SF Mono", Menlo, monospace; color: var(--ink-faint); }
.cp-chip { width: 30px; height: 30px; flex: none; border-radius: 8px; box-shadow: inset 0 0 0 1px rgba(21,23,53,.18); }
.cp-pop { width: 248px; padding: 12px; display: grid; gap: 12px; }
.cp-sv { position: relative; height: 150px; border-radius: 8px; cursor: crosshair; touch-action: none; outline: none; }
.cp-sv:focus-visible { box-shadow: 0 0 0 3px var(--cobalt-tint); }
.cp-dot { position: absolute; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%; border: 2.5px solid #fff; box-shadow: 0 0 0 1px rgba(21,23,53,.4), 0 2px 6px rgba(0,0,0,.3); pointer-events: none; }
.cp-hue { position: relative; height: 14px; border-radius: 999px; cursor: pointer; touch-action: none; outline: none;
  background: linear-gradient(to right, #f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00); }
.cp-hue:focus-visible { box-shadow: 0 0 0 3px var(--cobalt-tint); }
.cp-knob { position: absolute; top: 50%; width: 18px; height: 18px; margin: -9px 0 0 -9px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 1px rgba(21,23,53,.35), 0 2px 6px rgba(0,0,0,.25); pointer-events: none; }
.cp-row { display: flex; gap: 8px; align-items: center; }
.cp-chip.big { width: 38px; height: 38px; }
.cp-hex { font: 600 14px/1 ui-monospace, "SF Mono", Menlo, monospace; text-transform: uppercase; padding: 10px; }
.cp-swatches { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
.cp-swatch { aspect-ratio: 1; border: 0; border-radius: 6px; box-shadow: inset 0 0 0 1px rgba(21,23,53,.18); cursor: pointer; }
.cp-swatch:hover { transform: scale(1.1); }
/* Font picker: search, category tabs and a long list that only draws the rows in view. */
.fp-pop { width: 330px; padding: 10px; display: flex; flex-direction: column; gap: 8px; overflow: hidden; }
.fp-search { padding: 9px 12px; }
.fp-tabs { display: flex; flex-wrap: wrap; gap: 4px; }
.fp-tabs button { border: 0; background: var(--paper); border-radius: 999px; padding: 5px 10px; font-size: 12.5px; font-weight: 600; color: var(--ink-soft); }
.fp-tabs button[aria-selected="true"] { background: var(--cobalt); color: #fff; }
.fp-list { position: relative; height: 340px; min-height: 120px; flex: 1 1 auto; overflow-y: auto; outline: none; margin: 0 -4px; }
.fp-inner { position: relative; }
.fp-head, .fp-row { position: absolute; left: 4px; right: 4px; height: 38px; display: flex; align-items: center; }
.fp-head { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-faint); padding: 10px 8px 0; font-family: var(--body); }
.fp-row { justify-content: space-between; gap: 12px; padding: 0 10px; border-radius: 8px; cursor: pointer; }
.fp-row span { font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fp-row small { flex: none; font: 12px var(--body); color: var(--ink-faint); }
.fp-row.active { background: var(--paper); }
.fp-row[aria-selected="true"] { color: var(--cobalt); }
.fp-row[aria-selected="true"] small { display: none; }
.fp-row[aria-selected="true"]::after { content: "✓"; font-weight: 700; font-family: var(--body); }
.fp-status { margin: 0; font-size: 13px; color: var(--ink-faint); text-align: center; }

/* Search boxes: no browser-drawn clear button. */
input[type=search]::-webkit-search-cancel-button, input[type=search]::-webkit-search-decoration { -webkit-appearance: none; appearance: none; }
.order-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.order-list li {
  display: grid; grid-template-columns: 22px 1fr auto; gap: 10px; align-items: center; background: var(--paper);
  border-radius: 10px; padding: 8px 10px; font-size: 14px; user-select: none; touch-action: none;
}
.order-list li.dragging { opacity: .35; }
.order-list li.drop-before { box-shadow: 0 -3px 0 var(--cobalt); }
.order-list li.drop-after { box-shadow: 0 3px 0 var(--cobalt); }
.order-list .handle { cursor: grab; color: var(--ink-faint); display: grid; place-items: center; border: 0; background: none; padding: 0; height: 24px; }
.order-list .handle:focus-visible { color: var(--cobalt); }
.order-list .val { color: var(--ink-faint); font-variant-numeric: tabular-nums; font-size: 13px; }

/* ---------- Step 6: export ---------- */
.dest-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.dest {
  border: 1.5px solid var(--line); border-radius: 12px; background: #fff; padding: 12px; text-align: left; display: grid; gap: 8px;
}
.dest i { display: block; background: var(--cobalt-tint); border-radius: 4px; border: 1.5px solid var(--cobalt); }
.dest strong { font-size: 14px; display: block; }
.dest span { font-size: 12px; color: var(--ink-faint); }
.dest[aria-pressed="true"] { border-color: var(--cobalt); box-shadow: 0 0 0 3px var(--cobalt-tint); }
.progress { height: 8px; border-radius: 99px; background: var(--line-soft); overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; background: var(--cobalt); border-radius: 99px; transition: width .2s; }
.export-result { display: grid; gap: 10px; }
.summary-list { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 14px; }
.summary-list dt { color: var(--ink-faint); }
.summary-list dd { margin: 0; font-weight: 600; }

/* ---------- Stage ---------- */
.stage { display: flex; flex-direction: column; min-width: 0; min-height: 0; padding: 18px 28px 20px; gap: 14px; }
.stage-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stage-note { font-size: 13px; color: var(--ink-faint); }
.stage-warn { margin: -6px 0 0; padding: 7px 12px; border-radius: 10px; font-size: 13px; line-height: 1.4; background: #FFF3E6; color: #7A4A12; }
.stage-body { flex: 1; min-height: 0; display: grid; place-items: center; position: relative; }
.frame {
  position: relative; border-radius: 16px; overflow: hidden; background: #fff;
  box-shadow: 0 0 0 1px rgba(21,23,53,.08), 0 30px 60px -30px rgba(26,33,184,.45);
}
.frame canvas { display: block; width: 100%; height: 100%; }
/* Style step: the settings for the text selected on the preview. */
.inspector-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-radius: 12px; background: var(--cobalt-tint); }
.inspector-head strong { display: block; font: 700 16px/1.25 var(--display); overflow-wrap: anywhere; }
.inspector-head small { font-size: 12.5px; color: var(--cobalt); font-weight: 600; }

/* Keyboard shortcuts for moving text (Style → Move and resize text). */
.shortcuts { display: grid; grid-template-columns: auto 1fr; gap: 6px 10px; margin: 2px 0 0; font-size: 12.5px; align-items: center; }
.shortcuts dt { margin: 0; }
.shortcuts dd { margin: 0; color: var(--ink-faint); }
.shortcuts kbd { display: inline-block; font: 600 11.5px/1 var(--body); padding: 4px 7px; border-radius: 6px; background: var(--paper); border: 1px solid var(--line); border-bottom-width: 2px; color: var(--ink-soft); white-space: nowrap; }

/* Hovering the watermark on a Free visual. */
.brand-tip {
  position: absolute; z-index: 3; pointer-events: none; white-space: nowrap;
  background: var(--ink); color: #fff; font-size: 12.5px; font-weight: 600; padding: 7px 11px; border-radius: 8px;
  box-shadow: 0 8px 20px -8px rgba(21,23,53,.5);
}
.brand-tip::after { content: ""; position: absolute; right: 18px; bottom: -5px; width: 10px; height: 10px; background: var(--ink); transform: rotate(45deg); }
/* Selected text on the preview (Style step): drag inside to move, drag a corner to resize. */
.text-sel { position: absolute; border: 1.5px solid var(--cobalt); border-radius: 4px; pointer-events: none; box-shadow: 0 0 0 1px rgba(255,255,255,.85); }
.text-sel span { position: absolute; width: 11px; height: 11px; background: #fff; border: 1.5px solid var(--cobalt); border-radius: 3px; pointer-events: auto; }
.text-sel [data-h="nw"] { left: -7px; top: -7px; cursor: nwse-resize; }
.text-sel [data-h="ne"] { right: -7px; top: -7px; cursor: nesw-resize; }
.text-sel [data-h="sw"] { left: -7px; bottom: -7px; cursor: nesw-resize; }
.text-sel [data-h="se"] { right: -7px; bottom: -7px; cursor: nwse-resize; }
.frame.transparent { background-color: #fff; }
.frame-empty, .frame-loading {
  position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 8px; text-align: center;
  background: #fff; color: var(--ink-soft); padding: 20px;
}
.frame-empty strong { font: 700 17px/1.3 var(--display); color: var(--ink); margin-top: 8px; }
/* Loading (setLoading in main.js). Only transform and opacity animate, which the browser runs off the main
   thread, so the bars keep moving while a big file is parsed. */
.stage-loading {
  position: absolute; inset: 0; z-index: 6; display: grid; place-content: center; justify-items: center; gap: 8px;
  text-align: center; padding: 20px; border-radius: 16px;
  background: radial-gradient(ellipse at 50% 42%, rgba(255,255,255,.97) 0%, rgba(246,247,252,.94) 55%, rgba(236,239,250,.92) 100%);
  animation: ld-in .3s var(--ease) both;
}
@keyframes ld-in { from { opacity: 0; } }
.ld-bars { position: relative; display: flex; align-items: flex-end; gap: 8px; height: 68px; margin-bottom: 14px; }
.ld-bars::after { content: ""; position: absolute; left: -12px; right: -12px; bottom: -6px; height: 2px; border-radius: 2px; background: var(--line); }
.ld-bars i {
  width: 14px; height: 68px; border-radius: 6px 6px 3px 3px; transform-origin: 50% 100%; will-change: transform;
  animation: ld-bar 1.5s cubic-bezier(.45, 0, .2, 1) infinite; box-shadow: 0 8px 16px -8px rgba(43, 53, 245, .55);
}
.ld-bars i:nth-child(1) { background: var(--cobalt); animation-delay: -1.5s; }
.ld-bars i:nth-child(2) { background: #5E66FF; animation-delay: -1.3s; }
.ld-bars i:nth-child(3) { background: var(--tangerine); animation-delay: -1.1s; box-shadow: 0 8px 16px -8px rgba(255, 138, 31, .6); }
.ld-bars i:nth-child(4) { background: var(--mint); animation-delay: -.9s; box-shadow: 0 8px 16px -8px rgba(59, 227, 176, .6); }
.ld-bars i:nth-child(5) { background: var(--cobalt-deep); animation-delay: -.7s; }
@keyframes ld-bar { 0%, 100% { transform: scaleY(.22); } 50% { transform: scaleY(1); } }
.ld-title { font: 700 17px/1.3 var(--display); color: var(--ink); }
.ld-detail { font-size: 14px; color: var(--ink-soft); font-variant-numeric: tabular-nums; min-height: 1.4em; }
.ld-detail:empty { display: none; }
/* Four captions take turns, 2.2 s each: fade up, hold, fade away (setLoading always supplies four). */
.ld-tips { position: relative; width: min(320px, 80vw); height: 20px; margin-top: 2px; }
.ld-tips span { position: absolute; inset: 0; font-size: 13px; color: var(--ink-faint); opacity: 0; will-change: transform, opacity; animation: ld-tip 8.8s infinite both; }
.ld-tips span:nth-child(2) { animation-delay: 2.2s; }
.ld-tips span:nth-child(3) { animation-delay: 4.4s; }
.ld-tips span:nth-child(4) { animation-delay: 6.6s; }
@keyframes ld-tip {
  0% { opacity: 0; transform: translateY(6px); }
  3%, 22% { opacity: 1; transform: none; }
  25%, 100% { opacity: 0; transform: translateY(-6px); }
}
/* Small bars for inline progress (exports). */
.ld-bars.small { height: 16px; gap: 3px; margin: 0; flex: none; }
.ld-bars.small::after { display: none; }
.ld-bars.small i { width: 4px; height: 16px; border-radius: 2px; box-shadow: none; }
.export-status { display: flex; align-items: center; gap: 10px; }
@keyframes spin { to { transform: rotate(360deg); } }
.stage-body .table-view { position: absolute; inset: 0; }
.scrubber { display: flex; align-items: center; gap: 12px; }
.scrubber button { width: 38px; height: 38px; border-radius: 50%; border: 0; background: var(--ink); color: #fff; display: grid; place-items: center; flex: none; }
.scrubber input { flex: 1; }
.time { font-weight: 500; font-size: 14px; color: var(--ink-soft); font-variant-numeric: tabular-nums; min-width: 88px; text-align: right; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff;
  padding: 12px 18px; border-radius: 12px; font-weight: 500; font-size: 14px; z-index: 60;
  box-shadow: 0 12px 30px -10px rgba(21,23,53,.5); max-width: min(520px, calc(100% - 32px));
}

/* ---------- Small screens ---------- */
@media (max-width: 900px) {
  body { overflow: auto; }
  .topbar { flex-wrap: wrap; height: auto; padding: 10px 16px; row-gap: 8px; }
  .stepper { order: 3; width: 100%; justify-content: space-between; margin: 0; }
  .workspace { height: auto; display: flex; flex-direction: column-reverse; }
  .stage { padding: 14px 16px; position: sticky; top: 0; z-index: 4; background: var(--paper); height: 46vh; border-bottom: 1px solid var(--line); }
  .panel { border-right: 0; }
  .panel-scroll { overflow: visible; padding: 22px 16px; }
  .panel-nav { position: sticky; bottom: 0; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ---------- Account ---------- */
.account-slot { display: flex; align-items: center; gap: 8px; margin-left: 8px; }
.account-wrap { position: relative; }
.avatar-btn { width: 36px; height: 36px; border-radius: 50%; border: 0; padding: 0; overflow: hidden; background: var(--cobalt); color: #fff;
  font: 700 12px/1 var(--display); display: grid; place-items: center; }
.avatar-btn img { width: 100%; height: 100%; object-fit: cover; }
.account-menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 230px; background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; box-shadow: 0 16px 40px rgba(21, 23, 53, .16); padding: 6px; display: grid; z-index: 20; }
.account-menu button { text-align: left; border: 0; background: none; padding: 9px 12px; border-radius: 8px; font-weight: 500; }
.account-menu button:hover, .account-menu button:focus-visible { background: var(--paper); }
.account-menu hr { border: 0; border-top: 1px solid var(--line-soft); margin: 4px 0; }
.account-who { padding: 10px 12px; display: grid; gap: 2px; border-bottom: 1px solid var(--line-soft); margin-bottom: 4px; }
.account-who span { font-size: 13px; color: var(--ink-faint); overflow: hidden; text-overflow: ellipsis; }
.account-who .trial-line { margin-top: 4px; color: var(--ink-soft); font-weight: 600; white-space: normal; }
@media (max-width: 720px) { .account-slot .btn { display: none; } }

.visuals-dialog { width: min(920px, calc(100vw - 32px)); max-height: min(720px, calc(100vh - 48px)); border: 0; border-radius: 18px; padding: 0;
  background: var(--card); color: var(--ink); box-shadow: 0 30px 80px rgba(21, 23, 53, .3); }
.visuals-dialog::backdrop { background: rgba(21, 23, 53, .45); }
.visuals-dialog[open] { display: flex; flex-direction: column; }
.visuals-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 12px; }
.visuals-head h2 { margin: 0; font: 700 20px/1.2 var(--display); letter-spacing: -0.005em; }
.visuals-head form { margin: 0; }
.quick-start { display: grid; gap: 8px; margin-top: 6px; }
.quick-start .group-label { margin: 0; }
.join-dialog { width: min(440px, calc(100vw - 32px)); }
.join-body { display: grid; gap: 14px; padding: 0 20px 22px; }
.join-lede { margin: 0; font-size: 15px; color: var(--ink); }
.join-list { margin: 0; padding-left: 20px; display: grid; gap: 6px; color: var(--ink-soft); font-size: 14px; }
.join-alt { margin: 0; text-align: center; }
.visuals-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; padding: 4px 20px 24px; overflow-y: auto; }
.visual-card { position: relative; border: 1.5px solid var(--line); border-radius: 14px; overflow: hidden; background: #fff; transition: border-color .15s, box-shadow .15s; }
.visual-card:hover { border-color: var(--ink-faint); box-shadow: 0 8px 20px rgba(21, 23, 53, .08); }
.visual-card.current { border-color: var(--cobalt); }
button.visual-card, .visual-open { display: grid; width: 100%; border: 0; background: none; padding: 0; text-align: left; }
button.visual-card { border: 1.5px dashed var(--line); }
.visual-card .thumb { aspect-ratio: 16 / 9; background: var(--paper); display: grid; place-items: center; overflow: hidden; font: 700 32px/1 var(--display); color: var(--cobalt); }
.visual-card .thumb img { width: 100%; height: 100%; object-fit: contain; }
.visual-card .meta { display: grid; gap: 2px; padding: 10px 12px 12px; }
.visual-card .meta strong { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.visual-card .meta small { font-size: 12px; color: var(--ink-faint); }
.visual-del { position: absolute; top: 8px; right: 8px; min-width: 28px; height: 28px; padding: 0 8px; border-radius: 999px; border: 0;
  background: rgba(255, 255, 255, .92); color: var(--ink-soft); font-weight: 700; opacity: 0; transition: opacity .15s; }
.visual-card:hover .visual-del, .visual-del:focus-visible, .visual-del[data-armed="1"] { opacity: 1; }
.visual-del[data-armed="1"] { background: var(--danger); color: #fff; font-size: 12px; }
@media (hover: none) { .visual-del { opacity: 1; } }
.form-error { margin: 0; padding: 10px 12px; border-radius: 10px; background: #FDECEC; color: #9E2323; font-size: 14px; }

/* ---------- Picture bars ---------- */
.pic-thumb { width: 44px; height: 44px; flex: none; border-radius: 10px; background: var(--paper); display: grid; place-items: center; overflow: hidden; color: var(--ink-faint); }
.pic-thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.pic-row { display: flex; align-items: center; gap: 12px; }
.pic-row.main .pic-thumb { width: 56px; height: 56px; }
.pic-name { flex: 1; min-width: 0; display: grid; font-weight: 600; }
.pic-name strong, .pic-name small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pic-name small { font-weight: 500; font-size: 13px; color: var(--ink-faint); }
.pic-list { display: grid; gap: 10px; max-height: 360px; overflow-y: auto; padding-right: 4px; }

.picture-dialog { width: min(980px, calc(100vw - 32px)); }
.pic-tools { display: grid; gap: 12px; padding: 0 20px 12px; border-bottom: 1px solid var(--line-soft); }
.pic-cats { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-btn { border: 1.5px solid var(--line); background: #fff; border-radius: 999px; padding: 6px 12px; font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.chip-btn:hover { border-color: var(--ink-faint); }
.chip-btn[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.pic-body { overflow-y: auto; padding: 8px 20px 24px; }
.pic-h { font-size: 15px; margin: 16px 0 10px; }
.pic-upload { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 12px; }
.pic-cut { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-soft); }
.pic-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
.pic-tile { position: relative; }
.pic-pick { width: 100%; border: 1.5px solid var(--line); background: #fff; border-radius: 12px; padding: 10px 6px 8px; display: grid; gap: 6px; justify-items: center; transition: border-color .15s, box-shadow .15s; }
.pic-pick:hover { border-color: var(--ink-faint); box-shadow: 0 6px 16px rgba(21, 23, 53, .08); }
.pic-tile.current .pic-pick { border-color: var(--cobalt); box-shadow: 0 0 0 3px var(--cobalt-tint); }
.pic-img { height: 88px; display: grid; place-items: end center; }
.pic-img img { max-height: 88px; max-width: 90px; object-fit: contain; }
.pic-label { font-size: 12px; font-weight: 600; color: var(--ink-soft); text-align: center; line-height: 1.2; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.pic-del { position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .95); color: var(--ink-soft); font-weight: 700; box-shadow: 0 1px 4px rgba(0,0,0,.15); }
.pic-del:hover { background: var(--danger); color: #fff; }

/* ---------- Brand kits ---------- */
.kit-list { display: grid; gap: 10px; }
.kit-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 4px 12px; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 12px; }
.kit-row.current { border-color: var(--cobalt); box-shadow: 0 0 0 3px var(--cobalt-tint); }
.kit-swatch { display: inline-flex; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); }
.kit-swatch i { width: 14px; height: 30px; }
.kit-name { display: grid; min-width: 0; }
.kit-name strong, .kit-name small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kit-name small { font-size: 12px; color: var(--ink-faint); }
.kit-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; }
.link-btn.danger { color: var(--danger); }
.row .fixed { flex: none; }

/* ---------- Series ---------- */
.series-badge { margin: 0; padding: 10px 12px; border-radius: 10px; background: var(--cobalt-tint); color: var(--cobalt-deep); }
.gallery-h { grid-column: 1 / -1; margin: 6px 0 -4px; font-size: 14px; color: var(--ink-soft); }
.series-card { border-color: var(--cobalt); }
.series-card .thumb { font-size: 26px; }
.series-actions { display: flex; gap: 6px; padding: 0 12px 12px; }
.episode-dialog { width: min(620px, calc(100vw - 32px)); }
.ep-body { display: grid; gap: 12px; padding: 0 20px 22px; overflow-y: auto; }
.ep-lede { margin: 0; color: var(--ink-soft); }
.ep-option { display: grid; gap: 6px; padding: 14px; border: 1.5px solid var(--line); border-radius: 14px; justify-items: start; }
.ep-option.main { border-color: var(--cobalt); background: #F7F8FF; }
.ep-option .help { margin: 0; }
.ep-option textarea { min-height: 90px; }

/* ---------- Teams and working together ---------- */
.menu-label { padding: 8px 12px 2px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-faint); }
.account-menu .ws-item { display: flex; align-items: center; gap: 8px; }
.ws-item .ws-check { width: 14px; color: var(--cobalt); font-weight: 700; }
.ws-item small { margin-left: auto; font-size: 11px; color: var(--ink-faint); text-transform: capitalize; }
.presence { display: flex; align-items: center; gap: 0; margin-right: 6px; }
.presence-dot { width: 28px; height: 28px; border-radius: 50%; border: 2px solid #fff; background: var(--tangerine); color: var(--ink); font: 700 11px/1 var(--display); display: grid; place-items: center; overflow: hidden; margin-left: -6px; flex: none; }
.presence-dot:first-child { margin-left: 0; }
.presence-dot img { width: 100%; height: 100%; object-fit: cover; }
.presence-text { margin-left: 8px; font-size: 12px; color: var(--ink-soft); white-space: nowrap; }
@media (max-width: 1180px) { .presence-text { display: none; } }
.collab-banner { position: fixed; top: calc(var(--top-h) + 10px); left: 50%; transform: translateX(-50%); z-index: 30; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center;
  max-width: calc(100vw - 32px); padding: 10px 14px; border-radius: 14px; background: var(--ink); color: #fff; box-shadow: 0 16px 40px rgba(21, 23, 53, .3); font-size: 14px; }
.collab-banner .btn-ghost { color: #fff; border-color: rgba(255, 255, 255, .35); }
.collab-banner .btn-ghost:hover { border-color: #fff; }
.comments-btn .count { min-width: 20px; height: 20px; border-radius: 999px; background: var(--tangerine); color: var(--ink); font-size: 12px; display: inline-grid; place-items: center; padding: 0 6px; }
.comments-drawer { position: fixed; inset: var(--top-h) 0 0 auto; margin: 0; width: min(380px, 100vw); height: calc(100vh - var(--top-h)); max-height: none; border: 0; border-left: 1px solid var(--line);
  padding: 0; background: var(--card); color: var(--ink); z-index: 25; box-shadow: -16px 0 40px rgba(21, 23, 53, .12); }
.comments-drawer[open] { display: flex; flex-direction: column; }
.cm-list { flex: 1; overflow-y: auto; padding: 4px 16px; display: grid; gap: 10px; align-content: start; }
.cm-item { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.cm-item.resolved { opacity: .6; }
.cm-item p { margin: 6px 0; white-space: pre-wrap; }
.cm-head { display: flex; align-items: center; gap: 8px; }
.cm-head small { color: var(--ink-faint); font-size: 12px; }
.cm-time { margin-left: auto; border: 0; background: var(--cobalt-tint); color: var(--cobalt-deep); border-radius: 999px; padding: 2px 8px; font-size: 12px; font-weight: 700; }
.cm-actions { display: flex; gap: 12px; align-items: center; font-size: 13px; }
.cm-actions small { color: var(--ink-faint); }
.cm-compose { display: grid; gap: 8px; padding: 12px 16px 16px; border-top: 1px solid var(--line); }
.team-dialog { width: min(640px, calc(100vw - 32px)); }
.team-body { display: grid; gap: 18px; padding: 0 20px 22px; overflow-y: auto; }
.team-lede { margin: 0; color: var(--ink-soft); }
.team-meta { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; font-size: 14px; color: var(--ink-soft); }
.plan-pill { background: var(--ink); color: #fff; border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: 700; }
.member-list { display: grid; gap: 8px; }
.member-row { display: flex; align-items: center; gap: 12px; }
.member-row .presence-dot { margin-left: 0; width: 34px; height: 34px; }
.member-name { flex: 1; min-width: 0; display: grid; }
.member-name small { color: var(--ink-faint); font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
.member-role { width: auto; padding: 6px 30px 6px 10px; font-size: 13px; }
.member-badge { font-size: 13px; color: var(--ink-soft); }
.invite-row .field[type=email] { flex: 1; }
.invite-link { display: grid; gap: 8px; padding: 12px; border-radius: 12px; background: var(--cobalt-tint); }
.invite-link p { margin: 0; font-size: 14px; }
.danger-zone summary { cursor: pointer; color: var(--danger); font-weight: 600; font-size: 14px; }
.danger-zone { display: grid; gap: 8px; }
.danger-btn { background: var(--danger); color: #fff; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.two-col > .group { min-width: 0; }
@media (max-width: 600px) { .two-col { grid-template-columns: 1fr; } }
.sales-done { text-align: center; padding: 12px 0 8px; }
.sales-done h3 { margin: 0 0 8px; font-size: 20px; }
.sales-done p { margin: 0; color: var(--ink-soft); }

/* ---------- 2D switch + snapshot ---------- */
#dimSeg { margin-left: 8px; }
.snap-wrap { position: relative; }
.snap-menu { position: absolute; right: 0; bottom: calc(100% + 8px); min-width: 210px; background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 16px 40px rgba(21, 23, 53, .16); padding: 6px; display: grid; z-index: 20; }
.snap-menu button { text-align: left; border: 0; background: none; padding: 9px 12px; border-radius: 8px; font-weight: 500; }
.snap-menu button:hover, .snap-menu button:focus-visible { background: var(--paper); }

/* ---------- Public page and embed (player mode: window.IC_PUBLIC, see server/public-pages.js) ---------- */
/* The visual's text and data, for readers and search engines. Hidden in the embed; shown under the chart on the page. */
.public-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.player .topbar, .player .collab-banner, .player .panel, .player .stage-bar, .player .snap-wrap, .player #textSel, .player .stage-warn { display: none !important; }
.player .workspace { display: block; }
.player .stage { position: static; height: 100%; padding: 12px 16px 14px; border: 0; background: none; }
.player-embed body { background: transparent; }
.player-embed .workspace { height: 100%; }
.player-embed .stage { padding: 0 0 6px; gap: 6px; }
.player-embed .scrubber { padding: 0 8px; gap: 8px; }
.player-embed .scrubber button { width: 30px; height: 30px; }
.player-embed .scrubber .time { font-size: 12px; }

.player-page body { height: auto; min-height: 100%; overflow: auto; display: flex; flex-direction: column; }
.player-page .workspace { order: 1; height: calc(100svh - 64px); min-height: 320px; }
.public-bar { order: 0; display: flex; align-items: center; gap: 12px; height: 64px; padding: 0 24px; background: var(--card); border-bottom: 1px solid var(--line); flex: none; }
.public-bar .public-home img { display: block; }
.public-bar .title-block { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.public-bar .product-name { font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-faint); }
.public-bar .public-name { font-weight: 700; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.public-bar .public-actions { margin-left: auto; display: flex; gap: 8px; flex: none; }
.player-page .public-text { order: 2; position: static; width: 100%; height: auto; overflow: visible; clip: auto; white-space: normal;
  max-width: 1000px; margin: 8px auto 48px; padding: 0 24px; }
.player-page .public-text h1 { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.player-page .public-text > p { color: var(--ink-soft); margin: 0 0 12px; }
.player-page .public-text table { display: block; max-height: 420px; overflow: auto; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: 12px; font-size: 14px; margin-bottom: 12px; }
.player-page .public-text caption { text-align: left; font-weight: 700; padding: 12px 14px 4px; }
.player-page .public-text th, .player-page .public-text td { padding: 7px 14px; text-align: left; border-bottom: 1px solid var(--line-soft); white-space: nowrap; }
.player-page .public-text th { position: sticky; top: 0; background: var(--card); font-weight: 700; }
@media (max-width: 600px) {
  .public-bar { padding: 0 16px; }
  .public-bar .btn-ghost { display: none; }
  .player-page .workspace { height: auto; aspect-ratio: auto; min-height: 0; }
  .player-page .stage { height: 70svh; }
  .player-page .public-text { padding: 0 16px; }
}

/* Public link and embed code (Export step) */
.share-row { display: flex; align-items: center; gap: 8px; }
.share-url { flex: 1; min-width: 0; padding: 8px 12px; border-radius: 10px; background: var(--paper); border: 1px solid var(--line); color: var(--cobalt); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-decoration: none; }
.share-url:hover { text-decoration: underline; }
.share-code { margin: 8px 0; padding: 10px 12px; border-radius: 10px; background: var(--ink); color: #E3E6FF; font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; word-break: break-all; max-height: 140px; overflow: auto; user-select: all; }

/* A team's subdomain: its logo, name and color lead. */
.public-bar .org-logo { display: block; height: 34px; max-width: 150px; object-fit: contain; object-position: left center; }
.public-bar .org-mono { width: 34px; height: 34px; border-radius: 9px; background: var(--org, var(--cobalt)); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 17px; }
.player-org .public-bar .product-name { text-transform: none; letter-spacing: 0; font-size: 13px; color: var(--ink-soft); font-weight: 600; }
.player-org .public-bar .btn-primary { background: var(--org, var(--cobalt)); border-color: var(--org, var(--cobalt)); }
.public-credit { order: 3; text-align: center; font-size: 13px; color: var(--ink-faint); margin: 0 0 32px; }
.public-credit a { color: inherit; }
.player-org .public-bar .btn-primary:hover { background: var(--org, var(--cobalt-deep)); filter: brightness(.9); }

/* Team dialog: the team's subdomain */
.handle-field { flex: 1; min-width: 0; display: flex; align-items: center; border: 1.5px solid var(--line); border-radius: 12px; background: var(--card); padding-right: 12px; }
.handle-field:focus-within { border-color: var(--cobalt); }
.handle-field .field { border: 0; background: none; min-width: 0; flex: 1; box-shadow: none; outline: none; }
.handle-suffix { color: var(--ink-faint); font-size: 14px; white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { .ld-tips span:first-child { opacity: 1; } }
/* A public chart shows the loader until it's drawn, not the studio's "Your chart shows up here". */
.player .frame-empty { visibility: hidden; }

/* ---------- Reviewing fixes (clean.js; reviewActions in main.js) ---------- */
/* The bar floats over the bottom of the data table, like a Find and Replace box. */
.review-bar {
  position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 5;
  width: min(760px, calc(100% - 32px)); display: grid; gap: 10px; padding: 14px 16px 14px;
  background: var(--card); border-radius: 16px; border: 1px solid var(--line);
  box-shadow: 0 1px 2px rgba(21,23,53,.06), 0 18px 40px -12px rgba(26,33,184,.35);
  animation: rv-in .28s var(--ease) both;
}
@keyframes rv-in { from { opacity: 0; transform: translate(-50%, 10px); } }
.rv-top { display: flex; align-items: center; gap: 10px; min-width: 0; }
.rv-icon { flex: none; width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--cobalt-tint); color: var(--cobalt-deep); }
.rv-icon.rows, .rv-icon.header { background: #FDECEC; color: var(--danger); }
.rv-icon.rename, .rv-icon.style { background: #FFF1E0; color: #9A4E07; }
.rv-heading { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.rv-heading .dd-btn.rv-kinds { align-self: flex-start; width: auto; border: 0; background: none; padding: 0; min-height: 0; font: 700 15px/1.3 var(--display); color: var(--ink); max-width: 100%; justify-content: flex-start; gap: 6px; }
.rv-heading .dd-btn.rv-kinds .dd-value { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rv-count { font-size: 12.5px; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.rv-nav { display: flex; gap: 2px; flex: none; }
.rv-change { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 12px; border-radius: 12px; background: var(--paper); }
.rv-where { font-size: 12.5px; font-weight: 600; color: var(--ink-soft); margin-right: 4px; white-space: nowrap; }
.rv-val { padding: 4px 10px; border-radius: 8px; font: 500 14px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; max-width: 100%; overflow-wrap: anywhere; }
.rv-val em { font-style: italic; font-family: var(--body); opacity: .75; }
.rv-val.before { background: #fff; color: var(--ink-soft); border: 1px solid var(--line); }
.rv-val.before.struck { text-decoration: line-through; text-decoration-color: var(--danger); }
.rv-val.after { background: var(--cobalt-tint); color: var(--cobalt-deep); font-weight: 600; }
.rv-val.after.remove { background: #FDECEC; color: var(--danger); font-family: var(--body); }
.rv-arrow { color: var(--ink-faint); font-weight: 700; }
.rv-detail { margin: -2px 2px 0; font-size: 13px; color: var(--ink-soft); }
.rv-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rv-sep { width: 1px; height: 22px; background: var(--line); margin: 0 4px; }
.rv-actions .rv-accept { min-width: 96px; }

/* In the table: suggested changes, rows to remove, and the change being looked at. */
.dt td.rv-pending { background: #FFF6EC; }
.dt td.rv-pending .cell::after { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--tangerine); margin-left: 6px; vertical-align: 2px; }
.dt td.rv-current { background: var(--cobalt-tint); box-shadow: inset 0 0 0 2px var(--cobalt); }
.dt tr.rv-row-remove td:not(.rownum) { background: #FDF1F1; }
.dt tr.rv-row-remove td .cell { text-decoration: line-through; text-decoration-color: rgba(210,59,59,.6); color: var(--ink-soft); }
.dt tr.rv-current-row td:not(.rownum) { box-shadow: inset 0 2px 0 var(--danger), inset 0 -2px 0 var(--danger); }
.dt tr.rv-row-header td:not(.rownum) { background: var(--cobalt-tint); box-shadow: inset 0 2px 0 var(--cobalt), inset 0 -2px 0 var(--cobalt); font-weight: 700; }
.dt th.rv-pending { box-shadow: inset 0 -3px 0 var(--tangerine); }
.dt th.rv-current { box-shadow: inset 0 -3px 0 var(--cobalt); background: var(--cobalt-tint); }
/* Room under the last rows, so the bar never hides them. */
.table-view:has(~ .review-bar:not([hidden])) .dt-foot { padding-bottom: 190px; }

/* The list of fixes on the Data step. */
.fix-list { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 6px; }
.fix-item { display: grid; gap: 2px; padding: 9px 12px; border-radius: 12px; border: 1px solid var(--line-soft); background: var(--card); }
.fix-item.current { border-color: var(--cobalt); box-shadow: 0 0 0 2px var(--cobalt-tint); }
.fix-item.done { opacity: .6; }
.fix-title { border: 0; background: none; padding: 0; text-align: left; font-weight: 600; font-size: 14px; color: var(--ink); }
.fix-title:disabled { cursor: default; }
.fix-meta { display: flex; gap: 12px; align-items: center; font-size: 12.5px; color: var(--ink-faint); }
@media (max-width: 720px) { .review-bar { bottom: 8px; padding: 12px; } .rv-sep { display: none; } }

/* ---------- Scanning new data (startScan in main.js) ----------
   A beam sweeps down the table, leaving a soft trail; only transform and opacity move, so it keeps going while
   a big table is being checked. */
.scan { position: absolute; z-index: 4; overflow: hidden; pointer-events: none; border-radius: 0 0 16px 16px; }
.scan-sweep {
  position: absolute; inset: 0; transform: translateY(-100%); will-change: transform;
  background: linear-gradient(to bottom, rgba(43,53,245,0) 55%, rgba(43,53,245,.07) 88%, rgba(59,227,176,.16) 99%, transparent 100%);
}
.scan-sweep::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--cobalt) 18%, var(--mint) 50%, var(--cobalt) 82%, transparent);
  box-shadow: 0 0 14px 3px rgba(59,227,176,.55), 0 0 36px 8px rgba(43,53,245,.18);
}
.scan.run .scan-sweep { animation: scan-sweep .8s cubic-bezier(.55, .08, .35, .95) infinite; }
.scan.done { opacity: 0; transition: opacity .4s var(--ease); }
@keyframes scan-sweep { from { transform: translateY(-100%); } to { transform: translateY(100%); } }
.scan-pill {
  position: absolute; z-index: 5; left: 50%; bottom: 24px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px; padding: 8px 14px 8px 12px; border-radius: 999px;
  background: rgba(21,23,53,.9); color: #fff; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums;
  box-shadow: 0 10px 30px -10px rgba(21,23,53,.5); animation: rv-in-top .25s var(--ease) both;
}
.scan-pill .ld-bars.small i:nth-child(5) { background: #fff; }
@keyframes rv-in-top { from { opacity: 0; transform: translate(-50%, 8px); } }
/* After the scan, each column: a tick, or a dot where there's something to tidy. */
.scan-mark { flex: none; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; animation: scan-pop .35s cubic-bezier(.2, 1.4, .4, 1) both; }
.scan-mark.ok { background: #DDF8EE; color: #0D6B4F; }
.scan-mark.fix { background: #FFF1E0; color: var(--tangerine); }
@keyframes scan-pop { from { opacity: 0; transform: scale(.3); } }

/* The card after a scan. */
.scan-result {
  position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 5;
  width: min(640px, calc(100% - 32px)); display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; align-items: start;
  padding: 16px 18px; background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 1px 2px rgba(21,23,53,.06), 0 18px 40px -12px rgba(26,33,184,.35); animation: rv-in .3s var(--ease) both;
}
.sr-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; grid-row: span 2; }
.scan-result.good .sr-icon { background: #DDF8EE; color: #0D6B4F; animation: scan-pop .45s cubic-bezier(.2, 1.4, .4, 1) both; }
.scan-result.issues .sr-icon { background: #FFF1E0; color: #C2610C; }
.sr-text { display: grid; gap: 3px; min-width: 0; }
.sr-text strong { font: 700 17px/1.3 var(--display); color: var(--ink); }
.sr-text > span { font-size: 13.5px; color: var(--ink-soft); }
.sr-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.sr-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 4px 3px 10px; border-radius: 999px; background: var(--paper); border: 1px solid var(--line-soft); font-size: 12.5px; font-weight: 600; color: var(--ink-soft); }
.sr-chip b { min-width: 20px; padding: 1px 7px; border-radius: 999px; background: #FFF1E0; color: #9A4E07; font-size: 11.5px; text-align: center; font-variant-numeric: tabular-nums; }
.sr-actions { grid-column: 2; display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin-top: 6px; }
@media (max-width: 600px) { .scan-result { grid-template-columns: 1fr; } .sr-icon { grid-row: auto; } .sr-actions { grid-column: 1; justify-content: flex-start; } }

/* A bar, slice, region, point or line picked on the preview (positionItemSel in main.js). */
.item-sel { position: absolute; pointer-events: none; border: 1.5px dashed var(--cobalt); border-radius: 6px; box-shadow: 0 0 0 1px rgba(255,255,255,.85), 0 0 0 4px rgba(43,53,245,.12); }
.hidden-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.hidden-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 10px; background: var(--paper); font-size: 14px; }

/* Gridlines selected on the preview (main.js positionGridSel): a highlight along each line, a handle at each end. */
.grid-sel { position: absolute; pointer-events: none; overflow: visible; display: none; }
.grid-sel .gs-line { stroke: var(--cobalt); stroke-width: 3; stroke-opacity: .22; stroke-linecap: round; }
.grid-sel .gs-handle { fill: #fff; stroke: var(--cobalt); stroke-width: 1.5; }
.player .grid-sel { display: none !important; }

/* Captions (Motion step): one card per line of text, with its times. */
.cap-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; counter-reset: cap; }
.cap-item { border: 1.5px solid var(--line); border-radius: 12px; padding: 10px; background: #fff; display: grid; gap: 8px; }
.cap-item.on { border-color: var(--cobalt); }
.cap-text { resize: vertical; min-height: 0; height: 4.4em; font: inherit; font-size: 14px; line-height: 1.4; }
.cap-row { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-soft); }
.cap-time { width: 4.2em; padding: 6px 8px; font-size: 13px; text-align: right; }
.cap-play { width: 28px; height: 28px; border-radius: 50%; border: 1.5px solid var(--line); background: #fff; color: var(--ink); font-size: 10px; flex: none; }
.cap-play:hover { border-color: var(--ink); }
.cap-del { margin-left: auto; font-size: 13px; }
