/* Pensé pour un écran de voiture : sombre pour ne pas éblouir de nuit, et des
   cibles tactiles d'au moins 64 px, qu'on touche sans quitter la route des yeux. */
:root {
    --bg: #0b0f14;
    --surface: #151b23;
    --surface-2: #1d2530;
    --border: #2a3441;
    --text: #f1f5f9;
    --muted: #94a3b8;
    --faint: #64748b;
    --primary: #14b8a6;
    --primary-strong: #2dd4bf;
    --primary-dim: rgba(20, 184, 166, .16);
    --done: #475569;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
/* L'attribut hidden n'agit pas sur les <svg> : sans cette règle, lecture et pause s'affichent ensemble. */
[hidden] { display: none !important; }

html, body {
    margin: 0;
    height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    overscroll-behavior: none;
    user-select: none;
}

button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { opacity: .35; cursor: default; }

.app {
    display: grid;
    /* minmax(0, …) : sinon les noms d'invités sur une ligne élargissent la colonne au-delà de l'écran */
    grid-template-columns: minmax(340px, 44%) minmax(0, 1fr);
    height: 100dvh;
    padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right))
             max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
    gap: 12px;
}

/* ---------- Lecteur ---------- */
.player {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 16px;
    min-height: 0;
}

.now { display: flex; gap: 16px; align-items: center; min-width: 0; }
.cover {
    width: 96px; height: 96px; flex: none;
    border-radius: 14px; object-fit: cover; background: var(--surface-2);
}
.now-text { min-width: 0; }
.now-podcast { margin: 0 0 4px; color: var(--primary-strong); font-size: 14px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.now-title { margin: 0; font-size: 26px; line-height: 1.15; font-weight: 700; }
.now-guests {
    margin: 6px 0 0; color: var(--muted); font-size: 16px; line-height: 1.3;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

.progress input[type=range] {
    width: 100%; height: 44px; margin: 0; background: transparent;
    -webkit-appearance: none; appearance: none;
}
.progress input[type=range]::-webkit-slider-runnable-track {
    height: 8px; border-radius: 4px;
    background: linear-gradient(to right, var(--primary) var(--pct, 0%), var(--surface-2) var(--pct, 0%));
}
.progress input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none; width: 28px; height: 28px; margin-top: -10px;
    border-radius: 50%; background: var(--text); border: 0;
}
.progress input[type=range]::-moz-range-track { height: 8px; border-radius: 4px; background: var(--surface-2); }
.progress input[type=range]::-moz-range-progress { height: 8px; border-radius: 4px; background: var(--primary); }
.progress input[type=range]::-moz-range-thumb { width: 28px; height: 28px; border-radius: 50%; background: var(--text); border: 0; }
.times { display: flex; justify-content: space-between; color: var(--muted); font-size: 16px; font-variant-numeric: tabular-nums; }

.controls { display: flex; justify-content: center; align-items: center; gap: 28px; }
.ctl {
    position: relative; width: 84px; height: 84px; border-radius: 50%;
    background: var(--surface-2); border: 0;
    display: grid; place-items: center;
}
.ctl svg { width: 44px; height: 44px; fill: currentColor; }
.ctl span:not(.spinner) { position: absolute; font-size: 11px; font-weight: 700; top: 50%; left: 50%; transform: translate(-50%, -25%); }
.ctl-main { width: 116px; height: 116px; background: var(--primary); color: #04201d; }
.ctl-main svg { width: 60px; height: 60px; }
.ctl:not(:disabled):active { transform: scale(.94); }

.spinner {
    width: 52px; height: 52px; border-radius: 50%;
    border: 5px solid rgba(4, 32, 29, .25); border-top-color: #04201d;
    animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.subcontrols { display: flex; justify-content: center; gap: 12px; }
.chip {
    min-height: 56px; padding: 0 22px; border-radius: 999px;
    background: var(--surface-2); border: 1px solid var(--border);
    font-size: 18px; font-weight: 600;
}

/* ---------- Bibliothèque ---------- */
.library { display: flex; flex-direction: column; min-height: 0; gap: 10px; }

.tabs { display: flex; gap: 8px; overflow-x: auto; flex: none; scrollbar-width: none; }
.tabs:empty { display: none; }
.tab {
    min-height: 52px; padding: 0 20px; border-radius: 999px; white-space: nowrap;
    background: var(--surface); border: 1px solid var(--border); font-size: 17px; font-weight: 600;
}
.tab[aria-selected=true] { background: var(--primary); border-color: var(--primary); color: #04201d; }

.status { padding: 16px; border-radius: 14px; background: var(--surface); color: var(--muted); font-size: 17px; }

.episodes {
    list-style: none; margin: 0; padding: 0;
    overflow-y: auto; -webkit-overflow-scrolling: touch;
    display: flex; flex-direction: column; gap: 8px;
    flex: 1; min-height: 0;
}
.ep {
    display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
    min-height: 84px; padding: 12px 16px;
    background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
}
.ep:active { background: var(--surface-2); }
.ep.current { border-color: var(--primary); background: var(--primary-dim); }
.ep.done .ep-heading, .ep.done .ep-guests { color: var(--done); }

.ep-icon {
    flex: none; width: 48px; height: 48px; border-radius: 50%;
    display: grid; place-items: center; background: var(--surface-2);
}
.ep-icon svg { width: 24px; height: 24px; fill: currentColor; }
.ep.current .ep-icon { background: var(--primary); color: #04201d; }
.ep.done .ep-icon { color: var(--primary); }

.ep-body { flex: 1; min-width: 0; }
.ep-heading { font-size: 20px; font-weight: 700; }
.ep-guests { color: var(--muted); font-size: 15px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ep-bar { height: 4px; border-radius: 2px; background: var(--surface-2); margin-top: 8px; overflow: hidden; }
.ep-bar > i { display: block; height: 100%; background: var(--primary); }
.ep-meta { flex: none; color: var(--muted); font-size: 15px; text-align: right; font-variant-numeric: tabular-nums; }

/* Portrait (téléphone) : le lecteur passe au-dessus, plus compact */
@media (max-aspect-ratio: 1/1) {
    .app { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
    .player { padding: 16px; gap: 12px; }
    .cover { width: 72px; height: 72px; }
    .now-title { font-size: 22px; }
    .ctl { width: 72px; height: 72px; }
    .ctl-main { width: 96px; height: 96px; }
}

/* Écrans de voiture très bas (1280×480, 1024×600) */
@media (min-aspect-ratio: 1/1) and (max-height: 520px) {
    .player { padding: 14px 18px; gap: 8px; }
    .cover { width: 72px; height: 72px; }
    .now-title { font-size: 22px; }
    .ctl { width: 72px; height: 72px; }
    .ctl-main { width: 96px; height: 96px; }
    .chip { min-height: 48px; }
    .ep { min-height: 72px; }
}
