/* ==========================================================================
   INDEX PAGE — player, song list, queue drawer, modals
   Shared base look (nav, buttons, inputs, #app) lives in base.css
   ========================================================================== */

/* ---------- Main player container ---------- */
#player-container {
    background: #1e1e1e;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    margin-bottom: 20px;
    box-sizing: border-box;
    transition: all 0.35s cubic-bezier(0.25, 1, 0.5, 1);
    position: relative;
    z-index: 100;
    width: 100%;
}
.player-main-info {
    display: flex;
    flex-direction: column;
    align-items: center;
}
#now-playing-cover {
    width: 100%;
    max-width: 300px;
    border-radius: 12px;
    margin-bottom: 15px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}

/* ---------- Mini controls – hidden by default ---------- */
.mini-controls {
    display: none !important;   /* <<< FIX: never visible unless overridden */
}
#player-drag-indicator {
    display: none;
}

/* Song list */
#song-list {
    list-style: none;
    padding: 0;
}
/* Swipeable row: the <li> is a thin clipped shell; the reveal-color lives
   behind it, and the visible content slides over it on swipe. */
.swipeable-row {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    margin-bottom: 10px;
}
.song-swipe-bg,
.q-swipe-bg {
    visibility: hidden;
}
.swiping > .song-swipe-bg,
.swiping > .q-swipe-bg {
    visibility: visible;
}
.song-swipe-bg {
    position: absolute;
    inset: 0;
    background: var(--accent);
    color: var(--on-accent);
    font-weight: 700;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    padding-right: 24px;
}
.song-swipe-content {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    background: #1e1e1e;
    touch-action: pan-y;
    transition: transform 0.2s ease;
}
.song-swipe-content:hover {
    background: #2a2a2a;
}
.song-click-zone {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1;
    cursor: pointer;
}
.list-cover {
    width: 50px;
    height: 50px;
    border-radius: 6px;
    object-fit: cover;
}
.list-title {
    font-size: 16px;
    font-weight: 500;
}
.row-action-btn {
    background: none;
    border: none;
    color: #b3b3b3;
    cursor: pointer;
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.row-action-btn:hover {
    color: white;
    background: rgba(255, 255, 255, 0.08);
}

/* ---------- Modal (song action menu) ---------- */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: flex-end;
    z-index: 4000; /* above the tab bar, mini player and full-screen player */
}
.hidden {
    display: none !important;
}
.modal-content {
    background-color: #282828;
    width: 100%;
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    padding: 24px 24px calc(24px + var(--safe-bottom));
    box-sizing: border-box;
    max-height: 80vh;
    overflow-y: auto;
}
.modal-content h3 {
    margin-top: 0;
    text-align: center;
    font-size: 18px;
    border-bottom: 1px solid #3e3e3e;
    padding-bottom: 12px;
}
/* Visual cue that the sheet can be swiped down to close. */
.sheet-grabber {
    width: 36px;
    height: 4px;
    border-radius: 2px;
    background: #4e4e4e;
    margin: -8px auto 12px;
}
.modal-playlists-list {
    margin-bottom: 8px;
}
.menu-btn, .menu-playlist-item-btn {
    width: 100%;
    background: #3e3e3e;
    color: white;
    border: none;
    padding: 14px;
    text-align: left;
    font-size: 16px;
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    font-weight: normal;
    min-height: 48px;
    display: flex;
    align-items: center;
    gap: 12px;
}
.menu-btn:hover, .menu-playlist-item-btn:hover {
    background: #4e4e4e;
}
.menu-btn .icon { color: #b3b3b3; }
.menu-divider {
    font-size: 12px;
    text-transform: uppercase;
    color: #b3b3b3;
    margin: 15px 0 8px 5px;
    font-weight: bold;
    letter-spacing: 1px;
}
.close-btn {
    background: #222;
    color: #ff4444;
    text-align: center;
    justify-content: center;
    font-weight: bold;
    margin-top: 15px;
}
#edit-save-btn {
    justify-content: center;
}

/* ---------- Custom progress / seek bar (replaces native <audio controls>) ---------- */
.progress-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 5px;
    margin-bottom: 5px;
}
.time-label {
    font-size: 12px;
    color: #b3b3b3;
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
    width: 34px;
}
#duration-label {
    text-align: right;
}
/* Same trick as the sound sliders: a thin 4px visible track inside a taller
   padded box, so scrubbing with a thumb is easy on a phone. */
.seek-slider {
    flex: 1;
    min-width: 0;
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    padding: 12px 0;
    box-sizing: content-box;
    background: #4d4d4d;
    background-clip: content-box;
    border-radius: 2px;
    outline: none;
    cursor: pointer;
    touch-action: pan-y;
}
.seek-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #ffffff;
    cursor: pointer;
    border: none;
}
.seek-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #ffffff;
    cursor: pointer;
    border: none;
}

/* ---------- Player Controls ---------- */
.primary-controls-row {
    margin-top: 15px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
}
.secondary-controls-row {
    margin-top: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
/* Spotify-style transport: the play button is a solid white disc with a dark
   glyph; prev/next and the toggles are bare glyphs with no chrome. */
.play-pause-btn-lg {
    background: #ffffff;
    color: #000000;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.15s ease, background 0.15s ease;
    width: 60px;
    height: 60px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    flex-shrink: 0;
}
.play-pause-btn-lg:hover {
    background: #ffffff;
    transform: scale(1.06);
}
.play-pause-btn-lg:active {
    transform: scale(0.96);
}
.control-action-btn,
.control-toggle-btn {
    position: relative;
    background: transparent;
    color: #b3b3b3;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: color 0.15s ease, transform 0.15s ease;
    width: 46px;
    height: 46px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    flex-shrink: 0;
}
.control-action-btn { color: #ffffff; }
.control-action-btn .icon { width: 24px; height: 24px; }
.control-toggle-btn .icon { width: 22px; height: 22px; }
.control-action-btn:hover,
.control-toggle-btn:hover {
    color: #ffffff;
    background: transparent;
    transform: scale(1.06);
}

/* Active toggles turn green with a small dot beneath, as in Spotify. */
.shuffle-active,
.repeat-active,
.repeat-one-active,
.queue-active,
.sound-settings-active,
.smart-next-active {
    color: var(--accent) !important;
}
.shuffle-active::after,
.repeat-active::after,
.repeat-one-active::after,
.queue-active::after,
.sound-settings-active::after,
.smart-next-active::after {
    content: "";
    position: absolute;
    bottom: 3px;
    left: 50%;
    width: 4px;
    height: 4px;
    margin-left: -2px;
    border-radius: 50%;
    background: var(--accent);
}
.smart-next-status {
    font-size: 12px;
    color: var(--accent);
    text-align: center;
    margin-top: 10px;
}

/* The sound-settings toggle only makes sense in the full-screen expanded
   player — hide it in the normal in-page player to keep that view simple. */
#player-container:not(.expanded-mode) #sound-settings-toggle-btn {
    display: none;
}

/* ---------- Sound Settings Panel (bass / treble / speed) ---------- */
.sound-settings-panel {
    margin-top: 18px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    text-align: left;
}
.sound-settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #b3b3b3;
    margin-bottom: 14px;
}
.sound-settings-title {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.slider-row {
    display: grid;
    grid-template-columns: 56px 1fr 44px;
    align-items: center;
    gap: 12px;
    margin-bottom: 6px;
}
.slider-row:last-child {
    margin-bottom: 0;
}
.slider-row label {
    font-size: 13px;
    color: #e0e0e0;
    text-align: left;
}
/* The visible track is 4px, but the element itself has padding so the
   touch target is ~24px tall — thin sliders are hard to grab on a phone. */
.slider-row input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    padding: 10px 0;
    box-sizing: content-box;
    background: #4d4d4d;
    background-clip: content-box;
    border-radius: 2px;
    outline: none;
    cursor: pointer;
    touch-action: pan-y;
}
.slider-row input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #ffffff;
    cursor: pointer;
    border: none;
}
.slider-row input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #ffffff;
    cursor: pointer;
    border: none;
}
.slider-value {
    font-size: 12px;
    color: #b3b3b3;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.effects-render-status {
    margin: 10px 0 0;
    font-size: 0.75rem;
    line-height: 1.45;
    color: #b3b3b3;
}

/* ---------- Weird Effects toggles ---------- */
.effects-divider {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: #b3b3b3;
    font-weight: 700;
    margin: 16px 0 10px 0;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.effects-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}
/* Filter-chip style, like Spotify's: dark pill, green when selected. */
.effect-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    background: rgba(255, 255, 255, 0.07);
    color: #ffffff;
    border: none;
    border-radius: 22px;
    padding: 10px 12px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
    white-space: nowrap;
}
.effect-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.14);
}
.effect-toggle-btn.active {
    background: var(--accent) !important;
    color: var(--on-accent) !important;
}

/* ---------- Mini Player (docked above the tab bar) ---------- */
#player-container {
    transition: none;
}
/* No song yet → no player at all, instead of an empty "Pick a song" card. */
#player-container.no-song {
    display: none !important;
}
#player-container.mini-mode {
    position: fixed;
    bottom: calc(var(--tabbar-h) + var(--safe-bottom) + var(--jelly-bar-h) + 8px);
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 16px);
    max-width: 560px;
    margin: 0;
    z-index: 1900;
    padding: 8px 8px 10px 8px;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.6);
    cursor: pointer;
    animation: miniIn 0.28s ease-out;
    border: 1px solid rgba(255, 255, 255, 0.08);
    overflow: hidden;
}
@keyframes miniIn {
    from { transform: translate(-50%, 24px); opacity: 0; }
    to { transform: translate(-50%, 0); opacity: 1; }
}
/* Thin progress line along the bottom edge of the mini bar */
.mini-progress {
    display: none;
}
#player-container.mini-mode .mini-progress {
    display: block;
    position: absolute;
    left: 8px;
    right: 8px;
    bottom: 3px;
    height: 2px;
    border-radius: 1px;
    background: rgba(255, 255, 255, 0.22);
}
#mini-progress-fill {
    height: 100%;
    width: 0;
    border-radius: 1px;
    background: #ffffff;
}
/* Collapse chevron — only meaningful in the full-screen sheet */
.player-collapse-btn {
    display: none;
}
#player-container.expanded-mode .player-collapse-btn {
    display: flex;
    position: absolute;
    top: 8px;
    left: 8px;
    width: 44px;
    height: 44px;
    padding: 0;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: #ffffff;
    border: none;
    border-radius: 50%;
    z-index: 2;
}
#player-container.expanded-mode .player-collapse-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}
#player-container.mini-mode .player-full-controls { display: none; }
#player-container.mini-mode .player-main-info {
    flex-direction: row;
    align-items: center;
    gap: 12px;
    width: 100%;
    justify-content: space-between;
}
#player-container.mini-mode #now-playing-cover {
    width: 44px !important;
    height: 44px !important;
    margin: 0 !important;
    border-radius: 6px;
    object-fit: cover;
    box-shadow: 0 4px 10px rgba(0,0,0,0.4);
}
#player-container.mini-mode .player-text {
    flex: 1;
    text-align: left;
    overflow: hidden;
}
#player-container.mini-mode #now-playing-title {
    font-size: 14px;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
    margin: 0;
}
/* Show mini-controls ONLY in mini mode */
#player-container.mini-mode .mini-controls {
    display: flex !important;   /* <<< overrides the default hidden */
    align-items: center;
    gap: 8px;
}
#player-container.mini-mode .mini-controls .control-action-btn {
    width: 40px;
    height: 40px;
    color: #ffffff;
}
#player-container.mini-mode .mini-controls .control-action-btn .icon {
    width: 20px;
    height: 20px;
}
/* Play/pause in the mini bar is a solid white disc, like the big one. */
#player-container.mini-mode .mini-controls #custom-play-pause-btn {
    background: #ffffff;
    color: #000000;
}
#player-container.mini-mode .mini-controls #custom-play-pause-btn:hover {
    background: #ffffff;
}

/* ---------- Expanded Player (full-screen overlay) ---------- */
#player-container.expanded-mode {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh; /* excludes the mobile browser's collapsing address bar */
    z-index: 3000;
    border-radius: 0;
    padding: max(56px, calc(env(safe-area-inset-top, 0px) + 44px)) 20px calc(24px + var(--safe-bottom)) 20px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    transform: translateY(0);
    animation: popOpen 0.3s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
    overflow-y: auto;
}
@keyframes popOpen {
    from { transform: translateY(100vh); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
#player-container.expanded-mode #player-drag-indicator {
    display: block;
    width: 50px;
    height: 6px;
    background: rgba(255,255,255,0.3);
    border-radius: 10px;
    margin: 0 auto 18px auto;
    flex-shrink: 0;
    cursor: pointer;
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
}
#player-container.expanded-mode .player-main-info {
    width: 100%;
    max-width: 400px;
}
#player-container.expanded-mode #now-playing-cover {
    width: 100% !important;
    max-width: 320px !important;
    aspect-ratio: 1/1;
    object-fit: cover;
    border-radius: 16px;
    margin: 0 auto 30px auto !important;
}
#player-container.expanded-mode #now-playing-title {
    font-size: 24px;
    white-space: normal;
    text-align: center;
    margin-bottom: 20px;
}
#player-container.expanded-mode .mini-controls { display: none; }
#player-container.expanded-mode .player-full-controls {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 400px;
    margin-top: auto;
}
@media (min-width: 769px) {
    #player-container.expanded-mode {
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 90%;
        max-width: 450px;
        height: auto;
        max-height: 90vh;
        border-radius: 28px;
        box-shadow: 0 24px 64px rgba(0,0,0,0.85);
        animation: popOpenPC 0.3s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
        border: 1px solid rgba(255, 255, 255, 0.1);
    }
    @keyframes popOpenPC {
        from { transform: translate(-50%, -40%) scale(0.9); opacity: 0; }
        to { transform: translate(-50%, -50%) scale(1); opacity: 1; }
    }
}

/* ---------- Queue Drawer ---------- */
#queue-drawer {
    position: fixed;
    top: 0;
    right: -100%;
    width: 100%;
    max-width: 400px;
    height: 100vh;
    background: var(--bg);
    z-index: 9999;
    transition: right 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    box-shadow: -5px 0 20px rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
}
#queue-drawer.active {
    right: 0;
}
.queue-drawer {
    position: fixed;
    top: 0;
    right: -420px;
    width: 400px;
    height: 100%;
    background: var(--bg);
    border-left: 1px solid #282828;
    box-shadow: -8px 0 25px rgba(0, 0, 0, 0.6);
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 999;
    display: flex;
    flex-direction: column;
    padding: 24px;
    box-sizing: border-box;
}
.queue-drawer.open {
    right: 0;
}
.drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid #282828;
    padding-bottom: 12px;
}
.drawer-header h3 {
    margin: 0;
    font-size: 20px;
}
.drawer-close-btn {
    background: transparent;
    border: none;
    color: #b3b3b3;
    cursor: pointer;
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.drawer-close-btn:hover {
    color: white;
    background: rgba(255, 255, 255, 0.08);
}
.queue-scroll-container {
    flex: 1;
    overflow-y: auto;
    padding-right: 4px;
}
.queue-scroll-container::-webkit-scrollbar {
    width: 6px;
}
.queue-scroll-container::-webkit-scrollbar-thumb {
    background: #3e3e3e;
    border-radius: 4px;
}
.queue-section {
    margin-bottom: 24px;
}
.queue-section h4 {
    margin: 0 0 12px 0;
    font-size: 12px;
    text-transform: uppercase;
    color: #b3b3b3;
    letter-spacing: 0.5px;
}
.queue-section ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
/* Outer shell: stays overflow-visible so a dragged row's shadow isn't
   clipped; the swipe-to-remove reveal is clipped one level down instead. */
.queue-modifier-row {
    position: relative;
    margin-bottom: 8px;
}
.queue-modifier-row.dragging {
    z-index: 10;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
    border-radius: 6px;
    pointer-events: none;
    opacity: 0.96;
}
.q-swipe-mask {
    position: relative;
    overflow: hidden;
    border-radius: 6px;
}
.q-swipe-bg {
    position: absolute;
    inset: 0;
    background: #b91c1c;
    color: white;
    font-weight: 600;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    padding-right: 20px;
}
.q-swipe-content {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    background: #1e1e1e;
    padding: 10px 12px;
    border-radius: 6px;
    touch-action: pan-y;
    transition: transform 0.2s ease;
}
.queue-modifier-row.dragging .q-swipe-content {
    background: #2a2a2a;
    transition: none;
}
.q-drag-handle {
    background: transparent;
    border: none;
    color: #777;
    cursor: grab;
    width: 32px;
    height: 44px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: none;
    flex-shrink: 0;
}
.q-drag-handle:hover { color: #b3b3b3; }
.q-drag-handle:active { cursor: grabbing; }
.q-info-zone {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}
.q-info-zone-clickable {
    cursor: pointer;
}
.smart-pick-row .q-swipe-content {
    border: 1px solid rgba(var(--accent-rgb), 0.35);
}
.smart-pick-badge {
    width: 32px;
    height: 44px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
}
.queue-row-cover {
    width: 36px;
    height: 36px;
    border-radius: 4px;
    object-fit: cover;
}
.q-title {
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.q-control-btn {
    background: transparent;
    border: none;
    color: #b3b3b3;
    padding: 0;
    border-radius: 50%;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.q-control-btn:hover { background: rgba(255, 255, 255, 0.08); color: #ffffff; }
.btn-del:hover { color: #f87171; }
.empty-notice-item {
    font-size: 13px;
    color: #555;
    text-align: center;
    padding: 15px;
    border: 1px dashed #282828;
    border-radius: 6px;
}
/* Stands in for a dragged queue row while it's floating over either list,
   marking exactly where it will land. */
.queue-drag-placeholder {
    border: 1px dashed rgba(var(--accent-rgb), 0.6);
    background: rgba(var(--accent-rgb), 0.08);
    border-radius: 6px;
    margin-bottom: 8px;
    list-style: none;
}

/* ---------- Search container (library page) ---------- */
.search-container {
    position: relative;
    margin-bottom: 15px;
    width: 100%;
    max-width: 400px;
}
.search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: #b3b3b3;
    pointer-events: none;
}
#library-search-input {
    width: 100%;
    height: 44px;
    background: #2a2a2a;
    border: 2px solid transparent;
    color: white;
    padding: 0 16px 0 44px;
    font-size: 14px;
    border-radius: 22px;
    outline: none;
    box-sizing: border-box;
    transition: all 0.2s ease-in-out;
}
#library-search-input:focus {
    background: #333333;
    border-color: #ffffff;
    box-shadow: none;
}
#library-search-input::placeholder {
    color: #727272;
}

/* ---------- Home header: search + playlist chips (sticky) ---------- */
/* Stays pinned while the song list scrolls, so search and switching
   playlists are always one tap away. */
.library-header {
    position: sticky;
    top: 0;
    z-index: 60;
    background: var(--bg);
    padding: 6px 0 10px;
}
.search-container {
    margin-bottom: 10px;
}
.chip-row {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 2px;
}
.chip-row::-webkit-scrollbar {
    display: none;
}
.chip {
    flex-shrink: 0;
    height: 36px;
    padding: 0 16px;
    background: #2a2a2a;
    color: #ffffff;
    border: none;
    border-radius: 18px;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.chip:hover {
    background: #383838;
}
.chip.active {
    background: var(--accent);
    color: var(--on-accent);
}
.section-title {
    margin: 6px 0 10px;
    font-size: 0.95rem;
    color: #b3b3b3;
    font-weight: 600;
}
#home-playlist-actions {
    margin: 2px 0 14px;
}

/* The song that's currently playing */
.swipeable-row.playing .list-title {
    color: var(--accent);
}

/* Confirmation toast (floats above the mini player + tab bar) */
#toast {
    position: fixed;
    left: 50%;
    bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 96px);
    transform: translate(-50%, 12px);
    background: #ffffff;
    color: #000000;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 10px 18px;
    border-radius: 20px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 5000;
    max-width: calc(100% - 32px);
    text-align: center;
}
#toast.show {
    opacity: 1;
    transform: translate(-50%, 0);
}

/* ---------- A note from the admin ----------
   Sits above everything, including the expanded player, because it's meant to
   be read rather than noticed. It fades itself out; tapping anywhere on it
   closes it early. */
.admin-message-popup {
    position: fixed;
    inset: 0;
    z-index: 6000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(0, 0, 0, 0.62);
    opacity: 0;
    transition: opacity 0.25s ease;
}
/* display:flex above would otherwise win against the hidden attribute. */
.admin-message-popup[hidden] {
    display: none;
}
.admin-message-popup.visible {
    opacity: 1;
}
.admin-message-card {
    width: min(420px, 100%);
    background: #1c1c1c;
    border: 1px solid rgba(var(--accent-rgb), 0.5);
    border-radius: 16px;
    padding: 26px 24px 18px;
    text-align: center;
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.6);
    transform: translateY(10px) scale(0.97);
    transition: transform 0.25s ease;
}
.admin-message-popup.visible .admin-message-card {
    transform: translateY(0) scale(1);
}
.admin-message-icon {
    color: var(--accent);
    margin-bottom: 10px;
}
.admin-message-from {
    margin: 0 0 10px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent);
}
.admin-message-body {
    margin: 0;
    font-size: 1.05rem;
    line-height: 1.5;
    color: #ffffff;
    /* Keep the sender's line breaks, and don't let one very long word push
       the card off the side of a phone. */
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}
.admin-message-hint {
    margin: 18px 0 0;
    font-size: 0.72rem;
    color: #8d8d8d;
}


/* ---------- Global mobile tweaks (only for player/queue) ---------- */
@media (max-width: 768px) {
    .primary-controls-row {
        gap: 24px;
    }
    .secondary-controls-row {
        gap: 10px;
        width: 100%;
    }
    .control-action-btn,
    .control-toggle-btn {
        font-size: 16px;
        width: 46px;
        height: 46px;
    }
    .play-pause-btn-lg {
        width: 64px;
        height: 64px;
        font-size: 24px;
    }

    .queue-drawer {
        right: 0;
        bottom: -85%;
        top: auto;
        width: 100%;
        height: 80%;
        border-left: none;
        border-top: 1px solid #282828;
        border-radius: 24px 24px 0 0;
        transition: bottom 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 0 -10px 30px rgba(0,0,0,0.7);
    }
    .queue-drawer.open {
        bottom: 0;
    }

    .song-swipe-content {
        padding: 12px;
    }
    .list-title {
        font-size: 15px;
        line-height: 1.3;
    }

    .search-container {
        max-width: 100%;
    }
    #library-search-input {
        height: 46px;
        font-size: 16px;
    }
    /* Bleed the sticky header to the screen edges so scrolling rows don't peek out beside it */
    .library-header {
        margin: 0 -12px;
        padding-left: 12px;
        padding-right: 12px;
    }
}
/* ---------- Delete song button ---------- */
#menu-delete-song:hover {
    background: #5f1818 !important;
}
#edit-save-btn {
    text-align: center;
}