:root {
  --bg: #0d0b14;
  --bg2: #15121f;
  --card: #1b1727;
  --line: #2d2740;
  --text: #ece9f5;
  --muted: #a39cb8;
  --accent: #9146ff;
  --accent2: #ff4fa3;
  --good: #3ddc97;
  --warn: #ffc857;
  --bad: #ff5d6c;
  --radius: 14px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: radial-gradient(1200px 600px at 10% -10%, #2a1650 0%, transparent 60%),
              radial-gradient(900px 500px at 110% 0%, #3a1032 0%, transparent 55%), var(--bg);
  color: var(--text);
  font: 15px/1.5 Inter, system-ui, sans-serif;
  min-height: 100vh;
}
a { color: #c6a6ff; }
h1, h2 { margin: 0; }
h2 { font-size: 20px; display: flex; align-items: center; gap: 10px; }
em { color: var(--muted); font-style: normal; font-weight: 400; }

.top { padding: 28px 24px 8px; max-width: 1280px; margin: 0 auto; }
.brand { display: flex; gap: 16px; align-items: center; }
.logo {
  width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; font-size: 28px;
  background: linear-gradient(135deg, var(--accent), var(--accent2)); box-shadow: 0 8px 30px #9146ff55;
}
.brand h1 { font: 900 30px Montserrat, sans-serif; letter-spacing: -0.5px; }
.brand p { margin: 2px 0 0; color: var(--muted); }

main { max-width: 1280px; margin: 0 auto; padding: 16px 24px 40px; display: grid; gap: 20px; }
.card { background: color-mix(in srgb, var(--card) 92%, transparent); border: 1px solid var(--line); border-radius: 20px; padding: 22px; }
.num {
  width: 28px; height: 28px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 14px;
  background: var(--accent); color: #fff; flex: none;
}

.setup-grid { display: grid; grid-template-columns: 1fr 1.2fr; gap: 22px; margin-top: 18px; }
.drop {
  border: 2px dashed #4a3f6b; border-radius: var(--radius); min-height: 260px; display: grid; place-items: center;
  cursor: pointer; transition: .15s; background: #ffffff05; text-align: center; padding: 20px;
}
.drop:hover, .drop.over { border-color: var(--accent); background: #9146ff14; }
.drop-inner { display: grid; gap: 6px; justify-items: center; }
.drop-inner span, .drop-inner small { color: var(--muted); }
.drop-inner small { font-size: 12px; max-width: 320px; }
.drop-icon { font-size: 34px; width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; background: #9146ff26; }
.file-ok strong { word-break: break-all; }

.fields { display: grid; gap: 14px; align-content: start; }
.field { display: grid; gap: 6px; font-weight: 600; font-size: 13px; }
.field.inline { grid-template-columns: auto 1fr; align-items: center; gap: 12px; }
.field span { color: var(--text); }
input[type=text], select {
  background: var(--bg2); color: var(--text); border: 1px solid var(--line); border-radius: 10px;
  padding: 11px 12px; font: inherit; font-weight: 500; width: 100%;
}
input[type=text]:focus, select:focus { outline: 2px solid var(--accent); border-color: transparent; }
input[type=range] { accent-color: var(--accent); width: 100%; }
.row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.more { font-size: 13px; color: var(--muted); }
.more summary { cursor: pointer; }
.more p { margin: 8px 0; }
.vod-info { font-size: 13px; padding: 10px 12px; border-radius: 10px; background: #3ddc9714; border: 1px solid #3ddc9744; }
.vod-info.err { background: #ff5d6c14; border-color: #ff5d6c55; }

.btn {
  font: 600 14px Inter, sans-serif; color: var(--text); background: #2a2440; border: 1px solid #3a3256;
  border-radius: 10px; padding: 9px 14px; cursor: pointer; transition: .12s; white-space: nowrap;
}
.btn:hover:not(:disabled) { background: #352d52; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: linear-gradient(135deg, var(--accent), #b44cff 60%, var(--accent2)); border: 0; color: #fff; }
.btn.primary:hover:not(:disabled) { filter: brightness(1.1); }
.btn.big { padding: 14px 18px; font-size: 16px; border-radius: 12px; }
.btn.small { padding: 6px 10px; font-size: 12.5px; }
.btn.ghost { background: transparent; }
.hint { color: var(--muted); font-size: 12.5px; margin: 0; }

.progress-list { margin-top: 20px; display: grid; gap: 10px; }
.prog { display: grid; grid-template-columns: 22px 1fr auto; gap: 10px; align-items: center; font-size: 14px; }
.prog .bar { grid-column: 2 / 4; }
.bar { height: 6px; background: #ffffff12; border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent2)); transition: width .25s; }
.prog .st { color: var(--muted); font-size: 12.5px; }
.prog.done .icon { color: var(--good); }
.prog.fail .icon { color: var(--bad); }
.alert { margin-top: 16px; padding: 12px 14px; border-radius: 10px; background: #ffc85714; border: 1px solid #ffc85755; font-size: 14px; }
.alert.err { background: #ff5d6c14; border-color: #ff5d6c66; }

.results-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.weight { display: flex; gap: 10px; align-items: center; font-size: 13px; color: var(--muted); min-width: 280px; }
.player-wrap { margin-top: 16px; display: grid; gap: 10px; }
#player { width: 100%; max-height: 62vh; background: #000; border-radius: var(--radius); }
.timeline-wrap canvas { width: 100%; height: 90px; display: block; cursor: pointer; border-radius: 10px; background: var(--bg2); }
.timeline-legend { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 12.5px; margin-top: 6px; gap: 10px; }

.moments { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; margin-top: 20px; }
.moment { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: grid; }
.moment.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.thumb { position: relative; aspect-ratio: 16/9; background: #000 center/cover; }
.thumb .rank { position: absolute; top: 8px; left: 8px; font: 900 15px Montserrat; background: var(--accent); padding: 3px 9px; border-radius: 8px; }
.thumb .rank.manual { background: #4a3f6b; }
.thumb .tm { position: absolute; bottom: 8px; right: 8px; font-size: 12px; font-weight: 600; background: #000c; padding: 2px 7px; border-radius: 6px; }
.m-body { padding: 12px; display: grid; gap: 8px; }
.score { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.score .bar { flex: 1; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 12px; padding: 3px 8px; border-radius: 99px; background: #ffffff10; border: 1px solid #ffffff14; }
.chip.audio { background: #ff4fa31f; border-color: #ff4fa344; }
.chip.chat { background: #9146ff26; border-color: #9146ff55; }
.chip.tok { font-family: ui-monospace, monospace; font-size: 11.5px; }
.m-actions { display: flex; gap: 8px; }
.m-actions .btn { flex: 1; }
.m-actions .btn.x { flex: 0; }

/* editor */
.editor { position: fixed; inset: 0; background: #05040acc; backdrop-filter: blur(6px); z-index: 50; display: grid; place-items: center; padding: 18px; }
.editor[hidden] { display: none; }
.editor-panel { width: min(1280px, 100%); max-height: 100%; overflow: auto; background: var(--card); border: 1px solid var(--line); border-radius: 20px; }
.editor-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--card); z-index: 3; }
.editor-body { display: grid; grid-template-columns: 1fr 360px; gap: 22px; padding: 20px; }
.ed-left, .ed-right { display: grid; gap: 14px; align-content: start; min-width: 0; }
.layouts { display: flex; gap: 8px; flex-wrap: wrap; }
.layouts .btn.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.crop-stage { position: relative; width: 100%; background: #000; border-radius: 12px; overflow: hidden; user-select: none; }
.crop-stage video { width: 100%; height: 100%; display: block; }
.crop-overlay { position: absolute; inset: 0; }
.cbox { position: absolute; border: 3px solid; border-radius: 4px; cursor: move; touch-action: none; box-shadow: 0 0 0 9999px #0000; }
.cbox.cam { border-color: var(--accent2); background: #ff4fa314; }
.cbox.game { border-color: #59c3ff; background: #59c3ff10; }
.cbox .lbl { position: absolute; top: 0; left: 0; font-size: 12px; font-weight: 700; padding: 2px 8px; color: #000; }
.cbox.cam .lbl { background: var(--accent2); }
.cbox.game .lbl { background: #59c3ff; }
.cbox .handle { position: absolute; right: -9px; bottom: -9px; width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 3px solid currentColor; cursor: nwse-resize; touch-action: none; }
.transport { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; }
.time { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 13px; min-width: 70px; text-align: right; }
.trim { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.trim-col { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.trim-col b { color: var(--text); font-variant-numeric: tabular-nums; }
.btn-row { display: flex; flex-wrap: wrap; gap: 6px; }

.preview-frame { width: 100%; max-width: 300px; margin: 0 auto; aspect-ratio: 9/16; border-radius: 22px; overflow: hidden; border: 6px solid #2a2440; background: #000; }
.preview-frame canvas { width: 100%; height: 100%; display: block; }
.captions { display: grid; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg2); }
.cap-head { display: flex; justify-content: space-between; align-items: center; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 600; cursor: pointer; }
.check input { accent-color: var(--accent); width: 18px; height: 18px; }
.cap-list { display: grid; gap: 6px; max-height: 220px; overflow: auto; }
.cap { display: grid; grid-template-columns: 44px 1fr auto; gap: 6px; align-items: center; font-size: 12px; color: var(--muted); }
.cap input { padding: 6px 8px; font-size: 13px; }
.cap button { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 14px; }
.export-progress { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.export-result { display: grid; gap: 10px; }
.export-result video { width: 100%; max-height: 360px; border-radius: 12px; background: #000; }
.export-result a.btn { text-align: center; text-decoration: none; }

.foot { text-align: center; color: #6d6687; font-size: 12px; padding: 0 16px 30px; line-height: 1.9; }
.foot a { color: #a39cb8; }

.power-note { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--radius);
  background: #ffc8570f; border: 1px solid #ffc85755; font-size: 14px; color: var(--muted); }
.power-note strong { color: var(--text); }
.power-note .pn-ic { font-size: 20px; line-height: 1.2; }
.power-note.low { background: #ffc8571f; border-color: var(--warn); }
.power-note.low #powerExtra { display: block; margin-top: 6px; color: var(--warn); font-weight: 600; }

/* Lithospheres site chrome */
.site-nav { max-width: 1280px; margin: 0 auto; padding: 14px 24px 0; display: flex; align-items: center; gap: 18px; font-size: 14px; }
.site-nav a { color: var(--muted); text-decoration: none; font-weight: 600; }
.site-nav a:hover { color: var(--text); }
.site-brand { display: flex; align-items: center; gap: 8px; color: var(--text) !important; font-weight: 800 !important; font-size: 17px; }
.site-brand b { font-weight: 800; }
.site-brand b span { color: #8ef0c8; }
.site-nav .spacer { flex: 1; }
.faq { max-width: 1280px; margin: 0 auto; padding: 0 24px 30px; }
.faq h2 { margin-bottom: 12px; }
.faq-item { border-top: 1px solid var(--line); padding: 14px 0; }
.faq-item h3 { font-size: 16px; margin: 0 0 6px; }
.faq-item p { margin: 0; color: var(--muted); }
.ad-box { display: none; }
.ad-box.on { display: block; max-width: 1280px; margin: 0 auto 20px; padding: 0 24px; }
.ad-box.on ins.adsbygoogle { margin: 0 auto; max-width: 100%; }
.ad-box.on:has(ins[data-ad-status="unfilled"]) { display: none; }

@media (max-width: 960px) {
  .setup-grid, .editor-body { grid-template-columns: 1fr; }
  .row3 { grid-template-columns: 1fr 1fr; }
  .trim { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  main, .top { padding-left: 16px; padding-right: 16px; }
  .row3 { grid-template-columns: 1fr; }
  .card { padding: 16px; }
  .weight { min-width: 0; width: 100%; }
  .editor { padding: 0; }
  .editor-panel { border-radius: 0; height: 100%; }
}
