/* Mi Música · "Atardecer en ruta": degradados cálidos, modo claro/oscuro automático */
:root {
  --sun1: #ffb347; --sun2: #ff4d7d; --sun3: #6d4aff;
  --grad: linear-gradient(135deg, var(--sun1), var(--sun2) 55%, var(--sun3));
  --bg: #fff6ee; --card: #ffffff; --ink: #2a1b3d; --mute: #7a6a8c; --line: #f0e1d6;
  --soft: #fff0e6; --accent: #e8386d; --warn: #b45309; --shadow: 0 8px 24px rgba(109, 74, 255, .10);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #130e23; --card: #1e1733; --ink: #f6efff; --mute: #a99bc2; --line: #2e2547;
    --soft: #271e42; --accent: #ff7a9c; --warn: #fbbf24; --shadow: 0 8px 24px rgba(0, 0, 0, .35);
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body { margin: 0; font: 16px/1.45 ui-rounded, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--ink); padding-bottom: calc(96px + env(safe-area-inset-bottom)); }

/* Cabecera con foto o degradado */
.hero { position: relative; color: #fff; padding: calc(18px + env(safe-area-inset-top)) 20px 70px; overflow: hidden; border-radius: 0 0 28px 28px; }
.hero-bg { position: absolute; inset: 0; background:
  linear-gradient(135deg, #ffb347, #ff4d7d 55%, #6d4aff); }
.hero-in { position: relative; display: flex; align-items: center; gap: 14px; max-width: 640px; margin: 0 auto; }
.logo { width: 52px; height: 52px; border-radius: 14px; box-shadow: 0 6px 18px rgba(0, 0, 0, .28); }
h1 { margin: 0; font-size: 1.55rem; letter-spacing: -.01em; text-shadow: 0 2px 10px rgba(0, 0, 0, .35); }
.hero p { margin: 2px 0 0; opacity: .95; font-size: .95rem; text-shadow: 0 1px 6px rgba(0, 0, 0, .35); }

main { padding: 0 16px 16px; max-width: 1000px; margin: -36px auto 0; position: relative; }
h2 { font-size: 1.1rem; margin: 0 0 8px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 16px; margin-bottom: 14px; box-shadow: var(--shadow); }
label { display: block; font-weight: 700; margin: 12px 0 6px; font-size: .92rem; }
textarea, input[type=text], input[type=number] { width: 100%; font: inherit; color: inherit; background: var(--soft); border: 1.5px solid transparent; border-radius: 14px; padding: 12px 14px; transition: border-color .15s, box-shadow .15s; }
textarea:focus, input:focus { outline: none; border-color: var(--sun2); box-shadow: 0 0 0 4px rgba(255, 77, 125, .15); }
textarea { min-height: 96px; resize: vertical; }
input#title { font-weight: 800; font-size: 1.1rem; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0; }
.chip { border: 1.5px solid var(--line); background: var(--soft); color: inherit; border-radius: 999px; padding: 9px 15px; font: inherit; font-size: .92rem; transition: transform .1s; }
.chip:active { transform: scale(.96); }
.chip.on { background: var(--grad); border-color: transparent; color: #fff; font-weight: 700; box-shadow: 0 4px 14px rgba(255, 77, 125, .35); }
.chip.idea { background: transparent; border-style: dashed; color: var(--mute); }

button { font: inherit; }
button.big { width: 100%; margin-top: 14px; padding: 15px; border: 0; border-radius: 16px; background: var(--grad); color: #fff; font-weight: 800; font-size: 1.05rem; box-shadow: 0 8px 20px rgba(255, 77, 125, .35); transition: transform .1s, box-shadow .1s; }
button.big:active { transform: scale(.98); box-shadow: 0 4px 12px rgba(255, 77, 125, .3); }
button.big:disabled { opacity: .55; box-shadow: none; }
button.sec { padding: 11px 13px; border: 1.5px solid var(--line); border-radius: 14px; background: var(--card); color: inherit; font-weight: 600; transition: transform .1s, background .15s; }
button.sec:active { transform: scale(.97); background: var(--soft); }
button.sec:disabled { opacity: .5; }
button.danger { color: #e11d48; }
.row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.row > * { flex: 1 1 auto; }
.mute { color: var(--mute); font-size: .9rem; margin: 4px 0; }
.warn { color: var(--warn); }
b { font-weight: 800; }

/* Canciones */
.track { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.track:first-child { border-top: 0; }
.track .n { width: 28px; height: 28px; border-radius: 50%; background: var(--soft); color: var(--accent); display: grid; place-items: center; font-size: .78rem; font-weight: 800; flex: none; }
.track .i { flex: 1; min-width: 0; }
.track .i b, .track .i small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.track .i b { font-weight: 700; }
.track .i small { color: var(--mute); }
.track .x { border: 0; background: none; color: var(--mute); font-size: 1.15rem; padding: 8px 10px; border-radius: 10px; }
.track .x:active { background: var(--soft); }

.item { display: block; width: 100%; text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 14px 16px; margin-bottom: 12px; color: inherit; box-shadow: var(--shadow); }
.item:active { transform: scale(.99); }

.progress { height: 10px; background: var(--soft); border-radius: 999px; overflow: hidden; margin-top: 12px; }
.progress i { display: block; height: 100%; background: var(--grad); width: 0; border-radius: 999px; transition: width .4s; }

.empty { text-align: center; padding: 26px 12px 10px; }
.empty svg { width: 150px; height: auto; margin-bottom: 8px; }
.empty p { margin: 4px 0; }

details { margin-top: 12px; background: var(--soft); border-radius: 14px; padding: 10px 14px; }
summary { font-weight: 700; cursor: pointer; }
ol { padding-left: 20px; margin: 8px 0 2px; }
code { background: var(--soft); padding: 2px 6px; border-radius: 6px; }

/* Navegación flotante */
#tabs { position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); max-width: 616px; margin: 0 auto; display: flex; gap: 4px; padding: 6px; border-radius: 26px; background: color-mix(in srgb, var(--card) 88%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border: 1px solid var(--line); box-shadow: 0 10px 30px rgba(42, 27, 61, .22); }
#tabs button { flex: 1; border: 0; background: none; color: var(--mute); padding: 8px 0 6px; border-radius: 20px; display: flex; flex-direction: column; align-items: center; gap: 2px; transition: background .2s, color .2s; }
#tabs svg { width: 24px; height: 24px; fill: currentColor; }
#tabs button span { font-size: .72rem; font-weight: 700; }
#tabs button.on { background: var(--grad); color: #fff; box-shadow: 0 6px 16px rgba(255, 77, 125, .35); }

#toast { position: fixed; left: 50%; bottom: calc(104px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(8px); background: #2a1b3d; color: #fff; padding: 11px 18px; border-radius: 999px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; max-width: 90vw; text-align: center; box-shadow: 0 8px 24px rgba(0, 0, 0, .3); }
#toast.show { opacity: 1; transform: translateX(-50%); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

.credit { text-align: center; font-size: .8rem; }
.credit a { color: inherit; }

/* ---- Radio ---- */
body.has-player { padding-bottom: calc(176px + env(safe-area-inset-bottom)); }
.hero-in { max-width: 1000px; }
#tabs { max-width: 640px; }

/* Logos de emisora: la inicial queda detrás y se ve si la imagen falla */
.lg { position: relative; width: 56px; height: 56px; flex: none; border-radius: 14px; background: var(--soft); overflow: hidden; display: grid; place-items: center; }
.lg::before { content: attr(data-i); font-weight: 800; font-size: 1.4rem; color: var(--accent); }
.lg img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #fff; padding: 4px; }
.lg.big { width: 84px; height: 84px; border-radius: 20px; }
.lg.big::before { font-size: 2rem; }
.lg.huge { width: min(46vw, 220px); height: min(46vw, 220px); border-radius: 32px; box-shadow: 0 16px 40px rgba(0, 0, 0, .35); }
.lg.huge::before { font-size: 4rem; }

/* Favoritas: botones grandes */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.tile { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; padding: 16px 10px 14px; min-height: 170px; background: var(--card); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); color: inherit; transition: transform .1s; }
.tile:active { transform: scale(.97); }
.tile.on { outline: 3px solid var(--sun2); }
.tile b { font-size: 1rem; line-height: 1.2; }
.tile small { color: var(--mute); font-size: .78rem; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* Explorar */
.search { margin-bottom: 10px; }
.sel { width: 100%; font: inherit; color: inherit; background: var(--soft); border: 1.5px solid transparent; border-radius: 14px; padding: 11px 12px; margin-top: 6px; }
h3 { margin: 16px 0 6px; font-size: .95rem; color: var(--mute); }
.rrow { display: flex; align-items: center; gap: 10px; padding: 8px 4px; border-top: 1px solid var(--line); }
.rrow:first-child { border-top: 0; }
.rmain { flex: 1; min-width: 0; text-align: left; border: 0; background: none; color: inherit; padding: 6px 0; }
.rmain b, .rmain small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rmain small { color: var(--mute); }
.star { border: 0; background: none; font-size: 1.6rem; color: var(--line); padding: 8px 12px; }
.star.on { color: #ffb347; }
.rrow.on .rmain b { color: var(--accent); }

/* Barra de reproducción */
.mini { position: fixed; left: 12px; right: 12px; bottom: calc(92px + env(safe-area-inset-bottom)); max-width: 560px; margin: 0 auto; display: flex; align-items: center; gap: 8px; padding: 8px 10px 8px 8px; border-radius: 22px; background: var(--grad); color: #fff; box-shadow: 0 10px 30px rgba(255, 77, 125, .4); }
.mini[hidden] { display: none; }
.mini-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; border: 0; background: none; color: inherit; text-align: left; padding: 0; }
.mini .lg { width: 46px; height: 46px; border-radius: 12px; }
.mini-t { min-width: 0; }
.mini-t b, .mini-t small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-t small { opacity: .92; font-size: .8rem; }
.round { width: 46px; height: 46px; border-radius: 50%; border: 0; background: #fff; color: #e8386d; display: grid; place-items: center; flex: none; font-size: 1.2rem; box-shadow: 0 4px 12px rgba(0, 0, 0, .2); }
.round svg { width: 24px; height: 24px; fill: currentColor; }
.round:active { transform: scale(.94); }

/* Pantalla de reproducción */
.sheet { position: fixed; inset: 0; z-index: 10; display: flex; align-items: center; justify-content: center; background: linear-gradient(160deg, #ff9a4a, #ff4d7d 50%, #6d4aff); color: #fff; padding: env(safe-area-inset-top) 20px env(safe-area-inset-bottom); overflow: auto; }
.sheet[hidden] { display: none; }
.sheet-in { text-align: center; max-width: 520px; width: 100%; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.sheet h2 { font-size: 1.7rem; margin: 14px 0 0; text-shadow: 0 2px 10px rgba(0, 0, 0, .25); }
.sheet-prog { font-size: 1.1rem; margin: 2px 0; min-height: 1.4em; }
.sheet .mute { color: rgba(255, 255, 255, .85); min-height: 1.3em; }
.sheet-close { position: absolute; top: calc(10px + env(safe-area-inset-top)); left: 14px; width: 48px; height: 48px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .22); color: #fff; font-size: 1.6rem; }
.controls { display: flex; align-items: center; justify-content: center; gap: 28px; margin-top: 22px; }
.round.play { width: 92px; height: 92px; }
.round.play svg { width: 42px; height: 42px; }
.round.side { width: 60px; height: 60px; background: rgba(255, 255, 255, .25); color: #fff; font-size: 1.5rem; box-shadow: none; }
.round.side.on { background: #fff; color: #ffb347; }

.sheet-txt { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
@media (min-width: 700px) and (orientation: landscape) {
  .sheet-in { flex-direction: row; max-width: 900px; text-align: left; justify-content: center; gap: 40px; }
  .sheet-txt { align-items: flex-start; }
  .controls { justify-content: flex-start; }
}
