:root {
    /* --- COLOR PALETTE: THE CIRCADIAN SPECTRUM --- */
    --void: #050505;
    --onyx: #121212;
    --tungsten: #2A2A2A;
    --starlight: #EDEDED;
    --ash: #888888;

    /* Neuro-States */
    --delta: #4B0082;
    /* Sleep */
    --beta: #FFBF00;
    /* Focus */
    --gamma: #FF4500;
    /* Peak/Heal */

    /* --- TYPOGRAPHY --- */
    --font-human: 'Inter', sans-serif;
    --font-data: 'Space Mono', monospace;

    /* --- SPACING (8pt Grid) --- */
    --space-xs: 8px;
    --space-sm: 16px;
    --space-md: 32px;
    --space-lg: 64px;
    --space-xl: 12vh;
}

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

html,
body {
    height: 100%;
    width: 100%;
    background-color: var(--void);
    color: var(--starlight);
    overflow: hidden;
}

/* UTILITY CLASSES */
.mono-xs {
    font-family: var(--font-data);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--ash);
}

.blink {
    animation: blinker 1s linear infinite;
}

@keyframes blinker {
    50% {
        opacity: 0;
    }
}

/* --- LAYER 1: CANVAS --- */
#neuro-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    opacity: 1;
    filter: blur(5px) contrast(2.0);
    mix-blend-mode: lighter;
}

/* --- LAYER 2: NAV --- */
.lab-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-sm) var(--space-md);
    z-index: 1000;
    font-family: var(--font-data);
    background: rgba(5, 5, 5, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

@media (min-width: 768px) {
    .lab-nav {
        padding: 24px var(--space-lg);
    }
}

.nav-brand {
    font-weight: 700;
    letter-spacing: -0.05em;
    font-size: 1.2rem;
}

.nav-status {
    font-size: 0.8rem;
    color: var(--ash);
    border: 1px solid var(--tungsten);
    padding: 4px 12px;
    border-radius: 99px;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

/* --- MENU TOGGLE --- */
.menu-toggle {
    background: transparent;
    border: none;
    cursor: pointer;
    width: 40px;
    height: 40px;
    position: relative;
    z-index: 1001;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-end;
    gap: 6px;
    padding: 0;
}

.menu-toggle .bar {
    display: block;
    width: 24px;
    height: 2px;
    background-color: var(--starlight);
    transition: all 0.4s cubic-bezier(0.86, 0, 0.07, 1);
}

.menu-toggle .bot {
    width: 16px;
}

.menu-toggle:hover .bar {
    width: 28px;
    background-color: #FFBF00;
    box-shadow: 0 0 10px rgba(255, 191, 0, 0.5);
}

body.menu-open .menu-toggle .top {
    transform: translateY(4px) rotate(45deg);
    width: 24px;
    background-color: #fff;
}

body.menu-open .menu-toggle .bot {
    transform: translateY(-4px) rotate(-45deg);
    width: 24px;
    background-color: #fff;
}

/* --- OVERLAY --- */
.nav-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(5, 5, 5, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    align-items: center;
    justify-content: center;
}

body.menu-open .nav-overlay {
    opacity: 1;
    pointer-events: auto;
}

.nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
    text-align: center;
}

.nav-item {
    margin-bottom: var(--space-md);
    overflow: hidden;
}

.nav-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--starlight);
    transform: translateY(100%);
    opacity: 0;
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.6s ease;
    transition-delay: var(--d);
}

body.menu-open .nav-link {
    transform: translateY(0);
    opacity: 1;
}

.nav-meta {
    font-family: var(--font-data);
    font-size: 0.75rem;
    color: var(--ash);
    margin-bottom: 4px;
    letter-spacing: 0.1em;
}

.nav-label {
    font-family: var(--font-human);
    font-size: 2.5rem;
    font-weight: 300;
    letter-spacing: -0.02em;
    text-transform: uppercase;
    transition: color 0.3s ease;
}

.nav-link:hover .nav-label {
    color: #FFBF00;
    text-shadow: 0 0 20px rgba(255, 191, 0, 0.4);
}

.nav-link:hover .nav-meta {
    color: #fff;
}

.nav-footer {
    position: absolute;
    bottom: var(--space-md);
    left: 0;
    width: 100%;
    text-align: center;
    opacity: 0;
    transition: opacity 0.5s ease 0.6s;
}

body.menu-open .nav-footer {
    opacity: 0.5;
}

@media (min-width: 768px) {
    .nav-label {
        font-size: 4rem;
    }
}

/* --- LAYER 3: VIEWPORT --- */
.viewport {
    position: relative;
    width: 100%;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 10;
    scroll-behavior: smooth;
    padding-top: 80px;
    padding-bottom: 100px;
}

@media (min-width: 768px) {
    .viewport {
        padding-top: 110px;
    }
}

/* --- LAYER 4: AUDIO DOCK --- */
.audio-dock {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 80px;
    background: rgba(5, 5, 5, 0.85);
    backdrop-filter: blur(12px) saturate(0);
    border-top: 1px solid var(--tungsten);
    display: grid;
    /* Redesigned Grid: Play | Art | Info | Menu - perfectly centered */
    grid-template-columns: 56px 68px 1fr 56px;
    align-items: center;
    padding: 0 var(--space-sm);
    gap: 16px;
    z-index: 900;
    transition: transform 0.3s ease;
}

/* Play Button - Styled to match fullscreen player */
.dock-play-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255, 191, 0, 0.15);
    border: 1px solid rgba(255, 191, 0, 0.4);
    color: var(--starlight);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    margin: 0 auto;
    /* Center within 56px column */
    backdrop-filter: blur(10px);
    box-shadow: 0 0 15px rgba(255, 191, 0, 0.2);
}

.dock-play-btn:hover,
.dock-play-btn.playing {
    background: rgba(255, 191, 0, 0.25);
    border-color: rgba(255, 191, 0, 0.4);
    color: #FFBF00;
    transform: scale(1.05);
    box-shadow: 0 0 25px rgba(255, 191, 0, 0.4);
}

/* Album Art Slot (Enhanced for Vinyl Records) */
.dock-art {
    width: 64px;
    height: 64px;
    background: var(--onyx);
    border-radius: 50%;
    overflow: hidden;
    border: 1px solid var(--tungsten);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.dock-art:hover {
    border-color: #FFBF00;
    box-shadow: 0 0 15px rgba(255, 191, 0, 0.3);
    transform: scale(1.05);
}

/* Vinyl Record Structure */
.vinyl-record {
    width: 100%;
    height: 100%;
    position: relative;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #333, #1a1a1a);
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.5);
}

.vinyl-grooves {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    overflow: hidden;
}

.vinyl-grooves::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background: repeating-radial-gradient(circle at center,
            transparent 0,
            transparent 2px,
            rgba(255, 255, 255, 0.03) 2px,
            rgba(255, 255, 255, 0.03) 3px);
}

.album-art-label {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 0 0 1px #2a2a2a, 0 0 0 2px #1a1a1a;
    z-index: 2;
}

.album-art-label.placeholder {
    width: 100%;
    height: 100%;
    background: #050505;
    overflow: hidden;
}

.album-art-label.placeholder svg {
    width: 100%;
    height: 100%;
}

/* Vinyl Rotation Animation with Angle Preservation */
.dock-art .vinyl-record {
    animation: vinyl-spin 3s linear infinite;
    animation-play-state: paused;
    animation-delay: calc(var(--vinyl-rotation, 0deg) * -1s / 120);
    /* 120deg/s = 360deg/3s */
}

.dock-art.spinning .vinyl-record {
    animation-play-state: running;
}

@keyframes vinyl-spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* Center Info */
.dock-center {
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.track-meta {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.track-title {
    font-family: var(--font-human);
    font-size: 0.9rem !important;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1;
}

.track-time {
    font-family: var(--font-data);
    font-size: 0.75rem;
    color: var(--ash);
    min-width: 40px;
    text-align: right;
}

/* Progress Bar */
.progress-container {
    width: 100%;
    height: 4px;
    background: var(--tungsten);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.progress-container::after {
    content: '';
    position: absolute;
    top: -10px;
    bottom: -10px;
    left: 0;
    right: 0;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: #FFBF00;
    box-shadow: 0 0 10px #FFBF00;
    transition: width 0.1s linear;
}

/* Discography Toggle Button - Disc-shaped to match play button */
.dock-disc-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 191, 0, 0.15);
    border: 1px solid rgba(255, 191, 0, 0.4);
    color: var(--starlight);
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
    box-shadow: 0 0 15px rgba(255, 191, 0, 0.2);
    margin: 0 auto;
    /* Center within 56px column */
    padding: 0;
    /* Remove any default padding */
    box-sizing: border-box;
}

.dock-disc-btn:hover {
    background: rgba(255, 191, 0, 0.25);
    border-color: rgba(255, 191, 0, 0.4);
    color: #FFBF00;
    transform: scale(1.05);
    box-shadow: 0 0 25px rgba(255, 191, 0, 0.4);
}

.dock-disc-btn.active {
    background: rgba(255, 191, 0, 0.35);
    border-color: rgba(255, 191, 0, 0.6);
    color: #FFBF00;
    box-shadow: 0 0 30px rgba(255, 191, 0, 0.6);
}

.dock-disc-btn svg {
    width: 16px;
    height: 16px;
    display: block;
    flex-shrink: 0;
    /* Prevent SVG from shrinking */
    margin: 0;
    /* Remove any default margin */
    padding: 0;
    /* Remove any default padding */
}

/* ANIMATIONS */
.fade-in-up {
    animation: fadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    opacity: 0;
    transform: translateY(20px);
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 768px) {
    .audio-dock {
        height: 70px;
        padding-bottom: env(safe-area-inset-bottom);
        grid-template-columns: 50px 50px 1fr 60px;
    }

    .dock-art {
        width: 50px;
        height: 50px;
    }

    /* Smaller album art on mobile */
}