:root {
  --bg: #f4f4f2;
  --card: #ffffff;
  --text: #1c1b1a;
  --muted: #6b6864;
  --line: #e2e0dc;
  --accent: #0f766e;
  --accent-ink: #ffffff;
  --mute: #b45309;
  --solo: #1d4ed8;
  --led: #10b981;
  --track: #d6d3ce;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121211;
    --card: #1c1c1a;
    --text: #efeeeb;
    --muted: #9b9893;
    --line: #2d2c2a;
    --accent: #14b8a6;
    --accent-ink: #042f2b;
    --mute: #f59e0b;
    --solo: #60a5fa;
    --led: #34d399;
    --track: #3a3936;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.35 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
  padding-bottom: env(safe-area-inset-bottom);
}
button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; }
button:disabled { opacity: .45; cursor: default; }

.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.topbar h1 { font-size: 1.1rem; margin: 0; flex: 1; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 0 16px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--card); font-weight: 600;
  cursor: pointer; user-select: none;
}
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.ghost { background: transparent; }
.btn.small { min-height: 36px; padding: 0 12px; font-size: .9rem; }

main { max-width: 720px; margin: 0 auto; padding: 16px; }

.drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  min-height: 55vh; border: 2px dashed var(--line); border-radius: 20px;
  text-align: center; color: var(--muted); cursor: pointer; padding: 24px;
}
.drop svg { width: 56px; height: 56px; fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.drop strong { color: var(--text); font-size: 1.1rem; }
body.dragging .drop { border-color: var(--accent); }

.song { margin-bottom: 12px; }
.title { font-size: 1.2rem; font-weight: 700; overflow-wrap: anywhere; }
.status { color: var(--muted); font-size: .9rem; min-height: 1.3em; }

.transport { display: flex; align-items: center; gap: 14px; }
.play {
  flex: none; width: 64px; height: 64px; border-radius: 50%; border: 0;
  background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center;
}
.play svg { width: 30px; height: 30px; fill: currentColor; }
.play .i-pause, .play.on .i-play { display: none; }
.play.on .i-pause { display: block; }
.seek { flex: 1; min-width: 0; }
.times { display: flex; justify-content: space-between; color: var(--muted); font-size: .85rem; font-variant-numeric: tabular-nums; }

input[type=range] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 32px; background: transparent; margin: 0;
  touch-action: pan-y;
}
input[type=range]::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: var(--track); }
input[type=range]::-moz-range-track { height: 6px; border-radius: 3px; background: var(--track); }
input[type=range]::-moz-range-progress { height: 6px; border-radius: 3px; background: var(--accent); }
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 24px; height: 24px; margin-top: -9px; border-radius: 50%;
  background: var(--accent); border: 3px solid var(--card); box-shadow: 0 1px 3px rgba(0,0,0,.3);
}
input[type=range]::-moz-range-thumb {
  width: 18px; height: 18px; border-radius: 50%; background: var(--accent); border: 3px solid var(--card);
}

.globals {
  display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: flex-end;
  margin: 16px 0 8px; padding: 12px 14px; background: var(--card); border: 1px solid var(--line); border-radius: 16px;
}
.ctl { display: flex; flex-direction: column; gap: 4px; }
.ctl.grow { flex: 1; min-width: 160px; }
.lbl { font-size: .85rem; color: var(--muted); display: flex; justify-content: space-between; }
.lbl output { font-variant-numeric: tabular-nums; }

.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.stepper button { width: 48px; height: 44px; border: 0; background: transparent; font-size: 1.4rem; line-height: 1; }
.stepper button:active { background: var(--line); }
.stepper output { min-width: 40px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.stepper.sm button { width: 40px; height: 40px; font-size: 1.2rem; }
.stepper.sm output { min-width: 30px; }
.stepper.off { visibility: hidden; }
.stepper.wide output { min-width: 58px; }
#bpm { margin-left: 8px; }

.chhead { display: flex; align-items: center; justify-content: space-between; margin: 18px 0 8px; }
.chhead h2 { font-size: 1rem; margin: 0; }

.channels { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.ch { min-width: 0; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 10px 12px; }
.ch.silent .names, .ch.silent .row2 { opacity: .45; }
.row1 { display: flex; align-items: center; gap: 10px; }
.led { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--track); transition: background .08s; }
.led.on { background: var(--led); box-shadow: 0 0 8px var(--led); }
.names { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inst { color: var(--muted); font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tog {
  flex: none; width: 44px; height: 40px; border-radius: 10px; border: 1px solid var(--line);
  background: transparent; font-weight: 800;
}
.tog.mute.on { background: var(--mute); border-color: var(--mute); color: #fff; }
.tog.solo.on { background: var(--solo); border-color: var(--solo); color: #fff; }
.row2 { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.row2 .vol { flex: 1; min-width: 0; }
.volv { width: 44px; text-align: right; color: var(--muted); font-size: .85rem; font-variant-numeric: tabular-nums; }
.row3 { display: flex; align-items: center; gap: 10px; margin-top: 2px; }
.row3[hidden] { display: none; }
.row3 .sub { font-size: .85rem; color: var(--muted); width: 72px; }
.row3 .cym { flex: 1; min-width: 0; }
.row3 output { width: 44px; text-align: right; color: var(--muted); font-size: .85rem; font-variant-numeric: tabular-nums; }
.ch.silent .row3 { opacity: .45; }

.search {
  width: 100%; min-height: 48px; padding: 0 14px; margin-bottom: 12px;
  border: 1px solid var(--line); border-radius: 14px; background: var(--card); color: var(--text); font: inherit;
}
.search:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.songs { list-style: none; margin: 0; padding: 0; background: var(--card); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.songs li + li { border-top: 1px solid var(--line); }
.songs button {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 60px; padding: 8px 14px;
  border: 0; background: transparent; text-align: left;
}
.songs button:active { background: var(--line); }
.songs .ic {
  flex: none; width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center;
  background: color-mix(in srgb, var(--accent) 15%, transparent); color: var(--accent);
}
.songs .ic svg { width: 18px; height: 18px; fill: currentColor; }
.songs .current .ic { background: var(--accent); color: var(--accent-ink); }
.songs .txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.songs .t { font-weight: 600; overflow-wrap: anywhere; }
.songs .a { color: var(--muted); font-size: .85rem; }
.nomatch { color: var(--muted); text-align: center; }
.library { padding-bottom: 72px; }

.now {
  position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 6;
  max-width: 696px; margin: 0 auto;
  display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 8px 16px;
  border: 0; border-radius: 16px; background: var(--accent); color: var(--accent-ink); text-align: left;
  box-shadow: 0 6px 20px rgba(0,0,0,.25);
}
.now[hidden] { display: none; }
.now-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.now-lbl { font-size: .75rem; opacity: .8; }
.now-title { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.now-go { font-weight: 700; }

/* Tono y Tiempo en la misma fila aun en celulares angostos */
.globals { gap: 12px 14px; }
.globals .stepper button { width: 44px; }
.topbar h1 { white-space: nowrap; }
@media (max-width: 400px) {
  .topbar { gap: 8px; }
  .topbar .btn { padding: 0 12px; }
}
