/* ============================================================
   श्रवण ग्रंथालय — Audiobook module
   Sits on top of main.css. Uses the same warm editorial tokens.
   ============================================================ */

:root {
    --audio-accent: #7C3AED;
    --audio-accent-dark: #5B21B6;
    --audio-accent-pale: #EDE9FE;
    --audio-accent-bg: #F5F3FF;
}

/* ============ SHELF HERO ============ */
.audio-hero {
    position: relative;
    background: linear-gradient(135deg, #134E48 0%, #0F766E 46%, #1E5F7A 100%);
    border-radius: var(--r-lg);
    padding: 46px 44px;
    margin-bottom: 28px;
    overflow: hidden;
    color: var(--white);
}
.audio-hero::before {
    content: '';
    position: absolute;
    top: -80px;
    right: -60px;
    width: 320px;
    height: 320px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(212, 160, 23, 0.22) 0%, transparent 68%);
}
.audio-hero::after {
    content: '';
    position: absolute;
    left: -50px;
    bottom: -110px;
    width: 260px;
    height: 260px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.09) 0%, transparent 70%);
}
.audio-hero-inner { position: relative; z-index: 2; max-width: 640px; }
.audio-hero .eyebrow {
    color: var(--gold-light);
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 14px;
}
.audio-hero h2 {
    font-family: var(--font-serif);
    font-size: 36px;
    line-height: 1.12;
    color: var(--white);
    margin-bottom: 12px;
    font-weight: 700;
}
.audio-hero p {
    font-size: 15px;
    line-height: 1.65;
    color: rgba(255, 255, 255, 0.82);
    margin-bottom: 22px;
}
.audio-hero-search {
    display: flex;
    gap: 10px;
    max-width: 520px;
}
.audio-hero-search input {
    flex: 1;
    padding: 13px 18px;
    border-radius: var(--r-full);
    border: 1px solid rgba(255, 255, 255, 0.22);
    background: rgba(255, 255, 255, 0.13);
    color: var(--white);
    font-family: inherit;
    font-size: 14px;
    outline: none;
    transition: background 0.18s, border-color 0.18s;
}
.audio-hero-search input::placeholder { color: rgba(255, 255, 255, 0.6); }
.audio-hero-search input:focus {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.45);
}
.audio-hero-search button {
    padding: 13px 24px;
    border-radius: var(--r-full);
    border: none;
    background: var(--white);
    color: var(--teal-dark);
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    transition: transform 0.15s, box-shadow 0.15s;
}
.audio-hero-search button:hover { transform: translateY(-1px); box-shadow: 0 8px 18px -6px rgba(0, 0, 0, 0.4); }

/* Floating waveform decoration */
.audio-hero-wave {
    position: absolute;
    right: 46px;
    bottom: 34px;
    display: flex;
    align-items: flex-end;
    gap: 5px;
    height: 64px;
    opacity: 0.4;
    z-index: 1;
}
.audio-hero-wave span {
    width: 5px;
    border-radius: 3px;
    background: var(--gold-light);
    animation: heroWave 1.5s ease-in-out infinite;
}
.audio-hero-wave span:nth-child(1) { height: 22px; animation-delay: 0s; }
.audio-hero-wave span:nth-child(2) { height: 46px; animation-delay: 0.15s; }
.audio-hero-wave span:nth-child(3) { height: 30px; animation-delay: 0.3s; }
.audio-hero-wave span:nth-child(4) { height: 58px; animation-delay: 0.45s; }
.audio-hero-wave span:nth-child(5) { height: 36px; animation-delay: 0.6s; }
.audio-hero-wave span:nth-child(6) { height: 20px; animation-delay: 0.75s; }
.audio-hero-wave span:nth-child(7) { height: 48px; animation-delay: 0.9s; }
@keyframes heroWave {
    0%, 100% { transform: scaleY(0.45); }
    50% { transform: scaleY(1); }
}

/* ============ CONTINUE LISTENING STRIP ============ */
.continue-strip { margin-bottom: 30px; }
.continue-strip-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 14px;
    gap: 12px;
}
.continue-strip-head h3 {
    font-family: var(--font-serif);
    font-size: 20px;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 9px;
}
.continue-strip-head a {
    font-size: 12px;
    font-weight: 700;
    color: var(--teal);
    text-decoration: none;
}
.continue-row {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    padding-bottom: 8px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}
.continue-row::-webkit-scrollbar { height: 6px; }
.continue-row::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }
.continue-card {
    flex: 0 0 auto;
    width: 290px;
    scroll-snap-align: start;
    display: flex;
    gap: 13px;
    padding: 13px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    text-decoration: none;
    box-shadow: var(--shadow-xs);
    transition: transform 0.18s, box-shadow 0.18s, border-color 0.18s;
}
.continue-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--teal-pale);
}
.continue-card-art {
    width: 64px;
    height: 64px;
    border-radius: var(--r-sm);
    overflow: hidden;
    flex-shrink: 0;
    background: var(--paper-warm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-faint);
}
.continue-card-art img { width: 100%; height: 100%; object-fit: cover; }
.continue-card-body { flex: 1; min-width: 0; }
.continue-card-body h4 {
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 3px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.continue-card-body h4.mr { font-family: var(--font-mr); }
.continue-card-body .meta {
    font-size: 11px;
    color: var(--text-mute);
    margin-bottom: 9px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.continue-bar {
    height: 4px;
    border-radius: 2px;
    background: var(--paper-deep);
    overflow: hidden;
    margin-bottom: 5px;
}
.continue-bar span {
    display: block;
    height: 100%;
    border-radius: 2px;
    background: var(--teal);
}
.continue-card-body .left {
    font-size: 10px;
    font-weight: 700;
    color: var(--teal);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ============ AUDIOBOOK GRID ============ */
.audio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(212px, 1fr));
    gap: 22px;
}
.audio-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    overflow: hidden;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-xs);
    transition: transform 0.2s cubic-bezier(0.34, 1.4, 0.64, 1), box-shadow 0.2s, border-color 0.2s;
}
.audio-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--teal-pale);
}
.audio-card-art {
    position: relative;
    aspect-ratio: 1 / 1;
    background: linear-gradient(150deg, var(--paper-warm), var(--paper-deep));
    overflow: hidden;
}
.audio-card-art img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s;
}
.audio-card:hover .audio-card-art img { transform: scale(1.05); }
.audio-card-art-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 18px;
    text-align: center;
    color: var(--teal);
    background:
        radial-gradient(circle at 30% 25%, rgba(15, 118, 110, 0.12), transparent 60%),
        linear-gradient(150deg, var(--paper-warm), var(--paper-deep));
}
.audio-card-art-placeholder svg { opacity: 0.35; }
.audio-card-art-placeholder .pl-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-soft);
    line-height: 1.3;
}
.audio-card-art-placeholder .pl-title.mr { font-family: var(--font-mr); }

.audio-card-play {
    position: absolute;
    right: 12px;
    bottom: 12px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--white);
    color: var(--teal);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 18px -4px rgba(0, 0, 0, 0.35);
    transform: translateY(6px);
    opacity: 0;
    transition: all 0.22s cubic-bezier(0.34, 1.4, 0.64, 1);
}
.audio-card:hover .audio-card-play { transform: translateY(0); opacity: 1; }
@media (hover: none) {
    .audio-card-play { opacity: 1; transform: translateY(0); }
}
.audio-card-play svg { margin-left: 3px; }

.audio-card-duration {
    position: absolute;
    left: 10px;
    top: 10px;
    background: rgba(26, 22, 18, 0.78);
    backdrop-filter: blur(6px);
    color: var(--white);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.03em;
    padding: 4px 9px;
    border-radius: var(--r-full);
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.audio-card-progress {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 4px;
    background: rgba(26, 22, 18, 0.2);
}
.audio-card-progress span {
    display: block;
    height: 100%;
    background: var(--gold);
}

.audio-card-body { padding: 14px 15px 16px; flex: 1; display: flex; flex-direction: column; }
.audio-card-cat {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    margin-bottom: 6px;
}
.audio-card h3 {
    font-family: var(--font-sans);
    font-size: 15px;
    font-weight: 700;
    line-height: 1.3;
    color: var(--text);
    margin: 0 0 5px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.audio-card h3.mr { font-family: var(--font-mr); font-weight: 600; }
.audio-card .narrator {
    font-size: 12px;
    color: var(--text-soft);
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.audio-card-foot {
    margin-top: auto;
    padding-top: 10px;
    border-top: 1px solid var(--border-soft);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-mute);
    font-weight: 600;
}
.audio-card-foot .chapters { display: inline-flex; align-items: center; gap: 5px; }

/* ============ DETAIL PAGE ============ */
.ab-detail {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 40px;
    align-items: start;
}
.ab-detail-art {
    position: relative;
    border-radius: var(--r-lg);
    overflow: hidden;
    aspect-ratio: 1 / 1;
    background: linear-gradient(150deg, var(--paper-warm), var(--paper-deep));
    box-shadow: var(--shadow-lg);
}
.ab-detail-art img { width: 100%; height: 100%; object-fit: cover; }
.ab-detail-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 20px; }

.ab-detail h1 {
    font-family: var(--font-serif);
    font-size: 34px;
    line-height: 1.15;
    color: var(--text);
    margin-bottom: 8px;
}
.ab-detail h1.mr { font-family: var(--font-mr); font-weight: 600; }
.ab-alt-title { font-size: 16px; color: var(--text-soft); margin-bottom: 18px; }

.ab-credits { display: flex; flex-wrap: wrap; gap: 22px; margin-bottom: 22px; }
.ab-credit { display: flex; align-items: center; gap: 10px; }
.ab-credit-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--teal-bg);
    color: var(--teal);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.ab-credit-text small {
    display: block;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-mute);
    font-weight: 700;
}
.ab-credit-text strong { font-size: 14px; color: var(--text); font-weight: 600; }

.ab-meta-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 24px;
}
.ab-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 13px;
    border-radius: var(--r-full);
    background: var(--paper-warm);
    border: 1px solid var(--border);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-soft);
}
.ab-chip.accent { background: var(--teal-bg); border-color: var(--teal-pale); color: var(--teal-dark); }

.ab-section { margin-top: 32px; }
.ab-section h3 {
    font-family: var(--font-serif);
    font-size: 19px;
    color: var(--text);
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 9px;
}

/* Chapter list on the detail page */
.ab-tracklist {
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    overflow: hidden;
    background: var(--white);
}
.ab-track {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 13px 16px;
    border-bottom: 1px solid var(--border-soft);
    text-decoration: none;
    color: inherit;
    transition: background 0.15s;
}
.ab-track:last-child { border-bottom: none; }
.ab-track:hover { background: var(--paper-warm); }
.ab-track-no {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--paper-warm);
    color: var(--text-soft);
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.ab-track:hover .ab-track-no { background: var(--teal); color: var(--white); }
.ab-track-title { flex: 1; min-width: 0; font-size: 14px; font-weight: 600; color: var(--text); }
.ab-track-title small { display: block; font-size: 11px; font-weight: 500; color: var(--text-mute); margin-top: 2px; }
.ab-track-dur { font-size: 12px; color: var(--text-mute); font-weight: 600; font-variant-numeric: tabular-nums; }

/* ============ THE PLAYER ============ */
.player-page {
    min-height: 100vh;
    background: #14100D;
    color: rgba(255, 255, 255, 0.9);
    position: relative;
    overflow-x: hidden;
}
.player-backdrop {
    position: fixed;
    inset: 0;
    background-size: cover;
    background-position: center;
    filter: blur(70px) saturate(150%);
    transform: scale(1.25);
    opacity: 0.34;
    z-index: 0;
}
.player-backdrop-fallback {
    position: fixed;
    inset: 0;
    background:
        radial-gradient(circle at 22% 18%, rgba(15, 118, 110, 0.55) 0%, transparent 55%),
        radial-gradient(circle at 78% 78%, rgba(124, 58, 237, 0.42) 0%, transparent 55%),
        radial-gradient(circle at 55% 45%, rgba(212, 160, 23, 0.2) 0%, transparent 60%);
    z-index: 0;
}
.player-veil {
    position: fixed;
    inset: 0;
    background: linear-gradient(180deg, rgba(20, 16, 13, 0.68) 0%, rgba(20, 16, 13, 0.9) 55%, #14100D 100%);
    z-index: 1;
}
.player-shell {
    position: relative;
    z-index: 2;
    max-width: 1120px;
    margin: 0 auto;
    padding: 20px 24px 60px;
}

.player-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 34px;
}
.player-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 16px;
    border-radius: var(--r-full);
    background: rgba(255, 255, 255, 0.09);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    transition: background 0.15s;
}
.player-back:hover { background: rgba(255, 255, 255, 0.16); }
.player-top-actions { display: flex; gap: 8px; }
.player-icon-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.09);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: rgba(255, 255, 255, 0.85);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s;
    padding: 0;
    text-decoration: none;
}
.player-icon-btn:hover { background: rgba(255, 255, 255, 0.18); color: #fff; }
.player-icon-btn.active { background: var(--gold); border-color: var(--gold); color: #14100D; }

.player-main {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 380px;
    gap: 48px;
    align-items: start;
}

/* Artwork */
.player-art-wrap {
    position: relative;
    width: min(340px, 100%);
    margin: 0 auto 30px;
}
.player-art {
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 22px;
    overflow: hidden;
    background: linear-gradient(150deg, #1F2937, #111827);
    box-shadow: 0 30px 70px -20px rgba(0, 0, 0, 0.85);
    position: relative;
    transition: transform 0.5s cubic-bezier(0.34, 1.3, 0.64, 1);
}
.player-art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.player-art-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 26px;
    text-align: center;
    color: rgba(255, 255, 255, 0.5);
    background:
        radial-gradient(circle at 35% 30%, rgba(15, 118, 110, 0.5), transparent 62%),
        linear-gradient(150deg, #1B2A2B, #10181C);
}
.player-art-placeholder .pl-title { font-size: 15px; font-weight: 700; color: rgba(255, 255, 255, 0.8); line-height: 1.35; }
.player-art-placeholder .pl-title.mr { font-family: var(--font-mr); }
.playing .player-art { transform: scale(1.02); }

/* Equaliser under the artwork */
.player-eq {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 4px;
    height: 26px;
    margin-top: 18px;
    opacity: 0.35;
    transition: opacity 0.3s;
}
.playing .player-eq { opacity: 1; }
.player-eq span {
    width: 4px;
    height: 6px;
    border-radius: 2px;
    background: var(--gold);
    transform-origin: bottom;
}
.playing .player-eq span { animation: eqBounce 1.1s ease-in-out infinite; }
.player-eq span:nth-child(1) { height: 14px; animation-delay: 0s; }
.player-eq span:nth-child(2) { height: 24px; animation-delay: 0.12s; }
.player-eq span:nth-child(3) { height: 10px; animation-delay: 0.24s; }
.player-eq span:nth-child(4) { height: 20px; animation-delay: 0.36s; }
.player-eq span:nth-child(5) { height: 16px; animation-delay: 0.48s; }
.player-eq span:nth-child(6) { height: 26px; animation-delay: 0.6s; }
.player-eq span:nth-child(7) { height: 12px; animation-delay: 0.72s; }
@keyframes eqBounce {
    0%, 100% { transform: scaleY(0.32); }
    50% { transform: scaleY(1); }
}

/* Titles */
.player-titles { text-align: center; margin-bottom: 26px; }
.player-titles .book-title {
    font-family: var(--font-serif);
    font-size: 26px;
    line-height: 1.2;
    color: #fff;
    margin-bottom: 6px;
}
.player-titles .book-title.mr { font-family: var(--font-mr); font-weight: 600; }
.player-titles .book-author { font-size: 14px; color: rgba(255, 255, 255, 0.6); margin-bottom: 14px; }
.player-titles .track-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--gold-light);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 15px;
    border-radius: var(--r-full);
    background: rgba(212, 160, 23, 0.13);
    border: 1px solid rgba(212, 160, 23, 0.25);
    max-width: 100%;
}
.player-titles .track-title span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Seek bar */
.player-seek { margin-bottom: 8px; }
.seek-track {
    position: relative;
    height: 22px;
    display: flex;
    align-items: center;
    cursor: pointer;
    touch-action: none;
}
.seek-rail {
    position: absolute;
    left: 0;
    right: 0;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.16);
    overflow: hidden;
}
.seek-buffered {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 0;
    background: rgba(255, 255, 255, 0.17);
}
.seek-fill {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 0;
    background: linear-gradient(90deg, var(--teal-light), var(--gold));
}
.seek-knob {
    position: absolute;
    top: 50%;
    left: 0;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.55);
    transform: translate(-50%, -50%) scale(0.75);
    transition: transform 0.15s;
    pointer-events: none;
}
.seek-track:hover .seek-knob, .seek-track.dragging .seek-knob { transform: translate(-50%, -50%) scale(1); }
.seek-times {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    color: rgba(255, 255, 255, 0.6);
    font-weight: 600;
    margin-bottom: 22px;
}

/* Transport */
.player-transport {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-bottom: 26px;
}
.tp-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.82);
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: color 0.15s, transform 0.15s, background 0.15s;
}
.tp-btn:hover { color: #fff; background: rgba(255, 255, 255, 0.09); }
.tp-btn:active { transform: scale(0.9); }
.tp-btn:disabled { opacity: 0.28; cursor: not-allowed; }
.tp-btn:disabled:hover { background: none; color: rgba(255, 255, 255, 0.82); }
.tp-skip { position: relative; }
.tp-skip .tp-skip-num {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -42%);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: -0.02em;
    pointer-events: none;
}
.tp-play {
    width: 74px;
    height: 74px;
    border-radius: 50%;
    background: #fff;
    color: #14100D;
    box-shadow: 0 12px 32px -10px rgba(255, 255, 255, 0.55);
}
.tp-play:hover { background: #fff; color: #14100D; transform: scale(1.04); }
.tp-play svg { margin-left: 3px; }
.tp-play.is-playing svg { margin-left: 0; }
.tp-play.loading {
    pointer-events: none;
    background: rgba(255, 255, 255, 0.25);
}
.tp-play.loading::after {
    content: '';
    position: absolute;
    inset: 8px;
    border-radius: 50%;
    border: 3px solid rgba(20, 16, 13, 0.2);
    border-top-color: #14100D;
    animation: tpSpin 0.8s linear infinite;
}
.tp-play.loading svg { opacity: 0; }
@keyframes tpSpin { to { transform: rotate(360deg); } }

/* Secondary controls */
.player-tools {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
}
.tool-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 15px;
    border-radius: var(--r-full);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.13);
    color: rgba(255, 255, 255, 0.82);
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}
.tool-btn:hover { background: rgba(255, 255, 255, 0.16); color: #fff; }
.tool-btn.active {
    background: rgba(212, 160, 23, 0.2);
    border-color: rgba(212, 160, 23, 0.45);
    color: var(--gold-light);
}
.player-volume {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 7px 15px 7px 11px;
    border-radius: var(--r-full);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.13);
}
.player-volume input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 86px;
    height: 4px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.25);
    outline: none;
}
.player-volume input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
}
.player-volume input[type="range"]::-moz-range-thumb {
    width: 13px;
    height: 13px;
    border: none;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
}
.player-volume button { background: none; border: none; color: rgba(255, 255, 255, 0.8); cursor: pointer; display: flex; padding: 0; }

/* Playlist */
.player-playlist {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--r-lg);
    overflow: hidden;
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}
.player-playlist-head {
    padding: 18px 20px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.09);
}
.player-playlist-head h3 {
    font-family: var(--font-serif);
    font-size: 17px;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 9px;
    margin-bottom: 4px;
}
.player-playlist-head small { font-size: 11px; color: rgba(255, 255, 255, 0.5); font-weight: 600; }
.player-playlist-body { max-height: 480px; overflow-y: auto; }
.player-playlist-body::-webkit-scrollbar { width: 6px; }
.player-playlist-body::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.2); border-radius: 3px; }
.pl-item {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 12px 20px;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: background 0.15s;
    background: none;
    border-left: none;
    border-right: none;
    border-top: none;
    width: 100%;
    text-align: left;
    font-family: inherit;
    color: inherit;
}
.pl-item:last-child { border-bottom: none; }
.pl-item:hover { background: rgba(255, 255, 255, 0.07); }
.pl-item.current { background: rgba(212, 160, 23, 0.13); }
.pl-item-num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.65);
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.pl-item.current .pl-item-num { background: var(--gold); color: #14100D; }
.pl-item.done .pl-item-num { background: rgba(21, 128, 61, 0.35); color: #86EFAC; }
.pl-item-text { flex: 1; min-width: 0; }
.pl-item-text strong {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.pl-item.current .pl-item-text strong { color: var(--gold-light); }
.pl-item-text small { font-size: 10px; color: rgba(255, 255, 255, 0.42); font-weight: 600; }
.pl-item-dur {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.45);
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    flex-shrink: 0;
}

/* Sleep timer sheet */
.sheet-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(5px);
    z-index: 120;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.sheet-backdrop.open { display: flex; }
.sheet {
    background: #1E1915;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--r-lg);
    width: 100%;
    max-width: 340px;
    padding: 24px 22px;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.6);
    animation: sheetIn 0.28s cubic-bezier(0.34, 1.5, 0.64, 1);
}
@keyframes sheetIn { from { opacity: 0; transform: translateY(20px) scale(0.96); } to { opacity: 1; transform: none; } }
.sheet h4 {
    font-family: var(--font-serif);
    font-size: 19px;
    color: #fff;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 9px;
}
.sheet p { font-size: 12px; color: rgba(255, 255, 255, 0.5); margin-bottom: 18px; }
.sheet-options { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.sheet-options button {
    padding: 12px 10px;
    border-radius: var(--r-sm);
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.85);
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s;
}
.sheet-options button:hover { background: rgba(255, 255, 255, 0.14); }
.sheet-options button.wide { grid-column: 1 / -1; }
.sheet-options button.danger { background: rgba(185, 28, 28, 0.2); border-color: rgba(185, 28, 28, 0.4); color: #FCA5A5; }

/* Resume toast */
.resume-toast {
    position: fixed;
    left: 50%;
    bottom: 26px;
    transform: translate(-50%, 130%);
    z-index: 115;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 13px 16px 13px 18px;
    border-radius: var(--r-full);
    background: rgba(30, 25, 21, 0.97);
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: 0 16px 44px -12px rgba(0, 0, 0, 0.8);
    max-width: calc(100% - 32px);
    transition: transform 0.4s cubic-bezier(0.34, 1.4, 0.64, 1);
}
.resume-toast.show { transform: translate(-50%, 0); }
.resume-toast span { font-size: 13px; color: rgba(255, 255, 255, 0.85); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.resume-toast button {
    background: var(--gold);
    border: none;
    color: #14100D;
    padding: 8px 16px;
    border-radius: var(--r-full);
    font-family: inherit;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
    flex-shrink: 0;
}
.resume-toast .dismiss {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.65);
    padding: 8px 12px;
}

/* Small helper toast */
.mini-toast {
    position: fixed;
    left: 50%;
    top: 22px;
    transform: translate(-50%, -150%);
    z-index: 130;
    padding: 10px 20px;
    border-radius: var(--r-full);
    background: rgba(30, 25, 21, 0.97);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    transition: transform 0.3s cubic-bezier(0.34, 1.4, 0.64, 1);
    box-shadow: 0 12px 30px -10px rgba(0, 0, 0, 0.7);
}
.mini-toast.show { transform: translate(-50%, 0); }

/* ============ ADMIN: track rows ============ */
.track-rows { display: flex; flex-direction: column; gap: 12px; }
.track-row {
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    background: var(--paper-warm);
    padding: 14px 16px;
}
.track-row-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}
.track-row-badge {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--teal);
    color: var(--white);
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.track-row-head strong { font-size: 13px; color: var(--text); flex: 1; }
.track-row-remove {
    background: var(--danger-bg);
    border: 1px solid #FECACA;
    color: var(--danger);
    width: 30px;
    height: 30px;
    border-radius: var(--r-sm);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}
.track-row-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 12px; }
.src-toggle {
    display: flex;
    gap: 5px;
    background: var(--white);
    padding: 4px;
    border-radius: 10px;
    border: 1px solid var(--border);
    margin-bottom: 10px;
}
.src-toggle label { flex: 1; cursor: pointer; }
.src-toggle label input { display: none; }
.src-toggle .src-pill {
    padding: 8px 10px;
    border-radius: 7px;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-mute);
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.18s;
}
.src-toggle label input:checked + .src-pill {
    background: var(--teal-bg);
    color: var(--teal-dark);
    box-shadow: inset 0 0 0 1px var(--teal-pale);
}
.dur-hint {
    font-size: 11px;
    color: var(--teal);
    font-weight: 700;
    margin-top: 6px;
    display: none;
}
.dur-hint.show { display: block; }

/* Admin: the title / order / duration row on the edit screen */
.track-edit-grid {
    display: grid;
    grid-template-columns: 2fr 90px 130px;
    gap: 10px;
    align-items: end;
}

/* ============ RESPONSIVE ============ */
@media (max-width: 980px) {
    .player-main { grid-template-columns: 1fr; gap: 30px; }
    .player-playlist-body { max-height: none; }
    .ab-detail { grid-template-columns: 1fr; gap: 26px; }
    .ab-detail-art { max-width: 280px; margin: 0 auto; }
}

@media (max-width: 768px) {
    .audio-hero { padding: 30px 22px; border-radius: var(--r-md); }
    .audio-hero h2 { font-size: 26px; }
    .audio-hero p { font-size: 13.5px; }
    .audio-hero-wave { display: none; }
    .audio-hero-search { flex-direction: column; }
    .audio-hero-search button { justify-content: center; }

    .audio-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
    .audio-card-body { padding: 11px 12px 13px; }
    .audio-card h3 { font-size: 13.5px; }
    .audio-card .narrator { font-size: 11px; }

    .continue-card { width: 250px; }

    .ab-detail h1 { font-size: 26px; }
    .ab-credits { gap: 16px; }

    .player-shell { padding: 14px 16px 110px; }
    .player-art-wrap { width: min(260px, 74%); margin-bottom: 22px; }
    .player-titles .book-title { font-size: 21px; }
    .player-transport { gap: 12px; }
    .tp-play { width: 66px; height: 66px; }
    .player-volume { display: none; }
    .player-tools { gap: 8px; }
    .tool-btn { padding: 8px 13px; font-size: 11.5px; }

    .track-row-grid { grid-template-columns: 1fr; }
    .track-edit-grid { grid-template-columns: 1fr 1fr; }
    .track-edit-grid > div:first-child { grid-column: 1 / -1; }

    /* Admin audiobook detail: art column sits above the content */
    .ab-admin-split { grid-template-columns: 1fr !important; }

    /* Player: playlist gets room to breathe */
    .player-playlist-head { padding: 15px 16px 12px; }
    .pl-item { padding: 12px 16px; }
}

@media (max-width: 420px) {
    .audio-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
    .player-transport { gap: 8px; }
}
