:root {
  --page: #0b0b0c; --card: #1c1c1c; --well: #0d0d0d; --tile: #0f0f0f; --active: #5a5a5a; --active2: #2e2e2e;
  --text: #f2f2f2; --mute: #8d8d8d; --dim: #6b6b6b; --line: #2b2b2b; --accent: #ff4a00;
  font: 13px/1.35 -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; background: var(--page); color: var(--text); }
[hidden] { display: none !important; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
svg .f { fill: currentColor; stroke: none; }
button:focus-visible, input:focus-visible { outline: 2px solid #fff; outline-offset: 1px; }

.app { display: grid; grid-template-columns: 252px minmax(0, 1fr) 236px; gap: 8px; height: 100vh; height: 100dvh; padding: 8px; }
.side { display: flex; flex-direction: column; gap: 6px; min-height: 0; }
.card { border-radius: 16px; background: var(--card); }
.card.head { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; }
.card.list { padding: 6px; max-height: 60vh; overflow: auto; }
.card.body { flex: 1; min-height: 0; overflow: auto; padding: 8px; scrollbar-width: thin; scrollbar-color: #3a3a3a transparent; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; }
.logo { width: 20px; height: 20px; border-radius: 6px; background: var(--accent); box-shadow: inset 0 0 0 4px var(--accent), inset 0 0 0 20px #0b0b0b; }
.link { display: inline-flex; align-items: center; gap: 5px; padding: 3px 0; border: 0; background: none; font-size: 14px; }
.link svg { width: 13px; height: 13px; color: var(--mute); transition: transform .15s; }
.link[aria-expanded="true"] svg { transform: rotate(90deg); }
.tpl { display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px; border: 0; border-radius: 9px; background: none; text-align: left; }
.tpl:hover { background: #292929; }
.card.list { display: grid; gap: 2px; }
.card.list h3 { margin: 8px 6px 4px; }
.savebar { display: flex; gap: 5px; padding: 0 2px 4px; }
.savebar input { flex: 1; min-width: 0; padding: 6px 8px; border: 0; border-radius: 8px; background: var(--well); }
.savebar input::placeholder { color: var(--dim); }
.setup { position: relative; }
.setup .tpl { padding-right: 28px; }
.setup .tpl span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.setup-x { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 22px; height: 22px; padding: 0; border: 0; border-radius: 6px; background: none; color: var(--mute); font-size: 15px; line-height: 1; }
.setup-x:hover { background: #3a3a3a; color: #fff; }
.startover { margin-top: 6px; color: var(--mute); }
.tpl i { width: 44px; height: 30px; flex: none; border-radius: 6px; background-size: cover; background-position: center; }

.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin-bottom: 8px; }
.tabs button { padding: 9px 4px; border: 0; border-radius: 12px; background: none; color: var(--mute); font-size: 14px; font-weight: 500; }
.tabs button[aria-selected="true"] { background: var(--active2); color: var(--text); }

h3 { margin: 18px 2px 8px; color: var(--dim); font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; }
.hint { margin: 6px 2px; color: var(--dim); font-size: 12px; overflow-wrap: anywhere; }
.hint.center { text-align: center; }
.warn { margin: 8px 2px 0; color: #e8b08f; font-size: 12px; line-height: 1.4; }
.row { display: flex; gap: 6px; justify-content: center; }
.ghost { padding: 5px 10px; border: 0; border-radius: 8px; background: #2c2c2c; color: var(--text); }

.dd { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 12px; background: #292929; text-align: left; }
.dd-thumb { width: 38px; height: 26px; flex: none; border-radius: 4px; background: #d9d9d9 linear-gradient(#d9d9d9 34%, #2a2a2a 34%); border: 1px solid #555; }
.dd-frame { width: 32px; height: 24px; flex: none; border-radius: 4px; background: #7b7b7b; border: 1.5px solid #e8e8e8; }
.dd-t { flex: 1; min-width: 0; display: grid; }
.dd-t b { font-weight: 500; font-size: 14px; }
.dd-t small { color: var(--mute); font-size: 11.5px; }
.chev { width: 14px; height: 14px; color: var(--mute); }
.dd[aria-expanded="true"] .chev { transform: rotate(180deg); }
.ddlist { margin-top: 4px; padding: 4px; border-radius: 12px; background: var(--well); }
.ddlist button { display: flex; justify-content: space-between; gap: 8px; width: 100%; padding: 7px 8px; border: 0; border-radius: 8px; background: none; text-align: left; }
.ddlist button:hover, .ddlist button[aria-pressed="true"] { background: #2a2a2a; }
.ddlist small { color: var(--mute); }
.customsize { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 6px 4px 4px; }
.customsize label { display: flex; align-items: center; gap: 5px; color: var(--mute); }
.customsize input { width: 100%; padding: 5px 6px; border: 1px solid #333; border-radius: 7px; background: #1a1a1a; }

.magic { position: relative; display: flex; align-items: center; gap: 8px; margin-top: 8px; padding: 10px 8px 15px; border-radius: 12px; background: #161616; border: 1px solid #222; }
.magic b { flex: 1; font-weight: 500; color: #a9a9a9; }
.magic button { width: 24px; height: 24px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 6px; background: none; color: #8a8a8a; }
.magic button:hover { background: #2a2a2a; color: #fff; }
.magic button svg { width: 13px; height: 13px; }
.spark { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px; background: #232323; color: #d877b6; }
.spark svg { width: 17px; height: 17px; fill: currentColor; stroke: none; }
.magicbar { position: absolute; left: 10px; right: 10px; bottom: 7px; height: 3px; border-radius: 3px; background: #2a2a2a; overflow: hidden; }
.magicbar i { display: block; height: 100%; width: 0; background: #8d8d8d; }

.mediabox { display: block; width: 100%; padding: 0; border: 0; border-radius: 12px; background: var(--well); overflow: hidden; }
.mediabox canvas { display: block; width: 100%; aspect-ratio: 3 / 2; }
.mediabox.drop { outline: 2px solid #fff; }

.styles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.st { padding: 0; border: 0; background: none; color: var(--mute); font-size: 11.5px; min-width: 0; }
.st span { display: block; margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st i { position: relative; display: block; aspect-ratio: 4 / 3; border-radius: 10px; overflow: hidden; background: linear-gradient(145deg, #bdbdbd, #6f6f6f); box-shadow: 0 0 0 2px transparent; }
.st[aria-pressed="true"] { color: var(--text); }
.st[aria-pressed="true"] i { box-shadow: 0 0 0 2px var(--card), 0 0 0 3.5px #bdbdbd; }
.st i::after { content: ""; position: absolute; left: 25%; top: -14%; width: 90%; height: 84%; border-radius: 14px; background: #f2f2f2; }
.st.s-default i::after { box-shadow: 0 2px 8px rgba(0,0,0,.35); }
.st.s-glassLight i::after { box-shadow: 0 0 0 4px rgba(255,255,255,.55); }
.st.s-glassDark i::after { box-shadow: 0 0 0 4px rgba(40,40,40,.8); }
.st.s-liquid i { background: repeating-linear-gradient(120deg, #f09a2f 0 4px, #d4611a 4px 7px); }
.st.s-liquid i::after { box-shadow: 0 0 0 4px rgba(255,235,200,.7); }
.st.s-insetLight i::after { box-shadow: inset 0 0 0 3px #fff, 0 2px 7px rgba(0,0,0,.25); background: #3a3a3a linear-gradient(#a55f3a, #2b3b52); }
.st.s-insetDark i::after { box-shadow: inset 0 0 0 2px #333, 0 2px 7px rgba(0,0,0,.25); }
.st.s-outline i::after { box-shadow: 0 0 0 3px #bdbdbd, 0 0 0 4px #8b8b8b; }
.st.s-border i::after { box-shadow: 0 0 0 5px #000; }
.st.s-more i { background: var(--tile); display: grid; place-items: center; color: #c9c9c9; font-size: 18px; letter-spacing: 2px; }
.st.s-more i::after { display: none; }
.st.s-neon i::after { box-shadow: 0 0 0 3px #ff4a00, 0 0 12px 3px #ff4a00; }
.st.s-none i::after { box-shadow: none; border-radius: 0; }

.corners { display: grid; grid-template-columns: repeat(3, 1fr); padding: 6px; border-radius: 12px; background: var(--well); margin-bottom: 7px; }
.corners button { display: grid; justify-items: center; gap: 5px; padding: 8px 2px; border: 0; border-radius: 9px; background: none; color: var(--mute); font-size: 12px; }
.corners button[aria-pressed="true"] { background: #2c2c2c; color: var(--text); }
.corners svg { width: 24px; height: 24px; }

.isl { position: relative; display: block; height: 38px; margin-top: 5px; border-radius: 10px; background: var(--well); overflow: hidden; }
.isl span, .isl output { position: absolute; top: 50%; transform: translateY(-50%); color: var(--mute); pointer-events: none; z-index: 1; font-size: 12.5px; }
.isl span { left: 12px; } .isl output { right: 12px; font-variant-numeric: tabular-nums; }
.isl input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; background: none; -webkit-appearance: none; appearance: none; cursor: ew-resize; }
.isl input::-webkit-slider-runnable-track { height: 100%; background: none; }
.isl input::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 30px; margin-top: 4px; border-radius: 5px; background: #6a6a6a; }
.isl input:focus-visible { outline-offset: -2px; }

.seg { display: flex; gap: 2px; padding: 3px; border-radius: 12px; background: var(--well); }
.seg button { flex: 1; min-width: 0; padding: 8px 4px; border: 0; border-radius: 9px; background: none; color: var(--mute); }
.seg button[aria-pressed="true"] { background: var(--active); color: var(--text); }
.seg.tall button { display: grid; gap: 2px; padding: 8px 2px; font-size: 15px; }
.seg.tall small { font-size: 11px; color: inherit; opacity: .85; }
.seg.tall span, .seg.tall small { pointer-events: none; }
.seg.small { width: fit-content; }
.seg.small button { padding: 6px 12px; }
.seg.icons { margin-bottom: 8px; }
.seg.icons button { display: flex; justify-content: center; gap: 3px; padding: 9px 4px; }
.seg.icons .d { width: 8px; height: 17px; border-radius: 3px; background: #666; }
.seg.icons [aria-pressed="true"] .d { background: #f2f2f2; }

.fxgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.fxgrid button { display: grid; gap: 6px; justify-items: stretch; text-align: center; padding: 0; border: 0; background: none; color: var(--mute); font-size: 12px; }
.fxgrid svg { display: block; box-sizing: border-box; width: 100%; height: 58px; padding: 17px; border-radius: 12px; background: var(--tile); color: #d5d5d5; }
.fxgrid button[aria-pressed="true"] { color: var(--text); }
.fxgrid button[aria-pressed="true"] svg { box-shadow: inset 0 0 0 1.5px #a5a5a5; }
.fxgrid button.on svg { color: var(--accent); }
.fxpanel { margin-top: 8px; }
.fxpanel .seg { margin-top: 6px; }
.text { width: 100%; padding: 9px 10px; border: 0; border-radius: 10px; background: var(--well); }
.text::placeholder { color: var(--dim); }

.scenes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.scenes button { padding: 0; border: 0; background: none; color: var(--mute); font-size: 12px; }
.scenes i { display: grid; place-items: center; aspect-ratio: 4 / 3; margin-bottom: 4px; border-radius: 11px; background: var(--tile) center / cover no-repeat; color: #d5d5d5; }
.scenes i svg { width: 22px; height: 22px; }
.scenes button[aria-pressed="true"] { color: var(--text); }
.scenes button[aria-pressed="true"] i { box-shadow: 0 0 0 2px var(--card), 0 0 0 3.5px #bdbdbd; }

.bgkinds { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.bgkinds > * { position: relative; display: grid; gap: 4px; justify-items: stretch; padding: 0; border: 0; background: none; color: var(--mute); font-size: 12px; text-align: center; cursor: pointer; }
.bgkinds svg, .bgkinds .checker { box-sizing: border-box; display: block; width: 100%; height: 42px; padding: 11px; border-radius: 11px; background: var(--tile); color: #e6e6e6; }
.bgkinds .checker { background: repeating-conic-gradient(#777 0 25%, #1f1f1f 0 50%) 50% / 14px 14px; }
.bgkinds input { position: absolute; left: 0; top: 0; width: 100%; height: 42px; opacity: 0; cursor: pointer; }
.bgkinds [aria-pressed="true"] svg, .bgkinds [aria-pressed="true"] .checker { box-shadow: 0 0 0 2px var(--card), 0 0 0 3.5px #bdbdbd; }
.bgkinds [aria-pressed="true"] { color: var(--text); }

.cat { margin-top: 16px; }
.cat h4 { margin: 0 2px 7px; font-size: 14px; font-weight: 500; }
.swatches { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.swatches button { position: relative; aspect-ratio: 1 / .85; padding: 0; border: 0; border-radius: 10px; background: #222 center / cover no-repeat; }
.swatches button[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--card), 0 0 0 3.5px #bdbdbd; }
.swatches .more { display: grid; place-items: center; background-color: #2d2d2d; color: #e2e2e2; overflow: hidden; }
.swatches .more::before { content: ""; position: absolute; inset: 0; background: inherit; filter: blur(3px) brightness(.65); }
.swatches .more svg { position: relative; width: 14px; height: 14px; stroke-width: 2.4; }
.swatches .more[aria-expanded="true"] svg { transform: rotate(180deg); }

.center { position: relative; display: grid; grid-template-rows: minmax(0, 1fr) auto; min-width: 0; min-height: 0; }
.stagewrap { display: grid; place-items: center; min-height: 0; overflow: hidden; padding: 58px 12px 12px; }
.stage { position: relative; }
.stage.alpha { background: repeating-conic-gradient(#2a2a2a 0 25%, #1a1a1a 0 50%) 50% / 22px 22px; }
.stage.dragging { outline: 2px solid #fff; outline-offset: 2px; }
#c { display: block; width: 100%; height: 100%; }
.over { position: absolute; inset: 0; overflow: hidden; }
.fr { position: absolute; cursor: move; touch-action: none; container-type: inline-size; }
.fr .scr { position: absolute; display: grid; place-items: center; overflow: hidden; }
.fr:hover { outline: 1px solid rgba(255,255,255,.35); }
.fr.sel { outline: 1px solid rgba(255,255,255,.85); }
.fr.drop { outline: 2px solid #fff; }
.swap { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); padding: 6px 11px; border-radius: 9px; background: rgba(12,12,12,.72); color: #f2f2f2; font-size: 12.5px; white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity .12s; }
.fr:hover .swap { opacity: 1; }
.fr:active .swap { opacity: 0; }
@media (hover: none) { .swap { display: none; } }
.hd { position: absolute; width: 9px; height: 9px; margin: -4.5px; background: #fff; border-radius: 50%; box-shadow: 0 0 0 1px rgba(0,0,0,.5); display: none; touch-action: none; }
.fr.sel .hd { display: block; }
.hd.nw { left: 0; top: 0; cursor: nwse-resize; } .hd.n { left: 50%; top: 0; cursor: ns-resize; }
.hd.ne { left: 100%; top: 0; cursor: nesw-resize; } .hd.e { left: 100%; top: 50%; cursor: ew-resize; }
.hd.se { left: 100%; top: 100%; cursor: nwse-resize; } .hd.s { left: 50%; top: 100%; cursor: ns-resize; }
.hd.sw { left: 0; top: 100%; cursor: nesw-resize; } .hd.w { left: 0; top: 50%; cursor: ew-resize; }
.guide { position: absolute; background: #fff; pointer-events: none; }
.gx { left: 50%; top: 0; bottom: 0; width: 1px; } .gy { top: 50%; left: 0; right: 0; height: 1px; }

/* The empty state of a frame: a preview aid, never part of the export. Sized on the frame. */
.ph { display: flex; flex-direction: column; align-items: center; pointer-events: none; user-select: none; }
.ph-icons { position: relative; width: 20cqw; height: 11cqw; margin-bottom: 3.6cqw; }
.ph-a { position: absolute; left: 0; top: 0; width: 8.4cqw; transform: rotate(-9deg); stroke: none; -webkit-mask: linear-gradient(#000 45%, transparent 105%); mask: linear-gradient(#000 45%, transparent 105%); }
.ph-b { position: absolute; right: 0; top: .5cqw; width: 10cqw; transform: rotate(8deg); stroke: none; -webkit-mask: linear-gradient(#000 25%, transparent 85%); mask: linear-gradient(#000 25%, transparent 85%); }
.ph-plus { position: absolute; left: 50%; top: 58%; transform: translateX(-50%); display: grid; place-items: center; width: 7cqw; height: 7cqw; min-width: 16px; min-height: 16px; padding: 0; border: 0; border-radius: 50%; background: #f1f1f1; color: #111; pointer-events: auto; }
.ph-plus svg { width: 56%; height: 56%; stroke-width: 2.4; }
.ph-t { margin: 0; font-size: 5.6cqw; line-height: 1.15; font-weight: 500; letter-spacing: -.01em; color: #666; }
.ph-s { margin: 1.2cqw 0 0; font-size: 2.8cqw; line-height: 1.2; color: #575757; }

.exportbar { position: absolute; top: 4px; right: 4px; z-index: 5; display: flex; gap: 6px; padding: 5px; border-radius: 16px; background: #e8e8e8; color: #111; }
.exp { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border: 0; border-radius: 11px; background: none; color: inherit; }
.exp svg { width: 19px; height: 19px; stroke-width: 2; }
.exp b { font-size: 15px; font-weight: 500; }
.exp small { font-size: 12.5px; color: #444; white-space: nowrap; }
.exp2 { width: 34px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 10px; background: #cfcfcf; color: #111; }
.exp2:hover, .exp:hover { background: #d9d9d9; }
.exp2 svg { width: 18px; height: 18px; }
.exppop { position: absolute; right: 0; top: calc(100% + 6px); width: 290px; max-height: calc(100vh - 90px); overflow: auto; padding: 4px 12px 12px; border: 1px solid #333; border-radius: 16px; background: var(--card); color: var(--text); box-shadow: 0 20px 50px rgba(0,0,0,.6); }
.exppop h3:first-child { margin-top: 10px; }
.readout { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; padding: 10px 12px; border: 1px solid #303030; border-radius: 10px; color: var(--mute); }
.readout b { color: var(--text); font-weight: 500; font-variant-numeric: tabular-nums; }
.tog { display: flex; align-items: center; gap: 8px; margin-top: 10px; color: var(--mute); }
.tog input { accent-color: #d0d0d0; }

.zt { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 4px; }
.prec { display: inline-flex; align-items: center; gap: 5px; padding: 3px; border: 0; border-radius: 7px; background: none; color: var(--dim); font-size: 11px; white-space: nowrap; }
.prec i { display: grid; place-items: center; width: 16px; height: 16px; border-radius: 4px; background: #333; color: #aaa; }
.prec svg { width: 11px; height: 11px; }
.prec svg path { fill: currentColor; stroke: none; }
.prec[aria-pressed="true"] { color: var(--text); }
.prec[aria-pressed="true"] i { background: #e6e6e6; color: #111; }
.layouts { display: grid; gap: 8px; }
.layouts button { padding: 0; border: 0; background: none; border-radius: 12px; overflow: hidden; }
.layouts canvas { display: block; width: 100%; border-radius: 11px; }
.layouts button[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--card), 0 0 0 3.5px #bdbdbd; }

.time { display: flex; align-items: center; gap: 10px; padding: 7px 10px; margin: 0 auto; width: min(640px, 100%); border-radius: 14px; background: var(--card); }
.play { width: 28px; height: 28px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 8px; background: #2d2d2d; }
.play svg { width: 16px; height: 16px; }
#seek { flex: 1; min-width: 60px; accent-color: #cfcfcf; }
#clock { color: var(--mute); font-variant-numeric: tabular-nums; white-space: nowrap; font-size: 12px; }
.status { max-width: 34%; margin: 0; color: var(--mute); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status:empty { display: none; }
.status.err { color: #ff9b78; }

.busy { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; background: rgba(0,0,0,.55); }
.busybox { display: grid; gap: 10px; width: min(340px, 90vw); padding: 18px; border-radius: 16px; background: var(--card); }
.busybox p { margin: 0; font-variant-numeric: tabular-nums; }
.busybox progress { width: 100%; accent-color: #d0d0d0; }
.busybox .ghost { justify-self: end; }

@media (max-width: 1020px) {
  html, body { height: auto; }
  .app { grid-template-columns: minmax(0, 1fr); height: auto; }
  .center { order: -1; grid-template-rows: 62vh auto; }
  .card.body { overflow: visible; }
  .side { min-height: auto; }
}
