:root{
  --bg:#090a09;
  --panel:#111611;
  --panel2:#171b16;
  --panel3:#0d100d;
  --line:rgba(245,250,241,.12);
  --text:#f5f8f2;
  --muted:#aeb9ac;
  --accent:#4ed98a;
  --accent2:#48c7c2;
  --audio:#f3a0c4;
  --danger:#ff637d;
  --ok:#9df2bc;
}
*{box-sizing:border-box}
html,body{
  margin:0;
  height:100%;
  background:linear-gradient(180deg,#10130f 0%,#070807 100%);
  color:var(--text);
  font-family:Inter,system-ui,-apple-system,Segoe UI,sans-serif;
}
body{
  overflow:hidden;
  display:grid;
  grid-template-rows:auto minmax(0,1fr);
}

.topbar{
  display:flex;
  justify-content:space-between;
  gap:12px;
  align-items:flex-end;
  padding:12px 14px;
  border-bottom:1px solid var(--line);
  background:linear-gradient(180deg, rgba(22,26,20,.98), rgba(10,12,10,.98));
}
.brand{min-width:170px}
.brand .title{font-weight:850;font-size:24px;line-height:1.1}

.toolbar{display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-end;gap:7px}
.sep{width:1px;height:26px;background:rgba(255,255,255,.12);margin:0 2px}

.btn,
.export-select,
.choice-btn,
.tool-btn{
  border:1px solid rgba(255,255,255,.13);
  background:rgba(255,255,255,.045);
  color:var(--text);
  border-radius:8px;
  padding:9px 11px;
  cursor:pointer;
  user-select:none;
  display:inline-flex;
  align-items:center;
  gap:8px;
  text-decoration:none;
  transition:border-color .15s ease, background .15s ease, transform .15s ease;
  font:inherit;
  font-size:13px;
}
.btn:hover,
.choice-btn:hover,
.tool-btn:hover{border-color:rgba(255,255,255,.26);background:rgba(255,255,255,.07)}
.btn:active,
.choice-btn:active,
.tool-btn:active{transform:translateY(1px)}
.btn.small{padding:7px 9px;font-size:12px}
.btn.primary{background:linear-gradient(135deg, rgba(78,217,138,.22), rgba(72,199,194,.14));border-color:rgba(78,217,138,.48)}
.btn.ghost{background:rgba(255,255,255,.03)}
.btn.danger{border-color:rgba(255,99,125,.38);background:rgba(255,99,125,.09)}
.btn.active{border-color:rgba(157,242,188,.65);box-shadow:0 0 0 3px rgba(157,242,188,.10)}
.btn:disabled,
.tool-btn:disabled,
.choice-btn:disabled,
.export-select:disabled,
.btn.disabled{opacity:.42;cursor:not-allowed}
.export-select{background:rgba(0,0,0,.24);padding:9px 10px;min-width:130px}

.badge{
  font-size:12px;
  color:var(--muted);
  border:1px solid rgba(255,255,255,.11);
  padding:5px 9px;
  border-radius:999px;
  background:rgba(255,255,255,.035);
  white-space:nowrap;
}

.app{min-height:0}
.workspace{
  height:100%;
  display:grid;
  grid-template-columns:minmax(270px, 340px) minmax(0, 1fr);
  grid-template-rows:auto minmax(215px, 30vh) minmax(0, 1fr);
  min-width:0;
  min-height:0;
}

.project-choice{
  grid-column:1 / -1;
  grid-row:1;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  padding:10px 12px;
  border-bottom:1px solid var(--line);
  background:linear-gradient(90deg, rgba(78,217,138,.16), rgba(72,199,194,.07));
}
.choice-title{font-weight:850;font-size:17px}
.choice-note{color:var(--muted);font-size:12px;margin-top:2px}
.choice-actions{display:flex;gap:8px;flex-wrap:wrap;justify-content:flex-end}
.choice-btn{
  font-weight:850;
  font-size:15px;
  min-width:128px;
  justify-content:center;
}
.choice-btn.active{
  color:#061008;
  background:var(--accent);
  border-color:rgba(255,255,255,.18);
}
.project-choice.locked{background:linear-gradient(90deg, rgba(78,217,138,.10), rgba(255,255,255,.025))}

.top-stage{
  grid-column:1 / -1;
  grid-row:2;
  min-height:0;
  display:grid;
  grid-template-columns:minmax(270px, 340px) minmax(0, 1fr);
  grid-template-rows:minmax(0, 1fr);
  gap:10px;
  padding:10px 12px 8px;
  border-bottom:1px solid var(--line);
  background:linear-gradient(180deg, rgba(13,16,13,.98), rgba(9,11,9,.98));
}

.viewer-panel,
.media-panel{
  min-height:0;
  border:1px solid rgba(255,255,255,.11);
  border-radius:8px;
  background:linear-gradient(180deg, rgba(255,255,255,.045), rgba(255,255,255,.018));
  overflow:hidden;
}
.viewer-panel{grid-column:2;grid-row:1;display:grid;grid-template-rows:auto minmax(0,1fr)}
.viewer-head,
.panel-head{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
  padding:11px 12px;
  border-bottom:1px solid rgba(255,255,255,.08);
}
.panel-head.compact{padding:9px 10px}
.viewer-title,.panel-title,.timeline-title{font-weight:850}
.viewer-meta{display:flex;gap:7px;align-items:center;flex-wrap:wrap;justify-content:flex-end}
.panel-sub{color:var(--muted);font-size:12px;margin-top:3px}
.viewer-stage{position:relative;min-height:0;background:#000}
.viewer-video{width:100%;height:100%;min-height:0;background:#000;display:block;object-fit:contain}
.viewer-empty{
  position:absolute;inset:0;display:flex;align-items:center;justify-content:center;
  color:rgba(255,255,255,.48);font-size:14px;pointer-events:none;padding:20px;text-align:center;
}
.viewer-stage.has-media .viewer-empty{display:none}

.media-panel{grid-column:1;grid-row:1;display:grid;grid-template-rows:auto minmax(0,1fr)}
.library-grid{
  display:grid;
  grid-template-columns:repeat(2, minmax(0, 1fr));
  gap:7px;
  padding:8px;
  overflow:auto;
  align-content:start;
}
.thumb{
  border:1px solid rgba(255,255,255,.11);
  background:rgba(255,255,255,.04);
  border-radius:8px;
  padding:5px;
  cursor:grab;
}
.thumb:active{cursor:grabbing}
.thumb img{
  width:100%;
  aspect-ratio:16/9;
  object-fit:cover;
  border-radius:6px;
  border:1px solid rgba(255,255,255,.08);
  background:#000;
}
.thumb .name{margin-top:5px;font-size:10px;line-height:1.15;color:var(--text);word-break:break-word}
.thumb .meta{margin-top:3px;font-size:9px;color:var(--muted)}

.timeline{
  grid-column:1 / -1;
  grid-row:3;
  min-height:0;
  padding:8px 12px 12px;
  overflow:hidden;
  display:grid;
  grid-template-rows:auto auto minmax(0,1fr) auto auto;
  gap:9px;
}
.timeline-head{display:flex;justify-content:space-between;align-items:flex-end;gap:10px}
.timeline-sub{font-size:12px;color:var(--muted);margin-top:3px}
.hint-badges{display:flex;gap:7px;flex-wrap:wrap}

.timeline-tools{
  display:flex;
  align-items:center;
  gap:6px;
  overflow:auto;
  padding-bottom:1px;
}
.tool-btn{
  min-width:36px;
  justify-content:center;
  padding:6px 8px;
  font-size:12px;
  font-weight:850;
  white-space:nowrap;
}
.tool-btn.active{border-color:rgba(157,242,188,.65);box-shadow:0 0 0 2px rgba(157,242,188,.10)}
.tool-btn.danger{border-color:rgba(255,99,125,.38);background:rgba(255,99,125,.09)}
.tool-sep{width:1px;align-self:stretch;background:rgba(255,255,255,.12);margin:0 2px}

.timeline-scroller{
  border:1px solid rgba(255,255,255,.11);
  border-radius:8px;
  background:rgba(255,255,255,.02);
  overflow:auto;
  min-height:0;
}
.timeline-root{position:relative;min-width:1100px;min-height:100%}
.ruler{
  position:sticky;top:0;z-index:5;height:34px;border-bottom:1px solid rgba(255,255,255,.10);
  background:linear-gradient(180deg, rgba(18,22,17,.98), rgba(12,14,12,.98));
}
.tick{position:absolute;top:18px;width:1px;height:10px;background:rgba(255,255,255,.18)}
.tick.major{top:10px;height:18px;background:rgba(255,255,255,.34)}
.tick-label{position:absolute;top:3px;transform:translateX(-50%);font-size:11px;color:var(--muted)}

.tracks{display:grid;grid-template-columns:56px 1fr;min-height:100%}
.track-labels{
  position:sticky;left:0;z-index:4;background:linear-gradient(180deg, rgba(18,22,17,.98), rgba(8,10,8,.98));
  border-right:1px solid rgba(255,255,255,.10);
}
.track-label{
  height:78px;display:flex;align-items:center;justify-content:center;font-weight:850;font-size:13px;
  color:#eaf2e7;border-bottom:1px solid rgba(255,255,255,.08);
}
.track-lanes{position:relative}
.lane{
  position:relative;height:78px;border-bottom:1px solid rgba(255,255,255,.08);
  background-image:linear-gradient(90deg, rgba(255,255,255,.055) 1px, transparent 1px), linear-gradient(180deg, rgba(255,255,255,.018), rgba(255,255,255,.008));
  background-size:40px 100%, 100% 100%;
}
.lane.video{background-color:rgba(72,199,194,.035)}
.lane.audio{background-color:rgba(243,160,196,.04)}
.lane.dragover{box-shadow:inset 0 0 0 1px rgba(78,217,138,.58), inset 0 0 0 999px rgba(78,217,138,.07)}

.clip{
  position:absolute;top:8px;height:60px;border-radius:8px;border:1px solid rgba(255,255,255,.16);overflow:hidden;
  display:grid;grid-template-columns:8px 1fr 8px;min-width:22px;user-select:none;touch-action:none;
}
.clip.video{background:linear-gradient(135deg, rgba(72,199,194,.46), rgba(78,217,138,.18))}
.clip.audio{background:linear-gradient(135deg, rgba(243,160,196,.42), rgba(255,255,255,.08))}
.clip.selected{box-shadow:0 0 0 2px rgba(255,255,255,.18), 0 0 0 4px rgba(78,217,138,.22)}
.clip .body{position:relative;padding:8px 10px;overflow:hidden;cursor:grab}
.clip .body:active{cursor:grabbing}
.clip-name{font-size:12px;font-weight:800;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;position:relative;z-index:2}
.clip-meta{margin-top:4px;font-size:11px;color:rgba(255,255,255,.78);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;position:relative;z-index:2}
.clip-badges{margin-top:5px;display:flex;gap:5px;flex-wrap:wrap;position:relative;z-index:2}
.clip-badge{
  font-size:9px;line-height:1;padding:3px 5px;border-radius:999px;background:rgba(0,0,0,.22);border:1px solid rgba(255,255,255,.12);color:rgba(255,255,255,.84)
}
.waveform{
  position:absolute;left:0;right:0;top:0;bottom:0;opacity:.36;pointer-events:none;z-index:1;
}
.waveform path{fill:none;stroke:rgba(255,255,255,.88);stroke-width:1.4;vector-effect:non-scaling-stroke}
.fade-overlay{position:absolute;inset:0;pointer-events:none;z-index:1}
.fade-overlay::before,.fade-overlay::after{content:"";position:absolute;top:0;bottom:0}
.fade-overlay::before{left:0;background:linear-gradient(90deg, rgba(0,0,0,.42), rgba(0,0,0,0))}
.fade-overlay::after{right:0;background:linear-gradient(270deg, rgba(0,0,0,.42), rgba(0,0,0,0))}
.handle{background:rgba(255,255,255,.15);cursor:ew-resize}
.handle:hover{background:rgba(255,255,255,.25)}

.playhead{position:absolute;top:0;width:2px;bottom:0;background:linear-gradient(180deg, #fff, var(--accent));z-index:7;left:56px}
.playhead::before{content:"";position:absolute;top:0;left:50%;transform:translate(-50%, -2px);width:12px;height:12px;border-radius:999px;background:#fff;box-shadow:0 0 0 4px rgba(78,217,138,.20)}

.bottom-row{display:flex;justify-content:space-between;align-items:center;gap:10px;min-height:0}
.hint{font-size:12px;color:var(--muted)}
.bottom-actions{display:flex;align-items:center;gap:10px;justify-content:flex-end;flex-wrap:wrap}
.download{
  display:flex;
  gap:7px;
  flex-wrap:wrap;
  justify-content:flex-end;
  align-items:center;
}
.download-label{
  color:var(--ok);
  font-size:12px;
  font-weight:800;
}
.download a{
  color:#061008;text-decoration:none;border:1px solid rgba(255,255,255,.18);background:var(--accent);
  border-radius:8px;padding:9px 11px;display:inline-block;font-size:13px;font-weight:850;
}
.incoprea-link{
  color:var(--muted);
  font-size:12px;
  text-decoration:none;
}
.incoprea-link:hover{color:var(--text)}
.log{
  margin:0;height:31px;overflow:auto;border:1px solid rgba(255,255,255,.11);
  border-radius:8px;background:rgba(0,0,0,.24);padding:9px 10px;color:#dce4d8;font-size:12px;line-height:1.45;white-space:pre-wrap;
}
.hidden{display:none !important}

@media (max-width: 1120px){
  .topbar{align-items:flex-start}
  .workspace{
    grid-template-columns:minmax(230px, 300px) minmax(0, 1fr);
    grid-template-rows:auto minmax(220px, 32vh) minmax(0, 1fr);
  }
  .top-stage{grid-template-columns:minmax(230px, 300px) minmax(0, 1fr)}
}
@media (max-width: 900px){
  body{overflow:auto}
  .app{min-height:1040px}
  .topbar{display:block}
  .toolbar{justify-content:flex-start;margin-top:10px}
  .workspace{height:auto;grid-template-columns:1fr;grid-template-rows:auto 360px auto}
  .project-choice{display:grid;grid-template-columns:1fr;align-items:start}
  .choice-actions{justify-content:flex-start}
  .top-stage{
    grid-column:1;
    grid-row:2;
    grid-template-columns:minmax(220px, 280px) minmax(0, 1fr);
    grid-template-rows:minmax(0,1fr);
    padding:10px 12px 8px;
    border-bottom:1px solid var(--line);
  }
  .timeline{grid-column:1;grid-row:3;min-height:540px;padding:8px 12px 12px}
}
@media (max-width: 720px){
  .brand{min-width:0}
  .top-stage{grid-template-columns:1fr;grid-template-rows:280px 220px}
  .media-panel{grid-column:1;grid-row:1}
  .viewer-panel{grid-column:1;grid-row:2}
  .thumb .meta{display:none}
  .library-grid{grid-template-columns:repeat(3, minmax(0,1fr))}
  .timeline-head,.bottom-row{flex-direction:column;align-items:flex-start}
  .track-label{height:70px}
  .lane{height:70px}
  .clip{top:7px;height:56px}
  .download{justify-content:flex-start}
}
