:root {
  --bg: #0b0b0d; --panel: #16161a; --panel2: #1e1e24; --line: #2a2a31;
  --txt: #f3f3f5; --dim: #9a9aa6; --acc: #1ed760; --acc2: #a78bfa; --err: #ff6b6b;
  --r: 14px; --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; background: var(--bg); color: var(--txt); overscroll-behavior: none;
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif; }
button, input, textarea, select { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
a { color: var(--acc); }
.boot { text-align: center; margin-top: 40vh; color: var(--dim); }

/* ---------- estructura: una sola columna, nada se superpone ---------- */
#app { display: flex; flex-direction: column; height: 100vh; height: 100dvh; max-width: 960px; margin: 0 auto; position: relative; }
.top { display: flex; align-items: center; gap: 10px; padding: calc(var(--safe-t) + 10px) 14px 10px; border-bottom: 1px solid var(--line); flex: none; }
.top .back { width: 44px; height: 44px; border-radius: 22px; display: flex; align-items: center; justify-content: center; }
.top h1 { font-size: 20px; margin: 0; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .ico { width: 44px; height: 44px; border-radius: 22px; display: flex; align-items: center; justify-content: center; background: var(--panel); }
main { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 14px 14px 24px; }
.mini { flex: none; display: flex; align-items: center; gap: 12px; margin: 0 10px 6px; padding: 8px 10px; background: var(--panel2); border-radius: var(--r); border: 1px solid var(--line); }
.mini .info { flex: 1; min-width: 0; text-align: left; }
.mini .bar { position: absolute; left: 12px; right: 12px; bottom: 0; height: 2px; background: var(--line); border-radius: 2px; overflow: hidden; }
.mini { position: relative; }
.mini .bar i { display: block; height: 100%; width: 0; background: var(--acc); }
nav.tabs { flex: none; display: flex; border-top: 1px solid var(--line); background: var(--bg); padding-bottom: var(--safe-b); }
nav.tabs button { flex: 1; min-height: 56px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 11px; color: var(--dim); }
nav.tabs button.on { color: var(--acc); }
svg { width: 24px; height: 24px; fill: currentColor; flex: none; }
svg.s { width: 20px; height: 20px; }

/* ---------- texto y tarjetas ---------- */
h2 { font-size: 18px; margin: 22px 0 10px; }
h2:first-child { margin-top: 4px; }
.t1 { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t2 { color: var(--dim); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dim { color: var(--dim); font-size: 14px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; }
.card + .card { margin-top: 12px; }
.err { background: rgba(255, 107, 107, .12); border: 1px solid rgba(255, 107, 107, .4); color: #ffb3b3; border-radius: var(--r); padding: 12px; font-size: 14px; margin: 8px 0; }
.empty { color: var(--dim); text-align: center; padding: 22px 8px; font-size: 14px; }
.rail { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 6px; -webkit-overflow-scrolling: touch; scroll-snap-type: x proximity; }
.item { width: 132px; flex: none; text-align: left; scroll-snap-align: start; }
.item .cov { width: 132px; height: 132px; }
.item.round .cov { border-radius: 50%; }
.cov { background: var(--panel2) center/cover no-repeat; border-radius: 10px; flex: none; }
.cov.sm { width: 46px; height: 46px; border-radius: 8px; }
.cov.lg { width: 100%; max-width: 360px; aspect-ratio: 1; margin: 0 auto; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.grid .item { width: auto; }
.grid .item .cov { width: 100%; height: auto; aspect-ratio: 1; }

/* ---------- filas de canciones ---------- */
.row { display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 6px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.row .meta { flex: 1; min-width: 0; text-align: left; cursor: pointer; }
.row .idx { width: 22px; text-align: right; color: var(--dim); font-size: 13px; flex: none; }
.row.on .t1 { color: var(--acc); }
.row.off { opacity: .55; }
.ib { width: 44px; height: 44px; border-radius: 22px; display: flex; align-items: center; justify-content: center; color: var(--dim); flex: none; }
.ib:active { background: var(--panel2); }
.ib.on { color: var(--acc); }
.ib.big { width: 56px; height: 56px; border-radius: 28px; }
.play { background: var(--txt); color: #000; }
.play svg { width: 28px; height: 28px; }

/* ---------- controles ---------- */
.btn { min-height: 44px; padding: 0 18px; border-radius: 22px; background: var(--panel2); border: 1px solid var(--line); font-weight: 600; font-size: 15px; display: inline-flex; align-items: center; gap: 8px; justify-content: center; }
.btn.pri { background: var(--acc); color: #000; border-color: var(--acc); }
.btn.vio { background: var(--acc2); color: #14102b; border-color: var(--acc2); }
.btn[disabled] { opacity: .5; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.chip { min-height: 38px; padding: 0 14px; border-radius: 19px; background: var(--panel2); border: 1px solid var(--line); font-size: 14px; }
input[type=text], input[type=password], input[type=search], textarea { width: 100%; min-height: 46px; padding: 10px 14px; background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; outline: none; font-size: 16px; }
input:focus, textarea:focus { border-color: var(--acc2); }
input[type=range] { width: 100%; accent-color: var(--acc); height: 32px; }
.sp { height: 10px; }
.hanna { border-color: rgba(167, 139, 250, .45); background: linear-gradient(180deg, rgba(167, 139, 250, .10), var(--panel)); }
.hanna .why { color: #cfc3ff; font-size: 13px; }
.badge { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 10px; background: var(--panel2); color: var(--dim); }
.badge.ok { background: rgba(30, 215, 96, .15); color: var(--acc); }
.text { white-space: pre-wrap; font-size: 15px; line-height: 1.5; }

/* ---------- hojas (pantalla completa del reproductor, dispositivos, ajustes) ---------- */
.shade { position: fixed; inset: 0; background: rgba(0, 0, 0, .6); z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: 960px; max-height: 92vh; max-height: 92dvh; overflow-y: auto; -webkit-overflow-scrolling: touch; background: var(--panel); border-radius: 20px 20px 0 0; padding: 16px 16px calc(var(--safe-b) + 18px); border: 1px solid var(--line); }
.sheet.full { height: 96vh; height: 96dvh; max-height: none; }
.sheet .head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.sheet .head h3 { margin: 0; font-size: 18px; }
.ctrls { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 6px 0; }
.time { display: flex; justify-content: space-between; color: var(--dim); font-size: 12px; margin-top: -4px; }
.dev { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 8px 10px; border-radius: 12px; text-align: left; }
.dev:active { background: var(--panel2); }
.dev.on { background: rgba(30, 215, 96, .1); }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--safe-b) + 150px); max-width: 90%; z-index: 40; background: #fff; color: #111; padding: 10px 16px; border-radius: 22px; font-size: 14px; font-weight: 600; box-shadow: 0 6px 24px rgba(0, 0, 0, .5); }
.toast.bad { background: var(--err); color: #200; }
pre.log { background: #000; border: 1px solid var(--line); border-radius: 10px; padding: 10px; font-size: 11px; max-height: 180px; overflow: auto; white-space: pre-wrap; word-break: break-all; }

/* ---------- inicio de sesión ---------- */
.login { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 24px; gap: 14px; }
.login h1 { margin: 0; font-size: 26px; }
.login p { max-width: 420px; color: var(--dim); margin: 0; }
.login code { background: var(--panel2); padding: 2px 6px; border-radius: 6px; font-size: 12px; word-break: break-all; }

/* ---------- tableta en horizontal: más aire ---------- */
@media (min-width: 900px) {
  main { padding: 18px 24px 28px; }
  .item, .item .cov { width: 160px; }
  .item .cov { height: 160px; }
}
