/* OneBuckVideo editor: a dark, full-screen workspace like a desktop video editor. */
.ed {
  --e-bg: #0d1117;
  --e-panel: #151b24;
  --e-panel-2: #1c2430;
  --e-line: #2a3443;
  --e-text: #e7edf5;
  --e-muted: #8b98ab;
  --e-accent: #34d399;
  --e-accent-ink: #062b1e;
  --e-sel: #38bdf8;
  --e-warn: #fbbf24;
  --e-bad: #f87171;
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  background: var(--e-bg);
  color: var(--e-text);
  font: 13px/1.4 Inter, system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: dark;
}
.ed button, .ed select, .ed input, .ed textarea { font: inherit; color: inherit; }
.ed-h { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--e-muted); margin-bottom: 8px; }
.ed-h em { font-style: normal; text-transform: none; letter-spacing: 0; color: var(--e-text); font-weight: 600; }
.ed-btn { background: var(--e-panel-2); border: 1px solid var(--e-line); border-radius: 8px; padding: 6px 12px; cursor: pointer; font-weight: 600; }
.ed-btn:hover:not(:disabled) { border-color: var(--e-muted); }
.ed-btn:disabled { opacity: 0.4; cursor: default; }
.ed-btn.primary { background: var(--e-accent); border-color: var(--e-accent); color: var(--e-accent-ink); }
.ed-seg { display: inline-flex; border: 1px solid var(--e-line); border-radius: 8px; overflow: hidden; }
.ed-seg button { background: transparent; border: 0; padding: 6px 10px; cursor: pointer; color: var(--e-muted); font-weight: 600; }
.ed-seg button.on { background: var(--e-accent); color: var(--e-accent-ink); }
.ed-seg.wide { display: flex; }
.ed-seg.wide button { flex: 1; }

/* Top bar */
.ed-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 14px; border-bottom: 1px solid var(--e-line); background: var(--e-panel); }
.ed-title { display: flex; gap: 10px; align-items: center; min-width: 0; }
.ed-brand { display: flex; align-items: center; gap: 8px; background: none; border: 0; padding: 0; cursor: pointer; font-family: 'Inter Tight', Inter, system-ui, sans-serif; font-weight: 800; font-size: 16px; letter-spacing: -0.02em; color: var(--e-text); }
.ed-brand b { color: var(--e-accent); font-weight: 800; }
.ed-divider { width: 1px; height: 20px; background: var(--e-line); }
.ed-title span { color: var(--e-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40vw; }
.ed-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.ed-status { color: var(--e-muted); font-size: 12px; max-width: 360px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ed-status.ok { color: var(--e-accent); }
.ed-status.warn { color: var(--e-warn); }
.ed-status.bad { color: var(--e-bad); white-space: normal; }

/* Body: scenes | stage | properties */
.ed-body { display: grid; grid-template-columns: 240px minmax(0, 1fr) 320px; min-height: 0; }
.ed-scenes, .ed-props { background: var(--e-panel); overflow: auto; padding: 12px; }
.ed-scenes { border-right: 1px solid var(--e-line); display: flex; flex-direction: column; }
.ed-props { border-left: 1px solid var(--e-line); }
#ed-scene-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; flex: 1; align-content: start; }
#ed-scene-list li { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 6px; padding: 8px; border-radius: 8px; background: var(--e-panel-2); border: 1px solid transparent; cursor: pointer; }
#ed-scene-list .ed-thumb { grid-column: 1 / -1; aspect-ratio: 16 / 9; border-radius: 6px; overflow: hidden; background: #0a0d12; border: 1px solid var(--e-line); display: grid; place-items: center; }
#ed-scene-list .ed-thumb.tall { aspect-ratio: auto; height: 110px; }
#ed-scene-list .ed-thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
#ed-scene-list .ed-thumb span { width: 40%; height: 3px; border-radius: 3px; background: linear-gradient(90deg, transparent, var(--e-line), transparent); background-size: 200% 100%; animation: ed-shimmer 1.2s linear infinite; }
@keyframes ed-shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
#ed-scene-list li.on { border-color: var(--e-sel); }
#ed-scene-list .n { font-weight: 800; color: var(--e-muted); }
#ed-scene-list .info { display: grid; min-width: 0; }
#ed-scene-list .info span { color: var(--e-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#ed-scene-list .info em { font-style: normal; color: var(--e-muted); font-size: 11px; }
#ed-scene-list .ops { grid-column: 2; display: flex; gap: 4px; }
#ed-scene-list .ops button { background: transparent; border: 1px solid var(--e-line); border-radius: 6px; padding: 0 6px; cursor: pointer; color: var(--e-muted); }
#ed-scene-list .ops button:disabled { opacity: 0.3; cursor: default; }
.ed-add { display: grid; gap: 6px; margin-top: 10px; }
.ed-add select, .ed-props select, .ed-props input, .ed-props textarea { width: 100%; background: var(--e-bg); border: 1px solid var(--e-line); border-radius: 8px; padding: 6px 8px; }
.ed-props textarea { resize: vertical; }

/* Stage */
.ed-stage { display: grid; grid-template-rows: minmax(0, 1fr) auto; min-width: 0; min-height: 0; }
.ed-stage-area { position: relative; display: grid; place-items: center; min-height: 0; overflow: hidden; background: repeating-conic-gradient(#11161e 0 25%, #0f141b 0 50%) 0 0 / 24px 24px; }
.ed-canvas { position: relative; box-shadow: 0 10px 40px rgb(0 0 0 / 0.5); background: #000; overflow: hidden; }
#ed-frame { position: absolute; left: 0; top: 0; border: 0; transform-origin: 0 0; pointer-events: none; background: #000; }
.ed-overlay { position: absolute; inset: 0; cursor: pointer; }
.ed-box { position: absolute; border: 1px dashed transparent; border-radius: 3px; pointer-events: none; }
.ed-box.hov { border-color: rgb(56 189 248 / 0.7); }
.ed-box.sel { border: 2px solid var(--e-sel); box-shadow: 0 0 0 9999px rgb(0 0 0 / 0.12); }
.ed-box span { position: absolute; left: -2px; top: -20px; background: var(--e-sel); color: #04121b; font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 4px; white-space: nowrap; }
.ed-transport { display: flex; align-items: center; gap: 10px; padding: 8px 14px; border-top: 1px solid var(--e-line); background: var(--e-panel); }
.ed-time { font-variant-numeric: tabular-nums; color: var(--e-muted); }
.ed-time .over { color: var(--e-bad); font-weight: 700; }
.ed-time .max { font-size: 11px; }
.ed-hint { margin-left: auto; color: var(--e-muted); font-size: 12px; }

/* Properties */
.ed-sec { padding-bottom: 14px; margin-bottom: 14px; border-bottom: 1px solid var(--e-line); display: grid; gap: 10px; }
.ed-sec label { display: grid; gap: 4px; color: var(--e-muted); font-size: 12px; }
.ed-sec label > :not(span) { color: var(--e-text); }
.ed-obj { background: var(--e-panel-2); margin: -12px -12px 14px; padding: 12px; border-bottom-color: var(--e-sel); }
.ed-x { margin-left: auto; background: transparent; border: 0; color: var(--e-muted); cursor: pointer; font-size: 14px; }
.ed-desc { margin: 0; color: var(--e-muted); font-size: 12px; }
.ed-count { color: var(--e-muted); font-size: 11px; text-align: right; margin-top: -6px; }
.ed-count.bad { color: var(--e-bad); }
.ed-note { color: var(--e-muted); font-size: 11px; }
.ed-anim { display: grid; gap: 8px; }
.ed-row3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.ed-images { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.ed-images button { position: relative; aspect-ratio: 1; padding: 0; border-radius: 8px; overflow: hidden; border: 2px solid var(--e-line); background: #0a0d12; cursor: pointer; }
.ed-images button.on { border-color: var(--e-sel); }
.ed-images img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.ed-images i { position: absolute; right: 4px; top: 4px; background: var(--e-sel); color: #04121b; font-style: normal; font-weight: 800; border-radius: 99px; min-width: 18px; font-size: 11px; }
.ed-objects { display: grid; gap: 6px; }
.ed-objects button { display: grid; text-align: left; gap: 2px; background: var(--e-panel-2); border: 1px solid var(--e-line); border-radius: 8px; padding: 8px; cursor: pointer; }
.ed-objects button.on { border-color: var(--e-sel); }
.ed-objects span { color: var(--e-muted); font-size: 12px; }

/* Timeline */
.ed-timeline { background: var(--e-panel); border-top: 1px solid var(--e-line); padding: 6px 14px 12px; }
.ed-track { position: relative; height: 70px; cursor: col-resize; user-select: none; touch-action: none; }
.ruler { position: absolute; left: 0; right: 0; top: 0; height: 16px; }
.tick { position: absolute; top: 0; font-size: 10px; color: var(--e-muted); transform: translateX(-50%); }
.tick:first-child { transform: none; }
.ed-block { position: absolute; top: 20px; height: 44px; border-radius: 6px; background: hsl(var(--hue) 45% 28%); border: 1px solid hsl(var(--hue) 50% 45%); overflow: hidden; cursor: pointer; }
.ed-block.on { outline: 2px solid var(--e-sel); outline-offset: -1px; z-index: 1; }
.ed-block span { display: block; padding: 4px 8px; font-size: 11px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ed-handle { position: absolute; right: 0; top: 0; bottom: 0; width: 8px; cursor: ew-resize; background: linear-gradient(90deg, transparent, rgb(255 255 255 / 0.25)); }
.ed-playhead { position: absolute; top: 14px; bottom: 0; width: 2px; margin-left: -1px; background: var(--e-warn); pointer-events: none; z-index: 2; }
.ed-playhead::before { content: ''; position: absolute; top: -4px; left: -5px; border: 6px solid transparent; border-top-color: var(--e-warn); }

@media (max-width: 1000px) {
  .ed-body { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(320px, 50vh) max-content; align-content: start; overflow: auto; }
  .ed-scenes { border-right: 0; border-bottom: 1px solid var(--e-line); max-height: 150px; }
  #ed-scene-list { grid-auto-flow: column; grid-auto-columns: 200px; overflow-x: auto; }
  .ed-stage { min-height: 0; }
  .ed-props { border-left: 0; border-top: 1px solid var(--e-line); overflow: visible; }
  .ed-hint { display: none; }
}
.ed-color { display: flex; align-items: center; gap: 8px; }
.ed-color input[type="color"] { width: 38px; height: 30px; padding: 0; border: 1px solid var(--e-line); border-radius: 6px; background: none; cursor: pointer; }
.ed-color span { color: var(--e-muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.ed-color .ed-btn { margin-left: auto; padding: 3px 8px; font-size: 12px; }
.ed-colors { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.ed-warn { color: var(--e-warn); font-size: 12px; }

.ed-palettes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.ed-palettes button { display: grid; gap: 6px; padding: 8px; background: var(--e-bg); border: 1px solid var(--e-line); border-radius: 8px; cursor: pointer; text-align: left; }
.ed-palettes button[aria-pressed="true"] { border-color: var(--e-sel); }

.ed-art-library details { display: grid; gap: 10px; }
.ed-art-library summary { cursor: pointer; font-weight: 700; margin-bottom: 10px; }
.ed-art-library details > label { margin: 8px 0; }
.ed-art-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; max-height: 300px; overflow: auto; padding: 2px; }
.ed-art-grid button { min-width: 0; background: #e2e8f0; color: #0f172a; border: 1px solid var(--e-line); border-radius: 8px; padding: 6px; cursor: pointer; font-size: 10px; }
.ed-art-grid button:disabled { opacity: .4; cursor: default; }
.ed-art-grid img { display: block; width: 40px; height: 40px; margin: 0 auto 5px; }
.ed-art-grid span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
