:root {
    --primary-color: #4a6fa5;
    --secondary-color: #6b8cae;
    --accent-color: #ff6b6b;
    --background-color: #f5f7fa;
    --text-color: #333;
    --light-gray: #e9ecef;
    --border-radius: 8px;
    --box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

header {
    text-align: center;
    margin-bottom: 2rem;
    position: relative;
}

.language-switcher {
    position: absolute;
    top: 0;
    right: 0;
}

#language-select {
    padding: 0.5rem;
    border-radius: var(--border-radius);
    border: 1px solid var(--light-gray);
    background-color: white;
    cursor: pointer;
    font-size: 0.9rem;
}

.custom-select-wrapper {
    position: relative;
    user-select: none;
}

.custom-select {
    position: relative;
}

.custom-select__trigger {
    display: flex;
    align-items: center;
    padding: 0.5rem;
    border-radius: var(--border-radius);
    border: 1px solid var(--light-gray);
    background-color: white;
    cursor: pointer;
}

.custom-select__trigger img {
    width: 24px;
    height: auto;
    margin-right: 0.5rem;
}

.custom-options {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: white;
    border: 1px solid var(--light-gray);
    border-top: 0;
    border-radius: 0 0 var(--border-radius) var(--border-radius);
    display: none;
    z-index: 10;
}

.custom-select.open .custom-options {
    display: block;
}

.custom-option {
    display: flex;
    align-items: center;
    padding: 0.5rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.custom-option:hover {
    background-color: var(--light-gray);
}

.custom-option img {
    width: 24px;
    height: auto;
    margin-right: 0.5rem;
}

h1 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.game-container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.lobby, .game-room, .game-board {
    background: white;
    border-radius: var(--border-radius);
    padding: 2rem;
    box-shadow: var(--box-shadow);
}

.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

input, select, button {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    font-size: 1rem;
}

button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    cursor: pointer;
    font-weight: 600;
    transition: background-color 0.2s;
}

button:hover {
    background-color: var(--secondary-color);
}

button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

.btn-accent {
    background-color: var(--accent-color);
}

.btn-accent:hover {
    background-color: #ff5252;
}

.hidden {
    display: none;
}

#lobbyPlayers {
    margin: 1rem 0;
    min-height: 100px;
    border: 1px solid #eee;
    padding: 1rem;
    border-radius: var(--border-radius);
}

.player {
    padding: 0.5rem;
    margin-bottom: 0.5rem;
    background-color: var(--light-gray);
    border-radius: 4px;
}

.player.host::after {
    content: "👑";
    margin-left: 0.5rem;
}

.category {
    margin-bottom: 1.5rem;
}

.category h3 {
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

.timer {
    width: 80px;
    height: 80px;
    position: relative;
    margin: 2rem auto;
}

.timer-svg {
    transform: rotate(-90deg);
}

.timer-circle-bg {
    fill: none;
    stroke: #eee;
    stroke-width: 4;
}

.timer-circle {
    fill: none;
    stroke: var(--primary-color);
    stroke-width: 4;
    stroke-linecap: round;
    transition: stroke-dasharray 0.3s linear, stroke 0.3s linear;
}

.timer-label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.5rem;
    font-weight: bold;
    color: #333;
}

.stop-button {
    display: block;
    margin: 1rem auto;
    padding: 1rem 2rem;
    font-size: 1.2rem;
}

.room-list {
    margin: 2rem 0;
}

.room-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: var(--box-shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.room-info {
    flex: 1;
}

.room-actions {
    display: flex;
    gap: 0.5rem;
}

@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    .lobby, .game-room, .game-board {
        padding: 1rem;
    }
}

#gameArea {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
}

.game-main {
    flex: 3;
}

.game-sidebar {
    flex: 1;
    position: sticky;
    top: 2rem;
}

.scoreboard-container {
    background: #fff;
    border-radius: var(--border-radius);
    padding: 1rem;
    box-shadow: var(--box-shadow);
    margin-bottom: 2rem;
}

.scoreboard-container h3 {
    text-align: center;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

#scoreboard .player-score {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem;
    border-bottom: 1px solid var(--light-gray);
    font-size: 1rem;
}

#scoreboard .player-score:last-child {
    border-bottom: none;
}

#scoreboard .player-name {
    font-weight: 600;
}

#scoreboard .player-points {
    font-weight: bold;
    color: var(--accent-color);
}


.text-center { text-align: center; }

/* Extracted from game.html */
.share-link-container {
    display: flex;
    gap: 0.5rem;
}

.share-link-input {
    background-color: #e9ecef;
}

.copy-link-btn {
    width: auto;
    padding: 0.75rem 1rem;
}

.chat-messages-container {
    height: 200px;
    overflow-y: auto;
    border: 1px solid #ddd;
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: var(--border-radius);
}

.chat-input-container {
    display: flex;
    gap: 0.5rem;
}

.leave-room-btn {
    margin-top: 1rem;
}

.current-letter {
    font-size: 2rem;
    font-weight: bold;
}

.game-chat-container {
    margin-top: 2rem;
}

.game-chat-messages {
    height: 150px;
    overflow-y: auto;
    border: 1px solid #ddd;
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: var(--border-radius);
}

/* Custom Checkbox */
.checkbox-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    user-select: none;
    font-weight: normal; /* Override label's bold */
}

.checkbox-container input[type="checkbox"] {
    display: none; /* Hide default checkbox */
}

.checkbox-container .checkmark {
    display: inline-block;
    width: 22px;
    height: 22px;
    border: 2px solid #ccc;
    border-radius: 4px;
    transition: background-color 0.2s, border-color 0.2s;
    position: relative;
}

.checkbox-container:hover .checkmark {
    border-color: var(--primary-color);
}

.checkbox-container input[type="checkbox"]:checked + .checkmark {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* The checkmark/indicator (a rotated L) */
.checkbox-container input[type="checkbox"]:checked + .checkmark::after {
    content: '';
    position: absolute;
    left: 7px;
    top: 3px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 3px 3px 0;
    transform: rotate(45deg);
}

/* Voting Screen Styles */
#votingScreen {
    padding: 2rem;
    text-align: center;
}

.voting-answers {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
    margin-top: 2rem;
    margin-bottom: 2rem;
}

.answer-vote-item {
    padding: 0.75rem 1.25rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.1rem;
    border: 2px solid transparent;
}

.answer-vote-item.valid {
    background-color: #28a745; /* Green */
    color: white;
    border-color: #218838;
}

.answer-vote-item.invalid {
    background-color: #dc3545; /* Red */
    color: white;
    border-color: #c82333;
}

.answer-vote-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.category-badge {
    background-color: rgba(0,0,0,0.2);
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: bold;
}

.player-badge {
    font-style: italic;
    font-size: 0.9rem;
    opacity: 0.8;
}

#finishVotingBtn {
    margin-top: 1rem;
}

/* Leaderboard Styles */
#leaderboardScreen {
    text-align: center;
    padding: 2rem;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    animation: fadeIn 0.5s ease-in-out;
}

#leaderboardScreen h2 {
    color: #2c3e50;
    margin-bottom: 0.5rem;
}

#leaderboardScreen h3 {
    color: #34495e;
    margin-bottom: 2rem;
    font-weight: normal;
}

.leaderboard-container {
    max-width: 500px;
    margin: 0 auto 2rem auto;
    border: 1px solid #ecf0f1;
    border-radius: 5px;
    overflow: hidden;
}

.leaderboard-row {
    display: grid;
    grid-template-columns: 50px 1fr 100px;
    padding: 0.8rem 1rem;
    text-align: left;
    align-items: center;
    border-bottom: 1px solid #ecf0f1;
}

.leaderboard-row:last-child {
    border-bottom: none;
}

.leaderboard-row.leaderboard-header {
    background-color: #f8f9fa;
    font-weight: bold;
    color: #34495e;
}

.leaderboard-row:nth-child(even) {
    background-color: #fdfdfd;
}

.leaderboard-row.current-player {
    background-color: #e8f5e9; /* A light green to highlight the current player */
    font-weight: bold;
}

.leaderboard-rank {
    font-size: 1.2em;
    font-weight: bold;
    color: #3498db;
}

.leaderboard-name {
    font-size: 1.1em;
    color: #2c3e50;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.leaderboard-score {
    font-size: 1.1em;
    font-weight: bold;
    text-align: right;
    color: #2ecc71;
}

#goToHomeBtn {
    padding: 1rem 2.5rem;
    font-size: 1.2rem;
    border-radius: 50px; /* Pill shape */
    border: none;
    cursor: pointer;
    background: linear-gradient(45deg, #3498db, #2980b9);
    color: white;
    box-shadow: 0 4px 10px rgba(52, 152, 219, 0.4);
    transition: all 0.3s ease;
}

#goToHomeBtn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(52, 152, 219, 0.5);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
