/* v2: AI captions, studio recorder, elements, magic tools, montage */
.ai-card, .rec-card { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 12px; border-radius: 6px; border: 1px solid var(--border-2); background: var(--panel-2); color: var(--text); cursor: pointer; font: inherit; transition: border-color .15s, transform .15s; }
.ai-card:hover, .rec-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.ai-card > svg, .rec-card > svg { width: 22px; height: 22px; flex: none; padding: 8px; box-sizing: content-box; border-radius: 6px; background: var(--accent); color: var(--on-accent); }
.ai-card b, .rec-card b { display: block; font-size: 13px; }
.ai-card span, .rec-card span { display: block; font-size: 11px; color: var(--muted); line-height: 1.35; margin-top: 2px; }
.rec-card { background: var(--panel); }
.rec-card > svg { background: var(--panel-3); color: var(--accent-2); }
.studio-card { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 55%, transparent); }
.studio-card > svg { background: var(--accent); color: var(--on-accent); }

.shape-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.shape-btn { aspect-ratio: 1.3; border-radius: 6px; border: 1px solid var(--border); background: var(--panel); display: grid; place-items: center; cursor: pointer; }
.shape-btn:hover { border-color: var(--accent); }
.shape-btn i { display: block; width: 40px; height: 26px; background: var(--accent); }
.shape-btn .sh-round { border-radius: 4px; }
.shape-btn .sh-circle { width: 32px; height: 32px; border-radius: 50%; }
.shape-btn .sh-triangle { width: 34px; height: 30px; clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.shape-btn .sh-star { width: 34px; height: 34px; clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%); }
.shape-btn .sh-bar { width: 50px; height: 8px; border-radius: 4px; }
.emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(34px, 1fr)); gap: 4px; }
.emoji-btn { aspect-ratio: 1; border: 0; border-radius: 4px; background: none; font-size: 20px; padding: 0; min-width: 0; cursor: pointer; transition: transform .1s, background .1s; }
.emoji-btn:hover { background: var(--panel-2); transform: scale(1.15); }
.clip.k-shape { background: #1f7a7a; }
.clip-key { position: absolute; top: 3px; width: 7px; height: 7px; margin-left: -3.5px; transform: rotate(45deg); background: var(--yellow, #ffd60a); box-shadow: 0 0 0 1px rgba(0,0,0,.55); pointer-events: none; }
.kf { display: flex; flex-direction: column; gap: 6px; padding-top: 8px; border-top: 1px solid var(--line, rgba(255,255,255,.08)); }
.clip-zoom { position: absolute; bottom: 3px; height: 5px; border-radius: 3px; background: #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.4); pointer-events: none; opacity: .9; }

.cap-styles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.cap-style { position: relative; height: 70px; border-radius: 6px; border: 2px solid var(--border); background: linear-gradient(135deg, #3a3a34, #1a1a17); cursor: pointer; display: grid; place-items: center; font-size: 18px; }
.cap-style em { position: absolute; left: 8px; bottom: 4px; font: 600 9.5px var(--mono); color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.cap-style.on { border-color: var(--accent); }

.magic-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 6px; }
.magic-btn { width: 100%; padding: 0 8px; justify-content: flex-start; background: var(--panel-2); border-color: var(--border-2); }
.magic-btn svg { color: var(--accent-2); }
.magic-btn:hover { border-color: var(--accent); }
.zoom-list { display: flex; flex-direction: column; gap: 4px; }
.zoom-item { display: flex; align-items: center; gap: 6px; background: var(--panel); border: 1px solid var(--border); border-radius: 4px; padding: 3px 4px 3px 8px; }
.zoom-item .zi-go { flex: 1; display: flex; align-items: center; gap: 6px; border: 0; background: none; color: var(--text-2); font: 600 12px var(--font); cursor: pointer; text-align: left; }
.zoom-item .zi-go svg { width: 13px; height: 13px; color: var(--accent-2); }
.zoom-item select { background: var(--panel-2); color: var(--text); border: 1px solid var(--border-2); border-radius: 4px; font: 12px var(--font); padding: 2px 4px; }
.zoom-item .zi-del { border: 0; background: none; color: var(--muted); cursor: pointer; display: grid; padding: 3px; border-radius: 3px; }
.zoom-item .zi-del svg { width: 13px; height: 13px; }
.zoom-item .zi-del:hover { color: var(--red); background: var(--panel-2); }

/* Recorder */
.stock { display: flex; flex-direction: column; gap: 12px; min-height: 60vh; }
.stock-search .input { flex: 1; }
.stock-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; max-height: 56vh; overflow-y: auto; align-content: start; }
.stock-grid.audio { grid-template-columns: 1fr; }
.stock-item { position: relative; padding: 0; border: 1px solid transparent; border-radius: 6px; overflow: hidden; background: #000; aspect-ratio: 16/10; cursor: pointer; color: inherit; }
.stock-item img, .stock-item video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.stock-item:hover { border-color: var(--accent); }
.stock-item .mdur { position: absolute; left: 6px; bottom: 6px; z-index: 2; }
.stock-plus { position: absolute; right: 6px; bottom: 6px; z-index: 2; display: none; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 4px; background: var(--accent); color: #17150f; font-size: 12px; font-weight: 700; }
.stock-plus svg { width: 12px; height: 12px; }
.stock-item:hover .stock-plus { display: inline-flex; }
.stock-item.busy { opacity: .5; pointer-events: none; }
.stock-item.busy::after { content: 'Adding…'; position: absolute; inset: 0; z-index: 3; display: grid; place-items: center; background: rgba(0,0,0,.55); font-weight: 700; font-size: 13px; }
.stock-item.added { border-color: var(--green, #2fe58a); }
.stock-item.sound { display: flex; align-items: center; gap: 10px; aspect-ratio: auto; padding: 8px 10px; background: var(--panel-2, rgba(255,255,255,.04)); cursor: default; }
.stock-item.sound.busy::after { content: ''; background: none; }
.stock-item.sound.playing { border-color: var(--accent); }
.stock-name { flex: 1; min-width: 0; display: flex; flex-direction: column; text-align: left; }
.stock-name b { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stock-play svg { width: 12px; height: 12px; }
.stock-foot { display: flex; align-items: center; gap: 12px; }
.vo-voices { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 6px; }
.vo-voices.hidden { display: none; }
.vo-voices button { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 8px 10px; border-radius: 6px; border: 1px solid var(--line, rgba(255,255,255,.1)); background: none; color: inherit; cursor: pointer; text-align: left; }
.vo-voices button span { font-size: 11px; color: var(--muted, #9a978c); }
.vo-voices button.on { border-color: var(--accent); background: rgba(255,214,10,.08); }
.rec { display: flex; flex-direction: column; gap: 12px; }
.tp { position: absolute; left: 12%; right: 12%; top: 0; height: 46%; overflow: hidden; background: linear-gradient(rgba(0,0,0,.72), rgba(0,0,0,.5)); border-radius: 0 0 10px 10px; pointer-events: none; -webkit-mask-image: linear-gradient(transparent, #000 18%, #000 78%, transparent); mask-image: linear-gradient(transparent, #000 18%, #000 78%, transparent); }
.rec-view:has(.rec-meter) .tp { left: 0; right: 0; height: 100%; border-radius: 0; }
.rec-view:has(.rec-meter):has(.tp:not(.hidden)) { aspect-ratio: 16/7; }
.tp-text { padding: 0 18px; color: #fff; font-weight: 700; line-height: 1.35; text-align: center; white-space: pre-wrap; will-change: transform; }
.tp-setup { display: flex; flex-direction: column; gap: 8px; }
.tp-opts { display: flex; flex-direction: column; gap: 8px; }
.tp-opts.hidden { display: none; }
.tp-range { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted, #9a978c); flex: 1; }
.tp-range input { flex: 1; }
.rec-view, .st-view { position: relative; border-radius: 6px; overflow: hidden; background: #000; aspect-ratio: 16/9; display: grid; place-items: center; }
.rec-view video, .st-view .st-screen { width: 100%; height: 100%; object-fit: contain; }
.rec-view:has(.rec-meter) { aspect-ratio: 3/1; }
.rec-meter { width: 70%; height: 14px; border-radius: 6px; background: var(--panel-3); overflow: hidden; }
.rec-meter div { height: 100%; width: 0; background: var(--accent); transition: width .08s; }
.rec-badge { position: absolute; left: 12px; top: 12px; display: flex; align-items: center; gap: 8px; background: rgba(0,0,0,.65); color: #fff; padding: 5px 10px; border-radius: 4px; font: 600 12.5px var(--mono); font-variant-numeric: tabular-nums; }
.rec-badge i { width: 10px; height: 10px; border-radius: 50%; background: var(--red); animation: blink 1s infinite; }
.rec-badge.paused i { animation: none; background: var(--yellow); }
@keyframes blink { 50% { opacity: .3; } }
.rec-count { position: absolute; inset: 0; display: grid; place-items: center; font-size: 120px; font-weight: 900; color: #fff; background: rgba(0,0,0,.45); text-shadow: 0 10px 40px rgba(0,0,0,.6); }

/* Studio */
/* Studio: framing the recording — the shared screen with the recording frame on it, the finished video beside it */
.modal.wide.st-big { max-width: 1040px; }
.st-stage { display: grid; grid-template-columns: minmax(0, 1fr) 200px; gap: 16px; align-items: start; }
.st-view { width: 100%; margin: 0 auto; user-select: none; }
.st-view .st-screen { display: block; object-fit: fill; }
.st-view .rec-badge, .st-view .rec-count { z-index: 2; }
.st-frame { position: absolute; z-index: 1; box-sizing: border-box; border: 2px solid var(--accent); box-shadow: 0 0 0 9999px rgba(0,0,0,.62); cursor: move; touch-action: none; }
.st-frame i { position: absolute; width: 12px; height: 12px; box-sizing: border-box; background: var(--accent); border: 2px solid #17150f; border-radius: 2px; }
.st-frame i::before { content: ''; position: absolute; inset: -8px; }
.st-frame [data-h=nw] { left: -7px; top: -7px; cursor: nwse-resize; }
.st-frame [data-h=n] { left: calc(50% - 6px); top: -7px; cursor: ns-resize; }
.st-frame [data-h=ne] { right: -7px; top: -7px; cursor: nesw-resize; }
.st-frame [data-h=e] { right: -7px; top: calc(50% - 6px); cursor: ew-resize; }
.st-frame [data-h=se] { right: -7px; bottom: -7px; cursor: nwse-resize; }
.st-frame [data-h=s] { left: calc(50% - 6px); bottom: -7px; cursor: ns-resize; }
.st-frame [data-h=sw] { left: -7px; bottom: -7px; cursor: nesw-resize; }
.st-frame [data-h=w] { left: -7px; top: calc(50% - 6px); cursor: ew-resize; }
.st-size { position: absolute; left: 6px; top: 6px; padding: 2px 6px; border-radius: 3px; background: var(--accent); color: var(--on-accent); font: 600 11px var(--mono); white-space: nowrap; pointer-events: none; }
.st-live.locked .st-frame { cursor: default; border-color: var(--red); }
.st-live.locked:not(.live-resize) .st-frame i, .st-live.locked:not(.live-resize) .st-size { display: none; }
.st-live.locked.live-resize .st-frame { cursor: move; }
.st-live.locked.live-resize .st-frame i { background: var(--red); }
.st-live.locked .st-side > :not(.ex-label):not(.st-out) { opacity: .4; pointer-events: none; }
.st-side { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.st-side .btn svg { width: 14px; height: 14px; }
.st-out { position: relative; align-self: center; overflow: hidden; border-radius: 4px; border: 1px solid var(--border-2); }
.st-out-screen { position: absolute; overflow: hidden; background: #000; box-shadow: 0 4px 14px rgba(0,0,0,.45); }
.st-out-screen video { position: absolute; max-width: none; object-fit: fill; }
.st-out .st-cam { position: absolute; box-sizing: border-box; aspect-ratio: 1; border-radius: 50%; object-fit: cover; border: 2px solid #fff; transform: scaleX(-1); box-shadow: 0 3px 10px rgba(0,0,0,.5); }
.st-shape { align-self: stretch; }
.st-note { margin: 10px 0 0; }
@media (max-width: 760px) { .st-stage { grid-template-columns: 1fr; } }
.st-hero { display: flex; gap: 12px; align-items: center; padding: 14px; border-radius: 6px; background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); margin-bottom: 16px; }
.st-hero > svg { width: 22px; height: 22px; flex: none; padding: 8px; box-sizing: content-box; border-radius: 6px; background: var(--accent); color: var(--on-accent); }
.st-hero b { display: block; }
.st-hero span { display: block; font-size: 12px; color: var(--text-2); }
.st-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.st-opt { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 6px; background: var(--panel-2); border: 1px solid var(--border); cursor: pointer; }
.st-opt b { display: block; font-size: 13px; }
.st-opt span { display: block; font-size: 11px; color: var(--muted); }
.st-grads { display: flex; gap: 8px; margin-top: 14px; justify-content: flex-end; align-items: center; }
.st-grads::before { content: 'Background'; font-size: 12px; color: var(--muted); margin-right: 4px; }
.st-grads .swatch { width: 34px; height: 34px; aspect-ratio: auto; }
.st-grads .swatch.on { outline: 2px solid #fff; outline-offset: 2px; }
.st-steps { display: flex; flex-direction: column; gap: 8px; }
.st-step { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 6px; background: var(--panel-2); border: 1px solid var(--border); color: var(--muted); }
.st-step i { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--border-2); flex: none; box-sizing: border-box; }
.st-step em { margin-left: auto; font-style: normal; font-size: 12px; color: var(--muted); }
.st-step.run { color: var(--text); border-color: var(--accent); }
.st-step.run i { border-color: var(--panel-3); border-top-color: var(--accent); animation: spin .8s linear infinite; }
.st-step.done { color: var(--text); }
.st-step.done i { border: 0; background: var(--green); box-shadow: inset 0 0 0 5px var(--green), inset 0 0 0 9px #0a2e1d; }
.st-step.skip i { border-color: var(--yellow); }

/* Montage */
.mt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 8px; max-height: 210px; overflow-y: auto; }
.mt-item { position: relative; aspect-ratio: 16/10; border-radius: 4px; border: 2px solid var(--border); background: var(--panel-2) center/cover; cursor: pointer; opacity: .45; }
.mt-item.on { opacity: 1; border-color: var(--accent); }
.mt-item i { position: absolute; right: 4px; top: 4px; width: 18px; height: 18px; border-radius: 50%; background: var(--accent); color: var(--on-accent); display: none; place-items: center; }
.mt-item.on i { display: grid; }
.mt-item i svg { width: 11px; height: 11px; stroke-width: 3; }

@media (max-width: 700px) { .st-cols { grid-template-columns: 1fr; } }
.fmt-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.fmt-btn { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 6px; border-radius: 6px; border: 1px solid var(--border); background: var(--panel); color: var(--text); cursor: pointer; font: inherit; text-align: center; }
.fmt-btn i { display: block; border: 2px solid var(--text-2); border-radius: 3px; margin-bottom: 2px; }
.fmt-btn b { font-size: 12px; }
.fmt-btn span { font-size: 10px; color: var(--muted); line-height: 1.2; }
.fmt-btn:hover { border-color: var(--accent); }
.fmt-btn.on { border-color: var(--accent); background: var(--accent-soft); }
.fmt-btn.on i { border-color: var(--accent-2); }
.inspector .fmt-grid { grid-template-columns: 1fr 1fr; }
.st-after { margin-top: 6px; }

/* v3: filmstrips, multi-select, progress bar, word-highlight captions */
.clip-strip { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .62; pointer-events: none; }
.clip.sel .clip-strip { opacity: .8; }
.shape-btn .sh-progress { width: 52px; height: 7px; border-radius: 4px; background: linear-gradient(90deg, var(--accent) 60%, color-mix(in srgb, var(--accent) 30%, transparent) 60%); }
.cap-style span { white-space: nowrap; }
.stage-area.picking .stage-overlay { cursor: crosshair; }
.stage-area.picking .stage-box { outline: 2px dashed var(--accent); outline-offset: 3px; }
.inspector .magic-row .btn.danger { justify-content: flex-start; padding: 0 8px; }
