*, *::before, *::after {
    box-sizing: border-box;
}

body {
    background-color: #1a1a1a;
    color: #f0f0f0;
    font-family: 'Press Start 2P', cursive;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    margin: 0;
    text-align: center;
}

#game-container {
    display: flex;
    align-items: flex-start; /* Align items to the top */
    gap: 30px;
    border: 4px solid #444;
    border-radius: 10px;
    padding: 20px;
    background-color: #2b2b2b;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
}

.left-panel, .right-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 240px; /* Increased from 200px */
}

h1 {
    font-size: 2.5rem; /* Decreased from 3rem */
    margin: 0 0 20px 0;
    color: #ff00de;
    text-shadow: 3px 3px 0px #00f7ff;
}

.instructions {
    font-size: 0.7rem; /* Smaller font for instructions */
    line-height: 1.5;
    color: #ccc;
    margin-top: auto; /* Push instructions to the bottom */
}

#game-board {
    border: 3px solid #444;
    background-color: #111;
}

.info-box {
    background-color: #111;
    border: 3px solid #444;
    padding: 15px;
    border-radius: 5px;
    width: 100%;
}

#leaderboard-container {
    height: 250px; /* Fixed height for leaderboard */
    overflow-y: auto; /* Scroll if content overflows */
}

#leaderboard {
    list-style-type: none;
    padding: 0;
    margin: 0;
    font-size: 0.9rem;
}

#leaderboard li {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
}

#leaderboard li:not(:last-child) {
    border-bottom: 1px dashed #444;
}

h2 {
    font-size: 1.2rem;
    margin: 0 0 10px 0;
    color: #00f7ff;
}

#score {
    font-size: 1.5rem;
    margin: 0;
    color: #fff;
}

#next-piece {
    background-color: #111;
    border: none; /* Removed border to match info-box */
    margin: 0 auto;
}

#start-button, #pause-button, #sound-toggle-button {
    background-color: #ff00de;
    color: #fff;
    font-family: 'Press Start 2P', cursive;
    font-size: 1rem;
    border: none;
    padding: 15px 20px;
    cursor: pointer;
    border-radius: 5px;
    text-shadow: 2px 2px 0px #000;
    transition: all 0.2s ease;
}

#start-button:hover, #pause-button:hover, #sound-toggle-button:hover {
    background-color: #00f7ff;
    color: #111;
    text-shadow: 2px 2px 0px #fff;
}

#pause-button { background-color: #ff9d00; }
#sound-toggle-button { background-color: #0DFF72; }
#sound-toggle-button.muted { background-color: #888; }

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.75);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: #2b2b2b;
    padding: 30px;
    border-radius: 10px;
    border: 4px solid #444;
    text-align: center;
    box-shadow: 0 0 30px rgba(0,0,0,0.7);
}

.modal-content h2 {
    color: #00f7ff;
    font-size: 1.8rem;
}

.modal-content p {
    margin: 10px 0 20px;
    font-size: 1rem;
}

#highscore-form label {
    display: block;
    margin-bottom: 10px;
    font-size: 0.9rem;
}

#highscore-form input {
    width: 100px;
    padding: 10px;
    font-family: 'Press Start 2P', cursive;
    font-size: 1.5rem;
    text-transform: uppercase;
    text-align: center;
    background-color: #111;
    border: 2px solid #444;
    color: #fff;
    border-radius: 5px;
    margin-bottom: 20px;
}

#highscore-form button {
    background-color: #0DFF72;
    color: #111;
    font-family: 'Press Start 2P', cursive;
    font-size: 1rem;
    border: none;
    padding: 10px 20px;
    cursor: pointer;
    border-radius: 5px;
    text-shadow: 1px 1px 0px #fff;
}

@media (max-width: 900px) {
    #game-container { flex-direction: column; align-items: center; }
    .left-panel, .right-panel { order: 1; width: 100%; max-width: 350px; }
    #game-board { order: 0; }
}
