:root {
  color-scheme: dark;
  --bg: #15171a;
  --panel: #1d2024;
  --raised: #272b30;
  --line: #3a3f46;
  --text: #eceef0;
  --muted: #a2a9b1;
  --accent: #6fcf73;
  --accent-ink: #0f2a11;
  --warn: #f2b84b;
  --danger: #ef7d73;
  --mono: ui-monospace, "Cascadia Code", Consolas, monospace;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); font: 15px/1.45 system-ui, "Segoe UI", sans-serif; }
h1, h2, h3, p { margin: 0; }
h2 { font-size: 17px; overflow-wrap: anywhere; }
h3 { font-size: 13px; color: var(--muted); font-weight: 600; }
label { display: grid; gap: 4px; color: var(--muted); font-size: 13px; }
input, select, button { font: inherit; color: var(--text); }
input:not([type=range]):not([type=checkbox]), select {
  width: 100%; min-height: 36px; padding: 6px 9px; background: var(--raised);
  border: 1px solid var(--line); border-radius: 6px;
}
input[type=range] { width: 100%; accent-color: var(--accent); }
button {
  min-height: 36px; padding: 6px 12px; background: var(--raised); border: 1px solid var(--line);
  border-radius: 6px; cursor: pointer;
}
button:hover:not(:disabled) { border-color: var(--muted); }
button:disabled { opacity: .5; cursor: default; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
button.danger { color: var(--danger); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.error { color: var(--danger); min-height: 1.4em; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: 13px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.login {
  width: min(360px, calc(100vw - 32px)); margin: 14vh auto 0; display: grid; gap: 14px;
  padding: 24px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
}
.login h1 { font-size: 24px; }

.app {
  height: 100vh; display: grid; grid-template: 56px minmax(0, 1fr) / 230px minmax(280px, 1fr) minmax(360px, 460px);
  grid-template-areas: "top top top" "filters list editor";
}
.top {
  grid-area: top; display: flex; align-items: center; gap: 16px; padding: 0 16px;
  background: var(--panel); border-bottom: 1px solid var(--line);
}
.logo { font-size: 17px; color: var(--accent); }
.room { color: var(--muted); white-space: nowrap; }
.master { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.master input { width: 110px; }
.presence { flex: 1; min-width: 0; display: flex; gap: 8px; overflow-x: auto; }
.person {
  display: flex; gap: 6px; align-items: center; min-height: 32px; padding: 3px 10px; white-space: nowrap;
  background: var(--raised); border: 1px solid var(--line); border-radius: 16px; font-size: 13px;
}
.person i { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.person.recording i { background: var(--danger); }

.filters {
  grid-area: filters; padding: 14px; display: flex; flex-direction: column; gap: 12px; overflow-y: auto;
  border-right: 1px solid var(--line);
}
#tiers { display: grid; gap: 4px; }
.tier {
  display: grid; gap: 5px; width: 100%; padding: 8px 9px; text-align: left; background: none; border-color: transparent;
}
.tier.active { background: var(--raised); border-color: var(--line); }
.tier span { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.bar { height: 5px; background: var(--raised); border-radius: 3px; overflow: hidden; }
.tier.active .bar { background: var(--bg); }
.bar b { display: block; height: 100%; background: var(--accent); }

.list { grid-area: list; overflow-y: auto; }
.sound {
  display: grid; grid-template-columns: 12px minmax(0, 1fr) auto; gap: 10px; align-items: center; width: 100%;
  min-height: 42px; padding: 6px 14px; background: none; border: 0; border-bottom: 1px solid var(--raised);
  border-radius: 0; text-align: left;
}
.sound:hover { background: var(--panel); }
.sound.active { background: var(--raised); }
.sound .dot { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--line); }
.sound.done .dot { background: var(--accent); border-color: var(--accent); }
.sound .name { font-family: var(--mono); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sound .meta { font-size: 12px; color: var(--muted); white-space: nowrap; }
.sound .live { color: var(--warn); }

.editor { grid-area: editor; overflow-y: auto; padding: 16px; border-left: 1px solid var(--line); display: grid; gap: 16px; align-content: start; }
.card { display: grid; gap: 10px; padding: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
.banner { padding: 8px 10px; color: var(--warn); border: 1px solid var(--warn); border-radius: 6px; font-size: 13px; }
.take { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 8px; align-items: center; font-size: 13px; }
.take small { display: block; color: var(--muted); }
.wave { width: 100%; height: 96px; display: block; background: var(--bg); border-radius: 6px; }
.wave-wrap { position: relative; cursor: ew-resize; touch-action: none; user-select: none; }
.handle {
  position: absolute; top: 0; bottom: 0; width: 24px; margin-left: -12px; display: flex; justify-content: center;
  border-radius: 4px;
}
.handle::before { content: ""; width: 3px; height: 100%; background: var(--text); border-radius: 2px; }
.handle::after {
  content: ""; position: absolute; top: 50%; width: 12px; height: 24px; margin-top: -12px;
  background: var(--text); border-radius: 3px;
}
.level { height: 6px; background: var(--bg); border-radius: 3px; overflow: hidden; }
.level b { display: block; height: 100%; width: 0; background: var(--accent); }
.sliders { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.sliders output { float: right; color: var(--text); }
.check { display: flex; flex-direction: row; gap: 7px; align-items: center; }
.empty { padding: 32px 16px; text-align: center; color: var(--muted); }

.pack-dialog {
  width: min(520px, calc(100vw - 32px)); padding: 20px; color: var(--text); background: var(--panel);
  border: 1px solid var(--line); border-radius: 10px;
}
.pack-dialog[open] { display: grid; gap: 12px; }
.pack-dialog::backdrop { background: rgb(0 0 0 / .6); }
.history { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; font-size: 13px; }
.history li { overflow-wrap: anywhere; }

@media (max-width: 960px) {
  .app { height: auto; min-height: 100vh; grid-template: 56px auto minmax(240px, 40vh) auto / minmax(0, 1fr); grid-template-areas: "top" "filters" "list" "editor"; }
  .filters { border-right: 0; border-bottom: 1px solid var(--line); }
  .editor { border-left: 0; border-top: 1px solid var(--line); }
  .sliders { grid-template-columns: 1fr; }
  .top { gap: 8px; padding: 0 10px; }
  .master { font-size: 0; }
  .logo { display: none; }
  .master input { width: 70px; }
}

.weight { display: flex; align-items: center; gap: 6px; font-size: 12px; white-space: nowrap; }
.weight input { width: 56px; }
