/* Spotify in Atlas: the pill beside the bell, its player, the HQ card and the
 * Settings card (assets/atlas-spotify.js). Linked from index.html's head, so
 * every rule is in place before the module can draw anything -- the pill must
 * never paint as a bare button and then jump into shape. Every control is the
 * Atlas button (.btn, .btn-disc, .btn-sm); this file sizes and arranges them
 * and draws the parts that are not buttons: the art, the equalizer, the bar.
 */
:root{--sp-green:#1ed760}

/* --- the parts every surface shares ----------------------------------- */
.sp-art{display:grid;place-items:center;flex:0 0 auto;width:40px;height:40px;border-radius:6px;overflow:hidden;background:var(--surface-2);color:var(--ink-faint)}
.sp-art img{display:block;width:100%;height:100%;object-fit:cover}
.sp-eq{display:inline-flex;align-items:flex-end;gap:2px;height:12px;flex:0 0 auto}
.sp-eq i{display:block;width:3px;height:100%;border-radius:1px;background:var(--sp-green);transform-origin:bottom;transform:scaleY(.35)}
[data-sp-playing] .sp-eq i{animation:atlasSpEq 1s ease-in-out infinite}
[data-sp-playing] .sp-eq i:nth-child(2){animation-delay:-.4s}
[data-sp-playing] .sp-eq i:nth-child(3){animation-delay:-.7s}
@keyframes atlasSpEq{0%,100%{transform:scaleY(.3)}50%{transform:scaleY(1)}}
@media (prefers-reduced-motion:reduce){[data-sp-playing] .sp-eq i{animation:none;transform:scaleY(.8)}}
.sp-trk{flex:1;min-width:0}
.sp-trk b{display:block;color:var(--navy);font-size:13.5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.sp-trk small{display:block;color:var(--ink-muted,var(--muted));font-size:11.5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.sp-top{display:flex;gap:12px;align-items:center;min-width:0}
.sp-top .sp-art{width:58px;height:58px}
.sp-prog{height:4px;margin-top:12px;border-radius:4px;background:var(--line-strong);overflow:hidden}
.sp-prog i{display:block;height:100%;border-radius:4px;background:var(--navy);transition:width .9s linear}
.sp-times{display:flex;justify-content:space-between;margin-top:3px;font-size:10px;color:var(--ink-faint);font-variant-numeric:tabular-nums}
.sp-ctl{display:flex;align-items:center;justify-content:center;gap:8px;margin:12px 0 4px}
.sp-ctl-card{justify-content:space-between;flex-wrap:wrap;margin-bottom:0}
.sp-mid{display:flex;align-items:center;gap:8px}
.sp-dev{display:inline-flex;align-items:center;gap:6px;max-width:100%;min-width:0}
.sp-dev span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.sp-dev svg{flex:0 0 auto;width:14px;height:14px}
.sp-issue{margin:8px 0 0;font-size:12px;font-weight:700;color:var(--warning)}
/* Reconnect: a link from before Atlas played the sound itself. */
#atlasSpotifyPanel .sp-reconnect,.sp-settings .sp-reconnect{margin:8px 8px 0 0}
#page-dashboard .sp-card .sp-body>.sp-reconnect{margin-top:8px}
.sp-lbl{margin:12px 0 6px;font-size:10px;font-weight:900;letter-spacing:.13em;color:var(--ink-faint)}
.sp-shelf{display:flex;gap:6px;margin:12px 0 6px}
.sp-none{display:block;padding:8px 4px;font-size:12px;color:var(--ink-muted)}
.sp-list{display:grid;gap:2px;max-height:216px;overflow:auto}
/* A playlist or a device: a row in a list, not an action pill. */
.sp-pl{appearance:none;display:flex;align-items:center;gap:10px;width:100%;padding:6px;border:0;border-radius:9px;background:none;color:var(--text);font:inherit;font-size:12.5px;text-align:left;cursor:pointer}
.sp-pl:hover,.sp-pl:focus-visible{background:var(--surface-2);outline:none}
.sp-pl[aria-selected="true"]{background:var(--surface-2)}
.sp-pl .sp-art{width:30px;height:30px;border-radius:5px}
.sp-pl>svg{flex:0 0 auto;width:18px;height:18px;color:var(--sp-green)}
.sp-grow{flex:1;min-width:0}
.sp-grow b{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.sp-grow small{display:block;color:var(--ink-faint);font-size:10.5px}
.sp-devrow{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-top:10px;padding-top:10px;border-top:1px solid var(--line-soft,var(--border))}
.sp-devrow>span{font-size:11px;color:var(--ink-faint);flex:0 0 auto}
.sp-devs{margin-top:6px}

/* Volume: the speaker (mute) and the slider. The slider is drawn here, from
   the tokens: a 4px track like the song's bar, filled to the level (--sp-vol,
   set by the module), and a round knob that takes the Atlas glow on hover. */
.sp-vol{display:flex;align-items:center;gap:10px;min-width:0;margin-top:10px;--sp-fill:var(--navy);--sp-rail:var(--line-strong)}
.sp-vol .sp-mute{flex:0 0 auto}
.sp-vol .sp-mute>span{display:grid;place-items:center}
.sp-vol .sp-ic-off,.sp-vol[data-sp-muted] .sp-ic-on{display:none!important}
.sp-vol[data-sp-muted] .sp-ic-off{display:grid!important}
.sp-vol input.sp-range[type=range]{-webkit-appearance:none;appearance:none;flex:1 1 auto;width:auto;min-width:0;height:22px;min-height:0;margin:0;padding:0;border:0;border-radius:999px;background:none;box-shadow:none;color:inherit;cursor:pointer;--sp-vol:0%}
.sp-vol input.sp-range[type=range]::-webkit-slider-runnable-track{height:4px;border-radius:4px;background:linear-gradient(90deg,var(--sp-fill) var(--sp-vol),var(--sp-rail) var(--sp-vol))}
.sp-vol input.sp-range[type=range]::-moz-range-track{height:4px;border-radius:4px;background:var(--sp-rail)}
.sp-vol input.sp-range[type=range]::-moz-range-progress{height:4px;border-radius:4px;background:var(--sp-fill)}
.sp-vol input.sp-range[type=range]::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;width:14px;height:14px;margin-top:-5px;border-radius:999px;border:2px solid var(--card);background:var(--blue-deep);box-shadow:0 0 0 1px var(--line-strong);transition:box-shadow .18s ease}
.sp-vol input.sp-range[type=range]::-moz-range-thumb{width:14px;height:14px;box-sizing:border-box;border-radius:999px;border:2px solid var(--card);background:var(--blue-deep);box-shadow:0 0 0 1px var(--line-strong);transition:box-shadow .18s ease}
.sp-vol input.sp-range[type=range]:hover::-webkit-slider-thumb{box-shadow:0 0 0 3px color-mix(in srgb,var(--blue-deep) 15%,transparent),0 0 14px color-mix(in srgb,var(--blue-deep) 24%,transparent)}
.sp-vol input.sp-range[type=range]:hover::-moz-range-thumb{box-shadow:0 0 0 3px color-mix(in srgb,var(--blue-deep) 15%,transparent),0 0 14px color-mix(in srgb,var(--blue-deep) 24%,transparent)}
.sp-vol input.sp-range[type=range]:focus-visible{outline:2px solid var(--blue-deep);outline-offset:2px}
.sp-novol{display:inline-flex;align-items:center;gap:6px;font-size:11.5px;color:var(--ink-faint)}
.sp-novol svg{flex:0 0 auto;width:14px;height:14px}

/* The keys popup over a control ("Alt + Shift + P - play/pause"). */
.sp-keys-pop{position:fixed;z-index:10050;white-space:pre;pointer-events:none;padding:7px 11px;border-radius:10px;font:700 11px/1.55 var(--font-body,system-ui,sans-serif);letter-spacing:.02em;
  color:var(--ink-inverse);background:var(--chrome-navy);border:1px solid color-mix(in srgb,var(--ink-inverse) 18%,transparent);box-shadow:0 8px 20px color-mix(in srgb,var(--chrome-navy) 60%,transparent);animation:atlasSpKeysIn .14s ease}
@keyframes atlasSpKeysIn{from{opacity:0;transform:translateY(-3px)}to{opacity:1;transform:none}}
@media (prefers-reduced-motion:reduce){.sp-keys-pop{animation:none}}

/* --- B: the pill beside the bell -------------------------------------- */
/* The top bar's own rule gives it the ghost face on the dark chrome; this
   only lays out what is inside it. A track: art, equalizer, name. Nothing:
   a disc with a note. */
#atlasSpotifyPill{display:inline-flex;align-items:center;justify-content:flex-start;gap:8px;flex:0 1 auto;min-width:0;max-width:250px;height:40px;min-height:40px;padding:0 13px 0 5px;white-space:nowrap;overflow:hidden}
#atlasSpotifyPill[hidden]{display:none}
#atlasSpotifyPill .sp-art{width:30px;height:30px;border-radius:999px}
#atlasSpotifyPill .sp-t{min-width:0;overflow:hidden;text-overflow:ellipsis;font-size:12px}
#atlasSpotifyPill .sp-note{display:none}
#atlasSpotifyPill:not([data-sp-track]){width:40px;padding:0;justify-content:center}
#atlasSpotifyPill:not([data-sp-track]) .sp-note{display:grid;place-items:center}
#atlasSpotifyPill:not([data-sp-track]) :is(.sp-eq,.sp-t){display:none}
#atlasSpotifyPill .sp-note svg{width:17px;height:17px}

/* The player, hung under the pill (placed by the module). */
#atlasSpotifyPanel{position:fixed;z-index:70;width:320px;max-width:calc(100vw - 20px);max-height:calc(100vh - 90px);overflow:auto;box-sizing:border-box;padding:14px;
  border:1px solid var(--line-strong);border-radius:16px;background:var(--card);color:var(--text);box-shadow:0 18px 40px rgba(0,0,0,.35)}
#atlasSpotifyPanel[hidden]{display:none}

/* --- A: the HQ card ---------------------------------------------------- */
#page-dashboard .sp-card .card-head{align-items:flex-start}
#page-dashboard .sp-card .card-head>svg{flex:0 0 auto;color:var(--sp-green)}
#page-dashboard .sp-card .sp-body{padding:14px 17px 16px}
#page-dashboard .sp-card .sp-top .sp-art{width:64px;height:64px}
#page-dashboard .sp-card .sp-ctl-card{margin-top:11px}
/* HQ's cards carry their own ink (light on the dark card face), so the song,
   its bar and the volume follow the card's colour rather than --navy, which
   drew them dark on dark. */
#page-dashboard .sp-card .sp-trk b{color:inherit}
#page-dashboard .sp-card :is(.sp-trk small,.sp-times){color:color-mix(in srgb,currentColor 70%,transparent)}
#page-dashboard .sp-card .sp-prog{background:color-mix(in srgb,currentColor 22%,transparent)}
#page-dashboard .sp-card .sp-prog i{background:currentColor}
#page-dashboard .sp-card .sp-vol{--sp-fill:currentColor;--sp-rail:color-mix(in srgb,currentColor 22%,transparent)}

/* Settings. */
.sp-settings-note{margin:0 0 10px;color:var(--muted);font-size:12px}

