/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    width: 100%;
    overflow-x: hidden;
    font-family: 'Comfortaa', cursive;
    font-weight: 400;
    font-style: normal;
    font-stretch: normal;
    user-select: none;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-tap-highlight-color: transparent;
    text-rendering: optimizeLegibility;
    text-size-adjust: 100%;
    /* Enhanced Space Background */
    background: #000011;
    position: relative;
}

/* Animated Stars Background */
html::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(2px 2px at 20px 30px, #fff, transparent),
        radial-gradient(2px 2px at 40px 70px, rgba(255,255,255,0.8), transparent),
        radial-gradient(1px 1px at 90px 40px, #fff, transparent),
        radial-gradient(1px 1px at 130px 80px, rgba(255,255,255,0.6), transparent),
        radial-gradient(2px 2px at 160px 30px, #fff, transparent),
        radial-gradient(1px 1px at 200px 90px, rgba(255,255,255,0.7), transparent),
        radial-gradient(2px 2px at 240px 50px, #fff, transparent),
        radial-gradient(1px 1px at 280px 20px, rgba(255,255,255,0.8), transparent),
        radial-gradient(1px 1px at 320px 80px, #fff, transparent),
        radial-gradient(2px 2px at 360px 40px, rgba(255,255,255,0.6), transparent);
    background-repeat: repeat;
    background-size: 400px 200px;
    animation: twinkle 20s linear infinite;
    z-index: -2;
}

/* Moving nebula effect */
html::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 200%;
    height: 200%;
    background: 
        radial-gradient(ellipse at 20% 50%, rgba(148, 0, 211, 0.1) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(255, 105, 180, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 40% 80%, rgba(65, 105, 225, 0.1) 0%, transparent 50%);
    animation: nebula 40s ease-in-out infinite alternate;
    z-index: -1;
}

@keyframes twinkle {
    0% { transform: translateX(0px); }
    100% { transform: translateX(-400px); }
}

@keyframes nebula {
    0% { 
        transform: translate(-10%, -10%) rotate(0deg) scale(1);
        opacity: 0.5;
    }
    100% { 
        transform: translate(-5%, -5%) rotate(10deg) scale(1.1);
        opacity: 0.8;
    }
}

body {
    min-height: 100vh;
    position: relative;
    z-index: 0;
    color: #333;
}

/* Main Container */
#container {
    min-height: 100vh;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 2;
    opacity: 0;
    animation: fadeIn 0.5s ease-in-out forwards;
    pointer-events: none;
}

@keyframes fadeIn {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

/* Ensure interactive elements are accessible */
#keyInput, button, .modal {
    pointer-events: auto;
}

/* Heading */
h1 {
    font-family: 'Press Start 2P', cursive;
    font-size: clamp(1.8rem, 5vw, 2.5rem);
    color: #ff69b4;
    text-shadow: 0 0 10px #ff69b4, 0 0 20px #9400d3, 0 0 30px #4169e1;
    margin-bottom: 20px;
    animation: neonSlideIn 1s ease-out forwards, neonFlicker 6s ease-in-out infinite;
    opacity: 0;
    transform: translateX(-100%);
}

@keyframes neonSlideIn {
    0% {
        opacity: 0;
        transform: translateX(-100%);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes neonFlicker {
    0%, 100% {
        text-shadow: 0 0 10px #ff69b4, 0 0 20px #9400d3, 0 0 30px #4169e1;
    }
    10%, 30% {
        text-shadow: 0 0 20px #ff69b4, 0 0 40px #9400d3, 0 0 50px #4169e1;
    }
    20% {
        text-shadow: 0 0 5px #ff69b4, 0 0 10px #9400d3, 0 0 15px #4169e1;
    }
}

/* Textarea Styling */
#keyInput {
    width: 100%;
    max-width: 600px;
    padding: 15px;
    margin: 20px 0;
    font-family: 'Comfortaa', cursive;
    font-size: 16px;
    line-height: 1.7;
    background: rgba(16, 8, 35, 0.9);
    color: #87ceeb;
    border: 2px solid #ff69b4;
    border-radius: 10px;
    backdrop-filter: blur(10px);
    resize: none;
    height: 50px;
    transition: border-color 0.3s, box-shadow 0.3s;
}

#keyInput:hover, #keyInput:focus {
    border-color: #9400d3;
    box-shadow: 0 0 15px rgba(255, 105, 180, 0.4);
    outline: none;
}

/* Button Styling with Shimmer Animation */
button {
    font-family: 'Press Start 2P', cursive;
    font-size: 1.3rem;
    padding: 15px 30px;
    margin: 20px;
    background: rgba(16, 8, 35, 0.9);
    color: #ff69b4;
    border: 2px solid #ff69b4;
    border-radius: 10px;
    backdrop-filter: blur(10px);
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
    position: relative;
    overflow: hidden;
    cursor: pointer;
    transition: color 0.3s, background 0.3s, box-shadow 0.3s;
    z-index: 3;
}

button::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 105, 180, 0.3) 10%, transparent 70%);
    animation: neonPulse 1.5s ease-out infinite;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s;
}

/* Shimmer effect for button click */
button::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.4),
        rgba(255, 105, 180, 0.6),
        rgba(255, 255, 255, 0.4),
        transparent
    );
    transition: left 0.6s ease;
    z-index: 1;
    opacity: 0;
}

button.shimmer::after {
    left: 100%;
    opacity: 1;
}

button:hover::before {
    opacity: 1;
}

button:hover {
    color: #87ceeb;
    background: rgba(148, 0, 211, 0.9);
    box-shadow: 0 0 15px rgba(255, 105, 180, 0.4);
}

@keyframes neonPulse {
    0% { transform: scale(0); opacity: 0; }
    50% { transform: scale(1.2); opacity: 0.8; }
    100% { transform: scale(1); opacity: 0; }
}

/* Modal Styling with Space Background */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
    overflow: auto;
    background: #000011;
}

.modal::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(2px 2px at 20px 30px, #fff, transparent),
        radial-gradient(2px 2px at 40px 70px, rgba(255,255,255,0.8), transparent),
        radial-gradient(1px 1px at 90px 40px, #fff, transparent),
        radial-gradient(1px 1px at 130px 80px, rgba(255,255,255,0.6), transparent),
        radial-gradient(2px 2px at 160px 30px, #fff, transparent),
        radial-gradient(1px 1px at 200px 90px, rgba(255,255,255,0.7), transparent),
        radial-gradient(2px 2px at 240px 50px, #fff, transparent),
        radial-gradient(1px 1px at 280px 20px, rgba(255,255,255,0.8), transparent),
        radial-gradient(1px 1px at 320px 80px, #fff, transparent),
        radial-gradient(2px 2px at 360px 40px, rgba(255,255,255,0.6), transparent);
    background-repeat: repeat;
    background-size: 400px 200px;
    animation: twinkle 20s linear infinite;
    z-index: -2;
}

.modal::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 200%;
    height: 200%;
    background: 
        radial-gradient(ellipse at 20% 50%, rgba(148, 0, 211, 0.1) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(255, 105, 180, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 40% 80%, rgba(65, 105, 225, 0.1) 0%, transparent 50%);
    animation: nebula 40s ease-in-out infinite alternate;
    z-index: -1;
}

.modal-content {
    background: transparent;
    margin: 0;
    padding: 20px;
    border: none;
    width: 100vw;
    height: 100vh;
    border-radius: 0;
    backdrop-filter: none;
    box-shadow: none;
    color: #333;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    overflow-y: auto;
    position: relative;
    z-index: 2;
}

.close {
    background-color: transparent;
    position: absolute;
    top: 10px;
    right: 20px;
    font-size: 28px;
    font-weight: bold;
    color: #ff69b4;
    cursor: pointer;
    transition: color 0.3s;
    z-index: 10;
}

.close:hover,
.close:focus {
    color: #87ceeb;
}

/* Generated Key and Leaderboard Content */
#generatedKey, #leaderboard {
    font-family: 'Comfortaa', cursive;
    font-size: 1.1rem;
    text-align: center;
    width: 100%;
}

#generatedKey strong {
    color: #ff69b4;
    text-shadow: 0 0 10px #ff69b4;
    font-family: 'Press Start 2P', cursive;
    font-size: 1.5rem;
}

/* Card Zone Container */
.card-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 100vw;
    padding: 20px;
    margin-top: 20px;
}

.secondary-card-zone {
    display: flex;
    justify-content: center;
    gap: 2vw;
    width: 100%;
    max-width: 700px;
    flex-wrap: wrap;
}

/* Card Styles */
.card {
    background: linear-gradient(145deg, rgba(0, 0, 17, 0.5), rgba(20, 10, 40, 0.7));
    border: 2px solid transparent;
    border-radius: 20px;
    width: clamp(250px, 30vw, 300px);
    height: clamp(350px, 40vh, 400px);
    overflow: hidden;
    position: relative;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    box-shadow: 
        0 4px 15px rgba(0, 0, 0, 0.4),
        0 0 20px rgba(255, 105, 180, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(20px);
    opacity: 0;
    transform: perspective(1000px) rotateY(90deg) scale(0.8);
    animation: cardFlipOpen 0.8s ease-out forwards;
}

.secondary-card-zone .card:nth-child(2) { animation-delay: 0.2s; }
.secondary-card-zone .card:nth-child(3) { animation-delay: 0.4s; }
.secondary-card-zone .card:nth-child(4) { animation-delay: 0.6s; }

@keyframes cardFlipOpen {
    0% {
        opacity: 0;
        transform: perspective(1000px) rotateY(90deg) scale(0.8);
    }
    50% {
        opacity: 0.5;
        transform: perspective(1000px) rotateY(45deg) scale(0.9);
    }
    100% {
        opacity: 1;
        transform: perspective(1000px) rotateY(0deg) scale(1);
    }
}

/* Holographic border effect (enhanced) */
.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 20px;
    padding: 2px;
    background: linear-gradient(
        45deg, 
        rgba(255, 105, 180, 0.7), 
        rgba(148, 0, 211, 0.8), 
        rgba(65, 105, 225, 0.7), 
        rgba(255, 105, 180, 0.7)
    );
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask-composite: exclude;
    z-index: -1;
}

/* Floating particles effect */
.card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 80%, rgba(255, 255, 255, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 105, 180, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(148, 0, 211, 0.15) 0%, transparent 50%);
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
    border-radius: 20px;
}

.card:hover {
    background: linear-gradient(145deg, rgba(0, 0, 17, 0.7), rgba(30, 15, 60, 0.8));
    box-shadow: 
        0 8px 25px rgba(0, 0, 0, 0.5),
        0 0 30px rgba(255, 105, 180, 0.4);
    transform: translateY(-5px);
}

.card:hover::after {
    opacity: 1;
}

.card-image {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
    border-radius: 18px;
}

.card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
    transition: transform 0.4s ease, filter 0.4s ease;
}

.card:hover .card-image img {
    transform: scale(1.1);
    filter: brightness(1.2) contrast(1.15);
}

.card-image img:not([src])::before {
    content: "Image not found";
    display: block;
    color: #ff69b4;
    font-family: 'Comfortaa', cursive;
    font-size: 1.5rem;
    text-align: center;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        transparent 0%, 
        rgba(0, 0, 17, 0.3) 50%, 
        rgba(0, 0, 17, 0.85) 90%
    );
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 20px;
    color: #fff;
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.8);
    transition: background 0.4s ease;
    border-radius: 18px;
}

.card:hover .card-overlay {
    background: linear-gradient(
        transparent 0%, 
        rgba(0, 0, 17, 0.2) 40%, 
        rgba(0, 0, 17, 0.9) 85%
    );
}

/* Card name styling (enhanced) */
.card-name {
    font-family: 'Press Start 2P', cursive;
    font-size: clamp(1rem, 1.8vw, 1.3rem);
    font-weight: 700;
    color: #ff69b4;
    text-shadow: 
        0 0 8px #ff69b4, 
        0 0 12px #9400d3, 
        0 0 16px #4169e1,
        2px 2px 4px rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 15px;
    background: rgba(0, 0, 17, 0.7);
    padding: 8px 12px;
    border-radius: 8px;
    backdrop-filter: blur(5px);
}

.checkmark {
    color: #28a745;
    font-size: 1.4rem;
    text-shadow: 0 0 5px #28a745;
}

.card-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.card-description {
    font-size: clamp(1.2rem, 1.5vw, 1rem);
    line-height: 1.4;
    margin: 0;
    color: #87ceeb;
    text-shadow: 0 0 3px rgba(0, 0, 0, 0.8);
}

/* Table Styles for Ranks 4+ with Space Theme */
.leaderboard-table {
    width: 100%;
    max-width: 100vw;
    border-collapse: collapse;
    margin-top: 30px;
    background: rgba(0, 0, 17, 0.4);
    color: #87ceeb;
    border: 2px solid #ff69b4;
    border-radius: 10px;
    overflow: hidden;
    backdrop-filter: blur(20px);
}

.leaderboard-table th,
.leaderboard-table td {
    font-size: clamp(1.2rem, 1.5vw, 1rem);
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 105, 180, 0.3);
}

.leaderboard-table th {
    background: rgba(148, 0, 211, 0.7);
    font-family: 'Press Start 2P', cursive;
    font-size: 1rem;
    text-shadow: 0 0 5px #ff69b4;
}

.leaderboard-table tr:hover {
    background: rgba(255, 105, 180, 0.1);
    transition: background 0.3s;
}

.leaderboard-table tr:last-child td {
    border-bottom: none;
}

/* Responsive Design */
@media (max-width: 900px) {
    #container {
        width: 100%;
        padding: 10px;
    }

    #keyInput {
        max-width: 100%;
        padding: 10px;
    }

    .card-zone {
        padding: 10px;
    }

    .secondary-card-zone {
        flex-direction: column;
        align-items: center;
        max-width: 100%;
        gap: 20px;
    }

    .card {
        width: clamp(200px, 80vw, 250px);
        height: clamp(300px, 35vh, 350px);
    }

    .card-name {
        font-size: clamp(0.7rem, 1.3vw, 0.9rem);
    }

    .leaderboard-table {
        margin-top: 20px;
    }

    .leaderboard-table th,
    .leaderboard-table td {
        padding: 10px;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    #container {
        padding: 5px;
    }

    h1 {
        font-size: clamp(1.5rem, 4vw, 2rem);
    }

    #keyInput {
        padding: 8px;
        font-size: 14px;
    }

    button {
        font-size: 1rem;
        padding: 10px 20px;
    }

    #generatedKey strong {
        font-size: 1.2rem;
    }

    .card {
        width: clamp(180px, 90vw, 220px);
        height: clamp(280px, 30vh, 300px);
    }

    .card-name {
        font-size: clamp(0.6rem, 1.2vw, 0.8rem);
    }

    .card-overlay {
        padding: 15px;
    }

    .leaderboard-table {
        margin-top: 15px;
    }

    .leaderboard-table th,
    .leaderboard-table td {
        padding: 8px;
        font-size: 0.8rem;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Leaderboard Key Styling */
.leaderboard-key {
    font-family: 'Press Start 2P', cursive;
    font-size: clamp(1rem, 3vw, 1.2rem);
    color: #87ceeb;
    text-shadow: 
        0 0 8px #87ceeb,
        0 0 12px #ff69b4,
        0 0 16px #4169e1;
    background: rgba(16, 8, 35, 0.7);
    padding: 10px 20px;
    border: 2px solid #ff69b4;
    border-radius: 20px;
    display: inline-block;
    backdrop-filter: blur(10px);
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.6s ease-out 0.3s forwards;
    transition: all 0.3s ease;
    text-align: center;
}

.leaderboard-key:hover {
    background: rgba(148, 0, 211, 0.8);
    border-color: #9400d3;
    box-shadow: 0 0 15px rgba(255, 105, 180, 0.4);
    transform: translateY(-2px);
}

/* Responsive Design */
@media (max-width: 900px) {
    .leaderboard-key {
        font-size: clamp(0.9rem, 2.5vw, 1rem);
        padding: 8px 15px;
    }

    .back-button {
        font-size: clamp(0.8rem, 2vw, 0.9rem);
        padding: 10px 15px;
    }
}

@media (max-width: 480px) {
    .leaderboard-key {
        font-size: clamp(0.8rem, 2vw, 0.9rem);
        padding: 6px 12px;
    }

    .back-button {
        top: 10px;
        left: 10px;
        font-size: clamp(0.7rem, 1.8vw, 0.8rem);
        padding: 8px 12px;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    .leaderboard-key, .back-button {
        animation: none !important;
        transition: none !important;
        opacity: 1;
        transform: none;
    }

    .back-button::before {
        animation: none !important;
    }
}

/* Full screen overlay styles */
#leaderboardOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0f0f23 0%, #1a1a3e 25%, #2d1b69 50%, #150a30 75%, #000000 100%);
    z-index: 10000;
    display: none;
    overflow-y: auto;
    animation: slideIn 0.5s ease-out;
}

/* Animated space background */
#leaderboardOverlay::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(ellipse at 20% 50%, rgba(120, 0, 255, 0.3) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 10%, rgba(255, 0, 120, 0.3) 0%, transparent 50%),
        radial-gradient(ellipse at 40% 80%, rgba(0, 255, 200, 0.2) 0%, transparent 50%);
    animation: nebula 20s ease-in-out infinite alternate;
    pointer-events: none;
}

@keyframes nebula {
    0% {
        background: 
            radial-gradient(ellipse at 20% 50%, rgba(120, 0, 255, 0.3) 0%, transparent 50%),
            radial-gradient(ellipse at 80% 10%, rgba(255, 0, 120, 0.3) 0%, transparent 50%),
            radial-gradient(ellipse at 40% 80%, rgba(0, 255, 200, 0.2) 0%, transparent 50%);
    }
    25% {
        background: 
            radial-gradient(ellipse at 30% 60%, rgba(120, 0, 255, 0.4) 0%, transparent 60%),
            radial-gradient(ellipse at 70% 20%, rgba(255, 0, 120, 0.2) 0%, transparent 40%),
            radial-gradient(ellipse at 50% 70%, rgba(0, 255, 200, 0.3) 0%, transparent 55%);
    }
    50% {
        background: 
            radial-gradient(ellipse at 10% 40%, rgba(120, 0, 255, 0.2) 0%, transparent 45%),
            radial-gradient(ellipse at 90% 30%, rgba(255, 0, 120, 0.4) 0%, transparent 55%),
            radial-gradient(ellipse at 30% 90%, rgba(0, 255, 200, 0.3) 0%, transparent 50%);
    }
    75% {
        background: 
            radial-gradient(ellipse at 40% 30%, rgba(120, 0, 255, 0.3) 0%, transparent 50%),
            radial-gradient(ellipse at 60% 40%, rgba(255, 0, 120, 0.3) 0%, transparent 45%),
            radial-gradient(ellipse at 20% 60%, rgba(0, 255, 200, 0.4) 0%, transparent 60%);
    }
    100% {
        background: 
            radial-gradient(ellipse at 25% 45%, rgba(120, 0, 255, 0.4) 0%, transparent 55%),
            radial-gradient(ellipse at 75% 15%, rgba(255, 0, 120, 0.2) 0%, transparent 40%),
            radial-gradient(ellipse at 45% 75%, rgba(0, 255, 200, 0.3) 0%, transparent 50%);
    }
}

/* Stars layer */
.stars {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.star {
    position: absolute;
    background: white;
    border-radius: 50%;
    animation: twinkle 3s infinite ease-in-out;
}

.star.small {
    width: 1px;
    height: 1px;
    animation-duration: 2s;
}

.star.medium {
    width: 2px;
    height: 2px;
    animation-duration: 3s;
    box-shadow: 0 0 6px rgba(255, 255, 255, 0.8);
}

.star.large {
    width: 3px;
    height: 3px;
    animation-duration: 4s;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.9);
}

@keyframes twinkle {
    0%, 100% { opacity: 0.3; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.2); }
}

/* Moving particles */
.particle {
    position: absolute;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 50%;
    pointer-events: none;
}

.particle.floating {
    animation: float 15s infinite linear;
}

@keyframes float {
    0% {
        transform: translateY(100vh) translateX(0px);
        opacity: 0;
    }
    10% {
        opacity: 0.6;
    }
    90% {
        opacity: 0.6;
    }
    100% {
        transform: translateY(-100px) translateX(50px);
        opacity: 0;
    }
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

    @keyframes slideOut {
        from {
            transform: translateX(0);
            opacity: 1;
        }
        to {
            transform: translateX(-100%);
            opacity: 0;
        }
    }

.slide-out {
    animation: slideOut 0.5s ease-out forwards;
}

#leaderboardContent {
    min-height: 100vh;
    padding: 20px;
    position: relative;
    z-index: 1;
}

.back-button {
    position: fixed;
    top: 20px;
    left: 20px;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 12px 20px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    z-index: 10001;
}

.back-button:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.leaderboard-header {
    text-align: center;
    color: white;
    margin: 60px 0 30px 0;
}

.leaderboard-title {
    font-family: 'Press Start 2P', cursive;
    font-size: clamp(2rem, 5vw, 2.5rem);
    font-weight: 700;
    color: #ff69b4;
    text-shadow: 
        0 0 10px #ff69b4, 
        0 0 20px #9400d3, 
        0 0 30px #4169e1,
        2px 2px 4px rgba(0, 0, 0, 0.9);
    margin-bottom: 20px;
    animation: neonSlideIn 1s ease-out forwards, neonFlicker 6s ease-in-out infinite;
    opacity: 0;
    transform: translateX(-100%);
    text-align: center;
    z-index: 3;
}

.leaderboard-key {
    font-size: 1.2em;
    opacity: 0.9;
    background: rgba(255, 255, 255, 0.1);
    padding: 10px 20px;
    border-radius: 20px;
    display: inline-block;
    backdrop-filter: blur(5px);
}

.no-data-message {
    text-align: center;
    color: white;
    font-size: 1.5em;
    margin-top: 100px;
    background: rgba(255, 255, 255, 0.1);
    padding: 40px;
    border-radius: 20px;
    backdrop-filter: blur(10px);
}

/* Hide main content when overlay is shown */
body.overlay-active #container {
    filter: blur(5px);
}

/* Loading spinner for overlay */
#overlaySpinner {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10002;
    display: none;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(255, 255, 255, 0.3);
    border-top: 5px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}