@import 'fullplayer.css';
:root {
    color-scheme: dark;
    --bg: #1d1d1e;
    --bg-soft: #0b0f26;
    --bg-raised: rgba(15, 18, 38, 0.75);
    --card: rgba(255, 255, 255, 0.12);
    --card-hover: rgba(255, 255, 255, 0.22);
    --text-primary: #fdfdff;
    --text-secondary: rgba(246, 247, 255, 0.78);
    --accent: #92a4ff;
    --accent-strong: #7cf0ff;
    --neon-pink: #ff87e2;
    --glow-purple: #a67dff;
    --glow-cyan: #6cf7ff;
    --glow-salmon: #ff9bb7;
    --danger: #ff5f8f;
    --success: #4ade80;
    --pending: #ffd24d;
    --divider: rgba(255, 255, 255, 0.14);
    --glass-border: rgba(255, 255, 255, 0.22);
    --glass-muted: rgba(255, 255, 255, 0.08);
    --blur-heavy: 32px;
    --blur-medium: 20px;
    --radius-xl: 26px;
    --radius-lg: 20px;
    --radius-md: 16px;
    --radius-sm: 12px;
    --safe-area-top: 0px;
    --safe-area-bottom: 0px;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    height: 100vh;
    background: var(--bg);
    color: var(--text-primary);
    display: block;
    font-family: inherit;
    -webkit-font-smoothing: antialiased;
    position: relative;
    overflow: hidden;
}

.page-backdrop {
    position: fixed;
    inset: 0;
    z-index: 0;
    background: radial-gradient(circle at 15% -10%, rgba(255, 255, 255, 0.12), transparent 45%),
        radial-gradient(circle at 90% 10%, rgba(255, 255, 255, 0.08), transparent 45%),
        var(--bg);
    background-blend-mode: screen;
    pointer-events: none;
    filter: saturate(1.35) brightness(1.08);
}

.page-backdrop::before,
.page-backdrop::after {
    content: "";
    position: absolute;
    width: 540px;
    height: 540px;
    filter: blur(140px);
    opacity: 0.4;
    pointer-events: none;
}

.page-backdrop::before {
    top: -160px;
    left: -140px;
    background: radial-gradient(circle, rgba(35, 35, 36, 0.7), transparent 65%);
}

.page-backdrop::after {
    bottom: -200px;
    right: -120px;
    background: radial-gradient(circle, rgba(35, 35, 36, 0.7), transparent 65%);
}

.page-backdrop::after {
    mix-blend-mode: screen;
}

.layout {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 560px;
    margin: 0 auto;
    padding: calc(var(--safe-area-top, 0px) + 8px) 20px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 100%;
    height: 100%;
}

.status-layer {
    position: sticky;
    top: 0;
    z-index: 3;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 6px;
    backdrop-filter: blur(var(--blur-medium));
}

.error-banner {
    background: linear-gradient(120deg, rgba(255, 77, 109, 0.18), rgba(48, 48, 49, 0.15));
    border: 1px solid rgba(255, 77, 109, 0.5);
    color: #ffd2de;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    box-shadow: 0 10px 25px rgba(255, 77, 109, 0.25);
    backdrop-filter: blur(var(--blur-medium));
}

.loading-indicator {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    font-size: 0.95rem;
    color: var(--text-secondary);
    backdrop-filter: blur(var(--blur-medium));
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
    z-index: 10;
    margin: 0;
}

.loading-indicator[hidden],
.error-banner[hidden],
#toast[hidden],
#mini-player[hidden],
.status-layer[hidden] {
    display: none;
}

.spinner {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.12);
    border-top-color: var(--accent);
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding-top: calc(var(--safe-area-top, 0px) + 2px);
    padding-bottom: calc(var(--player-stack-inset, 150px) + var(--safe-area-bottom, 0px));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.screen.screen--detail {
    padding-bottom: var(--safe-area-bottom, 0px);
}

.screen.screen--detail .playlist-detail-body {
    padding-bottom: 0;
}

#playlist-detail-tracks.track-list {
    padding-bottom: 120px;
}

.screen::-webkit-scrollbar {
    display: none;
}

.track-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 0;
    padding: 4px 0;
}

#tracks-container.track-list {
    padding-top: 50px;
    padding-bottom: 160px;
}

.track-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 6px;
    min-height: 74px;
    border-radius: 20px;
    border: 1px solid transparent;
    background: transparent;
    transition:
        background 0.25s ease,
        border-color 0.25s ease,
        color 0.25s ease;
    position: relative;
}

.track-row.interactive {
    cursor: pointer;
}

.track-row.interactive:hover:not(.active) {
    background: rgba(255, 255, 255, 0.03);
}

.track-row.interactive:active:not(.active) {
    background: rgba(255, 255, 255, 0.05);
}

.track-row.active {
    background: rgba(70, 72, 75, 0.5) !important;
}

.track-row.active:hover,
.track-row.active:active,
.track-row.active.loading,
.track-row.active.loading:hover,
.track-row.active.loading:active {
    background: rgba(70, 72, 75, 0.5) !important;
}

.track-cover {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.16);
    display: grid;
    place-items: center;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.75);
    letter-spacing: 0.04em;
}

.track-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: inherit;
}

.track-row.loading .track-cover::before {
    content: "";
    position: absolute;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.25);
    border-top-color: rgba(255, 255, 255, 0.9);
    animation: spin 0.8s linear infinite;
    z-index: 2;
}

.track-row.loading .track-cover img {
    opacity: 0.25;
}

.track-cover .cover-overlay {
    position: absolute;
    inset: 0;
    background: rgba(7, 9, 18, 0.45);
    border-radius: inherit;
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2;
}

.track-cover .cover-icon {
    width: 30px;
    height: 30px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.92);
    color: #050506;
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 16px;
}

.track-cover .cover-icon::before {
    content: "";
    width: 16px;
    height: 16px;
    display: block;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.track-row.active:not(.loading) .cover-overlay {
    display: flex;
}

.track-row.active:not(.loading).playing .cover-icon::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23050506'%3E%3Cpath d='M6 19h4V5H6v14zm8-14v14h4V5h-4z'/%3E%3C/svg%3E");
}

.track-row.active:not(.loading).paused .cover-icon::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23050506'%3E%3Cpath d='M8 5v14l11-7z'/%3E%3C/svg%3E");
}

.track-meta {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.track-title-line {
    display: flex;
    align-items: baseline;
    gap: 8px;
    justify-content: space-between;
    min-width: 0;
}

.track-title {
    flex: 1;
    min-width: 0;
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.track-subtitle {
    font-size: 0.86rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
}

.track-artist {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.track-duration {
    font-variant-numeric: tabular-nums;
    font-size: 0.8rem;
    color: var(--text-secondary);
    flex-shrink: 0;
    margin-left: 12px;
}

.action-button {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    display: grid;
    place-items: center;
    cursor: pointer;
    border-radius: 10px;
    padding: 6px;
}

.action-button:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.06);
}

.status-chip {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 4px 9px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.16);
    color: var(--text-secondary);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    flex-shrink: 0;
}

.status-ready {
    color: var(--success);
    background: rgba(74, 222, 128, 0.2);
}

.status-pending {
    color: var(--pending);
    background: rgba(250, 204, 21, 0.16);
}

.status-uploading {
    color: var(--accent);
    background: rgba(76, 141, 255, 0.18);
}

.status-failed {
    color: var(--danger);
    background: rgba(255, 77, 109, 0.18);
}

.empty-state {
    text-align: center;
    padding: 20px 20px;
}

.empty-state h2 {
    margin-bottom: 8px;
    font-size: 1.2rem;
}

.empty-state p {
    margin: 0;
    color: var(--text-secondary);
}

.mini-player {
    position: fixed;
    bottom: 78px;
    left: 50%;
    transform: translateX(-50%);
    width: min(460px, calc(100% - 32px));
    background:
        linear-gradient(140deg, rgba(255, 255, 255, 0.18), transparent 45%),
        linear-gradient(125deg, rgba(48, 48, 49, 0.85), rgba(42, 42, 43, 0.8));
    border: none;
    border-radius: var(--radius-xl);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    z-index: 4;
    backdrop-filter: blur(var(--blur-medium));
}

.mini-cover {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    background: linear-gradient(135deg, #4c8dff, #7c5cff);
    position: relative;
    overflow: hidden;
    text-transform: uppercase;
}

.mini-cover::before {
    content: attr(data-initials);
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.85);
    letter-spacing: 0.12em;
}

.mini-cover::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.15), transparent);
}

.mini-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: inherit;
}

.mini-cover .status-chip {
    position: absolute;
    bottom: 6px;
    left: 6px;
    font-size: 0.6rem;
    padding: 2px 6px;
}

.mini-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.mini-title {
    margin: 0;
    font-weight: 600;
    font-size: 0.95rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mini-artist {
    margin: 0;
    font-size: 0.8rem;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.progress-trail {
    width: 100%;
    height: 4px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
}

.progress-trail span {
    display: block;
    height: 100%;
    width: 0;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--accent), var(--accent-strong));
    transition: width 0.15s linear;
}

.mini-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.control-button {
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    color: var(--text-primary);
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: transform 0.15s;
}

.control-button svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

.control-button:active {
    transform: scale(0.95);
}

.tab-bar {
    position: fixed;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    width: 280px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    border: none;
    border-radius: 35px;
    padding: 8px 12px;
    display: flex;
    justify-content: space-around;
    z-index: 5;
    will-change: backdrop-filter;
    isolation: isolate;
}

.tab-button {
    flex: 0 0 auto;
    width: 80px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    padding: 6px;
    border-radius: 25px;
    cursor: pointer;
    transition: color 0.3s ease-in-out, background 0.3s ease-in-out;
}

.action-button svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.tab-button svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
    transition: fill 0.3s ease-in-out;
}

.tab-button.active {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.18);

}

.tab-button:not(.active) {
    box-shadow: none;
}

.toast {
    position: fixed;
    bottom: 140px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, rgba(146, 164, 255, 0.25), rgba(124, 240, 255, 0.2));
    border: 1.5px solid rgba(146, 164, 255, 0.5);
    padding: 10px 18px;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 500;
    line-height: 1.4;
    z-index: 6;
    box-shadow: 0 8px 24px rgba(146, 164, 255, 0.3), 0 0 20px rgba(124, 240, 255, 0.15);
    backdrop-filter: blur(var(--blur-medium));
    text-align: center;
    max-width: 90%;
    word-wrap: break-word;
}

/* Action Sheet (Removed) */

.confirm-dialog {
    position: fixed;
    inset: 0;
    z-index: 9;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(10px);
}

.confirm-dialog[hidden] {
    display: none;
}

.confirm-card {
    width: 100%;
    max-width: 360px;
    background: rgba(40, 40, 41, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 22px;
    padding: 22px;
    box-shadow: 0 25px 45px rgba(0, 0, 0, 0.5);
}

.confirm-card p {
    margin: 0 0 18px;
    color: var(--text-primary);
    font-size: 1rem;
    text-align: center;
}

.confirm-actions {
    display: flex;
    gap: 12px;
}

.confirm-actions button {
    flex: 1;
    border: none;
    border-radius: 14px;
    padding: 12px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.1s ease;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
}

.confirm-actions button:hover {
    background: rgba(255, 255, 255, 0.12);
}

.confirm-actions button:active {
    transform: scale(0.97);
}

.confirm-actions button.danger {
    background: rgba(255, 82, 110, 0.25);
    color: #ffb3c4;
}

.confirm-actions button.danger:hover {
    background: rgba(255, 82, 110, 0.35);
}

.view {
    display: none;
    flex-direction: column;
    gap: 14px;
    min-height: 100%;
}

.view.view--active {
    display: flex;
}

.music-header {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 560px;
    z-index: 5;
    padding: 20px 20px 16px;
    padding-top: calc(var(--safe-area-top, 0px) + 50px);
    background: transparent;
    transition: transform 0.3s ease;
}

.music-header.header--hidden {
    transform: translateX(-50%) translateY(-100%);
    pointer-events: none;
}

.search-container {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    padding: 0 6px;
    max-width: 100%;
    background: transparent;
}

.search-input {
    width: 100%;
    padding: 10px 40px 10px 16px;
    border: 0;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.search-input:focus {
    border-color: rgba(146, 164, 255, 0.5);
    background: rgba(255, 255, 255, 0.12);
}

.search-input::placeholder {
    color: var(--text-secondary);
}

.search-clear {
    position: absolute;
    right: 8px;
    width: 28px;
    height: 28px;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 50%;
    transition: color 0.2s ease, background 0.2s ease;
}

.search-clear[hidden] {
    display: none !important;
}

.search-clear:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.1);
}

.search-clear svg {
    width: 18px;
    height: 18px;
}

.playlist-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: nowrap;
}

.playlist-heading {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
    min-width: 0;
}

.playlist-label {
    margin: 0;
    font-size: 0.75rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.playlist-title {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 600;
}

.playlist-icon-button,
.playlist-back-button {
    width: 35px;
    height: 35px;
    padding: 0;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: linear-gradient(140deg, var(--accent), var(--accent-strong));
    color: #041122;
    display: none;
    place-items: center;
    cursor: pointer;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.4);
    transition:
        transform 0.15s ease,
        box-shadow 0.15s ease,
        opacity 0.15s ease;
    margin-left: auto;
}

.view[data-has-playlists="true"] .playlist-icon-button {
    display: grid;
}

.playlist-icon-button svg,
.playlist-back-button svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
}

.playlist-back-button {
    width: auto;
    height: auto;
    padding: 4px;
    border: none;
    box-shadow: none;
    background: transparent;
    color: var(--text-primary);
    display: grid;
    place-items: center;
    margin-left: 0;
    transform: translateY(calc((8px - var(--safe-area-top, 0px)) / 2));
}

.playlist-back-button svg {
    width: 30px;
    height: 30px;
}

.playlist-icon-button:active {
    transform: scale(0.96);
    box-shadow: 0 8px 16px rgba(3, 6, 18, 0.55);
}

.playlist-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 14px;
    padding-bottom: 160px;
}

.playlist-card {
    position: relative;
    padding: 18px;
    border-radius: 22px;
    border: none;
    box-shadow: none;
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-height: 160px;
    height: 160px;
    cursor: pointer;
    overflow: visible;
    z-index: 0;
    transition:
        transform 0.18s ease,
        border-color 0.18s ease,
        box-shadow 0.18s ease;
}

.playlist-card::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background:
        linear-gradient(145deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02)),
        rgba(35, 35, 36, 0.6);
    backdrop-filter: blur(var(--blur-medium));
    z-index: -1;
}

.playlist-card::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    border: 1px solid rgba(255, 255, 255, 0.08);
    pointer-events: none;
    z-index: -1;
}

.playlist-card:hover {
    transform: translateY(-3px);
    border-color: rgba(255, 255, 255, 0.28);
    box-shadow: none;
}

.playlist-card__top {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.playlist-card__header-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.playlist-card__name {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.playlist-card__meta {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.4;
}

.playlist-thumb-stack {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0;
}

.playlist-thumb {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
    display: grid;
    place-items: center;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.85rem;
}

.playlist-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.playlist-thumb + .playlist-thumb {
    margin-left: -16px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.playlist-card__menu-button {
    margin-left: auto;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: color 0.2s ease;
}

.playlist-card__menu-button svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

.playlist-card__menu-button:hover {
    color: var(--text-primary);
}

.popup-menu {
    position: fixed;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px;
    border-radius: 14px;
    background: rgba(42, 42, 43, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(14px);
    min-width: 160px;
    z-index: 10;
}

.popup-menu button {
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 0.9rem;
    text-align: left;
    padding: 6px 10px;
    border-radius: 8px;
    cursor: pointer;
    white-space: nowrap;
}

.popup-menu button:hover {
    background: rgba(255, 255, 255, 0.08);
}

.popup-menu button.danger {
    color: #ffb3c4;
}

.popup-menu button.danger:hover {
    background: rgba(255, 77, 109, 0.18);
}

.popup-menu[hidden] {
    display: none;
}

.playlist-card--create {
    border-style: dashed;
    border-color: rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-secondary);
    text-align: center;
}

.playlist-card--create .playlist-card__body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.playlist-card--create svg {
    width: 36px;
    height: 36px;
    fill: currentColor;
}

.playlist-empty {
    text-align: center;
    padding: 90px 20px;
    border-radius: var(--radius-lg);
    border: 1px dashed rgba(255, 255, 255, 0.22);
    background: rgba(255, 255, 255, 0.02);
    backdrop-filter: blur(var(--blur-medium));
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
    justify-content: center;
}

.playlist-empty[hidden],
.playlist-grid[hidden],
.view[hidden] {
    display: none;
}

.playlist-empty-icon {
    width: 76px;
    height: 76px;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.05);
    display: grid;
    place-items: center;
    font-size: 2rem;
    color: var(--accent-strong);
}

.playlist-empty h2 {
    margin: 0;
    font-size: 1.2rem;
}

.playlist-empty p {
    margin: 0;
    color: var(--text-secondary);
}

.playlist-empty-button {
    border: none;
    border-radius: 14px;
    padding: 12px 20px;
    background: linear-gradient(120deg, var(--accent), var(--accent-strong));
    color: #050506;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.35);
}

.playlist-detail-view {
    height: 100%;
}

.playlist-detail-shell {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.playlist-detail-header {
    display: flex;
    align-items: center;
    gap: 16px;
    border-radius: 22px;
    padding: calc(var(--safe-area-top, 0px) + 4px) 0 12px;
    background:
        linear-gradient(140deg, rgba(255, 255, 255, 0.2), transparent 40%),
        linear-gradient(180deg, rgba(55, 55, 56, 0.95), rgba(50, 50, 51, 0.85));
    border: 1px solid rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(var(--blur-medium));
    z-index: 2;
}

.playlist-detail-heading {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
    min-width: 0;
    justify-content: center;
    align-items: flex-start;
    padding-right: 16px;
    transform: translateY(calc((8px - var(--safe-area-top, 0px)) / 2));
}

.playlist-detail-heading .playlist-title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

.playlist-detail-meta {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.playlist-detail-body {
    flex: 1;
    overflow-y: auto;

}

.playlist-picker-card {
    width: 100%;
    max-width: 360px;
    display: flex;
    flex-direction: column;
    max-height: 80vh;
}

.picker-title {
    margin: 0 0 16px;
    font-size: 1.1rem;
    font-weight: 600;
    text-align: center;
    color: var(--text-primary);
}

.picker-list {
    flex: 1;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 16px;
    padding-right: 4px; /* Space for scrollbar */
    justify-items: center; /* Center cards in their columns */
}

.picker-item {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid transparent;
    border-radius: 16px;
    padding: 12px 6px; /* Adjusted padding */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px; /* Reduced gap between icon and text */
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    width: 120px;
    height: 120px;
    text-align: center;
    overflow: hidden;
}

.picker-item:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.picker-item:active {
    transform: scale(0.98);
}

.picker-item.empty-message {
    grid-column: 1 / -1;
    width: 100%;
    height: auto;
    background: transparent;
    cursor: default;
    color: var(--text-secondary);
    text-align: center;
    justify-content: center;
    padding: 20px 0;
    align-items: center;
}

.picker-item.empty-message:hover {
    background: transparent;
    transform: none;
}

.picker-thumb {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.1);
    display: grid;
    place-items: center;
    font-weight: 600;
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.6);
    flex-shrink: 0;
    overflow: hidden;
}

.picker-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.picker-info {
    width: 100%;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0 !important; /* Force no gap */
    align-items: center;
}

.picker-name {
    margin: 0;
    font-weight: 500;
    font-size: 0.8rem;
    line-height: 1.1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
    width: 100%;
    margin-bottom: 2px !important; /* Pull closer */
}

.picker-meta {
    margin: 0;
    font-size: 12px !important; /* Force small size */
    line-height: 1;
    color: rgba(255, 255, 255, 0.45) !important; /* Force dimmer color */
    text-align: center;
}

.picker-actions {
    display: flex;
    justify-content: center;
}

.picker-actions button {
    width: 100%;
    padding: 12px;
    border: none;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    color: var(--text-secondary);
    font-size: 0.95rem;
    cursor: pointer;
}

.picker-actions button:hover {
    background: rgba(255, 255, 255, 0.12);
}


@media (max-width: 480px) {
    .app-shell {
        padding-top: calc(var(--safe-area-top, 0px) + 8px);
        padding-bottom: 120px;
        padding-left: 12px;
        padding-right: 12px;
    }

    .mini-player {
        width: calc(100% - 24px);
        left: 12px;
        transform: none;
    }

    .tab-bar {
        width: 340px;
        left: 50%;
        transform: translateX(-50%);
    }

    .playlist-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .playlist-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }
}
