/* =========================================================
   PocketStream — 100% Mobile-First Progressive Web App Styles
   ========================================================= */

:root {
    --bg-primary: #090a0f;
    --bg-secondary: #12141c;
    --bg-card: rgba(22, 25, 38, 0.7);
    --bg-card-hover: rgba(32, 36, 54, 0.85);
    --bg-glass: rgba(15, 17, 26, 0.82);
    --bg-glass-modal: rgba(12, 14, 22, 0.95);
    
    --accent: #6366f1;
    --accent-hover: #4f46e5;
    --accent-glow: rgba(99, 102, 241, 0.35);
    --accent-gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 50%, #ec4899 100%);
    
    --text-primary: #ffffff;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border-color: rgba(255, 255, 255, 0.08);
    --border-active: rgba(99, 102, 241, 0.4);

    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;

    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-full: 9999px;

    --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --bottom-nav-height: 64px;
    --mini-player-height: 62px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-family);
    overflow: hidden;
    height: 100vh;
    height: 100dvh;
    width: 100vw;
    position: fixed;
}

/* Background Canvas for Full Player WebGL Mist */
#mistCanvas {
    display: none;
}

/* App Container */
#app {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    position: relative;
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* Header */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 18px;
    background: transparent;
    z-index: 20;
    flex-shrink: 0;
}
.brand {
    display: flex;
    align-items: center;
    gap: 10px;
}
.brand-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px var(--accent-glow);
}
.brand-title {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, #ffffff 40%, #cbd5e1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}
.net-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    background: rgba(16, 185, 129, 0.12);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.25);
    transition: all 0.3s ease;
}
.net-pill.offline {
    background: rgba(245, 158, 11, 0.12);
    color: var(--warning);
    border-color: rgba(245, 158, 11, 0.3);
}
.net-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 8px currentColor;
}

/* Views Container */
.views-viewport {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    padding: 0 16px;
    padding-bottom: calc(var(--bottom-nav-height) + var(--mini-player-height) + 20px);
    -webkit-overflow-scrolling: touch;
}
.view-section {
    display: none;
    flex-direction: column;
    gap: 20px;
    animation: fadeIn 0.25s ease-out;
}
.view-section.active {
    display: flex;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Install Banner */
.install-banner {
    display: none;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2) 0%, rgba(236, 72, 153, 0.2) 100%);
    border: 1px solid rgba(99, 102, 241, 0.4);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    margin-bottom: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}
.install-banner.show {
    display: flex;
}
.install-btn {
    background: #ffffff;
    color: #090a0f;
    border: none;
    border-radius: var(--radius-full);
    padding: 6px 14px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
}

/* Section Titles & Carousels */
.section-title {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.horizontal-scroll {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    padding-bottom: 8px;
    margin: 0 -16px;
    padding-left: 16px;
    padding-right: 16px;
    scrollbar-width: none;
}
.horizontal-scroll::-webkit-scrollbar {
    display: none;
}

/* Cards */
.media-card {
    flex: 0 0 135px;
    width: 135px;
    max-width: 135px;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    box-sizing: border-box;
}
.media-card:active {
    transform: scale(0.96);
}
.card-thumb-wrap {
    width: 135px;
    height: 135px;
    border-radius: var(--radius-md);
    overflow: hidden;
    position: relative;
    background: var(--bg-secondary);
    box-shadow: 0 6px 16px rgba(0,0,0,0.3);
    flex-shrink: 0;
}
.card-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.card-title {
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    max-width: 135px;
    display: block;
}
.card-subtitle {
    font-size: 0.72rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    max-width: 135px;
    display: block;
}

/* Track Rows */
.track-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.track-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 10px;
    border-radius: var(--radius-md);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.15s ease;
}
.track-row:active {
    background: var(--bg-card-hover);
    transform: scale(0.98);
}
.track-row.playing {
    border-color: var(--border-active);
    background: rgba(99, 102, 241, 0.15);
}
.track-thumb {
    width: 46px;
    height: 46px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    background: var(--bg-secondary);
    flex-shrink: 0;
}
.track-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.track-name {
    font-size: 0.88rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.track-artist {
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.track-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
}
.btn-icon {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full);
}
.btn-icon.active {
    color: #ec4899;
}
.btn-icon:active {
    transform: scale(0.85);
}

/* Search Bar */
.search-bar-wrap {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    padding: 0 16px;
    gap: 10px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}
.search-bar-wrap:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-glow);
}
.search-input {
    flex: 1;
    background: none;
    border: none;
    padding: 12px 0;
    color: var(--text-primary);
    font-size: 0.95rem;
    outline: none;
    user-select: text;
}
.search-input::placeholder {
    color: var(--text-muted);
}

/* Autocomplete Dropdown */
.suggestions-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: var(--bg-glass-modal);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    z-index: 40;
    box-shadow: 0 12px 36px rgba(0,0,0,0.6);
    display: none;
}
.suggestions-dropdown.show {
    display: flex;
    flex-direction: column;
}
.suggestion-item {
    padding: 12px 16px;
    font-size: 0.88rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}
.suggestion-item:last-child {
    border-bottom: none;
}
.suggestion-item:active {
    background: rgba(99, 102, 241, 0.15);
    color: #ffffff;
}

/* Library Filter Chips */
.filter-chips {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
}
.filter-chips::-webkit-scrollbar {
    display: none;
}
.chip {
    padding: 6px 14px;
    border-radius: var(--radius-full);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}
.chip.active {
    background: var(--accent);
    color: #ffffff;
    border-color: var(--accent);
    box-shadow: 0 2px 10px var(--accent-glow);
}

/* Floating Mini-Player */
.mini-player {
    position: fixed;
    bottom: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom, 0px) + 8px);
    left: 12px;
    right: 12px;
    height: var(--mini-player-height);
    background: var(--bg-glass);
    backdrop-filter: blur(24px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    display: none;
    align-items: center;
    padding: 0 12px;
    gap: 12px;
    z-index: 45;
    box-shadow: 0 8px 32px rgba(0,0,0,0.6);
    cursor: pointer;
    overflow: hidden;
    transform: translateY(0);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.mini-player.show {
    display: flex;
}
.mini-progress-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 2.5px;
    background: var(--accent-gradient);
    width: 0%;
    transition: width 0.3s linear;
}
.mini-thumb {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    background: var(--bg-secondary);
    flex-shrink: 0;
}
.mini-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}
.mini-title {
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.mini-artist {
    font-size: 0.72rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.mini-controls {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: #0f111a;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    display: flex;
    align-items: center;
    justify-content: space-around;
    z-index: 50;
    box-shadow: none;
}
.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: #cbd5e1;
    font-size: 0.74rem;
    font-weight: 600;
    cursor: pointer;
    background: none;
    border: none;
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.nav-item:active {
    transform: scale(0.92);
}
.nav-item.active {
    color: #818cf8;
    font-weight: 700;
}
.nav-item svg {
    width: 22px;
    height: 22px;
    stroke: currentColor;
    transition: transform 0.2s ease, filter 0.2s ease;
}
.nav-item.active svg {
    stroke: #818cf8;
    filter: drop-shadow(0 0 6px rgba(129, 140, 248, 0.6));
    transform: translateY(-1px);
}

/* Full-Screen Now Playing Sheet */
.full-player-sheet {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    z-index: 60;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: calc(env(safe-area-inset-top, 0px) + 16px) 24px calc(env(safe-area-inset-bottom, 0px) + 24px);
    background: #090a0f;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.4s;
    pointer-events: none;
    visibility: hidden;
}
.full-player-sheet.open {
    transform: translateY(0);
    pointer-events: auto;
    visibility: visible;
}
.full-player-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.sheet-dismiss-btn {
    background: rgba(255,255,255,0.1);
    border: none;
    color: #ffffff;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.player-album-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px 0;
}
.player-album-art {
    width: min(78vw, 320px);
    height: min(78vw, 320px);
    border-radius: var(--radius-lg);
    object-fit: cover;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.65);
    background: var(--bg-secondary);
}

.player-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 10px;
}
.meta-left {
    min-width: 0;
    flex: 1;
}
.player-title {
    font-size: 1.3rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.player-artist {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-top: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Scrubbable Seek Bar */
.seek-container {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 14px;
}
.seek-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 5px;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.2);
    outline: none;
    cursor: pointer;
}
.seek-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.5);
    cursor: pointer;
}
.time-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.72rem;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

/* Primary Playback Controls */
.primary-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 10px;
}
.btn-play-large {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: #ffffff;
    color: #090a0f;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(255,255,255,0.25);
    transition: transform 0.15s ease;
}
.btn-play-large:active {
    transform: scale(0.92);
}
.secondary-actions {
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: 6px 0;
    color: var(--text-secondary);
}

/* Sheet Backdrops (Tap to Dismiss) */
.sheet-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 55;
}
.sheet-backdrop.show {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

#playerBackdrop {
    z-index: 55;
}

#albumBackdrop {
    z-index: 68;
}

#queueBackdrop {
    z-index: 73;
}

#actionSheetBackdrop {
    z-index: 85;
}

/* Queue Bottom Sheet */
.queue-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100vw;
    height: 75vh;
    height: 75dvh;
    background: var(--bg-glass-modal);
    backdrop-filter: blur(28px);
    border-top: 1px solid var(--border-color);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    z-index: 75;
    display: flex;
    flex-direction: column;
    padding: 16px 20px;
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.35s ease;
    pointer-events: none;
    visibility: hidden;
}
.queue-sheet.open {
    transform: translateY(0);
    pointer-events: auto;
    visibility: visible;
}
.sheet-drag-handle {
    width: 40px;
    height: 4px;
    border-radius: var(--radius-full);
    background: rgba(255,255,255,0.25);
    align-self: center;
    margin-bottom: 12px;
    cursor: grab;
}

/* Dedicated Album / Collection Detail Sheet */
.album-detail-sheet {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    background: #090a0f;
    z-index: 70;
    display: flex;
    flex-direction: column;
    padding: calc(env(safe-area-inset-top, 0px) + 12px) 18px calc(env(safe-area-inset-bottom, 0px) + 18px);
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.35s ease;
    pointer-events: none;
    visibility: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
.album-detail-sheet.open {
    transform: translateY(0);
    pointer-events: auto;
    visibility: visible;
}
.album-header-hero {
    display: flex;
    gap: 16px;
    align-items: center;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border-color);
}
.album-hero-art {
    width: 105px;
    height: 105px;
    border-radius: var(--radius-md);
    object-fit: cover;
    background: var(--bg-secondary);
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
    flex-shrink: 0;
}
.album-hero-meta {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}
.album-hero-title {
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.album-hero-artist {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.album-hero-sub {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 2px;
}
.album-actions-row {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    margin-bottom: 4px;
}
.album-act-btn {
    flex: 1;
    padding: 10px 0;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: #ffffff;
    font-size: 0.8rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
    transition: transform 0.15s ease;
}
.album-act-btn:active {
    transform: scale(0.95);
}
.album-act-btn.primary {
    background: #ffffff;
    color: #090a0f;
    border-color: #ffffff;
    font-weight: 700;
}

/* Settings Cards & Dev Panel */
.settings-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.settings-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.user-profile-card {
    display: flex;
    align-items: center;
    gap: 14px;
}
.avatar-large {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--accent);
}
.storage-meter {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.meter-bar {
    height: 8px;
    border-radius: var(--radius-full);
    background: rgba(255,255,255,0.1);
    overflow: hidden;
}
.meter-fill {
    height: 100%;
    background: var(--accent-gradient);
    width: 0%;
    border-radius: var(--radius-full);
    transition: width 0.4s ease;
}

/* Access Request / Private Beta Screen */
.auth-gate-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: var(--bg-primary);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px;
    text-align: center;
    z-index: 100;
}
.auth-gate-screen.show {
    display: flex;
}
.gate-icon {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-lg);
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
    box-shadow: 0 12px 36px var(--accent-glow);
}
.btn-primary {
    background: var(--accent-gradient);
    color: #ffffff;
    border: none;
    border-radius: var(--radius-full);
    padding: 14px 28px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 8px 24px var(--accent-glow);
    transition: transform 0.15s ease;
    margin-top: 20px;
}
.btn-primary:active {
    transform: scale(0.96);
}

/* Action Sheets & Modals */
.action-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100vw;
    max-height: 85vh;
    background: #0f111a;
    border-top: 1px solid var(--border-color);
    border-top-left-radius: var(--radius-lg);
    border-top-right-radius: var(--radius-lg);
    z-index: 90;
    display: flex;
    flex-direction: column;
    padding: 12px 20px calc(env(safe-area-inset-bottom, 0px) + 20px);
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.35s ease, opacity 0.35s ease;
    box-shadow: none;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
.action-sheet.open {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
    box-shadow: 0 -12px 40px rgba(0,0,0,0.85);
    pointer-events: auto;
}

/* Song Context Header */
.sheet-song-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 10px;
}
.sheet-song-thumb {
    width: 50px;
    height: 50px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    background: var(--bg-card);
}
.sheet-song-title {
    font-size: 0.98rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sheet-song-artist {
    font-size: 0.8rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Action Sheet Buttons */
.sheet-action-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-y: auto;
}
.sheet-action-btn {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 12px 14px;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 0.92rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-align: left;
    transition: background 0.15s ease;
}
.sheet-action-btn:active {
    background: rgba(255, 255, 255, 0.08);
}
.sheet-action-btn svg {
    flex-shrink: 0;
    color: var(--text-secondary);
}

/* Modal Tab Bar */
.modal-tab-bar {
    display: flex;
    background: var(--bg-card);
    border-radius: var(--radius-full);
    padding: 3px;
    margin-bottom: 16px;
}
.modal-tab {
    flex: 1;
    padding: 8px 12px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 0.84rem;
    font-weight: 700;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all 0.2s ease;
}
.modal-tab.active {
    background: var(--accent);
    color: #ffffff;
    box-shadow: 0 2px 8px var(--accent-glow);
}

/* Modal Forms & Inputs */
.modal-form {
    display: none;
    flex-direction: column;
}
.modal-form.active {
    display: flex;
}
.modal-input {
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    color: var(--text-primary);
    font-size: 0.9rem;
    outline: none;
}
.modal-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-glow);
}

/* Track Row Offline Badge & More Menu */
.downloaded-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #10b981;
    padding: 6px;
}
.btn-row-more {
    color: var(--text-muted);
}
.btn-row-more:active {
    color: var(--text-primary);
}

/* Toast */
#toast {
    position: fixed;
    top: calc(env(safe-area-inset-top, 0px) + 20px);
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: var(--bg-glass-modal);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    color: #ffffff;
    padding: 10px 18px;
    border-radius: var(--radius-full);
    font-size: 0.82rem;
    font-weight: 600;
    z-index: 200;
    box-shadow: 0 8px 32px rgba(0,0,0,0.7);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
}
#toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* Fullscreen App Updating Screen */
.update-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    background: rgba(9, 10, 15, 0.95);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    z-index: 300;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s ease;
}
.update-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.update-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 32px 24px;
    width: 100%;
    max-width: 360px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0,0,0,0.8);
}

.update-spinner-wrap {
    position: relative;
    width: 72px;
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

.update-pulse-ring {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid var(--accent);
    animation: updateRingPulse 1.8s infinite cubic-bezier(0.215, 0.61, 0.355, 1);
}

@keyframes updateRingPulse {
    0% { transform: scale(0.85); opacity: 0.8; }
    50% { transform: scale(1.3); opacity: 0; }
    100% { transform: scale(0.85); opacity: 0; }
}

.update-icon {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px var(--accent-glow);
    animation: updateSpin 3s linear infinite;
}

@keyframes updateSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.update-title {
    font-size: 1.25rem;
    font-weight: 800;
    margin-bottom: 6px;
}

.update-status {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 20px;
    min-height: 20px;
}

.update-progress-bar-wrap {
    width: 100%;
    height: 8px;
    background: rgba(255,255,255,0.08);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-bottom: 16px;
}

.update-progress-bar {
    height: 100%;
    width: 0%;
    background: var(--accent-gradient);
    border-radius: var(--radius-full);
    transition: width 0.3s ease;
}

.update-version-badge {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--accent);
    background: rgba(99, 102, 241, 0.15);
    padding: 4px 12px;
    border-radius: var(--radius-full);
    border: 1px solid rgba(99, 102, 241, 0.3);
}

/* =========================================================
   Playlist Import Loading Overlay & Unmapped Tracks Dialog
   ========================================================= */

.import-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    background: rgba(9, 10, 15, 0.88);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 24px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.import-loading-overlay.show {
    display: flex;
    opacity: 1;
}

.import-loading-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 32px 24px;
    width: 100%;
    max-width: 360px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
    animation: modalPopIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.import-spinner-wrap {
    position: relative;
    width: 72px;
    height: 72px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.import-spinner-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 3px solid rgba(99, 102, 241, 0.15);
    border-top-color: var(--accent);
    animation: spinRing 0.9s linear infinite;
}

@keyframes spinRing {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.import-spinner-icon {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px var(--accent-glow);
}

.import-title {
    font-size: 1.2rem;
    font-weight: 800;
    margin-bottom: 8px;
}

.import-subtitle {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.45;
    margin-bottom: 16px;
}

.import-badge {
    font-size: 0.72rem;
    font-weight: 600;
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.12);
    padding: 6px 14px;
    border-radius: var(--radius-full);
    border: 1px solid rgba(245, 158, 11, 0.25);
}

/* Missing / Unmapped Tracks Modal */
.missing-tracks-modal {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-glass-modal);
    border-top: 1px solid var(--border-color);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding: 20px;
    z-index: 10000;
    display: none;
    flex-direction: column;
    max-height: 85vh;
    max-height: 85dvh;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.7);
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.missing-tracks-modal.show {
    display: flex;
}

.missing-tip-box {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.25);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 12px 0;
}

.missing-tip-icon {
    font-size: 1.3rem;
    flex-shrink: 0;
}

.missing-tip-text {
    font-size: 0.8rem;
    color: #fbbf24;
    line-height: 1.35;
}

.missing-list-scroll {
    flex: 1;
    overflow-y: auto;
    max-height: 240px;
    margin: 8px 0 16px 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-right: 4px;
}

.missing-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-sm);
    gap: 10px;
}

.missing-item-title {
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.missing-item-artist {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.missing-item-badge {
    font-size: 0.68rem;
    color: #ef4444;
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.25);
    padding: 2px 8px;
    border-radius: var(--radius-full);
    flex-shrink: 0;
}
