:root {
    --bg-color: #ffffff;
    --text-primary: #000000;
    --text-secondary: #666666;
    --wheel-radius: 180px;
    --yellow-glow: #ffd700;
    --ws: 1;
}

body.dark-theme, body.night {
    --bg-color: #050505;
    --text-primary: #ffffff;
    --text-secondary: #aaaaaa;
}

body.morning {
    --bg-color: #fcf4e8;
}

body.evening {
    --bg-color: #1a1625;
    --text-primary: #e0d0f0;
}

@font-face {
    font-family: 'Little Small';
    src: url('font.otf') format('opentype');
}

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

html, body {
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

body {
    padding-bottom: 0;
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: 'Little Small', sans-serif;
    text-transform: lowercase;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    overflow: hidden;
    position: relative;
    user-select: none;
    transition: background-color 0.5s ease, color 0.5s ease;
}

body::before {
    content: "";
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background-image: url('paper.jpg');
    background-size: cover;
    background-position: center;
    opacity: 0.05;
    pointer-events: none;
    mix-blend-mode: multiply;
    z-index: -1;
}

body.dark-theme::before {
    opacity: 0.03;
    mix-blend-mode: normal;
}

header {
    position: absolute;
    top: 15px;
    left: 0;
    z-index: 10;
    width: 100%;
    display: flex;
    justify-content: center;
}

.floating-logo {
    width: 80%;
    max-width: 550px;
    height: auto;
    fill: var(--text-primary);
    transition: fill 0.5s ease;
    font-family: 'Caveat', cursive;
    font-size: 3rem;
    line-height: 1;
    text-align: center;
    color: var(--text-primary);
    animation: float 3s ease-in-out infinite;
    transform-origin: center;
}

@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-15px); }
    100% { transform: translateY(0px); }
}

.volume-container {
    position: absolute;
    bottom: 60px;
    right: 40px;
    z-index: 60;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.volume-wrapper {
    width: 20px;
    height: 80px;
    position: relative;
    margin-bottom: 5px;
}

#volume-slider {
    width: 80px;
    height: 4px;
    background: var(--text-secondary);
    outline: none;
    border-radius: 2px;
    transform: rotate(-90deg);
    cursor: pointer;
    z-index: 70;
    position: absolute;
    top: 39px;
    left: -30px;
    accent-color: var(--text-primary);
}

.control-btn {
    font-size: 1.8rem;
    color: var(--text-primary);
    cursor: pointer;
    background: transparent;
    transition: color 0.2s ease, transform 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

#sound-toggle {
    position: relative;
    animation: bounce-smooth 3s ease-in-out infinite;
}

/* Stop bouncing when muted so the strikethrough line doesn't jump */
#sound-toggle.muted {
    animation: none;
}

#theme-toggle {
    position: absolute;
    top: 40px;
    right: 40px;
    z-index: 60;
    animation: bounce-smooth 3s ease-in-out infinite 0.5s;
}

.control-btn:hover {
    transform: scale(1.15);
}

#sound-toggle.muted::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 28px;
    height: 2px;
    background: var(--text-primary);
    transform: translate(-50%, -50%) rotate(45deg);
    border-radius: 1px;
}

.bg-glow {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 110vmax;
    height: 110vmax;
    border-radius: 50%;
    background: radial-gradient(circle at center, var(--station-color, transparent) 0%, transparent 65%);
    z-index: 1;
    opacity: 0;
    transition: background 2s ease, opacity 1s ease;
    pointer-events: none;
}

@keyframes glow-breathe {
    0%   { transform: translate(-50%, -50%) scale(0.8); }
    50%  { transform: translate(-50%, -50%) scale(1.2); }
    100% { transform: translate(-50%, -50%) scale(0.8); }
}

body:not(.dark-theme):not(.night) .bg-glow {
    opacity: 0 !important;
}

body.dark-theme .bg-glow {
    opacity: 0.5;
    animation: glow-breathe 6s ease-in-out infinite;
}


.wheel-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    z-index: 10;
    /* Wrapper height matches scaled container + track text at bottom */
    height: calc(650px * var(--ws));
}

.wheel-container {
    position: relative;
    width: 580px;
    height: 580px;
    display: flex;
    align-items: center;
    justify-content: center;
    perspective: 1000px;
    transform: scale(var(--ws));
    transform-origin: center center;
}

.wheel-ring {
    position: absolute;
    width: 460px; 
    height: 460px;
    border-radius: 44% 56% 52% 48% / 48% 52% 46% 54%;
    background: rgba(0, 0, 0, 0.02);
    border: 1px solid var(--text-primary);
    box-shadow: inset 0 0 20px rgba(0,0,0,0.05);
    animation: spin-wobble 20s linear infinite;
    overflow: hidden;
    pointer-events: none; /* Prevents any dead zones from overlapping UI */
    transition: transform 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.wheel-ring::before {
    content: "";
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background-image: url('paper.jpg');
    background-size: cover;
    background-position: center;
    opacity: 0.05;
    pointer-events: none;
    mix-blend-mode: multiply;
}

body.dark-theme .wheel-ring::before {
    opacity: 0.03;
    mix-blend-mode: normal;
}

@keyframes spin-wobble {
    0% { border-radius: 44% 56% 52% 48% / 48% 52% 46% 54%; transform: rotate(0deg); }
    33% { border-radius: 54% 46% 43% 57% / 56% 44% 51% 49%; }
    66% { border-radius: 46% 54% 57% 43% / 45% 55% 53% 47%; }
    100% { border-radius: 44% 56% 52% 48% / 48% 52% 46% 54%; transform: rotate(360deg); }
}

.wheel {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    z-index: 2;
    transform-style: preserve-3d;
    transition: transform 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    pointer-events: none; /* Let clicks pass through to stations only */
}

/* Individual station styling */
.station {
    position: absolute;
    width: 90px;
    height: 90px;
    left: 50%;
    top: 50%;
    margin-left: -45px;
    margin-top: -45px;
    border-radius: 45% 55% 42% 58% / 55% 45% 58% 42%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    /* Only transition visual props, NOT transform (prevents cursor flicker) */
    transition: border-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
    background: var(--bg-color);
    border: 2px solid var(--text-primary);
    color: var(--text-primary);
    /* Position via CSS vars set by JS */
    transform: translate(var(--tx, 0), var(--ty, 0));
    overflow: hidden;
    /* Re-enable pointer events (parent .wheel has them disabled) */
    pointer-events: auto;
}

/* Kill pointer-events on ALL children so the entire blob is one solid hitbox */
.station * {
    pointer-events: none;
}

/* Hover/active: NO scale change = NO cursor flicker. Use box-shadow spread for visual growth */
.station:hover, .station.active {
    background: color-mix(in srgb, var(--station-color) 8%, transparent);
    border-color: var(--station-color);
    color: var(--station-color);
    /* 3rd shadow = spread radius, gives visual "growth" without moving hitbox */
    box-shadow: 0 0 15px 4px color-mix(in srgb, var(--station-color) 40%, transparent);
    z-index: 10;
}

.station-icon {
    font-size: 2.4rem;
    line-height: 1;
    transition: transform 0.3s;
    pointer-events: none;
}

/* Make icon slightly bigger when active/hovered */
.station:hover .station-icon, .station.active .station-icon {
    transform: scale(1.15);
}

.station-name {
    display: none;
    pointer-events: none;
}

.center-display {
    position: absolute;
    width: 280px;
    height: 120px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1; /* Below stations so it never steals clicks */
    text-align: center;
    pointer-events: none;
}

#current-station {
    font-family: 'Little Small', sans-serif;
    font-size: 2.8rem;
    font-weight: 400;
    text-transform: lowercase;
    letter-spacing: 2px;
    color: var(--text-primary);
}

/* Track Display under the wheel */
.track-display {
    position: absolute;
    bottom: -40px;
    text-align: center;
    width: 100%;
    pointer-events: none;
}

.track-label {
    font-size: 0.75rem;
    text-transform: lowercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

.track-name {
    font-family: 'Little Small', sans-serif;
    font-size: 1.8rem;
    font-weight: 400;
    color: var(--text-primary);
    transition: opacity 0.3s;
}

/* Footer Styles */
footer {
    position: absolute;
    bottom: 35px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.footer-quote {
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.footer-socials {
    display: flex;
    gap: 20px;
    margin: 20px 0;
}

.footer-socials a {
    color: var(--text-primary);
    text-decoration: none;
}

.footer-socials i {
    font-size: 1.5rem;
    cursor: pointer;
    transition: transform 0.2s, color 0.2s;
}

.footer-socials i:hover {
    transform: scale(1.2);
    color: var(--station-color, #ff00ff);
}

.footer-text {
    text-align: center;
    font-size: 0.9rem;
    line-height: 1.4;
    color: var(--text-primary);
}

/* EQ Panel */
.eq-panel {
    position: absolute;
    bottom: 60px;
    left: 40px;
    z-index: 60;
    display: flex;
    gap: 20px;
    background: rgba(12, 12, 12, 0.5);
    background: color-mix(in srgb, var(--bg-color) 50%, transparent);
    padding: 20px 25px;
    border: 1px solid rgba(128, 128, 128, 0.3);
    border: 1px solid color-mix(in srgb, var(--text-secondary) 30%, transparent);
    border-radius: 12px;
    backdrop-filter: blur(4px);
}

.eq-band {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.eq-wrapper {
    width: 20px;
    height: 80px;
    position: relative;
}

.eq-slider {
    width: 80px;
    height: 2px;
    background: var(--text-secondary);
    outline: none;
    border-radius: 2px;
    transform: rotate(-90deg);
    cursor: pointer;
    z-index: 70;
    position: absolute;
    top: 39px;
    left: -30px;
    accent-color: var(--text-primary);
}

.eq-band label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 15px;
    letter-spacing: 1px;
}

#bathroom-toggle.active i {
    color: var(--station-color, #ff00ff);
    transform: scale(1.1);
}

#vinyl-toggle {
    border: none;
    font-size: 1.4rem;
    box-shadow: none;
    background: transparent;
}

#vinyl-toggle.active i {
    color: var(--station-color, #ff00ff);
    animation: spin-wobble 2s linear infinite;
}

/* Marquee Styles */
.marquee {
    position: fixed;
    bottom: 0;
    width: 100%;
    background: rgba(0, 0, 0, 0.05);
    background: color-mix(in srgb, var(--text-primary) 5%, var(--bg-color));
    border-top: 1px solid rgba(128, 128, 128, 0.2);
    border-top: 1px solid color-mix(in srgb, var(--text-primary) 20%, transparent);
    overflow: hidden;
    white-space: nowrap;
    padding: 6px 0;
    z-index: 100;
}

.marquee-content {
    display: inline-block;
    padding-left: 100%;
    animation: marquee 25s linear infinite;
    font-size: 0.9rem;
    letter-spacing: 2px;
    color: var(--text-secondary);
}

@keyframes marquee {
    0% { transform: translate(0, 0); }
    100% { transform: translate(-100%, 0); }
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    body {
        padding-bottom: 20px;
        justify-content: flex-start;
        gap: 3vh;
        overflow: hidden; /* Never allow scrollbars, force scale down */
    }
    
    header {
        position: relative;
        top: 0;
        order: 1;
        margin-top: 10px;
        margin-bottom: 0;
    }
    
    .floating-logo {
        max-width: 70%;
    }
    
    .wheel-wrapper {
        order: 2;
        margin-top: 5px;
        margin-bottom: 5px;
    }
    
    .volume-container {
        display: none;
        order: 3;
        position: relative;
        bottom: auto;
        right: auto;
        flex-direction: row;
        margin-top: 5px;
        margin-bottom: 5px;
    }
    
    .volume-wrapper {
        width: 80px;
        height: 20px;
        margin-bottom: 0;
    }
    
    #volume-slider {
        transform: none;
        top: 8px;
        left: 0;
    }
    
    .eq-panel {
        display: none;
        order: 4;
        position: relative;
        bottom: auto;
        left: auto;
        flex-direction: row;
        margin: 5px auto;
        padding: 10px 15px;
    }
    
    body.show-settings .volume-container,
    body.show-settings .eq-panel {
        display: flex;
    }
    
    #settings-toggle {
        display: flex;
        position: absolute;
        top: 20px;
        left: 20px;
        z-index: 100;
    }
    body.show-settings #settings-toggle {
        color: #4ade80;
    }
    
    #theme-toggle {
        top: 20px;
        right: 20px;
    }
    
    footer {
        order: 5;
        position: relative;
        bottom: auto;
        margin-top: 10px;
        padding-bottom: 20px;
    }
    
    .marquee {
        order: 6;
    }
}
