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

:root {
    --primary-color: #4a90e2;
    --secondary-color: #67b8e3;
    --background-color: #0a0e27;
    --text-color: #ffffff;
    --circle-glow: rgba(74, 144, 226, 0.5);
    --glow-intensity: 0.8;
    --symmetrical-brightness: 0; /* Dynamic brightness boost for symmetrical hours */
    
    /* Smooth color transitions - 30 seconds to match update interval */
    transition: --primary-color 30s ease-in-out,
                --secondary-color 30s ease-in-out,
                --circle-glow 30s ease-in-out;
}

/* Material Icons styling */
.material-symbols-outlined {
    font-variation-settings:
        'FILL' 0,
        'wght' 300,
        'GRAD' 0,
        'opsz' 24;
    user-select: none;
    -webkit-user-select: none;
    color: inherit;
    line-height: 1;
    display: inline-block;
}

/* Hover state for icons */
button:hover .material-symbols-outlined,
a:hover .material-symbols-outlined {
    font-variation-settings:
        'FILL' 0,
        'wght' 400,
        'GRAD' 0,
        'opsz' 24;
}

/* Unified button style - clean monochromatic design */
.app-button {
    background: rgba(255, 255, 255, 0.05) !important;
    backdrop-filter: blur(10px) !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    color: rgba(255, 255, 255, 0.7) !important;
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.2),
        0 0 20px rgba(255, 255, 255, 0.05) !important;
}

.app-button:hover {
    background: rgba(255, 255, 255, 0.1) !important;
    border-color: rgba(255, 255, 255, 0.3) !important;
    color: rgba(255, 255, 255, 0.95) !important;
    box-shadow: 
        0 6px 20px rgba(0, 0, 0, 0.3),
        0 0 40px rgba(255, 255, 255, 0.1) !important;
}

html {
    background-color: #000000;
    width: 100%;
    height: 100%;
    overflow: hidden; /* Keep hidden to prevent scrollbars */
}

body {
    font-family: 'Segoe UI', 'Arial', 'Helvetica', sans-serif;
    background-color: var(--background-color);
    background-image: radial-gradient(ellipse at center, 
                var(--background-color) 0%, 
                rgba(0, 0, 0, 0.95) 100%);
    color: var(--text-color);
    overflow: hidden; /* Keep hidden to prevent scrolling */
    width: 100%;
    height: 100%;
    min-height: 100vh;
    min-height: -webkit-fill-available;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background-color 1.5s ease, background-image 1.5s ease, filter 0.5s ease;
    padding: 0; /* Remove padding to prevent content shift */
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    margin: 0;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

/* About button (left side) */
#about-button {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 200;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.2),
        0 0 20px rgba(255, 255, 255, 0.05);
    pointer-events: all;
    color: rgba(255, 255, 255, 0.7);
}

#about-button:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
    box-shadow: 
        0 6px 20px rgba(0, 0, 0, 0.3),
        0 0 40px rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.95);
}

#about-button:active {
    transform: scale(0.95);
}

/* Support button - Buy Me a Coffee */
#support-button {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 200;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.2),
        0 0 20px rgba(255, 255, 255, 0.05);
    pointer-events: all;
    color: rgba(255, 255, 255, 0.7);
}

#support-button:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
    box-shadow: 
        0 6px 20px rgba(0, 0, 0, 0.3),
        0 0 40px rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.95);
}

#support-button:active {
    transform: scale(0.95);
}

/* Fullscreen button */
#fullscreen-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 200;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.2),
        0 0 20px rgba(255, 255, 255, 0.05);
}

#fullscreen-button:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
    box-shadow: 
        0 6px 20px rgba(0, 0, 0, 0.3),
        0 0 40px rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.95);
}

#fullscreen-button:active {
    transform: scale(0.95);
}

#fullscreen-button.fullscreen-active {
    font-size: 20px;
}

/* Records button (top center) */
#records-button {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 200;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.2),
        0 0 20px rgba(255, 255, 255, 0.05);
    pointer-events: all;
    color: rgba(255, 255, 255, 0.7);
}

#records-button:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateX(-50%) scale(1.1);
    box-shadow: 
        0 6px 20px rgba(0, 0, 0, 0.3),
        0 0 40px rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.95);
}

#records-button:active {
    transform: translateX(-50%) scale(0.95);
}

/* Invite button (top center-right) */
#invite-button {
    position: fixed;
    top: 20px;
    left: calc(50% + 65px);
    z-index: 200;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.2),
        0 0 20px rgba(255, 255, 255, 0.05);
    pointer-events: all;
    color: rgba(255, 255, 255, 0.7);
}

#invite-button:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
    box-shadow: 
        0 6px 20px rgba(0, 0, 0, 0.3),
        0 0 40px rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.95);
}

#invite-button:active {
    transform: scale(0.95);
}

#invite-button.copied {
    background: rgba(100, 255, 150, 0.25);
    border-color: rgba(100, 255, 150, 0.5);
    animation: invite-success 0.6s ease-out;
}

@keyframes invite-success {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2) rotate(360deg);
    }
    100% {
        transform: scale(1) rotate(360deg);
    }
}

@keyframes tooltip-appear {
    0% {
        opacity: 0;
        transform: translateX(-50%) translateY(-10px);
    }
    100% {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

@keyframes tooltip-disappear {
    0% {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
    100% {
        opacity: 0;
        transform: translateX(-50%) translateY(-10px);
    }
}

/* Mobile responsive */
@media (max-width: 768px) {
    #about-button {
        width: 45px;
        height: 45px;
        font-size: 20px;
        top: 15px;
        left: 15px;
    }
    
    #support-button {
        width: 45px;
        height: 45px;
        font-size: 20px;
        top: 15px;
        right: 15px;
    }
    
    #fullscreen-button {
        width: 45px;
        height: 45px;
        font-size: 20px;
        bottom: 15px;
        right: 15px;
    }
    
    #records-button {
        width: 45px;
        height: 45px;
        font-size: 20px;
        top: 15px;
    }
    
    #invite-button {
        width: 45px;
        height: 45px;
        font-size: 20px;
        top: 15px;
        left: calc(50% + 55px);
    }
    
    /* Peak Euphoria Ring - smaller on mobile */
    body.peak-euphoria::before {
        width: min(85vw, 85vh);
        height: min(85vw, 85vh);
        border-width: 3px;
    }
    
    /* Peak Euphoria Radial Pulse - adjusted for mobile */
    body.peak-euphoria::after {
        width: min(95vw, 95vh);
        height: min(95vw, 95vh);
    }
    
    /* Clock adjustments for mobile euphoria */
    #clock.peak-euphoria {
        font-size: clamp(42px, 10vw, 72px);
        letter-spacing: clamp(5px, 2vw, 10px);
    }
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(20px);
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.modal.active {
    display: flex;
    opacity: 1;
    pointer-events: all;
}

.modal-content {
    position: relative;
    background: rgba(20, 20, 30, 0.95);
    backdrop-filter: blur(30px);
    border: 2px solid rgba(100, 180, 255, 0.3);
    border-radius: 24px;
    padding: 40px;
    max-width: 500px;
    width: 90%;
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.5),
        0 0 60px rgba(100, 180, 255, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    animation: modal-enter 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    color: rgba(255, 255, 255, 0.9);
}

@keyframes modal-enter {
    0% {
        opacity: 0;
        transform: scale(0.8) translateY(30px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    font-size: 24px;
    line-height: 1;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 1);
    transform: rotate(90deg);
    border-color: rgba(255, 255, 255, 0.3);
}

.modal-content h2 {
    margin: 0 0 20px 0;
    font-size: 28px;
    font-weight: 600;
    color: rgba(100, 180, 255, 0.9);
    text-shadow: 0 0 20px rgba(100, 180, 255, 0.5);
    letter-spacing: 1px;
}

.modal-content p {
    margin: 0 0 16px 0;
    font-size: 16px;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.8);
    text-align: left;
}

.modal-content p:last-child {
    margin-bottom: 0;
}

.modal-content strong {
    color: rgba(100, 180, 255, 0.95);
    font-weight: 600;
}

.modal-content em {
    color: rgba(200, 200, 255, 0.9);
    font-style: italic;
}

/* Global Custom Scrollbar Styling */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(
        135deg,
        rgba(123, 47, 247, 0.5) 0%,
        rgba(100, 180, 255, 0.5) 100%
    );
    border-radius: 5px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(
        135deg,
        rgba(123, 47, 247, 0.7) 0%,
        rgba(100, 180, 255, 0.7) 100%
    );
    border: 1px solid rgba(255, 255, 255, 0.1);
}

::-webkit-scrollbar-corner {
    background: rgba(0, 0, 0, 0.2);
}

/* Modal-specific Scrollbar Styling */
.modal-content::-webkit-scrollbar,
.records-modal-content::-webkit-scrollbar,
div[style*="overflow-y: auto"]::-webkit-scrollbar {
    width: 8px;
}

.modal-content::-webkit-scrollbar-track,
.records-modal-content::-webkit-scrollbar-track,
div[style*="overflow-y: auto"]::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
    margin: 10px 0;
}

.modal-content::-webkit-scrollbar-thumb,
.records-modal-content::-webkit-scrollbar-thumb,
div[style*="overflow-y: auto"]::-webkit-scrollbar-thumb {
    background: linear-gradient(
        180deg,
        rgba(123, 47, 247, 0.6) 0%,
        rgba(100, 180, 255, 0.6) 100%
    );
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 10px rgba(123, 47, 247, 0.3);
}

.modal-content::-webkit-scrollbar-thumb:hover,
.records-modal-content::-webkit-scrollbar-thumb:hover,
div[style*="overflow-y: auto"]::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(
        180deg,
        rgba(123, 47, 247, 0.8) 0%,
        rgba(100, 180, 255, 0.8) 100%
    );
    box-shadow: 0 0 15px rgba(123, 47, 247, 0.5);
}

.modal-content::-webkit-scrollbar-thumb:active,
.records-modal-content::-webkit-scrollbar-thumb:active,
div[style*="overflow-y: auto"]::-webkit-scrollbar-thumb:active {
    background: linear-gradient(
        180deg,
        rgba(123, 47, 247, 1) 0%,
        rgba(100, 180, 255, 1) 100%
    );
}

/* Firefox Scrollbar Styling */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(123, 47, 247, 0.5) rgba(0, 0, 0, 0.2);
}

.modal-content,
.records-modal-content,
div[style*="overflow-y: auto"] {
    scrollbar-width: thin;
    scrollbar-color: rgba(123, 47, 247, 0.6) rgba(0, 0, 0, 0.3);
}

/* Smooth scrolling for all scrollable elements */
.modal-content,
.records-modal-content,
div[style*="overflow-y: auto"] {
    scroll-behavior: smooth;
}

/* Add subtle animation to scrollbar on hover */
@keyframes scrollbar-glow {
    0% { box-shadow: 0 0 10px rgba(123, 47, 247, 0.3); }
    50% { box-shadow: 0 0 20px rgba(123, 47, 247, 0.5), 0 0 30px rgba(100, 180, 255, 0.3); }
    100% { box-shadow: 0 0 10px rgba(123, 47, 247, 0.3); }
}

.modal-content:hover::-webkit-scrollbar-thumb,
.records-modal-content:hover::-webkit-scrollbar-thumb,
div[style*="overflow-y: auto"]:hover::-webkit-scrollbar-thumb {
    animation: scrollbar-glow 2s ease-in-out infinite;
}

/* Records modal specific styles */
.records-modal-content {
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    padding-right: 10px; /* Space for scrollbar */
}

#records-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 20px;
}

.records-loading {
    text-align: center;
    padding: 30px;
    color: rgba(255, 255, 255, 0.5);
    font-size: 16px;
}

.record-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: rgba(255, 215, 0, 0.08);
    border: 1px solid rgba(255, 215, 0, 0.2);
    border-radius: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: record-enter 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) backwards;
}

.record-item:hover {
    background: rgba(255, 215, 0, 0.15);
    border-color: rgba(255, 215, 0, 0.4);
    transform: translateX(5px);
    box-shadow: 
        0 4px 16px rgba(255, 215, 0, 0.2),
        0 0 20px rgba(255, 215, 0, 0.1);
}

@keyframes record-enter {
    0% {
        opacity: 0;
        transform: translateX(-20px);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

.record-item:nth-child(1) { animation-delay: 0.05s; }
.record-item:nth-child(2) { animation-delay: 0.10s; }
.record-item:nth-child(3) { animation-delay: 0.15s; }
.record-item:nth-child(4) { animation-delay: 0.20s; }
.record-item:nth-child(5) { animation-delay: 0.25s; }
.record-item:nth-child(6) { animation-delay: 0.30s; }
.record-item:nth-child(7) { animation-delay: 0.35s; }
.record-item:nth-child(8) { animation-delay: 0.40s; }
.record-item:nth-child(9) { animation-delay: 0.45s; }
.record-item:nth-child(10) { animation-delay: 0.50s; }

.record-rank {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-weight: 700;
    font-size: 16px;
    background: rgba(255, 215, 0, 0.2);
    color: rgba(255, 215, 0, 1);
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
    flex-shrink: 0;
}

.record-rank.top-3 {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.3), rgba(255, 165, 0, 0.3));
    font-size: 18px;
    width: 40px;
    height: 40px;
}

.record-info {
    flex: 1;
    margin: 0 20px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.record-date {
    font-size: 16px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    letter-spacing: 0.5px;
}

.record-time {
    font-size: 13px;
    color: rgba(255, 215, 0, 0.7);
    font-weight: 500;
}

.record-count {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 20px;
    font-weight: 700;
    color: rgba(255, 215, 0, 1);
    text-shadow: 0 0 15px rgba(255, 215, 0, 0.6);
    flex-shrink: 0;
}

.record-count-icon {
    font-size: 18px;
}

@media (max-width: 768px) {
    .records-modal-content {
        max-width: 95%;
        max-height: 85vh;
    }
    
    .record-item {
        padding: 12px 16px;
    }
    
    .record-rank {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
    
    .record-rank.top-3 {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }
    
    .record-info {
        margin: 0 12px;
    }
    
    .record-date {
        font-size: 14px;
    }
    
    .record-time {
        font-size: 12px;
    }
    
    .record-count {
        font-size: 18px;
    }
    
    .record-count-icon {
        font-size: 16px;
    }
}

@media (max-width: 768px) {
    .modal-content {
        padding: 30px 25px;
        max-width: 90%;
    }
    
    .modal-content h2 {
        font-size: 22px;
        margin-bottom: 15px;
    }
    
    .modal-content p {
        font-size: 14px;
        line-height: 1.5;
    }
}

/* Symmetrical hour effect - brighten everything! */
body.symmetrical-hour {
    filter: brightness(calc(1 + var(--symmetrical-brightness)));
}

body.symmetrical-hour #main-circle {
    border-width: 5px;
    box-shadow: 
        0 0 60px var(--circle-glow),
        0 0 120px var(--circle-glow),
        0 0 180px calc(var(--circle-glow) * 1.5),
        inset 0 0 60px var(--circle-glow),
        inset 0 0 100px rgba(255, 255, 255, 0.2);
    animation: symmetrical-pulse 2s ease-in-out infinite;
}

body.symmetrical-hour #visualizer {
    filter: brightness(calc(1.3 + var(--symmetrical-brightness)));
}

body.symmetrical-hour .electron {
    filter: brightness(calc(1.8 + var(--symmetrical-brightness))) drop-shadow(0 0 15px var(--electron-glow, var(--circle-glow)));
}

body.symmetrical-hour #countdown-ring {
    filter: brightness(calc(1.4 + var(--symmetrical-brightness)));
}

@keyframes symmetrical-pulse {
    0%, 100% {
        transform: scale(1) translate3d(0, 0, 0);
        box-shadow: 
            0 0 60px var(--circle-glow),
            0 0 120px var(--circle-glow),
            0 0 180px calc(var(--circle-glow) * 1.5),
            inset 0 0 60px var(--circle-glow),
            inset 0 0 100px rgba(255, 255, 255, 0.2);
    }
    50% {
        transform: scale(1.02) translate3d(0, 0, 0);
        box-shadow: 
            0 0 80px var(--circle-glow),
            0 0 160px var(--circle-glow),
            0 0 240px calc(var(--circle-glow) * 2),
            inset 0 0 80px var(--circle-glow),
            inset 0 0 120px rgba(255, 255, 255, 0.3);
    }
}

#visualizer {
    position: fixed;
    top: -150px; /* Further extend beyond viewport - increased for larger glows */
    left: -150px;
    width: calc(100% + 300px); /* Extra space for gradients - increased */
    height: calc(100% + 300px);
    z-index: 1;
    pointer-events: none;
}

#main-circle {
    position: relative;
    width: min(450px, 80vw);
    height: min(450px, 80vw);
    max-width: 450px;
    max-height: 450px;
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    background: radial-gradient(circle at center, 
                                rgba(255, 255, 255, 0.08) 0%,
                                rgba(255, 255, 255, 0.02) 50%, 
                                transparent 70%);
    border: 4px solid var(--primary-color);
    box-shadow: 
        0 0 40px var(--circle-glow),
        0 0 80px var(--circle-glow),
        0 0 120px calc(var(--circle-glow) * var(--glow-intensity)),
        inset 0 0 40px var(--circle-glow),
        inset 0 0 60px rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    animation: pulse 3s ease-in-out infinite;
    flex-shrink: 0;
    will-change: transform;
    transform: translate3d(0, 0, 0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    margin: auto;
    overflow: visible;
}

#countdown-ring {
    position: absolute;
    top: -6px;
    left: -6px;
    width: calc(100% + 12px);
    height: calc(100% + 12px);
    pointer-events: none;
    z-index: 5;
    transform: rotate(-90deg);
}

.countdown-track {
    fill: none;
    stroke: rgba(255, 255, 255, 0.05);
    stroke-width: 2;
}

.countdown-progress {
    fill: none;
    stroke: var(--primary-color);
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-dasharray: 597;
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 1s linear;
    filter: drop-shadow(0 0 8px var(--circle-glow));
    opacity: 0.8;
}

/* Volume control ring */
#volume-ring {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate3d(-50%, -50%, 0);
    width: min(540px, 90vw);  /* Zwiększone o 30px dla gradientów */
    height: min(540px, 90vw);
    z-index: 3;  /* POD główną tarczą (która ma z-index: 10) */
    pointer-events: none;  /* Wyłącz pointer events na całym kontenerze */
    user-select: none;
    -webkit-user-select: none;
    padding: 15px;  /* Dodane padding dla gradientów */
    box-sizing: border-box;
    mix-blend-mode: screen;  /* Additive blending for glow effect */
}

#volume-ring svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
    filter: drop-shadow(0 0 12px rgba(255, 255, 255, 0.2));  /* Zwiększony drop-shadow */
    pointer-events: none;  /* SVG nie reaguje */
    overflow: visible;  /* Pozwól gradientom wychodzić poza SVG */
}

.volume-track {
    fill: none;
    stroke: rgba(255, 255, 255, 0.08);
    stroke-width: 12;  /* Szerszy stroke dla łatwiejszego chwytania */
    transition: stroke 0.3s ease;
    pointer-events: stroke;  /* Tylko stroke (pierścień) reaguje */
    cursor: ns-resize;
}

#volume-ring:hover .volume-track {
    stroke: rgba(255, 255, 255, 0.15);
}

.volume-progress {
    fill: none;
    stroke: var(--secondary-color);
    stroke-width: 4;
    stroke-linecap: round;
    stroke-dasharray: 722.6;
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 0.1s ease-out, stroke 0.3s ease;
    filter: drop-shadow(0 0 10px var(--circle-glow)) drop-shadow(0 0 20px var(--circle-glow));
    opacity: 0.7;
    pointer-events: none;  /* Progress nie reaguje, tylko track */
}

#volume-ring:hover .volume-progress {
    opacity: 1;
    stroke-width: 5;
}

#volume-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -180px);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-color);
    opacity: 0;
    white-space: nowrap;
    text-shadow: 
        0 0 12px var(--circle-glow),
        0 0 20px var(--circle-glow);
    letter-spacing: 1px;
    pointer-events: none;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    padding: 6px 12px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    transition: opacity 0.3s ease;
}

#volume-ring:hover #volume-indicator,
#volume-ring.dragging #volume-indicator {
    opacity: 1;
}

#volume-percentage {
    font-size: 18px;
    font-weight: 700;
    color: var(--secondary-color);
}

/* Track Progress Ring */
#track-progress-ring {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate3d(-50%, -50%, 0);
    width: min(580px, 95vw);
    height: min(580px, 95vw);
    z-index: 2;  /* Pod volume ring (3) i pod główną tarczą (10) */
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
    padding: 20px;
    box-sizing: border-box;
}

#track-progress-ring svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
    filter: drop-shadow(0 0 8px rgba(123, 47, 247, 0.2));
    pointer-events: none;
    overflow: visible;
}

.track-progress-track {
    fill: none;
    stroke: rgba(123, 47, 247, 0.08);
    stroke-width: 3;
    transition: stroke 0.3s ease;
}

.track-progress-fill {
    fill: none;
    stroke: var(--secondary-color);
    stroke-width: 3;
    stroke-linecap: round;
    stroke-dasharray: 848.23;  /* 2 * PI * 135 */
    stroke-dashoffset: 848.23;  /* Start empty */
    transition: stroke-dashoffset 0.3s linear;
    filter: drop-shadow(0 0 6px var(--circle-glow)) drop-shadow(0 0 12px var(--circle-glow));
    opacity: 0.6;
}

#countdown-timer {
    position: absolute;
    top: -42px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-color);
    opacity: 0.85;
    letter-spacing: 1.5px;
    text-shadow: 
        0 0 15px var(--circle-glow),
        0 0 25px var(--circle-glow),
        0 2px 4px rgba(0, 0, 0, 0.5);
    pointer-events: none;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(15px);
    padding: 6px 16px;
    border-radius: 16px;
    border: 1.5px solid rgba(255, 255, 255, 0.2);
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.4),
        0 0 20px var(--circle-glow),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    animation: countdown-pulse 2s ease-in-out infinite;
}

@keyframes countdown-pulse {
    0%, 100% {
        opacity: 0.8;
        transform: translateX(-50%) scale(1);
    }
    50% {
        opacity: 1;
        transform: translateX(-50%) scale(1.02);
    }
}

#main-circle::before {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    padding: 4px;
    background: linear-gradient(45deg, 
        var(--primary-color), 
        var(--secondary-color), 
        var(--primary-color));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, 
                  linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: -1;
}

#main-circle:hover::before {
    opacity: 0.6;
    animation: rotate-border 3s linear infinite;
}

#main-circle:hover {
    transform: scale(1.08);
    box-shadow: 
        0 0 60px var(--circle-glow),
        0 0 100px var(--circle-glow),
        0 0 140px calc(var(--circle-glow) * var(--glow-intensity)),
        inset 0 0 50px var(--circle-glow);
}

#main-circle.playing {
    animation: pulse 3s ease-in-out infinite;
    --glow-intensity: 1.2;
}

#main-circle.playing::after {
    content: '';
    position: absolute;
    inset: -8px;
    border-radius: 50%;
    background: conic-gradient(
        from 0deg,
        transparent 0deg,
        var(--primary-color) 90deg,
        transparent 180deg,
        var(--secondary-color) 270deg,
        transparent 360deg
    );
    opacity: 0.3;
    animation: rotate 8s linear infinite;
    z-index: -2;
    filter: blur(20px);
}

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

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

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

#clock {
    font-size: clamp(40px, 8vw, 72px);
    font-weight: 200;
    letter-spacing: clamp(4px, 1.5vw, 8px);
    color: var(--text-color);
    text-shadow: 
        0 0 20px var(--circle-glow),
        0 0 40px var(--circle-glow),
        0 0 60px calc(var(--circle-glow) * 0.5);
    font-variant-numeric: tabular-nums;
    position: relative;
    z-index: 100;
    pointer-events: none;
    transform: rotate(0deg) !important;
    will-change: contents;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Frozen symmetrical clock styling - matches UI color */
#clock.symmetrical-frozen {
    font-weight: 700;
    font-size: clamp(48px, 9vw, 84px);
    letter-spacing: clamp(6px, 2vw, 12px);
    color: var(--primary-color);  /* Use current theme color! */
    text-shadow: 
        0 0 30px var(--primary-color),
        0 0 60px var(--primary-color),
        0 0 90px var(--circle-glow),
        0 0 120px calc(var(--circle-glow) * 0.8),
        0 4px 20px rgba(0, 0, 0, 0.8);
    animation: symmetrical-clock-pulse 2s ease-in-out infinite;
    filter: brightness(1.5) saturate(1.3);
}

@keyframes symmetrical-clock-pulse {
    0%, 100% {
        transform: scale(1) rotate(0deg);
        filter: brightness(1.5) saturate(1.3);
    }
    50% {
        transform: scale(1.05) rotate(0deg);
        filter: brightness(1.8) saturate(1.5);
    }
}

/* PEAK EUPHORIA - The exact HH:HH moment! */
#clock.peak-euphoria {
    font-weight: 900;
    font-size: clamp(56px, 11vw, 96px);
    letter-spacing: clamp(8px, 2.5vw, 16px);
    text-shadow: 
        0 0 40px var(--primary-color),
        0 0 80px var(--primary-color),
        0 0 120px var(--circle-glow),
        0 0 160px calc(var(--circle-glow) * 0.9),
        0 0 200px calc(var(--circle-glow) * 0.5),
        0 6px 30px rgba(0, 0, 0, 0.9);
    animation: peak-euphoria-pulse 1.5s ease-in-out infinite;
    filter: brightness(2.2) saturate(1.8);
}

@keyframes peak-euphoria-pulse {
    0%, 100% {
        transform: scale(1) rotate(0deg);
        filter: brightness(2.2) saturate(1.8);
    }
    50% {
        transform: scale(1.12) rotate(0deg);
        filter: brightness(2.8) saturate(2.2);
    }
}

/* Peak Euphoria Ring - fills during the magic minute */
body.peak-euphoria::before {
    content: '';
    position: fixed;
    top: 50%;
    left: 50%;
    width: min(70vw, 70vh);
    height: min(70vw, 70vh);
    transform: translate(-50%, -50%);
    border-radius: 50%;
    border: 4px solid transparent;
    border-top-color: var(--primary-color);
    border-right-color: var(--primary-color);
    opacity: 0;
    z-index: 2;
    pointer-events: none;
    /* Use dynamic duration set by JavaScript based on remaining seconds */
    animation: 
        euphoria-ring-fade-in 1s ease-out forwards,
        euphoria-ring-fill var(--euphoria-duration, 60s) linear 1s 1,
        euphoria-ring-glow 2s ease-in-out 1s infinite;
    box-shadow: 
        0 0 30px var(--primary-color),
        0 0 60px var(--circle-glow),
        inset 0 0 30px var(--circle-glow);
    will-change: transform, opacity; /* Optimize animation performance */
}

@keyframes euphoria-ring-fade-in {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }
    100% {
        opacity: 0.6;
        transform: translate(-50%, -50%) scale(1);
    }
}

@keyframes euphoria-ring-fill {
    0% {
        transform: translate(-50%, -50%) rotate(0deg);
        border-right-color: transparent;
        border-bottom-color: transparent;
        border-left-color: transparent;
    }
    25% {
        border-right-color: var(--primary-color);
        border-bottom-color: transparent;
        border-left-color: transparent;
    }
    50% {
        border-right-color: var(--primary-color);
        border-bottom-color: var(--primary-color);
        border-left-color: transparent;
    }
    75% {
        border-right-color: var(--primary-color);
        border-bottom-color: var(--primary-color);
        border-left-color: var(--primary-color);
    }
    100% {
        transform: translate(-50%, -50%) rotate(360deg);
        border-right-color: var(--primary-color);
        border-bottom-color: var(--primary-color);
        border-left-color: var(--primary-color);
    }
}

@keyframes euphoria-ring-glow {
    0%, 100% {
        opacity: 0.5;
        filter: brightness(1.2);
    }
    50% {
        opacity: 0.8;
        filter: brightness(1.8);
    }
}

/* Peak Euphoria - Radial pulse effect */
body.peak-euphoria::after {
    content: '';
    position: fixed;
    top: 50%;
    left: 50%;
    width: min(90vw, 90vh);
    height: min(90vw, 90vh);
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: radial-gradient(
        circle,
        transparent 30%,
        var(--circle-glow) 70%,
        transparent 100%
    );
    opacity: 0;
    z-index: 1;
    pointer-events: none;
    animation: 
        euphoria-radial-fade-in 1s ease-out forwards,
        euphoria-radial-pulse 2s ease-out 1s infinite;
    will-change: transform, opacity; /* Optimize animation performance */
}

@keyframes euphoria-radial-fade-in {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.6);
    }
    100% {
        opacity: 0.15;
        transform: translate(-50%, -50%) scale(0.8);
    }
}

@keyframes euphoria-radial-pulse {
    0% {
        transform: translate(-50%, -50%) scale(0.8);
        opacity: 0;
    }
    50% {
        opacity: 0.15;
    }
    100% {
        transform: translate(-50%, -50%) scale(1.3);
        opacity: 0;
    }
}

/* Peak Euphoria - Enhanced particles/electrons */
body.peak-euphoria .electron {
    animation: 
        electron-pulse 0.6s ease-in-out infinite,
        electron-glow 0.6s ease-in-out infinite,
        euphoria-electron-boost 1.5s ease-in-out infinite;
}

@keyframes euphoria-electron-boost {
    0%, 100% {
        filter: brightness(1.5) saturate(1.3);
    }
    50% {
        filter: brightness(2.5) saturate(2);
        transform: scale(1.4);
    }
}

/* Peak Euphoria - Main circle extra glow */
body.peak-euphoria #main-circle {
    box-shadow: 
        0 0 100px var(--circle-glow),
        0 0 150px var(--circle-glow),
        0 0 200px calc(var(--circle-glow) * 0.6),
        inset 0 0 60px var(--circle-glow);
    filter: brightness(1.4);
}

/* Peak Euphoria - Countdown timer highlight */
body.peak-euphoria #countdown-timer {
    background: linear-gradient(
        135deg,
        rgba(var(--primary-color-rgb), 0.35),
        rgba(var(--primary-color-rgb), 0.15)
    );
    border-color: var(--primary-color);
    box-shadow: 
        0 4px 20px rgba(var(--primary-color-rgb), 0.5),
        0 0 40px var(--circle-glow);
    animation: countdown-pulse 1s ease-in-out infinite, euphoria-countdown-glow 1.5s ease-in-out infinite;
}

@keyframes euphoria-countdown-glow {
    0%, 100% {
        transform: translateX(-50%) scale(1);
        filter: brightness(1.3);
    }
    50% {
        transform: translateX(-50%) scale(1.08);
        filter: brightness(1.8);
    }
}

#user-count {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 11px;
    font-weight: 400;
    color: var(--text-color);
    opacity: 0.4;
    z-index: 100;
    text-shadow: 0 0 8px var(--circle-glow);
    letter-spacing: 2px;
    text-transform: lowercase;
    transition: opacity 0.3s ease;
    padding: 6px 16px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(10px);
}

#user-count:hover {
    opacity: 0.7;
}

/* Start hint - subtle prompt to click */
#start-hint {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, calc(-50% + 180px));
    z-index: 150;
    font-size: 13px;
    font-weight: 300;
    color: var(--text-color);
    opacity: 0.6;
    text-shadow: 0 0 12px var(--circle-glow);
    letter-spacing: 3px;
    text-transform: lowercase;
    padding: 10px 24px;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.04);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    animation: hint-pulse 3s ease-in-out infinite;
    pointer-events: all;  /* Make it clickable/touchable */
    cursor: pointer;
    transition: opacity 0.8s ease, transform 0.8s ease;
    -webkit-tap-highlight-color: rgba(255, 255, 255, 0.1);
}

#start-hint.hidden {
    opacity: 0;
    transform: translate(-50%, calc(-50% + 200px));
    pointer-events: none;
}

@keyframes hint-pulse {
    0%, 100% {
        opacity: 0.4;
        text-shadow: 0 0 8px var(--circle-glow);
    }
    50% {
        opacity: 0.7;
        text-shadow: 0 0 16px var(--circle-glow);
    }
}

/* Chat module */
#chat-container {
    position: fixed;
    bottom: 70px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    width: min(400px, 90vw);
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: none;
    height: auto;
    max-height: 300px;
}

#chat-messages {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    width: 100%;
    pointer-events: none;
    position: relative;
    margin-bottom: 10px;
}

.chat-message {
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(20px);
    padding: 10px 24px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 300;
    color: rgba(255, 255, 255, 0.85);
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.06);
    word-wrap: break-word;
    overflow: hidden;
    line-height: 1.6;
    letter-spacing: 0.5px;
    max-width: 100%;
    pointer-events: none;
    position: relative;
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Nowa wiadomość - pojawia się od dołu, pełen rozmiar */
.chat-message.newest {
    opacity: 1;
    transform: scale(1) translateY(0);
}

/* Stare wiadomości - zmniejszają się i przesuwają do góry */
.chat-message.position-1 {
    transform: scale(0.92) translateY(0);
    opacity: 0.85;
}

.chat-message.position-2 {
    transform: scale(0.84) translateY(0);
    opacity: 0.7;
}

.chat-message.position-3 {
    transform: scale(0.76) translateY(0);
    opacity: 0.55;
}

.chat-message.position-4 {
    transform: scale(0.68) translateY(0);
    opacity: 0.4;
}

/* Wiadomość do usunięcia - zanika */
.chat-message.removing {
    animation: message-fade-out 0.6s ease-out forwards;
}

/* Wiadomość pojawia się od dołu */
@keyframes message-enter {
    0% {
        opacity: 0;
        transform: scale(0.8) translateY(30px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Wiadomość zanika */
@keyframes message-fade-out {
    0% {
        opacity: 1;
        transform: scale(0.68) translateY(0);
    }
    100% {
        opacity: 0;
        transform: scale(0.5) translateY(-20px);
    }
}

/* Backwards compatibility - ukryj stary #chat-display jeśli istnieje */
#chat-display {
    display: none;
}

.notification-toggle {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    border-radius: 50%;
    flex-shrink: 0;
    width: 34px;
    height: 34px;
}

.notification-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 1);
    transform: scale(1.1);
}

.notification-toggle.muted {
    color: rgba(255, 100, 100, 0.6);
}

.notification-toggle.muted:hover {
    color: rgba(255, 100, 100, 1);
    background: rgba(255, 100, 100, 0.1);
}

#chat-input-container {
    display: flex;
    gap: 8px;
    align-items: center;
    opacity: 0.7;
    transition: opacity 0.3s ease;
    pointer-events: all;  /* Enable interaction with input */
}

#chat-input-container:hover,
#chat-input-container:focus-within {
    opacity: 1;
}

#chat-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    padding: 10px 16px;
    font-size: 12px;
    color: var(--text-color);
    outline: none;
    transition: all 0.3s ease;
}

#chat-input::placeholder {
    color: var(--text-color);
    opacity: 0.4;
}

#chat-input:focus {
    background: rgba(255, 255, 255, 0.12);
    border-color: var(--primary-color);
    box-shadow: 0 0 15px var(--circle-glow);
}

#chat-send {
    background: var(--primary-color);
    border: none;
    border-radius: 20px;
    padding: 10px 20px;
    font-size: 12px;
    font-weight: 600;
    /* Dynamic text color: dark for light backgrounds, light for dark backgrounds */
    color: rgba(0, 0, 0, 0.85);
    text-shadow: 0 0 1px rgba(255, 255, 255, 0.3);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 0 15px var(--circle-glow);
}

#chat-send:hover {
    transform: scale(1.05);
    box-shadow: 0 0 25px var(--circle-glow);
    color: rgba(0, 0, 0, 0.95);
}

#chat-send:active {
    transform: scale(0.95);
}

#electrons-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate3d(-50%, -50%, 0);
    width: min(650px, 90vw);
    height: min(650px, 90vw);
    max-width: 650px;
    max-height: 650px;
    aspect-ratio: 1 / 1;
    z-index: 5;
    pointer-events: none;
    will-change: transform;
}

.electron {
    position: absolute;
    width: 26px;  /* Increased from 22px for better visibility */
    height: 26px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, 
        rgba(255, 255, 255, 1),  /* Bright white core */
        var(--electron-color, var(--primary-color)) 30%,
        var(--electron-color, var(--secondary-color)));
    box-shadow: 
        0 0 25px var(--electron-glow, var(--circle-glow)),  /* Stronger glow */
        0 0 40px var(--electron-glow, var(--circle-glow)),
        0 0 60px var(--electron-glow, var(--circle-glow)),  /* Extra outer glow */
        0 0 10px rgba(255, 255, 255, 0.9),
        inset 0 0 12px rgba(255, 255, 255, 0.8);  /* Brighter inner glow */
    top: 50%;
    left: 50%;
    margin: -13px 0 0 -13px;  /* Adjusted for new size */
    opacity: 0;
    animation: electron-pulse 2.5s ease-in-out infinite;
    z-index: 50;  /* Increased - elektrony nad tarczą */
    filter: brightness(1.7) drop-shadow(0 0 10px var(--electron-glow, var(--circle-glow)));  /* Increased brightness */
    will-change: transform, opacity;
    transform: translate3d(0, 0, 0) scale(0);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);  /* Quick but smooth transition for radius changes */
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

.electron::before {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--electron-glow, var(--circle-glow)) 0%, transparent 70%);
    opacity: 0.6;
    z-index: -1;
    animation: electron-aura 2s ease-in-out infinite;
}

.electron::after {
    content: '';
    position: absolute;
    top: -6px;
    left: -6px;
    right: -6px;
    bottom: -6px;
    border-radius: 50%;
    background: radial-gradient(circle, transparent 40%, var(--electron-color, var(--primary-color)) 70%, transparent 100%);
    opacity: 0.25;
    z-index: -2;
    animation: electron-aura 2s ease-in-out infinite 1s;
}

/* Label "You" on user's electron */
.electron-label {
    position: absolute;
    top: -32px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 11px;
    font-weight: 700;
    color: var(--text-color);
    opacity: 0;  /* Start hidden */
    white-space: nowrap;
    text-shadow: 
        0 0 15px var(--circle-glow),
        0 0 25px var(--circle-glow),
        0 0 35px var(--circle-glow),
        0 2px 4px rgba(0, 0, 0, 0.9);
    letter-spacing: 2px;
    pointer-events: none;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(12px);
    padding: 4px 10px;
    border-radius: 10px;
    border: 1.5px solid var(--primary-color);
    box-shadow: 
        0 0 15px var(--circle-glow),
        0 0 25px var(--circle-glow);
    z-index: 100;  /* ZAWSZE NA WIERZCHU - nad wszystkim! */
    animation: label-fade-in 1.5s ease-out 0.8s forwards, label-pulse 2s ease-in-out infinite 2.5s;
}

@keyframes label-fade-in {
    0% {
        opacity: 0;
        transform: translateX(-50%) translateY(5px);
    }
    100% {
        opacity: 0.9;
        transform: translateX(-50%) translateY(0);
    }
}

@keyframes label-pulse {
    0%, 100% {
        opacity: 0.85;
        text-shadow: 
            0 0 10px var(--circle-glow),
            0 0 20px var(--circle-glow),
            0 1px 3px rgba(0, 0, 0, 0.8);
    }
    50% {
        opacity: 1;
        text-shadow: 
            0 0 15px var(--circle-glow),
            0 0 25px var(--circle-glow),
            0 1px 3px rgba(0, 0, 0, 0.8);
    }
}

/* Animacja pojawienia się elektronu - subtelna */
.electron.entering {
    animation: electron-enter 1s ease-out forwards,
               electron-pulse 2.5s ease-in-out infinite 1s;
}

/* Elektron aktywny (po zakończeniu entering animation) */
.electron.active {
    opacity: 1;
    animation: electron-pulse 2.5s ease-in-out infinite;
    /* Transform is now handled by JavaScript animateElectrons() */
}

/* Animacja znikania elektronu */
.electron.leaving {
    animation: electron-leave 1s cubic-bezier(0.55, 0.085, 0.68, 0.53) forwards;
}

/* Keyframe dla wlatywania elektronu - przylot z daleka do orbity */
@keyframes electron-enter {
    0% {
        opacity: 0;
        /* Elektron startuje daleko (JavaScript ustawi pozycję) */
    }
    60% {
        opacity: 1;
    }
    100% {
        opacity: 1;
        /* Elektron dolatuje do orbity (JavaScript ustawi pozycję) */
    }
}

/* Keyframe dla odlatywania elektronu - z orbity w dal */
@keyframes electron-leave {
    0% {
        opacity: 1;
        /* Elektron startuje na orbicie (JavaScript kontroluje) */
    }
    30% {
        opacity: 0.8;
    }
    100% {
        opacity: 0;
        /* Elektron odlatuje daleko (JavaScript kontroluje) */
    }
}

.electron::before {
    content: '';
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    background: radial-gradient(circle at center, 
        var(--electron-glow, var(--circle-glow)) 0%, 
        transparent 60%);
    opacity: 0.5;
    animation: electron-glow 2s ease-in-out infinite;
}

.electron::after {
    content: '';
    position: absolute;
    inset: -12px;
    border-radius: 50%;
    background: radial-gradient(circle at center, 
        var(--electron-color, var(--primary-color)) 0%, 
        transparent 50%);
    opacity: 0.3;
    animation: electron-glow 2s ease-in-out infinite reverse;
}

@keyframes electron-pulse {
    0%, 100% {
        filter: brightness(1.5) drop-shadow(0 0 8px var(--electron-glow, var(--circle-glow)));
        /* Don't use transform here - it will override JavaScript translate */
    }
    50% {
        filter: brightness(2.0) drop-shadow(0 0 15px var(--electron-glow, var(--circle-glow)));
        /* Don't use transform here - it will override JavaScript translate */
    }
}

@keyframes electron-glow {
    0%, 100% {
        opacity: 0.4;
        /* Don't use transform here - it will override JavaScript translate */
    }
    50% {
        opacity: 0.7;
        /* Don't use transform here - it will override JavaScript translate */
    }
}

audio {
    display: none;
}

/* Responsive */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    #main-circle {
        width: min(350px, 85vw);
        height: min(350px, 85vw);
        max-width: 350px;
        max-height: 350px;
    }
    
    #volume-ring {
        width: min(420px, 92vw);  /* Zwiększone dla mobile */
        height: min(420px, 92vw);
        padding: 10px;  /* Mniejszy padding na mobile */
    }
    
    #track-progress-ring {
        width: min(460px, 96vw);
        height: min(460px, 96vw);
        padding: 15px;
    }
    
    #volume-indicator {
        font-size: 12px;
        transform: translate(-50%, -150px);
    }
    
    #volume-percentage {
        font-size: 16px;
    }
    
    #countdown-timer {
        font-size: 12px;
        top: -38px;
        padding: 5px 14px;
        letter-spacing: 1.2px;
        font-weight: 600;
        opacity: 0.9;
    }
    
    #user-count {
        font-size: 10px;
        bottom: 20px;
        padding: 5px 12px;
    }
    
    #chat-container {
        bottom: 60px;
        width: min(350px, 92vw);
    }
    
    #chat-display {
        font-size: 12px;
        padding: 10px 18px;
    }
    
    #chat-input {
        font-size: 11px;
        padding: 8px 14px;
    }
    
    #chat-send {
        font-size: 11px;
        padding: 8px 16px;
    }
    
    #electrons-container {
        width: min(500px, 95vw);
        height: min(500px, 95vw);
    }
    
    .electron {
        width: 24px;  /* Increased from 20px */
        height: 24px;
        margin: -12px 0 0 -12px;
    }
    
    .electron-label {
        font-size: 10px;
        top: -30px;
        padding: 3px 8px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 8px;
    }
    
    #main-circle {
        width: min(280px, 80vw);
        height: min(280px, 80vw);
        max-width: 280px;
        max-height: 280px;
        border-width: 3px;
    }
    
    #countdown-timer {
        font-size: 9px;
        top: -28px;
        padding: 3px 8px;
    }
    
    #user-count {
        font-size: 9px;
        bottom: 15px;
        padding: 4px 10px;
    }
    
    #chat-container {
        bottom: 50px;
        width: min(300px, 95vw);
    }
    
    #chat-display {
        font-size: 11px;
        padding: 9px 16px;
    }
    
    #chat-input {
        font-size: 10px;
        padding: 7px 12px;
    }
    
    #chat-send {
        font-size: 10px;
        padding: 7px 14px;
    }
    
    #electrons-container {
        width: min(400px, 90vw);
        height: min(400px, 90vw);
    }
    
    .electron {
        width: 22px;  /* Increased from 18px */
        height: 22px;
        margin: -11px 0 0 -11px;
    }
    
    .electron-label {
        font-size: 9px;
        top: -28px;
        padding: 3px 7px;
    }
}

@media (max-width: 360px) {
    body {
        padding: 5px;
    }
    
    #main-circle {
        width: min(240px, 75vw);
        height: min(240px, 75vw);
        max-width: 240px;
        max-height: 240px;
    }
    
    #electrons-container {
        width: min(340px, 85vw);
        height: min(340px, 85vw);
    }
}

@media (min-width: 1920px) {
    #main-circle {
        width: min(550px, 80vw);
        height: min(550px, 80vw);
    }
    
    #electrons-container {
        width: min(750px, 90vw);
        height: min(750px, 90vw);
    }
}

/* Color themes based on time of day - Extended 12 theme palette */

/* Early Morning (4-6) - Deep Purple to Blue */
body.early-morning {
    --primary-color: #667EEA;
    --secondary-color: #764BA2;
    --circle-glow: rgba(102, 126, 234, 0.6);
    --text-color: #E6E9FF;
    background-color: #0a0616;
    background-image: radial-gradient(circle at 30% 20%, rgba(102, 126, 234, 0.12) 0%, transparent 50%);
}

/* Dawn (6-8) - Pink to Orange */
body.dawn {
    --primary-color: #FF6B9D;
    --secondary-color: #FF8E53;
    --circle-glow: rgba(255, 107, 157, 0.6);
    --text-color: #FFF5E1;
    background-color: #1a0a14;
    background-image: radial-gradient(circle at 30% 20%, rgba(255, 107, 157, 0.15) 0%, transparent 50%);
}

/* Morning (8-10) - Warm Orange to Yellow */
body.morning {
    --primary-color: #FFA07A;
    --secondary-color: #FFD93D;
    --circle-glow: rgba(255, 160, 122, 0.6);
    --text-color: #FFF8E7;
    background-color: #140a06;
    background-image: radial-gradient(circle at 40% 25%, rgba(255, 160, 122, 0.12) 0%, transparent 50%);
}

/* Late Morning (10-12) - Golden Yellow */
body.late-morning {
    --primary-color: #FFD700;
    --secondary-color: #FFB347;
    --circle-glow: rgba(255, 215, 0, 0.6);
    --text-color: #FFF8DC;
    background-color: #0f0a06;
    background-image: radial-gradient(circle at 50% 30%, rgba(255, 215, 0, 0.12) 0%, transparent 50%);
}

/* Noon/Early Afternoon (12-14) - Bright Yellow to Amber */
body.noon {
    --primary-color: #FFB347;
    --secondary-color: #FF9E00;
    --circle-glow: rgba(255, 179, 71, 0.65);
    --text-color: #FFFAED;
    background-color: #100904;
    background-image: radial-gradient(circle at 50% 35%, rgba(255, 179, 71, 0.1) 0%, transparent 50%);
}

/* Afternoon (14-16) - Amber to Orange */
body.afternoon {
    --primary-color: #FF9E00;
    --secondary-color: #FF7F50;
    --circle-glow: rgba(255, 158, 0, 0.6);
    --text-color: #FFF5E6;
    background-color: #140905;
    background-image: radial-gradient(circle at 60% 40%, rgba(255, 158, 0, 0.11) 0%, transparent 50%);
}

/* Late Afternoon (16-18) - Orange to Red-Orange */
body.late-afternoon {
    --primary-color: #FF7F50;
    --secondary-color: #E74C3C;
    --circle-glow: rgba(255, 127, 80, 0.65);
    --text-color: #FFE6E0;
    background-color: #0f0706;
    background-image: radial-gradient(circle at 65% 45%, rgba(255, 127, 80, 0.13) 0%, transparent 50%);
}

/* Dusk/Golden Hour (18-19) - Red-Orange to Purple */
body.dusk {
    --primary-color: #E74C3C;
    --secondary-color: #C06C84;
    --circle-glow: rgba(231, 76, 60, 0.6);
    --text-color: #FFE5E5;
    background-color: #120607;
    background-image: radial-gradient(circle at 70% 50%, rgba(231, 76, 60, 0.14) 0%, transparent 50%);
}

/* Evening (19-21) - Purple to Magenta */
body.evening {
    --primary-color: #9B59B6;
    --secondary-color: #C06C84;
    --circle-glow: rgba(155, 89, 182, 0.6);
    --text-color: #F0E6FF;
    background-color: #0a0514;
    background-image: radial-gradient(circle at 60% 40%, rgba(155, 89, 182, 0.15) 0%, transparent 50%);
}

/* Late Evening (21-22) - Deep Purple to Blue */
body.late-evening {
    --primary-color: #6C5CE7;
    --secondary-color: #4834D4;
    --circle-glow: rgba(108, 92, 231, 0.6);
    --text-color: #E8E4FF;
    background-color: #050312;
    background-image: radial-gradient(circle at 50% 50%, rgba(108, 92, 231, 0.12) 0%, transparent 50%);
}

/* Night (22-24) - Blue to Teal */
body.night {
    --primary-color: #4ECDC4;
    --secondary-color: #3A7BD5;
    --circle-glow: rgba(78, 205, 196, 0.6);
    --text-color: #E0F7FA;
    background-color: #000814;
    background-image: radial-gradient(circle at 40% 60%, rgba(78, 205, 196, 0.1) 0%, transparent 50%);
}

/* Deep Night (0-4) - Dark Blue to Indigo */
body.deep-night {
    --primary-color: #3A7BD5;
    --secondary-color: #00D2FF;
    --circle-glow: rgba(58, 123, 213, 0.6);
    --text-color: #E1F5FE;
    background-color: #000510;
    background-image: radial-gradient(circle at 35% 55%, rgba(58, 123, 213, 0.08) 0%, transparent 50%);
}

/* Legacy day theme for compatibility */
body.day {
    --primary-color: #FFB347;
    --secondary-color: #FF9E00;
    --circle-glow: rgba(255, 179, 71, 0.65);
    --text-color: #FFFAED;
    background-color: #100904;
    background-image: radial-gradient(circle at 50% 35%, rgba(255, 179, 71, 0.1) 0%, transparent 50%);
}

