:root {
  --bg: #F6F6F7;
  --panel: #FFFFFF;
  --ink: #0B0B0C;
  --ink-2: #3F3F46;
  --muted: #71717A;
  --faint: #A1A1AA;
  --line: #E7E7EA;
  --line-2: #F0F0F2;
  --sans: Geist, Inter, -apple-system, system-ui, sans-serif;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font: 14px/1.45 var(--sans); -webkit-font-smoothing: antialiased; letter-spacing: -0.006em; }
body { display: flex; flex-direction: column; overflow: hidden; }
button, input { font: inherit; color: inherit; letter-spacing: inherit; }

/* ---------- top bar ---------- */
.top { height: 56px; flex: none; display: flex; align-items: center; justify-content: space-between; padding: 0 16px 0 20px; background: var(--panel); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; font-size: 14px; }
.logo { width: 20px; height: 20px; border-radius: 6px; background: var(--ink); position: relative; flex: none; }
.logo::after { content: ""; position: absolute; left: 7px; top: 5.5px; border-left: 7px solid #fff; border-top: 4.5px solid transparent; border-bottom: 4.5px solid transparent; }
.name { font-weight: 600; }
.slash { color: var(--line); font-size: 18px; }
.project { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.controls { display: flex; align-items: center; gap: 10px; }

.seg { display: inline-flex; background: var(--line-2); border-radius: 9px; padding: 2px; gap: 2px; }
.seg button { border: 0; background: transparent; height: 28px; padding: 0 10px; border-radius: 7px; cursor: pointer; font-weight: 500; color: var(--muted); font-size: 13px; }
.seg button:hover { color: var(--ink); }
.seg button.on { background: var(--panel); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08), 0 0 0 0.5px rgba(0,0,0,.06); }
.seg.small button { height: 26px; font-size: 12.5px; padding: 0 10px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; border: 1px solid var(--line); background: var(--panel); padding: 0 14px; border-radius: 9px; cursor: pointer; font-weight: 500; font-size: 13px; text-decoration: none; color: var(--ink); }
.btn:hover { background: #FAFAFA; }
.btn.primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn.primary:hover { background: #27272A; }
.btn[disabled] { opacity: .5; cursor: default; }

/* ---------- layout ---------- */
.layout { flex: 1; display: grid; grid-template-columns: 384px 1fr; min-height: 0; }
.panel { background: var(--panel); border-right: 1px solid var(--line); overflow-y: auto; padding: 22px 20px 28px; scrollbar-width: thin; }
.panel section + section { margin-top: 28px; }
.panel h2 { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; font-size: 13px; font-weight: 600; color: var(--ink); }
.step { width: 18px; height: 18px; border-radius: 50%; background: var(--ink); color: #fff; font-size: 11px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; }
.ask { margin: 28px 0 0; padding: 12px 14px; border-radius: 10px; background: var(--bg); color: var(--muted); font-size: 12.5px; line-height: 1.5; }

/* style cards */
.styles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.style { position: relative; border: 0; background: none; padding: 0; text-align: left; cursor: pointer; }
.style .thumb { aspect-ratio: 16/9; border-radius: 10px; overflow: hidden; background: var(--line-2); box-shadow: 0 0 0 1px var(--line); transition: box-shadow .15s; }
.style:hover .thumb { box-shadow: 0 0 0 1px #D4D4D8; }
.style.on .thumb { box-shadow: 0 0 0 2px var(--ink); }
.style video { width: 100%; height: 100%; object-fit: cover; display: block; }
.style b { display: block; margin-top: 8px; font-size: 13px; font-weight: 600; }
.style span { display: block; margin-top: 1px; font-size: 12px; color: var(--muted); line-height: 1.35; }
.style .check { position: absolute; top: 7px; right: 7px; width: 20px; height: 20px; border-radius: 50%; background: var(--ink); color: #fff; display: none; align-items: center; justify-content: center; }
.style.on .check { display: flex; }

/* extras */
.extras { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.extra { padding: 10px 12px; }
.extra + .extra { border-top: 1px solid var(--line-2); }
.extra-row { display: grid; grid-template-columns: 64px 1fr auto; gap: 12px; align-items: center; cursor: pointer; }
.extra .thumb { width: 64px; aspect-ratio: 16/9; border-radius: 6px; overflow: hidden; background: var(--line-2); box-shadow: 0 0 0 1px var(--line); }
.extra video { width: 100%; height: 100%; object-fit: cover; display: block; }
.extra b { display: block; font-size: 13px; font-weight: 500; }
.extra .desc { display: block; font-size: 12px; color: var(--muted); line-height: 1.35; }
.extra .opt { display: none; margin: 10px 0 2px 76px; }
.extra.on .opt { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.extra .opt:empty { display: none !important; }
.opt input[type=text] { flex: 1 1 100%; height: 32px; border: 1px solid var(--line); border-radius: 8px; padding: 0 10px; font-size: 13px; background: #fff; outline: none; }
.opt input[type=text]:focus { border-color: #A1A1AA; box-shadow: 0 0 0 3px rgba(0,0,0,.05); }
.swatch { width: 26px; height: 26px; border-radius: 50%; border: 0; cursor: pointer; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }
.swatch.on { box-shadow: 0 0 0 2px #fff, 0 0 0 3.5px var(--ink); }

/* switch */
.switch { position: relative; width: 32px; height: 18px; border-radius: 9px; background: #D4D4D8; border: 0; cursor: pointer; transition: background .15s; flex: none; }
.switch::after { content: ""; position: absolute; left: 2px; top: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform .15s; }
.switch[aria-checked="true"] { background: var(--ink); }
.switch[aria-checked="true"]::after { transform: translateX(14px); }

/* ---------- preview ---------- */
.preview { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.pass { flex: 1; min-height: 0; position: relative; display: flex; align-items: center; justify-content: center; padding: 32px 40px 16px; }
.stage-wrap { position: relative; border-radius: 10px; overflow: hidden; background: #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.05), 0 1px 2px rgba(0,0,0,.04), 0 16px 48px rgba(0,0,0,.10); }
.stage-wrap iframe { border: 0; display: block; transform-origin: 0 0; position: absolute; left: 0; top: 0; }
.loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--muted); pointer-events: none; }
.loading[hidden] { display: none; }
.loading.err { font: 12.5px/1.5 var(--mono); color: #B42318; white-space: pre-wrap; padding: 40px; }
.transport { flex: none; display: flex; align-items: center; gap: 14px; padding: 4px 40px 22px; }
.play { width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--ink); color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; flex: none; }
.play svg { width: 18px; height: 18px; }
.i-pause { display: none; } .playing .i-pause { display: block; } .playing .i-play { display: none; }
.time { font: 12px var(--mono); color: var(--muted); white-space: nowrap; width: 112px; text-align: right; }
.scrub { flex: 1; height: 30px; display: flex; align-items: center; cursor: pointer; }
.track { position: relative; height: 4px; width: 100%; background: #E4E4E7; border-radius: 2px; }
.fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--ink); border-radius: 2px; }
.head { position: absolute; top: 50%; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 1.5px var(--ink), 0 1px 3px rgba(0,0,0,.2); }
.mk { position: absolute; pointer-events: none; }
.mk.click { top: -6px; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: var(--faint); }

/* ---------- export dialog ---------- */
dialog { border: 0; border-radius: 16px; padding: 0; width: 460px; max-width: calc(100vw - 40px); box-shadow: 0 0 0 1px rgba(0,0,0,.06), 0 24px 70px rgba(0,0,0,.22); background: var(--panel); color: var(--ink); }
dialog::backdrop { background: rgba(10,10,12,.32); }
.dlg { padding: 18px 20px 20px; }
.dlg-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.dlg-head h3 { margin: 0; font-size: 16px; font-weight: 600; }
.close { border: 0; background: none; color: var(--muted); cursor: pointer; width: 28px; height: 28px; border-radius: 7px; display: flex; align-items: center; justify-content: center; }
.close:hover { background: var(--line-2); color: var(--ink); }
.choice { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.choice button { text-align: left; border: 1px solid var(--line); background: var(--panel); border-radius: 11px; padding: 12px; cursor: pointer; }
.choice button b { display: block; font-size: 14px; font-weight: 600; }
.choice button span { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.choice button.on { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.row { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; font-size: 13px; color: var(--ink-2); }
.row[hidden] { display: none; }
.hint { color: var(--muted); font-size: 12.5px; margin: 14px 0 0; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.phase { font-size: 14px; font-weight: 500; margin: 4px 0 12px; }
.bar { height: 6px; border-radius: 3px; background: var(--line-2); overflow: hidden; }
.bar div { height: 100%; width: 0; background: var(--ink); transition: width .2s; }
.result video, .result img { width: 100%; border-radius: 10px; display: block; background: var(--line-2); }

/* poster sits on top until hover, then the clip plays underneath */
.thumb { position: relative; }
.thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: opacity .2s; }
.style:hover .thumb img, .extra:hover .thumb img { opacity: 0; }
