/* Mi Pódcast · "Atardecer en ruta": mismo estilo que Mi Música y Mi Radio */
:root {
  --sun1: #ffb347; --sun2: #ff4d7d; --sun3: #6d4aff;
  --grad: linear-gradient(135deg, var(--sun1), var(--sun2) 55%, var(--sun3));
  --bg: #fff6ee;
  --surface: #fff0e6;
  --card: #ffffff;
  --text: #2a1b3d;
  --muted: #7a6a8c;
  --line: #f0e1d6;
  --accent: #e8386d;
  --accent-text: #ffffff;
  --danger: #e11d48;
  --shadow: 0 8px 24px rgba(109, 74, 255, .10);
  --safe-b: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #130e23;
    --surface: #271e42;
    --card: #1e1733;
    --text: #f6efff;
    --muted: #a99bc2;
    --line: #2e2547;
    --accent: #ff7a9c;
    --accent-text: #2a0b18;
    --danger: #ff8aa3;
    --shadow: 0 8px 24px rgba(0, 0, 0, .35);
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 ui-rounded, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: calc(24px + var(--safe-b));
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
img { display: block; }
b { font-weight: 800; }

/* Cabecera fija con degradado: título, menú y lo que suena */
.topbar {
  position: sticky; top: 0; z-index: 8; color: #fff; background: var(--grad);
  display: flex; flex-direction: column; gap: 8px;
  padding: calc(8px + env(safe-area-inset-top, 0px)) 12px 10px;
  border-radius: 0 0 22px 22px; box-shadow: 0 6px 20px rgba(109, 74, 255, .25);
}
.top-row { display: flex; align-items: center; gap: 10px; max-width: 1000px; width: 100%; margin: 0 auto; }
.topbar .logo { width: 34px; height: 34px; border-radius: 10px; box-shadow: 0 3px 10px rgba(0, 0, 0, .25); flex: none; }
.topbar h1 { font-size: 1.2rem; margin: 0; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -.01em; text-shadow: 0 2px 8px rgba(0, 0, 0, .3); }
.back { width: 36px; height: 36px; border-radius: 50%; background: rgba(255, 255, 255, .24); color: #fff; font-size: 26px; line-height: 1; padding: 0 0 3px; flex: none; }
.offline { font-size: 12px; background: rgba(255, 255, 255, .25); padding: 3px 9px; border-radius: 99px; }

main { max-width: 1000px; margin: 12px auto 0; padding: 0 16px 24px; }
h2 { font-size: 1.1rem; margin: 22px 0 8px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.empty { color: var(--muted); text-align: center; padding: 22px 12px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 15px; border-radius: 14px; background: var(--card); border: 1.5px solid var(--line);
  font-weight: 700; font-size: .95rem; transition: transform .1s, background .15s;
}
.btn:active { transform: scale(.97); background: var(--surface); }
.btn.primary { background: var(--grad); color: #fff; border-color: transparent; box-shadow: 0 6px 16px rgba(255, 77, 125, .35); }
.btn.danger { color: var(--danger); }
.btn:disabled { opacity: .5; box-shadow: none; }
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }

.search-form { display: flex; gap: 8px; margin-top: 8px; }
.search-form input { flex: 1; min-width: 0; }
input[type=search], input[type=text] {
  width: 100%; padding: 12px 14px; border-radius: 14px; border: 1.5px solid transparent; background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
}
input:focus { outline: none; border-color: var(--sun2); box-shadow: 0 0 0 4px rgba(255, 77, 125, .15); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; }
.tile { text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 8px; box-shadow: var(--shadow); color: inherit; transition: transform .1s; }
.tile:active { transform: scale(.97); }
.tile img, .cover { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 12px; background: var(--surface); }
.tile span { display: block; font-size: .82rem; font-weight: 600; margin-top: 6px; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.list { list-style: none; margin: 0; padding: 0; background: var(--card); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); padding: 2px 14px; }
.list:empty { display: none; }
.item { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); align-items: flex-start; }
.item:last-child { border-bottom: 0; }
.item img { width: 54px; height: 54px; border-radius: 12px; object-fit: cover; flex: none; background: var(--surface); }
.item .body { flex: 1; min-width: 0; }
.item .t { font-weight: 700; line-height: 1.3; }
.item .t.done { color: var(--muted); font-weight: 500; }
.item .meta { font-size: .82rem; color: var(--muted); }
.item .desc { font-size: .82rem; color: var(--muted); margin-top: 2px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.item .acts { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.item .acts button { padding: 6px 11px; border-radius: 999px; background: var(--surface); font-size: .82rem; font-weight: 600; }
.item .acts button.on { background: var(--grad); color: #fff; }
.bar { height: 5px; background: var(--surface); border-radius: 99px; margin-top: 8px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--grad); border-radius: 99px; }

.pod-head { display: flex; gap: 14px; align-items: center; margin: 12px 0; background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 14px; box-shadow: var(--shadow); }
.pod-head img { width: 96px; height: 96px; border-radius: 16px; object-fit: cover; }
.pod-head .t { font-weight: 800; font-size: 1.1rem; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 14px 16px; margin: 12px 0; box-shadow: var(--shadow); }

/* Menú dentro de la cabecera */
.tabs { display: flex; gap: 2px; max-width: 640px; width: 100%; margin: 0 auto; padding: 3px; border-radius: 18px; background: rgba(255, 255, 255, .2); }
.tabs a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 5px 0 4px; border-radius: 15px; text-decoration: none; color: rgba(255, 255, 255, .9); font-size: .64rem; font-weight: 700; transition: background .2s, color .2s; }
.tabs svg { width: 20px; height: 20px; fill: currentColor; }
.tabs a.active { background: #fff; color: #e8386d; }

/* Reproductor */
.player { max-width: 640px; width: 100%; margin: 0 auto; background: rgba(255, 255, 255, .2); color: #fff; border-radius: 18px; }
.player-bar { display: flex; align-items: center; gap: 10px; padding: 5px 8px 5px 5px; cursor: pointer; }
.player-bar img { width: 38px; height: 38px; border-radius: 10px; object-fit: cover; background: rgba(255, 255, 255, .25); }
.p-text { flex: 1; min-width: 0; }
.p-title { font-weight: 700; font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-sub { font-size: .8rem; opacity: .92; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.round { width: 38px; height: 38px; border-radius: 50%; background: #fff; color: #e8386d; font-size: 18px; flex: none; box-shadow: 0 4px 12px rgba(0, 0, 0, .2); }
.round:active { transform: scale(.94); }
.round.big { width: 64px; height: 64px; font-size: 26px; }
.player-full { position: fixed; inset: 0; z-index: 10; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: calc(16px + env(safe-area-inset-top, 0px)) 24px calc(16px + var(--safe-b)); background: linear-gradient(160deg, #ff9a4a, #ff4d7d 50%, #6d4aff); overflow: auto; }
.player-full > * { width: 100%; max-width: 520px; }
.sheet-close { position: absolute; top: calc(10px + env(safe-area-inset-top, 0px)); left: 14px; width: 48px !important; height: 48px; border-radius: 50%; background: rgba(255, 255, 255, .22); color: #fff; font-size: 1.6rem; }
.sheet-cover { width: min(56vw, 240px) !important; height: min(56vw, 240px); aspect-ratio: 1; object-fit: cover; border-radius: 28px; box-shadow: 0 16px 40px rgba(0, 0, 0, .35); background: rgba(255, 255, 255, .25); margin: 0 auto 10px; }
.sheet-title { text-align: center; font-weight: 800; font-size: 1.2rem; line-height: 1.25; margin-bottom: 8px; text-shadow: 0 2px 10px rgba(0, 0, 0, .25); }
.player-full input[type=range] { width: 100%; accent-color: #fff; }
.p-times { display: flex; justify-content: space-between; font-size: .8rem; opacity: .92; }
.p-controls { display: flex; justify-content: center; align-items: center; gap: 28px; margin: 6px 0 10px; }
.p-controls button:not(.round) { font-weight: 800; font-size: 1.05rem; padding: 10px 14px; border-radius: 14px; background: rgba(255, 255, 255, .22); color: #fff; }
.p-options { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }
.p-options button { padding: 8px 14px; border-radius: 99px; background: rgba(255, 255, 255, .22); color: #fff; font-size: .85rem; font-weight: 700; }
.p-options button.on { background: #fff; color: #e8386d; }

dialog { border: 0; border-radius: 22px; padding: 20px; width: min(92vw, 400px); background: var(--card); color: var(--text); box-shadow: 0 20px 50px rgba(0, 0, 0, .35); }
dialog::backdrop { background: rgb(19 14 35 / .55); }
dialog h3 { margin: 0 0 12px; font-size: 1.1rem; }
dialog .opts { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
dialog .opts button { text-align: left; padding: 11px 14px; background: var(--surface); border-radius: 14px; font-weight: 600; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 9;
  bottom: calc(24px + var(--safe-b));
  background: #2a1b3d; color: #fff; padding: 11px 18px; border-radius: 999px; font-size: .95rem; max-width: 90vw; text-align: center; box-shadow: 0 8px 24px rgba(0, 0, 0, .3);
}
code.link { display: block; word-break: break-all; font-size: 12px; background: var(--surface); padding: 8px; border-radius: 10px; margin: 6px 0; }

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


/* Sin barra: se controla desde el episodio (Pausar / Continuar / Controles) */
#player { background: none; margin: 0; }
#player .player-bar { display: none; }
