body {
    font-family: 'Noto Sans TC', sans-serif; /* Using a common CJK font */
    background-color: #f0f4f8; /* Light blue-gray background */
    color: #33475b; /* Dark blue-gray text */
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    margin: 0;
    padding: 20px;
    box-sizing: border-box;
}

.container {
    background-color: #ffffff;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 6px 18px rgba(51, 71, 91, 0.15); /* Softer shadow */
    width: 100%;
    max-width: 700px;
    text-align: center;
}

h1, h2 {
    color: #1a73e8; /* Google Blue for headings */
}

label {
    display: block;
    margin-top: 12px;
    margin-bottom: 6px;
    font-weight: 500; /* Medium weight */
    text-align: left;
    color: #1a73e8;
}

input[type="text"],
input[type="password"] {
    width: calc(100% - 24px);
    padding: 12px;
    margin-bottom: 18px;
    border: 1px solid #d1d9e6; /* Lighter border */
    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: #1a73e8;
    box-shadow: 0 0 0 0.2rem rgba(26, 115, 232, 0.2);
    outline: none;
}

button {
    background-color: #1a73e8;
    color: white;
    padding: 10px 18px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    margin: 10px 5px;
    transition: background-color 0.2s ease-in-out, transform 0.1s ease;
}
button:hover {
    background-color: #1765c2; /* Darker blue on hover */
    transform: translateY(-1px);
}
button:active {
    transform: translateY(0px);
}
button:disabled {
    background-color: #e8eaf6; /* Light blue-gray for disabled */
    color: #90a4ae;
    cursor: not-allowed;
    transform: translateY(0px);
}

.error-message { color: #d93025; margin-top: 10px; font-size: 0.9em; } /* Google Red */
.success-message { color: #1e8e3e; margin-top: 10px; font-size: 0.9em; } /* Google Green */
.info-message { color: #5f6368; margin-top: 12px; font-size: 1em; }

/* 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: #e8f0fe; border: 1px solid #d2e3fc; border-radius: 4px; font-size: 1.2em; font-weight: bold; letter-spacing: 3px; user-select: none; margin-right: 10px; }
.captcha-refresh-btn { padding: 8px 10px; font-size: 1.2em; background-color: #8ab4f8; border: none; color: white; cursor: pointer; border-radius: 4px; }
.captcha-refresh-btn:hover { background-color: #669df6; }

/* Game Section Specific Styles */
#game-section, #leaderboard-section {
    margin-top: 35px;
    padding-top: 30px;
    border-top: 2px solid #e8f0fe; /* Light blue separator */
}

.game-info {
    display: flex;
    justify-content: space-around;
    margin-bottom: 20px;
    font-size: 1.2em;
    font-weight: 500;
}
.game-info span {
    background-color: #e8f0fe;
    padding: 10px 18px;
    border-radius: 8px;
    color: #1765c2;
}

#gameArea {
    display: grid;
    /* Grid columns and rows will be set by JavaScript */
    border: 2px solid #8ab4f8; /* Blue border */
    border-radius: 8px;
    margin: 20px auto;
    background-color: #ffffff;
    /* Width and height can also be controlled by JS or be responsive */
    width: 300px; /* Example fixed size, adjust as needed */
    height: 300px;
    touch-action: none; /* Prevent scrolling on touch devices when interacting with game area */
}

.grid-cell {
    border: 1px solid #d2e3fc; /* Light border for cells */
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: background-color 0.2s;
}

.grid-cell:hover:not(.wall):not(.dot-container) { /* Only hover empty cells */
    background-color: #e8f0fe;
}

.grid-cell.wall {
    background-color: #5f6368; /* Dark gray for walls */
    cursor: not-allowed;
    animation: wall-place 0.2s ease-out;
}

@keyframes wall-place {
    0% { transform: scale(0.5); opacity: 0.5; }
    100% { transform: scale(1); opacity: 1; }
}

.grid-cell.dot-container .dot {
    width: 70%;
    height: 70%;
    background-color: #ea4335; /* Google Red dot */
    border-radius: 50%;
    animation: dot-pulse 1s infinite ease-in-out;
}

@keyframes dot-pulse {
    0% { transform: scale(0.9); }
    50% { transform: scale(1); }
    100% { transform: scale(0.9); }
}

.grid-cell.trapped .dot {
    background-color: #fcc934; /* Google Yellow when trapped */
    animation: none; /* Stop pulsing when trapped */
}


/* Leaderboard Styles */
.leaderboard-filters button { background-color: #8ab4f8; margin-bottom: 15px; }
.leaderboard-filters button:hover { background-color: #669df6; }
#leaderboardTable { width: 100%; border-collapse: collapse; margin-top: 15px; }
#leaderboardTable th, #leaderboardTable td { border: 1px solid #e8f0fe; padding: 10px; text-align: left; }
#leaderboardTable th { background-color: #1a73e8; color: white; text-align: center; font-weight: 500; }
#leaderboardTable tbody tr:nth-child(even) { background-color: #f8f9fa; }