/*! mod_audioplayer — стили плеера (общие для всех экземпляров, кэшируются браузером).
   Раньше селекторы были вида #ap112 …; здесь #ap-spec внутри :is() держит ту же специфичность ID,
   поэтому каскад такой же, как у встроенного <style>. Акцентный цвет задаёт шаблон (:root --ap-accent). */
:is(#ap-spec,.ap-player) {
    --bg: linear-gradient(135deg, #0f0a1a 0%, #1a1028 40%, #12081f 100%);
    --bass: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    max-width: 480px; margin: 0 auto; border-radius: 28px; overflow: hidden;
    background: var(--bg); color: #fff; position: relative;
    box-shadow: 0 25px 60px rgba(0,0,0,.6), 0 0 calc(80px + var(--bass) * 60px) var(--ap-glow), inset 0 1px 0 rgba(255,255,255,.06);
    transition: --ap-accent .6s, --ap-glow .6s;
}
:is(#ap-spec,.ap-player) .ap-controls, :is(#ap-spec,.ap-player) .ap-toolbar, :is(#ap-spec,.ap-player) .ap-vinyl-wrap, :is(#ap-spec,.ap-player) .ap-arm { user-select: none; }
:is(#ap-spec,.ap-player) * { box-sizing: border-box; }

/* ── Ambient glow blobs ── */
.ap-ambient { position:absolute; inset:0; overflow:hidden; pointer-events:none; z-index:0; border-radius:28px; }
.ap-ambient i { position:absolute; border-radius:50%; filter:blur(80px); opacity:.25; animation: apFloat 8s ease-in-out infinite alternate; }
.ap-ambient i:nth-child(1) { width:200px; height:200px; background:var(--ap-accent); top:-40px; left:-40px; }
.ap-ambient i:nth-child(2) { width:160px; height:160px; background:#06b6d4; bottom:-30px; right:-30px; animation-delay:-4s; }
.ap-ambient i:nth-child(3) { width:120px; height:120px; background:#ec4899; top:50%; left:60%; animation-delay:-2s; }
@keyframes apFloat { to { transform: translate(30px,20px) scale(1.15); } }

/* ── Blur cover background (Apple Music style) ── */
.ap-bg-cover { position:absolute; inset:-40px; background-size:cover; background-position:center;
    filter: blur(60px) saturate(1.4); opacity:0; transition: opacity 1.2s, background-image .3s;
    z-index:0; pointer-events:none; transform:scale(1.2); }
.ap-bg-cover.loaded { opacity:.45; }

.ap-inner { position: relative; z-index: 1; padding: 28px 24px 20px; }

/* ── Vinyl + Visualizer ── */
.ap-stage { display:flex; align-items:center; justify-content:center; margin-bottom:24px; position:relative; height:220px; }

.ap-vinyl-wrap { position:relative; width:200px; height:200px;
    transform: scale(calc(1 + var(--bass) * 0.04)); transition: transform .08s ease-out; will-change: transform; }
.ap-vinyl { width:200px; height:200px; border-radius:50%; position:relative;
    background: repeating-radial-gradient(circle at center, #111 0px, #1a1a2e 2px, #111 4px);
    box-shadow: 0 0 30px rgba(0,0,0,.5), inset 0 0 40px rgba(0,0,0,.4);
    animation: apSpin 3s linear infinite; animation-play-state: paused;
    will-change: transform;
}
.ap-vinyl.spinning { animation-play-state: running; }
@keyframes apSpin { to { transform: rotate(360deg); } }

/* ── Cover art on vinyl ── */
.ap-cover { position:absolute; top:50%; left:50%; width:110px; height:110px; margin:-55px 0 0 -55px;
    border-radius:50%; object-fit:cover; z-index:1; opacity:0; transition:opacity .5s;
    box-shadow: inset 0 0 0 2px rgba(0,0,0,.4), 0 0 15px rgba(0,0,0,.5); }
.ap-cover.loaded { opacity:1; }

.ap-vinyl::after { content:''; position:absolute; top:50%; left:50%; width:60px; height:60px;
    margin:-30px 0 0 -30px; border-radius:50%;
    background: radial-gradient(circle, var(--ap-accent) 0%, #1a1028 60%, transparent 70%);
    box-shadow: 0 0 15px var(--ap-glow);
}
.ap-vinyl-label { position:absolute; top:50%; left:50%; transform:translate(-50%,-50%);
    width:24px; height:24px; border-radius:50%; background:#0f0a1a;
    border:2px solid var(--ap-accent); z-index:2; }

/* Tonearm */
.ap-arm { position:absolute; top:-15px; right:-15px; width:60px; height:120px; z-index:3;
    transform-origin: top right; transform: rotate(-28deg); transition: transform .6s cubic-bezier(.4,0,.2,1); }
.ap-arm.playing { transform: rotate(-8deg); }
.ap-arm svg { width:100%; height:100%; filter: drop-shadow(0 2px 8px rgba(0,0,0,.5)); }

/* Visualizer bars behind vinyl */
.ap-viz { position:absolute; bottom:0; left:50%; transform:translateX(-50%); display:flex;
    gap:3px; align-items:flex-end; height:80px; z-index:0; opacity:.6; }
.ap-viz span { width:4px; border-radius:2px; background: linear-gradient(to top, var(--ap-accent), #06b6d4);
    transition: height .08s ease; min-height:3px; }

/* ── Track Info ── */
.ap-info { text-align:center; margin-bottom:20px; }
.ap-title { font-size:1.2em; font-weight:700; margin:0 0 4px; white-space:nowrap; overflow:hidden;
    background: linear-gradient(90deg,#fff 0%,#fff 33%,transparent 100%);
    -webkit-background-clip:text; background-clip:text; }
.ap-title.scrolling span { display:inline-block; animation: apScroll 8s linear infinite; }
@keyframes apScroll { 0%,10%{transform:translateX(0)} 90%,100%{transform:translateX(var(--scroll-dist))} }
.ap-artist { font-size:.85em; color:rgba(255,255,255,.5); margin:0; }

/* ── Progress ── */
.ap-progress { margin-bottom:16px; }
.ap-bar-wrap { width:100%; height:6px; background:rgba(255,255,255,.08); border-radius:3px;
    cursor:pointer; position:relative; overflow:visible; }
.ap-bar-fill { height:100%; border-radius:3px; width:0%;
    background: linear-gradient(90deg, var(--ap-accent), #06b6d4);
    position:relative; transition: width .1s linear; }
.ap-bar-fill::after { content:''; position:absolute; right:-6px; top:-3px; width:12px; height:12px;
    border-radius:50%; background:#fff; box-shadow:0 0 10px var(--ap-glow); opacity:0; transition:opacity .2s; }
.ap-bar-wrap:hover .ap-bar-fill::after { opacity:1; }
.ap-times { display:flex; justify-content:space-between; font-size:.7em; color:rgba(255,255,255,.35); margin-top:4px; }

/* ── Controls ── */
.ap-controls { display:flex; align-items:center; justify-content:center; gap:16px; margin-bottom:18px; }
.ap-btn { background:none; border:none; color:rgba(255,255,255,.6); cursor:pointer; padding:8px;
    transition: all .2s; display:flex; align-items:center; justify-content:center; border-radius:50%; }
.ap-btn:hover { color:#fff; background:rgba(255,255,255,.08); }
.ap-btn.active { color:var(--ap-accent); }
.ap-btn svg { width:20px; height:20px; fill:currentColor; }
.ap-play { width:56px; height:56px; border-radius:50%; border:none; cursor:pointer;
    background: linear-gradient(135deg, var(--ap-accent), #7c3aed);
    color:#fff; display:flex; align-items:center; justify-content:center;
    box-shadow: 0 4px 20px var(--ap-glow); transition: all .2s; }
.ap-play:hover { transform:scale(1.08); box-shadow: 0 6px 30px var(--ap-glow); }
.ap-play svg { width:24px; height:24px; fill:#fff; margin-left:2px; }
.ap-play.is-playing svg { margin-left:0; }

/* ── Volume ── */
.ap-vol { display:flex; align-items:center; gap:8px; margin-bottom:18px; padding:0 12px; }
.ap-vol svg { width:16px; height:16px; fill:rgba(255,255,255,.4); flex-shrink:0; cursor:pointer; }
.ap-vol-bar { flex:1; height:4px; background:rgba(255,255,255,.08); border-radius:2px; cursor:pointer; position:relative; }
.ap-vol-fill { height:100%; border-radius:2px; background:var(--ap-accent); width:80%; }

/* ── Playlist ── */
.ap-playlist-toggle { display:flex; justify-content:center; }
.ap-playlist-toggle button { background:none; border:none; color:rgba(255,255,255,.4); font-size:.75em;
    cursor:pointer; padding:4px 16px; letter-spacing:.05em; text-transform:uppercase; transition:color .2s; }
.ap-playlist-toggle button:hover { color:var(--ap-accent); }

.ap-playlist { max-height:0; overflow:hidden; transition: max-height .4s cubic-bezier(.4,0,.2,1); }
.ap-playlist.open { max-height:300px; overflow-y:auto; }
.ap-playlist::-webkit-scrollbar { width:4px; } .ap-playlist::-webkit-scrollbar-thumb { background:var(--ap-accent); border-radius:2px; }

.ap-track { display:flex; align-items:center; gap:12px; padding:10px 12px; border-radius:10px;
    cursor:pointer; transition: background .2s; }
.ap-track:hover { background:rgba(255,255,255,.05); }
.ap-track.active { background:rgba(255,255,255,.08); }
.ap-track-num { font-size:.75em; color:rgba(255,255,255,.25); width:20px; text-align:center; }
.ap-track.active .ap-track-num { color:var(--ap-accent); }
.ap-track-eq { display:none; gap:2px; align-items:flex-end; height:14px; }
.ap-track.active .ap-track-eq { display:flex; }
.ap-track.active .ap-track-num span { display:none; }
.ap-track-eq i { width:3px; background:var(--ap-accent); border-radius:1px; animation: apEq .6s ease infinite alternate; }
.ap-track-eq i:nth-child(2) { animation-delay:.2s; } .ap-track-eq i:nth-child(3) { animation-delay:.4s; }
@keyframes apEq { from{height:3px} to{height:14px} }
.ap-track-info { flex:1; min-width:0; }
.ap-track-title { font-size:.85em; font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.ap-track-artist { font-size:.7em; color:rgba(255,255,255,.35); }
.ap-track-dl { flex:none; width:30px; height:30px; padding:0; border:none; background:none; cursor:pointer;
    color:rgba(255,255,255,.3); display:flex; align-items:center; justify-content:center; border-radius:8px; transition:.15s; }
.ap-track-dl:hover { color:#fff; background:rgba(255,255,255,.08); }
.ap-track-dl svg { width:16px; height:16px; }
.ap-track-dl.done { color:var(--ap-accent); }
.ap-track-dl.busy { color:var(--ap-accent); animation:apDlPulse 1s ease infinite; pointer-events:none; }
@keyframes apDlPulse { 0%,100%{opacity:.4} 50%{opacity:1} }
.ap-plsearch { display:flex; gap:8px; align-items:center; flex-wrap:wrap; padding:8px 10px 10px; position:sticky; top:0; z-index:2;
    background:rgba(18,18,28,.85); backdrop-filter:blur(8px); border-radius:10px; margin-bottom:4px; }
.ap-pltype { display:flex; gap:4px; width:100%; }
.ap-pltype button { flex:1; background:rgba(255,255,255,.05); border:1px solid rgba(255,255,255,.1); color:rgba(255,255,255,.5);
    font-size:.72em; padding:5px 4px; border-radius:8px; cursor:pointer; transition:.15s; white-space:nowrap; }
.ap-pltype button:hover { color:#fff; }
.ap-pltype button.active { background:var(--ap-accent); border-color:var(--ap-accent); color:#fff; }
.ap-plgroup { display:flex; align-items:center; gap:8px; padding:9px 12px 4px; font-size:.68em; letter-spacing:.09em;
    text-transform:uppercase; color:rgba(255,255,255,.42); font-weight:700; }
.ap-plgroup .c { margin-left:auto; color:rgba(255,255,255,.28); font-weight:600; letter-spacing:0; }
.ap-track-type { flex:none; font-size:.78em; line-height:1; opacity:.75; width:16px; text-align:center; }
.ap-upbtn { display:block; width:100%; text-align:center; margin-top:2px; background:rgba(255,255,255,.05);
    border:1px dashed rgba(255,255,255,.18); color:rgba(255,255,255,.6); font-size:.74em; padding:7px 8px;
    border-radius:8px; cursor:pointer; transition:.15s; }
.ap-upbtn:hover { color:#fff; border-color:var(--ap-accent); background:rgba(255,255,255,.08); }
.ap-drop { position:absolute; inset:0; z-index:60; display:none; align-items:center; justify-content:center;
    background:rgba(12,8,20,.82); backdrop-filter:blur(4px); border:2px dashed var(--ap-accent); border-radius:24px;
    pointer-events:none; }
.ap-drop.on { display:flex; }
.ap-drop-in { text-align:center; color:#fff; font-size:1.2em; font-weight:700; line-height:1.5; }
.ap-drop-in small { display:block; font-size:.6em; font-weight:500; color:rgba(255,255,255,.6); margin-top:4px; }
.ap-plsearch input { flex:1; min-width:0; background:rgba(255,255,255,.07); border:1px solid rgba(255,255,255,.12);
    border-radius:8px; color:inherit; padding:7px 10px; font-size:.8em; outline:none; }
.ap-plsearch input:focus { border-color:var(--ap-accent); }
.ap-plsearch select { background:rgba(255,255,255,.07); border:1px solid rgba(255,255,255,.12); border-radius:8px;
    color:inherit; padding:7px 8px; font-size:.75em; outline:none; cursor:pointer; }
.ap-plsearch select option { color:#000; }
.ap-plcount { font-size:.7em; color:rgba(255,255,255,.4); white-space:nowrap; }
.ap-abrange { position:absolute; top:0; bottom:0; background:rgba(255,200,60,.28); border-left:2px solid rgba(255,200,60,.9);
    border-right:2px solid rgba(255,200,60,.9); pointer-events:none; display:none; border-radius:4px; }
.ap-bmdot { position:absolute; top:50%; width:8px; height:8px; margin:-4px 0 0 -4px; border-radius:50%;
    background:var(--ap-accent); box-shadow:0 0 0 2px rgba(0,0,0,.35); cursor:pointer; z-index:3; }
.ap-bmpanel { display:none; position:fixed; inset:0; z-index:99998; background:rgba(0,0,0,.55); backdrop-filter:blur(4px);
    align-items:center; justify-content:center; }
.ap-bmpanel.active { display:flex; }
.ap-bmcard { background:rgba(24,24,36,.97); border:1px solid rgba(255,255,255,.12); border-radius:14px; padding:18px 22px;
    max-width:420px; width:92%; max-height:70vh; overflow:auto; color:#fff; }
.ap-bmcard h4 { margin:0 0 10px; font-size:.95em; }
.ap-bmrow { display:flex; align-items:center; gap:10px; padding:7px 6px; border-radius:8px; cursor:pointer; font-size:.85em; }
.ap-bmrow:hover { background:rgba(255,255,255,.07); }
.ap-bmrow .t { color:var(--ap-accent); font-variant-numeric:tabular-nums; min-width:52px; }
.ap-bmrow .x { margin-left:auto; opacity:.5; padding:2px 8px; }
.ap-bmrow .x:hover { opacity:1; color:#ff7b7b; }
.ap-bmempty { opacity:.5; font-size:.8em; padding:6px; }
.ap-lrced { display:none; position:fixed; inset:0; z-index:99998; background:rgba(0,0,0,.6); backdrop-filter:blur(5px);
    align-items:center; justify-content:center; }
.ap-lrced.active { display:flex; }
.ap-lrced-card { background:rgba(22,22,34,.98); border:1px solid rgba(255,255,255,.12); border-radius:14px; padding:16px 18px;
    width:94%; max-width:560px; max-height:82vh; display:flex; flex-direction:column; color:#fff; }
.ap-lrced-card h4 { margin:0 0 4px; font-size:.95em; }
.ap-lrced-hint { font-size:.72em; opacity:.55; margin-bottom:10px; }
.ap-lrced-lines { flex:1; overflow-y:auto; margin:0 -6px; }
.ap-lrced-line { display:flex; gap:8px; align-items:center; padding:5px 6px; border-radius:8px; font-size:.85em; cursor:pointer; }
.ap-lrced-line:hover { background:rgba(255,255,255,.06); }
.ap-lrced-line.stamped { background:rgba(120,200,120,.08); }
.ap-lrced-line .ts { min-width:60px; font-variant-numeric:tabular-nums; color:var(--ap-accent); font-size:.9em; }
.ap-lrced-line .ts.empty { color:rgba(255,255,255,.25); }
.ap-lrced-line .tx { flex:1; }
.ap-lrced-tools { display:flex; gap:8px; margin-top:12px; flex-wrap:wrap; }
.ap-lrced-tools button, .ap-lrced-tools label { background:rgba(255,255,255,.08); border:1px solid rgba(255,255,255,.14);
    border-radius:8px; color:#fff; padding:7px 12px; font-size:.78em; cursor:pointer; }
.ap-lrced-tools button.primary { background:var(--ap-accent); border-color:transparent; }
.ap-lrced textarea { width:100%; box-sizing:border-box; height:120px; background:rgba(255,255,255,.06);
    border:1px solid rgba(255,255,255,.14); border-radius:8px; color:#fff; padding:8px; font-size:.8em; resize:vertical; }
.ap-jsonbtns { display:flex; gap:8px; margin-top:6px; }
.ap-jsonbtns .ap-eq-btn { flex:1; }
@keyframes apCprPulse { 0%{transform:scale(1);opacity:1} 50%{transform:scale(1.7);opacity:.4} 100%{transform:scale(1);opacity:1} }
.ap-hkhelp { display:none; position:fixed; inset:0; z-index:99998; background:rgba(0,0,0,.55); backdrop-filter:blur(4px);
    align-items:center; justify-content:center; }
.ap-hkhelp.active { display:flex; }
.ap-hkcard { background:rgba(24,24,36,.97); border:1px solid rgba(255,255,255,.14); border-radius:14px;
    padding:18px 22px; max-width:340px; width:90%; box-shadow:0 20px 60px rgba(0,0,0,.5); }
.ap-hkcard h4 { margin:0 0 12px; font-size:.95em; }
.ap-hkcard table { width:100%; border-collapse:collapse; font-size:.8em; }
.ap-hkcard td { padding:4px 6px; color:rgba(255,255,255,.75); }
.ap-hkcard td:first-child { white-space:nowrap; }
.ap-hkcard kbd { background:rgba(255,255,255,.1); border:1px solid rgba(255,255,255,.18); border-bottom-width:2px;
    border-radius:6px; padding:2px 7px; font-size:.9em; font-family:inherit; }

/* ── Particles ── */
.ap-particles { position:absolute; inset:0; pointer-events:none; z-index:0; overflow:hidden; border-radius:28px; }
.ap-particle { position:absolute; width:3px; height:3px; background:var(--ap-accent); border-radius:50%;
    opacity:0; animation: apParticle 4s ease-in-out infinite; }
@keyframes apParticle { 0%{opacity:0;transform:translateY(100px)} 50%{opacity:.6} 100%{opacity:0;transform:translateY(-200px)} }

/* ── Waveform ── */
.ap-waveform { width:100%; height:40px; cursor:pointer; display:block; margin-bottom:6px; }
.ap-waveform.hidden { display:none; }

/* ── Toolbar (speed / eq / lyrics / sleep / share) ── */
.ap-toolbar { display:flex; align-items:center; justify-content:space-between; gap:4px;
    flex-wrap: wrap; row-gap: 6px;
    padding:8px 6px; margin-bottom:10px; border-top:1px solid rgba(255,255,255,.06);
    border-bottom:1px solid rgba(255,255,255,.06); }
@media (max-width: 520px) {
    .ap-toolbar { justify-content: center; gap: 6px; padding: 10px 6px; }
    .ap-toolbar .ap-tb { padding: 6px 10px; font-size: .72em; }
    .ap-toolbar .ap-settings-wrap { order: 99; }
}
.ap-toolbar .ap-tb { background:none; border:none; color:rgba(255,255,255,.5); font-size:.7em;
    cursor:pointer; padding:6px 8px; border-radius:8px; display:flex; align-items:center; gap:4px;
    transition: all .2s; letter-spacing:.03em; text-transform:uppercase; font-weight:600; }
.ap-toolbar .ap-tb:hover { color:#fff; background:rgba(255,255,255,.06); }
.ap-toolbar .ap-tb.active { color:var(--ap-accent); background:var(--ap-glow); }
.ap-toolbar .ap-tb svg { width:14px; height:14px; fill:currentColor; }
.ap-tb-spd { display:flex; align-items:center; gap:2px; }
.ap-tb-spd button { background:none; border:none; color:inherit; cursor:pointer; padding:2px 6px;
    font-size:1em; font-weight:700; border-radius:4px; }
.ap-tb-spd button:hover { background:rgba(255,255,255,.08); }
.ap-tb-spd span { min-width:36px; text-align:center; font-variant-numeric: tabular-nums; }

/* ── EQ panel ── */
.ap-eq-panel { max-height:0; overflow:hidden; transition:max-height .3s; display:flex; gap:6px;
    padding:0 6px; justify-content:center; flex-wrap:wrap; }
.ap-eq-panel.open { max-height:80px; padding:8px 6px 12px; }
.ap-eq-btn { background:rgba(255,255,255,.04); border:1px solid rgba(255,255,255,.08); color:rgba(255,255,255,.6);
    padding:6px 12px; border-radius:20px; font-size:.7em; cursor:pointer; letter-spacing:.05em;
    text-transform:uppercase; font-weight:600; transition:all .2s; }
.ap-eq-btn:hover { color:#fff; border-color:var(--ap-accent); }
.ap-eq-btn.active { background:var(--ap-accent); color:#fff; border-color:transparent;
    box-shadow:0 0 12px var(--ap-glow); }

/* ── Lyrics ── */
.ap-lyrics { max-height:0; overflow:hidden; transition:max-height .4s; text-align:center;
    font-size:.9em; line-height:1.8; color:rgba(255,255,255,.4); }
.ap-lyrics.open.has-lyrics { max-height:200px; overflow-y:auto; padding:10px 12px; }
.ap-lyrics::-webkit-scrollbar { width:3px; } .ap-lyrics::-webkit-scrollbar-thumb { background:var(--ap-accent); }
.ap-lyrics p { margin:0; padding:2px 0; transition:all .3s; }
.ap-lyrics p.active { color:#fff; font-weight:600; font-size:1.1em; text-shadow:0 0 20px var(--ap-glow); }
.ap-lyrics.plain-lyrics p { color:rgba(255,255,255,.7); padding:4px 0; }
.ap-lyrics.plain-lyrics { text-align:center; }
.ap-lyrics.no-lyrics-msg::before { content:'No synced lyrics for this track'; color:rgba(255,255,255,.3); font-size:.75em; }

/* ── Sleep badge ── */
.ap-sleep-badge { position:absolute; top:14px; right:14px; background:var(--ap-accent); color:#fff;
    font-size:.65em; padding:4px 10px; border-radius:12px; font-weight:700; z-index:5; display:none;
    animation: apPulse 2s ease-in-out infinite; }
.ap-sleep-badge.active { display:block; }
@keyframes apPulse { 50% { box-shadow: 0 0 20px var(--ap-glow); } }

/* ── Mini player (fixed floating) ── */
.ap-mini { position:fixed; bottom:20px; right:20px; width:280px; padding:10px 14px; border-radius:16px;
    background: linear-gradient(135deg, rgba(15,10,26,.95), rgba(26,16,40,.95));
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 20px 50px rgba(0,0,0,.5), 0 0 40px var(--ap-glow), inset 0 1px 0 rgba(255,255,255,.08);
    display:none; align-items:center; gap:10px; z-index:9999; color:#fff;
    font-family: 'Inter', -apple-system, sans-serif;
    transform:translateY(100px); opacity:0; transition: transform .4s cubic-bezier(.4,0,.2,1), opacity .3s; }
.ap-mini.visible { display:flex; transform:translateY(0); opacity:1; }
.ap-mini-cover { width:40px; height:40px; border-radius:50%; background:var(--ap-accent); flex-shrink:0;
    background-size:cover; background-position:center; animation: apSpin 3s linear infinite;
    animation-play-state: paused; box-shadow:0 0 12px var(--ap-glow); }
.ap-mini-cover.spinning { animation-play-state: running; }
.ap-mini-info { flex:1; min-width:0; }
.ap-mini-title { font-size:.8em; font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.ap-mini-artist { font-size:.65em; color:rgba(255,255,255,.5); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.ap-mini button { background:none; border:none; color:#fff; cursor:pointer; padding:6px;
    border-radius:50%; display:flex; align-items:center; justify-content:center; }
.ap-mini button:hover { background:rgba(255,255,255,.1); }
.ap-mini button svg { width:18px; height:18px; fill:currentColor; }
.ap-mini-close { opacity:.5; } .ap-mini-close:hover { opacity:1; }
@media (max-width: 520px) { .ap-mini { left:10px; right:10px; width:auto; bottom:10px; } }

/* Hint for keyboard shortcuts */
.ap-hint { position:absolute; bottom:8px; left:50%; transform:translateX(-50%);
    font-size:.6em; color:rgba(255,255,255,.2); letter-spacing:.05em; text-transform:uppercase; }
.ap-hint:hover { color:rgba(255,255,255,.5); cursor:help; }

/* ── BPM badge ── */
.ap-bpm-badge { position:absolute; top:14px; left:14px; background:rgba(0,0,0,.5);
    color:#fff; font-size:.65em; padding:5px 10px; border-radius:12px; font-weight:700;
    z-index:5; display:none; letter-spacing:.05em; backdrop-filter: blur(8px);
    border:1px solid var(--ap-accent); }
.ap-bpm-badge.visible { display:block; }
.ap-bpm-badge .ap-bpm-num { color:var(--ap-accent); }

/* ── Car mode / Fullscreen ── */
.ap-car-overlay { position:fixed; inset:0; background:#000; z-index:99999; display:none;
    flex-direction:column; align-items:center; justify-content:space-between;
    padding:40px 20px; color:#fff; font-family: 'Inter', -apple-system, sans-serif;
    overflow:hidden; }
.ap-car-overlay.active { display:flex; }
.ap-car-overlay::before { content:''; position:absolute; inset:-50px; background-size:cover;
    background-position:center; background-image:var(--car-bg); filter:blur(100px) saturate(1.6) brightness(.5);
    z-index:0; transform:scale(1.3); transition: background-image .8s; }
.ap-car-overlay > * { position:relative; z-index:1; }
.ap-car-close { position:absolute; top:20px; right:20px; background:rgba(255,255,255,.1);
    border:none; color:#fff; width:44px; height:44px; border-radius:50%; cursor:pointer;
    display:flex; align-items:center; justify-content:center; z-index:2; }
.ap-car-close:hover { background:rgba(255,255,255,.2); }
.ap-car-close svg { width:20px; height:20px; fill:currentColor; }
.ap-car-clock { font-size:2.2em; font-weight:200; letter-spacing:.05em; font-variant-numeric: tabular-nums; opacity:.85; }
.ap-car-cover { width:min(70vmin,500px); height:min(70vmin,500px); border-radius:24px;
    background-size:cover; background-position:center;
    box-shadow: 0 30px 80px rgba(0,0,0,.6), 0 0 100px var(--ap-glow);
    transform: scale(calc(1 + var(--bass) * 0.03)); transition: transform .08s ease-out; }
.ap-car-info { text-align:center; max-width:90%; }
.ap-car-title { font-size:1.8em; font-weight:700; margin:0 0 8px; }
.ap-car-artist { font-size:1em; opacity:.6; margin:0; }
.ap-car-controls { display:flex; align-items:center; gap:24px; }
.ap-car-controls button { background:rgba(255,255,255,.08); border:none; color:#fff;
    width:56px; height:56px; border-radius:50%; cursor:pointer; display:flex;
    align-items:center; justify-content:center; backdrop-filter: blur(10px); transition:all .2s; }
.ap-car-controls button:hover { background:rgba(255,255,255,.18); transform:scale(1.08); }
.ap-car-controls button svg { width:24px; height:24px; fill:currentColor; }
.ap-car-controls .ap-car-play { width:80px; height:80px; background:var(--ap-accent); box-shadow:0 0 30px var(--ap-glow); }
.ap-car-controls .ap-car-play svg { width:32px; height:32px; }
.ap-car-progress { width:min(70vmin,500px); height:4px; background:rgba(255,255,255,.15);
    border-radius:2px; overflow:hidden; }
.ap-car-progress-fill { height:100%; background:var(--ap-accent); width:0%; transition:width .1s; }

/* ── Settings popup ── */
.ap-settings-popup { position:absolute; bottom:64px; right:16px; left:auto;
    min-width:220px; max-width:calc(100% - 32px);
    background:rgba(20,15,35,.98); backdrop-filter: blur(20px); border-radius:14px;
    border:1px solid rgba(255,255,255,.08); padding:10px; z-index:100;
    box-shadow: 0 20px 50px rgba(0,0,0,.6); opacity:0; pointer-events:none;
    transform:translateY(10px); transition: all .25s; }
.ap-settings-popup.open { opacity:1; pointer-events:auto; transform:translateY(0); }
.ap-setting-row { display:flex; align-items:center; justify-content:space-between;
    padding:8px 10px; border-radius:8px; cursor:pointer; font-size:.75em; }
.ap-setting-row:hover { background:rgba(255,255,255,.05); }
.ap-setting-row .ap-setting-label { display:flex; flex-direction:column; gap:2px; flex:1; }
.ap-setting-row .ap-setting-hint { font-size:.7em; opacity:.5; }
.ap-switch { width:32px; height:18px; background:rgba(255,255,255,.15); border-radius:9px;
    position:relative; flex-shrink:0; transition: background .2s; }
.ap-switch::after { content:''; position:absolute; top:2px; left:2px; width:14px; height:14px;
    background:#fff; border-radius:50%; transition: transform .2s; }
.ap-switch.on { background:var(--ap-accent); }
.ap-switch.on::after { transform: translateX(14px); }
.ap-settings-wrap { display:inline-flex; }

/* ── QR overlay ── */
.ap-qr-overlay { position:fixed; inset:0; background:rgba(0,0,0,.85); backdrop-filter: blur(10px);
    z-index:99998; display:none; align-items:center; justify-content:center; }
.ap-qr-overlay.active { display:flex; }
.ap-qr-box { background:#fff; padding:20px; border-radius:20px; text-align:center;
    max-width:90vw; box-shadow: 0 30px 80px rgba(0,0,0,.5); animation: apQrIn .3s ease; }
@keyframes apQrIn { from { transform:scale(.8); opacity:0; } }
.ap-qr-box canvas { display:block; margin:0 auto; border-radius:8px; }
.ap-qr-box h3 { margin:14px 0 4px; color:#111; font-size:1em; }
.ap-qr-box p { margin:0; color:#666; font-size:.75em; }
.ap-qr-close { margin-top:14px; background:#111; color:#fff; border:none; padding:10px 24px;
    border-radius:20px; cursor:pointer; font-size:.85em; font-weight:600; }

/* ── Spatial indicator ── */
.ap-spatial-indicator { position:absolute; top:14px; left:14px; width:32px; height:32px;
    background:var(--ap-accent); border-radius:50%; opacity:0; pointer-events:none;
    transform:translate(0,0); transition: opacity .3s; z-index:5;
    box-shadow: 0 0 20px var(--ap-glow); display:flex; align-items:center; justify-content:center;
    font-size:.7em; color:#fff; font-weight:700; }
.ap-spatial-indicator.visible { opacity:.8; }
.ap-bpm-badge.visible + .ap-spatial-indicator { top:54px; }

/* ── Medical visualizer (ECG / EchoCG / Holter / ECS) ── */
.ap-medviz-wrap { position:absolute; inset:0; z-index:2; pointer-events:none;
    opacity:0; transition: opacity .6s ease; border-radius:18px; overflow:hidden;
    background: linear-gradient(180deg, rgba(5,2,10,.88), rgba(15,8,25,.94));
    box-shadow: inset 0 0 30px rgba(239, 68, 68, .18); }
:is(#ap-spec,.ap-player).medviz-on .ap-medviz-wrap { opacity: 1; pointer-events: auto; }
:is(#ap-spec,.ap-player).medviz-on .ap-vinyl-wrap { opacity:.18; transform: scale(.42) translateX(30%); }
:is(#ap-spec,.ap-player).medviz-on .ap-viz { opacity: 0; }
:is(#ap-spec,.ap-player).medviz-on .ap-arm { opacity:.18; }
.ap-medviz-wrap canvas { display:block; width:100%; height:100%; cursor: pointer; }
.ap-medviz-snap { position:absolute; bottom:8px; right:10px; z-index:4; width:34px; height:34px; padding:0;
    border:1px solid rgba(255,255,255,.25); border-radius:9px; background:rgba(10,12,18,.75); color:#fff;
    cursor:pointer; display:none; align-items:center; justify-content:center; transition:.15s; }
:is(#ap-spec,.ap-player).medviz-on .ap-medviz-snap { display:flex; }
.ap-medviz-snap:hover { border-color:var(--ap-accent); background:rgba(10,12,18,.95); transform:scale(1.08); }
.ap-medviz-snap svg { width:18px; height:18px; }
.ap-medviz-scene-label { position:absolute; top:6px; right:10px; font-size:.58em; font-weight:700;
    color:rgba(239, 68, 68, .95); letter-spacing:.14em;
    background:rgba(0,0,0,.45); padding:3px 8px; border-radius:4px;
    font-family: 'SF Mono', Consolas, monospace; }
.ap-medviz-dots { position:absolute; top:9px; left:10px; display:flex; gap:4px; }
.ap-medviz-dots i { width:5px; height:5px; border-radius:50%; background:rgba(255,255,255,.25); transition: background .3s; }
.ap-medviz-dots i.on { background:#ef4444; box-shadow: 0 0 6px #ef4444; }
.ap-vinyl-wrap, .ap-arm { transition: transform .7s cubic-bezier(.4,0,.2,1), opacity .6s; }
.ap-medviz-switch { position: relative; }
.ap-medviz-switch.active { color:#ef4444; background: rgba(239, 68, 68, .12); }
.ap-medviz-switch.active::after { content:''; position:absolute; top:4px; right:4px; width:6px; height:6px;
    border-radius:50%; background:#ef4444; animation: medPulse 1.2s ease-in-out infinite; }
@keyframes medPulse { 0%,100%{ opacity:.4; transform:scale(.9); } 50%{ opacity:1; transform:scale(1.3); } }
/* Car mode: medviz as ambient background */
.ap-car-overlay .ap-medviz-car { position:absolute; inset:0; z-index:0; opacity:0; pointer-events:none;
    transition: opacity .8s; }
.ap-car-overlay.medviz-on .ap-medviz-car { opacity:.32; }
.ap-car-overlay .ap-medviz-car canvas { width:100%; height:100%; display:block; }

/* ── Sky with procedural drifting clouds (around player, masked) ── */
.ap-sky { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden;
    -webkit-mask-image: radial-gradient(circle at var(--sky-cx, 50vw) var(--sky-cy, 50vh),
        #000 0, #000 280px, transparent 640px);
    mask-image: radial-gradient(circle at var(--sky-cx, 50vw) var(--sky-cy, 50vh),
        #000 0, #000 280px, transparent 640px);
    transition: opacity .5s ease; }
.ap-sky.hidden { opacity: 0; }
.ap-sky-bg { position: absolute; inset: 0;
    background: linear-gradient(180deg, #60a5fa 0%, #7dd3fc 35%, #bae6fd 70%, #e0f2fe 100%);
    filter: saturate(calc(1 + var(--bass, 0) * 0.45)) brightness(calc(1 + var(--bass, 0) * 0.06)); }
.ap-cloud-layer { position: absolute; width: 300vmax; height: 45vh;
    top: var(--y, 15%); left: -100vmax;
    opacity: var(--opa, .9);
    animation: apCloudDrift var(--dur, 60s) linear infinite;
    will-change: transform; pointer-events: none; }
.ap-cloud-layer-2 { --y: 28%; --dur: 90s; --opa: .55; animation-direction: reverse; }
.ap-cloud-layer-3 { --y: 50%; --dur: 130s; --opa: .38; }
@keyframes apCloudDrift {
    from { transform: translate3d(0, 0, 0); }
    to   { transform: translate3d(100vmax, 0, 0); }
}
@media (prefers-reduced-motion: reduce) { .ap-cloud-layer { animation: none; } }
@media (max-width: 768px), (pointer: coarse) { .ap-sky { display: none !important; } }

/* On mobile: disable --bass-driven transforms/shadows to prevent
   jitter during scroll (iOS dynamic toolbar triggers layout thrash). */
@media (max-width: 768px), (pointer: coarse) {
    :is(#ap-spec,.ap-player) { box-shadow: 0 25px 60px rgba(0,0,0,.6), 0 0 60px var(--ap-glow), inset 0 1px 0 rgba(255,255,255,.06) !important; }
    :is(#ap-spec,.ap-player) .ap-vinyl-wrap { transform: none !important; }
    :is(#ap-spec,.ap-player) .ap-car-cover { transform: none !important; }
}

/* ── FX badges (mini) ── */
.ap-fx-badges { position:absolute; top:14px; right:50px; display:flex; gap:4px; z-index:5; }
.ap-fx-badge { font-size:.55em; padding:3px 7px; border-radius:10px;
    background:rgba(0,0,0,.5); color:var(--ap-accent); border:1px solid var(--ap-accent);
    font-weight:700; letter-spacing:.05em; backdrop-filter: blur(8px); display:none; }
.ap-fx-badge.visible { display:block; }

/* ── Admin mode: delete buttons / confirm / toast ── */
.ap-del { flex:none; width:30px; height:30px; padding:0; border:none; background:none; cursor:pointer;
    color:rgba(255,120,120,.55); display:none; align-items:center; justify-content:center; border-radius:8px; transition:.15s; }
:is(#ap-spec,.ap-player).admin-on .ap-del { display:flex; }
.ap-del:hover { color:#ff5b5b; background:rgba(255,80,80,.12); }
.ap-del svg { width:16px; height:16px; }
.ap-del.busy { opacity:.5; pointer-events:none; }
:is(#ap-spec,.ap-player).admin-on { box-shadow: 0 25px 60px rgba(0,0,0,.6), 0 0 60px rgba(255,80,80,.35), inset 0 0 0 1px rgba(255,80,80,.35); }
.ap-setting-row.ap-admin-row .ap-switch.on { background:#ef4444; }
.ap-delconfirm, .ap-toast-wrap { }
.ap-delconfirm { display:none; position:fixed; inset:0; z-index:99999; background:rgba(0,0,0,.6); backdrop-filter:blur(5px);
    align-items:center; justify-content:center; }
.ap-delconfirm.active { display:flex; }
.ap-delcard { background:rgba(24,20,28,.98); border:1px solid rgba(255,80,80,.35); border-radius:16px; padding:20px 22px;
    width:90%; max-width:380px; color:#fff; box-shadow:0 24px 70px rgba(0,0,0,.6); }
.ap-delcard h4 { margin:0 0 10px; font-size:1.05em; }
.ap-delcard .ap-delname { margin:0 0 6px; font-weight:700; color:var(--ap-accent); word-break:break-word; }
.ap-delcard .ap-delhint { margin:0 0 12px; font-size:.82em; opacity:.7; }
.ap-delcard .ap-delask { display:flex; align-items:center; gap:8px; font-size:.8em; opacity:.75; margin-bottom:14px; cursor:pointer; }
.ap-delbtns { display:flex; gap:10px; justify-content:flex-end; }
.ap-delbtns button { border:none; border-radius:10px; padding:9px 18px; font-size:.85em; font-weight:600; cursor:pointer; }
.ap-delbtns .ap-delno { background:rgba(255,255,255,.1); color:#fff; }
.ap-delbtns .ap-delyes { background:#ef4444; color:#fff; }
.ap-delbtns .ap-delyes:hover { background:#dc2626; }
.ap-toast { position:absolute; left:50%; bottom:52px; transform:translateX(-50%) translateY(10px);
    background:rgba(20,18,26,.96); border:1px solid rgba(255,255,255,.14); color:#fff; font-size:.8em;
    padding:9px 16px; border-radius:20px; z-index:99997; opacity:0; pointer-events:none; transition:.25s;
    max-width:88%; text-align:center; box-shadow:0 10px 30px rgba(0,0,0,.5); }
.ap-toast.show { opacity:1; transform:translateX(-50%) translateY(0); }
.ap-admin-help { padding:8px 10px; border-radius:8px; background:rgba(239,68,68,.08); margin:2px 0 6px; }
.ap-admin-help .ap-adminlink-url { display:block; font-size:.62em; opacity:.65; word-break:break-all;
    margin:5px 0 7px; font-family:'SF Mono',Consolas,monospace; color:var(--ap-accent); }
.ap-admin-help button { width:100%; }

/* ── Internet radio panel ── */
.ap-radio { display:none; position:fixed; inset:0; z-index:99998; background:rgba(0,0,0,.6); backdrop-filter:blur(5px);
    align-items:center; justify-content:center; }
.ap-radio.active { display:flex; }
.ap-radio-card { background:rgba(22,20,32,.98); border:1px solid rgba(255,255,255,.12); border-radius:16px;
    width:94%; max-width:520px; max-height:82vh; display:flex; flex-direction:column; color:#fff; padding:16px 18px;
    box-shadow:0 24px 70px rgba(0,0,0,.6); }
.ap-radio-head { display:flex; align-items:center; justify-content:space-between; margin-bottom:12px; }
.ap-radio-head h4 { margin:0; font-size:1.05em; }
.ap-radio-x { cursor:pointer; opacity:.6; padding:2px 8px; font-size:1.1em; }
.ap-radio-x:hover { opacity:1; color:var(--ap-accent); }
.ap-radio-search { display:flex; flex-wrap:wrap; gap:8px; margin-bottom:12px; }
.ap-radio-search input { flex:1 1 100%; min-width:0; background:rgba(255,255,255,.07); border:1px solid rgba(255,255,255,.14);
    border-radius:9px; color:#fff; padding:9px 12px; font-size:.9em; outline:none; }
.ap-radio-search input:focus { border-color:var(--ap-accent); }
.ap-radio-search select { flex:1 1 40%; background:rgba(255,255,255,.07); border:1px solid rgba(255,255,255,.14);
    border-radius:9px; color:#fff; padding:9px 8px; font-size:.82em; outline:none; cursor:pointer; }
.ap-radio-search select option { color:#000; }
.ap-radio-search button { flex:1 1 100%; background:var(--ap-accent); border:none; border-radius:9px; color:#fff;
    padding:10px; font-size:.9em; font-weight:600; cursor:pointer; }
.ap-radio-search button:hover { filter:brightness(1.1); }
.ap-radio-list { flex:1; overflow-y:auto; margin:0 -6px; }
.ap-radio-list::-webkit-scrollbar { width:5px; } .ap-radio-list::-webkit-scrollbar-thumb { background:var(--ap-accent); border-radius:3px; }
.ap-radio-empty { opacity:.55; font-size:.82em; padding:14px 8px; text-align:center; line-height:1.5; }
.ap-radio-row { display:flex; align-items:center; gap:10px; padding:9px 10px; border-radius:10px; cursor:pointer; }
.ap-radio-row:hover { background:rgba(255,255,255,.06); }
.ap-radio-row.playing { background:var(--ap-glow); }
.ap-radio-info { flex:1; min-width:0; }
.ap-radio-name { font-size:.9em; font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.ap-radio-meta { font-size:.72em; color:rgba(255,255,255,.45); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.ap-radio-play { flex:none; width:34px; height:34px; border:none; border-radius:50%; cursor:pointer;
    background:rgba(255,255,255,.1); color:#fff; font-size:.8em; display:flex; align-items:center; justify-content:center; }
.ap-radio-row:hover .ap-radio-play, .ap-radio-row.playing .ap-radio-play { background:var(--ap-accent); }
.ap-radio-live { position:absolute; top:14px; left:14px; background:rgba(0,0,0,.5); color:#fff; font-size:.62em;
    padding:4px 9px; border-radius:12px; font-weight:700; z-index:5; letter-spacing:.06em; display:none;
    border:1px solid #ef4444; backdrop-filter:blur(8px); }
.ap-radio-live.on { display:block; }
.ap-radio-live b { color:#ef4444; }

/* ── Speech-to-text panel ── */
.ap-txt { display:none; position:fixed; inset:0; z-index:99998; background:rgba(0,0,0,.62); backdrop-filter:blur(5px);
    align-items:center; justify-content:center; }
.ap-txt.active { display:flex; }
.ap-txt-card { background:rgba(22,20,32,.98); border:1px solid rgba(255,255,255,.12); border-radius:16px;
    width:94%; max-width:560px; max-height:86vh; display:flex; flex-direction:column; color:#fff; padding:16px 18px;
    box-shadow:0 24px 70px rgba(0,0,0,.6); }
.ap-txt-head { display:flex; align-items:center; justify-content:space-between; }
.ap-txt-head h4 { margin:0; font-size:1.05em; }
.ap-txt-x { cursor:pointer; opacity:.6; padding:2px 8px; font-size:1.1em; }
.ap-txt-x:hover { opacity:1; color:var(--ap-accent); }
.ap-txt-sub { font-size:.82em; color:var(--ap-accent); margin:4px 0 12px; word-break:break-word; }
.ap-txt-controls { display:flex; flex-wrap:wrap; gap:8px; margin-bottom:10px; }
.ap-txt-controls select { flex:1 1 40%; background:rgba(255,255,255,.07); border:1px solid rgba(255,255,255,.14);
    border-radius:9px; color:#fff; padding:9px 8px; font-size:.82em; outline:none; cursor:pointer; }
.ap-txt-controls select option { color:#000; }
.ap-txt-controls button { flex:1 1 100%; background:var(--ap-accent); border:none; border-radius:9px; color:#fff;
    padding:10px; font-size:.9em; font-weight:600; cursor:pointer; }
.ap-txt-controls button:disabled { opacity:.5; cursor:default; }
.ap-txt-status { font-size:.75em; opacity:.7; line-height:1.5; margin-bottom:8px; min-height:1.2em; }
.ap-txt-prog { height:5px; border-radius:3px; background:rgba(255,255,255,.1); overflow:hidden; margin-bottom:10px; }
.ap-txt-prog-fill { height:100%; width:0%; background:var(--ap-accent); transition:width .2s; }
.ap-txt textarea { width:100%; box-sizing:border-box; flex:1; min-height:180px; background:rgba(255,255,255,.06);
    border:1px solid rgba(255,255,255,.14); border-radius:10px; color:#fff; padding:10px 12px; font-size:.86em;
    line-height:1.5; resize:vertical; outline:none; }
.ap-txt-tools { display:flex; flex-wrap:wrap; gap:8px; margin-top:10px; }
.ap-txt-tools button { flex:1 1 30%; background:rgba(255,255,255,.08); border:1px solid rgba(255,255,255,.14);
    border-radius:9px; color:#fff; padding:9px 10px; font-size:.78em; cursor:pointer; }
.ap-txt-tools button:hover { border-color:var(--ap-accent); }
.ap-txt-tools .ap-txt-save { flex:1 1 100%; background:var(--ap-accent); border-color:transparent; font-weight:600; }

/* ── Video (hybrid) ── */
.ap-video-wrap { position:absolute; inset:0; z-index:3; display:none; border-radius:18px; overflow:hidden;
    background:#000; box-shadow: inset 0 0 0 1px rgba(255,255,255,.06); }
:is(#ap-spec,.ap-player).video-on .ap-video-wrap { display:block; }
:is(#ap-spec,.ap-player).video-on .ap-vinyl-wrap, :is(#ap-spec,.ap-player).video-on .ap-arm,
:is(#ap-spec,.ap-player).video-on .ap-viz, :is(#ap-spec,.ap-player).video-on .ap-medviz-wrap { display:none !important; }
:is(#ap-spec,.ap-player).video-on .ap-stage { height:auto; aspect-ratio:16/9; }
:is(#ap-spec,.ap-player).video-on .ap-waveform { display:none; }
.ap-video-wrap video { width:100%; height:100%; object-fit:contain; background:#000; display:block; cursor:pointer; }
.ap-video-fs { position:absolute; bottom:10px; right:10px; z-index:4; width:36px; height:36px; padding:0;
    border:1px solid rgba(255,255,255,.25); border-radius:9px; background:rgba(10,12,18,.7); color:#fff;
    cursor:pointer; display:flex; align-items:center; justify-content:center; transition:.15s; }
.ap-video-fs:hover { border-color:var(--ap-accent); background:rgba(10,12,18,.95); transform:scale(1.08); }
.ap-video-fs svg { width:18px; height:18px; }
.ap-video-wrap:fullscreen { border-radius:0; }
.ap-video-wrap:fullscreen video { object-fit:contain; }

/* ═══════════════ DESKTOP (≥900px): широкий макет в две зоны ═══════════════ */
@media (min-width: 900px) {
    :is(#ap-spec,.ap-player) {
        max-width: 960px;
        margin: 28px auto;
        border-radius: 34px;
        /* статичная тень (без var(--bass)) — иначе огромное свечение перерисовывается каждый кадр и мерцает */
        box-shadow: 0 40px 90px rgba(0,0,0,.6),
                    0 0 110px var(--ap-glow),
                    inset 0 1px 0 rgba(255,255,255,.08),
                    inset 0 0 0 1px rgba(255,255,255,.05);
    }
    :is(#ap-spec,.ap-player) .ap-bg-cover.loaded { opacity: .55; }

    :is(#ap-spec,.ap-player) .ap-inner {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 366px;
        column-gap: 38px;
        align-items: start;
        padding: 46px 46px 36px;
    }
    /* левая зона — «сейчас играет» + транспорт */
    :is(#ap-spec,.ap-player) .ap-stage, :is(#ap-spec,.ap-player) .ap-info, :is(#ap-spec,.ap-player) .ap-progress,
    :is(#ap-spec,.ap-player) .ap-controls, :is(#ap-spec,.ap-player) .ap-vol, :is(#ap-spec,.ap-player) .ap-toolbar,
    :is(#ap-spec,.ap-player) .ap-eq-panel, :is(#ap-spec,.ap-player) .ap-lyrics { grid-column: 1; min-width: 0; }

    /* крупная сцена → крупный винил и диагностический визуализер */
    :is(#ap-spec,.ap-player) .ap-stage { height: 400px; margin-bottom: 32px; }
    :is(#ap-spec,.ap-player) .ap-vinyl-wrap, :is(#ap-spec,.ap-player) .ap-vinyl { width: 268px; height: 268px; }
    :is(#ap-spec,.ap-player) .ap-cover { width: 152px; height: 152px; margin: -76px 0 0 -76px; }
    :is(#ap-spec,.ap-player) .ap-viz { height: 130px; }
    :is(#ap-spec,.ap-player) .ap-medviz-wrap { border-radius: 24px; }
    :is(#ap-spec,.ap-player) .ap-medviz-scene-label { font-size: .68em; }

    :is(#ap-spec,.ap-player) .ap-title { font-size: 1.8em; margin-bottom: 6px; }
    :is(#ap-spec,.ap-player) .ap-artist { font-size: 1.02em; }
    :is(#ap-spec,.ap-player) .ap-info { margin-bottom: 26px; }
    :is(#ap-spec,.ap-player) .ap-progress { margin-bottom: 20px; }
    :is(#ap-spec,.ap-player) .ap-waveform { height: 52px; }
    :is(#ap-spec,.ap-player) .ap-controls { gap: 24px; margin-bottom: 22px; }
    :is(#ap-spec,.ap-player) .ap-play { width: 66px; height: 66px; }
    :is(#ap-spec,.ap-player) .ap-play svg { width: 30px; height: 30px; }
    :is(#ap-spec,.ap-player) .ap-btn svg { width: 24px; height: 24px; }
    :is(#ap-spec,.ap-player) .ap-vol { margin-bottom: 22px; }

    /* правая зона — всегда открытый плейлист во всю высоту, со скроллом */
    :is(#ap-spec,.ap-player) .ap-playlist-toggle { display: none; }
    :is(#ap-spec,.ap-player) .ap-playlist {
        grid-column: 2;
        grid-row: 1 / span 99;
        align-self: stretch;
        min-height: 0;
        max-height: min(78vh, 760px);
        overflow-y: auto;
        /* НЕПРОЗРАЧНЫЙ фон: иначе сквозь панель просвечивают анимированные блобы/частицы и она «мерцает» */
        background: #17111f;
        border: 1px solid rgba(255,255,255,.08);
        border-radius: 20px;
        padding: 6px 8px 8px;
        position: relative;
        z-index: 2;
    }
    :is(#ap-spec,.ap-player) .ap-track { padding: 11px 12px; }
    :is(#ap-spec,.ap-player) .ap-track-title { font-size: .9em; }

    /* небо: расширить «чистую» зону под всю широкую карту */
    :is(#ap-spec,.ap-sky) {
        -webkit-mask-image: radial-gradient(circle at var(--sky-cx,50vw) var(--sky-cy,50vh),
            #000 0, #000 500px, transparent 940px);
        mask-image: radial-gradient(circle at var(--sky-cx,50vw) var(--sky-cy,50vh),
            #000 0, #000 500px, transparent 940px);
    }
}
@media (min-width: 1180px) {
    :is(#ap-spec,.ap-player) { max-width: 1040px; }
    :is(#ap-spec,.ap-player) .ap-inner { grid-template-columns: minmax(0, 1fr) 400px; column-gap: 44px; }
    :is(#ap-spec,.ap-player) .ap-stage { height: 440px; }
    :is(#ap-spec,.ap-player) .ap-vinyl-wrap, :is(#ap-spec,.ap-player) .ap-vinyl { width: 300px; height: 300px; }
    :is(#ap-spec,.ap-player) .ap-cover { width: 168px; height: 168px; margin: -84px 0 0 -84px; }
}

/* ══ Лаборатория: общие панели модулей (features/*) ══ */
.ap-lab { position:fixed; inset:0; z-index:99990; display:none; align-items:center; justify-content:center; padding:16px;
    background:rgba(4,4,10,.72); backdrop-filter:blur(6px); -webkit-backdrop-filter:blur(6px); font-family:inherit; }
.ap-lab.active { display:flex; }
.ap-lab-box { width:min(680px,100%); max-height:92vh; overflow:auto; background:linear-gradient(160deg,#17162a,#0e0d18);
    border:1px solid rgba(255,255,255,.1); border-radius:18px; box-shadow:0 20px 60px rgba(0,0,0,.6), 0 0 0 1px var(--ap-glow); color:#eee; }
.ap-lab-head { position:sticky; top:0; z-index:1; display:flex; align-items:center; justify-content:space-between; gap:12px; padding:14px 18px;
    background:rgba(20,19,36,.96); border-bottom:1px solid rgba(255,255,255,.07); font-size:1.05em; }
.ap-lab-x { background:none; border:0; color:#aaa; font-size:1.2em; cursor:pointer; padding:4px 8px; border-radius:8px; }
.ap-lab-x:hover { color:#fff; background:rgba(255,255,255,.08); }
.ap-lab-body { padding:16px 18px 20px; font-size:.92em; line-height:1.45; }
.ap-lab-body p { margin:.4em 0; }
.ap-lab-hub .ap-lab-body { display:grid; grid-template-columns:repeat(auto-fill,minmax(260px,1fr)); gap:10px; }
.ap-lab-item { display:flex; gap:12px; align-items:flex-start; text-align:left; padding:12px; border-radius:12px; cursor:pointer;
    background:rgba(255,255,255,.04); border:1px solid rgba(255,255,255,.08); color:#eee; font:inherit; }
.ap-lab-item:hover { border-color:var(--ap-accent); background:rgba(255,255,255,.07); }
.ap-lab-item b { display:block; margin-bottom:3px; } .ap-lab-item small { color:#aab; font-size:.82em; line-height:1.35; }
.ap-lab-ic { font-size:1.6em; line-height:1; }
.ap-lab-row { display:flex; flex-wrap:wrap; align-items:center; gap:8px; margin:10px 0; }
.ap-lab-btn { padding:8px 14px; border-radius:10px; border:1px solid rgba(255,255,255,.14); background:rgba(255,255,255,.06);
    color:#eee; font:inherit; cursor:pointer; }
.ap-lab-btn:hover { border-color:var(--ap-accent); } .ap-lab-btn.on, .ap-lab-btn.primary { background:var(--ap-accent); border-color:var(--ap-accent); color:#fff; }
.ap-lab-btn:disabled { opacity:.45; cursor:default; }
.ap-lab input[type=text], .ap-lab input[type=search], .ap-lab input[type=number], .ap-lab select {
    padding:8px 10px; border-radius:10px; border:1px solid rgba(255,255,255,.14); background:rgba(0,0,0,.35); color:#eee; font:inherit; }
.ap-lab input[type=range] { accent-color:var(--ap-accent); }
.ap-lab-big { font-size:3em; font-weight:800; line-height:1; font-variant-numeric:tabular-nums; }
.ap-lab-muted { color:#99a; font-size:.86em; }
.ap-lab-ok { color:#4ade80; } .ap-lab-warn { color:#fbbf24; } .ap-lab-bad { color:#f87171; }
.ap-lab-card { padding:12px; border-radius:12px; background:rgba(255,255,255,.04); border:1px solid rgba(255,255,255,.07); margin:10px 0; }
.ap-lab-list { list-style:none; margin:6px 0; padding:0; max-height:46vh; overflow:auto; }
.ap-lab-list li { padding:8px 10px; border-radius:10px; cursor:pointer; border:1px solid transparent; }
.ap-lab-list li:hover { background:rgba(255,255,255,.06); border-color:rgba(255,255,255,.08); }
.ap-lab-list mark { background:var(--ap-accent); color:#fff; border-radius:3px; padding:0 2px; }
.ap-lab-tbl { width:100%; border-collapse:collapse; font-size:.88em; }
.ap-lab-tbl td, .ap-lab-tbl th { padding:5px 6px; border-bottom:1px solid rgba(255,255,255,.06); text-align:left; }
.ap-lab canvas { width:100%; display:block; border-radius:10px; background:#07060d; }
.ap-lab-quiz button { margin:4px; }
.ap-lab a { color:#c4b5fd; } .ap-lab a:hover { color:#fff; }
.ap-lab code { background:rgba(255,255,255,.08); padding:1px 5px; border-radius:4px; font-size:.9em; }
.ap-lab summary { cursor:pointer; }
/* караоке по словам */
.ap-lyrics.karaoke .ap-kw { transition:color .12s; }
.ap-lyrics.karaoke p.active .ap-kw { color:rgba(255,255,255,.55); }
.ap-lyrics.karaoke p.active .ap-kw.sung { color:var(--ap-accent); text-shadow:0 0 10px var(--ap-glow); }
.ap-txt-words { display:inline-flex; align-items:center; gap:6px; margin-left:8px; font-size:.85em; color:#ccd; cursor:pointer; }
/* режим операционной */
.ap-or { position:fixed; inset:0; z-index:99995; display:none; flex-direction:column; background:#05050a; color:#fff; font-family:inherit;
    padding:max(16px,env(safe-area-inset-top)) 16px max(16px,env(safe-area-inset-bottom)); }
.ap-or.active { display:flex; }
.ap-or-top { display:flex; justify-content:space-between; align-items:center; gap:12px; font-size:1.1em; }
.ap-or-title { flex:1; text-align:center; font-size:clamp(1.4em,4vw,2.6em); font-weight:700; margin:2vh 0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.ap-or-grid { flex:1; display:grid; grid-template-columns:1fr 1.4fr 1fr; grid-template-rows:1fr 1fr; gap:14px; }
.ap-or-grid button { border:0; border-radius:24px; background:#1b1a2e; color:#fff; font-size:clamp(2em,7vw,5em); cursor:pointer; }
.ap-or-grid button:active { background:var(--ap-accent); }
.ap-or-grid .ap-or-play { grid-row:1 / span 2; grid-column:2; background:var(--ap-accent); }
.ap-or-status { text-align:center; margin-top:12px; font-size:1.1em; color:#bbc; min-height:1.5em; }
.ap-or-status .ap-or-dot { display:inline-block; width:12px; height:12px; border-radius:50%; background:#555; margin-right:8px; vertical-align:middle; }
.ap-or-status .ap-or-dot.live { background:#22c55e; box-shadow:0 0 12px #22c55e; }
.ap-or-status .ap-or-dot.duck { background:#f59e0b; box-shadow:0 0 12px #f59e0b; }
/* викторина аускультации: подпись записи скрыта, пока не ответили */
.ap-player.ap-quiz-on [id$="_title"], .ap-player.ap-quiz-on [id$="_artist"], .ap-player.ap-quiz-on .ap-track { filter:blur(9px); pointer-events:none; user-select:none; }
