:root {
    --bg-dark: #0b0f17;
    --bg-card: rgba(22, 30, 46, 0.75);
    --bg-card-hover: rgba(32, 44, 68, 0.9);
    --accent: #22c55e;
    --accent-glow: rgba(34, 197, 94, 0.35);
    --accent-blue: #38bdf8;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --border-color: rgba(255, 255, 255, 0.08);
    --player-bg: rgba(15, 23, 42, 0.95);
    --font-stack: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

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

body {
    font-family: var(--font-stack);
    background-color: var(--bg-dark);
    color: var(--text-primary);
    overflow-x: hidden;
    min-height: 100vh;
    padding-bottom: 40px;
    user-select: none;
    -webkit-user-select: none;
}

#app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    max-width: 580px;
    margin: 0 auto;
    position: relative;
    padding: 10px 14px;
}

/* Top Nav */
.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0 12px;
}

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

.brand-icon {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 22px;
}

.wave-bar {
    width: 4px;
    background: var(--accent);
    border-radius: 2px;
    animation: wave 1.2s ease-in-out infinite alternate;
}

.wave-bar:nth-child(1) { height: 10px; animation-delay: 0.1s; }
.wave-bar:nth-child(2) { height: 20px; animation-delay: 0.3s; }
.wave-bar:nth-child(3) { height: 14px; animation-delay: 0.2s; }

@keyframes wave {
    0% { height: 6px; }
    100% { height: 22px; }
}

.brand-text h1 {
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #fff 0%, #cbd5e1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.room-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.72rem;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.05);
    padding: 2px 8px;
    border-radius: 12px;
    margin-top: 1px;
    border: 1px solid var(--border-color);
}

.badge-dot {
    width: 6px;
    height: 6px;
    background: var(--accent);
    border-radius: 50%;
    box-shadow: 0 0 6px var(--accent);
}

.listener-count {
    color: var(--accent-blue);
    font-weight: 600;
    margin-left: 2px;
}

.nav-actions {
    position: relative;
}

.icon-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s ease;
}

.icon-btn:active {
    transform: scale(0.92);
}

.queue-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: var(--accent);
    color: #000;
    font-size: 0.65rem;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

/* Dedicated Player Card */
.player-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 18px;
    overflow: hidden;
    backdrop-filter: blur(16px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    margin-bottom: 16px;
}

.player-screen {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #090d16;
    overflow: hidden;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
}

.artwork-view {
    display: none;
    width: 100%;
    height: 100%;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at center, #1e293b 0%, #060911 100%);
}

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

.vinyl-wrapper {
    position: relative;
    width: 140px;
    height: 140px;
    border-radius: 50%;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
    overflow: hidden;
    border: 3px solid rgba(255, 255, 255, 0.1);
}

.player-artwork {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.vinyl-wrapper.spinning {
    animation: spin 18s linear infinite;
}

.vinyl-grooves {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.15);
    pointer-events: none;
}

.yt-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.yt-container iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.placeholder-view {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    padding: 20px;
    background: radial-gradient(circle at center, #1e293b 0%, #090d16 100%);
}

.placeholder-icon {
    font-size: 2.4rem;
    color: var(--accent);
    margin-bottom: 8px;
    opacity: 0.85;
}

.placeholder-text {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.placeholder-sub {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

.player-details {
    padding: 12px 16px 14px;
}

.track-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.track-text {
    flex: 1;
    min-width: 0;
    margin-right: 12px;
}

.player-title {
    font-size: 1.05rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #fff;
}

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

.share-btn {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.share-btn:hover {
    color: var(--accent);
}

/* Scrubber / Progress */
.progress-section {
    margin-bottom: 12px;
}

.progress-bar-wrap {
    position: relative;
    width: 100%;
    height: 5px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    display: flex;
    align-items: center;
}

#seekSlider {
    position: absolute;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}

.slider-fill {
    height: 100%;
    width: 0%;
    background: var(--accent);
    border-radius: 3px;
    box-shadow: 0 0 8px var(--accent-glow);
    position: relative;
}

.slider-fill::after {
    content: '';
    position: absolute;
    right: -4px;
    top: -3px;
    width: 11px;
    height: 11px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

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

/* Player Controls */
.player-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-bottom: 10px;
}

.control-btn {
    background: transparent;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 1.25rem;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s ease;
}

.control-btn:active {
    transform: scale(0.9);
}

.control-btn.primary {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--accent);
    color: #031409;
    font-size: 1.3rem;
    box-shadow: 0 4px 16px var(--accent-glow);
}

/* Sub-Bar (Autoplay Toggle) */
.player-sub-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
}

.sub-toggle {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 5px 12px;
    border-radius: 16px;
    font-size: 0.75rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.sub-toggle.active {
    background: rgba(34, 197, 94, 0.15);
    border-color: var(--accent);
    color: var(--accent);
}

.mode-indicator {
    font-size: 0.72rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Search Section */
.search-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 14px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.search-box input {
    width: 100%;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-color);
    padding: 11px 40px 11px 40px;
    border-radius: 14px;
    color: var(--text-primary);
    font-size: 0.9rem;
    outline: none;
    transition: all 0.2s ease;
}

.search-box input:focus {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--accent);
    box-shadow: 0 0 10px rgba(34, 197, 94, 0.2);
}

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

.chips-row {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
}

.chips-row::-webkit-scrollbar {
    display: none;
}

.chip {
    white-space: nowrap;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: 18px;
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chip.active {
    background: var(--accent);
    color: #05140b;
    font-weight: 600;
    border-color: var(--accent);
    box-shadow: 0 2px 8px var(--accent-glow);
}

/* Content Area & Songs */
.section-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 10px;
    color: #e2e8f0;
}

.song-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.song-card {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 8px 12px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
}

.song-card:active {
    transform: scale(0.98);
    background: var(--bg-card-hover);
}

.song-card.now-playing {
    border-color: var(--accent);
    background: rgba(34, 197, 94, 0.12);
}

.song-thumb-box {
    position: relative;
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    border-radius: 8px;
    overflow: hidden;
    background: #1e293b;
}

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

.play-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
    color: #fff;
    font-size: 0.85rem;
}

.song-card:hover .play-overlay,
.song-card.now-playing .play-overlay {
    opacity: 1;
}

.song-meta {
    flex: 1;
    min-width: 0;
}

.song-title {
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.song-card.now-playing .song-title {
    color: var(--accent);
}

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

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

.add-queue-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: color 0.2s;
}

.add-queue-btn:hover {
    color: var(--accent);
}

/* Spinner */
.spinner-container {
    text-align: center;
    padding: 24px 0;
    color: var(--text-secondary);
    font-size: 0.82rem;
}

.spinner {
    width: 28px;
    height: 28px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--accent);
    border-radius: 50%;
    margin: 0 auto 10px;
    animation: spin 0.8s linear infinite;
}

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

/* Queue Drawer */
.queue-drawer {
    position: fixed;
    inset: 0;
    background: var(--player-bg);
    z-index: 120;
    transform: translateY(105%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    padding: 20px 16px;
    backdrop-filter: blur(25px);
}

.queue-drawer.open {
    transform: translateY(0);
}

.drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.drawer-content {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.queue-section-title {
    font-size: 0.88rem;
    font-weight: 700;
    color: #cbd5e1;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.radio-tag {
    font-size: 0.68rem;
    color: var(--accent);
    background: rgba(34, 197, 94, 0.15);
    padding: 2px 7px;
    border-radius: 10px;
    font-weight: 600;
}

.empty-hint {
    font-size: 0.78rem;
    color: var(--text-secondary);
    padding: 10px 0;
    font-style: italic;
}

/* Toast */
.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid var(--accent);
    color: #fff;
    padding: 8px 16px;
    border-radius: 25px;
    font-size: 0.82rem;
    font-weight: 500;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6);
    z-index: 200;
    display: flex;
    align-items: center;
    gap: 8px;
    backdrop-filter: blur(12px);
    max-width: 90%;
    text-align: center;
}
