:root {
    --bg-primary: #0f0f0f;
    --bg-card: #181818;
    --bg-card-hover: #222222;
    --bg-elevated: #262626;
    --accent: #1DB954;
    --accent-hover: #1ed760;
    --accent-glow: rgba(29, 185, 84, 0.35);
    --text-primary: #ffffff;
    --text-secondary: #b3b3b3;
    --text-muted: #787878;
    --danger: #e22134;
    --border-color: rgba(255, 255, 255, 0.08);
    --border-radius: 16px;
    --transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, Helvetica, Arial, sans-serif;
    background: radial-gradient(circle at 50% 10%, #222222 0%, #0d0d0d 100%);
    color: var(--text-primary);
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 24px 16px;
    overflow-x: hidden;
    overflow-y: auto;
}

.player-wrapper {
    width: 100%;
    max-width: 1040px;
    margin: auto 0;
}

/* LANDSCAPE DUAL-PANEL GRID */
.player-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 28px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.65), 0 0 1px rgba(255, 255, 255, 0.12);
    position: relative;
    backdrop-filter: blur(12px);
    display: grid;
    grid-template-columns: minmax(300px, 410px) 1fr;
    gap: 32px;
    min-height: 580px;
    width: 100%;
    max-width: 100%;
}

/* ========================================================
   PANEL KIRI: NOW PLAYING & CONTROLS
   ======================================================== */
.player-left-panel {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 16px;
    min-width: 0;
    max-width: 100%;
}

/* Header */
.player-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
}

.app-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-icon {
    font-size: 1.6rem;
    background: rgba(29, 185, 84, 0.15);
    padding: 6px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.player-header h2 {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.3px;
    color: var(--text-primary);
}

.subtitle {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 500;
}

.header-badges {
    display: flex;
    align-items: center;
    gap: 8px;
}

.badge-btn {
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 5px 11px;
    border-radius: 20px;
    font-size: 0.75rem;
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
}

.badge-btn:hover, .badge-btn.active {
    background: var(--accent);
    color: #000;
    border-color: var(--accent);
}

.status-badge {
    font-size: 0.72rem;
    padding: 4px 10px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.07);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.status-badge.playing {
    background: rgba(29, 185, 84, 0.15);
    color: var(--accent);
    font-weight: 600;
}

.status-badge.playing::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    background: var(--accent);
    border-radius: 50%;
    box-shadow: 0 0 6px var(--accent);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(1.3); }
}

/* YOUTUBE IFRAME (HIDDEN BY DEFAULT & VISIBLE IN LEFT PANEL) */
.youtube-hidden {
    position: fixed;
    top: -9999px;
    left: -9999px;
    width: 240px;
    height: 160px;
    opacity: 0;
    pointer-events: none;
    z-index: -999;
}

.youtube-visible {
    position: relative;
    top: 0;
    left: 0;
    width: 100%;
    border-radius: 14px;
    overflow: hidden;
    background: #000;
    aspect-ratio: 16 / 9;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
    border: 1px solid var(--border-color);
    margin-bottom: 8px;
}

.youtube-visible iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* NOW PLAYING CARD & VINYL ARTWORK */
.now-playing-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    background: var(--bg-card-hover);
    padding: 24px 20px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    margin: 4px 0;
}

.cover-art-container {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    overflow: hidden;
    position: relative;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7), 0 0 0 6px rgba(255, 255, 255, 0.04);
    border: 3px solid rgba(255, 255, 255, 0.1);
    background: #000;
    margin-bottom: 16px;
}

.cover-art-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.cover-art-container.spinning img {
    animation: rotateVinyl 12s linear infinite;
}

.cover-art-container.paused img {
    animation-play-state: paused;
}

.vinyl-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 26px;
    height: 26px;
    background: var(--bg-card);
    border: 3px solid #fff;
    border-radius: 50%;
    pointer-events: none;
    box-shadow: 0 0 6px rgba(0,0,0,0.5);
}

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

.track-details {
    width: 100%;
    overflow: hidden;
}

.track-details h3 {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 5px;
}

.track-details p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* EQUALIZER SPECTRUM DECK */
.equalizer-wrapper {
    width: 100%;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 12px;
    padding: 10px 12px;
    margin-top: 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.5);
}

.equalizer-top-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    width: 100%;
}

.eq-status-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
}

.eq-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #eab308;
    display: inline-block;
    transition: var(--transition);
}

.eq-dot.real {
    background: var(--accent);
    box-shadow: 0 0 8px var(--accent);
    animation: pulse 1.2s infinite;
}

.eq-tag {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.6px;
    color: var(--text-secondary);
}

.eq-tag.real {
    color: var(--accent);
}

.eq-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.eq-sync-btn {
    background: rgba(29, 185, 84, 0.12);
    border: 1px solid var(--accent);
    color: var(--accent);
    font-size: 0.68rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 12px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 4px;
}

.eq-sync-btn:hover {
    background: var(--accent);
    color: #000;
}

.eq-sync-btn.connected {
    background: var(--accent);
    color: #000;
    border-color: var(--accent);
    box-shadow: 0 0 8px var(--accent-glow);
}

.eq-mini-bars {
    display: flex;
    align-items: flex-end;
    gap: 2.5px;
    height: 12px;
}

.eq-mini-bars span {
    width: 2.5px;
    height: 30%;
    background: var(--accent);
    border-radius: 1px;
    transition: height 0.2s ease;
}

.cover-art-container.spinning ~ .equalizer-wrapper .eq-mini-bars span {
    animation: bounceMiniEq 0.65s ease-in-out infinite alternate;
}

.cover-art-container.spinning ~ .equalizer-wrapper .eq-mini-bars span:nth-child(1) { animation-delay: 0.1s; }
.cover-art-container.spinning ~ .equalizer-wrapper .eq-mini-bars span:nth-child(2) { animation-delay: 0.3s; }
.cover-art-container.spinning ~ .equalizer-wrapper .eq-mini-bars span:nth-child(3) { animation-delay: 0.15s; }
.cover-art-container.spinning ~ .equalizer-wrapper .eq-mini-bars span:nth-child(4) { animation-delay: 0.4s; }

@keyframes bounceMiniEq {
    0% { height: 25%; }
    100% { height: 100%; }
}

#equalizer-canvas {
    width: 100%;
    height: 54px;
    display: block;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.25);
}

.eq-footnote {
    font-size: 0.68rem;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.3;
    padding-top: 2px;
}

.vinyl-glow-ring {
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    border: 2px solid transparent;
    pointer-events: none;
    transition: var(--transition);
}

.cover-art-container.spinning .vinyl-glow-ring {
    border-color: var(--accent);
    box-shadow: 0 0 15px var(--accent-glow);
    animation: glowPulse 2s infinite alternate;
}

@keyframes glowPulse {
    0% { box-shadow: 0 0 8px var(--accent-glow); }
    100% { box-shadow: 0 0 20px rgba(29, 185, 84, 0.6); }
}

/* PROGRESS BAR */
.left-panel-controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.progress-section {
    margin-bottom: 4px;
}

.progress-container {
    position: relative;
    display: flex;
    align-items: center;
}

input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 5px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    outline: none;
    cursor: pointer;
    transition: height 0.15s ease;
}

input[type="range"]:hover {
    height: 7px;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0,0,0,0.5);
    transition: transform 0.15s ease, background-color 0.15s ease;
}

input[type="range"]:hover::-webkit-slider-thumb {
    transform: scale(1.3);
    background: var(--accent);
}

.time-display {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 6px;
    font-variant-numeric: tabular-nums;
}

/* CONTROLS */
.controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
}

.ctrl-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.25rem;
    cursor: pointer;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    user-select: none;
    position: relative;
}

.ctrl-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
    transform: scale(1.08);
}

.ctrl-btn:active {
    transform: scale(0.95);
}

.ctrl-btn.active {
    color: var(--accent);
    text-shadow: 0 0 10px var(--accent-glow);
}

.ctrl-btn.repeat-one::after {
    content: '1';
    font-size: 0.55rem;
    position: absolute;
    bottom: 5px;
    right: 7px;
    background: var(--accent);
    color: #000;
    font-weight: bold;
    border-radius: 50%;
    width: 12px;
    height: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.main-play-btn {
    background: var(--accent) !important;
    color: #000 !important;
    width: 52px;
    height: 52px;
    font-size: 1.45rem;
    font-weight: bold;
    box-shadow: 0 6px 20px var(--accent-glow);
}

.main-play-btn:hover {
    background: var(--accent-hover) !important;
    color: #000 !important;
    transform: scale(1.1) !important;
}

/* VOLUME */
.volume-container {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.03);
    padding: 8px 14px;
    border-radius: 12px;
}

.volume-icon-btn {
    background: transparent;
    border: none;
    font-size: 1.15rem;
    cursor: pointer;
    color: var(--text-secondary);
}

.volume-icon-btn:hover {
    color: #fff;
}

#volume-slider {
    flex: 1;
}

#volume-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    min-width: 34px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* ========================================================
   PANEL KANAN: TABS (ANTREAN / PENCARIAN / BANTUAN)
   ======================================================== */
.player-right-panel {
    display: flex;
    flex-direction: column;
    min-width: 0;
    border-left: 1px solid var(--border-color);
    padding-left: 32px;
}

/* Tabs */
.tabs-nav {
    display: flex;
    background: var(--bg-elevated);
    border-radius: 14px;
    padding: 5px;
    gap: 6px;
    margin-bottom: 18px;
}

.tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 10px 14px;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 10px;
    cursor: pointer;
    transition: var(--transition);
}

.tab-btn:hover {
    color: #fff;
}

.tab-btn.active {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.tab-content-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 440px;
}

.tab-content {
    display: none;
    flex: 1;
    flex-direction: column;
}

.tab-content.active {
    display: flex;
    animation: fadeIn 0.22s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* QUEUE & PLAYLIST MANAGER (TAB 1) */
.playlist-manager-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.playlist-selector-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 170px;
    position: relative;
}

.selector-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-secondary);
    white-space: nowrap;
}

/* CUSTOM DROPDOWN COMPONENT (100% IN-FRAME) */
.custom-dropdown {
    position: relative;
    flex: 1;
    min-width: 0;
}

.custom-dropdown-btn {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: #fff;
    padding: 6px 10px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: var(--transition);
    text-align: left;
    user-select: none;
}

.custom-dropdown-btn:hover, .custom-dropdown-btn:focus {
    border-color: var(--accent);
    background: rgba(255, 255, 255, 0.1);
}

.custom-dropdown.open .custom-dropdown-btn {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-glow);
}

.dropdown-selected-text {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
}

.dropdown-arrow {
    font-size: 0.75rem;
    color: var(--text-muted);
    transition: transform 0.2s ease;
    user-select: none;
    line-height: 1;
}

.custom-dropdown.open .dropdown-arrow {
    transform: rotate(180deg);
}

/* DROPDOWN POPUP MENU (STAYS INSIDE THE FRAME) */
.custom-dropdown-menu {
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    right: 0;
    max-height: 230px;
    overflow-y: auto;
    background: #161616 !important;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.98), 0 0 0 1px rgba(255, 255, 255, 0.1);
    z-index: 1300;
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    animation: fadeIn 0.1s ease-out;
}

.dropdown-group-title {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    padding: 6px 8px 3px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    margin-top: 3px;
    user-select: none;
}

.dropdown-group-title:first-child {
    border-top: none;
    margin-top: 0;
}

.dropdown-item {
    padding: 7px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
    color: #e2e2e2;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: var(--transition);
    user-select: none;
}

.dropdown-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.dropdown-item.active {
    background: rgba(29, 185, 84, 0.15);
    color: var(--accent);
    font-weight: 600;
}

.dropdown-item-check {
    font-size: 0.8rem;
    color: var(--accent);
    margin-left: 6px;
}

.playlist-dropdown {
    flex: 1;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: #fff;
    padding: 6px 10px;
    font-size: 0.8rem;
    outline: none;
    cursor: pointer;
    transition: var(--transition);
}

.playlist-dropdown:focus {
    border-color: var(--accent);
}

.playlist-toolbar {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.queue-presets-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.queue-tip-bar {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.queue-tip-bar .reorder-tip,
.reorder-tip {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.presets-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.preset-buttons {
    display: flex;
    gap: 6px;
}

.preset-btn {
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 5px 10px;
    border-radius: 8px;
    font-size: 0.75rem;
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
}

.preset-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

.preset-btn.active {
    background: rgba(29, 185, 84, 0.2);
    border-color: var(--accent);
    color: var(--accent);
    font-weight: 700;
    box-shadow: 0 0 10px rgba(29, 185, 84, 0.2);
}

.danger-btn {
    background: rgba(226, 33, 52, 0.15);
    border: 1px solid rgba(226, 33, 52, 0.3);
    color: #ff6b7b;
    padding: 5px 10px;
    border-radius: 8px;
    font-size: 0.75rem;
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
}

.danger-btn:hover {
    background: var(--danger);
    color: #fff;
}

.queue-list {
    list-style: none;
    flex: 1;
    max-height: 420px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-right: 6px;
}

.queue-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: var(--bg-card-hover);
    border-radius: 10px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: var(--transition);
    user-select: none;
}

.queue-item:hover {
    background: var(--bg-elevated);
    border-color: rgba(255, 255, 255, 0.08);
}

.queue-item.active {
    background: rgba(29, 185, 84, 0.12);
    border-color: var(--accent);
}

.queue-item.dragging {
    opacity: 0.4;
    border: 2px dashed var(--accent);
}

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

.drag-handle {
    cursor: grab;
    color: var(--text-muted);
    font-size: 1.15rem;
    padding: 2px 4px;
    border-radius: 4px;
    line-height: 1;
    transition: color 0.15s;
}

.drag-handle:hover {
    color: var(--accent);
}

.queue-item-thumb {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    object-fit: cover;
}

.queue-item-info {
    flex: 1;
    min-width: 0;
    text-align: left;
}

.queue-item-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.queue-item.active .queue-item-title {
    color: var(--accent);
}

.playing-bars {
    display: inline-flex;
    align-items: flex-end;
    gap: 2.5px;
    height: 11px;
    margin-left: 6px;
    vertical-align: middle;
}

.playing-bars span {
    width: 2.5px;
    background: var(--accent);
    border-radius: 1px;
    animation: bounceMiniEq 0.65s ease-in-out infinite alternate;
}

.playing-bars span:nth-child(1) { animation-delay: 0.1s; height: 35%; }
.playing-bars span:nth-child(2) { animation-delay: 0.35s; height: 100%; }
.playing-bars span:nth-child(3) { animation-delay: 0.18s; height: 60%; }

.queue-item-artist {
    font-size: 0.74rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

.queue-item-actions {
    display: flex;
    align-items: center;
    gap: 3px;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.queue-item:hover .queue-item-actions {
    opacity: 1;
}

.item-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    font-size: 0.82rem;
    border-radius: 6px;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.item-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
}

.item-btn.remove-track-btn:hover {
    color: #fff;
    background: var(--danger);
}

.item-btn.edit-track-btn:hover {
    color: var(--accent);
}

/* MODAL POPUP */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    animation: fadeIn 0.2s ease-in-out;
}

.modal-box {
    background: #1e1e1e;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    width: 90%;
    max-width: 460px;
    padding: 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.85);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    transition: var(--transition);
}

.modal-close:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.modal-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.modal-form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    text-align: left;
}

.modal-form-group label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.modal-input, .modal-textarea {
    width: 100%;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 0.85rem;
    color: #fff;
    outline: none;
    transition: var(--transition);
}

.modal-textarea {
    font-family: monospace;
    font-size: 0.78rem;
    resize: vertical;
    min-height: 120px;
}

.modal-input:focus, .modal-textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-glow);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 6px;
}

.main-confirm-btn {
    background: var(--accent);
    color: #000;
    border: none;
    padding: 8px 18px;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}

.main-confirm-btn:hover {
    background: var(--accent-hover);
}

/* SEARCH (TAB 2) */
.search-container {
    display: flex;
    gap: 10px;
    margin-bottom: 8px;
}

.search-input-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 12px;
    font-size: 0.9rem;
    color: var(--text-muted);
    pointer-events: none;
}

#search-input {
    width: 100%;
    padding: 12px 36px 12px 36px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: #fff;
    font-size: 0.85rem;
    outline: none;
    transition: var(--transition);
}

#search-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-glow);
}

.clear-input-btn {
    position: absolute;
    right: 10px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.85rem;
    padding: 4px;
}

.clear-input-btn:hover {
    color: #fff;
}

#search-btn {
    background: var(--accent);
    color: #000;
    border: none;
    padding: 0 20px;
    border-radius: 12px;
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}

#search-btn:hover {
    background: var(--accent-hover);
}

.search-tips {
    font-size: 0.74rem;
    color: var(--text-muted);
    margin-bottom: 14px;
    text-align: left;
    line-height: 1.4;
}

.search-tips code {
    background: var(--bg-elevated);
    padding: 2px 5px;
    border-radius: 4px;
    color: var(--text-secondary);
}

.search-status {
    padding: 20px;
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.spinner {
    display: inline-block;
    width: 15px;
    height: 15px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    vertical-align: middle;
    margin-right: 6px;
}

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

.error-msg {
    color: #ff6b7b;
    background: rgba(226, 33, 52, 0.1);
    border-radius: 10px;
    padding: 12px;
}

#search-results {
    list-style: none;
    flex: 1;
    max-height: 380px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-right: 6px;
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    background: var(--bg-card-hover);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: var(--transition);
}

.search-result-item:hover {
    background: var(--bg-elevated);
}

.search-result-thumb {
    width: 56px;
    height: 42px;
    border-radius: 6px;
    object-fit: cover;
}

.search-result-info {
    flex: 1;
    min-width: 0;
    text-align: left;
}

.search-result-title {
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result-meta {
    font-size: 0.74rem;
    color: var(--text-muted);
    display: flex;
    gap: 8px;
    margin-top: 3px;
}

.search-item-actions {
    display: flex;
    gap: 6px;
}

.action-play-btn, .action-add-btn {
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 0.75rem;
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
}

.action-play-btn:hover {
    background: var(--accent);
    color: #000;
    border-color: var(--accent);
}

.action-add-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

/* SETTINGS & HELP (TAB 3) */
.settings-card {
    background: var(--bg-card-hover);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 14px;
    text-align: left;
}

.settings-card h4 {
    font-size: 0.88rem;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.shortcuts-list {
    list-style: none;
    font-size: 0.78rem;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

kbd {
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    padding: 2px 7px;
    border-radius: 5px;
    font-size: 0.72rem;
    font-family: monospace;
    color: #fff;
}

.toggle-setting {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-top: 10px;
    cursor: pointer;
}

.setting-desc {
    font-size: 0.74rem;
    color: var(--text-muted);
    line-height: 1.4;
    margin-bottom: 10px;
}

.api-key-input-wrapper {
    display: flex;
    gap: 10px;
}

#custom-api-key {
    flex: 1;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 0.8rem;
    color: #fff;
    outline: none;
}

.masked-input {
    -webkit-text-security: disc;
}

/* OVERRIDE BROWSER AUTOFILL STYLING & BACKGROUND */
input:-webkit-autofill,
input:-webkit-autofill:hover, 
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
    -webkit-text-fill-color: #ffffff !important;
    -webkit-box-shadow: 0 0 0px 1000px #262626 inset !important;
    box-shadow: 0 0 0px 1000px #262626 inset !important;
    transition: background-color 5000s ease-in-out 0s;
}

/* TOAST NOTIFICATION */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #242424;
    color: #fff;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 0.82rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.7);
    border: 1px solid var(--border-color);
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 8px;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* CUSTOM SCROLLBAR */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ========================================================
   RESPONSIVE DESIGN ENGINE (ALL SCREEN SIZES & ORIENTATIONS)
   ======================================================== */

/* Tab Responsive Text Helpers */
.tab-label-short {
    display: none;
}

/* 1. LAPTOPS & INTERMEDIATE DESKTOPS (1040px and below) */
@media (max-width: 1040px) {
    .player-container {
        grid-template-columns: minmax(300px, 350px) 1fr;
        gap: 22px;
        padding: 22px;
    }

    .player-right-panel {
        padding-left: 22px;
    }

    .cover-art-container {
        width: 125px;
        height: 125px;
    }
}

/* 2. TABLETS & LARGE PHONES (880px and below) - COLLAPSE TO 1 COLUMN */
@media (max-width: 880px) {
    .player-container {
        grid-template-columns: 1fr;
        gap: 24px;
        padding: 20px;
        min-height: auto;
    }

    .player-right-panel {
        border-left: none;
        padding-left: 0;
        border-top: 1px solid var(--border-color);
        padding-top: 24px;
    }

    .cover-art-container {
        width: 120px;
        height: 120px;
    }

    .tab-content-container {
        min-height: 380px;
    }

    .queue-list {
        max-height: 360px;
    }
}

/* 3. MOBILE PHONES (600px and below) */
@media (max-width: 600px) {
    body {
        padding: 12px 8px;
    }

    .player-container {
        padding: 16px 14px;
        border-radius: 18px;
        gap: 18px;
    }

    .player-header h2 {
        font-size: 1.05rem;
    }

    .brand-icon {
        font-size: 1.35rem;
        padding: 5px;
    }

    .now-playing-card {
        padding: 16px 14px;
        border-radius: 16px;
    }

    .cover-art-container {
        width: 105px;
        height: 105px;
        margin-bottom: 12px;
    }

    .vinyl-center {
        width: 22px;
        height: 22px;
    }

    .track-details h3 {
        font-size: 0.98rem;
    }

    .track-details p {
        font-size: 0.8rem;
    }

    .equalizer-wrapper {
        padding: 8px 10px;
        margin-top: 10px;
    }

    #equalizer-canvas {
        height: 48px;
    }

    .ctrl-btn {
        width: 40px;
        height: 40px;
        font-size: 1.15rem;
    }

    .main-play-btn {
        width: 48px;
        height: 48px;
        font-size: 1.35rem;
    }

    .controls {
        gap: 8px;
    }

    .volume-container {
        padding: 6px 12px;
    }

    .tabs-nav {
        padding: 4px;
        gap: 4px;
        border-radius: 12px;
        margin-bottom: 14px;
    }

    .tab-btn {
        padding: 8px 6px;
        font-size: 0.8rem;
    }

    .playlist-manager-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .playlist-selector-group {
        width: 100%;
        min-width: 0;
    }

    .playlist-toolbar {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(65px, 1fr));
        gap: 6px;
    }

    .playlist-toolbar .preset-btn,
    .playlist-toolbar .danger-btn {
        padding: 6px 4px;
        text-align: center;
        justify-content: center;
        font-size: 0.72rem;
    }

    .queue-presets-bar {
        gap: 6px;
    }

    .reorder-tip {
        width: 100%;
        margin-left: 0;
        margin-top: 2px;
        font-size: 0.68rem;
    }

    .queue-list {
        max-height: 330px;
    }

    .search-container {
        gap: 8px;
    }

    #search-input {
        padding: 10px 32px 10px 32px;
        font-size: 0.82rem;
    }

    #search-btn {
        padding: 0 14px;
        font-size: 0.82rem;
    }

    .modal-box {
        width: 95%;
        max-width: 95%;
        padding: 18px 14px;
        border-radius: 16px;
        max-height: 90vh;
        overflow-y: auto;
    }
}

/* 4. COMPACT / SMALL PHONES (410px and below, e.g. iPhone SE, Galaxy A) */
@media (max-width: 410px) {
    body {
        padding: 8px 4px;
    }

    .player-container {
        padding: 12px 10px;
        border-radius: 14px;
        gap: 14px;
    }

    .app-brand {
        gap: 6px;
    }

    .player-header h2 {
        font-size: 0.95rem;
    }

    .subtitle {
        display: none;
    }

    .badge-btn {
        padding: 4px 8px;
        font-size: 0.7rem;
    }

    .status-badge {
        padding: 3px 8px;
        font-size: 0.68rem;
    }

    .cover-art-container {
        width: 92px;
        height: 92px;
        margin-bottom: 10px;
    }

    .vinyl-center {
        width: 18px;
        height: 18px;
    }

    .now-playing-card {
        padding: 12px 10px;
    }

    .equalizer-wrapper {
        padding: 6px 8px;
    }

    #equalizer-canvas {
        height: 42px;
    }

    .eq-tag {
        font-size: 0.62rem;
    }

    .eq-sync-btn {
        font-size: 0.62rem;
        padding: 2px 6px;
    }

    .eq-footnote {
        font-size: 0.62rem;
    }

    .controls {
        gap: 6px;
    }

    .ctrl-btn {
        width: 36px;
        height: 36px;
        font-size: 1.05rem;
    }

    .main-play-btn {
        width: 44px;
        height: 44px;
        font-size: 1.25rem;
    }

    .volume-container {
        padding: 5px 10px;
    }

    .tabs-nav .tab-label-text {
        display: none;
    }

    .tabs-nav .tab-label-short {
        display: inline;
    }

    .tab-btn {
        padding: 7px 4px;
        font-size: 0.74rem;
    }

    .queue-item {
        padding: 6px 6px;
        gap: 6px;
    }

    .queue-item-thumb {
        width: 36px;
        height: 36px;
        border-radius: 6px;
    }

    .queue-item-title {
        font-size: 0.8rem;
    }

    .queue-item-artist {
        font-size: 0.68rem;
    }

    .item-btn {
        padding: 3px 4px;
        font-size: 0.74rem;
    }

    .queue-item-actions {
        gap: 1px;
    }

    .search-result-item {
        padding: 8px 6px;
        gap: 8px;
    }

    .search-result-thumb {
        width: 48px;
        height: 36px;
    }

    .search-result-title {
        font-size: 0.78rem;
    }

    .action-play-btn,
    .action-add-btn {
        padding: 4px 8px;
        font-size: 0.7rem;
    }
}

/* 5. ULTRA-NARROW SCREENS (330px and below) */
@media (max-width: 330px) {
    .controls {
        gap: 3px;
    }

    .ctrl-btn {
        width: 32px;
        height: 32px;
        font-size: 0.95rem;
    }

    .main-play-btn {
        width: 40px;
        height: 40px;
        font-size: 1.15rem;
    }

    .item-btn.move-up-btn,
    .item-btn.move-down-btn {
        display: none;
    }
}

/* 6. LANDSCAPE ORIENTATION ON SMARTPHONES (Short Viewport Height) */
@media (orientation: landscape) and (max-height: 560px) {
    body {
        padding: 4px 8px;
        align-items: flex-start;
    }

    .player-wrapper {
        margin: 0 auto;
    }

    .player-container {
        display: grid;
        grid-template-columns: minmax(240px, 42%) 1fr;
        gap: 12px;
        padding: 8px 12px;
        min-height: auto;
        border-radius: 14px;
    }

    .player-left-panel {
        gap: 4px;
    }

    .player-right-panel {
        border-left: 1px solid var(--border-color);
        padding-left: 12px;
        border-top: none;
        padding-top: 0;
    }

    .player-header {
        padding-bottom: 0;
        gap: 4px;
    }

    .brand-icon {
        font-size: 1.1rem;
        padding: 3px;
        border-radius: 8px;
    }

    .player-header h2 {
        font-size: 0.88rem;
    }

    .subtitle {
        display: none;
    }

    .badge-btn {
        padding: 2px 6px;
        font-size: 0.65rem;
    }

    .status-badge {
        padding: 2px 6px;
        font-size: 0.62rem;
    }

    .now-playing-card {
        padding: 6px 8px;
        margin: 0;
        border-radius: 10px;
    }

    .cover-art-container {
        width: 50px;
        height: 50px;
        margin-bottom: 2px;
    }

    .vinyl-center {
        width: 12px;
        height: 12px;
    }

    .track-details h3 {
        font-size: 0.8rem;
        margin-bottom: 1px;
    }

    .track-details p {
        font-size: 0.68rem;
    }

    .equalizer-wrapper {
        margin-top: 2px;
        padding: 3px 6px;
        gap: 2px;
    }

    #equalizer-canvas {
        height: 24px;
    }

    .eq-tag {
        font-size: 0.58rem;
    }

    .eq-sync-btn {
        font-size: 0.58rem;
        padding: 1px 5px;
    }

    .eq-mini-bars {
        display: none;
    }

    .eq-footnote {
        display: none;
    }

    .left-panel-controls {
        gap: 4px;
    }

    .progress-section {
        margin-bottom: 0;
    }

    .time-display {
        margin-top: 1px;
        font-size: 0.65rem;
    }

    .controls {
        gap: 6px;
    }

    .ctrl-btn {
        width: 28px;
        height: 28px;
        font-size: 0.95rem;
    }

    .main-play-btn {
        width: 34px;
        height: 34px;
        font-size: 1.15rem;
    }

    .volume-container {
        padding: 2px 8px;
        gap: 6px;
    }

    .volume-icon-btn {
        font-size: 0.85rem;
    }

    #volume-label {
        font-size: 0.68rem;
    }

    .tabs-nav {
        margin-bottom: 4px;
        padding: 2px;
        gap: 3px;
    }

    .tab-btn {
        padding: 5px 6px;
        font-size: 0.72rem;
    }

    .tab-content-container {
        min-height: 0;
    }

    .playlist-manager-bar {
        margin-bottom: 4px;
        gap: 4px;
    }

    .selector-label {
        font-size: 0.72rem;
    }

    .playlist-dropdown {
        padding: 3px 6px;
        font-size: 0.72rem;
    }

    .playlist-toolbar {
        gap: 3px;
    }

    .playlist-toolbar .preset-btn,
    .playlist-toolbar .danger-btn {
        padding: 3px 6px;
        font-size: 0.68rem;
    }

    .queue-presets-bar {
        margin-bottom: 4px;
        gap: 4px;
    }

    .presets-label {
        font-size: 0.68rem;
    }

    .preset-btn {
        padding: 3px 6px;
        font-size: 0.68rem;
    }

    .reorder-tip {
        display: none;
    }

    .queue-list {
        max-height: calc(100vh - 110px);
        min-height: 140px;
        gap: 4px;
    }

    .queue-item {
        padding: 4px 6px;
        gap: 6px;
    }

    .queue-item-thumb {
        width: 30px;
        height: 30px;
    }

    .queue-item-title {
        font-size: 0.75rem;
    }

    .queue-item-artist {
        font-size: 0.65rem;
    }

    .item-btn {
        padding: 2px;
        font-size: 0.7rem;
    }

    #search-results {
        max-height: calc(100vh - 130px);
        min-height: 120px;
        gap: 4px;
    }

    .search-result-item {
        padding: 4px 6px;
        gap: 6px;
    }

    .search-result-thumb {
        width: 36px;
        height: 26px;
    }

    .search-result-title {
        font-size: 0.75rem;
    }

    .search-container {
        margin-bottom: 4px;
        gap: 4px;
    }

    #search-input {
        padding: 6px 28px;
        font-size: 0.75rem;
    }

    #search-btn {
        padding: 0 10px;
        font-size: 0.75rem;
    }

    .search-tips {
        display: none;
    }
}
