/* ==========================================================================
   COSMIC BEAT VISUALIZER & VIDEO STUDIO - LIQUID GLASS EDITION
   ========================================================================== */

:root {
    --bg-color: #020308;
    --accent-cyan: #00f0ff;
    --accent-magenta: #ff007b;
    --accent-purple: #9d4edd;
    --accent-amber: #ffaa00;

    /* Ultra-Translucent Sheer Glass Tokens (Ще прозоріше скло) */
    --liquid-bg: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.08) 0%,
        rgba(255, 255, 255, 0.015) 45%,
        rgba(180, 215, 255, 0.04) 100%
    ), rgba(4, 8, 18, 0.12);
    --liquid-border: rgba(255, 255, 255, 0.15);
    --liquid-border-subtle: rgba(255, 255, 255, 0.06);
    --liquid-highlight: inset 0 1px 1px 0 rgba(255, 255, 255, 0.22);
    --liquid-glow: 0 16px 40px -10px rgba(0, 0, 0, 0.45),
                   0 4px 15px rgba(0, 240, 255, 0.03);
    --liquid-blur: blur(20px) saturate(180%) brightness(108%);

    --text-main: #ffffff;
    --text-muted: rgba(230, 242, 255, 0.75);
    --danger: #ff3366;
    --radius-hud: 24px;
    --radius-pill: 9999px;
    --radius-card: 20px;
}

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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: var(--bg-color);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    color: var(--text-main);
}

/* ==========================================================================
   CANVAS & AMBIENT GLOW
   ========================================================================== */

#canvas-container {
    position: fixed;
    inset: 0;
    z-index: 1;
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
    outline: none;
}

.ambient-glow {
    position: fixed;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    background: 
        radial-gradient(circle at 50% 60%, rgba(0, 240, 255, 0.06), transparent 55%),
        radial-gradient(circle at 20% 85%, rgba(255, 0, 123, 0.05), transparent 45%),
        radial-gradient(circle at 80% 20%, rgba(157, 78, 221, 0.05), transparent 45%);
    transition: opacity 0.5s ease;
}

/* ==========================================================================
   TOP BAR (Brand & Header Actions)
   ========================================================================== */

#top-bar {
    position: fixed;
    top: 14px;
    left: 20px;
    right: 20px;
    z-index: 50;
    display: flex;
    justify-content: space-between;
    align-items: center;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

#top-bar > * {
    pointer-events: auto;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 18px;
    border-radius: var(--radius-pill);
    background: var(--liquid-bg);
    border: 1px solid var(--liquid-border);
    backdrop-filter: var(--liquid-blur);
    -webkit-backdrop-filter: var(--liquid-blur);
    box-shadow: var(--liquid-glow), var(--liquid-highlight);
    position: relative;
    overflow: hidden;
}

.brand-orb {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #fff, var(--accent-cyan));
    box-shadow: 0 0 12px var(--accent-cyan), 0 0 24px var(--accent-purple);
    animation: orbPulse 2.4s infinite ease-in-out;
}

@keyframes orbPulse {
    0%, 100% { transform: scale(1); opacity: 0.85; filter: drop-shadow(0 0 6px var(--accent-cyan)); }
    50% { transform: scale(1.3); opacity: 1; filter: drop-shadow(0 0 12px #fff); }
}

.brand-title {
    font-size: 11.5px;
    font-weight: 800;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    background: linear-gradient(135deg, #ffffff, rgba(200, 240, 255, 0.95));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1;
}

.brand-subtitle {
    font-size: 8.5px;
    font-weight: 500;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    max-width: 220px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

/* ==========================================================================
   LIQUID GLASS PILLS & BUTTONS
   ========================================================================== */

.glass-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: var(--radius-pill);
    background: var(--liquid-bg);
    border: 1px solid var(--liquid-border);
    backdrop-filter: var(--liquid-blur);
    -webkit-backdrop-filter: var(--liquid-blur);
    box-shadow: var(--liquid-glow), var(--liquid-highlight);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.pill-label {
    font-size: 10.5px;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.05em;
}

.round-btn {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.scene-popover-wrapper {
    position: relative;
    display: inline-flex;
}

.scene-popover {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 195px;
    padding: 6px;
    border-radius: 16px;
    background: var(--liquid-bg);
    border: 1px solid var(--liquid-border);
    backdrop-filter: var(--liquid-blur);
    -webkit-backdrop-filter: var(--liquid-blur);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.65), var(--liquid-highlight);
    display: flex;
    flex-direction: column;
    gap: 3px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px) scale(0.96);
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 100;
}

.scene-popover.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.scene-opt-item {
    padding: 9px 14px;
    border-radius: 10px;
    font-size: 11.5px;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    white-space: nowrap;
    border: 1px solid transparent;
}

.scene-opt-item:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.08);
}

.scene-opt-item.active {
    color: var(--accent-cyan);
    font-weight: 600;
    background: rgba(0, 240, 255, 0.12);
    border-color: rgba(0, 240, 255, 0.3);
    box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.15);
}

.glass-btn {
    display: flex;
    align-items: center;
    gap: 7px;
    height: 36px;
    padding: 0 15px;
    border-radius: var(--radius-pill);
    border: 1px solid var(--liquid-border);
    background: var(--liquid-bg);
    color: #fff;
    font-family: inherit;
    font-size: 11px;
    font-weight: 650;
    letter-spacing: 0.04em;
    cursor: pointer;
    backdrop-filter: var(--liquid-blur);
    -webkit-backdrop-filter: var(--liquid-blur);
    box-shadow: var(--liquid-glow), var(--liquid-highlight);
    position: relative;
    overflow: hidden;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.glass-btn:hover {
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.22) 0%,
        rgba(255, 255, 255, 0.08) 50%,
        rgba(0, 240, 255, 0.18) 100%
    );
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-1px) scale(1.02);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), 0 0 20px rgba(0, 240, 255, 0.3), var(--liquid-highlight);
}

.glass-btn:active {
    transform: translateY(1px) scale(0.98);
}

.record-btn {
    background: linear-gradient(
        135deg,
        rgba(255, 0, 123, 0.35) 0%,
        rgba(157, 78, 221, 0.20) 50%,
        rgba(255, 255, 255, 0.1) 100%
    );
    border-color: rgba(255, 0, 123, 0.5);
}

.record-btn:hover {
    border-color: var(--accent-magenta);
    box-shadow: 0 0 30px rgba(255, 0, 123, 0.6), var(--liquid-highlight);
}

.record-btn.recording {
    background: linear-gradient(
        135deg,
        rgba(255, 51, 102, 0.6) 0%,
        rgba(255, 0, 80, 0.35) 100%
    );
    border-color: var(--danger);
    animation: pulseRecording 1.4s infinite ease-in-out;
}

@keyframes pulseRecording {
    0%, 100% { box-shadow: 0 0 20px rgba(255, 51, 102, 0.7), var(--liquid-highlight); }
    50% { box-shadow: 0 0 45px rgba(255, 51, 102, 1), var(--liquid-highlight); }
}

.art-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #ffffff, var(--accent-cyan));
    box-shadow: 0 0 10px var(--accent-cyan);
    pointer-events: none;
}

.rec-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #fff, var(--danger));
    box-shadow: 0 0 10px var(--danger);
    pointer-events: none;
}

/* ==========================================================================
   SCENE BADGE & TRANSITION
   ========================================================================== */

.transition-overlay {
    position: fixed;
    inset: 0;
    z-index: 5;
    background: radial-gradient(circle at center, rgba(0, 240, 255, 0.25), rgba(255, 0, 123, 0.2), transparent 70%);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.transition-overlay.flash {
    opacity: 1;
}

.scene-badge {
    position: fixed;
    top: 70px;
    left: 50%;
    transform: translateX(-50%) translateY(-10px);
    z-index: 6;
    padding: 6px 18px;
    border-radius: var(--radius-pill);
    background: var(--liquid-bg);
    border: 1px solid var(--liquid-border);
    backdrop-filter: var(--liquid-blur);
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.2em;
    color: var(--accent-cyan);
    text-shadow: 0 0 10px var(--accent-cyan);
    opacity: 0;
    pointer-events: none;
    transition: all 0.4s ease;
}

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

/* Center Screen Tap Play/Pause Indicator */
.tap-feedback {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.65);
    z-index: 60;
    width: 78px;
    height: 78px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0, 240, 255, 0.22) 0%, rgba(157, 78, 221, 0.12) 100%), rgba(5, 10, 25, 0.4);
    border: 1px solid rgba(0, 240, 255, 0.5);
    box-shadow: 0 0 35px rgba(0, 240, 255, 0.4), inset 0 1px 1px rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    pointer-events: none;
    opacity: 0;
    transition: transform 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease;
}

.tap-feedback.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.05);
}

.tap-icon-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    filter: drop-shadow(0 0 10px rgba(0, 240, 255, 0.8));
}

/* ==========================================================================
   FLOATING HUD (BOTTOM MUSIC PLAYER - ANCHORED FIRMLY AT BOTTOM)
   ========================================================================== */

.glass-hud {
    position: fixed;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    width: min(860px, calc(100vw - 28px));
    padding: 12px 20px;
    border-radius: var(--radius-hud);
    background: var(--liquid-bg);
    border: 1px solid var(--liquid-border);
    backdrop-filter: var(--liquid-blur);
    -webkit-backdrop-filter: var(--liquid-blur);
    box-shadow: 
        0 25px 70px -10px rgba(0, 0, 0, 0.8),
        0 10px 30px rgba(0, 240, 255, 0.12),
        var(--liquid-highlight);
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow: visible;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Subtle fluid caustic glow effect inside HUD */
.glass-hud::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.45) 30%,
        rgba(0, 240, 255, 0.5) 50%,
        rgba(255, 0, 123, 0.45) 70%,
        transparent 100%
    );
    pointer-events: none;
    opacity: 0.45;
}

/* Timeline */
.timeline-container {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
}

.time-text {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10.5px;
    font-weight: 600;
    color: var(--text-muted);
    min-width: 40px;
    text-align: center;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

.seek-bar-wrapper {
    position: relative;
    flex: 1;
    height: 6px;
    border-radius: var(--radius-pill);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.5);
    cursor: pointer;
    overflow: visible;
    transition: height 0.2s ease;
}

.seek-bar-wrapper:hover {
    height: 8px;
}

.seek-bar-buffered {
    position: absolute;
    inset: 0 auto 0 0;
    width: 0%;
    border-radius: inherit;
    background: rgba(255, 255, 255, 0.16);
}

.seek-bar-fill {
    position: absolute;
    inset: 0 auto 0 0;
    width: 0%;
    border-radius: inherit;
    background: linear-gradient(
        90deg,
        rgba(0, 240, 255, 0.95),
        rgba(157, 78, 221, 0.95),
        rgba(255, 0, 123, 0.95)
    );
    box-shadow: 
        0 0 14px rgba(0, 240, 255, 0.8),
        inset 0 1px 0 rgba(255, 255, 255, 0.6);
    transition: width 0.05s linear;
}

.seek-bar-handle {
    position: absolute;
    top: 50%;
    left: 0%;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #ffffff, #d2f4ff);
    border: 1px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 0 10px rgba(0, 240, 255, 1), 0 2px 6px rgba(0, 0, 0, 0.4);
    transform: translate(-50%, -50%) scale(0);
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.seek-bar-wrapper:hover .seek-bar-handle {
    transform: translate(-50%, -50%) scale(1.15);
}

/* Controls Row */
.controls-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
}

/* Left: Track Info */
.track-info {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 170px;
    max-width: 240px;
}

.track-cover {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.2) 0%,
        rgba(0, 240, 255, 0.25) 50%,
        rgba(255, 0, 123, 0.25) 100%
    );
    border: 1px solid var(--liquid-border);
    backdrop-filter: var(--liquid-blur);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4), var(--liquid-highlight);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-cyan);
    overflow: hidden;
    flex-shrink: 0;
}

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

.track-meta {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.track-name {
    font-size: 12.5px;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.track-artist {
    font-size: 10px;
    font-weight: 500;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Center: Main Playback Buttons */
.main-buttons {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ctrl-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--liquid-border);
    background: var(--liquid-bg);
    color: #fff;
    cursor: pointer;
    backdrop-filter: var(--liquid-blur);
    -webkit-backdrop-filter: var(--liquid-blur);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3), var(--liquid-highlight);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.ctrl-btn:hover {
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.3) 0%,
        rgba(255, 255, 255, 0.1) 100%
    );
    border-color: rgba(255, 255, 255, 0.6);
    transform: translateY(-1px) scale(1.06);
    box-shadow: 0 10px 24px rgba(0, 240, 255, 0.25), var(--liquid-highlight);
}

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

.play-btn {
    width: 46px;
    height: 46px;
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.95) 0%,
        rgba(0, 240, 255, 0.85) 45%,
        rgba(157, 78, 221, 0.9) 100%
    );
    border: 1px solid rgba(255, 255, 255, 0.6);
    color: #030712;
    box-shadow: 
        0 10px 30px rgba(0, 240, 255, 0.5),
        inset 0 2px 2px rgba(255, 255, 255, 0.8);
}

.play-btn:hover {
    background: linear-gradient(
        135deg,
        #ffffff 0%,
        #5ff5ff 50%,
        #c37aff 100%
    );
    box-shadow: 
        0 14px 40px rgba(0, 240, 255, 0.8),
        inset 0 2px 3px rgba(255, 255, 255, 1);
    transform: translateY(-1px) scale(1.08);
}

/* Right: Utility */
.utility-buttons {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 170px;
    justify-content: flex-end;
}

.sub-btn {
    width: 34px;
    height: 34px;
    border-radius: 10px;
}

.with-badge {
    position: relative;
}

.badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #ffffff, var(--accent-cyan));
    color: #030712;
    font-size: 9px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 8px var(--accent-cyan);
}

.beat-meter {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 18px;
    padding: 0 2px;
}

.meter-bar {
    width: 3px;
    height: 3px;
    border-radius: var(--radius-pill);
    background: var(--accent-cyan);
    box-shadow: 0 0 6px var(--accent-cyan);
    transition: height 0.05s ease;
}

#meterMid { background: var(--accent-purple); box-shadow: 0 0 6px var(--accent-purple); }
#meterHigh { background: var(--accent-magenta); box-shadow: 0 0 6px var(--accent-magenta); }

.volume-container {
    display: flex;
    align-items: center;
    gap: 6px;
}

.vol-slider {
    appearance: none;
    width: 55px;
    height: 4px;
    border-radius: var(--radius-pill);
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.1);
    outline: none;
    cursor: pointer;
}

.vol-slider::-webkit-slider-thumb {
    appearance: none;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #fff, var(--accent-cyan));
    cursor: pointer;
    box-shadow: 0 0 8px var(--accent-cyan);
    transition: transform 0.15s ease;
}

.vol-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

/* ==========================================================================
   PLAYLIST DROPDOWN POPOVER (LIQUID GLASS POPUP FROM BUTTON)
   ========================================================================== */

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

.playlist-dropdown {
    position: absolute;
    bottom: calc(100% + 14px);
    right: 0;
    width: min(340px, calc(100vw - 32px));
    max-height: min(440px, 68vh);
    z-index: 500;
    background: var(--liquid-bg);
    border: 1px solid var(--liquid-border);
    border-radius: var(--radius-card);
    backdrop-filter: var(--liquid-blur);
    -webkit-backdrop-filter: var(--liquid-blur);
    box-shadow: 
        0 25px 70px -10px rgba(0, 0, 0, 0.85),
        0 10px 30px rgba(0, 240, 255, 0.2),
        var(--liquid-highlight);
    display: flex;
    flex-direction: column;
    padding: 16px;
    gap: 12px;
    opacity: 0;
    pointer-events: none;
    transform: translateY(12px) scale(0.96);
    transform-origin: bottom right;
    transition: all 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.playlist-dropdown.open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

.dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 2px;
}

.dropdown-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13.5px;
    font-weight: 800;
    color: #fff;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}

.close-pop-btn {
    background: var(--liquid-bg);
    border: 1px solid var(--liquid-border-subtle);
    border-radius: 50%;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 16px;
    cursor: pointer;
    line-height: 1;
    transition: all 0.2s ease;
}

.close-pop-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.drop-zone-mini {
    border: 1.5px dashed rgba(0, 240, 255, 0.4);
    border-radius: 12px;
    padding: 10px 12px;
    text-align: center;
    background: rgba(0, 240, 255, 0.05);
    border: 1px solid var(--liquid-border);
    backdrop-filter: var(--liquid-blur);
    box-shadow: var(--liquid-highlight);
    cursor: pointer;
    transition: all 0.22s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--accent-cyan);
    font-size: 11px;
    font-weight: 650;
}

.drop-zone-mini:hover, .drop-zone-mini.dragover {
    border-color: var(--accent-cyan);
    background: rgba(0, 240, 255, 0.14);
    box-shadow: 0 0 20px rgba(0, 240, 255, 0.35), var(--liquid-highlight);
    transform: scale(1.02);
}

.track-list-dropdown {
    flex: 1;
    overflow-y: auto;
    max-height: 220px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-right: 4px;
}

.track-list-dropdown::-webkit-scrollbar {
    width: 3.5px;
}

.track-list-dropdown::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-pill);
}

.playlist-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-radius: 10px;
    background: var(--liquid-bg);
    border: 1px solid var(--liquid-border-subtle);
    backdrop-filter: var(--liquid-blur);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2), var(--liquid-highlight);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.playlist-item:hover {
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateX(2px);
}

.playlist-item.active {
    background: linear-gradient(
        135deg,
        rgba(0, 240, 255, 0.26) 0%,
        rgba(157, 78, 221, 0.26) 100%
    );
    border-color: var(--accent-cyan);
    box-shadow: 0 0 16px rgba(0, 240, 255, 0.3), var(--liquid-highlight);
}

.playlist-item-left {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow: hidden;
}

.playlist-item-index {
    font-family: 'JetBrains Mono', monospace;
    font-size: 9.5px;
    font-weight: 700;
    color: var(--text-muted);
    min-width: 14px;
}

.playlist-item-meta {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    gap: 1px;
}

.playlist-item-title {
    font-size: 11.5px;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.playlist-item-artist {
    font-size: 9px;
    font-weight: 400;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.playlist-item-right {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.playlist-item-dur {
    font-family: 'JetBrains Mono', monospace;
    font-size: 9.5px;
    color: var(--text-muted);
}

.playlist-item-del-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
    opacity: 0.6;
}

.playlist-item:hover .playlist-item-del-btn {
    opacity: 1;
}

.playlist-item-del-btn:hover {
    color: #ff3366;
    background: rgba(255, 51, 102, 0.2);
    transform: scale(1.15);
}

.playlist-empty {
    padding: 24px 12px;
    text-align: center;
    font-size: 11px;
    color: var(--text-muted);
}

/* ==========================================================================
   RECORDING MODAL (LIQUID GLASS CARD)
   ========================================================================== */

.recording-modal {
    position: fixed;
    inset: 0;
    z-index: 300;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(16px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s ease;
}

.recording-modal.active {
    opacity: 1;
    pointer-events: auto;
}

.recording-card {
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.16) 0%,
        rgba(20, 10, 30, 0.75) 50%,
        rgba(5, 5, 15, 0.95) 100%
    );
    border: 1px solid rgba(255, 51, 102, 0.5);
    box-shadow: 
        0 30px 90px rgba(255, 51, 102, 0.35),
        var(--liquid-highlight);
    border-radius: var(--radius-card);
    backdrop-filter: var(--liquid-blur);
    padding: 34px 44px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    transform: scale(0.92);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.recording-modal.active .recording-card {
    transform: scale(1);
}

.pulse-ring {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #fff, var(--danger));
    box-shadow: 0 0 25px var(--danger);
    animation: ringGlow 1s infinite alternate;
}

@keyframes ringGlow {
    from { transform: scale(0.85); opacity: 0.7; }
    to { transform: scale(1.25); opacity: 1; box-shadow: 0 0 35px var(--danger); }
}

.rec-title {
    font-size: 18px;
    font-weight: 800;
    color: #fff;
}

.rec-timer {
    font-family: 'JetBrains Mono', monospace;
    font-size: 32px;
    font-weight: 800;
    color: var(--danger);
    letter-spacing: 0.08em;
    text-shadow: 0 0 15px rgba(255, 51, 102, 0.6);
}

.rec-sub {
    font-size: 11.5px;
    color: var(--text-muted);
}

.danger-btn {
    background: linear-gradient(135deg, #ff3366, #ff0055);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.4);
    padding: 10px 24px;
    box-shadow: 0 10px 25px rgba(255, 51, 102, 0.4);
}

.danger-btn:hover {
    background: linear-gradient(135deg, #ff4d7a, #ff1a66);
    box-shadow: 0 0 30px rgba(255, 51, 102, 0.8);
    transform: translateY(-1px);
}

/* ==========================================================================
   TOAST (LIQUID GLASS PILL)
   ========================================================================== */

.toast {
    position: fixed;
    bottom: 95px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    z-index: 150;
    padding: 8px 20px;
    border-radius: var(--radius-pill);
    background: var(--liquid-bg);
    border: 1px solid var(--liquid-border);
    backdrop-filter: var(--liquid-blur);
    -webkit-backdrop-filter: var(--liquid-blur);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.6), var(--liquid-highlight);
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* ==========================================================================
   RESPONSIVE DESIGN & MOBILE OPTIMIZATIONS
   ========================================================================== */

/* Tablets & Smaller Desktops */
@media (max-width: 900px) {
    #top-bar {
        top: max(10px, env(safe-area-inset-top));
        left: 14px;
        right: 14px;
    }

    .brand-title { font-size: 10px; }
    .brand-subtitle { max-width: 130px; }

    .glass-hud {
        width: calc(100vw - 28px);
        bottom: max(10px, env(safe-area-inset-bottom));
        padding: 10px 16px;
    }
}

/* Mobile Phones (Standard & Large) */
@media (max-width: 640px) {
    #top-bar {
        top: max(8px, env(safe-area-inset-top));
        left: 8px;
        right: 8px;
        gap: 6px;
    }

    .brand {
        padding: 6px 12px;
        gap: 8px;
    }

    .brand-title {
        font-size: 9.5px;
        letter-spacing: 0.14em;
    }

    .brand-subtitle {
        display: none;
    }

    .top-actions {
        gap: 6px;
    }

    .round-btn {
        width: 32px;
        height: 32px;
    }

    .scene-popover {
        width: 175px;
        right: 0;
    }

    .glass-btn {
        height: 32px;
        padding: 0 10px;
        font-size: 10px;
        gap: 5px;
    }

    .glass-btn span:not(.rec-dot) {
        display: none; /* Hide text, show only icon on small mobile */
    }

    /* Floating HUD Mobile */
    .glass-hud {
        bottom: max(8px, env(safe-area-inset-bottom));
        left: 8px;
        right: 8px;
        transform: none;
        width: calc(100vw - 16px);
        padding: 10px 14px;
        border-radius: 20px;
        gap: 8px;
    }

    .timeline-container {
        gap: 8px;
    }

    .time-text {
        font-size: 9.5px;
        min-width: 32px;
    }

    .seek-bar-wrapper {
        height: 8px; /* Easier to tap with finger */
    }

    .controls-row {
        gap: 8px;
    }

    .track-info {
        min-width: 0;
        flex: 1;
        max-width: 140px;
        gap: 8px;
    }

    .track-cover {
        width: 32px;
        height: 32px;
        border-radius: 8px;
    }

    .track-name {
        font-size: 11px;
    }

    .track-artist {
        font-size: 9px;
    }

    .main-buttons {
        gap: 6px;
        flex-shrink: 0;
    }

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

    .play-btn {
        width: 42px;
        height: 42px;
    }

    .play-btn svg {
        width: 18px;
        height: 18px;
    }

    .utility-buttons {
        min-width: 0;
        flex-shrink: 0;
        gap: 6px;
        align-items: center;
    }

    .volume-container {
        display: flex;
        align-items: center;
        gap: 4px;
    }

    .vol-slider {
        width: 44px;
        height: 5px;
    }

    .vol-slider::-webkit-slider-thumb {
        width: 14px;
        height: 14px;
    }

    .beat-meter {
        display: none; /* Save horizontal space on narrow screens */
    }

    .sub-btn {
        width: 32px;
        height: 32px;
        border-radius: 8px;
    }

    /* Playlist Dropdown Popover Mobile (Fixed Viewport Bounds) */
    .playlist-dropdown {
        position: fixed;
        left: 10px;
        right: 10px;
        bottom: calc(max(8px, env(safe-area-inset-bottom)) + 74px);
        width: auto;
        max-width: calc(100vw - 20px);
        max-height: min(440px, 62vh);
        padding: 14px;
        border-radius: 20px;
        transform: translateY(14px) scale(0.96);
        transform-origin: bottom center;
        box-sizing: border-box;
    }

    .playlist-dropdown.open {
        transform: translateY(0) scale(1);
    }

    .track-list-dropdown {
        max-height: min(230px, 34vh);
    }

    .drop-zone-mini {
        padding: 8px 10px;
        font-size: 10.5px;
    }

    /* Recording Modal Mobile */
    .recording-card {
        width: calc(100vw - 32px);
        padding: 24px 20px;
        border-radius: 18px;
    }

    .rec-timer {
        font-size: 26px;
    }
}

/* Small Screens & Landscape Mobile */
@media (max-height: 520px) and (orientation: landscape) {
    #top-bar {
        top: 6px;
    }

    .glass-hud {
        bottom: 6px;
        padding: 6px 12px;
    }

    .track-cover {
        display: none;
    }

    .scene-badge {
        top: 50px;
        font-size: 9px;
    }
}
