:root {
  --bg: #121316;
  --panel: #1a1c20;
  --line: #2a2d33;
  --text: #e6e6e6;
  --muted: #8b9099;
  --accent: #f08a24;
  --hover: #23262c;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

body {
  display: grid;
  grid-template-columns: 340px 1fr;
  overflow: hidden;
}

#side {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--panel);
  border-right: 1px solid var(--line);
}

#side h1 { margin: 0; padding: 14px 16px 10px; font-size: 15px; font-weight: 600; }

#search {
  margin: 4px 16px 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
}
#search:focus { outline: 2px solid var(--accent); outline-offset: -1px; }


#tree { flex: 1; min-height: 0; overflow: auto; font-size: 13px; }
#tree .space { position: relative; margin: 6px 0 24px; }
#tree .folder, #tree .clip {
  position: absolute; left: 0; right: 0; height: var(--row);
  display: block; width: 100%; border: 0; border-radius: 0; background: none; text-align: left; font: inherit;
  cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: var(--row);
}
#tree .clip:has(small) { line-height: 1.35; padding-top: 4px; }
#tree .folder { padding: 0 16px 0 calc(16px + var(--depth, 0) * 14px); color: #cfd2d8; }
#tree .folder::before { content: "▸"; display: inline-block; width: 14px; color: var(--muted); }
#tree .folder.open::before { content: "▾"; }
#tree .clip { padding: 0 16px 0 calc(30px + var(--depth, 0) * 14px); color: var(--text); }
#tree .folder:hover, #tree .clip:hover { background: var(--hover); }
#tree .clip small { display: block; margin-top: -2px; color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; }
#tree .clip.on { background: #3a2a18; color: #fff; box-shadow: inset 3px 0 var(--accent); }
#tree .folder:focus-visible, #tree .clip:focus-visible { outline-offset: -2px; }

#stage { position: relative; min-width: 0; min-height: 0; }
#view { display: block; width: 100%; height: 100%; }

#info {
  position: absolute; top: 12px; left: 12px; max-width: min(560px, calc(100% - 24px));
  padding: 10px 12px; border-radius: 8px; background: rgba(18, 19, 22, .82); border: 1px solid var(--line);
}
#info h2 { margin: 0 0 6px; font-size: 15px; }
#copy {
  display: block; max-width: 100%; padding: 3px 6px; text-align: left; word-break: break-all;
  font: 12px/1.4 ui-monospace, Consolas, monospace; color: var(--muted);
}
#copy:hover { color: var(--text); }
#chain { margin-top: 6px; border-color: var(--accent); color: #fff; }

button, select {
  padding: 4px 10px; border: 1px solid var(--line); border-radius: 6px;
  background: var(--panel); color: var(--text); font: inherit; font-size: 13px; cursor: pointer;
}
button:hover, select:hover { border-color: #4a4f58; }
button:focus-visible, select:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

#status {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); margin: 0;
  color: var(--muted); pointer-events: none; text-align: center; max-width: 80%;
}

#transport {
  position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 12px; background: rgba(18, 19, 22, .9); border-top: 1px solid var(--line);
}
#transport #play { width: 40px; }
#scrub { flex: 1; min-width: 120px; accent-color: var(--accent); }
#time { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 12px; min-width: 70px; }
#transport label { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 12px; cursor: pointer; }
#transport input[type=checkbox] { accent-color: var(--accent); }

@media (max-width: 760px) {
  body { grid-template-columns: minmax(0, 1fr); grid-template-rows: 42vh minmax(0, 1fr); }
  #side { min-width: 0; border-right: 0; border-bottom: 1px solid var(--line); }
  #search { min-width: 0; }
  #scrub { flex-basis: 100%; order: 10; }
  #time { min-width: 0; }
}
