/* editor.css -- dark, DAW-ish chrome for the timeline editor.
   The player (my.css) is deliberately untouched by this file. */

:root {
  --bg:        #14151a;
  --panel:     #1c1e25;
  --panel-2:   #24262f;
  --line:      #333644;
  --text:      #e6e8ef;
  --muted:     #8d92a6;
  --accent:    #6ea8ff;
  --danger:    #ff6b6b;
  --lane-h:    84px;
  --ruler-h:   26px;
  --header-w:  148px;
  --detail-w:  292px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; height: 100%;
  background: var(--bg); color: var(--text);
  font: 13px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow: hidden;
}

body { display: flex; flex-direction: column; }

/* ---- toolbar --------------------------------------------------------- */

#toolbar {
  display: flex; align-items: center; gap: 14px;
  padding: 8px 12px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}

.brand { font-weight: 600; letter-spacing: .2px; white-space: nowrap; }
.brand span { color: var(--muted); font-weight: 400; }

.spacer { flex: 1 1 auto; }
.group { display: flex; gap: 6px; }

.btn {
  background: var(--panel-2); color: var(--text);
  border: 1px solid var(--line); border-radius: 6px;
  padding: 5px 11px; font: inherit; cursor: pointer;
}
.btn:hover:not(:disabled) { background: #2e3140; border-color: #454a5e; }
.btn:disabled { opacity: .4; cursor: default; }
.btn.primary { background: #2b4d8a; border-color: #3a63ad; }
.btn.primary:hover:not(:disabled) { background: #34599c; }
.btn.icon { width: 30px; padding: 5px 0; text-align: center; }
.btn.wide { width: 100%; }
.btn.play { width: 40px; }

.field { display: flex; align-items: center; gap: 8px; margin: 7px 0; }
.field > span { color: var(--muted); flex: 0 0 118px; }
.field input[type=text], .field input[type=number] {
  flex: 1 1 auto; min-width: 0;
  background: #101118; color: var(--text);
  border: 1px solid var(--line); border-radius: 5px;
  padding: 4px 7px; font: inherit;
}
.field input[type=range] { flex: 1 1 auto; min-width: 0; }
.name-field > span { flex: 0 0 auto; }
.name-field input { width: 190px; }

.check { display: flex; align-items: center; gap: 8px; margin: 12px 0 4px; }
.check input { width: 15px; height: 15px; }

/* ---- stage: timeline + detail panel ---------------------------------- */

#stage { flex: 1 1 auto; display: flex; min-height: 0; }

#timelineWrap { flex: 1 1 auto; display: flex; min-width: 0; }

#headers {
  flex: 0 0 var(--header-w);
  background: var(--panel);
  border-right: 1px solid var(--line);
  overflow: hidden;
}

.ruler-corner {
  height: var(--ruler-h);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: flex-end;
  padding-right: 9px;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.track-header {
  height: var(--lane-h);
  border-bottom: 1px solid var(--line);
  padding: 9px 11px;
  display: flex; flex-direction: column; justify-content: center; gap: 3px;
}
.track-header .swatch {
  width: 11px; height: 11px; border-radius: 3px; display: inline-block;
  margin-right: 7px; vertical-align: -1px;
}
.track-header .nm { font-weight: 600; text-transform: capitalize; }
.track-header .deg { color: var(--muted); font-size: 12px; }
.track-header .lvl {
  height: 3px; background: #2a2d38; border-radius: 2px; overflow: hidden;
  margin-top: 4px;
}
.track-header .lvl i { display: block; height: 100%; width: 0; background: var(--accent); }

#scroller { flex: 1 1 auto; overflow-x: auto; overflow-y: hidden; position: relative; }
#canvas { position: relative; height: 100%; min-width: 100%; }

#ruler {
  position: sticky; top: 0; z-index: 3;
  height: var(--ruler-h);
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.tick { position: absolute; top: 0; height: 100%; border-left: 1px solid var(--line); }
.tick span {
  position: absolute; left: 4px; top: 4px;
  color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.tick.minor { border-left-color: #262835; }

.lane {
  position: relative;
  height: var(--lane-h);
  border-bottom: 1px solid var(--line);
  background: #191a21;
}
.lane.drop-target { background: #202433; box-shadow: inset 0 0 0 2px var(--accent); }

/* ---- clips ----------------------------------------------------------- */

.clip {
  position: absolute; top: 6px; bottom: 6px;
  border-radius: 5px;
  overflow: hidden;
  cursor: grab;
  border: 1px solid rgba(255,255,255,.22);
  /* colour comes from the track, applied inline */
}
.clip.selected { border-color: #fff; box-shadow: 0 0 0 1px #fff; z-index: 2; }
.clip.dragging { cursor: grabbing; opacity: .85; }
.clip .env { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.clip .nm {
  position: absolute; left: 6px; top: 4px; right: 6px;
  font-size: 11px; font-weight: 600;
  color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.65);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  pointer-events: none;
}
.clip .badge {
  position: absolute; left: 6px; bottom: 4px;
  font-size: 10px; color: rgba(255,255,255,.85);
  text-shadow: 0 1px 2px rgba(0,0,0,.65);
  pointer-events: none;
}
.clip .handle {
  position: absolute; top: 0; bottom: 0; width: 7px;
  cursor: ew-resize; z-index: 2;
}
.clip .handle.l { left: 0; }
.clip .handle.r { right: 0; }
.clip .fade-grip {
  position: absolute; top: 0; width: 11px; height: 11px;
  cursor: ew-resize; z-index: 3;
}

#playhead {
  position: absolute; top: 0; bottom: 0; width: 1px;
  background: #ff5470; z-index: 5; pointer-events: none;
}
#playhead::before {
  content: ''; position: absolute; top: 0; left: -4px;
  border: 4px solid transparent; border-top-color: #ff5470;
}

/* ---- detail panel ---------------------------------------------------- */

#detail {
  flex: 0 0 var(--detail-w);
  background: var(--panel);
  border-left: 1px solid var(--line);
  padding: 12px 14px; overflow-y: auto;
}
#detail h3 {
  margin: 16px 0 8px; font-size: 12px; text-transform: uppercase;
  letter-spacing: .6px; color: var(--muted);
}
#detail h3:first-child { margin-top: 0; }
#detail hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
.detail-empty p { color: var(--muted); }
.hint { color: var(--muted); font-size: 12px; margin: 6px 0; }
.meta {
  background: #101118; border: 1px solid var(--line); border-radius: 5px;
  padding: 7px 9px; font-size: 12px; color: var(--muted);
  margin-bottom: 12px; word-break: break-all;
}
.meta b { color: var(--text); font-weight: 600; }
.row { margin-top: 9px; }

/* ---- transport ------------------------------------------------------- */

#transport {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 14px;
  padding: 8px 12px;
  background: var(--panel); border-top: 1px solid var(--line);
}
.readout { font-variant-numeric: tabular-nums; color: var(--muted); }
.compass-preview { display: flex; align-items: center; gap: 12px; }
.compass-preview label { display: flex; align-items: center; gap: 8px; }
.compass-preview input[type=range] { width: 190px; }
.compass-preview b { font-variant-numeric: tabular-nums; }
.mix { display: flex; gap: 4px; }
.mix i {
  display: block; width: 26px; height: 9px; border-radius: 2px;
  background: #2a2d38; position: relative; overflow: hidden;
}
.mix i em { position: absolute; inset: 0; width: 0; display: block; }
.status { color: var(--muted); font-size: 12px; }
.status.err { color: var(--danger); }
.status.ok { color: #5ed09a; }

/* ---- modal ----------------------------------------------------------- */

.modal {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(0,0,0,.6);
  display: flex; align-items: center; justify-content: center;
}
.modal[hidden] { display: none; }
.modal-box {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 9px; padding: 18px 20px;
  width: 460px; max-width: calc(100vw - 40px);
  max-height: calc(100vh - 80px); overflow-y: auto;
}
.modal-box h2 { margin: 0 0 12px; font-size: 16px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.modal-box .log {
  background: #101118; border: 1px solid var(--line); border-radius: 5px;
  padding: 8px 10px; font-family: ui-monospace, Menlo, monospace;
  font-size: 11.5px; max-height: 210px; overflow-y: auto; white-space: pre-wrap;
}
[hidden] { display: none !important; }
