/* Basic Reset & Body Styling */
:root {
    /* Light Theme Variables */
    --bg-color: #eef7f6;
    --text-color: #333;
    --header-bg: #4a7c59;
    --header-text: #ffffff;
    --footer-bg: #f8f9fa;
    --footer-text: #666;
    --card-bg: #ffffff; /* Landing page container, content area */
    --card-border: #e0e0e0;
    --card-shadow: rgba(0,0,0,0.08);
    --gamemode-card-bg: #f9f9f9;
    --gamemode-card-border: #e0e0e0;
    --heading-color: #4a7c59;
    --subheading-color: #333;
    --paragraph-color: #555;
    --button-primary-bg: #74b49b;
    --button-primary-hover-bg: #5c8d89;
    --button-secondary-bg: #fca311;
    --button-secondary-hover-bg: #e85d04;
    --button-text: #ffffff;
    --button-disabled-bg: #cccccc;
    --button-disabled-text: #888888;
    --border-color: #ddd;
    --link-color: #4a7c59;
    --map-bg-placeholder: #ddd;
    --map-overlay-bg: rgba(255, 255, 255, 0.8);
    --map-overlay-text: #333;
    --result-column-bg: #f9f9f9;
    --result-column-border: #eee;
    --score-color: #e85d04;
    /* --image-focus-outline: #fca311; */ /* REMOVED */

    /* Transitions */
    --transition-speed: 0.3s;
}

/* Dark Theme Variables */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #1a1a1a;
        --text-color: #e0e0e0;
        --header-bg: #2c4a35;
        --header-text: #e0e0e0;
        --footer-bg: #222222;
        --footer-text: #aaaaaa;
        --card-bg: #2a2a2a;
        --card-border: #444444;
        --card-shadow: rgba(0,0,0,0.3);
        --gamemode-card-bg: #333333;
        --gamemode-card-border: #444444;
        --heading-color: #8fcb9b; /* Lighter green */
        --subheading-color: #e0e0e0;
        --paragraph-color: #cccccc;
        --button-primary-bg: #5c8d89;
        --button-primary-hover-bg: #74b49b;
        --button-secondary-bg: #e85d04;
        --button-secondary-hover-bg: #fca311;
        --button-text: #ffffff;
        --button-disabled-bg: #555555;
        --button-disabled-text: #aaaaaa;
        --border-color: #555555;
        --link-color: #8fcb9b;
        --map-bg-placeholder: #444;
        --map-overlay-bg: rgba(0, 0, 0, 0.7);
        --map-overlay-text: #e0e0e0;
        --result-column-bg: #333333;
        --result-column-border: #444444;
        --score-color: #ffb703; /* Lighter orange */
        /* --image-focus-outline: #ffb703; */ /* REMOVED */
    }
}

/* Manual Dark Mode Toggle Class */
body.dark-mode {
    --bg-color: #1a1a1a;
    --text-color: #e0e0e0;
    --header-bg: #2c4a35;
    --header-text: #e0e0e0;
    --footer-bg: #222222;
    --footer-text: #aaaaaa;
    --card-bg: #2a2a2a;
    --card-border: #444444;
    --card-shadow: rgba(0,0,0,0.3);
    --gamemode-card-bg: #333333;
    --gamemode-card-border: #444444;
    --heading-color: #8fcb9b;
    --subheading-color: #e0e0e0;
    --paragraph-color: #cccccc;
    --button-primary-bg: #5c8d89;
    --button-primary-hover-bg: #74b49b;
    --button-secondary-bg: #e85d04;
    --button-secondary-hover-bg: #fca311;
    --button-text: #ffffff;
    --button-disabled-bg: #555555;
    --button-disabled-text: #aaaaaa;
    --border-color: #555555;
    --link-color: #8fcb9b;
    --map-bg-placeholder: #444;
    --map-overlay-bg: rgba(0, 0, 0, 0.7);
    --map-overlay-text: #e0e0e0;
    --result-column-bg: #333333;
    --result-column-border: #444444;
    --score-color: #ffb703;
    /* --image-focus-outline: #ffb703; */ /* REMOVED */
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html, body {
    width: 100%;
    overflow-x: hidden;
    margin: 0;
    padding: 0;
}
body {
    overflow-x: hidden;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: background-color var(--transition-speed) ease, color var(--transition-speed) ease;

  /*
    background-image: url('images/game_preview_placeholder.png');
    background-size: cover; /* Scales the image to cover the entire screen 
    background-position: center center; /* Centers the image
    background-repeat: no-repeat; /* Prevents the image from tiling 
    background-attachment: fixed; /* This is the key property that keeps the image static 
  */
}

header {
    background-color: var(--header-bg);
    color: var(--header-text);
    text-align: center;
    padding: 1em 0;
    box-shadow: 0 3px 6px var(--card-shadow);
    flex-shrink: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

header h1 { margin: 0; font-size: 2em; font-weight: 600; }

#theme-toggle {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    background-color: var(--button-primary-bg);
    color: var(--button-text);
    border: none;
    padding: 8px 12px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9em; 
    line-height: 1; 
    min-width: 40px; 
    text-align: center;
    transition: background-color var(--transition-speed) ease;
}
#theme-toggle:hover {
    background-color: var(--button-primary-hover-bg);
}
/* CSS for theme toggle icons is removed as JS handles it now */

footer {
    padding: 20px 15px;
    font-size: 0.9em;
    color: var(--footer-text);
    border-top: 1px solid var(--border-color);
    background-color: var(--footer-bg);
    margin-top: auto;
}

.footer-content {
    display: flex;
    justify-content: center; /* This now centers the group of items */
    align-items: center;
    flex-wrap: wrap; /* Allows items to stack on very small screens */
    gap: 0 15px; /* 0 vertical gap, 15px horizontal gap */
    max-width: 1200px;
    margin: 0 auto;
    text-align: center;
}

.footer-separator {
    color: var(--footer-text);
    opacity: 0.6; /* Makes the bullet slightly dimmer */
}

.footer-item a {
    color: #4a7c59;
    text-decoration: none;
    transition: color 0.2s ease;
}

.footer-item a:hover {
    text-decoration: underline;
    color: var(--button-primary-hover-bg);
}

/* Landing Page Section Styling */
.landing-container {
    max-width: 900px;
    width: 90%;
    margin: 40px auto 20px;
    padding: 30px;
    background-color: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 10px; box-shadow: 0 4px 12px var(--card-shadow);
    text-align: center;
}
.intro-text h2 { color: var(--heading-color); margin-bottom: 15px; font-size: 1.8em; }
.intro-text p { font-size: 1.1em; color: var(--paragraph-color); max-width: 700px; margin: 0 auto 20px auto; }
.game-preview-image {
    display: block; /* This is needed to allow margin auto to work for centering */
    width: 100%; /* This makes the image responsive on smaller screens */
    max-width: 700px; /* Sets the maximum width to match the paragraph */
    height: auto; /* Maintains the image's aspect ratio */
    margin: 0 auto 20px auto; /* Centers the image and adds space below it */
    border-radius: 5px;
    box-shadow: 0 2px 4px var(--card-shadow);
    border: 1px solid var(--border-color);
}
.gamemode-selection h3 { margin-top: 30px; margin-bottom: 25px; font-size: 1.5em; color: var(--subheading-color); border-bottom: 1px solid var(--result-column-border); padding-bottom: 10px; }
.gamemode-options { display: flex; flex-wrap: wrap; justify-content: center; gap: 25px; }
.gamemode-card {
    background-color: var(--gamemode-card-bg);
    border: 1px solid var(--gamemode-card-border);
    border-radius: 8px; padding: 20px; width: 250px; box-shadow: 0 2px 5px rgba(0,0,0,0.05); transition: transform 0.2s ease, box-shadow 0.2s ease; display: flex; flex-direction: column; justify-content: space-between; }
.gamemode-card:hover { transform: translateY(-3px); box-shadow: 0 4px 8px var(--card-shadow); }
.gamemode-card h4 { margin-top: 0; margin-bottom: 10px; color: var(--button-primary-hover-bg); font-size: 1.3em; }
.gamemode-card p { font-size: 0.95em; color: var(--paragraph-color); flex-grow: 1; margin-bottom: 15px; }
.gamemode-button {
    font-size: 1em; padding: 10px 15px; cursor: pointer;
    background-color: var(--button-primary-bg);
    color: var(--button-text);
    border: none; border-radius: 5px; transition: background-color var(--transition-speed) ease; margin-top: auto; text-decoration: none;}
.gamemode-button:hover:not(:disabled) { background-color: var(--button-primary-hover-bg); }
.gamemode-button:disabled { background-color: var(--button-disabled-bg); color: var(--button-disabled-text); cursor: not-allowed; opacity: 0.7; }
.gamemode-card.placeholder { opacity: 0.6; }
.gamemode-card.placeholder:hover { transform: none; box-shadow: 0 2px 5px rgba(0,0,0,0.05); }

/* Modal Styles */
.modal { /* Base styles for ALL dialogs */
    border: 1px solid var(--border-color); 
    border-radius: 8px; 
    padding: 2em;
    background-color: var(--card-bg); 
    color: var(--text-color);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2); 
    max-width: 500px; 
    width: 90%;
    box-sizing: border-box; 
    margin: 0; /* Remove browser default margin */
}

dialog { 
    display: none; /* Hidden by default */
    position: fixed;
    z-index: 1001; 
}

dialog[open].image-zoom-modal {
  display: block;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

/* Centering for standard modals like Game Mode and Game Over */
dialog[open].modal:not(.image-zoom-modal) { 
    display: block;
    top: 50%;
    left: 0; 
    right: 0; 
    margin-left: auto; 
    margin-right: auto; 
    transform: translateY(-50%); 
}

.modal::backdrop { 
    background-color: rgba(0, 0, 0, 0.6); 
    backdrop-filter: blur(4px); 
}

.modal h2 { margin-top: 0; margin-bottom: 1.5em; text-align: center; color: var(--heading-color); }
.modal-options { border: none; padding: 0; margin: 0 0 1.5em 0; text-align: left; }
.modal-options legend { font-weight: bold; margin-bottom: 1em; color: var(--subheading-color); width: 100%; padding-bottom: 5px; border-bottom: 1px solid var(--border-color); }
.modal-options div { margin-bottom: 0.8em; }
.modal-options input[type="radio"] { opacity: 0; position: fixed; width: 0; }
.modal-options label { display: inline-block; padding: 10px 18px; border: 1px solid var(--border-color); border-radius: 5px; background-color: var(--gamemode-card-bg); cursor: pointer; transition: background-color var(--transition-speed) ease, border-color var(--transition-speed) ease; width: 100%; box-sizing: border-box; text-align: center; }
.modal-options label:hover { background-color: var(--button-primary-hover-bg); border-color: var(--button-primary-hover-bg); color: var(--button-text); }
.modal-options input[type="radio"]:checked + label { background-color: var(--button-primary-bg); border-color: var(--button-primary-bg); color: var(--button-text); font-weight: bold; }
.modal-options input[type="radio"]:focus + label { outline: 2px solid var(--link-color); outline-offset: 2px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 1em; margin-top: 1em; }
.modal-button { padding: 10px 20px; border-radius: 5px; border: none; cursor: pointer; font-size: 1em; transition: background-color var(--transition-speed) ease, opacity var(--transition-speed) ease; }
.modal-button.confirm { background-color: var(--button-primary-bg); color: var(--button-text); }
.modal-button.confirm:hover { background-color: var(--button-primary-hover-bg); }
.modal-button.cancel { background-color: transparent; color: var(--text-color); border: 1px solid var(--border-color); }
body.dark-mode .modal-button.cancel:hover { background-color: rgba(255,255,255,0.1); }
body:not(.dark-mode) .modal-button.cancel:hover { background-color: rgba(0,0,0,0.05); }



.modal h2 { margin-top: 0; margin-bottom: 1.5em; text-align: center; color: var(--heading-color); }
.modal-options { border: none; padding: 0; margin: 0 0 1.5em 0; text-align: left; }
.modal-options legend { font-weight: bold; margin-bottom: 1em; color: var(--subheading-color); width: 100%; padding-bottom: 5px; border-bottom: 1px solid var(--border-color); }
.modal-options div { margin-bottom: 0.8em; }
.modal-options input[type="radio"] { opacity: 0; position: fixed; width: 0; }
.modal-options label { display: inline-block; padding: 10px 18px; border: 1px solid var(--border-color); border-radius: 5px; background-color: var(--gamemode-card-bg); cursor: pointer; transition: background-color var(--transition-speed) ease, border-color var(--transition-speed) ease; width: 100%; box-sizing: border-box; text-align: center; }
.modal-options label:hover { background-color: var(--button-primary-hover-bg); border-color: var(--button-primary-hover-bg); color: var(--button-text); }
.modal-options input[type="radio"]:checked + label { background-color: var(--button-primary-bg); border-color: var(--button-primary-bg); color: var(--button-text); font-weight: bold; }
.modal-options input[type="radio"]:focus + label { outline: 2px solid var(--link-color); outline-offset: 2px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 1em; margin-top: 1em; }
.modal-button { padding: 10px 20px; border-radius: 5px; border: none; cursor: pointer; font-size: 1em; transition: background-color var(--transition-speed) ease, opacity var(--transition-speed) ease; }
.modal-button.confirm { background-color: var(--button-primary-bg); color: var(--button-text); }
.modal-button.confirm:hover { background-color: var(--button-primary-hover-bg); }
.modal-button.cancel { background-color: transparent; color: var(--text-color); border: 1px solid var(--border-color); }
body.dark-mode .modal-button.cancel:hover { background-color: rgba(255,255,255,0.1); }
body:not(.dark-mode) .modal-button.cancel:hover { background-color: rgba(0,0,0,0.05); }


/* --- Image Zoom Modal Styles --- */
/* Base styles for the image zoom dialog */
.image-zoom-modal { 
    max-width: 90vw;
    max-height: 90vh;
    width: auto; /* Let the image define the width */
    height: auto; /* Let the image define the height */
    padding: 0; 
    overflow: hidden; 
    border: none;
    background-color: transparent;
    box-shadow: none;
}

/* Specific centering for the open image zoom dialog */
dialog[open].image-zoom-modal {
    display: flex; /* Use flexbox to center the image inside */
    align-items: center;
    justify-content: center;
    
    /* Use transform for both horizontal and vertical centering */
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

#zoomed-image {
    display: block;
    /* The max-width/height is now effectively controlled by the parent .image-zoom-modal */
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 5px;
}

.zoom-close-button {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 1.8em;
    line-height: 1;
    padding: 0.1em 0.4em;
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;
}
.zoom-close-button:hover {
    background-color: rgba(0, 0, 0, 0.8);
}

.zoom-nav-button {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(0, 0, 0, 0.3);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    z-index: 15;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
    user-select: none; /* Prevents text selection on double click */
    opacity: 0; /* Initially make them invisible */
    transition: opacity 0.2s ease-in-out;
}

.image-zoom-modal:hover .zoom-nav-button {
 opacity: 0.7; /* Optional: Show them on hover for desktop users */
}

.zoom-nav-button:hover {
 opacity: 1; /* Slightly more opaque on hover */
}

.zoom-nav-button:hover {
    background-color: rgba(0, 0, 0, 0.6);
}

#zoom-prev-button {
    left: 20px;
}

#zoom-next-button {
    right: 20px;
}

/* Utility class to hide the buttons when not needed */
.hidden {
    display: none !important;
}


/* Game Layout Styling */
main#game-container.game-layout { display: block; padding: 0; background-color: transparent; box-shadow: none; border-radius: 0; max-width: none; margin: 0; }
#map-section.map-area { 
    height: 450px; 
    max-height: 55vh; 
    width: 100%; 
    position: relative; 
    background-color: var(--map-bg-placeholder);
    border-bottom: none; 
}
#map { height: 100%; width: 100%; border: none; border-radius: 0; }
body.dark-mode #map { filter: brightness(0.8) contrast(1.1) saturate(0.9); }
.map-overlay-instruction { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); background-color: var(--map-overlay-bg); color: var(--map-overlay-text); padding: 5px 15px; border-radius: 15px; z-index: 1000; font-size: 0.9em; box-shadow: 0 1px 3px rgba(0,0,0,0.2); }

#map {
    height: 100%;
    width: 100%;
    border: none;
    border-radius: 0;
    background-color: #1a2d38; /* A dark blue-gray that matches deep ocean water */

    /* This is the key property for touch compatibility */
    touch-action: none;
}

/* This is the new parent container for both buttons. */
.game-button-container {
    /* Use Grid to create a single cell where both buttons will be placed */
    display: grid;
    place-items: center; /* This centers the buttons both horizontally and vertically */

    /* Style the container area */
    background-color: var(--card-bg);
    padding: 10px 0; /* Vertical spacing around the buttons */
    border-top: 1px solid var(--border-color);
}

/* This rule targets both buttons and tells them to occupy the same grid cell,
   effectively stacking them on top of each other. */
.game-button-container > .control-button {
    grid-column: 1 / 1;
    grid-row: 1 / 1;
}

#content-section.content-area { 
    background-color: var(--card-bg); 
    padding: 15px 20px 20px 20px;
    border-top: none; 
}

.content-panel { width: 90%; max-width: 1100px; margin: 0 auto 20px auto; }

/* Animal Info (Guessing Phase) */
#animal-info { text-align: center; }
#animal-info h2 { margin-bottom: 10px; color: var(--heading-color); font-size: 1.5em; }
#animal-binomial-name { font-style: italic; font-weight: normal; font-size: 0.9em; margin-left: 5px; }

/* General Image Container Styles (used by both guess and result image containers) */
.image-container { 
    display: flex; 
    align-items: center; /* Vertically align items if they have different natural heights */
    gap: 10px; 
    margin: 10px auto; 
    width: 100%; 
    box-sizing: border-box;
}

#animal-heading,
#result-title {
    margin-top: 0;
}

/* Specific for Guessing Phase Image Container: Side-by-side */
#guess-image-container {
    flex-direction: row; 
    justify-content: center; 
}

/* Specific for Results Phase Image Container: Stacked */
#result-image-container {
    flex-direction: column; 
    align-items: center; 
}

.animal-image-small {
    display: block;
    /* border: 1px solid var(--border-color); */
    border-radius: 5px;
    /* background-color: var(--gamemode-card-bg); */
    transition: transform 0.2s ease;
    
    /* --- ADD/MODIFY THESE LINES --- */
    width: 100%; /* Make the image fill the container's width */
    object-fit: contain; /* Scale image to be fully visible, maintaining aspect ratio */
    
    /* Ensure a consistent height for both side-by-side images */
    height: 180px; 
}

/* REMOVED: .animal-image-small.image-focused rule */

/* Styling for images within the GUESSING container (side-by-side, same height) */
#guess-image-container .animal-image-small {
    height: 180px; 
    width: auto;   
    max-width: 48%; 
}

.clickable-image { cursor: zoom-in; }
.clickable-image:hover { transform: scale(1.05); }

/* Image Credit Link Styles */
.image-credit-link-container {
    text-align: center;
    margin-top: 8px;
    margin-bottom: 10px;
}
.image-credit-link {
    font-size: 0.8em;
    color: var(--link-color);
    text-decoration: none;
    padding: 2px 5px;
    border-bottom: 1px solid transparent;
    transition: color var(--transition-speed) ease, border-color var(--transition-speed) ease;
}
.image-credit-link:hover,
.image-credit-link:focus {
    color: var(--button-primary-hover-bg);
    border-bottom-color: var(--button-primary-hover-bg);
}

/* Controls Styling */
.controls {
    text-align: center;
    background-color: var(--card-bg); /* Apply card background */
    padding: 15px 0; /* Consistent padding */
    /* margin-top: 0; */ /* Remove top margin to sit flush under map or previous element */
    /* border-bottom: 1px solid var(--border-color); */ /* Optional: add if needed for separation */
}
.control-button {
    font-size: 1.1em;
    padding: 10px 20px;
    margin: 0; /* Margin is no longer needed for positioning */
    cursor: pointer;
    border: none;
    border-radius: 5px;
    transition: background-color var(--transition-speed) ease;
    color: var(--button-text);
    /* Optional: Give them a min-width to prevent size changes */
    min-width: 180px;
    text-align: center;
}

#guess-button { background-color: var(--button-secondary-bg); }
#guess-button:hover:not(:disabled) { background-color: var(--button-secondary-hover-bg); }
#guess-button:disabled { background-color: var(--button-disabled-bg); color: var(--button-disabled-text); cursor: not-allowed; }
.next-button { background-color: var(--button-primary-bg); }
.next-button:hover { background-color: var(--button-primary-hover-bg); }


/* Results Panel Styling */
#results-panel { border-top: none; margin-top: 0; }
.results-columns {
    display: grid;
    gap: 20px;
    /* Mobile First: Defaults to a single column layout */
    grid-template-columns: 1fr;
}

/* This rule for the right-side wrapper is also correct. */
.result-media-score-wrapper {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Base styling for all three content panels */
.result-column {
    padding: 15px;
    background-color: var(--result-column-bg);
    border: 1px solid var(--result-column-border);
    border-radius: 5px;
    display: flex;
    flex-direction: column;
}

@media (min-width: 768px) {
    .results-columns {
        /* On wider screens, switch to the two-column grid */
        grid-template-columns: 1.5fr 1fr;
        /* Stretch columns to be equal height */
        align-items: stretch;
    }

    .image-column {
        /* Allow the image panel to grow to fill vertical space */
        flex-grow: 1;
    }
}

/* --- THIS IS THE KEY CHANGE --- */
/* This makes the image panel a flex container and tells it to grow */

/* This rule now styles ALL h3 headings within the results columns consistently */
.result-column h3 {
    margin-top: 0;
    font-size: 1.5em;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
    margin-bottom: 15px;
}

/* This rule specifically handles the COLOR of the two different headings */
#result-title {
    color: var(--heading-color);
}

.result-column h3:not(#result-title) {
    color: var(--button-primary-hover-bg);
}

#animal-description {
    white-space: pre-wrap; /* This is the key property */
}

/* This targets the container holding the two result images */
#result-image-container {
    display: flex;
    flex-direction: row;
    gap: 10px;
    justify-content: space-evenly;
    align-items: center;
    flex-grow: 1;
}

/* Styles the images inside the results container */
#result-image-container .animal-image-small {
    /* Set a consistent height for alignment */
    height: 150px;

    /* Let the browser calculate the width to maintain the aspect ratio */
    width: auto;

    /* Prevent very wide images from taking up too much space */
    max-width: 45%;

    /* Remove the object-fit property entirely */
    border-radius: 8px;
}

/* Targeting paragraphs within specific result columns for justification */
.info-column p {
    text-align: left;
    flex-grow: 1; /* Ensures the description column can stretch */
}
/* Keep score text left-aligned for readability */
.score-column p {
    text-align: left;
}
.image-column { text-align: center; }
.score-column .feedback-text { /* This class is on p tags in score-column */
    font-weight: bold; 
    margin-bottom: 8px; 
    font-size: 1em; 
    color: var(--text-color);
    /* text-align: justify; */ /* Already handled by .score-column p */
}
.score-column .score-text { /* This class is on p tags in score-column */
    font-size: 1.1em; 
    font-weight: bold; 
    color: var(--score-color);
    /* text-align: justify; */ /* Already handled by .score-column p */
}
.score-column #distance-info { /* This ID is on a p tag in score-column */
    font-size: 0.9em; 
    color: var(--paragraph-color); 
    margin-top: 5px;
    /* text-align: justify; */ /* Already handled by .score-column p */
}

/*-----------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
/* --- STYLES FOR GAME OVER MODAL --- */
.game-over-modal { 
    max-width: 550px; 
    text-align: center;
}
.game-over-content h2 { 
    color: var(--heading-color);
    margin-bottom: 15px;
    font-size: 1.8em; 
}
#final-score-display {
    font-size: 1.6em; 
    font-weight: bold;
    color: var(--score-color);
    margin: 10px 0 20px; 
}
#score-distribution-placeholder {
    text-align: center;
    margin: 20px 0;
    padding: 15px;
    background-color: var(--gamemode-card-bg); 
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-style: italic;
    color: var(--paragraph-color);
}
.share-buttons {
    margin-top: 20px; 
    margin-bottom: 15px; 
    display: flex;
    justify-content: center;
    align-items: center; 
    gap: 10px; 
}
.share-button { 
    display: inline-flex; 
    align-items: center;
    justify-content: center;
    padding: 8px; /* Default padding for icon buttons */
    border-radius: 5px;
    text-decoration: none;
    font-weight: bold;
    transition: opacity 0.2s ease, transform 0.1s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    border: none; 
    cursor: pointer;
    height: 40px; 
    min-width: 40px; 
    box-sizing: border-box; 
}
.share-button img {
    height: 24px; /* Specific height for icons */
    width: auto;  /* Maintain aspect ratio */
    max-width: 100%; 
    max-height: 100%;
    display: block; 
}
.share-button:hover {
    opacity: 0.85;
    transform: translateY(-1px);
}
.x-com-share-button { 
    background-color: #000000; 
    /* width & height are from .share-button */
}

.bmc-button { /* Buy Me a Coffee button */
    background-color: #FFDD00; /* Official BMC yellow */
    /* width & height are from .share-button */
}

.generic-share-button {
    background-color: var(--button-primary-bg); 
    color: var(--button-text);
    padding: 8px 15px; /* More padding for text button */
    font-size: 0.9em; /* Ensure text is visible */
    min-width: auto; /* Allow button to size to its text content */
}
.generic-share-button:hover {
    background-color: var(--button-primary-hover-bg);
}
.game-over-modal .modal-actions {
    margin-top: 20px; /* Space above Play Again/Close buttons */
    display: flex; 
    justify-content: center; 
    gap: 10px; 
}
/* The .modal-button, .modal-button.confirm, .modal-button.cancel styles
   are already defined globally and will apply to the buttons in this modal. */



/*-----------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
/* --- STYLES FOR CREDITS PAGE --- */
.credits-container {
    max-width: 900px;
    margin: 20px auto;
    padding: 20px 30px;
    background-color: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 8px;
}
/* Applied to h1 in header of credits page, and h2 within credits-container */
.credits-container h1, 
.credits-container h2 { 
    color: var(--heading-color);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
    margin-top: 1.5em;
    margin-bottom: 1em;
}
/* Adjust first heading in the container specifically */
.credits-container > h2:first-of-type { 
    margin-top: 0;
}
.credit-entry {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px dashed var(--border-color);
}
.credit-entry:last-of-type {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}
.credit-entry h3 { /* Animal Name */
    margin-top: 0;
    margin-bottom: 8px;
    color: var(--subheading-color);
    font-size: 1.3em;
}
.credit-entry h4 { /* For "Male Image", "Female Image" subheadings */
    margin-top: 10px;
    margin-bottom: 3px;
    font-size: 1em;
    font-weight: bold;
    color: var(--paragraph-color);
}
.credit-entry p {
    margin: 5px 0;
    font-size: 0.95em;
    color: var(--paragraph-color);
}
.credit-entry a {
    color: var(--link-color);
    text-decoration: none;
}
.credit-entry a:hover {
    text-decoration: underline;
}
.back-link-container {
    margin-top: 30px;
    text-align: center;
}

/* --- Pagination Styles --- */

/* The main container for the pagination links */
.pagination {
    margin-top: 40px; /* Adds space above the navigation */
    text-align: center;
    font-size: 1em;
}

/* The wrapper for all the links and text */
.pagination .step-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px; /* Controls spacing between all items */
}

/* Styling for the clickable links (next, previous, first, last) */
.pagination a {
    color: var(--link-color);
    text-decoration: none;
    border: 1px solid var(--border-color);
    padding: 8px 15px;
    border-radius: 5px;
    transition: background-color 0.2s ease, color 0.2s ease;
}

/* Hover effect for the links */
.pagination a:hover {
    background-color: var(--link-color);
    color: var(--button-text, #ffffff); /* Use button text color, default to white */
    border-color: var(--link-color);
}

/* Styling for the non-clickable "Page X of Y" text */
.pagination .current {
    color: var(--paragraph-color);
    font-weight: bold;
    padding: 8px 15px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    #map-section.map-area { height: 300px; max-height: 45vh; }
    .results-columns { flex-direction: column; align-items: center; }
    
    .share-buttons {
        gap: 8px; /* Slightly smaller gap on mobile */
    }
    .share-button {
        height: 36px;
        min-width: 36px;
        padding: 6px;
    }
    .share-button img {
        height: 20px;
    }
    .generic-share-button {
        padding: 6px 10px;
        font-size: 0.85em;
    }
    
    #guess-image-container .animal-image-small {
        height: 150px; 
        max-width: 45%; 
    }

    #theme-toggle { padding: 6px 10px; font-size: 0.8em; right: 10px; }
    header h1 { font-size: 1.8em; }
    .gamemode-options {
    display: flex;
    flex-direction: column; /* Stack cards vertically */
    align-items: center;    /* Center them horizontally */
    gap: 25px;
    }
    .gamemode-card { width: 80%; max-width: 350px; }
}

/*
========================================
--- STYLES FOR HOW-TO-PLAY SECTION ---
========================================
*/

/* The main container for the new block */
.details-container {
    max-width: 900px;
    width: 90%;
    margin: 0 auto 30px auto; /* Provides space between this and the section above */
    padding: 30px;
    background-color: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    box-shadow: 0 4px 12px var(--card-shadow);
}

/* Styling for the headings inside the new block */
.details-container h2 {
    color: var(--heading-color);
    text-align: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
    margin-bottom: 20px;
    margin-top: 0; /* This removes the unwanted space at the top */
}

.details-container h3 {
    color: var(--heading-color);
    text-align: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
    margin-bottom: 20px;
}

.details-container h3 {
    font-size: 1.3em;
    border-bottom: none; /* Sub-headings don't need a border */
    margin-top: 30px;
    margin-bottom: 15px;
}

/* Styling for paragraphs */

.details-content-block {
    max-width: 700px; /* The consistent maximum width for all content */
    width: 90%;       /* Makes it responsive on smaller screens */
    margin-left: auto;
    margin-right: auto;
}

/* We can now simplify the other rules by removing their width/margin properties */

.details-container p {
    font-size: 1.1em;
    color: var(--paragraph-color);
    line-height: 1.7;
    text-align: center;
    margin-bottom: 20px; /* Keep the vertical spacing */
}

.rules-list {
    list-style-type: decimal;
    padding-left: 30px; 
    margin-bottom: 30px; /* Keep the vertical spacing */
}

.rules-list li {
    margin-bottom: 10px;
    font-size: 1em;
    color: var(--paragraph-color);
    line-height: 1.6;
}

.details-images-container {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 30px; /* Add space below the image */
}

.details-images-container img {
    width: 100%; /* The image will now fill the .details-content-block container */
    height: auto;
    border-radius: 5px;
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 4px var(--card-shadow);
}

/* --- Changelog Page Styles --- */
.changelog-container {
    max-width: 900px;
    width: 90%;
    margin: 40px auto;
    padding: 30px;
    background-color: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    box-shadow: 0 4px 12px var(--card-shadow);
}

.changelog-container h2 {
    color: var(--heading-color);
    text-align: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
    margin-top: 0;
    margin-bottom: 30px;
}

.version-entry {
    margin-bottom: 30px;
}

.version-entry h3 {
    color: var(--subheading-color);
    font-size: 1.5em;
    margin-bottom: 15px;
}

.release-date {
    font-size: 0.8em;
    font-weight: normal;
    color: var(--paragraph-color);
    margin-left: 10px;
}

.change-list {
    list-style-type: disc;
    padding-left: 20px;
}

.change-list li {
    margin-bottom: 10px;
    color: var(--paragraph-color);
    line-height: 1.6;
}

.back-link-container {
    text-align: center;
    margin-top: 40px;
}

/* Make the back button link look like other buttons */
.back-link-container a {
    display: inline-block;
    text-decoration: none;
}

/* --- Shrinking Circle Beacon --- */
.shrinking-circle-beacon {
    /* The parent div is just an anchor point, so it's invisible */
    background: transparent;
    border: none;
}

/* We use a pseudo-element to create the visible, animated circle */
.shrinking-circle-beacon::before {
    content: '';
    display: block;
    position: absolute;
    
    /* Center the pseudo-element within its parent div */
    left: 50%;
    top: 50%;
    
    width: 100%;
    height: 100%;
    
    /* Style the ring: a thick, semi-transparent border */
    border: 5px solid rgba(160, 32, 240, 0.7);
    border-radius: 50%;
    
    /* Link to the animation */
    /* It plays once over 4 seconds and then disappears */
    animation: shrink-in 4s ease-out forwards;
}

/* Defines the shrinking and fading animation */
@keyframes shrink-in {
    /* Start state */
    0% {
        transform: translate(-50%, -50%) scale(15);
        opacity: 0.9;
    }

    /* Keep opacity constant until the very end */
    99% {
        opacity: 0.9;
    }
    
    /* End state: shrink and disappear instantly */
    100% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 0;
    }
}

@media (max-width: 768px) {
  .image-zoom-modal {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    border-radius: 0; /* Optional: removes rounded corners for a true full-screen look */
  }

  /* Ensures the image inside also has sharp corners */
  .image-zoom-modal #zoomed-image {
    border-radius: 0; 
  }
}

@media (min-width: 2000px) {
  /* For screens wider than 2000px, increase the max-width of the panels */
  .content-panel {
    max-width: 1600px; /* You can adjust this value to your liking */
  }
}

@media (min-width: 2000px) {
  #map-section.map-area {
    height: 750px;
    max-height: 70vh;
  }
}