body {
    font-family: 'Segoe UI', Arial, sans-serif;
    background-color: #1a1a1a; /* Dark mode */
    color: #ffffff;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    flex-direction: column;
}

.container {
    text-align: center;
    padding: 15px;
    background: #2c2c2c;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    position: relative;
    max-width: 320px;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}

h1 {
    font-size: 1.6em;
    margin: 0;
    color: #ffffff;
    text-transform: uppercase;
    letter-spacing: 1px;
}

p {
    font-size: 1em;
    margin: 5px 0;
    color: #cccccc;
}

canvas {
    border: 3px solid #4a4a4a;
    background-color: #222222;
    display: block;
    margin: 5px auto;
    border-radius: 8px;
}

.controls {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-top: 10px;
}

.control-row {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.control-btn {
    width: 70px;
    height: 70px;
    background: linear-gradient(145deg, #3a3a3a, #2c2c2c);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s, background 0.2s;
    touch-action: manipulation;
}

.control-btn svg {
    width: 28px;
    height: 28px;
    fill: #ffffff;
}

.control-btn:active {
    transform: scale(0.95);
    background: linear-gradient(145deg, #4a4a4a, #3a3a3a);
}

.reset-btn {
    width: 70px;
    height: 70px;
    background: linear-gradient(145deg, #ff4d4d, #e63939);
    position: absolute;
    top: 15px;
    right: 15px;
}

.reset-btn:active {
    background: linear-gradient(145deg, #ff6666, #ff4d4d);
}

.modal {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: #2c2c2c;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    text-align: center;
    max-width: 300px;
}

.modal-content h2, .modal-content h3 {
    margin: 10px 0;
    color: #ffffff;
}

.modal-content input {
    width: 100%;
    padding: 10px;
    margin: 10px 0;
    background: #3a3a3a;
    border: none;
    border-radius: 8px;
    color: #ffffff;
    font-size: 1em;
}

.modal-content button {
    width: 100%;
    padding: 12px;
    background: linear-gradient(145deg, #28a745, #218838);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    margin: 10px 0;
}

#leaderboardList {
    list-style: none;
    padding: 0;
    max-height: 200px;
    overflow-y: auto;
}

#leaderboardList li {
    padding: 5px;
    border-bottom: 1px solid #4a4a4a;
    color: #cccccc;
}

@media (max-width: 400px) {
    canvas {
        width: 260px;
        height: 260px;
    }

    .control-btn, .reset-btn {
        width: 60px;
        height: 60px;
    }

    .control-btn svg {
        width: 24px;
        height: 24px;
    }

    h1 {
        font-size: 1.4em;
    }

    p {
        font-size: 0.9em;
    }
}