/* ================= Artist editor workspace ================= */
.ed { height: 100vh; display: flex; flex-direction: column; overflow: hidden; background: var(--bg); }
.ed-top { height: 58px; flex: none; display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--line); background: var(--bg-2); }
.ed-div { width: 1px; height: 24px; background: var(--line-2); }
.ed-name { background: transparent; border: 1px solid transparent; border-radius: 8px; padding: 6px 10px; font-weight: 700; font-size: 17px; width: min(380px, 34vw); outline: none; }
.ed-name:hover, .ed-name:focus { border-color: var(--line-2); background: var(--bg); }
.save-state { font-size: 12px; color: var(--muted); }
.avatar.sm { width: 36px; height: 36px; font-size: 13px; color: #fff; }

/* ---- grid: adapts to the frame's aspect ratio (--tl-h is set by dragging the timeline grip) ---- */
.ed-main { flex: 1; min-height: 0; display: grid; gap: 10px; padding: 10px;
  grid-template-areas: "side stage right" "tl stage right";
  grid-template-columns: minmax(0, 1fr) var(--stage-w, 380px) 390px;
  grid-template-rows: minmax(0, 1fr) var(--tl-h, minmax(0, 1fr)); }
.ar-landscape .ed-main { grid-template-areas: "side stage right" "tl tl right"; grid-template-columns: 370px minmax(0, 1fr) 370px; grid-template-rows: minmax(0, 1fr) var(--tl-h, 262px); }
.ar-square .ed-main { grid-template-areas: "side stage right" "tl tl right"; grid-template-columns: minmax(300px, 1fr) var(--stage-w, 420px) 380px; grid-template-rows: minmax(0, 1fr) var(--tl-h, 250px); }
.ed.tl-big.ar-portrait .ed-main { grid-template-rows: minmax(0, .55fr) minmax(0, 1.45fr); }
.ed.tl-big:not(.ar-portrait) .ed-main { grid-template-rows: minmax(0, 1fr) 430px; }

/* header account menu & generic dropdowns */
.acct { display: flex; align-items: center; gap: 6px; padding: 3px 8px 3px 3px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--bg); color: var(--muted); cursor: pointer; }
.dd-menu.right { left: auto; right: 0; }
.dd-menu a { display: flex; gap: 9px; align-items: center; padding: 9px 10px; border-radius: 8px; color: var(--text); font-size: 13px; }
.dd-menu a:hover { background: var(--surface-3); }
.dd-menu button.on { background: rgba(255, 153, 28, .16); color: var(--accent-2); }
.dd-who { padding: 8px 10px 10px; border-bottom: 1px solid var(--line-2); margin-bottom: 4px; display: flex; flex-direction: column; }
.dd-who small { color: var(--muted); font-size: 11.5px; }
.dd-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); font-weight: 700; padding: 8px 10px 4px; }

/* preview header */
.pv-head { flex: none; display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.pv-kind { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 13.5px; }
.pv-kind i { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.pv-chip { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border-radius: 9px; border: 1px solid var(--line-2); background: var(--surface-2); color: var(--muted); font-size: 12.5px; cursor: pointer; }
.pv-chip b { color: var(--text); }
.pv-chip:hover { border-color: var(--accent); }
.asp-ic { display: inline-block; border: 1.6px solid currentColor; border-radius: 2px; color: var(--text); }
.bg-dot { width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid var(--line-2); display: inline-block; }
.dd-menu .asp-ic { margin-right: 4px; }
/* Aspect / Background pickers (list style, floating so they never get clipped by the preview panel) */
.dd-menu.floating { position: fixed; right: auto; z-index: 700; min-width: 0; width: 232px; padding: 6px; animation: ddIn .2s cubic-bezier(.2, .8, .2, 1) both; }
.dd-menu.floating.up { animation-name: ddUp; }
@keyframes ddUp { from { opacity: 0; transform: translateY(6px) scale(.97); } to { opacity: 1; transform: none; } }
.sel-title { font-size: 12px; color: var(--muted); padding: 8px 10px 6px; font-weight: 500; }
.sel-item { display: flex !important; align-items: center; gap: 10px; width: 100%; padding: 9px 10px !important; border: 0; border-radius: 9px; background: none; color: var(--text); font-size: 13.5px; cursor: pointer; text-align: left; }
.sel-item:hover { background: var(--surface-3); }
.sel-item.on { background: rgba(255, 153, 28, .16) !important; color: var(--accent-2) !important; }
.sel-item small { color: var(--muted); font-size: 11.5px; }
.sel-item .asp-ic { color: inherit; flex: none; }
.sel-item .ic { flex: none; }
.sel-dot { width: 14px; height: 14px; border-radius: 50%; flex: none; box-shadow: 0 0 0 1.5px rgba(255, 255, 255, .25) inset; }
.sel-item input[type=color] { width: 26px; height: 22px; padding: 0; border: 1px solid var(--line-2); border-radius: 6px; cursor: pointer; }
.sel-sep { height: 1px; background: var(--line-2); margin: 6px 4px; }
.sel-note { font-size: 11.5px; color: var(--muted); padding: 6px 10px 4px; line-height: 1.4; }
.pv-chip.dd-open { border-color: var(--accent); color: var(--text); }
.pv-chip .ic { transition: transform .15s; }
.pv-chip.dd-open .ic { transform: rotate(180deg); }
.pv-head { flex-wrap: nowrap; min-width: 0; }
.pv-kind { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 0 1 auto; }
.pv-chip { white-space: nowrap; flex: none; }
.stage-box { container-type: inline-size; }
@container (max-width: 380px) { .pv-kind .pv-word { display: none; } .pv-chip { padding: 0 8px; gap: 4px; } .pv-chip .pv-cap { display: none; } }
.swatches { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; padding: 6px 0 10px; }
.sw { width: 34px; height: 34px; border-radius: 9px; border: 2px solid var(--line-2); cursor: pointer; font-weight: 800; font-size: 11px; color: #fff; padding: 0; }
.sw.on { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(255, 153, 28, .35); }
.custom-bg { margin-bottom: 8px; color: var(--muted); }
.bg-menu p { margin: 6px 0; }
.player video { opacity: 0; }

/* Caption Tools panel */
.pill-btn.open { border-color: var(--accent); background: rgba(255, 153, 28, .12); }
.tools-panel { border: 1px solid var(--line); border-radius: 14px; padding: 4px 12px 12px; margin-bottom: 12px; background: var(--bg-2); animation: tin .18s ease; }
.tp-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .16em; color: var(--muted); font-weight: 700; text-align: center; margin: 12px 0 8px; display: flex; align-items: center; gap: 10px; }
.tp-label::before, .tp-label::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.tp-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.tp-grid label { display: flex; flex-direction: column; gap: 5px; font-size: 11.5px; color: var(--muted); min-width: 0; }
.tp-ctl { display: flex; align-items: center; gap: 4px; height: 36px; padding: 0 8px; border: 1px solid var(--line-2); border-radius: 9px; background: var(--surface); color: var(--muted); min-width: 0; }
.tp-ctl select, .tp-ctl input { flex: 1; min-width: 0; border: 0; background: none; outline: none; color: var(--text); font-size: 12.5px; font-weight: 600; }
.tp-ctl input::-webkit-inner-spin-button { display: none; }
.tp-reset { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 2px; display: grid; place-items: center; }
.tp-reset:hover { color: var(--text); }
.tcard { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); margin-bottom: 8px; transition: border-color .15s, background .15s; }
.tcard.on { border-color: rgba(255, 153, 28, .55); background: rgba(255, 153, 28, .07); }
.tcard > div { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.tcard b { font-size: 13.5px; }
.tcard small { color: var(--muted); font-size: 11.5px; line-height: 1.35; }
.tcard-ic { width: 34px; height: 34px; border-radius: 9px; background: var(--surface-3); display: grid; place-items: center; color: var(--muted); flex: none; }
.tcard.on .tcard-ic { color: var(--accent-2); background: rgba(255, 153, 28, .18); }
.tcard.col { flex-direction: column; align-items: stretch; gap: 8px; }
.tcard.col input[type=range] { width: 100%; }
.delay-v { font-size: 12px; color: var(--muted); white-space: nowrap; }
.tcard.on .delay-v { color: var(--accent-2); }
.mono { font-family: ui-monospace, Consolas, monospace; }
.tp-btns { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 4px; }

/* words inside caption rows */
.ctext .wd { display: inline-block; padding: 1px 5px; margin: 1px -2px; border-radius: 7px; cursor: pointer; transition: background .12s; border: 1px solid transparent; }
.ctext .wd:hover { background: var(--surface-3); }
.ctext .wd.sel { border-color: var(--accent); background: rgba(255, 153, 28, .14); }
.ctext .wd.emph { background: rgba(47, 210, 122, .14); color: #6ff0a8; }
.ctext .wd.spot { background: rgba(255, 212, 0, .16); color: #ffe066; }
.ctext .wd.anim { text-decoration: underline dotted var(--accent-2); text-underline-offset: 4px; }
.ctext .wd.behind { opacity: .65; font-style: italic; }
.ctext .wd.br::before { content: '↵'; color: var(--muted); font-size: 11px; margin-right: 3px; }
.ctext.editing { background: var(--bg); box-shadow: 0 0 0 1px var(--accent); }
.wd-edit { display: inline-flex; align-items: center; gap: 2px; padding: 1px 3px; border: 1px solid var(--accent); border-radius: 8px; background: var(--bg); vertical-align: middle; }
.wd-edit input { border: 0; background: none; outline: none; color: var(--text); font: inherit; font-size: 15px; padding: 2px 4px; min-width: 3ch; }
.wd-edit input::selection { background: var(--accent); }
.wd-edit button { width: 22px; height: 22px; border: 0; border-radius: 6px; background: none; color: var(--muted); display: grid; place-items: center; cursor: pointer; }
.wd-edit button:hover { color: var(--text); background: var(--surface-3); }

/* word context menu */
.pop.wmenu { width: 260px; padding: 6px; }
.pop .mi { display: flex; align-items: flex-start; gap: 10px; width: 100%; padding: 8px 10px; border: 0; background: none; border-radius: 9px; color: var(--text); text-align: left; cursor: pointer; }
.pop .mi .ic { margin-top: 2px; color: var(--muted); }
.pop .mi span { display: flex; flex-direction: column; }
.pop .mi b { font-size: 13.5px; font-weight: 600; }
.pop .mi small { font-size: 11px; color: var(--muted); }
.pop .mi:hover:not(:disabled) { background: var(--surface-3); }
.pop .mi.on .ic, .pop .mi.on b { color: var(--accent-2); }
.pop .mi:disabled { opacity: .4; cursor: not-allowed; }
.pop hr { border: 0; border-top: 1px solid var(--line-2); margin: 4px 6px; }
.pop.sub { width: 250px; z-index: 601; }

/* timeline extras */
.tl-box { position: relative; }
.tl-grip { position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 60px; height: 8px; cursor: ns-resize; z-index: 5; }
.tl-grip::after { content: ''; position: absolute; left: 12px; right: 12px; top: 3px; height: 3px; border-radius: 3px; background: var(--line-2); }
.tl-grip:hover::after { background: var(--accent); }
.tl-add { height: 38px; }
.tl-btn:disabled { opacity: .35; cursor: not-allowed; }
.tl-btn.on:not(.tog) { color: var(--accent-2); border-color: var(--accent); }
.cap-i { font-style: italic; font-weight: 800; font-family: Georgia, serif; }
.tl-seg.word { background: linear-gradient(180deg, #d9c48f, #b9a46c); border-color: #e9d9a8; color: #2a2108; }
.tl-seg.word span { font-weight: 600; }
.tl-seg.word.grp { box-shadow: inset 0 0 0 1px rgba(255, 153, 28, .9); }
.tl-seg.word.emph { background: linear-gradient(180deg, #f2d98c, #d8b34f); }
.tl-seg.word.sel { background: linear-gradient(180deg, #ff991c, #e67e00); color: #fff; border-color: #fff; }
.tl-seg.behind { background-image: repeating-linear-gradient(135deg, rgba(0, 0, 0, .12) 0 4px, transparent 4px 8px); }
.tl-seg .tb { position: absolute; top: 1px; left: 4px; font-size: 9px; font-weight: 800; }
.tl-seg .ti { position: absolute; bottom: 1px; right: 5px; font-size: 9px; font-style: normal; }

/* library */
.lib-scope { margin-bottom: 10px; }
.lib-scope small { opacity: .6; margin-left: 4px; }
.lib-bar { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.lib-bar .search input { width: 100%; }
.lib-filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.lib-filters button { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--bg-2); color: var(--muted); font-weight: 600; font-size: 12.5px; cursor: pointer; }
.lib-filters button.on { border-color: var(--accent); color: var(--accent-2); background: rgba(255, 153, 28, .12); }
.lib-meta { margin-bottom: 8px; }
.lib-meta .tp-label::before, .lib-meta .tp-label::after { display: none; }
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.asset { border: 1px solid var(--line); border-radius: 10px; background: var(--bg-2); padding: 6px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.asset-th { position: relative; aspect-ratio: 16 / 10; border-radius: 7px; background: var(--surface-3); display: grid; place-items: center; overflow: hidden; color: var(--muted); }
.asset-th img { width: 100%; height: 100%; object-fit: cover; }
.asset-kind { position: absolute; left: 4px; bottom: 4px; font-size: 9.5px; text-transform: uppercase; font-weight: 700; background: rgba(0, 0, 0, .65); color: #fff; padding: 1px 5px; border-radius: 4px; }
.asset-name { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.asset-acts { display: flex; gap: 2px; align-items: center; flex-wrap: wrap; }
.lib-empty { grid-column: 1 / -1; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 36px 10px; border: 1.5px dashed var(--line-2); border-radius: 12px; color: var(--muted); cursor: pointer; text-align: center; }
.lib-empty:hover, .side-panel.drag .lib-empty { border-color: var(--accent); color: var(--accent-2); }

/* export view (replaces the right panel) */
.rt-body:has(.ex-panel) { display: flex; flex-direction: column; }
.ex-panel { flex: 1; display: flex; flex-direction: column; gap: 14px; padding: 18px 16px 14px; min-height: 100%; animation: tin .18s ease; }
.ex-panel h3 { font-size: 19px; }
.ex-field { display: flex; flex-direction: column; gap: 7px; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.ex-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ex-select { position: relative; display: flex; align-items: center; }
.ex-select select { width: 100%; height: 42px; padding: 0 36px 0 14px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--bg-2); color: var(--text); font-size: 14px; font-weight: 500; appearance: none; cursor: pointer; outline: none; }
.ex-select select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255, 153, 28, .18); }
.ex-select .ic { position: absolute; right: 12px; pointer-events: none; color: var(--muted); }
.ex-input { height: 42px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--bg-2); color: var(--text); font-size: 14px; outline: none; }
.ex-note { display: flex; gap: 8px; align-items: flex-start; margin: 0; font-size: 12px; color: var(--muted); line-height: 1.45; background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.ex-note .ic { margin-top: 2px; flex: none; color: var(--accent-2); }
.ex-form { display: flex; flex-direction: column; gap: 14px; animation: tin .2s ease; }

/* ---- render screen ---- */
.ex-run { flex: 1; display: flex; flex-direction: column; }
.rn { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 0; animation: rnIn .35s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes rnIn { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.rn-art { position: relative; width: 210px; height: 170px; display: grid; place-items: center; margin: 6px 0 14px; }
.rn-blob { position: absolute; width: 128px; height: 122px; background: radial-gradient(circle at 35% 30%, rgba(255, 179, 82, .42), rgba(255, 153, 28, .16) 60%, rgba(255, 153, 28, .06)); border: 1px solid rgba(255, 179, 82, .3); border-radius: 58% 42% 55% 45% / 45% 55% 45% 55%; animation: blob 7s ease-in-out infinite; box-shadow: 0 0 60px rgba(255, 153, 28, .22), inset 0 0 30px rgba(255, 153, 28, .18); }
.rn-blob.b2 { width: 146px; height: 138px; background: none; border-color: rgba(255, 179, 82, .12); animation-duration: 9s; animation-direction: reverse; box-shadow: none; }
@keyframes blob {
  0%, 100% { border-radius: 58% 42% 55% 45% / 45% 55% 45% 55%; transform: rotate(0deg) scale(1); }
  33% { border-radius: 42% 58% 40% 60% / 58% 42% 58% 42%; transform: rotate(8deg) scale(1.04); }
  66% { border-radius: 50% 50% 62% 38% / 40% 60% 40% 60%; transform: rotate(-6deg) scale(.97); }
}
.rn-mon { position: relative; width: 96px; height: 80px; color: #ffe9cc; filter: drop-shadow(0 0 6px rgba(255, 179, 82, .5)); animation: floaty 4s ease-in-out infinite; }
.rn-mon svg { width: 100%; height: 100%; display: block; }
.rn-mon.in path { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 1.4s cubic-bezier(.65, 0, .35, 1) forwards; }
.rn-mon.in { animation: monIn .5s ease both, floaty 4s ease-in-out .5s infinite; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes monIn { from { opacity: 0; transform: scale(.85); } }
@keyframes floaty { 50% { transform: translateY(-4px); } }
.rn-sp { position: absolute; width: 14px; height: 14px; color: #fff; animation: twinkle 2.4s ease-in-out infinite; }
.rn-sp svg { width: 100%; height: 100%; fill: currentColor; display: block; }
.rn-sp.s1 { left: 22px; top: 52px; }
.rn-sp.s2 { right: 34px; top: 26px; width: 11px; height: 11px; animation-delay: .6s; }
.rn-sp.s3 { right: 22px; bottom: 22px; width: 10px; height: 10px; animation-delay: 1.2s; color: var(--lime); }
.rn-sp.s4 { left: 48px; top: 12px; width: 8px; height: 8px; animation-delay: 1.8s; }
@keyframes twinkle { 0%, 100% { opacity: .2; transform: scale(.6) rotate(0); } 50% { opacity: 1; transform: scale(1) rotate(45deg); } }
.rn-dot { position: absolute; width: 5px; height: 5px; border-radius: 50%; background: var(--accent-2); animation: drift 6s ease-in-out infinite; }
.rn-dot.d1 { left: 40px; bottom: 30px; }
.rn-dot.d2 { right: 56px; top: 8px; background: #7ee0c8; animation-delay: -2s; }
.rn-dot.d3 { left: 96px; bottom: 4px; width: 4px; height: 4px; animation-delay: -4s; }
.rn-ring { position: absolute; right: 14px; top: 78px; width: 11px; height: 11px; border-radius: 50%; border: 1.5px solid rgba(255, 255, 255, .35); animation: drift 7s ease-in-out infinite reverse; }
@keyframes drift { 0%, 100% { transform: translate(0, 0); opacity: .9; } 50% { transform: translate(6px, -8px); opacity: .4; } }
.rn-head { width: 100%; display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.rn-bar { width: 100%; height: 10px; border-radius: 99px; background: var(--surface-3); overflow: hidden; position: relative; }
.rn-bar i { position: absolute; inset: 0 auto 0 0; width: 0; min-width: 10px; border-radius: 99px; background: linear-gradient(90deg, #f08a0a, #ff7a3d, #ff5e3a); transition: width .35s ease; overflow: hidden; }
.rn-bar i::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .45), transparent); transform: translateX(-100%); animation: shine 1.6s ease-in-out infinite; }
@keyframes shine { to { transform: translateX(100%); } }
.rn-pct { font-size: 15px; font-weight: 800; margin: 8px 0 14px; font-variant-numeric: tabular-nums; }
.rn h4 { font-size: 19px; font-weight: 700; margin: 0 0 6px; }
.rn-sub { margin: 0; font-size: 13px; color: var(--muted); }
.rn-sub b { color: var(--lime); font-weight: 600; }
.rn-eta { margin: 4px 0 14px; font-size: 11.5px; color: var(--muted); opacity: .8; min-height: 16px; }
.rn-cancel { height: 36px; padding: 0 22px; }
.rn-name { margin: 22px 0 12px; font-size: 13px; color: var(--muted); }
.rn-name b { color: var(--text); font-weight: 600; }
.rn-name.in { animation: tin .4s ease; }
.rn-tip { width: 100%; background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.rn-tip-h { display: flex; align-items: center; justify-content: center; gap: 7px; font-size: 10.5px; font-weight: 700; letter-spacing: .14em; color: var(--lime); }
.rn-tip-h i { width: 6px; height: 6px; border-radius: 50%; background: var(--lime); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .3; transform: scale(.7); } }
.rn-tip p { margin: 8px 0 0; font-size: 13px; line-height: 1.5; color: var(--text); min-height: 40px; }
.rn-tip p.in { animation: tin .45s ease; }
.rn-done { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; animation: rnIn .35s cubic-bezier(.2, .8, .2, 1) both; }
.rn-ok { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, #f08a0a, #ff7a3d); box-shadow: 0 0 0 8px rgba(255, 153, 28, .15), 0 10px 30px rgba(255, 153, 28, .35); animation: pop .5s cubic-bezier(.2, 1.4, .4, 1) both; margin-top: 8px; }
@keyframes pop { from { transform: scale(.3); opacity: 0; } }
.rn-done h4 { font-size: 19px; margin: 4px 0 0; }
.rn-done p { margin: 0; font-size: 12.5px; }
.rn-done .exp-vid { width: 100%; max-height: 260px; border-radius: 12px; background: #000; margin-top: 4px; }
.rn-dl { width: 100%; }
.rn-done-row { display: flex; gap: 8px; width: 100%; }
.rn-done-row .btn { flex: 1; }
@media (prefers-reduced-motion: reduce) { .rn *, .rn-done * { animation: none !important; } .rn-mon.in path { stroke-dashoffset: 0; } }
.exp-vid.checker { background: repeating-conic-gradient(#2a2a35 0 25%, #1b1b22 0 50%) 0 0 / 18px 18px; }
.ex-foot { display: flex; justify-content: space-between; gap: 10px; padding-top: 12px; border-top: 1px solid var(--line); }
.ex-foot .btn { height: 40px; padding: 0 20px; }

/* transitions tab */
.tr-top { padding: 12px 12px 0; display: flex; flex-direction: column; gap: 10px; }
.tr-phases { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 12px; overflow: hidden; }
.tr-phases button { position: relative; border: 0; background: none; padding: 8px 6px 9px; display: flex; flex-direction: column; align-items: center; gap: 1px; cursor: pointer; color: var(--muted);
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%, 10px 50%); background: var(--surface); margin-right: -6px; }
.tr-phases button:first-child { clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%); }
.tr-phases button:last-child { clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 10px 50%); margin-right: 0; }
.tr-phases small { font-size: 9.5px; font-weight: 800; letter-spacing: .12em; display: inline-flex; align-items: center; gap: 4px; }
.tr-phases b { font-size: 13px; color: var(--text); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.tr-phases button.on { background: var(--surface-3); color: var(--accent-2); }
.tr-phases button.on::after { content: ''; position: absolute; left: 22%; right: 22%; bottom: 3px; height: 2px; border-radius: 2px; background: var(--accent); }
.tr-body { padding: 4px 14px 18px; }
.tr-head { display: flex; justify-content: space-between; align-items: center; margin: 12px 0 2px; }
.tr-head b { font-size: 14px; }
.link-btn { border: 0; background: none; color: var(--muted); display: inline-flex; align-items: center; gap: 5px; cursor: pointer; font-size: 12.5px; font-weight: 600; }
.link-btn:hover { color: var(--accent-2); }
.tr-note { margin: 4px 0; }
.tr-cat { margin: 14px 0 8px; font-size: 12px; font-weight: 700; color: var(--muted); }
.tr-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.tr-card { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 4px 9px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg-2); cursor: pointer; color: var(--text); transition: border-color .15s, background .15s; }
.tr-card:hover { border-color: var(--line-2); background: var(--surface-2); }
.tr-card.on { border-color: var(--accent); background: rgba(255, 153, 28, .12); box-shadow: 0 0 0 1px var(--accent) inset; }
.tr-card small { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.tr-card.on small { color: var(--text); }
.tr-aa { height: 28px; display: grid; place-items: center; overflow: visible; }
.tr-aa span { display: inline-block; font-weight: 800; font-size: 17px; letter-spacing: -.02em; }
.tr-extra { margin-top: 14px; display: flex; flex-direction: column; gap: 10px; }

/* templates tab */
.tpl-top { padding: 12px; display: flex; flex-direction: column; gap: 10px; border-bottom: 1px solid var(--line); }
.tpl-builder { height: 42px; border-color: rgba(255, 153, 28, .6); background: rgba(255, 153, 28, .14); color: var(--accent-2); font-size: 14px; }
.tpl-top .search input { width: 100%; }
.tpl-list { padding: 12px; display: flex; flex-direction: column; gap: 12px; }
.tpl-card { border: 2px solid var(--line); border-radius: 14px; background: var(--bg-2); overflow: hidden; cursor: pointer; transition: border-color .15s, transform .15s; }
.tpl-card:hover { border-color: var(--line-2); transform: translateY(-1px); }
.tpl-card.on { border-color: var(--accent); }
.tpl-card-head { display: flex; align-items: center; gap: 8px; padding: 9px 10px 8px 12px; }
.tpl-card-head b { font-size: 13.5px; }
.tpl-card { position: relative; }
.tpl-card canvas { display: block; width: 100%; height: auto; }
.verified { width: 15px; height: 15px; border-radius: 50%; display: inline-grid; place-items: center; background: #ff991c; color: #fff; flex: none; }
.tpl-applied { position: absolute; right: 10px; bottom: 10px; display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; }
.star { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 2px; display: grid; place-items: center; }
.star.on { color: #ffd400; }
.star.on svg { fill: #ffd400; }
.builder { display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: 18px; margin-bottom: 14px; }
.builder input[type=color] { width: 100%; height: 40px; }
.builder-prev { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.builder-prev canvas { width: 100%; border-radius: 12px; border: 1px solid var(--line-2); }
@media (max-width: 700px) { .builder { grid-template-columns: 1fr; } }
.side-box { grid-area: side; } .tl-box { grid-area: tl; } .stage-box { grid-area: stage; } .right-box { grid-area: right; }
.box { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; min-height: 0; min-width: 0; overflow: hidden; }

/* ---- left: rail + panels ---- */
.side-box { display: grid; grid-template-columns: 78px minmax(0, 1fr); }
.ed-rail { display: flex; flex-direction: column; gap: 6px; padding: 10px 6px; border-right: 1px solid var(--line); background: var(--bg-2); overflow-y: auto; }
.ed-rail button { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 2px; border: 0; border-radius: 12px; background: none; color: var(--muted); font-size: 11px; font-weight: 600; cursor: pointer; text-align: center; line-height: 1.2; }
.ed-rail button:hover { background: var(--surface-2); color: var(--text); }
.ed-rail button.on { background: rgba(255, 153, 28, .16); color: var(--accent-2); }
.side-panel { overflow-y: auto; padding: 14px 14px 24px; min-width: 0; container-type: inline-size; }
/* narrow captions column (16:9 layout / small screens): icons drop under the text */
@container (max-width: 360px) {
  .crow-main { grid-template-columns: 30px minmax(0, 1fr); row-gap: 0; }
  .cicons { grid-column: 2; margin-top: -2px; }
  .cwords { margin-left: 0; }
  .lp-head .pill-btn { padding: 0 10px; }
  .tools-panel { padding: 2px 8px 10px; }
  .tp-ctl > .ic { display: none; }
  .tp-ctl { padding: 0 6px; }
  .tcard-ic { display: none; }
  .tcard { padding: 9px 10px; }
  .tcard small { font-size: 11px; }
}
.lp-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.lp-head h2 { font-size: 21px; }
.round-btn { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line-2); background: var(--bg-2); display: grid; place-items: center; color: var(--text); cursor: pointer; }
.round-btn.on, .round-btn:hover { border-color: var(--accent); color: var(--accent-2); }
.pill-btn { border-radius: 999px; height: 40px; color: var(--accent-2); background: var(--bg-2); }
.dd { position: relative; }
.dd-menu { position: absolute; left: 0; top: 46px; z-index: 30; background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 12px; padding: 6px; min-width: 260px; box-shadow: var(--shadow); }
.dd-menu button { display: flex; gap: 9px; align-items: center; width: 100%; padding: 9px 10px; border: 0; background: none; border-radius: 8px; text-align: left; cursor: pointer; font-size: 13px; color: var(--text); }
.dd-menu button:hover { background: var(--surface-3); }
.cap-search { margin-bottom: 10px; }
.clist { display: flex; flex-direction: column; gap: 4px; }
.empty { padding: 30px 10px; text-align: center; }
.crow-main { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 12px; border: 1px solid transparent; }
.crow-main:hover { background: rgba(255, 255, 255, .03); }
.crow.playing .crow-main { background: var(--surface-2); }
.crow.sel .crow-main { background: var(--surface-2); border-color: rgba(255, 153, 28, .45); }
.cnum { width: 30px; height: 30px; border-radius: 50%; border: 0; background: none; color: var(--muted); font-weight: 700; font-size: 13px; cursor: pointer; }
.crow.playing .cnum, .crow.sel .cnum { background: var(--accent); color: #fff; }
.ctext { font-size: 16px; line-height: 1.4; padding: 6px; border-radius: 8px; outline: none; min-width: 0; word-break: break-word; cursor: text; }
.ctext:focus { background: var(--bg); box-shadow: 0 0 0 1px var(--line-2); }
.cicons { display: flex; gap: 1px; }
.cicons button { width: 30px; height: 30px; border: 0; background: none; color: var(--muted); border-radius: 8px; display: grid; place-items: center; cursor: pointer; }
.cicons button:hover { background: var(--surface-3); color: var(--text); }
.cicons button.on { color: var(--accent-2); background: rgba(255, 153, 28, .16); }
.cwords { margin: 4px 0 8px 42px; padding: 10px; border-radius: 12px; background: var(--bg-2); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.ctimes { display: flex; gap: 6px; align-items: flex-end; flex-wrap: wrap; }
.ctimes label { display: flex; flex-direction: column; gap: 3px; font-size: 11px; color: var(--muted); flex: 1 1 70px; max-width: 100px; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip { border: 1px solid var(--line-2); background: var(--surface); border-radius: 7px; padding: 2px 8px; font-size: 12.5px; cursor: pointer; color: var(--text); }
.chip:hover { border-color: var(--accent); }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff !important; }
.chip.emph { box-shadow: inset 0 -2px 0 #ffd400; }
.word-insp { padding: 10px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line-2); display: flex; flex-direction: column; gap: 6px; }
.wi-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.wi-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 11.5px; color: var(--muted); }
.pop { position: fixed; z-index: 600; width: 280px; background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 12px; padding: 12px; box-shadow: var(--shadow); }
.pop-title { font-weight: 700; font-size: 13px; margin-bottom: 8px; }
.mask-hero { display: flex; gap: 12px; padding: 14px; background: rgba(255, 153, 28, .1); border-radius: 12px; margin-bottom: 12px; color: var(--accent-2); }
.mask-hero p { margin: 4px 0 0; }
.mask-hero b { color: var(--text); }
.font-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; margin-bottom: 8px; }
.font-tile { position: relative; padding: 12px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--bg-2); cursor: pointer; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.font-tile span { font-size: 22px; white-space: nowrap; overflow: hidden; }
.font-tile small { color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.font-tile.on { border-color: var(--accent); background: rgba(255, 153, 28, .1); }
.font-tile .icon-btn { position: absolute; top: 4px; right: 4px; }
.lib-cur { display: flex; gap: 12px; padding: 12px; background: var(--bg-2); border-radius: 12px; margin-bottom: 8px; align-items: center; }
.lib-cur img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; }
.lib-list { display: flex; flex-direction: column; gap: 4px; }
.lib-item { display: flex; gap: 10px; align-items: center; padding: 8px; border-radius: 10px; color: var(--text); }
.lib-item:hover { background: var(--surface-2); }
.lib-item img, .lib-ph { width: 48px; height: 48px; object-fit: cover; border-radius: 8px; display: grid; place-items: center; background: var(--surface-3); flex: none; }
.lib-item span { display: flex; flex-direction: column; min-width: 0; }
.lib-item b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---- timeline ---- */
.tl-box { display: flex; flex-direction: column; }
.tl-tools { display: flex; align-items: center; gap: 6px; padding: 10px 12px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.segctl.mini button { padding: 6px 12px; font-size: 11px; letter-spacing: .05em; }
.tl-sep { width: 1px; height: 24px; background: var(--line-2); margin: 0 4px; }
.tl-btn { width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface-2); color: var(--text); display: grid; place-items: center; cursor: pointer; }
.tl-btn:hover { border-color: #4a4a62; background: var(--surface-3); }
.tl-btn.tog.on { background: rgba(255, 153, 28, .2); border-color: var(--accent); color: var(--accent-2); }
.tl-zoom { width: 110px !important; }
.tl-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 96px minmax(0, 1fr); }
.tl-labels { border-right: 1px solid var(--line); background: var(--bg-2); position: relative; }
.lab { position: absolute; left: 0; right: 0; display: flex; align-items: center; gap: 6px; padding: 0 10px; font-size: 12px; color: var(--muted); }
.lab-ruler { top: 0; height: 26px; }
.lab-cap { top: 32px; height: 44px; color: var(--warn); }
.lab-vid { top: 82px; height: 48px; color: #7cc4ff; }
.lab-aud { top: 136px; height: 44px; color: var(--ok); }
.tl-body:has(.no-vid) .lab-aud { top: 82px; }
.tl-scroll { overflow: auto; position: relative; }
.tl-inner { position: relative; height: 188px; min-height: 100%; }
.tl-inner.no-vid { height: 134px; }
.tl-ruler { position: absolute; top: 0; left: 0; height: 26px; display: block; cursor: col-resize; }
.tl-row { position: absolute; left: 0; }
.tl-cap { top: 32px; height: 44px; right: 0; }
.tl-vid { top: 82px; height: 48px; right: 0; overflow: hidden; border-radius: 8px; background: #2a2216; border: 1px solid rgba(255, 196, 120, .35); }
.tl-vid img { position: absolute; top: 0; height: 48px; object-fit: cover; pointer-events: none; }
.tl-tag { position: absolute; left: 6px; top: 4px; z-index: 1; font-size: 10px; font-weight: 700; background: rgba(0, 0, 0, .65); padding: 1px 6px; border-radius: 4px; }
.tl-aud { top: 136px; height: 44px; border-radius: 8px; }
.no-vid .tl-aud { top: 82px; }
.tl-seg { position: absolute; top: 0; height: 100%; background: linear-gradient(180deg, #5a3a14, #3f2a10); border: 1px solid #b8701c; border-radius: 8px; overflow: hidden; display: flex; align-items: center; cursor: grab; user-select: none; }
.tl-seg span { padding: 0 9px; font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
.tl-seg.word { border-radius: 6px; }
.tl-seg.word span { padding: 0 5px; }
.tl-seg.playing { border-color: var(--lime); }
.tl-seg.sel { background: linear-gradient(180deg, #e67e00, #c96a00); border-color: #fff; }
.tl-seg .h-l, .tl-seg .h-r { position: absolute; top: 0; bottom: 0; width: 6px; cursor: ew-resize; z-index: 1; }
.tl-seg .h-l { left: 0; } .tl-seg .h-r { right: 0; }
.tl-seg:hover .h-l, .tl-seg:hover .h-r { background: rgba(255, 255, 255, .25); }
.tl-head { position: absolute; top: 0; bottom: 0; left: 0; width: 2px; background: #ff4d8d; pointer-events: none; z-index: 3; }
.tl-head::before { content: ''; position: absolute; top: 0; left: -5px; border: 6px solid transparent; border-top-color: #ff4d8d; }

/* ---- preview ---- */
.stage-box { display: flex; flex-direction: column; min-height: 0; min-width: 0; background: var(--bg-2); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.stage-area { flex: 1; min-height: 0; display: grid; place-items: center; padding: 8px;
  background-image: radial-gradient(rgba(255, 255, 255, .045) 1px, transparent 1px); background-size: 18px 18px; }
.player { position: relative; border-radius: 10px; overflow: hidden; background: #000; box-shadow: 0 20px 60px rgba(0, 0, 0, .55); }
.player video, .player canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.player video { object-fit: fill; }
.player canvas { cursor: pointer; touch-action: none; }
.player:fullscreen { display: grid; place-items: center; background: #000; }
/* Replace + Safe zone live in the timeline toolbar */
.tl-chip { height: 34px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface-2); color: var(--text); font-size: 12.5px; font-weight: 600; display: inline-flex; align-items: center; gap: 7px; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, color .15s; }
.tl-chip:hover { background: var(--surface-3); border-color: #4a4a62; }
.tl-chip .ic:last-child { transition: transform .22s cubic-bezier(.2, .8, .2, 1); color: var(--muted); }
.tl-chip.dd-open .ic:last-child { transform: rotate(180deg); }
.tl-chip.dd-open, .tl-chip.on { border-color: var(--accent); background: rgba(255, 153, 28, .14); color: var(--accent-2); }
#safeMenu.floating { width: 320px; }
#safeMenu .sel-item span { white-space: nowrap; }
#safeMenu .sel-item small { font-size: 11px; white-space: nowrap; }
.proc { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(6, 6, 12, .72); z-index: 3; padding: 16px; }
.proc-card { background: var(--surface); border: 1px solid var(--line-2); border-radius: 14px; padding: 20px 22px; width: min(320px, 100%); text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.proc-card p { margin: 0; }
.proc-card .bar { width: 100%; }
.proc-card.err b { color: var(--danger); }
.proc-card.err { max-height: calc(100% - 16px); overflow: auto; width: min(340px, calc(100% - 16px)); padding: 16px; }
.key-form { display: flex; gap: 6px; width: 100%; margin-top: 6px; flex-wrap: wrap; }
.key-form .input { flex: 1 1 140px; min-width: 0; }
.key-form .btn { flex: 1 1 auto; }
.pl-bar { flex: none; padding: 8px 12px 10px; border-top: 1px solid var(--line); }
.seek { display: block; width: 100%; margin: 0; height: 14px; }
.pl-row { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.pl-btn { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line-2); background: var(--surface-2); display: grid; place-items: center; cursor: pointer; color: var(--text); flex: none; }
.pl-btn:hover { background: var(--surface-3); }
#playBtn { background: var(--accent); border-color: var(--accent); color: #fff; }
.pl-time { padding: 8px 12px; border-radius: 999px; background: var(--surface-2); font: 600 12px ui-monospace, 'SFMono-Regular', Consolas, monospace; white-space: nowrap; }
.pl-rate { height: 34px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line-2); padding: 0 6px; color: var(--text); }

/* ---- right panel ---- */
.right-box { display: flex; flex-direction: column; }
.rt-top { margin: 10px 10px 4px; }
.rt-top button { padding: 9px 4px; font-size: 13.5px; }
.rt-sub { display: flex; gap: 2px; padding: 0 10px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.rt-sub button { background: none; border: 0; padding: 11px 9px; color: var(--muted); font-weight: 600; font-size: 14px; border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap; }
.rt-sub button:hover { color: var(--text); }
.rt-sub button.on { color: var(--text); border-bottom-color: var(--accent); }
.rt-body { flex: 1; overflow-y: auto; min-height: 0; }
.rt-foot { padding: 12px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; }
.rsec { border-bottom: 1px solid var(--line); }
.rsec header { display: flex; justify-content: space-between; align-items: center; padding: 15px 18px; cursor: pointer; color: var(--muted); user-select: none; transition: background .15s, color .15s; outline: none; }
.rsec header:hover, .rsec header:focus-visible { color: var(--text); background: rgba(255, 255, 255, .025); }
.rsec h5 { font-size: 11.5px; letter-spacing: .14em; text-transform: uppercase; font-weight: 800; margin: 0; color: var(--text); }
.rsec .chev { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; transition: transform .3s cubic-bezier(.2, .8, .2, 1), background .15s; transform: rotate(180deg); }
.rsec header:hover .chev { background: var(--surface-3); }
.rsec.closed .chev { transform: rotate(0deg); }
/* smooth expand / collapse (grid 1fr ↔ 0fr animates the real content height) */
.rsec-wrap { display: grid; grid-template-rows: 1fr; transition: grid-template-rows .32s cubic-bezier(.2, .8, .2, 1); }
.rsec-clip { overflow: hidden; min-height: 0; }
.rsec-body { padding: 0 18px 16px; display: flex; flex-direction: column; gap: 12px; transition: opacity .25s ease, transform .32s cubic-bezier(.2, .8, .2, 1); }
.rsec.closed .rsec-wrap { grid-template-rows: 0fr; }
.rsec.closed .rsec-body { opacity: 0; transform: translateY(-6px); pointer-events: none; }
.rrow { display: grid; grid-template-columns: 104px minmax(0, 1fr) 34px; align-items: center; gap: 10px; }
.rrow.chk { grid-template-columns: 1fr auto; cursor: pointer; }
.rrow > .segctl, .rrow > .fmt-group { grid-column: 2 / 4; }
.rlab { font-size: 13px; color: var(--muted); display: flex; flex-direction: column; gap: 2px; }
.rlab small { font-size: 11px; }
.rctl { display: flex; align-items: center; gap: 8px; min-width: 0; }
.rctl input[type=range] { flex: 1; min-width: 30px; }
.rctl select { flex: 1; min-width: 0; }
.rctl.col code { font-size: 12px; color: var(--muted); }
.num { display: flex; align-items: center; height: 34px; border: 1px solid var(--line-2); background: var(--bg-2); border-radius: 8px; padding: 0 8px; width: 78px; flex: none; }
.num input { width: 100%; border: 0; background: none; outline: none; text-align: right; font-weight: 600; font-size: 13px; color: var(--text); }
.num input::-webkit-inner-spin-button { display: none; }
.num i { font-style: normal; color: var(--muted); margin-left: 4px; font-size: 12px; }
.num.wide { width: auto; }
.rrow.xy { grid-template-columns: 14px minmax(0, 1fr) 34px 14px minmax(0, 1fr) 34px; gap: 8px; }
.reset-btn { width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--surface-2); display: grid; place-items: center; color: var(--muted); cursor: pointer; }
.reset-btn:hover { color: var(--text); border-color: var(--accent); }
.stepper { display: flex; flex-direction: column; gap: 2px; flex: none; }
.stepper button { width: 24px; height: 16px; border: 1px solid var(--line-2); background: var(--surface-2); border-radius: 4px; display: grid; place-items: center; color: var(--muted); cursor: pointer; padding: 0; }
.stepper button:hover { color: var(--text); }
.fmt-group { display: flex; border: 1px solid var(--line-2); border-radius: 10px; overflow: hidden; justify-self: end; }
.fmt-group button { width: 44px; height: 38px; border: 0; background: var(--bg-2); border-right: 1px solid var(--line-2); cursor: pointer; font-size: 15px; font-weight: 700; color: var(--text); display: grid; place-items: center; }
.fmt-group button:last-child { border-right: 0; }
.fmt-group button.on { background: var(--accent); color: #fff; }
.al { display: flex; flex-direction: column; gap: 3px; width: 16px; }
.al i { display: block; height: 2px; width: 100%; background: currentColor; border-radius: 2px; }
.al i:nth-child(2) { width: 65%; }
.al-center { align-items: center; } .al-right { align-items: flex-end; }
.rt-actions { padding: 14px 18px; display: flex; gap: 8px; flex-wrap: wrap; }
.pad { padding: 12px 18px; }
.right-box .tpl-grid { padding: 12px; }
.right-box h4.sub { padding: 0 12px; margin-top: 14px; }
.tpl canvas { aspect-ratio: auto !important; height: auto; }

@media (max-width: 1280px) {
  .ed-main { grid-template-columns: minmax(0, 1fr) var(--stage-w, 340px) 340px; }
  .ar-landscape .ed-main { grid-template-columns: 290px minmax(0, 1fr) 330px; }
  .ar-square .ed-main { grid-template-columns: minmax(280px, 1fr) var(--stage-w, 380px) 340px; }
  .side-box { grid-template-columns: 66px minmax(0, 1fr); }
  .ed-rail button { font-size: 10px; }
  .rrow { grid-template-columns: 90px minmax(0, 1fr) 34px; }
  .num { width: 66px; }
}
@media (max-width: 999px) {
  .ed { height: auto; min-height: 100vh; overflow: visible; }
  .ed-main, .ar-landscape .ed-main, .ar-square .ed-main, .ed.tl-big .ed-main {
    grid-template-areas: "stage" "side" "tl" "right"; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto; }
  .stage-area { flex: none; height: 62vh; }
  .side-box { height: 440px; }
  .tl-box { height: 300px; }
  .right-box { height: 680px; }
  .save-state, #srtBtn { display: none; }
}
@media (max-width: 520px) {
  .pl-rate, #muteBtn, .ed-div { display: none; }
  .pl-time { padding: 8px 10px; font-size: 11px; }
  .tl-zoom { width: 70px !important; }
  .ed-name { width: 40vw; }
}

/* ---- custom font picker ---- */
.font-pick { flex: 1; min-width: 0; height: 34px; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--bg-2); color: var(--text); font-size: 15px; cursor: pointer; transition: border-color .15s; }
.font-pick span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.font-pick:hover, .font-pick.open { border-color: var(--accent); }
.font-pick .ic { flex: none; color: var(--muted); transition: transform .2s; }
.font-pick.open .ic { transform: rotate(180deg); }
.pop.font-pop { width: 300px; padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.fp-search { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 10px; border-radius: 9px; border: 1px solid var(--line-2); background: var(--bg-2); color: var(--muted); }
.fp-search input { flex: 1; border: 0; background: none; outline: none; color: var(--text); font-size: 13px; }
.fp-list { max-height: 340px; overflow-y: auto; scroll-behavior: smooth; }
.fp-cat { font-size: 10.5px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); font-weight: 700; padding: 10px 8px 4px; position: sticky; top: 0; background: var(--surface-2); z-index: 1; }
.fp-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; padding: 7px 10px; border: 0; border-radius: 8px; background: none; color: var(--text); cursor: pointer; text-align: left; font-size: 17px; }
.fp-item small { font-family: var(--font); font-size: 11px; color: var(--muted); flex: none; }
.fp-item:hover, .fp-item.kb { background: var(--surface-3); }
.fp-item.on { background: rgba(255, 153, 28, .16); color: var(--accent-2); }
.fp-hint { font-size: 11px; color: var(--muted); padding: 2px 6px; }

/* draggable playhead */
.tl-handle { position: absolute; top: 0; left: -9px; width: 20px; height: 28px; pointer-events: auto; cursor: grab; }
.tl-handle::after { content: ''; position: absolute; left: 3px; top: 0; width: 14px; height: 12px; border-radius: 3px 3px 7px 7px; background: #ff4d8d; box-shadow: 0 0 0 2px rgba(255, 77, 141, .25); transition: transform .15s; }
.tl-handle:hover::after, .scrubbing .tl-handle::after { transform: scale(1.2); }
.tl-head::before { display: none; }
.scrubbing, .scrubbing * { cursor: grabbing !important; user-select: none; }
.scrubbing .tl-head { box-shadow: 0 0 0 1px rgba(255, 77, 141, .5), 0 0 12px rgba(255, 77, 141, .6); }
