:root {
  color-scheme: dark;
  --bg: #090b10; --panel: #11141b; --panel-2: #171b23; --line: #292f3a;
  --muted: #929bad; --text: #f5f6f8; --accent: #b9f34a; --accent-dim: #1d2913;
  --violet: #9d8cff; --danger: #ff737b;
  font-family: Tahoma, Arial, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: radial-gradient(circle at 12% -10%, rgba(157,140,255,.1), transparent 30rem), var(--bg); color: var(--text); }
button, input, select { font: inherit; }
button, select, input[type="number"] { border: 1px solid var(--line); border-radius: 7px; color: var(--text); background: var(--panel-2); }
button { min-height: 34px; padding: 0 11px; cursor: pointer; }
button:hover:not(:disabled) { border-color: #495263; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button:disabled { opacity: .35; cursor: not-allowed; }
select, input[type="number"] { width: 100%; min-height: 34px; padding: 0 9px; }
input[type="range"] { accent-color: var(--accent); }
h1, h2, h3, p { margin-top: 0; }

.topbar { min-height: 68px; padding: 9px 26px; display: flex; align-items: center; justify-content: space-between; gap: 18px; border-bottom: 1px solid var(--line); background: rgba(9,11,16,.9); }
.brand { display: flex; align-items: center; gap: 11px; color: inherit; text-decoration: none; }
.brand > span:last-child { display: grid; gap: 2px; }
.brand b { direction: ltr; font: 700 17px/1 Arial, sans-serif; }
.brand small { color: var(--muted); font-size: 10px; }
.brand-mark { position: relative; width: 30px; height: 30px; border-radius: 9px; background: var(--accent); overflow: hidden; }
.brand-mark i { position: absolute; top: 7px; bottom: 7px; width: 4px; border-radius: 4px; background: #0d1208; transform: rotate(17deg); }
.brand-mark i:first-child { left: 9px; } .brand-mark i:last-child { right: 9px; }
.header-actions { display: flex; gap: 6px; margin-inline: auto 0; }
.header-actions button { min-height: 30px; color: var(--muted); font-size: 10px; }
.danger-quiet { color: #ff9ca1 !important; }
.session-state { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; white-space: nowrap; }
.session-state button { min-height: 28px; font-size: 9px; }
.pulse { width: 7px; height: 7px; border-radius: 50%; background: #e2a83a; box-shadow: 0 0 0 4px rgba(226,168,58,.1); }
.session-state.ready .pulse { background: var(--accent); box-shadow: 0 0 0 4px rgba(185,243,74,.1); }
.session-state.error .pulse { background: var(--danger); }

.workspace { display: grid; grid-template-columns: minmax(0,1fr) 300px; direction: ltr; min-height: calc(100vh - 106px); }
.stage { min-width: 0; padding: 24px; direction: rtl; }
.stage-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 18px; margin-bottom: 14px; }
.eyebrow { display: block; color: var(--accent); font-size: 9px; font-weight: 700; margin-bottom: 5px; }
h1 { margin-bottom: 0; font-size: 20px; } h2 { font-size: 15px; } h3 { font-size: 12px; }
.time-readout { display: flex; gap: 14px; color: var(--muted); font-size: 9px; }
.time-readout span { display: grid; gap: 3px; }
.time-readout b { color: #d8dce4; font: 10px Consolas, monospace; font-weight: 400; }

.preview { position: relative; min-height: 380px; display: grid; place-items: center; overflow: hidden; border: 1px solid #222731; border-radius: 14px; background: linear-gradient(135deg,rgba(255,255,255,.018) 25%,transparent 25%) 0 0/18px 18px,#05070a; box-shadow: 0 18px 60px rgba(0,0,0,.22); }
.preview-badge { position: absolute; z-index: 3; top: 13px; right: 13px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; color: var(--muted); background: rgba(16,19,26,.88); font-size: 9px; }
.video-frame { position: relative; width: min(100%, 860px); height: min(64vh, 520px); overflow: hidden; background: #000; transition: aspect-ratio .2s; }
.video-rotator { position: absolute; left: 50%; top: 50%; width: 100%; height: 100%; transform-origin: center; }
.video-rotator video { display: block; width: 100%; height: 100%; background: #000; }
.upload-panel { width: min(440px,calc(100% - 40px)); z-index: 1; text-align: center; color: var(--muted); }
.drop-zone { padding: 38px 25px; border: 1px dashed #343b48; border-radius: 12px; outline: 0; transition: .18s; }
.drop-zone.dragging, .drop-zone:focus-visible { border-color: var(--accent); background: rgba(185,243,74,.035); transform: translateY(-2px); }
.drop-zone h2, .upload-status h2 { margin: 16px 0 7px; color: #d9dce2; }
.drop-zone p, .upload-status p { margin: 0; font-size: 11px; }
.empty-icon { display: inline-block; position: relative; width: 47px; height: 35px; border: 1px solid #404654; border-radius: 8px; background: #151922; }
.empty-icon::before { content: ""; position: absolute; border-top: 6px solid transparent; border-bottom: 6px solid transparent; border-right: 9px solid var(--accent); left: 18px; top: 11px; }
.file-button, .retry-button { display: inline-flex; align-items: center; justify-content: center; min-height: 36px; margin-top: 20px; padding: 0 17px; border: 0; border-radius: 8px; color: #101508; background: var(--accent); font-size: 11px; font-weight: 700; cursor: pointer; }
.file-button:has(input:disabled) { opacity: .45; cursor: wait; }
.file-button input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.upload-status { padding: 38px 20px; }
.status-glyph { width: 45px; height: 45px; margin: auto; border: 2px solid #313846; border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; }
.upload-status.error .status-glyph { position: relative; animation: none; border-color: var(--danger); }
.upload-status.error .status-glyph::before, .upload-status.error .status-glyph::after { content: ""; position: absolute; top: 20px; left: 10px; width: 21px; height: 2px; background: var(--danger); transform: rotate(45deg); }
.upload-status.error .status-glyph::after { transform: rotate(-45deg); }
.progress { height: 4px; margin: 20px auto 0; max-width: 300px; overflow: hidden; border-radius: 4px; background: #262c36; }
.progress span { display: block; width: 0; height: 100%; background: var(--accent); transition: width .15s; }
.progress.indeterminate span { width: 35%; animation: slide 1.1s ease-in-out infinite; }
.retry-button { color: #e8ebf0; background: #292f3a; }
@keyframes spin { to { transform: rotate(360deg); } } @keyframes slide { from { transform: translateX(220%); } to { transform: translateX(-320%); } }

.transport { direction: ltr; display: grid; grid-template-columns: 62px 1fr 72px; align-items: center; gap: 10px; margin-top: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.play-button { color: #111607; border-color: var(--accent); background: var(--accent); font-weight: 700; }
#seek-bar { width: 100%; } #playhead-label { color: var(--muted); text-align: right; font: 10px Consolas,monospace; }

.clip-editor { margin-top: 14px; padding: 14px; border: 1px solid var(--line); border-radius: 11px; background: var(--panel); }
.clip-summary { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; }
.clip-summary h2 { margin: 0; } #duration-summary { color: var(--muted); font: 10px Consolas,monospace; }
.selected-clip { display: grid; grid-template-columns: 110px minmax(100px,1fr) minmax(100px,1fr) minmax(250px,2fr); align-items: end; gap: 10px; margin-top: 13px; padding: 11px; border-radius: 9px; background: #0d1016; }
.selected-clip h3 { margin: 0; }
.selected-clip label, .setting-group label { display: grid; gap: 6px; color: var(--muted); font-size: 9px; }
.clip-actions { display: flex; gap: 5px; flex-wrap: wrap; direction: rtl; }
.clip-actions button { min-height: 34px; font-size: 9px; }
.inline-message { min-height: 18px; padding-top: 7px; color: #f1c368; font-size: 9px; }
.clip-list { display: grid; grid-template-columns: repeat(auto-fill,minmax(175px,1fr)); gap: 8px; margin: 4px 0 0; padding: 0; list-style: none; counter-reset: clip; }
.clip-list li { counter-increment: clip; }
.clip-card { width: 100%; min-height: 58px; display: grid; grid-template-columns: 24px 1fr; align-items: center; gap: 8px; padding: 8px; text-align: right; }
.clip-card::before { content: counter(clip); display: grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; color: var(--violet); background: rgba(157,140,255,.12); font: 700 10px Arial; }
.clip-card.selected { border-color: var(--accent); background: var(--accent-dim); }
.clip-card span { display: grid; gap: 4px; }
.clip-card b { font-size: 10px; } .clip-card small { color: var(--muted); font: 9px Consolas,monospace; direction: ltr; }
.precision-note { margin: 11px 0 0; color: #6f7889; font-size: 9px; }

.inspector { direction: rtl; padding: 24px 19px; border-left: 1px solid var(--line); background: var(--panel); }
.inspector-head { padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.inspector h2 { margin: 0; }
.notice { display: flex; gap: 10px; margin: 18px 0; padding: 12px; border: 1px solid #35401e; border-radius: 9px; background: var(--accent-dim); }
.notice > span { flex: 0 0 22px; width: 22px; height: 22px; display: grid; place-items: center; color: #101508; background: var(--accent); border-radius: 50%; font: 700 11px Arial; }
.notice p { margin: 0; color: #b9c1ad; font-size: 10px; line-height: 1.8; } .notice b { display: block; color: #e5ecd9; }
.setting-group { display: grid; gap: 11px; padding: 15px 0; border-bottom: 1px solid #222630; }
.setting-group.two-column { grid-template-columns: 1fr 1fr; }
.setting-group button { width: 100%; text-align: right; }
.audio-settings small { color: #737c8e; font-size: 8px; line-height: 1.7; }
.check-label { display: flex !important; grid-auto-flow: column; justify-content: start; align-items: center; }
.audio-settings output { float: left; color: var(--text); }
#volume-input { width: 100%; }
.export-box { margin-top: 17px; padding: 12px; border: 1px solid var(--line); border-radius: 9px; background: #0d1016; }
.export-box button { width: 100%; }
.export-box p { margin: 8px 0 0; color: var(--muted); font-size: 9px; line-height: 1.7; }
.export-progress { height: 5px; margin-top: 10px; overflow: hidden; border-radius: 5px; background: #262c36; }
.export-progress span { display: block; width: 0; height: 100%; background: var(--accent); transition: width .2s; }
.export-box .danger { margin-top: 9px; color: #ff9b9b; }
.export-box video { width: 100%; margin-top: 10px; border-radius: 7px; background: #000; }
.download-link { display: block; margin-top: 9px; padding: 9px; border-radius: 7px; text-align: center; color: #07110c; background: var(--accent); font-size: 11px; font-weight: 700; }

footer { min-height: 38px; display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 0 26px; border-top: 1px solid var(--line); color: #666f80; font-size: 9px; }

@media (max-width: 960px) { .selected-clip { grid-template-columns: 1fr 1fr; } .selected-clip > div:first-child, .clip-actions { grid-column: 1/-1; } }
@media (max-width: 800px) { .workspace { grid-template-columns: 1fr; } .inspector { border-left: 0; border-top: 1px solid var(--line); } .video-frame { height: min(52vh,430px); } }
@media (max-width: 560px) {
  .topbar { padding-inline: 12px; flex-wrap: wrap; } .brand small, footer span:last-child, .session-state { display: none; }
  .header-actions { order: 2; width: 100%; } .stage { padding: 16px 10px; }
  .stage-heading { align-items: flex-start; } h1 { font-size: 17px; }
  .time-readout { flex-direction: column; gap: 5px; } .preview { min-height: 270px; }
  .video-frame { width: 100%; height: 42vh; } .selected-clip { grid-template-columns: 1fr; }
  .selected-clip > div:first-child, .clip-actions { grid-column: auto; }
  .clip-actions button { flex: 1 1 42%; } footer { padding-inline: 12px; }
}
