body {
    font-family: 'Montserrat', sans-serif; /* Modern, clean font */
    background-color: #2c3e50; /* Dark blue-gray background */
    color: #ecf0f1; /* Light text color */
    display: flex;
    justify-content: center;
    align-items: flex-start; /* Align to top to see full game area */
    min-height: 100vh;
    margin: 0;
    padding: 20px;
    box-sizing: border-box;
    overflow-y: auto; /* Allow scrolling if content is too tall */
}

.container {
    background-color: #34495e; /* Slightly lighter container background */
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 500px; /* Optimal for this game type */
    text-align: center;
}

h1, h2 {
    color: #1abc9c; /* Teal color for headings */
    font-weight: 600;
}

label {
    display: block;
    margin-top: 12px;
    margin-bottom: 6px;
    font-weight: 500;
    text-align: left;
    color: #1abc9c;
}

input[type="text"],
input[type="password"] {
    width: calc(100% - 24px);
    padding: 12px;
    margin-bottom: 18px;
    border: 1px solid #2c3e50;
    background-color: #4a6278; /* Darker input background */
    color: #ecf0f1;
    border-radius: 6px;
    box-sizing: border-box;
    transition: border-color 0.3s, box-shadow 0.3s;
}
input[type="text"]:focus,
input[type="password"]:focus {
    border-color: #1abc9c;
    box-shadow: 0 0 0 0.2rem rgba(26, 188, 156, 0.25);
    outline: none;
}

button {
    background-color: #1abc9c;
    color: #2c3e50; /* Dark text on light button */
    padding: 10px 18px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    margin: 10px 5px;
    transition: background-color 0.2s ease-in-out, transform 0.1s ease;
}
button:hover {
    background-color: #16a085; /* Darker teal on hover */
    transform: translateY(-1px);
}
button:active {
    transform: translateY(0px);
}
button:disabled {
    background-color: #7f8c8d; /* Gray for disabled */
    color: #bdc3c7;
    cursor: not-allowed;
    transform: translateY(0px);
}

.error-message { color: #e74c3c; margin-top: 10px; font-size: 0.9em; } /* Red */
.success-message { color: #2ecc71; margin-top: 10px; font-size: 0.9em; } /* Green */
.info-message { color: #bdc3c7; margin-top: 12px; font-size: 1em; } /* Light gray */

/* CAPTCHA Styles */
#captcha-container { margin-bottom: 18px; text-align: left; }
.captcha-line { display: flex; align-items: center; }
#captchaInput { width: 100px; padding: 10px; margin-right: 10px; margin-bottom: 0; text-align: center; letter-spacing: 2px;}
.captcha-display { display: inline-block; padding: 10px 15px; background-color: #4a6278; border: 1px solid #567086; border-radius: 4px; font-size: 1.2em; font-weight: bold; letter-spacing: 3px; user-select: none; margin-right: 10px; color: #ecf0f1;}
.captcha-refresh-btn { padding: 8px 10px; font-size: 1.2em; background-color: #95a5a6; border: none; color: #2c3e50; cursor: pointer; border-radius: 4px; }
.captcha-refresh-btn:hover { background-color: #7f8c8d; }

/* Game Section Specific Styles */
#game-section, #leaderboard-section {
    margin-top: 35px;
    padding-top: 30px;
    border-top: 2px solid #4a6278;
}

.game-info {
    display: flex;
    justify-content: space-around;
    margin-bottom: 20px;
    font-size: 1.2em;
    font-weight: 500;
}
.game-info span {
    background-color: #4a6278;
    padding: 10px 18px;
    border-radius: 8px;
    color: #1abc9c;
}

#gameAreaContainer {
    width: 100%;
    height: 400px; /* Fixed height for the game viewport */
    background-color: #2c3e50; /* Match body background */
    border: 3px solid #1abc9c;
    border-radius: 8px;
    margin: 20px auto;
    position: relative;
    overflow: hidden; /* Crucial for "falling" blocks */
    cursor: pointer; /* Indicate it's clickable */
    display: flex; /* For centering gameArea if smaller */
    justify-content: center;
    align-items: flex-end; /* Stack blocks from bottom */
}

#gameArea {
    position: relative; /* Child blocks will be absolute to this */
    width: 80%; /* Game play area width relative to container */
    height: 100%;
    /* background-color: #34495e; */ /* For visual debugging if needed */
}

.block {
    position: absolute;
    height: 20px; /* Height of each block */
    background-color: #3498db; /* Blue for stacked blocks */
    border: 1px solid #2980b9;
    border-radius: 3px;
    box-sizing: border-box;
    transition: left 0.05s linear, width 0.1s ease-out; /* Smooth width change for cut */
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.block.base {
    background-color: #95a5a6; /* Gray for base */
    border-color: #7f8c8d;
    bottom: 0;
    z-index: 1;
}

.block.current-moving {
    background-color: #e74c3c; /* Red for moving block */
    border-color: #c0392b;
    z-index: 10; /* Above other blocks */
    /* 'bottom' and 'left' will be set by JS */
}

.block.stacked {
    /* 'bottom', 'left', 'width' set by JS */
    z-index: 2; /* Ensure stacked blocks are above base, below moving */
    animation: land 0.2s ease-out;
}
.block.perfect {
    background-color: #f1c40f; /* Gold for perfect stack */
    border-color: #f39c12;
    animation: perfect-land 0.3s ease-out;
}

@keyframes land {
    0% { transform: translateY(-10px); }
    100% { transform: translateY(0); }
}
@keyframes perfect-land {
    0% { transform: scale(1.1) translateY(-5px); }
    50% { transform: scale(0.95); }
    100% { transform: scale(1) translateY(0); }
}

.block.missed {
    animation: fall 0.5s ease-in forwards;
    z-index: 0;
}
@keyframes fall {
    0% { transform: translateY(0) rotate(0deg); }
    100% { transform: translateY(400px) rotate(45deg); opacity: 0; }
}


/* Leaderboard Styles */
.leaderboard-filters button { background-color: #95a5a6; margin-bottom: 15px; }
.leaderboard-filters button:hover { background-color: #7f8c8d; }
#leaderboardTable { width: 100%; border-collapse: collapse; margin-top: 15px; }
#leaderboardTable th, #leaderboardTable td { border: 1px solid #4a6278; padding: 10px; text-align: left; }
#leaderboardTable th { background-color: #1abc9c; color: #2c3e50; text-align: center; font-weight: 600; }
#leaderboardTable tbody tr:nth-child(even) { background-color: #4a6278; }