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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #2ECC71 0%, #ECF0F1 35%, #E74C3C 65%, #27AE60 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #2C3E50;
    overflow-x: hidden;
    overflow-y: auto;
    position: relative;
}

/* Snow Effect */
.snowflake {
    position: fixed;
    top: -50px;
    color: white;
    font-size: 1em;
    pointer-events: none;
    z-index: 9999;
    animation: fall linear infinite, fadeOut 1s ease-out forwards;
    animation-delay: 0s, calc(var(--duration) - 1s);
    opacity: 0.8;
    filter: blur(1px);
    text-shadow: 0 0 3px rgba(255, 255, 255, 0.8);
    will-change: transform, opacity;
    transform: translateZ(0);
    backface-visibility: hidden;
}

@keyframes fall {
    0% {
        transform: translate3d(0, 0, 0);
    }
    100% {
        transform: translate3d(0, 110vh, 0);
    }
}

@keyframes fadeOut {
    to {
        opacity: 0;
    }
}

.container {
    text-align: center;
    padding: 1.5rem;
    max-width: 800px;
    width: 100%;
    position: relative;
    z-index: 10;
}

.header {
    margin-bottom: 1.5rem;
}

h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    color: #2C3E50;
}

.countdown {
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 1rem;
    margin: 0 auto;
    max-width: 400px;
}

.countdown-label {
    font-size: 0.9rem;
    opacity: 0.95;
    margin-bottom: 0.5rem;
    color: #2C3E50;
}

.countdown-timer {
    font-size: 1.8rem;
    font-weight: bold;
    font-family: 'Courier New', monospace;
    color: #2C3E50;
}

.countdown-timer.urgent {
    color: #ff6b6b;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.stats {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.stats-row-2 {
    display: contents;
}

.stat-box {
    background: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 1.5rem;
    min-width: 160px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
    color: #2C3E50;
}

.stat-box.personal {
    background: rgba(255, 215, 0, 0.4);
    border: 2px solid rgba(255, 215, 0, 0.7);
}

.stat-value {
    font-size: 2.5rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
    color: #2C3E50;
}

.stat-label {
    font-size: 0.9rem;
    opacity: 0.9;
    color: #2C3E50;
}

.stat-sublabel {
    font-size: 0.85rem;
    opacity: 0.8;
    margin-top: 0.3rem;
    color: #2C3E50;
}

.instructions {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
    color: #2C3E50;
}

.instructions p {
    margin: 0.3rem 0;
}

.santa-container {
    position: relative;
    margin: 2rem 0;
    display: inline-block;
}

.hold-indicator {
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 200px;
    height: 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    overflow: hidden;
    opacity: 0;
    transition: opacity 0.3s;
}

.hold-indicator.active {
    opacity: 1;
}

.hold-progress {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, #ffd700, #ffed4e);
    border-radius: 10px;
    will-change: transform;
    transform: scaleX(0);
    transform-origin: left;
}

.santa-button {
    background: none;
    border: none;
    cursor: pointer;
    position: relative;
    z-index: 10;
    touch-action: none;
    -webkit-tap-highlight-color: transparent;
}

.santa-button:active {
    transform: scale(0.98);
}

.santa {
    font-size: 12rem;
    filter: drop-shadow(0 10px 20px rgba(0,0,0,0.3));
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
}

.santa-button.holding .santa {
    animation: wiggle 0.3s ease-in-out infinite;
}

@keyframes wiggle {
    0%, 100% { transform: rotate(-2deg); }
    50% { transform: rotate(2deg); }
}

.hold-effect {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.sparkle {
    position: absolute;
    font-size: 1.5rem;
    animation: sparkle 1.5s ease-out forwards;
}

@keyframes sparkle {
    0% {
        opacity: 1;
        transform: translate(0, 0) scale(0.5);
    }
    100% {
        opacity: 0;
        transform: translate(var(--tx), var(--ty)) scale(1);
    }
}

.leaderboard {
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 1.5rem;
    margin-top: 2rem;
}

.leaderboard h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: #2C3E50;
}

.leaderboard-list {
    overflow-y: visible;
    overflow-x: hidden;
}

.leaderboard-entry {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem;
    margin: 0.5rem 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    transition: transform 0.2s;
    color: #2C3E50;
}

.leaderboard-entry:hover {
    transform: translateX(5px);
}

.leaderboard-entry.me {
    background: rgba(255, 215, 0, 0.4);
    border: 2px solid rgba(255, 215, 0, 0.6);
}

.leaderboard-entry.top3 {
    background: rgba(255, 215, 0, 0.3);
}

.entry-rank {
    font-size: 1.2rem;
    font-weight: bold;
    min-width: 40px;
    color: #2C3E50;
}

.entry-player {
    flex: 1;
    text-align: left;
    margin: 0 1rem;
    color: #2C3E50;
}

.entry-score {
    font-size: 1.1rem;
    font-weight: bold;
    color: #2C3E50;
}

.loading {
    padding: 2rem;
    opacity: 0.8;
    color: #2C3E50;
}

.connection-status {
    margin-top: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    opacity: 0.9;
    color: #2C3E50;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #ff4444;
}

.status-dot.connected {
    background: #44ff44;
    box-shadow: 0 0 10px #44ff44;
}

.game-over-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.game-over-modal.show,
.username-modal.show {
    display: flex;
}

.username-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    z-index: 2000;
    justify-content: center;
    align-items: center;
}

.modal-content {
    position: relative;
    background: linear-gradient(135deg, #2ECC71 0%, #E74C3C 100%);
    padding: 3rem;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    border: 3px solid rgba(255, 255, 255, 0.5);
    max-width: 500px;
    width: 90%;
}

.modal-content h2 {
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
    color: #2C3E50;
}

.modal-content p {
    margin: 1rem 0;
    color: #2C3E50;
}

.modal-content p {
    margin: 1rem 0;
}

.username-input {
    width: 100%;
    padding: 1rem;
    font-size: 1.2rem;
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    text-align: center;
    margin: 1rem 0;
}

.username-input:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.8);
    background: rgba(255, 255, 255, 0.25);
}

.username-input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.username-button {
    width: 100%;
    padding: 1rem 2rem;
    font-size: 1.2rem;
    font-weight: bold;
    background: white;
    color: #27AE60;
    border: 2px solid #27AE60;
    border-radius: 10px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    margin-top: 1rem;
}

.username-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(255, 215, 0, 0.5);
}

.username-button:active {
    transform: translateY(0);
}

.username-error {
    color: #ff6b6b;
    font-size: 0.9rem;
    margin-top: 0.5rem;
    display: none;
}

.username-hint {
    font-size: 0.85rem;
    opacity: 0.9;
    margin-top: 1rem;
    color: #2C3E50;
}

.final-score {
    font-size: 1.5rem;
    margin: 1rem 0;
}

.final-score span {
    font-size: 2.5rem;
    font-weight: bold;
    color: #ffd700;
}

.final-rank {
    font-size: 1.3rem;
    margin: 1rem 0;
}

.thank-you {
    font-size: 1.2rem;
    margin-top: 1.5rem;
    opacity: 0.9;
}

@media (max-width: 768px) {
    h1 {
        font-size: 2rem;
    }
    
    .santa {
        font-size: 8rem;
    }
    
    .stat-box {
        min-width: 140px;
    }
    
    .countdown-timer {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 1rem;
    }
    
    h1 {
        font-size: 1.6rem;
    }
    
    .santa {
        font-size: 6rem;
    }
    
    .stats {
        flex-direction: column;
        align-items: center;
    }
    
    .stat-box {
        width: 100%;
        max-width: 250px;
    }
}


.snow-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    overflow: hidden;
}


@media (max-width: 768px) {
    h1 {
        font-size: 2rem;
    }
    
    .santa {
        font-size: 8rem;
    }
    
    .stat-box {
        min-width: 140px;
    }
    
    .countdown-timer {
        font-size: 1.5rem;
    }
    
    .stats {
        flex-direction: column;
        gap: 1rem;
        align-items: center;
    }
    
    .stat-box.personal {
        order: 1;
        width: 100%;
        max-width: 300px;
    }
    
    .stats-row-2 {
        display: flex;
        flex-direction: row;
        gap: 1rem;
        width: 100%;
        max-width: 300px;
        justify-content: center;
    }
    
    .stats-row-2 .stat-box {
        flex: 1;
        min-width: 0;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 1rem;
    }
    
    h1 {
        font-size: 1.6rem;
    }
    
    .santa {
        font-size: 6rem;
    }
}


.change-name-button {
    margin-left: 1rem;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 5px;
    color: #2C3E50;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.2s;
}

.change-name-button:hover {
    background: rgba(255, 255, 255, 0.5);
}
