:root {
  --bg: #0f1216; --panel: #181d23; --panel2: #222932; --line: #2c343e;
  --ink: #eef2f5; --mute: #9aa6b2; --acc: #4fb3ff; --acc2: #7ee0b0; --warn: #ffb35c;
  --tab-h: 68px; --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f3f5f7; --panel: #ffffff; --panel2: #e9edf1; --line: #d5dce3;
    --ink: #11161b; --mute: #5c6875; --acc: #0a74c9; --acc2: #1a9a63; --warn: #b86a00;
    color-scheme: light;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); }
body { font: 17px/1.35 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; overscroll-behavior: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; touch-action: manipulation; }
input { font: inherit; color: inherit; }
h2 { margin: 6px 0 4px; font-size: 24px; }
h3 { margin: 0 0 6px; font-size: 18px; }
.hint { color: var(--mute); font-size: 14px; margin: 4px 0 10px; }

.app { max-width: 560px; margin: 0 auto; min-height: 100%; }
.view { padding: calc(env(safe-area-inset-top, 0px) + 12px) 16px calc(var(--tab-h) + var(--safe-b) + 16px); }

/* ---------- Sonando ---------- */
#v-sonando { display: flex; flex-direction: column; gap: 10px; }
#v-sonando[hidden] { display: none !important; }
.art { position: relative; aspect-ratio: 1; width: min(100%, 22vh); margin: 0 auto; border-radius: 22px;
  background: linear-gradient(145deg, #243b55, #141e30); display: grid; place-items: center; overflow: hidden; touch-action: pan-y; user-select: none; }
.art-emoji { font-size: 96px; }
.art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.now { text-align: center; min-height: 56px; }
.now-title { font-size: 24px; font-weight: 750; line-height: 1.2; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.now-sub { color: var(--mute); font-size: 17px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seek { height: 28px; position: relative; cursor: pointer; }
.seek::before { content: ""; position: absolute; left: 0; right: 0; top: 11px; height: 6px; border-radius: 3px; background: var(--panel2); }
.seek-fill { position: absolute; left: 0; top: 11px; height: 6px; border-radius: 3px; background: var(--acc); width: 0; }
.times { display: flex; justify-content: space-between; color: var(--mute); font-size: 14px; margin-top: -10px; font-variant-numeric: tabular-nums; }
.controls { display: flex; justify-content: center; align-items: center; gap: 22px; }
.ctl { width: 80px; height: 80px; border-radius: 50%; background: var(--panel2); font-size: 34px; display: grid; place-items: center; }
.ctl-big { width: 100px; height: 100px; background: var(--acc); color: #04121f; font-size: 46px; }
.ctl:active { transform: scale(.94); }

.mixer { background: var(--panel); border-radius: 20px; padding: 10px 12px; display: grid; gap: 6px; }
.ch { display: grid; gap: 2px; }
.ch-name { text-align: left; font-weight: 700; font-size: 17px; padding: 6px 2px; display: flex; gap: 6px; align-items: center; }
.pill { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: var(--panel2); color: var(--mute); margin-left: auto; }
.pill.on { background: var(--acc2); color: #062616; }
.vol { display: grid; grid-template-columns: 56px 1fr 56px; align-items: center; gap: 8px; }
.pm { height: 52px; border-radius: 14px; background: var(--panel2); font-size: 30px; font-weight: 700; }
.pm:active { background: var(--line); }

input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 52px; background: transparent; margin: 0; }
input[type=range]::-webkit-slider-runnable-track { height: 14px; border-radius: 7px; background: linear-gradient(to right, var(--acc) var(--p, 50%), var(--panel2) var(--p, 50%)); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 38px; height: 38px; margin-top: -12px; border-radius: 50%; background: #fff; box-shadow: 0 1px 6px #0007; }
input[type=range]::-moz-range-track { height: 14px; border-radius: 7px; background: var(--panel2); }
input[type=range]::-moz-range-progress { height: 14px; border-radius: 7px; background: var(--acc); }
input[type=range]::-moz-range-thumb { width: 38px; height: 38px; border-radius: 50%; background: #fff; border: 0; }
#volAmb::-webkit-slider-runnable-track { background: linear-gradient(to right, var(--acc2) var(--p, 50%), var(--panel2) var(--p, 50%)); }

.mic-big { width: 100%; min-height: 68px; border-radius: 20px; background: var(--panel2); font-size: 22px; font-weight: 700; border: 2px solid var(--line); }
.mic-big:active { background: var(--line); }

/* ---------- Pestañas ---------- */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; height: calc(var(--tab-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  background: var(--panel); border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(4, 1fr); z-index: 5; }
.tabs button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 13px; color: var(--mute); font-weight: 600; }
.tabs button i { font-style: normal; font-size: 24px; }
.tabs button.on { color: var(--acc); }

/* ---------- Música ---------- */
.bar { position: sticky; top: 0; background: var(--bg); padding: 4px 0 10px; z-index: 3; display: grid; gap: 10px; }
.search { display: flex; gap: 8px; }
.search input { flex: 1; min-width: 0; height: 54px; border-radius: 14px; border: 1px solid var(--line); background: var(--panel); padding: 0 14px; font-size: 18px; }
.icon-btn { width: 54px; height: 54px; border-radius: 14px; background: var(--panel2); font-size: 24px; flex: none; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--panel); border-radius: 14px; padding: 4px; }
.seg button { height: 44px; border-radius: 10px; font-weight: 700; color: var(--mute); }
.seg button.on { background: var(--panel2); color: var(--ink); }
.lista { display: grid; gap: 4px; }
.item { display: grid; grid-template-columns: 56px 1fr auto; gap: 12px; align-items: center; padding: 8px; border-radius: 14px; background: var(--panel); min-height: 72px; text-align: left; width: 100%; }
.item.playing { outline: 2px solid var(--acc); }
.thumb { width: 56px; height: 56px; border-radius: 10px; background: var(--panel2); display: grid; place-items: center; font-size: 26px; overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.it-t { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.it-s { color: var(--mute); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.it-main { min-width: 0; }
.more { width: 48px; height: 48px; border-radius: 12px; font-size: 22px; color: var(--mute); }
.sec { color: var(--mute); font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; margin: 14px 4px 4px; }
.empty { text-align: center; color: var(--mute); padding: 30px 10px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 54px; padding: 0 18px; border-radius: 14px; background: var(--acc); color: #04121f; font-weight: 750; cursor: pointer; }
.btn-soft { background: var(--panel2); color: var(--ink); }
.btn-wide { width: 100%; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0 10px; }
.bar-prog { height: 4px; background: var(--panel2); border-radius: 2px; margin-top: 6px; overflow: hidden; }
.bar-prog > div { height: 100%; background: var(--acc); width: 0; transition: width .3s; }

/* ---------- Fondos ---------- */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 10px 0 16px; align-items: start; }
.tile { background: var(--panel); border-radius: 18px; padding: 14px 12px 10px; text-align: left; border: 2px solid transparent; display: grid; gap: 4px; }
.tile .e { font-size: 34px; }
.tiles-sec { grid-column: 1 / -1; margin: 6px 4px 0; }
.tile .n { font-weight: 700; }
.tile .s { font-size: 13px; color: var(--mute); }
.tile.on { border-color: var(--acc2); background: color-mix(in srgb, var(--acc2) 12%, var(--panel)); }
.tile input[type=range] { height: 44px; }
.row-switch { display: flex; gap: 12px; align-items: flex-start; padding: 10px 2px; }
.row-switch input { width: 26px; height: 26px; flex: none; accent-color: var(--acc); margin-top: 2px; }
.row-switch small { color: var(--mute); }

/* ---------- Más ---------- */
.card { background: var(--panel); border-radius: 18px; padding: 14px; margin: 12px 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips button { min-height: 48px; padding: 0 16px; border-radius: 12px; background: var(--panel2); font-weight: 700; }
.chips button.on { background: var(--acc); color: #04121f; }
.help { font-size: 15px; }
.help p { margin: 6px 0; }
.help ol { padding-left: 20px; margin: 6px 0; }

/* ---------- Escucha y avisos ---------- */
.listen { position: fixed; inset: 0; background: #000c; display: grid; place-items: center; z-index: 20; padding: 16px; }
.listen-box { text-align: center; display: grid; gap: 14px; justify-items: center; max-width: 420px; }
.listen-dot { width: 110px; height: 110px; border-radius: 50%; background: #ff4f6d; animation: pulse 1.2s infinite; }
.listen-text { font-size: 26px; font-weight: 750; color: #fff; }
.listen .hint { color: #c9d1d9; }
@keyframes pulse { 0%,100% { transform: scale(.85); opacity: .75 } 50% { transform: scale(1); opacity: 1 } }
.toast { position: fixed; left: 16px; right: 16px; bottom: calc(var(--tab-h) + var(--safe-b) + 12px); max-width: 528px; margin: 0 auto;
  background: var(--ink); color: var(--bg); border-radius: 14px; padding: 14px 16px; font-weight: 650; z-index: 30; box-shadow: 0 6px 24px #0008; }

@media (max-height: 700px) {
  .art { width: min(100%, 16vh); }
  .art-emoji { font-size: 56px; }
  .ctl { width: 72px; height: 72px; font-size: 28px; }
  .ctl-big { width: 92px; height: 92px; font-size: 40px; }
  .art-emoji { font-size: 70px; }
}

/* ---------- Listas y modos ---------- */
.seg { grid-template-columns: repeat(4, 1fr); }
.seg button { font-size: 15px; padding: 0 2px; }
.mark { width: 48px; text-align: center; font-size: 22px; color: var(--mute); }
.list-head { display: flex; align-items: baseline; gap: 10px; margin: 10px 2px 0; }
.list-head h2 { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.times { align-items: center; }
.modes { display: flex; gap: 6px; }
.mode { height: 36px; padding: 0 12px; border-radius: 99px; background: var(--panel2); color: var(--mute); font-size: 14px; font-weight: 700; }
.mode.on { background: var(--acc); color: #04121f; }
.sheet-list { display: grid; gap: 10px; width: 100%; max-height: 55vh; overflow-y: auto; }
.connect { display: grid; gap: 6px; text-align: center; }
.connect-btn { min-height: 76px; font-size: 21px; }
.item.off { opacity: .45; }
.banner { background: var(--panel); border: 2px solid var(--acc); border-radius: 16px; padding: 12px; margin: 0 0 10px; display: grid; gap: 8px; }
/* Ordenar canciones (Recientes / Nombre / Autor / Tamaño) */
.seg.orden { margin: 0 0 10px; }
.seg.orden button { height: 36px; font-size: 14px; }
.btn-danger { background: #c62828; color: #fff; }
.btn:disabled { opacity: .45; }
.actions.marcando { position: sticky; top: 0; z-index: 5; background: var(--bg); padding: 6px 0; }
#lista .item { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
/* Pestañas «Todas · En este iPhone · En el servidor» */
.seg.donde { grid-template-columns: repeat(3, 1fr); margin: 0 0 8px; }
.seg.donde button { height: auto; min-height: 48px; padding: 4px 2px; line-height: 1.15; font-size: 14px; }
.seg.donde small { display: block; font-weight: 500; font-size: 12px; opacity: .8; }

/* ---------- Ecualizador experto ---------- */
.eq-panel { position: fixed; inset: 0; z-index: 25; background: var(--bg); overflow-y: auto; padding: calc(env(safe-area-inset-top, 0px) + 10px) 14px calc(var(--safe-b) + 24px); max-width: 560px; margin: 0 auto; }
.eq-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.eq-head b { font-size: 22px; flex: 1; }
.eq-sw { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.eq-sw input { width: 26px; height: 26px; accent-color: var(--acc2); }
.eq-cv { width: 100%; height: 170px; background: var(--panel); border-radius: 16px; display: block; }
.eq-leg { display: flex; align-items: center; gap: 8px; color: var(--mute); font-size: 12px; margin: 4px 4px 8px; }
.eq-leg .lg-sp { flex: 1; }
.eq-presets { margin-bottom: 10px; }
.eq-presets button { min-height: 40px; padding: 0 12px; font-size: 14px; }
.eq-presets [data-del] { margin-left: 6px; opacity: .6; }
.eq-tabs { grid-template-columns: 1fr 1fr; margin-bottom: 10px; }
.eq-tabs button.on { background: var(--panel2); color: var(--ink); }
.eqv-row { display: grid; grid-template-columns: repeat(10, 1fr); gap: 2px; background: var(--panel); border-radius: 16px; padding: 10px 4px; }
.eqv { display: grid; justify-items: center; gap: 4px; }
.eqv-g { font-size: 11px; font-variant-numeric: tabular-nums; color: var(--mute); height: 14px; }
.eqv small { color: var(--mute); font-size: 11px; }
.eqv-track { position: relative; width: 100%; height: 210px; touch-action: none; cursor: pointer; }
.eqv-track::before { content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: 6px; margin-left: -3px; border-radius: 3px; background: var(--panel2); }
.eqv-track::after { content: ""; position: absolute; left: 20%; right: 20%; top: 50%; height: 1px; background: var(--mute); opacity: .6; }
.eqv-fill { position: absolute; left: 50%; width: 6px; margin-left: -3px; border-radius: 3px; background: var(--acc); }
.eqv-knob { position: absolute; left: 50%; width: 26px; height: 26px; margin: -13px 0 0 -13px; border-radius: 50%; background: #fff; box-shadow: 0 1px 6px #0007; }
.eqb { margin: 0 0 10px; }
.eqb-h { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 4px; }
.eqb-h select { height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel2); color: var(--ink); padding: 0 8px; font: inherit; }
.eq-r { display: block; }
.eq-r > span { display: flex; justify-content: space-between; color: var(--mute); font-size: 14px; }
.eq-r b { color: var(--ink); font-variant-numeric: tabular-nums; }
.eqr { height: 40px; }
.eqr::-webkit-slider-thumb { width: 28px; height: 28px; margin-top: -7px; }
.eqr::-webkit-slider-runnable-track { height: 14px; }
.eq-glob { margin-top: 12px; }
