body {
    font-family: 'Baloo Thambi 2', cursive, 'Noto Sans TC', sans-serif;
    background-color: #4a148c; 
    color: #e1f5fe; 
    display: flex;
    justify-content: center;
    align-items: flex-start; /* Changed to flex-start for better scroll on mobile */
    min-height: 100vh;
    margin: 0;
    padding: 10px; /* Reduced padding for smaller screens */
    box-sizing: border-box;
    overflow-x: hidden;
}

.container {
    background-color: rgba(255, 255, 255, 0.05); 
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 20px; /* Base padding */
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(31, 38, 135, 0.37); 
    backdrop-filter: blur(5px); 
    width: 100%;
    max-width: 420px; /* Adjusted max-width for better mobile fit */
    text-align: center;
    margin: auto; /* Ensure centering */
}

h1 {
    color: #f8bbd0; 
    font-weight: 700;
    font-size: 2em; /* Base size */
    text-shadow: 0 0 5px rgba(248, 187, 208, 0.5);
    margin-bottom: 15px;
}
h2 {
    color: #f8bbd0; 
    font-weight: 600; /* Slightly less than h1 */
    font-size: 1.3em; /* Base size */
    text-shadow: 0 0 3px rgba(248, 187, 208, 0.4);
    margin-top: 20px;
    margin-bottom: 10px;
}


label {
    display: block;
    margin-top: 10px;
    margin-bottom: 4px;
    font-weight: 500;
    text-align: left;
    color: #f8bbd0;
    font-size: 0.9em;
}

input[type="text"],
input[type="password"] {
    width: calc(100% - 20px); /* Adjusted for padding */
    padding: 10px;
    margin-bottom: 15px;
    border: 1px solid rgba(248, 187, 208, 0.5); 
    background-color: rgba(255,255,255,0.1);
    color: #e1f5fe;
    border-radius: 6px;
    box-sizing: border-box;
    font-size: 1em;
    transition: border-color 0.3s, box-shadow 0.3s;
}
input[type="text"]::placeholder,
input[type="password"]::placeholder {
    color: rgba(225, 245, 254, 0.7);
}
input[type="text"]:focus,
input[type="password"]:focus {
    border-color: #f8bbd0;
    box-shadow: 0 0 0 0.2rem rgba(248, 187, 208, 0.25);
    outline: none;
}

button {
    background: linear-gradient(45deg, #ec407a, #d81b60); 
    color: white;
    padding: 10px 18px;
    border: none;
    border-radius: 20px; 
    cursor: pointer;
    font-size: 1em; /* Base size */
    font-weight: 600;
    margin: 10px 5px;
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease;
    box-shadow: 0 4px 15px rgba(236, 64, 122, 0.4);
}
button:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 20px rgba(236, 64, 122, 0.5);
}
button:active {
    transform: translateY(0px) scale(1);
    box-shadow: 0 2px 10px rgba(236, 64, 122, 0.3);
}
button:disabled {
    background: #78909c; 
    color: #cfd8dc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.error-message { color: #ef9a9a; margin-top: 8px; font-size: 0.85em; }
.success-message { color: #a5d6a7; margin-top: 8px; font-size: 0.85em; }
.info-message { color: #b3e5fc; margin-top: 10px; font-size: 0.9em; }

/* CAPTCHA Styles */
#captcha-container { margin-bottom: 15px; text-align: left; }
.captcha-line { display: flex; align-items: center; }
#captchaInput { width: 80px; padding: 8px; font-size: 0.9em; margin-right: 8px;}
.captcha-display { padding: 8px 12px; font-size: 1.1em; margin-right: 8px;}
.captcha-refresh-btn { padding: 6px 8px; font-size: 1.1em; background: #ad1457;}
.captcha-refresh-btn:hover { background-color: #880e4f; }

/* Game Section Specific Styles */
#game-section, #leaderboard-section {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.2); 
}

.game-info {
    display: flex;
    justify-content: space-around;
    align-items: center;
    margin-bottom: 15px;
    font-size: 1em; /* Adjusted size */
    font-weight: 500;
    flex-wrap: wrap;
}
.game-info span {
    background-color: rgba(255,255,255,0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 6px 12px; /* Adjusted padding */
    border-radius: 14px; /* Adjusted radius */
    color: #e1f5fe;
    margin: 4px;
    min-width: 70px;
}
#nextBubblePreview {
    display: inline-block;
    width: 20px; /* Adjusted size */
    height: 20px;
    border-radius: 50%;
    vertical-align: middle;
    margin-left: 5px;
    border: 1px solid white;
}

#gameAreaWrapper {
    width: 100%;
    max-width: 320px; /* Further reduced for very small phone screens */
    margin: 10px auto; /* Reduced margin */
    padding: 0;
    background-color: rgba(0,0,0,0.2); 
    border-radius: 8px;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.3);
}

#gameCanvas {
    display: block; 
    width: 100%;
    height: 420px; /* Adjusted height, can be dynamic based on wrapper width for aspect ratio */
    border-radius: 8px;
    cursor: crosshair; 
}

/* Leaderboard Styles */
.leaderboard-filters button { background: #8e24aa; margin-bottom: 10px; }
.leaderboard-filters button:hover { background-color: #6a1b9a; }
#leaderboardTable { width: 100%; border-collapse: collapse; margin-top: 10px; background-color: rgba(255,255,255,0.05); font-size: 0.85em; }
#leaderboardTable th, #leaderboardTable td { border: 1px solid rgba(255,255,255,0.2); padding: 6px; text-align: left; }
#leaderboardTable th { background-color: #d81b60; color: white; text-align: center; font-weight: 600; }
#leaderboardTable tbody tr:nth-child(even) { background-color: rgba(255,255,255,0.1); }

/* Media Queries for smaller screens */
@media (max-width: 380px) {
    .container {
        padding: 15px;
    }
    h1 {
        font-size: 1.6em;
    }
    h2 {
        font-size: 1.1em;
    }
    button {
        padding: 8px 15px;
        font-size: 0.9em;
    }
    .game-info {
        font-size: 0.9em;
    }
    .game-info span {
        padding: 5px 10px;
    }
    #gameAreaWrapper {
        max-width: 280px; /* Even smaller for very narrow screens */
    }
    #gameCanvas {
        height: 380px; /* Adjust height proportionally or based on aspect */
    }
     #leaderboardTable {
        font-size: 0.75em;
    }
    #leaderboardTable th, #leaderboardTable td {
        padding: 4px;
    }
}