body {
    font-family: 'Roboto', sans-serif;
    text-align: center;
    margin: 0;
    padding: 0;
    background: linear-gradient(to bottom, #0f2027, #203a43, #2c5364);
    color: #ffffff;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
}

h1 {
    margin-top: 20px;
    color: #00d4ff;
    font-size: 2.5rem;
    text-shadow: 2px 2px 5px #000;
}

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

label {
    font-size: 1.2rem;
    color: #00d4ff;
}

button {
    background-color: #00d4ff;
    color: #0f2027;
    border: none;
    border-radius: 8px;
    padding: 10px 20px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.5);
}

button:hover {
    background-color: #00b3cc;
    transform: scale(1.1);
}

#moves, #timer {
    font-size: 1.2rem;
    font-weight: bold;
    margin-top: 10px;
    color: #00d4ff;
}

main {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    padding: 20px;
}

#gameArea {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 15px;
    width: 100%;
}

.column {
    width: 80px;
    display: flex;
    flex-direction: column-reverse;
    align-items: center;
    position: relative;
    overflow: hidden; /* Verhindert, dass Kugeln über die Spalte hinausragen */
    border: 3px solid #00d4ff;
    border-radius: 10px;
    background-color: #1c1c1c;
    padding-top: 20px;
    transition: transform 0.2s ease, height 0.2s ease;
    height: calc(68px * var(--max-balls)); /* Höhe bleibt konstant basierend auf der maximalen Kugelanzahl */
    box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.5);
}

.column:hover {
    transform: scale(1.05);
    border-color: #00b3cc;
}

.column.selected {
    border-color: green;
    transform: scale(1.1);
}

.column.target {
    border-color: red;
}

.column.invalid {
    animation: shake 0.3s;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    50% { transform: translateX(5px); }
    75% { transform: translateX(-5px); }
}

.ball {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    margin: 5px 0;
    cursor: grab;
    transition: all 0.2s ease;
    box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.5);
}

.ball:active {
    cursor: grabbing;
    transform: scale(1.1);
    box-shadow: 2px 2px 15px rgba(0, 0, 0, 0.8);
}

.red { background-color: #ff4d4d; }
.yellow { background-color: #ffeb3b; }
.green { background-color: #4caf50; }
.blue { background-color: #2196f3; }
.purple { background-color: #9c27b0; }
.orange { background-color: #ff9800; }

#leaderboardDisplay {
    margin-top: 20px;
    padding: 10px;
    background-color: #1c1c1c;
    border: 2px solid #00d4ff;
    border-radius: 10px;
    box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.5);
    max-width: 600px;
    margin: 20px auto;
    text-align: center; /* Center the text */
}

#leaderboardDisplay h3, #leaderboardDisplay h4 {
    color: #00d4ff;
}

#leaderboardDisplay div {
    margin: 5px 0;
    color: #ffffff;
}

#topScores {
    display: none; /* Hide the top scores by default */
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 80%; /* Adjust width for better centering */
    max-width: 800px;
    height: auto; /* Adjust height to fit content */
    background-color: transparent; /* Remove black background */
    justify-content: center;
    align-items: center;
    padding: 20px; /* Add padding for better spacing */
    box-sizing: border-box; /* Ensure padding is included in width/height */
}

.modal-content {
    background-color: #1c1c1c;
    padding: 20px;
    border: 2px solid #00d4ff;
    border-radius: 10px;
    width: 80%;
    max-width: 800px;
    text-align: left;
    box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.5);
    position: relative;
}

.close-button {
    color: #00d4ff;
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close-button:hover,
.close-button:focus {
    color: #00b3cc;
}

@media (max-width: 768px) {
    .column {
        width: 60px;
        height: calc(58px * var(--max-balls)); /* Neue Spaltenhöhe für mobile Geräte */
    }

    .ball {
        width: 50px;
        height: 50px;
    }
}
