@import url("/node_modules/@fontsource/inter/400.css");
@import url("/node_modules/@fontsource/inter/500.css");
@import url("/node_modules/@fontsource/inter/600.css");

:root {
  color-scheme: light dark;
  --bg: #f5f5f3; --surface: #ffffff; --surface-2: #f0f0ed; --surface-3: #e8e8e4;
  --border: #e2e2de; --border-strong: #cdcdc7;
  --text: #16161a; --text-2: #55555e; --text-3: #85858e;
  --accent: #3554f5; --accent-hover: #2843d6; --accent-ink: #ffffff; --accent-soft: #eaeeff;
  --ok: #12804a; --ok-soft: #e3f4e9; --warn: #9a5b00; --warn-soft: #fdf0d9; --danger: #c02a2a; --danger-soft: #fde7e7;
  --radius: 14px; --radius-sm: 9px; --radius-xs: 6px;
  --shadow: 0 1px 2px rgba(20,20,30,.05), 0 6px 20px rgba(20,20,30,.05);
  --font: "Inter", -apple-system, system-ui, sans-serif;
  --focus: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent);
  --seg-on: #ffffff;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e0e10; --surface: #17171a; --surface-2: #1f1f23; --surface-3: #28282d;
    --border: #2a2a30; --border-strong: #3b3b43;
    --text: #ededf0; --text-2: #a5a5ae; --text-3: #73737d;
    --accent: #6f86ff; --accent-hover: #8597ff; --accent-ink: #0b0d1a; --accent-soft: #1c2244;
    --ok: #46d18a; --ok-soft: #10291c; --warn: #f2b453; --warn-soft: #30230c; --danger: #ff7474; --danger-soft: #361515;
    --shadow: 0 0 0 1px rgba(255,255,255,.02);
    --seg-on: #34343c;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 15px/1.5 var(--font); background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 24px; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }
p { margin: 0; }
code { font: 13px/1 ui-monospace, Menlo, monospace; background: var(--surface-2); padding: 2px 6px; border-radius: 5px; }
.muted { color: var(--text-3); }
.lede { color: var(--text-2); margin-top: 6px; max-width: 64ch; }
[hidden] { display: none !important; }
.row { display: flex; align-items: center; }
.row.between { justify-content: space-between; }
.row.gap { gap: 10px; }
.row.wrap { flex-wrap: wrap; }
:focus { outline: none; }
:focus-visible { box-shadow: var(--focus); border-radius: var(--radius-xs); }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; height: 60px; padding: 0 20px;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; white-space: nowrap; }
.logo { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--text); color: var(--bg); font-size: 14px; }
.steps { display: flex; align-items: center; gap: 4px; }
.steps .sep { width: 18px; height: 1px; background: var(--border-strong); }
.step {
  display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border-radius: 999px;
  border: 0; background: none; color: var(--text-3); font: 500 14px var(--font); cursor: pointer;
}
.step .num { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; background: var(--surface-3); color: var(--text-2); }
.step:hover:not(:disabled) { color: var(--text); background: var(--surface-2); }
.step.current { color: var(--text); background: var(--surface); box-shadow: inset 0 0 0 1px var(--border); }
.step.current .num { background: var(--accent); color: var(--accent-ink); }
.step.done .num { background: var(--ok-soft); color: var(--ok); }
.step:disabled { cursor: default; opacity: .55; }
.top-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 11px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font: 500 13px var(--font); cursor: pointer;
}
.chip:hover { border-color: var(--border-strong); color: var(--text); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); }
.chip.ok .dot { background: var(--ok); }
.chip.warn .dot { background: var(--warn); }
.chip.bad .dot { background: var(--danger); }

/* ---------- layout ---------- */
main { max-width: 1240px; margin: 0 auto; padding: 28px 24px 120px; }
.view-head { margin-bottom: 20px; }
.section-head { display: flex; align-items: baseline; gap: 10px; margin: 32px 0 12px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }

/* ---------- buttons & fields ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 16px;
  border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font: 500 14px var(--font); cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s, opacity .12s;
}
.btn:hover:not(:disabled) { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn.ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.btn.small { height: 30px; padding: 0 11px; font-size: 13px; border-radius: var(--radius-xs); }
.btn.icon { width: 36px; padding: 0; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
a.btn { text-decoration: none; }
.btn[data-armed] { border-color: var(--warn); color: var(--warn); background: var(--warn-soft); }
.btn.busy .btn-label::before { content: ""; display: inline-block; width: 13px; height: 13px; margin-right: 8px; vertical-align: -2px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field.grow { flex: 1; }
.label { font: 500 13px var(--font); color: var(--text-2); }
.help { font-size: 13px; color: var(--text-3); }
input[type="text"], input[type="password"], input:not([type]), select, textarea {
  width: 100%; font: 14px/1.45 var(--font); color: var(--text); background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 9px 11px; transition: border-color .12s, box-shadow .12s;
}
select { height: 38px; padding: 0 30px 0 11px; appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%); background-position: calc(100% - 16px) 16px, calc(100% - 11px) 16px; background-size: 5px 5px; background-repeat: no-repeat; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: var(--focus); border-radius: var(--radius-sm); }
textarea { resize: vertical; min-height: 44px; }
.segmented { display: inline-flex; padding: 3px; gap: 3px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border); }
.segmented button { height: 32px; padding: 0 14px; border: 0; border-radius: 7px; background: none; color: var(--text-2); font: 500 13.5px var(--font); cursor: pointer; }
.segmented button[aria-checked="true"] { background: var(--seg-on); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.18); }
.segmented button:hover:not([aria-checked="true"]) { color: var(--text); }
.switch { position: relative; width: 36px; height: 22px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.switch i { position: absolute; inset: 0; border-radius: 999px; background: var(--surface-3); transition: background .15s; pointer-events: none; }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .15s; }
.switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { transform: translateX(14px); }
.switch input:focus-visible + i { box-shadow: var(--focus); }

.callout { display: flex; gap: 10px; padding: 11px 13px; border-radius: var(--radius-sm); font-size: 13.5px; line-height: 1.45; }
.callout.warn { background: var(--warn-soft); color: var(--warn); }
.callout.bad { background: var(--danger-soft); color: var(--danger); }
.callout.info { background: var(--surface-2); color: var(--text-2); }
.callout strong { font-weight: 600; }
.callout .btn { margin-left: auto; }

.spinner { width: 15px; height: 15px; border-radius: 50%; border: 2px solid var(--accent); border-right-color: transparent; animation: spin .7s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.bar { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: inherit; transition: width .2s; }

/* ---------- 1. clip ---------- */
.drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; height: 190px;
  border: 1.5px dashed var(--border-strong); border-radius: var(--radius); background: var(--surface); color: var(--text-2);
  cursor: pointer; text-align: center; transition: border-color .15s, background .15s;
}
.drop strong { color: var(--text); font-weight: 600; }
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.upload { margin-top: 12px; padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; }
.clip-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 14px; }
.clip-card {
  display: flex; flex-direction: column; gap: 8px; padding: 8px 8px 11px; border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--surface); text-align: left; color: var(--text); font: inherit; cursor: pointer; transition: border-color .12s, transform .12s;
}
.clip-card:hover { border-color: var(--border-strong); }
.clip-card.current { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.clip-card img { width: 100%; aspect-ratio: 9/16; object-fit: cover; border-radius: 9px; background: var(--surface-3); display: block; }
.clip-card .name { font-weight: 500; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 3px; }
.clip-card .meta { font-size: 12px; color: var(--text-3); padding: 0 3px; }
.badges { display: flex; gap: 5px; flex-wrap: wrap; padding: 0 3px; }
.badge { font: 500 11px/1 var(--font); padding: 4px 7px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.empty { padding: 36px; text-align: center; color: var(--text-3); border: 1px dashed var(--border); border-radius: var(--radius); }

/* ---------- 2. watch ---------- */
.split { display: grid; grid-template-columns: minmax(260px, 360px) 1fr; gap: 28px; align-items: start; }
.player-col { position: sticky; top: 84px; display: flex; flex-direction: column; gap: 10px; }
.player { width: 100%; aspect-ratio: 9/16; max-height: calc(100vh - 160px); background: #000; border-radius: var(--radius); object-fit: contain; display: block; }
.clip-meta { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--text-3); padding: 0 2px; }
.clip-meta .name { color: var(--text); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.watch-card { padding: 22px; display: flex; flex-direction: column; gap: 16px; }
.watch-card .head { display: flex; flex-direction: column; gap: 4px; }
.steps-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.steps-list li { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--text-2); }
.steps-list li.done { color: var(--text-3); }
.steps-list .tick { width: 15px; height: 15px; flex: none; color: var(--ok); }
.source { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; color: var(--text-3); }
.toggle-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--surface-2); }
.toggle-row .text { display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.actions .spacer { flex: 1; }
.saved { font-size: 12.5px; color: var(--text-3); transition: opacity .3s; }

/* ---------- 3. captions ---------- */
.controls { padding: 16px 18px; display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; }
.controls .field.action { justify-content: flex-end; align-self: stretch; padding-top: 25px; }
.controls #cap-lang { width: 150px; }
.progress-line { display: flex; align-items: center; gap: 10px; margin: 16px 2px 0; font-size: 14px; color: var(--text-2); }
#cap-body { margin-top: 20px; display: flex; flex-direction: column; gap: 14px; }
.shared { padding: 18px; display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.shared .full { grid-column: 1 / -1; }
.text-field { display: flex; flex-direction: column; gap: 6px; }
.text-field .top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.count { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.count.over { color: var(--danger); }
.issues { display: flex; flex-wrap: wrap; gap: 5px; min-height: 0; }
.issue { font: 500 12px/1 var(--font); padding: 4px 8px; border-radius: 999px; background: var(--danger-soft); color: var(--danger); }
.options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.option { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface-2); }
.option .s { font-weight: 600; font-size: 14px; }
.option .p { font-size: 13.5px; color: var(--text-2); }
.option .btn { align-self: flex-start; margin-top: auto; }
.options-head { display: flex; align-items: center; justify-content: space-between; }

.page-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.page-card { display: flex; flex-direction: column; gap: 7px; }
.page-card.off .thumb { opacity: .35; }
.thumb { position: relative; width: 100%; aspect-ratio: 9/16; border-radius: 10px; overflow: hidden; background: var(--surface-3); border: 1px solid var(--border); cursor: zoom-in; padding: 0; display: block; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: opacity .2s; }
.thumb.loading::after { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, color-mix(in srgb, var(--surface) 60%, transparent) 50%, transparent 70%); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
.thumb.loading img { opacity: .55; }
@keyframes shimmer { from { background-position: 150% 0; } to { background-position: -50% 0; } }
.page-line { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.page-who { display: flex; align-items: center; gap: 9px; min-width: 0; flex: 1; }
.page-name { display: flex; flex-direction: column; min-width: 0; }
.page-name b { font-weight: 500; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.page-name span { font-size: 12px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.page-who.compact { gap: 7px; }
.page-who.compact .page-name b { font-size: 13px; }

.rows { display: flex; flex-direction: column; gap: 12px; }
.prow { padding: 14px; display: grid; grid-template-columns: 112px 1fr; gap: 16px; }
.prow.off { opacity: .6; }
.prow .thumb { width: 112px; }
.prow .body { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.prow .head { display: flex; align-items: center; gap: 10px; }
.prow .head .page-name { flex: 1; }
.prow .fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.prow .options-wrap { display: flex; flex-direction: column; gap: 8px; }

.footer-bar {
  position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 15;
  display: flex; align-items: center; gap: 18px; padding: 10px 10px 10px 18px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--border); box-shadow: 0 8px 30px rgba(0,0,0,.14); font-size: 14px; color: var(--text-2);
  max-width: calc(100vw - 32px);
}
.footer-bar .warn-text { color: var(--warn); }

/* ---------- 4. render ---------- */
.render-setup { padding: 22px; display: flex; flex-direction: column; gap: 18px; max-width: 760px; }
.quality { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.radio-card { display: flex; gap: 10px; padding: 12px 14px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); cursor: pointer; }
.radio-card input { margin-top: 3px; accent-color: var(--accent); }
.radio-card:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.radio-card .t { font-weight: 500; font-size: 14px; }
.radio-card .d { font-size: 13px; color: var(--text-3); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.render-progress { padding: 22px; display: flex; flex-direction: column; gap: 14px; max-width: 760px; }
.plist { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px 20px; }
.plist li { display: flex; align-items: center; gap: 9px; font-size: 14px; color: var(--text-2); }
.plist .state { width: 16px; height: 16px; flex: none; display: grid; place-items: center; }
.plist .queued .state::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--surface-3); }
.plist .done { color: var(--text); }
.plist .failed { color: var(--danger); }
.results-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.results-head .spacer { flex: 1; }
.results { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.result { display: flex; flex-direction: column; overflow: hidden; }
.result video { width: 100%; aspect-ratio: 9/16; background: #000; display: block; object-fit: cover; }
.result .info { padding: 11px 12px 12px; display: flex; flex-direction: column; gap: 8px; }
.result .post { font-size: 13.5px; color: var(--text-2); }
.result .row { gap: 6px; flex-wrap: wrap; }

/* ---------- pages editor ---------- */
.top-link { gap: 7px; height: 32px; }
.top-link.current { background: var(--surface); color: var(--text); box-shadow: inset 0 0 0 1px var(--border); }
.pg-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.pages-layout { display: grid; grid-template-columns: 300px 1fr; gap: 22px; align-items: start; }
.pg-list-card { position: sticky; top: 84px; padding: 8px; max-height: calc(100vh - 110px); overflow: auto; }
.pg-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.pg-list-help { font-size: 12px; padding: 10px 8px 4px; }
.pg-item { position: relative; display: flex; align-items: center; border-radius: 10px; }
.pg-item:hover { background: var(--surface-2); }
.pg-item.selected { background: var(--accent-soft); }
.pg-select {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 8px 8px; border: 0; background: none;
  color: var(--text); font: inherit; text-align: left; cursor: pointer; border-radius: 10px;
}
.pg-num { width: 20px; flex: none; text-align: right; font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.pg-text { min-width: 0; display: flex; flex-direction: column; }
.pg-text b { font-weight: 500; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pg-text small { font-size: 12px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pg-item.off .pg-text, .pg-item.off .av { opacity: .45; }
.pg-flag { flex: none; font: 500 11px/1 var(--font); padding: 3px 6px; border-radius: 999px; background: var(--surface-3); color: var(--text-2); }
.pg-flag.err { background: var(--danger-soft); color: var(--danger); }
.pg-flag.new { background: var(--accent-soft); color: var(--accent); }
.pg-move { display: flex; flex-direction: column; gap: 1px; padding-right: 4px; opacity: 0; transition: opacity .12s; }
.pg-item:hover .pg-move, .pg-item.selected .pg-move, .pg-move:focus-within { opacity: 1; }
.pg-move button { width: 24px; height: 18px; border: 0; border-radius: 5px; background: none; color: var(--text-2); cursor: pointer; display: grid; place-items: center; padding: 0; }
.pg-move button:hover:not(:disabled) { background: var(--surface-3); color: var(--text); }
.pg-move button:disabled { opacity: .3; cursor: default; }

.av { flex: none; display: grid; place-items: center; overflow: hidden; color: #fff; font-weight: 600; background: linear-gradient(135deg,#555,#222); }
.av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.av.circle { border-radius: 50%; }
.av.square { border-radius: 22%; }

.pg-editor { display: grid; grid-template-columns: 1fr 280px; gap: 22px; align-items: start; min-width: 0; }
.pg-form { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.pg-card { padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.pg-card > h2 { font-size: 15px; }
.pg-card .card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.field .label .note { font-weight: 400; color: var(--text-3); margin-left: 6px; }
.field.error input, .field.error textarea { border-color: var(--danger); }
.field-error { font-size: 12.5px; color: var(--danger); }
.prefix-input { position: relative; display: flex; align-items: center; }
.prefix-input span { position: absolute; left: 11px; color: var(--text-3); pointer-events: none; }
.prefix-input input { padding-left: 26px; }
.grid-2c { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-4c { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }

.avatar-editor { display: grid; grid-template-columns: auto 1fr; gap: 18px; align-items: start; }
.avatar-shapes { display: flex; gap: 12px; align-items: flex-end; }
.avatar-shapes figure { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 11.5px; color: var(--text-3); }
.avatar-drop { position: relative; border-radius: 50%; cursor: pointer; }
.avatar-drop.over::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px dashed var(--accent); }
.avatar-controls { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { width: 30px; height: 30px; border-radius: 50%; border: 0; padding: 0; cursor: pointer; box-shadow: inset 0 0 0 1px rgba(0,0,0,.12); position: relative; }
.swatch[aria-checked="true"]::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; box-shadow: 0 0 0 2px var(--accent); }
.swatch.custom { background: conic-gradient(#f87171, #fbbf24, #34d399, #60a5fa, #a78bfa, #f472b6, #f87171); display: grid; place-items: center; overflow: hidden; }
.swatch.custom input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; padding: 0; border: 0; }
.emoji-picks { display: flex; flex-wrap: wrap; gap: 4px; }
.emoji-picks button { width: 34px; height: 34px; border-radius: 8px; border: 1px solid transparent; background: var(--surface-2); font-size: 18px; cursor: pointer; padding: 0; }
.emoji-picks button:hover { border-color: var(--border-strong); }
.emoji-picks button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }

.tpl-current { display: flex; gap: 14px; align-items: center; }
.tpl-current .meta { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }
.tpl-current .meta b { font-weight: 600; }
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 12px; }
.tpl-option { display: flex; flex-direction: column; gap: 6px; padding: 6px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; font: inherit; text-align: left; }
.tpl-option:hover { border-color: var(--border-strong); }
.tpl-option[aria-checked="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.tpl-option .thumb { cursor: inherit; border: 0; }
.tpl-option span { font-size: 12.5px; font-weight: 500; padding: 0 2px 2px; }
.uses { display: flex; flex-wrap: wrap; gap: 5px; }
details.more > summary { cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between; font-weight: 600; font-size: 15px; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::after { content: ""; width: 8px; height: 8px; border-right: 2px solid var(--text-3); border-bottom: 2px solid var(--text-3); transform: rotate(45deg); margin-right: 4px; transition: transform .15s; }
details.more[open] > summary::after { transform: rotate(-135deg); }
details.more[open] > summary { margin-bottom: 14px; }
.color-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.danger-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, var(--border-strong)); }
.btn.danger:hover:not(:disabled) { background: var(--danger-soft); }

.pg-preview { position: sticky; top: 84px; display: flex; flex-direction: column; gap: 8px; }
.pg-preview .thumb { cursor: zoom-in; border-radius: 14px; }
.pg-preview p { font-size: 12.5px; color: var(--text-3); text-align: center; }
.files-hint { font-size: 12.5px; color: var(--text-3); }
.files-hint code { font-size: 12px; }

.ask-inner { width: min(440px, calc(100vw - 32px)); }
.ask-body { padding: 22px 22px 8px; gap: 8px; }
.ask-body p { font-size: 14px; line-height: 1.5; }

/* ---------- sign-in, account, access ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(400px, 100%); padding: 30px 28px 24px; display: flex; flex-direction: column; gap: 14px; text-align: left; }
.login-card h1 { font-size: 22px; }
.login-card .btn { height: 42px; }
.logo.big { width: 40px; height: 40px; border-radius: 11px; font-size: 18px; }
.account-wrap { position: relative; }
#account { gap: 8px; height: 32px; padding: 0 10px 0 4px; }
#account .av { flex: none; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 200px; padding: 6px; z-index: 30; display: flex; flex-direction: column; gap: 4px; box-shadow: 0 12px 30px rgba(0,0,0,.2); }
.menu-head { display: flex; flex-direction: column; padding: 8px 10px 6px; font-size: 13.5px; }
.menu .btn { justify-content: flex-start; width: 100%; }
.levels { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.pl-text { display: flex; flex-direction: column; min-width: 0; }
.pl-text small { font-size: 12px; color: var(--text-3); }
.plist .failed .pl-text small { color: var(--danger); }
.token-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.token-list li { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2); font-size: 14px; }
.token-list .t-main { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.token-list .t-main span { font-size: 12.5px; }
.token-new { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.token-new .field.grow { flex: 1; min-width: 180px; }
.token-value { display: inline-block; margin-top: 6px; font-size: 12.5px; word-break: break-all; user-select: all; }

/* ---------- dialogs & toasts ---------- */
dialog { border: 0; padding: 0; background: transparent; color: var(--text); }
dialog::backdrop { background: rgba(10,10,14,.45); backdrop-filter: blur(2px); }
#settings { width: min(720px, calc(100vw - 32px)); max-height: calc(100vh - 48px); }
.dialog-inner { display: flex; flex-direction: column; max-height: calc(100vh - 48px); background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: 0 20px 60px rgba(0,0,0,.25); overflow: hidden; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 14px 14px 22px; border-bottom: 1px solid var(--border); }
.dialog-body { padding: 8px 22px 20px; overflow: auto; display: flex; flex-direction: column; }
.dialog-foot { display: flex; align-items: center; gap: 10px; justify-content: flex-end; padding: 12px 16px; border-top: 1px solid var(--border); }
.dialog-foot .muted { margin-right: auto; font-size: 13px; }
.set-group { display: flex; flex-direction: column; gap: 14px; padding: 18px 0; border-bottom: 1px solid var(--border); }
.set-group:last-child { border-bottom: 0; }
.set-title { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
#set-voice { font: 13px/1.5 ui-monospace, Menlo, monospace; }
.test-result { font-size: 13px; }
.test-result.ok { color: var(--ok); }
.test-result.bad { color: var(--danger); }
#lightbox { padding: 0; max-height: 94vh; }
#lightbox img { display: block; max-height: 92vh; max-width: 92vw; border-radius: 12px; }
#lightbox .close { position: absolute; top: 10px; right: 10px; background: rgba(0,0,0,.55); color: #fff; }

.toasts { position: fixed; top: 72px; right: 18px; z-index: 50; display: flex; flex-direction: column; gap: 8px; width: min(380px, calc(100vw - 36px)); }
.toast { display: flex; gap: 10px; align-items: flex-start; padding: 12px 12px 12px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); box-shadow: 0 10px 30px rgba(0,0,0,.16); font-size: 14px; animation: toast-in .18s ease-out; }
.toast .msg { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.toast .hint { color: var(--text-3); font-size: 13px; }
.toast.bad { border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); }
.toast.bad .title { color: var(--danger); font-weight: 500; }
.toast.ok .title { color: var(--ok); font-weight: 500; }
.toast button { border: 0; background: none; color: var(--text-3); cursor: pointer; font-size: 14px; padding: 2px 4px; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-6px); } }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .pages-layout { grid-template-columns: 250px 1fr; }
  .pg-editor { grid-template-columns: 1fr 200px; gap: 16px; }
}
@media (max-width: 960px) {
  .pages-layout { grid-template-columns: 1fr; }
  .pg-list-card { position: static; max-height: none; }
  .pg-editor { grid-template-columns: 1fr; }
  .pg-preview { order: -1; position: static; flex-direction: row; align-items: center; gap: 16px; }
  .pg-preview .thumb { width: 140px; flex: none; }
  .pg-preview p { text-align: left; }
  .pg-move { opacity: 1; }
  .grid-4c { grid-template-columns: 1fr 1fr; }
  .topbar { grid-template-columns: auto 1fr auto; height: auto; padding: 10px 14px; }
  .steps { grid-column: 1 / -1; grid-row: 2; justify-content: center; }
  .split { grid-template-columns: 1fr; }
  .player-col { position: static; max-width: 340px; margin: 0 auto; width: 100%; }
  .shared, .prow .fields, .options, .quality, .levels, .plist, .grid-2 { grid-template-columns: 1fr; }
  #account span:last-child { display: none; }
}
@media (max-width: 620px) {
  .top-link span { display: none; }
  .avatar-editor, .grid-2c { grid-template-columns: 1fr; }
  .steps .step span:not(.num) { display: none; }
  .prow { grid-template-columns: 1fr; }
  .prow .thumb { width: 120px; }
  .brand span:last-child { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
@media (max-width: 620px) {
  .footer-bar { left: 12px; right: 12px; bottom: 12px; transform: none; max-width: none; padding: 10px 10px 10px 14px; gap: 10px; }
  #cap-summary { flex: 1; font-size: 13px; line-height: 1.3; }
  .controls .field.action { padding-top: 0; }
}

/* recent renders on the Render step */
.recent { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.recent li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 12px; border-radius: var(--radius-sm); background: var(--surface-2); font-size: 14px; }
.recent li > span:first-child { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.recent li .muted { font-size: 12.5px; }
