/* General Body and App Container Styles */
body {
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    margin: 0;
    padding: 10px;
    background-color: #1a1a2e; /* Dark background for a modern feel */
    color: #e0e0e0; /* Light text color for contrast */
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    box-sizing: border-box;
    line-height: 1.6;
}

#app-container {
    background-color: #24263b; /* Slightly lighter dark shade for the container */
    padding: 20px;
    border-radius: 16px; /* More rounded corners */
    box-shadow: 0 8px 24px rgba(0,0,0,0.3); /* Deeper shadow for depth */
    width: 100%;
    max-width: 650px; 
    box-sizing: border-box;
    margin-bottom: 30px;
    border: 1px solid #3a3f5e; /* Subtle border */
}

/* Headings */
h1, h2, h3 {
    color: #ffffff; /* White headings */
    text-align: center;
    margin-top: 0.5em;
    margin-bottom: 0.8em;
    font-weight: 500; /* Medium weight for modern look */
}

h1 {
    font-size: 2.2em;
    color: #e94560; /* Accent color for main title */
    letter-spacing: 1px;
}

h2 {
    font-size: 1.7em;
    color: #f0f0f0;
}

h3 {
    font-size: 1.3em;
    color: #cccccc;
    border-bottom: 1px solid #3a3f5e;
    padding-bottom: 0.4em;
}

/* Labels and Inputs */
label {
    display: block;
    margin-bottom: 10px;
    font-weight: 500;
    font-size: 1em;
    color: #a7a9be; /* Softer label color */
}

input[type="text"],
input[type="number"],
textarea {
    width: 100%;
    padding: 14px 18px;
    margin-bottom: 15px;
    border: 1px solid #3a3f5e; 
    border-radius: 8px; 
    box-sizing: border-box;
    font-size: 1em;
    background-color: #1e1e32; /* Darker input background */
    color: #e0e0e0; /* Light text in inputs */
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}
input[type="text"]:focus,
input[type="number"]:focus,
textarea:focus {
    border-color: #e94560; /* Accent border on focus */
    box-shadow: 0 0 0 3px rgba(233, 69, 96, 0.2); /* Subtle glow */
    outline: none;
}

input[type="number"] {
    width: auto;
    min-width: 90px;
}

textarea {
    min-height: 80px;
    resize: vertical;
}

/* Buttons */
button {
    background-color: #e94560; /* Accent color for primary buttons */
    color: white;
    padding: 14px 22px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.05em;
    font-weight: 500; /* Medium weight */
    margin-top: 10px;
    margin-right: 10px;
    transition: background-color 0.25s ease-in-out, transform 0.15s ease;
    display: inline-block;
    width: auto;
    letter-spacing: 0.5px;
}

button:hover, button:focus {
    background-color: #d43f55; /* Slightly darker accent */
    transform: translateY(-2px); /* Subtle lift effect */
    box-shadow: 0 4px 10px rgba(233, 69, 96, 0.2);
    outline: none;
}

button:disabled {
    background-color: #4a4e69; /* Darker disabled state */
    color: #8c8c8e;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

#createGameButton, #joinGameButton, #confirmGameSetupButton, #setNameButton, #startGameButton, #submitAnswerButton, #readyButton, #playAgainButton {
    width: 100%;
    margin-right: 0;
    margin-bottom: 12px;
}

.secondary-action-button, #backToLobbyButton, #howToPlayButton, #changeNameButton, #leaveGameButton { 
    background-color: #4a4e69; /* Secondary button color */
    width: 100%;
    margin-right: 0;
    margin-bottom: 12px;
}
.secondary-action-button:hover, #backToLobbyButton:hover, #howToPlayButton:hover, #changeNameButton:hover, #leaveGameButton:hover {
    background-color: #5f6787;
}

#leaveGameButton {
    background-color: #c0392b; /* More distinct danger color */
}
#leaveGameButton:hover {
    background-color: #a93226;
}


.mode-button {
    padding: 12px 18px;
    background-color: #3a3f5e; 
    color: #c0c0c0;
    border: 1px solid #4a4e69;
    border-radius: 8px;
    font-size: 1em;
    margin-right: 10px;
    margin-bottom: 10px; 
    transition: background-color 0.2s, border-color 0.2s, color 0.2s, transform 0.2s;
    position: relative; 
    /* width: calc(50% - 5px); Let them size naturally for 3 buttons */
    box-sizing: border-box;
}
.mode-button:hover {
    background-color: #4a4e69;
    border-color: #5f6787;
    transform: translateY(-1px);
}
.mode-button:last-of-type {
    margin-right: 0;
}

.mode-button.selected {
    background-color: #e94560; 
    border-color: #d43f55;
    color: #ffffff;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(233, 69, 96, 0.2);
}
.mode-button .checkmark {
    display: none; 
    position: absolute;
    top: 50%;
    right: 12px; 
    transform: translateY(-50%);
    font-size: 1.2em;
    color: #ffffff; 
}
.mode-button.selected .checkmark {
    display: inline; 
}

/* Category Button Styles */
.category-buttons {
    display: flex;
    flex-wrap: wrap; 
    gap: 8px; 
    margin-bottom: 10px;
}
.category-button {
    padding: 10px 15px;
    background-color: #3a3f5e;
    color: #c0c0c0;
    border: 1px solid #4a4e69;
    border-radius: 6px;
    font-size: 0.9em;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s, color 0.2s;
    flex-grow: 1; 
    text-align: center;
    margin: 0; 
}
.category-button:hover {
    background-color: #4a4e69;
    border-color: #5f6787;
}
.category-button.selected {
    background-color: #00bcd4; /* Teal for selected category */
    border-color: #00acc1;
    color: #ffffff;
    font-weight: 500;
}

/* Location Checkbox Styles */
#locationsGameSelection {
    border: 1px solid #3a3f5e;
    padding: 15px;
    border-radius: 8px;
    margin-top: 15px;
    background-color: #2a2c44;
}
.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); /* Responsive grid */
    gap: 10px;
    margin-bottom: 15px;
    max-height: 200px; /* Limit height and allow scroll */
    overflow-y: auto;
    padding: 5px;
    border: 1px solid #3a3f5e;
    border-radius: 6px;
}
.checkbox-grid label {
    display: flex; /* Align checkbox and text */
    align-items: center;
    padding: 8px;
    background-color: #1e1e32;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
    font-size: 0.9em;
    color: #c0c0c0;
}
.checkbox-grid label:hover {
    background-color: #3a3f5e;
}
.checkbox-grid input[type="checkbox"] {
    margin-right: 8px;
    accent-color: #e94560; /* Style the checkbox itself */
    width: auto; /* Override general input width */
    margin-bottom: 0; /* Override general input margin */
}
.utility-button { /* For Select All / Deselect All / View Possible Locations */
    background-color: #4a4e69;
    color: #e0e0e0;
    padding: 8px 12px;
    font-size: 0.9em;
    margin-right: 10px;
    margin-top: 5px; /* Reset top margin for these utility buttons */
    width: auto; /* Override full-width for these */
}
.utility-button:hover {
    background-color: #5f6787;
}
#viewPossibleLocationsButton { /* Specific for in-game button */
    display: block; /* Make it block to center it */
    margin: 10px auto 15px auto; /* Center it and add some margin */
    width: fit-content; /* Size to content */
}


/* General UI Elements */
.hidden {
    display: none !important;
}

#playerList, #answersList, #voteResultsList, #possibleLocationsList {
    list-style-type: none;
    padding: 0;
    margin-bottom: 18px;
}

#playerList li, #answersList li, #voteResultsList li, #possibleLocationsList li {
    background-color: #1e1e32; 
    padding: 12px 15px; 
    margin-bottom: 8px;
    border-radius: 8px;
    border: 1px solid #3a3f5e; 
    font-size: 1em;
    word-wrap: break-word; 
    color: #c0c0c0;
}
#possibleLocationsList { /* For 2-column display in modal */
    column-count: 2;
    -webkit-column-count: 2;
    -moz-column-count: 2;
    gap: 10px;
}
#possibleLocationsList li {
    break-inside: avoid-column; /* Prevent items from breaking across columns */
    padding: 8px;
    font-size: 0.95em;
}


#answersList li strong, #voteResultsList li strong {
    color: #e94560; 
}

.error-message {
    color: #ff6b6b; 
    font-size: 0.95em;
    margin-top: 10px;
    text-align: center;
    background-color: rgba(255, 107, 107, 0.1);
    padding: 8px;
    border-radius: 6px;
}

#game-room-section > div { 
    margin-bottom: 25px;
    padding: 18px;
    border: 1px solid #3a3f5e;
    border-radius: 12px;
    background-color: #2a2c44; 
}

hr {
    margin: 25px 0;
    border: 0;
    border-top: 1px solid #3a3f5e; 
}

/* Voting Options */
#voting-options button {
    background-color: #00bcd4; 
    color: #ffffff;
    width: calc(50% - 5px); 
    margin-bottom: 10px;
}
#voting-options button:nth-child(odd) {
    margin-right: 10px;
}
#voting-options button:nth-child(even) {
    margin-right: 0;
}
#voting-options button:hover {
    background-color: #00acc1;
}

/* Reveal Area */
#reveal-area {
    background-color: #2c3e50; 
    border-color: #34495e;
}
#revealedMoleName {
    color: #e94560; 
    font-size: 1.3em;
}
#actualSecretWordReveal, #actualLocationReveal {
    font-weight: 500;
    color: #bdc3c7;
}
#actualSecretWordReveal strong, #actualLocationReveal strong {
    color: #ffffff;
}
#actualSecretWordReveal img {
    border: 2px solid #e94560;
}


/* Image Display */
#currentImageDisplay {
    max-width: 100%;
    max-height: 220px; 
    height: auto;
    margin-top: 12px;
    margin-bottom:12px;
    border-radius: 10px; 
    border: 2px solid #4a4e69; 
    display: block;
    margin-left: auto;
    margin-right: auto;
    background-color: #3a3f5e; 
}

/* Modal Styles */
.modal {
    display: flex; 
    align-items: center; 
    justify-content: center; 
    position: fixed; 
    z-index: 1000; 
    left: 0;
    top: 0;
    width: 100%; 
    height: 100%; 
    overflow: auto; 
    background-color: rgba(10, 10, 20, 0.8); 
    backdrop-filter: blur(5px); 
}

.modal-content {
    background-color: #24263b; 
    padding: 30px;
    border: 1px solid #3a3f5e;
    width: 90%; 
    max-width: 700px; 
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    position: relative; 
    max-height: 90vh; 
    overflow-y: auto; 
    text-align: left; 
    color: #e0e0e0; 
}

#leaveGameConfirmModal .modal-content, #possibleLocationsModal .modal-content { /* Apply to both specific modals */
    max-width: 450px; 
    text-align: center; 
}
#leaveGameConfirmModal .modal-content p {
    text-align: center;
    margin-bottom: 25px;
    font-size: 1.05em;
}
#leaveGameConfirmModal .modal-content div[style*="text-align: right"] { 
    text-align: center !important; 
}
#leaveGameConfirmModal .modal-content div[style*="text-align: right"] button {
    width: auto; 
    margin: 8px; 
    padding: 12px 20px;
}
#confirmLeaveGameButton { 
    background-color: #c0392b;
}
#confirmLeaveGameButton:hover {
    background-color: #a93226;
}
#cancelLeaveGameButton { 
    background-color: #4a4e69;
}
#cancelLeaveGameButton:hover {
    background-color: #5f6787;
}


.modal-content h2, .modal-content h3 {
    color: #e94560; 
    margin-top: 0;
    text-align: center; 
}
#howToPlayModal .modal-content h2, #howToPlayModal .modal-content h3,
#possibleLocationsModal .modal-content h2 { /* Keep HowToPlay and PossibleLocations titles left-aligned */
    text-align: left; 
    color: #ffffff; 
}
#howToPlayModal .modal-content h3 {
    border-bottom-color: #4a4e69;
}

.modal-content p, .modal-content li {
    font-size: 1em;
    line-height: 1.7;
    color: #bdc3c7; 
}
.modal-content ol {
    padding-left: 25px;
}
.modal-content hr {
    margin: 30px 0;
    border-top-color: #4a4e69;
}

.close-button {
    color: #8c8c8e;
    position: absolute;
    top: 15px;
    right: 25px;
    font-size: 32px;
    font-weight: bold;
    transition: color 0.2s;
}
.close-button:hover,
.close-button:focus {
    color: #ffffff;
    text-decoration: none;
    cursor: pointer;
}

/* Responsive Adjustments */
@media (min-width: 480px) {
    #createGameButton, #joinGameButton, #confirmGameSetupButton, #setNameButton, #startGameButton, #submitAnswerButton, #changeNameButton, #readyButton, #playAgainButton, #backToLobbyButton, #howToPlayButton, #leaveGameButton {
        width: auto; 
        margin-right: 10px; 
        margin-bottom: 0; 
    }
     .mode-button {
        width: auto; 
        padding: 12px 20px;
    }
    .category-button {
        flex-grow: 0; 
        width: auto;
    }
    .utility-button {
        width: auto;
        margin-bottom: 0;
    }
    #voting-options button {
        width: auto; 
        padding: 12px 20px;
    }
}

p, span, li, label, input, textarea, button {
    line-height: 1.6;
}

/* Countdown Display Specific Style */
#countdownDisplay {
    font-size: 1.3em; 
    color: #e94560; 
    font-weight: bold;
    padding: 5px 0;
}

/* Player role display style */
#playerRole {
    font-weight: bold;
    color: #00bcd4; 
    margin-bottom: 10px;
    text-align: center;
}
#moleCategoryHint {
    font-weight: bold;
    color: #00bcd4; 
    margin-bottom: 10px;
    text-align: center;
    font-size: 0.95em;
}


/* General paragraph styling within sections */
#game-room-section p {
    color: #bdc3c7;
    margin-bottom: 10px;
}
#game-room-section p strong {
    color: #e0e0e0;
}

/* Developer Credit Style */
#developer-credit {
    text-align: center;
    margin-top: 30px; 
    padding-top: 15px; 
    font-size: 0.85em;
    color: #a7a9be; 
    border-top: 1px solid #3a3f5e; 
}
