/* Diseño pensado para una persona mayor: texto grande, botones grandes,
   mucho contraste, pocas cosas en pantalla, modo oscuro automático de noche. */

:root {
  --bg: #F7F3EC;
  --card: #FFFFFF;
  --text: #1B1B1B;
  --muted: #5C5C5C;
  --accent: #0B6E6E;
  --accent-text: #FFFFFF;
  --accent-soft: #D9EDED;
  --line: #D8D2C8;
  --track: #E3DED5;
  --danger: #A33A2E;
  --radius: 22px;
  --fs: 20px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121417;
    --card: #1D2126;
    --text: #F2F2F2;
    --muted: #B0B6BE;
    --accent: #4FC3C3;
    --accent-text: #0A1F1F;
    --accent-soft: #1F3A3A;
    --line: #2C333B;
    --track: #2C333B;
    --danger: #F08A7E;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { font-size: var(--fs); }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.35;
  -webkit-text-size-adjust: 100%;
  -webkit-user-select: none; user-select: none;
  touch-action: manipulation;
}
button { font: inherit; color: inherit; cursor: pointer; }
.hidden { display: none !important; }
.muted { color: var(--muted); }

.view {
  min-height: 100dvh;
  padding: calc(env(safe-area-inset-top) + 14px) 18px calc(env(safe-area-inset-bottom) + 24px);
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}
.top h1 { font-size: 2rem; margin: 0.4rem 0 0.1rem; }
.subtitle { margin: 0 0 1rem; color: var(--muted); }

/* ---- lista ---- */
.list { display: flex; flex-direction: column; gap: 14px; padding-bottom: 110px; }
.card {
  width: 100%;
  text-align: left;
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 14px;
  align-items: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.card:active { transform: scale(0.99); background: var(--accent-soft); }
.card .c-title { font-size: 1.2rem; font-weight: 700; margin: 0; grid-column: 1; }
.card .c-meta { margin: 0; color: var(--muted); font-size: 0.95rem; grid-column: 1; }
.card .c-meta.done { color: var(--accent); font-weight: 600; }
.card .c-play {
  grid-column: 2; grid-row: 1 / span 3;
  width: 64px; height: 64px; border-radius: 50%;
  background: var(--accent); color: var(--accent-text);
  display: grid; place-items: center; font-size: 1.6rem;
}
.card .c-bar { grid-column: 1; height: 8px; border-radius: 4px; background: var(--track); overflow: hidden; }
.card .c-bar > i { display: block; height: 100%; background: var(--accent); width: 0; }

/* curso (tarjeta que abre la lista de capítulos) */
.card.course { border-color: var(--accent); background: var(--accent-soft); }
.card .c-kicker { grid-column: 1; margin: 0; font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); font-weight: 700; }
.card.course .c-play { grid-row: 1 / span 4; font-size: 2.2rem; }
/* capítulo todavía sin audio */
.card.soon { opacity: 0.55; grid-template-columns: 1fr; box-shadow: none; }
.card.soon .c-title { font-weight: 600; }

.course-title { font-size: 1.6rem; line-height: 1.2; margin: 0.4rem 0 0.2rem; }
.continue {
  width: 100%; text-align: left; margin: 0.2rem 0 1.2rem;
  background: var(--accent); color: var(--accent-text); border: 0; border-radius: var(--radius);
  padding: 16px 18px; display: flex; align-items: center; gap: 14px;
  box-shadow: 0 6px 18px rgba(11,110,110,0.3);
}
.continue .c-play { width: 60px; height: 60px; border-radius: 50%; background: var(--accent-text); color: var(--accent); display: grid; place-items: center; font-size: 1.5rem; flex: none; }
.continue .np-title { white-space: normal; font-size: 1.1rem; }
.continue:active { transform: scale(0.99); }
.p-course { margin: 0.4rem 0 0; font-size: 0.9rem; }

.now-playing {
  position: fixed; left: 14px; right: 14px;
  bottom: calc(env(safe-area-inset-bottom) + 14px);
  max-width: 532px; margin: 0 auto;
  background: var(--accent); color: var(--accent-text);
  border: 0; border-radius: 18px; padding: 14px 18px;
  display: flex; align-items: center; gap: 14px; text-align: left;
  box-shadow: 0 6px 20px rgba(0,0,0,0.25);
}
.np-icon { font-size: 1.4rem; }
.np-text { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.np-label { font-size: 0.8rem; opacity: 0.85; }
.np-title { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.np-chevron { font-size: 1.8rem; line-height: 1; }

/* ---- reproductor ---- */
.player-top { display: flex; align-items: center; }
.back {
  background: none; border: 0; padding: 10px 6px;
  font-size: 1.15rem; font-weight: 600; color: var(--accent);
  min-height: 56px;
}
.p-title { font-size: 1.5rem; line-height: 1.25; margin: 0.6rem 0 0.2rem; }
.p-status { margin: 0 0 1rem; min-height: 1.4em; }
.p-desc { margin-top: auto; padding-top: 1.2rem; font-size: 0.95rem; }

.progress { margin: 0.6rem 0 0.4rem; }
.seek {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 44px; background: transparent; margin: 0;
}
.seek:focus { outline: none; }
.seek::-webkit-slider-runnable-track { height: 12px; border-radius: 6px; background: var(--track); }
.seek::-webkit-slider-thumb {
  -webkit-appearance: none; width: 34px; height: 34px; border-radius: 50%;
  background: var(--accent); border: 4px solid var(--card); margin-top: -11px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}
.seek::-moz-range-track { height: 12px; border-radius: 6px; background: var(--track); }
.seek::-moz-range-thumb { width: 30px; height: 30px; border-radius: 50%; background: var(--accent); border: 4px solid var(--card); }
.times { display: flex; justify-content: space-between; font-size: 1.05rem; font-variant-numeric: tabular-nums; }

.controls {
  display: flex; align-items: center; justify-content: center; gap: 22px;
  margin: 1rem 0 1.4rem;
}
.skip {
  width: 84px; height: 84px; border-radius: 50%;
  background: var(--card); border: 2px solid var(--line); color: var(--text);
  display: grid; place-items: center;
}
.skip svg { width: 48px; height: 48px; }
.play {
  width: 124px; height: 124px; border-radius: 50%; border: 0;
  background: var(--accent); color: var(--accent-text);
  display: grid; place-items: center;
  box-shadow: 0 8px 22px rgba(11,110,110,0.35);
}
.play svg { width: 64px; height: 64px; }
.skip:active, .play:active, .tool:active { transform: scale(0.96); }

.tools { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.tool {
  background: var(--card); border: 2px solid var(--line); border-radius: 18px;
  padding: 12px 6px; min-height: 92px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
}
.tool-label { font-size: 0.85rem; color: var(--muted); }
.tool-value { font-size: 1.3rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.tool.active { border-color: var(--accent); background: var(--accent-soft); }

/* ---- hojas de opciones ---- */
.backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 10; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 11;
  background: var(--card); color: var(--text);
  border-radius: 26px 26px 0 0;
  padding: 18px 18px calc(env(safe-area-inset-bottom) + 18px);
  max-width: 560px; margin: 0 auto;
  box-shadow: 0 -8px 30px rgba(0,0,0,0.25);
}
.sheet h3 { margin: 0 0 12px; font-size: 1.4rem; text-align: center; }
.sheet-help { margin: -4px 0 14px; text-align: center; }
.options { display: flex; flex-direction: column; gap: 10px; }
.options.grid { display: grid; grid-template-columns: 1fr 1fr; }
.options button, .option-off {
  background: var(--bg); border: 2px solid var(--line); border-radius: 16px;
  padding: 16px 14px; font-size: 1.15rem; font-weight: 600; text-align: left;
  display: flex; justify-content: space-between; align-items: center; min-height: 64px;
}
.options.grid button { justify-content: center; font-size: 1.25rem; white-space: nowrap; }
.options button small { color: var(--muted); font-weight: 500; font-size: 0.95rem; }
.options button.selected, .option-off.selected {
  background: var(--accent); color: var(--accent-text); border-color: var(--accent);
}
.options button.selected small { color: inherit; }
.option-off { width: 100%; margin-top: 10px; justify-content: center; }
.sheet-close {
  width: 100%; margin-top: 14px; min-height: 60px;
  background: none; border: 0; font-size: 1.15rem; font-weight: 600; color: var(--accent);
}

.volume-row { display: flex; align-items: center; gap: 14px; padding: 6px 0 10px; }
.volume-row input { flex: 1; height: 44px; }
.round {
  width: 60px; height: 60px; border-radius: 50%; font-size: 1.8rem; line-height: 1;
  background: var(--bg); border: 2px solid var(--line);
}
.phone-hint { display: flex; justify-content: center; padding: 6px 0 12px; }
.phone {
  width: 90px; height: 170px; border-radius: 18px; border: 4px solid var(--muted);
  position: relative; background: var(--bg);
}
.vol-btn {
  position: absolute; left: -16px; width: 12px; height: 34px; border-radius: 4px;
  background: var(--accent); color: var(--accent-text); font-size: 0;
}
.vol-btn.up { top: 40px; } .vol-btn.down { top: 84px; }
.vol-btn::after {
  content: attr(class); position: absolute; left: -36px; top: 4px; font-size: 1.3rem; font-weight: 700; color: var(--text);
}
.vol-btn.up::after { content: "+"; } .vol-btn.down::after { content: "−"; }

.toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 30px);
  transform: translateX(-50%); z-index: 20;
  background: var(--text); color: var(--bg);
  padding: 14px 22px; border-radius: 16px; font-size: 1.05rem; max-width: 90vw; text-align: center;
  box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}
