body {
    font-family: 'Poppins', sans-serif;
    margin: 0;
    padding: 0;
    background: radial-gradient(circle at top, #6a85f1, #4834d4);
    color: white;
    display: flex; 
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
}

h1 {
    font-size: 2.7rem;
    margin-top: 25px;
    text-shadow: 3px 3px 10px rgba(0,0,0,0.4);
    letter-spacing: 1px;
}

h2 {
    font-size: 2.5rem;
    margin-top: 20px;
    text-shadow: 3px 3px 10px rgba(0,0,0,0.4);
}

.menu {
    margin-top: 10px;
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
}

.menu a {
    text-decoration: none;
    color: #fff;
    padding: 10px 18px;
    background: rgba(255,255,255,0.18);
    border-radius: 30px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.3);
    transition: 0.3s ease;
    display: flex;
    align-items: center;
    gap: 7px;
}

.menu a:hover {
    transform: translateY(-3px);
    background: rgba(255,255,255,0.35);
}

.user-info {
    font-size: 1.1rem;
    margin-bottom: 5px;
    text-align: center;
    width: 100%;
    display: block;
}

.game-container {
    margin-top: 20px;
    background: rgba(255,255,255,0.08);
    backdrop-filter: blur(12px);
    padding: 25px;
    border-radius: 20px;
    border: 1px solid rgba(255,255,255,0.25);
    box-shadow: 0px 10px 25px rgba(0,0,0,0.25);
    text-align: center;
    width: 95%;
    max-width: 520px;
}

canvas {
    border-radius: 12px;
    border: 3px solid rgba(255,255,255,0.8);
    background: #111;
    box-shadow: 0px 8px 25px rgba(0,0,0,0.6);
}

#score {
    font-size: 1.6rem;
    font-weight: bold;
    margin: 10px 0;
}

.controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 15px;
    flex-wrap: wrap;
}

select {
    padding: 8px 12px;
    border-radius: 8px;
    border: none;
    font-size: 1rem;
    outline: none;
}

button {
    padding: 10px 22px;
    font-size: 1rem;
    border: none;
    border-radius: 25px;
    color: white;
    background: linear-gradient(45deg, #ff6b6b, #ff4757);
    box-shadow: 0px 5px 15px rgba(255,76,76,0.4);
    transition: 0.25s ease;
    cursor: pointer;
}

button:hover {
    transform: scale(1.05);
    box-shadow: 0px 7px 18px rgba(255,76,76,0.55);
}

.leaderboard-body { 
    padding: 20px;
    text-align: center;
    min-height: auto; 
    display: block;  
}

.leaderboard-wrapper {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
    margin: 25px auto;
    width: 95%;
    max-width: 1200px;
}

.lb-column {
    flex: 1;
    min-width: 300px;
    background: rgba(255,255,255,0.1);
    padding: 20px;
    border-radius: 18px;
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.25);
    box-shadow: 0px 10px 25px rgba(0,0,0,0.25);
}

.lb-column h3 {
    margin-top: 0;
    text-transform: uppercase;
    font-size: 1.5rem;
    letter-spacing: 2px;
    margin-bottom: 15px;
    text-shadow: 2px 2px 8px rgba(0,0,0,0.3);
}

.easy-title { color: #33FF57; border-bottom: 2px solid #33FF57; display: inline-block; padding-bottom: 5px; }
.medium-title { color: #3357FF; border-bottom: 2px solid #3357FF; display: inline-block; padding-bottom: 5px; }
.hard-title { color: #FF33F5; border-bottom: 2px solid #FF33F5; display: inline-block; padding-bottom: 5px; }

table {
    width: 100%;
    border-collapse: collapse;
    color: white;
    border-radius: 12px;
    overflow: hidden;
}

th {
    background: rgba(255,255,255,0.2);
    padding: 12px;
    font-weight: 600;
    letter-spacing: 1px;
}

td {
    padding: 12px;
    background: rgba(255,255,255,0.07);
    border-bottom: 1px solid rgba(255,255,255,0.15);
}

tr:nth-child(even) td {
    background: rgba(255,255,255,0.12);
}

tr:hover td {
    background: rgba(255,255,255,0.22);
    transition: 0.25s;
}

.back-button {
    display: inline-block;
    margin: 25px auto;
    padding: 10px 22px;
    background: linear-gradient(45deg, #28a745, #21c064);
    border-radius: 25px;
    color: white;
    font-weight: bold;
    text-decoration: none;
    font-size: 1rem;
    box-shadow: 0px 5px 15px rgba(0,0,0,0.25);
    transition: 0.25s ease;
}

.back-button:hover {
    transform: scale(1.05);
    box-shadow: 0px 7px 18px rgba(0,0,0,0.45);
}

.login-body {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    margin: 0;
}

.login-box {
    position: relative;
    width: 380px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(12px);
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 8px 32px rgba(255, 255, 255, 0.86);
    animation: popup 0.4s ease;
}

@keyframes popup {
    from { opacity: 0; transform: scale(0.85); }
    to { opacity: 1; transform: scale(1); }
}

.login-box input, .login-box button {
    width: 100%;
    padding: 10px;
    margin-bottom: 15px;
    border: none;
    border-radius: 8px;
    box-sizing: border-box;
    font-size: 1rem;
}

.login-box button {
    background: linear-gradient(45deg, #ff6b6b, #ff4757);
    color: white;
    font-weight: bold;
    cursor: pointer;
    transition: 0.3s ease;
}

.login-box button:hover {
    background: linear-gradient(45deg, #ff4757, #ff6b6b);
}

.login-box hr {
    margin: 25px 0; 
    border: 1px solid rgba(255, 255, 255, 0.3); 
    width: 90%;
    margin-left: 5%;
}

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

.modal-content {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(15px);
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    width: 90%;
    max-width: 350px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
    animation: popup 0.4s ease-out;
    border: 1px solid rgba(255, 255, 255, 0.4);
}

.modal-content h2 {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.modal-content p {
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 25px;
}

.modal-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

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

#saveScoreBtn {
    background: linear-gradient(45deg, #28a745, #21c064);
    box-shadow: 0px 5px 15px rgba(33, 192, 100, 0.4);
}

.leaderboard-link, .back-link {
    display: block;
    margin-top: 10px;
    text-decoration: none;
    color: #fff;
    font-size: 0.9rem;
    padding: 8px;
    border-radius: 10px;
    transition: 0.3s ease;
}

.leaderboard-link:hover, .back-link:hover {
    background: rgba(255, 255, 255, 0.15);
}

@media (max-width: 600px) {
    h1 { font-size: 2.2rem; }
    canvas { width: 100%; height: auto; }
    .leaderboard-wrapper { flex-direction: column; }
    .lb-column { width: 100%; min-width: auto; }
}