:root {
  --bg: #FBF8F2; --card: #fff; --ink: #16233F; --muted: #5b6478; --line: #e6e0d4;
  --accent: #F2B935; --on-accent: #16233F; --primary: #16233F; --on-primary: #fff; --error: #b42318; --ok: #146c43;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0f1626; --card: #172036; --ink: #eef1f7; --muted: #a8b0c2; --line: #2a3550; --primary: #F2B935; --on-primary: #16233F; --error: #ff8a80; --ok: #7bd3a3; color-scheme: dark; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", "Noto Sans", Roboto, sans-serif; }
a { color: inherit; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.brand { font-weight: 800; text-decoration: none; font-size: 18px; }
.brand span:last-child { font-weight: 500; color: var(--muted); }
.brand { display: inline-flex; align-items: center; gap: 4px; }
img.mark { width: 32px; height: 32px; border-radius: 0; background: none; margin-right: 6px; vertical-align: middle; }
.mark { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--accent); color: var(--on-accent); font-size: 13px; margin-right: 4px; }
nav { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
nav a { text-decoration: none; font-weight: 600; }
main { max-width: 960px; margin: 0 auto; padding: 24px 16px 48px; }
main.wide { max-width: 1180px; }
footer { display: flex; gap: 16px; justify-content: center; padding: 24px 16px; color: var(--muted); font-size: 14px; border-top: 1px solid var(--line); flex-wrap: wrap; }
h1 { font-size: 28px; line-height: 1.2; margin: 0 0 12px; }
h2 { font-size: 18px; margin: 0 0 8px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 20px; }
.narrow { max-width: 460px; margin: 0 auto; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack > form, form.stack { margin: 0; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 15px; }
label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; }
input, select { font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--ink); width: 100%; }
input[type=checkbox], input[type=radio] { width: auto; }
button, .button { font: inherit; font-weight: 700; border: 0; border-radius: 12px; padding: 12px 18px; background: var(--accent); color: var(--on-accent); cursor: pointer; text-decoration: none; display: inline-block; text-align: center; }
button:disabled { opacity: 0.5; cursor: not-allowed; }
.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.small { padding: 8px 12px; font-size: 14px; }
.link { background: none; padding: 0; color: var(--ink); text-decoration: underline; font-weight: 600; }
form.inline { display: inline; }
button.danger { background: var(--error); color: #fff; }
.danger { border-top: 1px solid var(--line); padding-top: 14px; }
.muted { color: var(--muted); font-weight: 400; }
.small { font-size: 13px; }
.error { color: var(--error); font-weight: 600; margin: 0; }
.flash { color: var(--ok); font-weight: 600; margin: 0; }
.hero { padding: 24px 0 32px; }
.hero h1 { font-size: clamp(30px, 6vw, 46px); max-width: 18ch; }
.lead { font-size: 18px; color: var(--muted); max-width: 60ch; }
.points { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.points > div { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 18px; }
.points p { color: var(--muted); margin: 0; }
.prose { max-width: 720px; margin: 0 auto; }
.prose h2 { margin-top: 20px; }
fieldset { border: 0; padding: 0; margin: 0; }
legend { font-weight: 600; font-size: 15px; margin-bottom: 6px; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill { flex-direction: row; font-weight: 500; }
.pill { position: relative; }
.pill input { position: absolute; top: 0; left: 0; opacity: 0; pointer-events: none; }
.pill span { padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px; cursor: pointer; }
.pill input:checked + span { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.pill input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
details summary { cursor: pointer; font-weight: 600; margin-bottom: 10px; }
.maker { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 420px); gap: 20px; align-items: start; }
.controls { display: flex; flex-direction: column; gap: 14px; }
.preview { position: sticky; top: 12px; display: flex; flex-direction: column; gap: 10px; }
#stage { width: 100%; max-height: 70vh; object-fit: contain; background: #16233F; border-radius: 14px; }
.preview #stage { aspect-ratio: auto; }
.file { position: relative; overflow: hidden; align-self: flex-start; }
.file input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.strip { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.thumb { position: relative; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--bg); }
.thumb img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; }
.thumb-n { position: absolute; top: 4px; left: 4px; background: rgba(0,0,0,0.65); color: #fff; font-size: 12px; border-radius: 6px; padding: 0 6px; }
.thumb-tools { display: flex; justify-content: space-between; }
.thumb-tools button { flex: 1; padding: 6px 0; background: transparent; color: var(--ink); border-radius: 0; font-size: 14px; }
progress { width: 100%; height: 10px; }
#result-video { width: 100%; max-height: 60vh; border-radius: 12px; background: #000; }
@media (max-width: 820px) {
  .maker { grid-template-columns: 1fr; }
  .preview { position: static; order: -1; }
  #stage { max-height: 52vh; }
}

/* ── Reel editor ─────────────────────────────────────────────────────────── */
main.editor-main { max-width: none; padding: 0; }
.sr { position: absolute !important; top: 0; left: 0; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
label.chip, .file, .empty .button { position: relative; }
.editor {
  --rail: 84px; --panel: 340px; --insp: 300px;
  display: grid; height: calc(100vh - 57px); height: calc(100dvh - 57px);
  grid-template-columns: var(--rail) var(--panel) minmax(0, 1fr) var(--insp);
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-areas: "tabs top top top" "tabs panel stage insp" "tabs panel timeline insp";
  background: var(--bg);
}
.ed-top { grid-area: top; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.ed-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ed-tabs { grid-area: tabs; display: flex; flex-direction: column; gap: 4px; padding: 10px 8px; border-right: 1px solid var(--line); background: var(--card); }
.ed-tabs button { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px; border-radius: 12px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 600; }
.ed-tabs button:hover { background: var(--bg); color: var(--ink); }
.ed-tabs button.on { background: var(--primary); color: var(--on-primary); }
.ed-panel { grid-area: panel; overflow-y: auto; padding: 16px; border-right: 1px solid var(--line); background: var(--card); display: flex; flex-direction: column; gap: 14px; }
.ed-panel h2 { font-size: 20px; margin: 0; }
.ed-panel h3 { font-size: 15px; margin: 8px 0 0; padding-top: 12px; border-top: 1px solid var(--line); }
.ed-stage { grid-area: stage; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 16px; min-height: 0; }
.stage-wrap { position: relative; height: 100%; max-height: 100%; max-width: 100%; aspect-ratio: 9 / 16; border-radius: 16px; overflow: hidden; box-shadow: 0 10px 40px rgba(0,0,0,0.25); background: #111; }
.stage-wrap.drop { outline: 3px dashed var(--accent); outline-offset: 4px; }
#stage { display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; background: #111; border-radius: 0; max-height: none; }
#stage.dragging { cursor: grabbing; }
.empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center; padding: 24px; color: #fff; }
.empty .muted { color: rgba(255,255,255,0.75); }
.empty-title { font-size: 22px; font-weight: 800; margin: 0; }
.empty .button { position: relative; overflow: hidden; }
.safe { position: absolute; inset: 0; pointer-events: none; }
.safe::before, .safe::after { content: ""; position: absolute; left: 0; right: 0; background: repeating-linear-gradient(45deg, rgba(255,60,60,0.28) 0 8px, rgba(255,60,60,0.12) 8px 16px); }
.safe::before { top: 0; height: var(--t); }
.safe::after { bottom: 0; height: var(--b); }
.safe span { position: absolute; left: 8px; right: 8px; font-size: 11px; font-weight: 700; color: #fff; text-shadow: 0 1px 2px #000; z-index: 1; }
.safe-top { top: 6px; } .safe-bottom { bottom: 6px; }
.transport { display: flex; align-items: center; gap: 10px; width: min(560px, 100%); }
.transport input[type=range] { flex: 1; padding: 0; }
.time { font-variant-numeric: tabular-nums; font-size: 13px; color: var(--muted); min-width: 86px; text-align: right; }
.status { margin: 0; font-size: 14px; color: var(--muted); text-align: center; }
.status.err { color: var(--error); font-weight: 600; }
.ed-timeline { grid-area: timeline; border-top: 1px solid var(--line); padding: 10px 16px; overflow-x: auto; background: var(--card); }
.timeline { list-style: none; margin: 0; padding: 0; display: flex; gap: 8px; align-items: stretch; }
.clip { flex: 0 0 auto; border-radius: 12px; border: 2px solid transparent; position: relative; }
.clip.on { border-color: var(--accent); }
.clip.now { box-shadow: 0 0 0 2px var(--primary) inset; }
.clip.over { transform: translateX(6px); border-color: var(--primary); }
.clip-btn { position: relative; display: block; width: 72px; height: 92px; padding: 0; border-radius: 10px; overflow: hidden; background: var(--bg); color: var(--ink); border: 1px solid var(--line); cursor: pointer; }
.clip-btn img { width: 100%; height: 100%; object-fit: cover; display: block; }
.clip-n { position: absolute; top: 4px; left: 4px; background: rgba(0,0,0,0.65); color: #fff; font-size: 11px; border-radius: 6px; padding: 0 5px; }
.clip-t { position: absolute; top: 4px; right: 4px; background: var(--accent); color: var(--on-accent); font-size: 10px; font-weight: 800; border-radius: 5px; padding: 0 5px; }
.clip-d { position: absolute; bottom: 4px; right: 4px; background: rgba(0,0,0,0.65); color: #fff; font-size: 11px; border-radius: 6px; padding: 0 5px; font-variant-numeric: tabular-nums; }
.clip.end .clip-btn, .clip.add .clip-btn { display: grid; place-items: center; }
.clip.end .clip-d { right: auto; left: 50%; transform: translateX(-50%); }
.clip.add .clip-btn { border-style: dashed; color: var(--muted); }
.ed-inspector { grid-area: insp; overflow-y: auto; padding: 16px; border-left: 1px solid var(--line); background: var(--card); display: flex; flex-direction: column; gap: 14px; }
.ed-inspector h2 { font-size: 17px; margin: 0; }
.insp-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.insp-thumb { width: 100%; max-height: 120px; object-fit: cover; border-radius: 10px; }
.tips { margin: 0; padding-left: 18px; color: var(--muted); font-size: 14px; display: grid; gap: 6px; }
kbd { font: 12px ui-monospace, monospace; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 0 4px; }
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; padding: 0; border-radius: 10px; background: transparent; color: var(--ink); border: 1px solid var(--line); }
.icon-btn:hover:not(:disabled) { background: var(--bg); }
.icon-btn.round { width: 44px; height: 44px; border-radius: 999px; background: var(--primary); color: var(--on-primary); border: 0; }
.icon-btn[aria-pressed=true] { background: var(--primary); color: var(--on-primary); }
.icon-row { display: flex; gap: 4px; }
button.primary, .button.primary { background: var(--accent); color: var(--on-accent); }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-weight: 700; font-size: 14px; }
.field-hint { font-size: 12.5px; color: var(--muted); }
.field-hint.right { text-align: right; }
.field textarea, .ed-panel textarea, .ed-panel input[type=text], .ed-panel input[type=search], .ed-inspector input[type=text] { font: inherit; width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--ink); resize: vertical; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.stack-s { display: flex; flex-direction: column; gap: 8px; }
.value { font-variant-numeric: tabular-nums; font-size: 13px; color: var(--muted); min-width: 44px; text-align: right; }
.row input[type=range] { flex: 1; padding: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.chip { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 4px; padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font-weight: 600; font-size: 13.5px; cursor: pointer; position: relative; }
.chip.on { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.chip svg { width: 16px; height: 16px; }
.chip input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.toggle { flex-direction: row; align-items: center; gap: 10px; font-weight: 500; font-size: 14px; cursor: pointer; }
.toggle { position: relative; }
/* Kept inside the switch: an unanchored hidden checkbox sits at the foot of the page, and focusing it on click scrolled the whole page into empty space (the "blank screen"). */
.toggle input { position: absolute; top: 0; left: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.toggle-ui { flex: 0 0 auto; width: 38px; height: 22px; border-radius: 999px; background: var(--line); position: relative; transition: background .15s; }
.toggle-ui::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,0.3); }
.toggle input:checked + .toggle-ui { background: var(--primary); }
.toggle input:checked + .toggle-ui::after { transform: translateX(16px); }
.toggle input:focus-visible + .toggle-ui { outline: 2px solid var(--accent); outline-offset: 2px; }
.swatches, .pairs { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { width: 30px; height: 30px; padding: 0; border-radius: 50%; background: var(--c); border: 2px solid var(--line); }
.swatch.on { outline: 3px solid var(--accent); outline-offset: 2px; }
.swatch.custom, .pair.custom { position: relative; overflow: hidden; background: conic-gradient(red, yellow, lime, cyan, blue, magenta, red); }
.swatch.custom input, .pair.custom input { position: absolute; inset: -6px; width: calc(100% + 12px); height: calc(100% + 12px); opacity: 0; cursor: pointer; padding: 0; }
.pair { width: 40px; height: 30px; padding: 0; border-radius: 8px; background: linear-gradient(135deg, var(--a), var(--b)); border: 2px solid var(--line); display: inline-block; }
.pair.on { outline: 3px solid var(--accent); outline-offset: 2px; }
.tpl-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.tpl { display: flex; flex-direction: column; align-items: stretch; gap: 4px; padding: 6px; border-radius: 12px; background: var(--bg); color: var(--ink); border: 2px solid transparent; text-align: left; font-weight: 400; }
.tpl canvas { width: 100%; height: auto; border-radius: 8px; background: #222; }
.tpl.on { border-color: var(--accent); }
.tpl-name { font-weight: 700; font-size: 14px; }
.tpl-desc { font-size: 12px; color: var(--muted); line-height: 1.3; }
.font-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.font-card { display: flex; flex-direction: column; align-items: center; padding: 8px 4px; border-radius: 10px; background: var(--bg); color: var(--ink); border: 2px solid transparent; }
.font-card.on { border-color: var(--accent); }
.font-aa { font-size: 24px; line-height: 1.2; }
.font-name { font: 600 11px system-ui, sans-serif; color: var(--muted); }
.filter-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.filter { display: flex; flex-direction: column; gap: 4px; padding: 4px; border-radius: 10px; background: var(--bg); color: var(--ink); border: 2px solid transparent; font-size: 12px; font-weight: 600; }
.filter canvas { width: 100%; height: auto; border-radius: 6px; }
.filter.on { border-color: var(--accent); }
.layout-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.layout-card { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 4px; border-radius: 10px; background: var(--bg); color: var(--ink); border: 2px solid transparent; font-size: 12px; font-weight: 600; }
.layout-card.on { border-color: var(--accent); }
.layout-pic { width: 34px; height: 50px; border-radius: 4px; background: linear-gradient(135deg, #a78bfa, #f472b6); position: relative; display: block; }
.layout-pic i { position: absolute; background: #64748b; display: block; }
.l-full .layout-pic i { inset: 0; border-radius: 4px; }
.l-card .layout-pic i { inset: 8px 5px; border-radius: 3px; }
.l-polaroid .layout-pic i { inset: 9px 6px 15px; outline: 3px solid #fff; transform: rotate(-4deg); }
.l-frame .layout-pic i { inset: 3px; }
.cap-list { display: flex; flex-direction: column; gap: 8px; }
.cap-row { display: flex; flex-direction: row; gap: 8px; align-items: flex-start; font-weight: 400; }
.cap-row img { width: 44px; height: 56px; object-fit: cover; border-radius: 6px; flex: 0 0 auto; }
.music-card { display: flex; flex-direction: column; gap: 10px; padding: 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); }
.music-title { display: flex; align-items: center; gap: 6px; }
.wave-wrap canvas { width: 100%; height: 56px; display: block; }
.tracks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.track { display: flex; align-items: center; gap: 8px; padding: 6px; border-radius: 10px; }
.track:hover { background: var(--bg); }
.track.on { background: var(--bg); outline: 2px solid var(--accent); }
.track-main { flex: 1; display: flex; flex-direction: column; align-items: flex-start; background: transparent; color: var(--ink); padding: 2px 4px; font-weight: 400; text-align: left; }
.track-name { font-weight: 700; font-size: 14.5px; }
.track-mood { font-size: 12.5px; color: var(--muted); }
.track-on { color: var(--accent); display: inline-flex; }
.search { margin: 0; }
.sheet { position: fixed; inset: 0; background: rgba(10,14,25,0.6); display: grid; place-items: center; padding: 16px; z-index: 50; }
.sheet[hidden] { display: none; }
.sheet-card { background: var(--card); color: var(--ink); border-radius: 18px; padding: 20px; width: min(440px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.sheet-card > div { display: flex; flex-direction: column; gap: 12px; }
.sheet-preview { width: 140px; height: auto; align-self: center; border-radius: 10px; background: #111; }
.sheet video { width: 100%; max-height: 55vh; border-radius: 12px; background: #000; }
@media (max-width: 1180px) {
  .editor { --panel: 300px; --insp: 260px; }
}
@media (max-width: 960px) {
  .editor {
    height: auto; display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto auto auto auto auto;
    grid-template-areas: "top" "stage" "timeline" "insp" "tabs" "panel";
  }
  .ed-top { position: sticky; top: 0; z-index: 5; background: var(--bg); }
  .ed-stage { padding: 12px; }
  .stage-wrap { height: auto; width: min(100%, calc(56vh * 9 / 16)); max-height: 56vh; }
  .stage-wrap[style*="1280 / 720"] { width: 100%; }
  .ed-tabs { flex-direction: row; justify-content: space-around; border-right: 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); position: sticky; top: 56px; z-index: 4; }
  .ed-tabs button { flex: 1; }
  .ed-panel, .ed-inspector { border: 0; overflow: visible; }
  .ed-inspector { border-bottom: 1px solid var(--line); }
  .tpl-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ed-shapes .chips { flex-wrap: nowrap; overflow-x: auto; }
}
@media (max-width: 520px) {
  .tpl-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .font-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  #length { display: none; }
}
[hidden] { display: none !important; }
.ed-panel > *, .ed-inspector > * { flex-shrink: 0; }
label.chip { flex-direction: row; }
.tab-photo { display: none; }
@media (max-width: 960px) {
  .editor { grid-template-areas: "top" "stage" "timeline" "tabs" "panel" "insp"; }
  .tab-photo { display: contents; }
  .editor.show-photo .ed-panel { display: none; }
  .editor:not(.show-photo) .ed-inspector { display: none; }
  .ed-tabs { top: 0; }
  .ed-top { position: static; }
}
.track { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 8px; border-radius: 12px; }
.track .track-play { width: 40px; height: 40px; }
.track.playing { background: var(--bg); }
.track.playing .track-play { background: var(--accent); color: var(--on-accent); }
.track-main { cursor: pointer; }
.track-bar { display: none; width: 100%; height: 4px; border-radius: 4px; background: var(--line); margin-top: 6px; overflow: hidden; }
.track-bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .25s linear; }
.track.playing .track-bar { display: block; }
.track-time { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.track-use { padding: 7px 14px; border-radius: 999px; font-size: 13px; font-weight: 700; background: var(--primary); color: var(--on-primary); border: 0; }
.track-use.in { display: inline-flex; align-items: center; gap: 2px; background: transparent; color: var(--accent); padding: 7px 4px; }
.track-use.in svg { width: 16px; height: 16px; }
.icon-btn.round:hover:not(:disabled) { background: var(--primary); filter: brightness(1.15); }
.track.playing .track-play:hover:not(:disabled) { background: var(--accent); }
.code-input { font-size: 28px; letter-spacing: 10px; text-align: center; font-variant-numeric: tabular-nums; }
.cf-turnstile { min-height: 65px; }

/* ── Admin ───────────────────────────────────────────────────────────────── */
.a-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.a-head h1 { margin: 0; }
a.chip { text-decoration: none; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 14px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.tile.good { border-left: 4px solid var(--ok); } .tile.bad { border-left: 4px solid var(--error); }
.t-v { font-size: 30px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.t-l { font-weight: 700; font-size: 14px; } .t-h { font-size: 12.5px; color: var(--muted); }
.a-card { margin-bottom: 14px; } .a-card h3 { margin: 0 0 8px; font-size: 16px; }
.a-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }
.a-grid .a-card { margin: 0; }
.a-h2 { margin: 26px 0 10px; font-size: 20px; }
.bars, .funnel, .problems { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.problems { list-style: disc; padding-left: 18px; gap: 6px; font-size: 14.5px; }
.bars li, .funnel li { display: grid; grid-template-columns: minmax(90px, 1.2fr) 2fr auto; gap: 10px; align-items: center; font-size: 14px; }
.funnel li { grid-template-columns: minmax(150px, 1.6fr) 2fr auto; }
.b-bar { height: 10px; background: var(--bg); border-radius: 6px; overflow: hidden; }
.b-bar i { display: block; height: 100%; background: var(--accent); border-radius: 6px; }
.b-n { font-variant-numeric: tabular-nums; font-weight: 700; text-align: right; white-space: nowrap; }
.b-n small { color: var(--muted); font-weight: 500; }
.a-chart { width: 100%; height: auto; display: block; }
.c-visit { fill: var(--accent); opacity: 0.55; } .c-reel { stroke: var(--primary); stroke-width: 2.5; }
.c-t { font-size: 11px; fill: var(--muted); }
.key { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: middle; }
.k-visit { background: var(--accent); opacity: 0.55; } .k-reel { background: var(--primary); }
.a-table-wrap { overflow-x: auto; padding: 0; }
.a-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.a-table th, .a-table td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.a-table th { background: var(--bg); font-size: 12.5px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.a-table td.num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; }

.guest-note { margin-top: 10px; font-size: 0.9rem; font-weight: 600; color: #16233F; background: #FFF4CC; border-radius: 999px; padding: 6px 14px; }

/* ── home page: a finished reel and one button, before anything else ── */
.home-hero { display: grid; grid-template-columns: 1fr auto; gap: 32px; align-items: center; padding: 8px 0 32px; }
.home-hero h1 { font-size: clamp(30px, 6vw, 48px); line-height: 1.1; margin: 8px 0 10px; max-width: 16ch; }
.home-hi { font-size: 19px; font-weight: 600; margin: 0 0 10px; }
.home-badges { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }
.home-badges span { font-size: 13px; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: #FFF4CC; color: #16233F; }
.home-cta { margin: 18px 0 8px; }
.button.cta { font-size: 19px; padding: 14px 28px; border-radius: 14px; background: var(--accent); color: var(--on-accent); box-shadow: 0 6px 18px rgba(242, 185, 53, 0.45); }
.button.cta.block { display: block; text-align: center; }
.phone { width: 280px; aspect-ratio: 9 / 16; border-radius: 34px; padding: 10px; background: #111; box-shadow: 0 20px 50px rgba(22, 35, 63, 0.35); }
.phone video { width: 100%; height: 100%; border-radius: 26px; display: block; object-fit: cover; background: #222; }
.home-steps ol { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; counter-reset: step; }
.home-steps li { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px 16px 16px 60px; position: relative; display: flex; flex-direction: column; }
.home-steps li::before { counter-increment: step; content: counter(step); position: absolute; left: 16px; top: 16px; width: 32px; height: 32px; border-radius: 50%; background: var(--primary); color: var(--on-primary); display: grid; place-items: center; font-weight: 800; }
.home-steps li span { color: var(--muted); }
.home-steps, .home-examples, .home-end { margin: 8px 0 32px; }
.examples { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.examples figure { margin: 0; }
.examples img { width: 100%; height: auto; border-radius: 14px; display: block; border: 1px solid var(--line); }
.examples figcaption { text-align: center; font-weight: 600; font-size: 14px; margin-top: 6px; }
.home-end { text-align: center; padding: 24px 0 8px; }
.sticky-cta { display: none; }
@media (max-width: 720px) {
  .home-hero { grid-template-columns: 1fr; gap: 0; padding-top: 0; text-align: center; }
  /* Phone order: headline, the reel, then the button, all on the first screen. */
  .home-copy { display: contents; }
  .home-badges { order: 1; } .home-hero h1 { order: 2; } .home-hi { order: 3; } .phone { order: 4; }
  .home-cta { order: 5; } .home-copy > .muted { order: 6; } .home-hero .lead { order: 7; margin-top: 14px; }
  .home-hero h1 { font-size: 28px; margin-top: 10px; margin-bottom: 4px; }
  .home-hi { font-size: 16px; margin-bottom: 12px; }
  .home-cta { margin: 14px 0 6px; }
  .home-hero h1 { margin-left: auto; margin-right: auto; }
  .home-badges { justify-content: center; }
  .home-hero .lead { font-size: 16px; }
  .phone { width: min(56vw, calc(40vh * 9 / 16), 230px); margin: 0 auto; border-radius: 26px; padding: 7px; }
  .phone video { border-radius: 21px; }
  .home-steps ol { grid-template-columns: 1fr; }
  .examples { gap: 8px; }
  .sticky-cta { display: block; position: fixed; left: 0; right: 0; bottom: 0; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: var(--bg); border-top: 1px solid var(--line); z-index: 20; }
  .sticky-cta.watch { transform: translateY(110%); transition: transform 0.2s ease; }
  .sticky-cta.watch.show { transform: none; }
  body:has(.sticky-cta) footer { padding-bottom: 96px; }
}

/* ── feedback box ── */
.fb-dialog { border: 0; border-radius: 18px; padding: 0; width: min(440px, calc(100vw - 32px)); background: var(--card); color: var(--ink); box-shadow: 0 20px 60px rgba(0,0,0,0.35); }
.fb-dialog::backdrop { background: rgba(15, 22, 38, 0.55); }
.fb-form { padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.fb-form h2 { margin: 0; font-size: 20px; }
.fb-form p { margin: 0; }
.fb-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.fb-kinds { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.fb-kinds .chip { position: relative; cursor: pointer; }
.fb-kinds .chip input { position: absolute; opacity: 0; width: 1px; height: 1px; top: 0; left: 0; }
.fb-kinds .chip:has(input:checked) { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.fb-kinds .chip:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.fb-form textarea, .fb-form input[type=email], .card textarea { font: inherit; width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--ink); resize: vertical; display: block; margin-top: 4px; }
.fb-form label { font-weight: 600; }
.fb-form label .muted { font-weight: 400; }
.fb-hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; opacity: 0; }
.fb-status.error { color: var(--error); }
.status .link { font-weight: 700; text-decoration: underline; padding: 0; background: none; color: inherit; border: 0; cursor: pointer; }
.wm-locked .toggle { opacity: 0.6; }
.fb-list { display: flex; flex-direction: column; gap: 0; }
.fb-item { padding: 10px 0; border-bottom: 1px solid var(--line); }
.fb-item:last-child { border-bottom: 0; }
.fb-item p { margin: 2px 0; }
.fb-msg { white-space: pre-wrap; }

/* ── add to home screen ── */
.install-card { display: flex; align-items: center; gap: 12px; margin-top: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: #FFF8E1; color: #16233F; }
.install-card img { border-radius: 10px; flex: none; }
.install-text { flex: 1; display: flex; flex-direction: column; font-size: 14px; line-height: 1.35; }
.install-text span { color: #4b5568; font-size: 13px; }
.install-actions { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.install-actions .link { background: none; border: 0; color: inherit; text-decoration: underline; cursor: pointer; font-size: 13px; padding: 2px; }
.ios-steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }

/* ══ Modern refresh (Nov 2026) ═══════════════════════════════════════════════
   Brand font for headings and buttons, softer surfaces, one clear main action.
   On phones and small tablets the editor becomes a full-screen app: slim top bar,
   preview in the middle, photo strip, tools in a bottom sheet, fixed tab bar. */
@font-face { font-family: "Poppins"; font-weight: 500; font-display: swap; src: url(/fonts/poppins-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "Poppins"; font-weight: 700; font-display: swap; src: url(/fonts/poppins-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: "Poppins"; font-weight: 800; font-display: swap; src: url(/fonts/poppins-latin-800-normal.woff2) format("woff2"); }
:root { --radius: 14px; --shadow-sm: 0 1px 2px rgba(22,35,63,.06), 0 1px 1px rgba(22,35,63,.04); --shadow: 0 8px 24px rgba(22,35,63,.10); --head: "Poppins", system-ui, sans-serif; }
h1, h2, h3, .brand, .home-hero h1, .empty-title, .tpl-name, .ed-panel h2, .ed-inspector h2 { font-family: var(--head); letter-spacing: -0.01em; }
button, .button { font-family: var(--head); font-weight: 700; letter-spacing: 0; transition: transform .08s ease, background-color .15s ease, box-shadow .15s ease; }
button:active:not(:disabled), .button:active { transform: scale(0.97); }
.button.primary, button.primary { box-shadow: 0 4px 14px rgba(242,185,53,.35); }
.card, .points > div, .home-steps li { border-color: transparent; box-shadow: var(--shadow-sm), 0 0 0 1px var(--line); }
input, select, textarea { transition: border-color .15s ease, box-shadow .15s ease; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(22,35,63,.12); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.top { padding: 10px 16px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: saturate(1.4) blur(10px); position: sticky; top: 0; z-index: 30; }

/* editor, all sizes */
.ed-home { display: none; }
.shape-pick { display: none; }
.icon-btn.new-reel { width: auto; padding: 0 12px; gap: 6px; display: inline-flex; align-items: center; font-size: 14px; }
.ed-top { background: var(--card); }
.ed-tabs button svg { width: 22px; height: 22px; }
.ed-panel h2 { font-size: 19px; }
.ed-panel > p.muted:first-of-type { margin: -6px 0 0; font-size: 14px; }
.tpl { border-radius: 14px; transition: transform .12s ease, box-shadow .15s ease; }
.tpl:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.tpl.on { box-shadow: 0 0 0 2px var(--accent), var(--shadow); }
.clip-btn { border-radius: 12px; }
.clip.on { border-color: transparent; }
.clip.on .clip-btn { box-shadow: 0 0 0 3px var(--accent); }
.transport .icon-btn.round { box-shadow: var(--shadow-sm); }
.sheet-bar { display: none; }

@media (max-width: 960px) {
  /* The editor page is one screen: no page scroll, no site header. */
  body:has(main.editor-main) { overflow: hidden; height: 100dvh; }
  body:has(main.editor-main) > .top { display: none; }
  .editor {
    height: 100vh; height: 100dvh;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr) auto auto auto auto;
    grid-template-areas: "top" "stage" "timeline" "bar" "sheet" "tabs";
  }
  .ed-top { position: static; flex-wrap: nowrap; gap: 8px; padding: 8px 10px; padding-top: max(8px, env(safe-area-inset-top)); border-bottom: 1px solid var(--line); }
  .ed-home { display: inline-flex; flex: none; }
  .ed-shapes { display: none; }
  .shape-pick { display: block; flex: none; }
  .shape-pick select { width: auto; padding: 7px 28px 7px 10px; font-size: 14px; font-weight: 600; border-radius: 10px; background: var(--bg); }
  .ed-actions { flex: 1; flex-wrap: nowrap; justify-content: flex-end; gap: 4px; }
  .ed-actions .icon-btn { width: 38px; height: 38px; }
  .icon-btn.new-reel { width: 38px; padding: 0; justify-content: center; }
  .icon-btn.new-reel span { display: none; }
  #length { display: none; }
  #export { padding: 9px 14px; font-size: 15px; border-radius: 12px; white-space: nowrap; }

  .ed-stage { padding: 10px 12px 6px; gap: 6px; min-height: 0; }
  .stage-wrap, .stage-wrap[style*="1280 / 720"] { height: auto; max-height: 100%; width: auto; max-width: 100%; flex: 1 1 auto; min-height: 0; }
  .transport { gap: 8px; }
  .transport .icon-btn.round { width: 40px; height: 40px; }
  .time { min-width: 0; font-size: 12px; }

  .ed-timeline { padding: 6px 10px; border-top: 1px solid var(--line); }
  .timeline { gap: 6px; }
  .clip-btn { width: 50px; height: 64px; border-radius: 10px; }
  .clip-n, .clip-d { font-size: 10px; }

  /* The tool sheet: closed by default, so the preview has the screen. */
  .ed-panel, .ed-inspector { grid-area: sheet; display: none; max-height: 46dvh; overflow-y: auto; overscroll-behavior: contain; padding: 4px 16px 16px; border: 0; }
  .editor.sheet-open:not(.show-photo) .ed-panel { display: flex; }
  .editor.sheet-open.show-photo .ed-inspector { display: flex; }
  .editor.sheet-open .sheet-bar { display: flex; }
  .sheet-bar { grid-area: bar; align-items: center; justify-content: center; position: relative; padding: 8px 16px 2px; background: var(--card); border-top-left-radius: 20px; border-top-right-radius: 20px; box-shadow: 0 -8px 24px rgba(22,35,63,.10); border-top: 1px solid var(--line); }
  .sheet-grip { width: 40px; height: 5px; border-radius: 3px; background: var(--line); }
  .sheet-hide { position: absolute; right: 10px; top: 4px; background: transparent; color: var(--primary); padding: 6px 10px; font-size: 14px; box-shadow: none; }
  .ed-panel h2, .ed-inspector h2 { font-size: 17px; }

  /* Fixed bottom tab bar, like a phone app. */
  .ed-tabs { grid-area: tabs; position: static; flex-direction: row; justify-content: space-around; gap: 0; padding: 4px 6px; padding-bottom: max(4px, env(safe-area-inset-bottom)); border: 0; border-top: 1px solid var(--line); background: var(--card); }
  .ed-tabs button { flex: 1; padding: 6px 2px; font-size: 11px; border-radius: 10px; gap: 2px; }
  .ed-tabs button.on { background: transparent; color: var(--ink); }
  .ed-tabs button.on svg { color: var(--on-accent); background: var(--accent); border-radius: 999px; padding: 3px 12px; width: 48px; height: 28px; box-sizing: border-box; }
  .ed-tabs button svg { padding: 3px 12px; width: 48px; height: 28px; box-sizing: border-box; }

  /* Compact template cards: three across, name only. */
  .tpl-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .tpl { padding: 4px; }
  .tpl-desc { display: none; }
  .tpl-name { font-size: 12px; }
}
@media (max-width: 960px) {
  /* Top bar: fit a 360px-wide phone, Download always visible. */
  .ed-top { min-width: 0; overflow: hidden; padding-left: 8px; padding-right: 8px; gap: 6px; }
  .ed-home img { width: 28px; height: 28px; }
  .shape-pick select { padding: 6px 24px 6px 10px; font-size: 14px; max-width: 110px; }
  .ed-actions { gap: 2px; min-width: 0; }
  .ed-actions .icon-btn { width: 34px; height: 34px; border-color: transparent; background: transparent; }
  .ed-actions .icon-btn:disabled { opacity: .35; }
  #export { padding: 8px 14px; margin-left: 4px; flex: none; }
  #export .long { display: none; }
  /* With a sheet open, the preview keeps the room: the play bar steps aside. */
  .editor.sheet-open .transport { display: none; }
  .ed-panel, .ed-inspector { max-height: 40dvh; }
  /* Empty state, compact. */
  .empty { justify-content: safe center; gap: 10px; padding: 18px; overflow-y: auto; }
  .empty > * { flex-shrink: 0; margin: 0; }
  .empty-title { font-size: 20px; line-height: 1.25; }
  .empty .muted.small { display: none; }
  .empty .button { padding: 12px 22px; font-size: 16px; }
  .guest-note { font-size: 13px; padding: 6px 12px; border-radius: 12px; }
}
@media (max-width: 380px) { .ed-actions .icon-btn.new-reel { display: none; } }
@media (min-width: 961px) {
  .ed-tabs { padding: 12px 6px; gap: 6px; }
  .ed-tabs button { width: 100%; padding: 8px 2px; background: transparent; color: var(--muted); font-size: 11.5px; gap: 4px; }
  .ed-tabs button svg { padding: 4px 14px; width: 52px; height: 32px; box-sizing: border-box; border-radius: 999px; transition: background-color .15s ease; }
  .ed-tabs button:hover { background: transparent; color: var(--ink); }
  .ed-tabs button:hover svg { background: var(--bg); }
  .ed-tabs button.on { background: transparent; color: var(--ink); }
  .ed-tabs button.on svg { background: var(--accent); color: var(--on-accent); }
}
footer a { text-decoration: none; } footer a:hover { color: var(--ink); text-decoration: underline; }

/* dragging the words on the preview */
#stage.over-text { cursor: move; }
#stage.dragging-text { cursor: grabbing; }
.stage-wrap.snap-x::after { content: ""; position: absolute; top: 0; bottom: 0; left: 50%; width: 0; border-left: 2px dashed rgba(242,185,53,.95); pointer-events: none; }
.text-place { display: flex; flex-direction: column; gap: 8px; margin-top: -6px; }

/* adjust sliders */
.adj { display: flex; flex-direction: column; gap: 6px; }
.adj-row { display: grid; grid-template-columns: 84px minmax(0, 1fr) 40px; align-items: center; gap: 8px; font-weight: 500; font-size: 14px; }
.adj-row input[type=range] { padding: 0; }
.adj-v { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); font-size: 13px; }
.adj .link { align-self: flex-start; }

/* logo */
.logo-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.logo-prev { width: 56px; height: 56px; object-fit: contain; border-radius: 10px; background: repeating-conic-gradient(#e9e4da 0 25%, #fff 0 50%) 50% / 12px 12px; border: 1px solid var(--line); }
.logo-pick { position: relative; }

/* stickers */
.sticker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(56px, 1fr)); gap: 8px; }
.sticker-grid.tags { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
.sticker-btn { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 8px 4px; min-height: 56px; display: grid; place-items: center; color: var(--ink); box-shadow: none; }
.sticker-btn:hover { border-color: var(--primary); }
.sticker-emoji { font-size: 30px; line-height: 1; font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; }
.sticker-tag { font-family: var(--head); font-weight: 800; font-size: 12px; padding: 5px 8px; border-radius: 8px; transform: rotate(-4deg); white-space: nowrap; }
.sticker-list { display: flex; flex-direction: column; gap: 6px; }
.sticker-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; align-items: center; gap: 6px; }
.sticker-name { font-weight: 700; font-size: 18px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sticker-row .icon-btn { width: 34px; height: 34px; font-size: 18px; padding: 0; }
@media (max-width: 960px) { .ed-tabs button { font-size: 10.5px; } .ed-tabs button svg { width: 44px; padding: 3px 10px; } }

/* video clips */
.clip-row { display: grid; grid-template-columns: 64px minmax(0, 1fr) 44px; align-items: center; gap: 8px; font-size: 14px; font-weight: 500; }
.clip-row input[type=range] { padding: 0; }
.clip-v { position: absolute; bottom: 4px; left: 4px; background: rgba(0,0,0,0.65); color: #fff; font-size: 10px; border-radius: 5px; padding: 0 4px; }
