/* Style for the 'Start Game' button in the header */
#game-start-button {
    font-size: 14px;
    font-weight: bold;
    color: #3388ff;
    background: #e6f3ff;
    border: 1px solid #3388ff;
    border-radius: 5px;
    padding: 6px 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-left: auto; /* Pushes the button to the right */
}

#game-start-button:hover {
    background: #3388ff;
    color: white;
}

/* --- START OF MODIFICATION: Fix for scrolling on final screens --- */
#container.game-mode-active #details {
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    /* Aligns content to the top, allowing it to overflow and become scrollable */
    justify-content: flex-start; 
    align-items: center;
    text-align: center;
    /* This allows the user to scroll the entire panel if content overflows */
    overflow-y: auto; 
    padding-top: 5vh; /* Adds some space at the top */
}
/* --- END OF MODIFICATION --- */


/* --- In-Game Panel Styles --- */
#game-panel {
    padding: 15px;
    text-align: center;
}

#game-question {
    font-size: 1.4em;
    font-weight: 500;
    margin-bottom: 20px;
    color: #333;
}

#game-answer-progress {
    min-height: 2em; /* Reserve space to prevent layout shift */
    font-size: 1.1em;
    font-style: italic;
    color: #555;
    margin-top: -10px;
    margin-bottom: 15px;
}

/* --- Styles for elements on the map --- */
#game-timer-map-overlay {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1001;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    font-family: 'Courier New', Courier, monospace;
    font-size: 1.8em;
    font-weight: bold;
    padding: 5px 12px;
    border-radius: 5px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    display: none;
}

#game-close-map-button {
    position: absolute;
    bottom: 45px;
    right: 15px;
    z-index: 1001;
    font-size: 13px;
    font-weight: bold;
    color: white;
    background-color: #f44336;
    border: none;
    cursor: pointer;
    padding: 5px 10px;
    transition: background-color 0.2s ease;
    border-radius: 5px;
    box-shadow: 0 1px 5px rgba(0,0,0,0.4);
    display: none;
}

#game-close-map-button:hover {
    background-color: #c62828;
}

/* --- START OF NEW MODIFICATION: Enhanced Score Tracker --- */
#game-score-tracker {
    font-size: 1.2em;
    color: #444;
    margin-bottom: 25px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.score-line {
    padding: 6px 12px;
    border-radius: 4px;
    width: 80%;
    max-width: 200px;
    text-align: center;
}

.score-line-correct {
    border: 1px solid #28a745;
    background-color: #f0fff4;
}

.score-line-progress {
    border: 1px solid #3388ff;
    background-color: #f0f7ff;
}
/* --- END OF NEW MODIFICATION --- */


.feature-toggle.disabled {
    background-color: #f4f4f4;
    border-color: #ddd;
    color: #aaa;
    cursor: not-allowed;
    transform: none;
}

.feature-toggle.disabled:hover {
    background-color: #f4f4f4;
    transform: none;
}

/* --- Confirmation button below the map --- */
#confirm-answer-container {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1001;
    text-align: center;
    display: none;
}

#confirm-answer-btn {
    padding: 12px 30px;
    font-size: 16px;
    font-weight: bold;
    color: white;
    background-color: #28a745;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
}

#confirm-answer-btn:hover {
    background-color: #218838;
    transform: translateY(-2px);
}

/* --- Final Score & Report Screens --- */
#game-final-score-container, #game-report-container {
    text-align: center;
    padding: 20px;
    padding-bottom: 5vh; /* MODIFIED: Added padding for scroll breathing room */
}

/* --- START OF MODIFICATION --- */
#game-final-score-container h2, #game-report-container h2 {
    font-size: 1.8em;
    color: #333;
    margin-bottom: 15px;
    /* Added for alignment consistency with other app headers */
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 2px solid #3388ff;
    padding-bottom: 5px;
    text-align: left; /* Ensure title text aligns left */
}
/* --- END OF MODIFICATION --- */

#game-final-score {
    font-size: 3em;
    font-weight: bold;
    color: #3388ff;
    margin-bottom: 25px;
}

/* --- START OF NEW MODIFICATION: Updated Button Container --- */
.final-actions-container {
    margin-top: 25px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    width: 100%;
}

#game-play-again-btn, #game-change-mode-btn, #game-quit-btn, #game-report-btn {
    padding: 12px 28px;
    font-size: 1.1em;
    font-weight: bold;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 220px;
    max-width: 250px;
    box-sizing: border-box;
    border: 2px solid transparent;
}

#game-change-mode-btn { /* This is the new "Play Again" button */
    background-color: #3388ff;
    color: white;
    border-color: #3388ff;
}
#game-change-mode-btn:hover { background-color: #2968cc; }

#game-quit-btn {
    background-color: #f44336;
    color: white;
    border-color: #f44336;
}
#game-quit-btn:hover { background-color: #c62828; }

#game-report-btn { /* This is now green */
    background-color: #28a745;
    color: white;
    border-color: #28a745;
}
#game-report-btn:hover { background-color: #218838; }
/* --- END OF NEW MODIFICATION --- */


/* --- START OF MODIFICATION: Fix for report scrolling --- */
.report-list {
    list-style: none;
    padding: 0;
    margin-top: 20px;
    text-align: left;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}
/* --- END OF MODIFICATION --- */

.report-item {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 12px;
}

.report-item.incorrect {
    border-left: 5px solid #f44336; /* Red bar */
}

.report-item.correct {
     border-left: 5px solid #28a745; /* Green bar */
}

.report-question {
    font-size: 1.1em;
    margin-bottom: 8px;
    color: #343a40;
}

.report-answer {
    color: #495057;
    font-size: 1em;
    margin-left: 10px;
}


/* --- Styles for Theme Selection and Toggles --- */
.theme-selection-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.theme-category-group {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    max-width: 300px;
}

.collapsible-theme-options {
    background-color: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #dee2e6;
    padding: 15px;
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* --- START OF MODIFICATION: New styles for config screen --- */
.start-theme-game-btn {
    background-color: #3388ff !important;
    color: white !important;
    border-color: #2968cc !important;
    margin-top: 10px;
}

.start-theme-game-btn:hover {
    background-color: #2968cc !important;
}

.config-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 10px;
    padding-left: 10px;
}

.config-options label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1em;
}

.custom-option-label {
    display: flex;
    align-items: center;
    gap: 8px;
}

.custom-option-label input[type="number"] {
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 4px 8px;
}

.custom-option-label input[type="number"]:disabled {
    background-color: #f4f4f4;
    color: #999;
    cursor: not-allowed;
}
/* --- END OF MODIFICATION --- */


.toggle-switch-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.toggle-switch-label {
    font-size: 15px;
    font-weight: 500;
    color: #495057;
}

.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    -webkit-transition: .4s;
    transition: .4s;
    border-radius: 28px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    -webkit-transition: .4s;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #3388ff;
}

input:focus + .slider {
    box-shadow: 0 0 1px #3388ff;
}

input:checked + .slider:before {
    -webkit-transform: translateX(22px);
    -ms-transform: translateX(22px);
    transform: translateX(22px);
}
/* --- START OF MODIFICATION: Styles for Custom Game Screen --- */
#game-custom-theme-container .custom-theme-category {
    background-color: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #dee2e6;
    padding: 15px;
    margin-top: 15px;
}

#game-custom-theme-container .custom-theme-category h3 {
    margin-top: 0;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 1px solid #ccc;
    font-size: 1.2em;
    color: #333;
}

#game-custom-theme-container .toggle-switch-row {
    margin-bottom: 12px;
}

#start-custom-game-btn {
    background-color: #28a745 !important;
    color: white !important;
    border-color: #218838 !important;
    padding: 12px 28px !important;
    font-size: 1.1em !important;
}

#start-custom-game-btn:hover {
    background-color: #218838 !important;
}
/* --- END OF MODIFICATION --- */

/* --- START OF NEW MODIFICATION: Game Navigation Buttons --- */
/* This container is for the buttons inside the details panel (on menu screens) */
.game-navigation-actions {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #f44336; /* Red separator line */
    display: flex;
    justify-content: center;
    gap: 15px;
    width: 100%;
}

/* Base style for ALL nav buttons (in-panel and on-map) is now the smaller, red style */
.game-nav-btn {
    padding: 5px 12px; /* Smaller padding */
    font-size: 12px;   /* Smaller font */
    border-width: 1px; /* Thinner border */
    border-color: #f44336; /* Red border */
    color: #f44336; /* Red text */
    background-color: white;
    border-radius: 5px; /* Sharper corners */
    box-shadow: 0 1px 5px rgba(0,0,0,0.3); /* Subtle shadow */
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
}

.game-nav-btn:hover {
    background-color: #f44336; /* Red background on hover */
    color: white; /* White text on hover */
    border-color: #f44336;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(244, 67, 54, 0.4); /* Reddish shadow on hover */
}

/* This class ONLY handles positioning for the on-map buttons now */
.game-nav-map-btn {
    position: absolute;
    z-index: 1001; /* Above map tiles */
    display: none; /* Hidden by default */
}

#game-map-back-btn {
    bottom: 10px;
    left: 10px;
}

#game-map-home-btn {
    bottom: 10px;
    right: 10px;
}
/* --- END OF NEW MODIFICATION --- */