:root {
    /* Theme colours (the Default theme). Admin-made themes override these. */
    --bg: #121212;
    --surface: #181818;
    --surface-2: #282828;
    --surface-3: #222222;
    --border: #333333;
    --text: #ffffff;
    --text-dim: #b3b3b3;
    --text-faint: #777777;
    --accent: #1db954;
    --on-accent: #121212;
}

* { 
    box-sizing: border-box;
	-webkit-tap-highlight-color: transparent;
}

body { 
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; 
    background-color: var(--bg); 
    color: var(--text); 
    margin: 0; 
    padding: 0; 
    padding-bottom: 90px; 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    overscroll-behavior-y: contain; 
}

.login-container { 
    background-color: var(--surface); 
    padding: 30px; 
    border-radius: 12px; 
    width: 100%; 
    max-width: 400px; 
    box-shadow: 0 8px 24px rgba(0,0,0,0.5); 
    margin-top: 10vh; 
}

.login-container h2 { 
    margin-top: 0; 
    text-align: center; 
}

.input-group { 
    margin-bottom: 15px; 
    display: flex; 
    flex-direction: column; 
}

.input-group label { 
    font-size: 13px; 
    color: var(--text-dim); 
    margin-bottom: 5px; 
}

.input-group input { 
    background-color: var(--surface-2); 
    border: 1px solid var(--border); 
    color: var(--text); 
    padding: 12px; 
    border-radius: 6px; 
    outline: none; 
    font-size: 16px;
}

.msg { 
    padding: 10px; 
    border-radius: 6px; 
    margin-bottom: 15px; 
    font-size: 14px; 
    text-align: center; 
}

.msg.error { 
    background-color: rgba(255, 77, 77, 0.1); 
    color: #ff4d4d; 
    border: 1px solid #ff4d4d; 
}

.btn-green { 
    background-color: var(--accent); 
    color: var(--on-accent); 
    border: none; 
    font-weight: bold; 
    padding: 12px 16px; 
    border-radius: 24px; 
    cursor: pointer; 
    width: 100%; 
    font-size: 16px; 
    transition: opacity 0.2s; 
}

#mini-player-bar { 
    position: fixed; 
    bottom: 0; 
    left: 0; 
    width: 100%; 
    height: 75px; 
    background-color: var(--surface); 
    border-top: 1px solid var(--surface-2); 
    display: flex; 
    align-items: center; 
    justify-content: space-between; 
    padding: 10px 20px; 
    z-index: 1000; 
    box-shadow: 0 -4px 12px rgba(0,0,0,0.5); 
}

.mini-left { 
    display: flex; 
    align-items: center; 
    gap: 12px; 
    overflow: hidden; 
    flex: 1; 
    cursor: pointer; 
}

#mini-art { 
    width: 50px; 
    height: 50px; 
    border-radius: 6px; 
    background-color: var(--surface-2); 
    object-fit: cover; 
    flex-shrink: 0; 
}

.mini-info { 
    display: flex; 
    flex-direction: column; 
    overflow: hidden; 
}

#mini-title { 
    font-size: 14px; 
    font-weight: 600; 
    white-space: nowrap; 
    overflow: hidden; 
    text-overflow: ellipsis; 
    transition: color 0.3s; 
}

#mini-album { 
    font-size: 12px; 
    color: var(--text-dim); 
    margin-top: 2px; 
    white-space: nowrap; 
    overflow: hidden; 
    text-overflow: ellipsis; 
}

.mini-controls { 
    display: flex; 
    align-items: center; 
    gap: 20px; 
    flex-shrink: 0; 
}

.ctrl-btn { 
    background: none; 
    border: none; 
    color: var(--accent); 
    cursor: pointer; 
    padding: 5px; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    transition: opacity 0.2s;
}

.ctrl-btn:hover { 
    color: #1ed760; 
}

.ctrl-btn svg { 
    width: 32px; 
    height: 32px; 
}

.volume-container { 
    display: flex; 
    align-items: center; 
    gap: 8px; 
    margin-left: 10px; 
    color: var(--text-dim);
}

#volume-slider { 
    width: 80px; 
    accent-color: var(--accent); 
    cursor: pointer; 
    height: 4px; 
}

@media (max-width: 768px) { 
    .volume-container { display: none !important; } 
    #width-btn { display: none !important; } 
}

#full-player-overlay { 
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
    background-color: var(--bg); 
    z-index: 2000; 
    display: flex; 
    flex-direction: column; 
    padding: 20px; 
    transform: translateY(120%); 
    transition: transform 0.3s cubic-bezier(0.1, 0.9, 0.2, 1); 
    overflow-y: auto; 
}

#full-player-overlay.open { 
    transform: translateY(0); 
}

.overlay-header { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    width: 100%; 
    margin-bottom: 20px; 
}

.close-btn { 
    background: none; 
    border: none; 
    color: var(--text); 
    cursor: pointer; 
    display: flex; 
    align-items: center; 
    justify-content: center;
}

.close-btn svg { 
    width: 32px; 
    height: 32px; 
}

.full-player-content { 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    width: 100%; 
    max-width: 450px; 
    margin: 0 auto; 
}

#full-art { 
    width: 80vw; 
    height: 80vw; 
    max-width: 320px; 
    max-height: 320px; 
    border-radius: 12px; 
    background-color: var(--surface-2); 
    object-fit: cover; 
    box-shadow: 0 8px 24px rgba(0,0,0,0.6); 
    margin-bottom: 25px; 
    cursor: pointer; 
    transition: transform 0.2s; 
}

#full-art:active { 
    transform: scale(0.95); 
}

#full-title { 
    font-size: 20px; 
    font-weight: 700; 
    text-align: center; 
    margin-bottom: 6px; 
    width: 100%; 
    white-space: nowrap; 
    overflow: hidden; 
    text-overflow: ellipsis; 
}

#full-album { 
    font-size: 14px; 
    color: var(--text-dim); 
    text-align: center; 
    margin-bottom: 25px; 
}

.scrubber-container { 
    width: 100%; 
    display: flex; 
    flex-direction: column; 
    gap: 8px; 
    margin-bottom: 25px; 
}

#seek-bar { 
    width: 100%; 
    accent-color: var(--accent); 
    height: 4px; 
    cursor: pointer; 
}

.time-stamps { 
    display: flex; 
    justify-content: space-between; 
    font-size: 12px; 
    color: var(--text-dim); 
}

.large-controls { 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    gap: 35px; 
    margin-bottom: 30px; 
}

.large-ctrl-btn { 
    background: none; 
    border: none; 
    color: var(--text); 
    cursor: pointer; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    transition: opacity 0.2s;
}

.large-ctrl-btn svg { 
    width: 40px; 
    height: 40px; 
}

#full-play-btn svg { 
    width: 56px; 
    height: 56px; 
    color: var(--accent); 
}

.drawer-section { 
    width: 100%; 
    border-top: 1px solid var(--surface-2); 
    padding-top: 20px; 
    margin-top: 15px; 
}

#lightbox-overlay { 
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
    background: rgba(0,0,0,0.95); 
    z-index: 3000; 
    display: none; 
    flex-direction: column; 
}

.lightbox-header { 
    display: flex; 
    justify-content: space-between; 
    padding: 20px; 
    color: var(--text); 
    font-size: 16px; 
    align-items: center; 
}

.lightbox-gallery { 
    flex: 1; 
    display: flex; 
    overflow-x: auto; 
    scroll-snap-type: x mandatory; 
}

.lightbox-gallery::-webkit-scrollbar { 
    display: none; 
}

.lightbox-item { 
    flex: 0 0 100vw; 
    width: 100vw; 
    scroll-snap-align: start; 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    position: relative; 
    padding: 10px; 
}

.lightbox-img { 
    max-width: 100%; 
    max-height: 100%; 
    object-fit: contain; 
}

.pdf-card { 
    background: var(--surface); 
    padding: 30px; 
    border-radius: 12px; 
    text-align: center; 
    border: 1px solid var(--border); 
    max-width: 300px; 
    width: 100%; 
}

.lb-nav { 
    position: absolute; 
    top: 50%; 
    transform: translateY(-50%); 
    background: rgba(0,0,0,0.6); 
    color: white; 
    border: none; 
    width: 44px; 
    height: 44px; 
    border-radius: 50%; 
    font-size: 20px; 
    cursor: pointer; 
    z-index: 3001; 
    display: none; 
    align-items: center; 
    justify-content: center; 
    transition: background 0.2s;
}

.lb-nav:hover { 
    background: var(--accent); 
    color: var(--on-accent); 
}

#main-container { 
    width: 100%; 
    max-width: 1000px; 
    padding: 20px; 
    transition: max-width 0.3s ease; 
}

.top-tabs { 
    display: flex; 
    align-items: center; 
    margin-bottom: 20px; 
    border-bottom: 1px solid var(--surface-2); 
    padding-bottom: 10px; 
    overflow-x: auto; 
    white-space: nowrap;
}

.top-tabs::-webkit-scrollbar { 
    display: none; 
}

.tab-btn { 
    background: none; 
    border: none; 
    color: var(--text-dim); 
    font-size: 16px; 
    font-weight: 600; 
    cursor: pointer; 
    padding: 5px 15px; 
    flex-shrink: 0;
}

.tab-btn.active { 
    color: var(--text); 
    border-bottom: 2px solid var(--accent); 
}

.spacer { 
    flex: 1; 
} 

#status { 
    text-align: center; 
    color: var(--text-dim); 
    font-size: 14px; 
    margin-top: 40px; 
    white-space: pre-wrap; 
}

#view-controls { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    gap: 10px; 
    margin-bottom: 20px; 
}

.search-container { 
    position: relative; 
    width: 60%; 
    display: flex; 
    align-items: center;
}

#search-bar { 
    background-color: var(--surface-2); 
    border: none; 
    color: var(--text); 
    padding: 10px 40px 10px 15px; 
    border-radius: 20px; 
    font-size: 14px; 
    width: 100%; 
    outline: none; 
}

/* Merged styles for the Dice and Clear search icons */
.search-icon-btn {
    position: absolute;
    right: 12px;
    color: var(--text-dim);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 5px;
    transition: color 0.2s ease;
}

.search-icon-btn:hover {
    color: var(--text);
}

.view-toggle { 
    background-color: transparent; 
    color: var(--text-dim); 
    border: 1px solid var(--text-dim); 
    padding: 6px 12px; 
    border-radius: 4px; 
    cursor: pointer; 
    font-size: 13px; 
    display: flex; 
    align-items: center; 
    text-decoration: none; 
    justify-content: center;
}

.view-toggle svg { 
    width: 20px; 
    height: 20px; 
}

.view-toggle.active { 
    background-color: var(--text); 
    color: var(--bg); 
    border-color: var(--text); 
}

#album-list, #collection-list { 
    display: grid; 
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); 
    gap: 15px; 
}

.album-card { 
    background-color: var(--surface); 
    padding: 12px; 
    border-radius: 8px; 
    text-align: center; 
    cursor: pointer; 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    transition: background-color 0.2s; 
}

.album-card:hover { 
    background-color: var(--surface-2); 
}

.art-wrapper { 
    position: relative; 
    width: 100%; 
    aspect-ratio: 1 / 1; 
    margin-bottom: 10px; 
    border-radius: 6px; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
}

.fallback-text { 
    position: absolute; 
    top:0; 
    left:0; 
    width:100%; 
    height:100%; 
    display:flex; 
    align-items:center; 
    justify-content:center; 
    background-color:var(--surface-2); 
    border-radius:6px; 
    color:var(--text-dim); 
    font-size:12px; 
    padding:10px; 
    text-align:center; 
    box-sizing:border-box; 
    overflow:hidden; 
    word-break: break-word; 
    line-height: 1.4; 
    z-index: 1; 
}

.grid-art-thumb { 
    position: relative; 
    z-index: 2; 
    width: 100%; 
    aspect-ratio: 1 / 1; 
    object-fit: cover; 
    border-radius: 6px; 
    background-color: transparent; 
    display: block; 
}

.album-title { 
    font-size: 13px; 
    font-weight: 600; 
    word-wrap: break-word; 
}

#album-list.list-view { 
    display: flex; 
    flex-direction: column; 
    gap: 10px; 
}

#album-list.list-view .album-card { 
    flex-direction: row; 
    text-align: left; 
    padding: 8px 12px; 
}

#album-list.list-view .art-wrapper { 
    width: 45px; 
    height: 45px; 
    margin-bottom: 0; 
    margin-right: 12px; 
    flex-shrink: 0; 
}

#album-list.list-view .fallback-text { 
    font-size: 9px; 
    padding: 4px; 
}

#album-list.single-column { 
    display: grid; 
    grid-template-columns: 1fr; 
    gap: 25px; 
}

#album-list.single-column .album-card { 
    padding: 20px; 
}

#album-list.single-column .art-wrapper { 
    max-width: 400px; 
    margin: 0 auto 15px auto; 
    box-shadow: 0 4px 12px rgba(0,0,0,0.4); 
    border-radius: 8px; 
}

#album-list.single-column .fallback-text { 
    font-size: 18px; 
    border-radius: 8px; 
    padding: 20px; 
}

#album-list.single-column .album-title { 
    font-size: 16px; 
    font-weight: 700; 
}

.track-item { 
    padding: 12px 16px; 
    background-color: var(--surface); 
    border-radius: 4px; 
    cursor: pointer; 
    margin-bottom: 6px; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    font-size: 14px; 
    transition: background-color 0.2s, opacity 0.2s;
}

.track-item:hover { 
    background-color: var(--surface-2); 
}

.track-item.playing { 
    color: var(--accent); 
    font-weight: bold; 
    background-color: var(--surface-3); 
}

.track-item.drag-over { 
    border-top: 2px solid var(--accent); 
}

.track-item.unavailable { 
    opacity: 0.4; 
    pointer-events: none; 
}

.add-p-btn, .del-p-btn { 
    background-color: var(--surface-2); 
    color: var(--text-dim); 
    border: 1px solid var(--text-dim); 
    border-radius: 12px; 
    padding: 4px 10px; 
    font-size: 12px; 
    cursor: pointer; 
    margin-left: 8px; 
    z-index: 5;
}

.add-p-btn:hover { 
    background-color: var(--accent); 
    color: var(--on-accent); 
    border-color: var(--accent);
}

.del-p-btn:hover { 
    background-color: #ff4d4d; 
    color: var(--on-accent); 
    border-color: #ff4d4d;
}

.playlist-input-group { 
    display: flex; 
    gap: 10px; 
    margin-bottom: 15px; 
}

.playlist-input { 
    background-color: var(--surface-2); 
    border: none; 
    color: var(--text); 
    padding: 10px 12px; 
    border-radius: 4px; 
    flex: 1; 
    outline: none; 
}

#modal-overlay { 
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
    background-color: rgba(0,0,0,0.8); 
    z-index: 3000; 
    display: none; 
    justify-content: center; 
    align-items: center; 
    padding: 20px; 
}

#modal-content { 
    background-color: var(--surface); 
    width: 100%; 
    max-width: 350px; 
    border-radius: 12px; 
    padding: 20px; 
    display: flex; 
    flex-direction: column; 
    max-height: 80vh; 
}

#modal-list { 
    overflow-y: auto; 
    display: flex; 
    flex-direction: column; 
    gap: 8px; 
    margin: 15px 0; 
}

.modal-p-btn { 
    background-color: var(--surface-2); 
    border: none; 
    color: var(--text); 
    padding: 12px; 
    border-radius: 6px; 
    cursor: pointer; 
    text-align: left; 
}

.modal-p-btn:hover { 
    background-color: #383838; 
    color: var(--accent); 
}

#toast { 
    position: fixed; 
    bottom: 90px; 
    left: 50%; 
    transform: translateX(-50%); 
    background-color: var(--accent); 
    color: var(--on-accent); 
    padding: 12px 24px; 
    border-radius: 24px; 
    font-weight: bold; 
    font-size: 14px; 
    opacity: 0; 
    pointer-events: none; 
    transition: opacity 0.3s ease; 
    z-index: 10000;
    width: max-content;
    max-width: min(92vw, 520px);   /* long messages wrap instead of running off the screen */
    text-align: center;
    box-sizing: border-box; 
    box-shadow: 0 4px 12px rgba(0,0,0,0.4); 
    white-space: normal;
    line-height: 1.35;
}
/* Album "Add" button: same icon as the track menu, green like Like/Bookmark */
.album-add-btn {
    background: none;
    border: none;
    color: var(--accent);
    cursor: pointer;
    align-items: center;
    gap: 5px;
    font-size: 14px;
    padding: 0;
}
.album-add-btn svg { width: 18px; height: 18px; }

/* Per-track "Add" (album track list and play queue): grey icon */
.track-add-btn,
.add-p-btn.track-add-btn {
    background: none;
    border: none;
    color: var(--text-dim);
    padding: 4px 6px;
    margin: 0 4px 0 0;
    border-radius: 6px;
    display: flex;
    align-items: center;
    cursor: pointer;
}
.track-add-btn svg { width: 22px; height: 22px; }
.track-add-btn:hover,
.add-p-btn.track-add-btn:hover {
    background: none;
    color: var(--accent);
}

/* =====================================================================
   FEED ON PHONES: fill the space between the tab bar and the player bar
   (top/bottom are measured by layoutFeedView() in app.js)
   ===================================================================== */
@media (max-width: 768px) {
    #feed-view.feed-fullscreen {
        position: fixed !important;
        top: var(--feed-top, 70px) !important;
        bottom: var(--feed-bottom, 75px) !important;
        left: 0 !important;
        right: 0 !important;
        height: auto !important;
        padding: 0 !important;
        z-index: 50;
        background: var(--bg);
    }
    #feed-view.feed-fullscreen #feed-view-container {
        height: 100% !important;
        border-radius: 0 !important;
        border: none !important;
    }
}

/* Let the message list shrink to the space available and scroll inside it.
   Without min-height:0 the list grew to fit every message and the bottom
   was cut off (most noticeable on Global, which has the most messages). */
#feed-view-container > div,
#feed-list {
    min-height: 0;
}

/* AirPlay + Cast buttons, top right of the full-screen player */
.output-buttons {
    display: flex;
    align-items: center;
    gap: 14px;
}
.airplay-btn {
    background: none;
    border: none;
    color: var(--text);
    padding: 0;
    width: 28px;
    height: 28px;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.airplay-btn.active { color: var(--accent); }

/* Recent page */
.recent-item { gap: 12px; justify-content: flex-start; }
.recent-icon { color: var(--accent); display: flex; align-items: center; flex-shrink: 0; }
.recent-icon svg { width: 16px; height: 16px; }
.recent-text { flex: 1; min-width: 0; text-align: left; }
.recent-title { color: var(--text); overflow-wrap: anywhere; }
.recent-sub { color: var(--text-faint); font-size: 12px; margin-top: 3px; overflow-wrap: anywhere; }

/* Tracks shared to the Feed (shown like a Like) */
.feed-share {
    align-self: center;
    max-width: 90%;
    background: color-mix(in srgb, var(--accent) 10%, transparent);
    color: var(--accent);
    padding: 10px 16px;
    border-radius: 16px;
    font-size: 12.5px;
    margin-bottom: 10px;
    text-align: center;
    line-height: 1.4;
}
.feed-share-link { color: var(--text); cursor: pointer; text-decoration: underline; overflow-wrap: anywhere; }
.feed-share-note { color: var(--text); font-size: 13px; margin-top: 6px; overflow-wrap: anywhere; }
.feed-share-meta { color: var(--text-faint); font-size: 10px; margin-top: 5px; }
.feed-share-del { color: #ff4d4d; cursor: pointer; }

/* Collections: press-and-hold to reorder */
#collection-list .album-card { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.album-card.collection-dragging {
    position: fixed !important;
    z-index: 5000;
    pointer-events: none;
    transform: scale(1.05);
    box-shadow: 0 16px 40px rgba(0,0,0,0.7);
    opacity: 0.95;
    margin: 0;
}
.collection-placeholder {
    border: 2px dashed var(--accent);
    background: color-mix(in srgb, var(--accent) 6%, transparent) !important;
}
body.reordering { -webkit-user-select: none; user-select: none; }

/* Album sort button */
.album-sort-btn { font-size: 12px; font-weight: bold; min-width: 64px; padding: 6px 10px; white-space: nowrap; }

/* Collection cards: the cover image ignores presses, so the card gets them.
   Stops iPad's image preview/drag and the desktop "drag this image" taking over. */
#collection-list .album-card img,
#collection-list .album-card .art-wrapper {
    pointer-events: none;
    -webkit-user-drag: none;
    -webkit-touch-callout: none;
}
#collection-list .album-card { -webkit-user-drag: none; touch-action: manipulation; }

/* --- Feed: channels, unread dots, members, reactions --- */
.channel-item { padding: 14px 15px; cursor: pointer; font-size: 13px; border-bottom: 1px solid var(--surface-3); transition: background 0.2s; color: var(--text-dim); display: flex; align-items: center; gap: 8px; }
.channel-item:hover { background: var(--surface-2); }
.channel-item.active { background: color-mix(in srgb, var(--accent) 10%, transparent); color: var(--accent); font-weight: bold; }
.channel-item .channel-icon { display: inline-flex; flex-shrink: 0; opacity: 0.85; }
.channel-item .channel-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.channel-item .unread-dot { margin-left: auto; }

.unread-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--bg); flex-shrink: 0; }
#tab-feed { position: relative; }
#tab-feed .tab-dot { position: absolute; top: 4px; right: 8px; width: 9px; height: 9px; pointer-events: none; }

#active-channel-header { display: flex; flex-direction: column; gap: 3px; }
#active-channel-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#active-channel-members { font-size: 11px; font-weight: normal; color: var(--text-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 768px) {
    /* The channel strip already shows the name, so only the members line is shown */
    #active-channel-name { display: none; }
    #active-channel-header.is-global { display: none !important; }
    #active-channel-header { padding: 6px 15px !important; }
    .channel-item { gap: 6px; }
}

/* Long-press to react: stop the phone selecting text or popping up its own menu */
.chat-bubble, .feed-share { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
@media (hover: hover) and (pointer: fine) {
    /* Desktop can still select and copy message text */
    .chat-bubble, .feed-share { -webkit-user-select: text; user-select: text; }
}
.chat-bubble.reacting, .feed-share.reacting { outline: 2px solid color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: 2px; }

#reaction-picker { position: fixed; z-index: 20000; display: flex; gap: 2px; padding: 6px 8px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 28px; box-shadow: 0 8px 24px rgba(0,0,0,0.6); animation: reactionPop 0.12s ease-out; }
#reaction-picker button { background: transparent; border: none; font-size: 24px; line-height: 1; padding: 6px; border-radius: 50%; cursor: pointer; transition: transform 0.1s, background 0.1s; }
#reaction-picker button:hover, #reaction-picker button:active { background: var(--border); transform: scale(1.2); }
@keyframes reactionPop { from { transform: scale(0.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.feed-reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.feed-reactions.right { justify-content: flex-end; }
.reaction-chip { background: var(--surface-3); border: 1px solid var(--border); color: var(--text); border-radius: 12px; padding: 2px 8px; font-size: 13px; line-height: 1.4; cursor: pointer; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.reaction-chip.mine { background: color-mix(in srgb, var(--accent) 18%, transparent); border-color: var(--accent); color: var(--text); }

/* --- Likes & Bookmarks rows: title + details line that always fit the screen --- */
#likes-list .track-item, #bookmarks-list .track-item { align-items: stretch; }
.saved-row { display: flex; align-items: center; width: 100%; min-width: 0; gap: 10px; }
.saved-row .action-btn-remove-icon { background: none; border: none; color: var(--accent); cursor: pointer; padding: 0; display: flex; align-items: center; flex-shrink: 0; }
.saved-text { flex: 1; min-width: 0; cursor: pointer; text-align: left; }
.saved-title { overflow-wrap: anywhere; line-height: 1.35; }
.saved-meta { color: var(--text-faint); font-size: 12px; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.saved-row .accordion-toggle { background: transparent; border: none; color: var(--text-dim); font-size: 16px; cursor: pointer; width: 30px; flex-shrink: 0; padding: 0; }
.saved-details { width: 100%; margin-top: 12px; padding: 12px; background: var(--surface); border-radius: 6px; font-size: 12px; color: var(--text-dim); box-sizing: border-box; text-align: left; overflow-wrap: anywhere; }

/* --- "More artwork" badge on the big cover in the player --- */
.art-stack { position: relative; width: 80vw; height: 80vw; max-width: 320px; max-height: 320px; margin-bottom: 25px; cursor: pointer; touch-action: pan-y; }
.art-stack #full-art { margin-bottom: 0; width: 100%; height: 100%; max-width: none; max-height: none; }
.art-more-badge {
    position: absolute; top: 10px; right: 10px; z-index: 2; display: flex; align-items: center; gap: 5px;
    padding: 5px 9px; border-radius: 14px; font-size: 12px; font-weight: 700; color: #fff;
    background: rgba(0,0,0,0.55); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
    border: 1px solid rgba(255,255,255,0.15); pointer-events: none;
    opacity: 0; transform: scale(0.9); transition: opacity 0.25s ease, transform 0.25s ease;
}
.art-stack.has-more-art .art-more-badge { opacity: 1; transform: scale(1); }
.art-stack:active #full-art { transform: scale(0.97); }

/* Other "more artwork" styles, shown under the cover */
#art-more-below { display: none; }
#art-more-below[class^="art-more-"] { display: flex; align-items: center; justify-content: center; gap: 6px; margin: -14px 0 16px; cursor: pointer; min-height: 10px; }
.art-more-strip div { width: 34px; height: 34px; border-radius: 5px; background: var(--surface-2) center / cover no-repeat; border: 1px solid var(--border); opacity: 0.9; }
.art-more-strip span { font-size: 12px; color: var(--text-dim); margin-left: 2px; }
.art-more-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--text-faint); }
.art-more-dots i.on { background: var(--text); }
.art-more-link { color: var(--accent); font-size: 13px; font-weight: 600; }

/* --- Settings: theme picker and collection switches --- */
.settings-card { margin-top: 20px; padding: 15px; background: var(--surface); border-radius: 6px; }
.theme-choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.theme-choice { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 12px; border-radius: 10px;
    border: 2px solid var(--border); cursor: pointer; font-family: inherit; font-size: 13px; font-weight: 600; text-align: left; }
.theme-choice.selected { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 30%, transparent); }
.tc-swatches { display: flex; gap: 4px; }
.tc-swatches i { width: 18px; height: 18px; border-radius: 50%; border: 1px solid rgba(128,128,128,0.35); }
.tc-draft { position: absolute; top: 8px; right: 8px; font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 8px; background: rgba(128,128,128,0.3); }
.col-pref-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--surface-2); }
.col-pref-row.off .col-pref-name { color: var(--text-faint); text-decoration: line-through; }
.col-pref-name { flex: 1; min-width: 0; overflow-wrap: anywhere; color: var(--text); }
.col-pref-eye { background: none; border: none; color: var(--text-dim); cursor: pointer; padding: 4px; display: flex; }
.col-pref-eye.hidden-col { color: var(--text-faint); }
.col-pref-eye:disabled { opacity: 0.3; cursor: default; }
.col-pref-switch { position: relative; width: 40px; height: 22px; flex-shrink: 0; cursor: pointer; }
.col-pref-switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.col-pref-switch span { position: absolute; inset: 0; background: var(--border); border-radius: 22px; transition: background 0.2s; }
.col-pref-switch span::after { content: ''; position: absolute; width: 18px; height: 18px; left: 2px; top: 2px; background: #fff; border-radius: 50%; transition: transform 0.2s; }
.col-pref-switch input:checked + span { background: var(--accent); }
.col-pref-switch input:checked + span::after { transform: translateX(18px); }
.settings-tabs { display: flex; gap: 6px; margin-bottom: 14px; border-bottom: 1px solid var(--surface-2); }
.settings-tabs button { background: none; border: none; border-bottom: 2px solid transparent; color: var(--text-dim); padding: 8px 10px; font-size: 14px; font-weight: 700; cursor: pointer; font-family: inherit; margin-bottom: -1px; }
.settings-tabs button.active { color: var(--text); border-bottom-color: var(--accent); }

/* "Reconnect to TV" after the cast connection was lost */
#cast-reconnect { position: fixed; left: 50%; transform: translateX(-50%); bottom: 190px; z-index: 10001;
    background: var(--accent); color: var(--on-accent); border: none; border-radius: 22px; padding: 10px 18px; font-weight: 700; font-size: 14px;
    box-shadow: 0 6px 18px rgba(0,0,0,0.5); cursor: pointer; font-family: inherit; }

/* --- Playlists: type picker and sections --- */
.playlist-input-group { flex-wrap: wrap; }
.playlist-type-select { flex: 0 1 220px; min-width: 0; cursor: pointer; }
@media (max-width: 600px) { .playlist-input-group .playlist-input:first-child { flex-basis: 100%; } .playlist-type-select { flex: 1 1 auto; } }
.playlist-section-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px; color: var(--text-dim); margin: 18px 0 8px; }
.playlist-section-title:first-child { margin-top: 4px; }
.playlist-row-sub { font-size: 11px; color: var(--text-faint); margin-top: 3px; }

/* Playlist share window */
.pl-share-modal { display: none; position: fixed; bottom: 120px; left: 50%; transform: translateX(-50%); background: var(--surface-2); padding: 20px; border-radius: 12px; z-index: 9999; width: 320px; max-width: calc(100vw - 32px); box-sizing: border-box; box-shadow: 0 10px 40px rgba(0,0,0,0.6); font-family: sans-serif; text-align: center; }
.pl-share-modal h4 { margin: 0 0 12px 0; color: var(--text); font-size: 16px; }
.pl-share-name { color: var(--text-dim); font-size: 13px; margin-bottom: 18px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl-share-row { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }
.pl-share-opt { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.pl-share-opt button { border: none; color: var(--text); width: 52px; height: 52px; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: filter 0.2s; }
.pl-share-opt button:hover { filter: brightness(1.2); }
.pl-share-opt span { color: var(--text-dim); font-size: 11px; }
.pl-share-hint { color: var(--text-faint); font-size: 11px; margin-top: 16px; line-height: 1.4; }
.pl-share-panel { text-align: left; }
.pl-share-panel label { color: var(--text-dim); font-size: 12px; display: block; margin-bottom: 6px; }
.pl-share-panel select, .pl-share-panel input[type="text"] { width: 100%; padding: 10px; border-radius: 8px; border: none; background: var(--border); color: var(--text); font-size: 14px; margin-bottom: 12px; box-sizing: border-box; }
.pl-share-panel label.pl-share-check { display: flex; align-items: center; gap: 8px; cursor: pointer; margin: 4px 0 16px; font-size: 13px; }
.pl-share-check input { accent-color: var(--accent); width: 16px; height: 16px; }
.pl-share-explain { color: var(--text-dim); font-size: 12px; line-height: 1.4; margin: 0 0 12px; }
.pl-share-btns { display: flex; gap: 10px; }
.pl-share-btns button { flex: 1; padding: 10px; border-radius: 20px; cursor: pointer; }
.pl-share-btns .pl-share-back { border: 1px solid var(--text-faint); background: none; color: var(--text-dim); }
.pl-share-btns .btn-green { border: none; font-weight: bold; }
.pl-share-close { position: absolute; top: 12px; right: 12px; background: none; border: none; color: var(--text-dim); cursor: pointer; font-size: 16px; padding: 0; }

/* Album page header: big cover in the middle, title and details underneath */
.album-hero { display: flex; flex-direction: column; align-items: center; gap: 14px; margin: 0 0 6px; text-align: center; }
.album-hero-text { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.album-hero-title { margin: 4px 0 0; font-size: 22px; line-height: 1.25; overflow-wrap: anywhere; max-width: 640px; }
.album-hero-art { position: relative; width: min(72vw, 300px); aspect-ratio: 1; padding: 0; border: none; border-radius: 12px; overflow: hidden; background: var(--surface-2); cursor: zoom-in; box-shadow: 0 10px 30px rgba(0,0,0,0.45); }
.album-hero-art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.album-hero-art.no-cover img { display: none; }
.album-hero-art.no-cover::after { content: '♪'; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 64px; color: var(--text-faint); }
.album-hero-meta { color: var(--text); font-size: 14px; min-height: 1.3em; }
.album-hero-stats { color: var(--text-dim); font-size: 12px; line-height: 1.5; }
.album-hero-stats:empty { display: none; }
.album-hero-counts span { margin: 0 6px; white-space: nowrap; display: inline-flex; align-items: center; gap: 4px; }
.album-hero-counts svg { width: 13px; height: 13px; color: var(--accent); }
.album-hero-dim { color: var(--text-faint); }
.album-hero-actions { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px 22px; margin-top: 6px; }
.album-hero-strip { display: flex; gap: 8px; overflow-x: auto; max-width: 100%; padding: 8px 0 2px; margin-bottom: 8px; justify-content: safe center; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.album-hero-strip:empty { display: none; }
.album-hero-strip::-webkit-scrollbar { display: none; }
.album-hero-thumb { flex: 0 0 auto; width: 64px; height: 64px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface-2) center / cover no-repeat; cursor: zoom-in; padding: 0; color: var(--text-dim); font-size: 12px; font-weight: bold; }
.album-hero-thumb:hover { filter: brightness(1.15); }
@media (min-width: 700px) {
    /* Larger screens: cover on the left, title, details and buttons on the right */
    .album-hero { flex-direction: row; align-items: flex-start; gap: 28px; text-align: left; margin-bottom: 18px; }
    .album-hero-art { flex: 0 0 auto; }
    .album-hero-text { align-items: flex-start; flex: 1; min-width: 0; padding-top: 4px; }
    .album-hero-title { max-width: none; }
    .album-hero-actions { justify-content: flex-start; }
    .album-hero-counts span:first-child { margin-left: 0; }
    .album-hero-strip { justify-content: flex-start; }
    .album-hero-title { font-size: 28px; }
    .album-hero-meta { font-size: 15px; }
    .album-hero-stats { font-size: 13px; }
    .album-hero-thumb { width: 76px; height: 76px; }
}

/* Now Playing: the album name opens the album */
#full-album.full-album-link { cursor: pointer; }
#full-album.full-album-link:hover, #full-album.full-album-link:focus-visible { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }

/* Album page, larger screens: the thumbnails line up with the bottom of the cover */
@media (min-width: 700px) {
    .album-hero { align-items: stretch; }
    .album-hero-art { align-self: flex-start; }
    .album-hero-text { align-self: stretch; }
    .album-hero-text .album-hero-strip { margin-top: auto; margin-bottom: 0; padding-bottom: 0; }
}

/* Now Playing: back / forward 10 seconds (double arrows), either side of previous / next */
.large-ctrl-btn.skip-btn { color: var(--text-dim); padding: 0; }
.large-ctrl-btn.skip-btn svg { width: 32px; height: 32px; }
.large-ctrl-btn.skip-btn:hover { color: var(--text); }
.large-ctrl-btn.skip-btn:active { transform: scale(0.92); }
@media (max-width: 420px) {
    .large-controls { gap: 18px !important; }
    .large-ctrl-btn.skip-btn svg { width: 30px; height: 30px; }
}

/* Album groups ("_" folders): a folder card on the Albums page, and a header when open */
.group-card .art-wrapper { position: relative; }
.group-card .art-wrapper::before { content: ''; position: absolute; left: 6px; right: 6px; top: -5px; height: 8px; border-radius: 6px 6px 0 0; background: var(--surface-3); z-index: 0; }
.group-card .grid-art-thumb, .group-card .fallback-text { position: relative; z-index: 1; }
.group-badge { position: absolute; right: 6px; bottom: 6px; z-index: 2; display: flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 10px; background: rgba(0,0,0,0.72); color: #fff; font-size: 11px; font-weight: 700; line-height: 1; }
.group-card .album-title { font-weight: 700; }
.group-header { display: flex; align-items: center; gap: 14px; margin: 0 0 16px; }
.group-header-text { min-width: 0; }
.group-header-text h2 { margin: 0; font-size: 22px; line-height: 1.2; overflow-wrap: anywhere; }
.group-header-text span { color: var(--text-dim); font-size: 13px; }

/* Very long names with no spaces (e.g. file names joined with underscores) wrap onto
   the next line instead of pushing the page off the side of the screen */
.track-item > div, .track-item .track-title, .track-item span, .track-details, .track-details div,
.album-title, .saved-title, .saved-meta, .playlist-row-sub, .feed-share-link,
#full-title, #full-album, #viewing-playlist-title, .group-header-text h2, .album-hero-meta {
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
}
.track-item > div { max-width: 100%; }
.track-item button, .track-item .add-p-btn, .track-item .accordion-toggle { flex-shrink: 0; }
.mini-info { min-width: 0; }