﻿/* Import the pixel font from Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

html, body {
    overflow-x: hidden;
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Press Start 2P', cursive;
    color: #FFF;
    text-align: center;
    /* RESTORED: Default Background for Gallery/Pond/etc */
    background-image: url('images/background.png');
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center top; /* FIX: Aligns street horizon with ducks at 55vh */
    background-attachment: fixed; /* Keeps bg steady during scroll */
    background-color: #222;
    min-height: 100vh;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    /* RESTORED: Allow scrolling by default */
    overflow-y: auto; 
    overflow-x: hidden;
}

/* --- PHASE 2: SCALABLE GAME STAGE (Desktop) --- */
@media (min-width: 601px) {
    #game-stage {
        position: absolute; 
        top: 0;
        left: 0;
        width: 1536px; 
        height: 695px; 
        transform-origin: 0 0; 
        margin: 0; 
        padding: 0;
        
        /* FIX: Hide initially to prevent "Jump" on load */
        opacity: 0; 
    }

    #game-background {
        position: absolute;
        top: 0; left: 0; width: 100%; height: 100%;
        background-image: url('images/background.png');
        background-size: auto 115%;
        background-repeat: no-repeat;
        background-position: center -103px;
        z-index: 0;

    }

    /* --- TOP NAV LAYOUT --- */
    .top-nav {
        position: absolute; 
        top: 0; left: 0; width: 100%;
        z-index: 800;
        
        /* Ensure the layout spreads out */
        display: flex;
        justify-content: space-between; /* Pushes Left/Right groups to edges */
        align-items: flex-start;
        padding: 20px; /* Internal padding */
        box-sizing: border-box; /* Padding doesn't add to width */
    }

    /* Center the Title relative to the STAGE, not the flexbox */
    .top-nav h1 {
        position: absolute;
        top: 20px;
        left: 50%;
        transform: translateX(-50%);
        margin: 0;
        white-space: nowrap;
    }

    /* Fixed Pixel Positions for 695px Height */
    #game-area {
        position: absolute;
        top: 382px !important;
        left: 0; width: 100%;
        height: 100px;
        z-index: 10;
        overflow: visible !important; /* CRITICAL: Allows ducks to stand "above" the street line */
    }

    #my-duck-area {
        position: absolute;
        top: 268px !important; /* Fixed pixel value */
        left: 0; width: 100%;
        margin-top: 0 !important;
        z-index: 500;
    }
}

/* --- MOBILE FALLBACK (Restore Fluid Layout) --- */
@media (max-width: 600px) {
    body {
        background-image: url('images/background.png');
        background-size: cover;
        background-repeat: no-repeat;
        background-position: center bottom;
        overflow-y: auto;
    }
    #game-background { display: none; }
    #game-stage { width: 100%; height: 100%; }
}


img {
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

h1, h2 {
    text-shadow: 4px 4px #000;
    letter-spacing: 2px;
    margin-top: 20px;
    margin-bottom: 10px;
}

.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: flex-start; /* MODIFIED: Was 'center' */
    padding: 20px;
    position: relative;
    z-index: 800; /* Ensure nav is high */
}

    .top-nav h1 {
        position: absolute;
        top: 20px;
        left: 50%;
        transform: translateX(-50%);
        margin: 0;
    }

/* === MODIFIED: Top-Left Container (COMPACT MODE) === */
/* Fits comfortably under the title without dominating the header */
.nav-links-left {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px; /* Reduced from 10px */
    z-index: 801;
    /* --- COHESION BOX --- */
    background-color: #444;
    border-style: outset;
    border-width: 4px;
    border-color: #888 #333 #333 #888;
    padding: 6px 8px; /* Reduced from 10px to make the box tighter */
    margin-top: -10px;
}

/* --- NEW: Force smaller items INSIDE the left cluster only --- */
.nav-links-left .nav-button {
    font-size: 12px !important; /* Reduced from 14px */
    padding: 6px 8px !important; /* Reduced padding */
    line-height: 1.5; /* Tighter line height */
    height: auto;
}

/* Shrink the coin icon specifically in this header to match */
.nav-links-left #coin-display img {
    width: 16px; /* Reduced from default 24px */
    height: 16px;
}

/* Fine-tune the coin text alignment for the smaller size */
.nav-links-left #coin-display {
    gap: 5px;
}

/* === MODIFIED: Top-Right Container (BOX REMOVED) === */
.nav-links {
    display: flex;
    flex-direction: row; /* Make buttons horizontal */
    align-items: center; /* Vertically center buttons and settings icon */
    gap: 15px;
    z-index: 801;
    margin-top: -8px;
}

/* --- NEW: Style for Gallery Link (to position the "!") --- */
.top-nav .nav-links a[href="gallery.html"],
.mobile-nav-centered a[href="gallery.html"] {
    position: relative; /* Allows the "!" to be positioned inside it */
}

/* --- NEW: Style for the notification "!" icon --- */
.nav-notify-icon {
    position: absolute;
    top: -5px;
    right: -5px;
    color: #FF3333; /* Bright RED */
    text-shadow: 2px 2px #000;
    font-weight: bold;
    font-size: 20px;
    display: inline-block;
    animation: pulse-red 1.2s infinite;
    pointer-events: none; /* So it doesn't block clicks */
}

/* Keyframes for pulsing (copied from gallery.css) */
@keyframes pulse-red {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.4);
        opacity: 0.8;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}
/* --- END NOTIFICATION STYLES --- */


/* Base settings button style */
#settings-btn {
    width: 48px;
    height: 48px;
    cursor: pointer;
    transition: transform 0.4s ease-in-out;
    z-index: 900;
}

    #settings-btn.is-rotated {
        transform: rotate(180deg);
    }

.mobile-nav-centered {
    display: none;
}

#show-bounty-btn-mobile {
    display: none;
}

#game-area {
    background-color: transparent;
    width: 100%;
    height: 100px;
    position: absolute;
    top: 55vh;
    left: 0;
    overflow: hidden;
    z-index: 10;
    pointer-events: none !important; /* The container lets clicks pass through */
}

.marching-duck {
    position: absolute;
    width: 250px;
    cursor: pointer;
    pointer-events: auto !important;
    /* z-index is set dynamically in script.js (100) */
}

#my-duck-area {
    margin-top: calc(51.58vh - 120px); /* This is our fix from last time */
    position: relative;
    z-index: 500; /* Duck display container should be high */
}

#my-duck-display {
    width: 400px;
    height: 300px;
    border: none;
    margin: auto;
    position: relative;
    background-color: transparent;
}

#duck-image-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

    #duck-image-container.is-flipped {
        transform: scaleX(-1);
    }

    #duck-image-container.is-flipped-vertical {
    transform: scaleY(-1);
}

.base-duck-image, .accessory-image {
    position: absolute;
    top: 0;
    /* Desktop styles */
    width: 300px;
    left: 50px;
    /* z-index is set dynamically in script.js (0-80) */
}

/* === MODIFIED: Renamed to #duck-name-display === */
#duck-name-display {
    position: absolute;
    top: 10px;
    left: 0;
    width: 100%;
    margin: 0;
    z-index: 10;
    user-select: none; /* NEW: Prevent text selection */
}

/* === NEW: Styles for the main page name input === */
/* === NEW: Styles for the main page name input === */
#duck-name-input-main {
    /* Copy styles from h2 */
    font-family: 'Press Start 2P', cursive;
    text-shadow: 4px 4px #000;
    letter-spacing: 2px;
    font-size: 1.5em; /* Matches h2 */
    /* Copy styles from other inputs */
    background-color: transparent;
    border: none;
    outline: none;
    color: #FFF; /* <--- ADD THIS LINE */
    text-align: center;
    /* Positioning */
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 80%; /* Make it wide */
    z-index: 10; /* Above duck */
}

button, .nav-button {
    font-family: 'Press Start 2P', cursive;
    font-size: 14px; /* <-- THIS IS THE FIX */
    background-color: #555;
    color: #FFF;
    border-style: outset;
    border-width: 4px;
    border-color: #888 #333 #333 #888;
    padding: 10px 15px;
    cursor: pointer;
    white-space: nowrap;
    text-decoration: none;
    z-index: 900; /* Ensure all buttons are clickable */
}

    button:active, .nav-button:active {
        border-style: inset;
        border-color: #333 #888 #888 #333;
    }

    /* === NEW: Custom disabled style === */
    button.is-disabled, .nav-button.is-disabled {
        background-color: #333; /* Darker grey */
        color: #888; /* Lighter grey text */
        border-style: outset; /* Keep the outset style */
        border-color: #555 #222 #222 #555; /* Darker grey border */
    }

        button.is-disabled:active, .nav-button.is-disabled:active {
            border-style: outset; /* Don't "press" */
            border-color: #555 #222 #222 #555; /* Don't change border */
        }


/* --- NEW: Coin Display Styles --- */
#coin-display {
    display: flex;
    align-items: center;
    gap: 8px; /* Space between coin and number */
    padding-left: 10px;
    padding-right: 10px;
    background-color: #333; /* Darker, non-interactive look */
    border-color: #555 #222 #222 #555;
    cursor: default; /* Not a button */
}

    #coin-display img {
        width: 24px;
        height: 24px;
    }

    /* Override the :active state it inherits from .nav-button */
    #coin-display:active {
        border-style: outset;
        border-color: #555 #222 #222 #555;
    }
/* --- END: Coin Display Styles --- */


/* --- NEW: Container for Duck Buttons --- */
#duck-controls {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 900;
    display: flex; /* Arrange buttons side-by-side */
    gap: 15px; /* Space between them */
    align-items: flex-start; /* Align tops of buttons */
}

/* --- MODIFIED: Removed absolute positioning --- */
#save-to-pond-btn {
    position: relative; /* WAS: absolute */
    bottom: auto; /* WAS: 10px */
    left: auto; /* WAS: 50% */
    transform: none; /* WAS: translateX(-50%) */
    z-index: auto; /* WAS: 900 */
}

/* --- NEW: Style for Sell Button --- */
#sell-duck-btn {
    background-color: #008000; /* Green */
    border-color: #00CC00 #004D00 #004D00 #00CC00;
}

    #sell-duck-btn:active {
        border-color: #004D00 #00CC00 #00CC00 #004D00;
    }
/* --- END: Button Styles --- */

/* === NEW: Wrapper for Sell Button + Value === */
.sell-control {
    display: flex;
    flex-direction: column;
    align-items: center;
}

#sell-value-display {
    font-size: 12px;
    color: #ffd700;
    text-shadow: 2px 2px #000;
    margin-top: 5px; /* Space from button */
    /* Add height so it doesn't jump layout */
    height: 12px;
}


/* --- body.mobile-view block removed --- */


.hidden {
    display: none !important;
}

/* --- REMOVED THE VISIBLE STYLE FOR #content-description --- */


/* Styles for Welcome Popup */
#welcome-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000; /* Ensure popups are highest */
}

#welcome-menu {
    background-color: #444;
    padding: 30px;
    border: 4px double #FFF;
    width: 90%;
    max-width: 600px;
    text-align: center;
}

    #welcome-menu h3 {
        text-shadow: 3px 3px #000;
        margin-top: 0;
    }

    #welcome-menu p {
        font-size: 14px;
        line-height: 1.6;
        margin: 15px 0;
    }

#close-welcome-btn {
    margin-top: 20px;
}
/* END: Styles for Welcome Popup */

#settings-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.75);
    display: flex;
    justify-content: center;
    align-items: flex-start; /* CHANGED: Was center */
    padding-top: 20px;       /* ADDED: Push it down slightly from the very top */
    z-index: 1000; 
}

#settings-menu {
    background-color: #444;
    padding: 20px;
    border: 4px double #FFF;
    width: 450px;
    text-align: center;
    position: relative;
    z-index: 1001;
}

    #settings-menu h3, #settings-menu h4 {
        text-shadow: 2px 2px #000;
    }

#close-settings-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    padding: 0 8px;
    font-size: 20px;
}

#reset-section p {
    font-size: 12px;
    line-height: 1.5;
    margin-bottom: 20px;
}

#reset-section button {
    margin: 5px;
}

#reset-game-btn {
    background-color: #990000;
    border-color: #CC0000 #660000 #660000 #CC0000;
}

    #reset-game-btn:active {
        border-color: #660000 #CC0000 #CC0000 #660000;
    }

#settings-main-view {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.settings-menu-button {
    width: 100%;
    padding: 10px 15px; /* <-- ADDED */
    box-sizing: border-box; /* <-- ADDED (THE FIX) */
}

/* --- NEW: Style for Blog link in settings --- */
#settings-main-view a.settings-menu-button[href="privacy.html"],
#settings-main-view a.settings-menu-button[href="terms.html"],
#settings-main-view a.settings-menu-button[href="blog.html"] {
    color: #1E90FF; /* Bright blue color (Dodger Blue) */
}

    /* Optional: Add a hover effect */
    #settings-main-view a.settings-menu-button[href="privacy.html"]:hover,
    #settings-main-view a.settings-menu-button[href="terms.html"]:hover,
    #settings-main-view a.settings-menu-button[href="blog.html"]:hover {
        color: #87CEFA; /* Lighter blue on hover (Light Sky Blue) */
    }

    /* Optional: Keep the active (pressed) style consistent */
    #settings-main-view a.settings-menu-button[href="privacy.html"]:active,
    #settings-main-view a.settings-menu-button[href="terms.html"]:active,
    #settings-main-view a.settings-menu-button[href="blog.html"]:active {
        color: #FFF; /* Match the regular button active color */
        border-style: inset;
        border-color: #333 #888 #888 #333;
    }
    /* --- END: Style for Privacy Policy link --- */

    /* Optional: Add a hover effect */
    #settings-main-view a.settings-menu-button[href="privacy.html"]:hover {
        color: #87CEFA; /* Lighter blue on hover (Light Sky Blue) */
    }

    /* Optional: Keep the active (pressed) style consistent */
    #settings-main-view a.settings-menu-button[href="privacy.html"]:active {
        color: #FFF; /* Match the regular button active color */
        border-style: inset;
        border-color: #333 #888 #888 #333;
    }
/* --- END: Style for Privacy Policy link --- */


/* --- MODIFIED: REMOVED #upgrades-section --- */
#how-to-play-section, #about-section {
    text-align: left;
    font-size: 11px;
    line-height: 1.6;
}

    /* --- MODIFIED: REMOVED #upgrades-section --- */
    #how-to-play-section h4, #about-section h4 {
        text-align: center;
    }

    #how-to-play-section ul {
        list-style-type: '▸ ';
        padding-left: 20px;
        margin-bottom: 20px;
    }

    /* --- NEW: Style for about section paragraph --- */
    #about-section p {
        margin-bottom: 15px;
    }


/* NEW: Styles for the Contact section */
#contact-section {
    text-align: center;
    font-size: 12px;
    line-height: 1.6;
}

    #contact-section h4 {
        text-align: center;
    }

    #contact-section p {
        margin-bottom: 20px;
    }

.settings-back-btn {
    display: block;
    margin: 20px auto 0;
}

#settings-menu hr {
    border: none;
    border-top: 2px solid #FFF;
    margin: 20px 0;
}

#password-section {
    display: flex;
    justify-content: center;
    gap: 10px;
}

input[type="password"], input[type="number"] {
    font-family: 'Press Start 2P', cursive;
    background-color: #222;
    color: #FFF;
    border-style: inset;
    border-width: 4px;
    border-color: #333 #888 #888 #333;
    padding: 8px;
    text-align: center;
}

#dev-settings-section h4 {
    text-shadow: 2px 2px #000;
    margin-top: 0;
}

.dev-control {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    font-size: 12px;
}

    .dev-control button {
        font-size: 10px;
        padding: 8px;
    }

    .dev-control span {
        font-weight: bold;
    }

    .dev-control input {
        width: 80px;
    }

#dev-mode-trigger {
    position: fixed;
    bottom: 0;
    right: 0;
    width: 20px;
    height: 20px;
    cursor: pointer;
    z-index: 9999;
}

@keyframes pan-off-right {
    from {
        transform: translateX(0);
    }

    to {
        transform: translateX(200%);
    }
}

/* --- pan-off-left-flipped REMOVED --- */

@keyframes pan-on-left {
    from {
        transform: translateX(-200%);
    }

    to {
        transform: translateX(0);
    }
}

#duck-image-container.is-leaving {
    animation: pan-off-right 0.6s ease-in forwards;
}

/* --- .is-ponding REMOVED --- */

#duck-image-container.is-entering {
    animation: pan-on-left 0.6s ease-out;
}

/* --- MOBILE STYLES (Native) --- */
/* --- @media (max-width: 600px) block removed --- */


/* --- DEV MOBILE VIEW STYLES (Dev Setting Only) --- */
/* This block explicitly targets ONLY the dev setting toggle */
/* --- THIS BLOCK WAS DUPLICATED AND HAS BEEN REMOVED --- */


/* --- NEW: STYLES FOR COOKIE CONSENT BANNER --- */
/* --- NEW: STYLES FOR COOKIE CONSENT BANNER --- */
#cookie-consent-banner {
    position: fixed;
    bottom: 20px; /* Moved up from bottom */
    left: 20px; /* Moved in from left */
    width: auto; /* Changed from 100% */
    max-width: 450px; /* Added max width */
    background-color: rgba(0, 0, 0, 0.9);
    border: 4px double #FFF; /* Changed from border-top */
    border-radius: 5px; /* Added for corner style */
    padding: 20px;
    z-index: 3000; /* Highest z-index */
    display: flex;
    flex-direction: column; /* Stack items vertically */
    align-items: flex-start; /* Align to the left */
    box-sizing: border-box; /* Include padding in width */
}

    #cookie-consent-banner p {
        font-size: 12px;
        line-height: 1.5;
        margin: 0;
        margin-bottom: 15px; /* Changed from margin-right */
    }

    /* --- ADD THIS NEW RULE --- */
    #cookie-consent-banner #cookie-consent-accept-btn {
        align-self: center; /* Centers the button in the flex column */
    }
    /* --- END NEW RULE --- */
    /* --- END: STYLES FOR COOKIE CONSENT BANNER --- */
    /* --- END: STYLES FOR COOKIE CONSENT BANNER --- */

    #cookie-consent-banner a {
        color: #3399FF;
        text-decoration: underline;
    }
/* --- END: STYLES FOR COOKIE CONSENT BANNER --- */


/* --- STYLES FOR PACK SHOP POPUP --- */

/* The main "Duck Packs" button in the nav */
#show-packs-btn {
    background-color: #ffd700; /* Gold */
    color: #333; /* Dark text */
    border-color: #ffec8b #c5a100 #c5a100 #ffec8b;
}

    #show-packs-btn:active {
        border-color: #c5a100 #ffec8b #ffec8b #c5a100;
    }

/* --- "pack-overlay" and "pack-menu" styles REMOVED --- */


/* --- STYLES FOR PACK *RESULT* POPUP --- */

/* The overlay (copied from pack-overlay) */
#pack-result-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9); /* Darker */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999; /* Higher than the pack menu */
}

/* The menu (copied from pack-menu) */
#pack-result-menu {
    background-color: #444;
    padding: 20px;
    border: 4px double #FFF;
    width: 450px;
    text-align: center;
    position: relative;
    z-index: 2001;
}

    #pack-result-menu h3 {
        text-shadow: 2px 2px #000;
        margin-top: 0;
    }

/* The square box that will hold the duck preview */
#result-image-wrapper {
    width: 250px;
    height: 250px;
    background-color: #222;
    border: 4px solid #888;
    margin: 20px auto;
    padding: 10px;
}

/* The container for the images */
#result-image-container {
    width: 100%;
    height: 100%;
    position: relative;
}
    /* Images inside the result preview */
    #result-image-container img {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
    }

/* The text "A Top Hat!" */
#result-item-name {
    font-size: 18px;
    color: #ffd700; /* Gold */
    margin-bottom: 20px;
    text-shadow: 2px 2px #000;
}

/* --- "pack-menu" mobile style REMOVED --- */
/* --- @media (max-width: 600px) block removed --- */

/* --- STYLES FOR SHOP BUTTON --- */
#show-shop-btn {
    background-color: #004070; /* Dodger Blue */
    color: #FFF;
    border-color: #87CEFA #104E8B #104E8B #87CEFA;
}

    #show-shop-btn:active {
        border-color: #104E8B #87CEFA #87CEFA #104E8B;
    }

/* Mobile style for the new Shop button */
.mobile-nav-centered #show-shop-btn {
    background-color: #1E90FF;
    color: #FFF;
    border-color: #87CEFA #104E8B #104E8B #87CEFA;
    padding: 8px 12px; /* Match other mobile buttons */
    font-size: 12px; /* Match other mobile buttons */
}

    .mobile-nav-centered #show-shop-btn:active {
        border-color: #104E8B #87CEFA #87CEFA #104E8B;
    }


/* --- STYLES FOR CONSOLIDATED SHOP POPUP --- */

/* The overlay (copied from pack-overlay) */
#shop-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.75);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

/* The popup menu (copied from pack-menu) */
#shop-menu {
    background-color: #444;
    padding: 20px;
    border: 4px double #FFF;
    width: 90%;
    max-width: 1000px; /* User's custom width */
    text-align: center;
    position: relative;
    z-index: 1001;
    /* NEW: Flex column to handle scrolling on mobile */
    display: flex;
    flex-direction: column;
    max-height: 80vh; /* Set max height */
}

    #shop-menu h3 {
        text-shadow: 2px 2px #000;
        margin-top: 0;
        margin-bottom: 5px;
        flex-shrink: 0; /* Don't shrink title */
    }

/* The close button (copied from close-pack-btn) */
#close-shop-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    padding: 0 8px;
    font-size: 20px;
}

/* Timer text */
#shop-timer {
    font-size: 12px;
    color: #ffd700;
    display: block;
    margin-bottom: 15px;
    flex-shrink: 0; /* Don't shrink timer */
}

/* --- FIX: FORCE 4 TABS IN A ROW --- */
.shop-tabs {
    display: flex;
    justify-content: space-between;
    width: 100%;
    gap: 5px; /* Small gap between buttons */
    margin-bottom: 15px; /* Space below tabs */
}

.shop-tab-button {
    flex: 1; /* Force all buttons to take equal width */
    min-width: 0; /* Allow shrinking below content size if needed */
    padding: 10px 5px; /* Reduce side padding to fit text */
    font-size: 10px; /* Slightly smaller text for mobile safety */
    white-space: nowrap; /* Prevent text wrapping */
    overflow: hidden; /* Hide overflow */
    text-overflow: ellipsis; /* ... if text is too long */
    text-align: center;
}

    .shop-tab-button.active {
        background-color: #555; /* Active color */
        border-style: outset;
        border-color: #888 #333 #333 #888;
    }
/* --- END SHOP TAB STYLES --- */

/* --- NEW: SHOP VIEW CONTAINERS --- */
#shop-daily-view,
#shop-packs-view,
#shop-upgrades-view {
    /* NEW: Make containers scrollable */
    flex-grow: 1; /* Fill remaining space */
    overflow-y: auto; /* Add scrollbar if content overflows */
    min-height: 0; /* Flexbox scroll fix */
    /* Styles for the "box" */
    background-color: #222;
    border: 4px inset #333;
    padding: 15px;
}

/* === MODIFIED: Daily Shop container (was #shop-items-container) === */
#shop-items-container {
    display: flex;
    flex-direction: row; /* Horizontal row */
    flex-wrap: wrap; /* Allow wrapping */
    justify-content: space-around; /* Space them out */
    gap: 20px; /* Gap between cards */
    /* REMOVED max-height, overflow, padding, bg, border */
}

/* === MODIFIED: Shop Card styles (no change, just confirming) === */
.shop-card {
    width: 280px;
    background-color: #333;
    border: 4px solid #888;
    padding: 15px 15px 10px 15px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
}
    /* ... (rarity border styles for .shop-card remain the same) ... */
    .shop-card.rarity-common {
        border-color: #00A3FF;
    }

    .shop-card.rarity-uncommon {
        border-color: #33CC33;
    }

    .shop-card.rarity-rare {
        border-color: #FF3333;
    }

    .shop-card.rarity-very-rare {
        border-color: #B233FF;
    }

    .shop-card.rarity-legendary {
        border-color: #FF9900;
    }

    .shop-card.rarity-mythical {
        border-width: 4px;
        border-style: solid;
        border-image: linear-gradient(45deg, #ff0000, #ff7300, #fffb00, #48ff00, #00ffd5, #002bff, #7a00ff, #ff00c8, #ff0000) 1;
        animation: rainbow-border 2s linear infinite;
    }

.shop-card-preview {
    width: 250px;
    height: 250px;
    background-color: transparent;
    position: relative;
    flex-shrink: 0;
}

    .shop-card-preview img {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
    }

.shop-card-info {
    text-align: center;
    position: relative;
    z-index: 2;
    text-shadow: 2px 2px #000, -2px -2px #000, 2px -2px #000, -2px 2px #000;
    margin-top: -60px;
}

    .shop-card-info span {
        font-size: 16px;
        display: block;
    }

    .shop-card-info small {
        font-size: 10px;
    }

.shop-card-buy {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    width: 100%;
    position: relative;
    z-index: 2;
}

.shop-item-price {
    font-size: 14px;
    color: #ffd700;
    text-shadow: 2px 2px #000, -2px -2px #000, 2px -2px #000, -2px 2px #000;
}

.shop-buy-btn {
    font-size: 12px;
    padding: 8px 12px;
    background-color: #008000;
    border-color: #00CC00 #004D00 #004D00 #00CC00;
    width: 100%;
}

.shop-sold-out {
    font-size: 12px;
    padding: 8px 12px;
    background-color: #333;
    border-color: #555 #222 #222 #555;
    color: #888;
    width: 100%;
}
/* --- END DAILY SHOP STYLES --- */


/* --- STYLES FOR PACKS (MOVED INSIDE SHOP) --- */
/* This holds the 3 pack options */
#shop-packs-view #pack-options-container {
    display: flex;
    justify-content: space-around;
    gap: 20px;
    flex-wrap: wrap; /* Allows stacking on mobile */
    /* REMOVED background/border/padding, now on parent */
}

/* This is the clickable card for each pack */
/* This is the clickable card for each pack */
/* This is the clickable card for each pack */
#shop-packs-view .pack-option {
    width: 270px; /* <-- THIS IS THE FIX */
    height: 280px; /* Give the card a fixed height */
    background-color: transparent; /* Container is now see-through */
    border: none; /* Container has no border */
    padding: 0; /* Container has no padding */
    cursor: pointer;
    perspective: 1000px; /* This enables the 3D space for the flip */
}
    /* Hover effect (REMOVED) - The hover is now on the inner card */
    #shop-packs-view .pack-option:hover {
        /* OLD STYLES REMOVED */
    }

    /* Styles for the pack images */
    #shop-packs-view .pack-option img {
        width: 100%;
        max-width: 150px;
    }

    /* The "Bronze Pack" text */
    #shop-packs-view .pack-option p {
        font-size: 16px;
        margin: 10px 0 5px 0;
    }

    /* The "100 Coins" text */
    #shop-packs-view .pack-option span {
        font-size: 14px;
        color: #ffd700; /* Gold */
    }

/* Specific border colors for each pack */
#shop-packs-view #buy-bronze-pack {
    border-color: #cd7f32;
}

#shop-packs-view #buy-silver-pack {
    border-color: #c0c0c0;
}

#shop-packs-view #buy-gold-pack {
    border-color: #ffd700;
}
/* --- END PACK STYLES --- */

/* --- NEW: DASHBOARD SETTINGS MENU --- */
#settings-overlay {
    align-items: center; /* Center vertically */
    padding-top: 0;
}
/* Force link buttons inside settings to be white */
#settings-main-view a.nav-button {
    color: #FFFFFF;
    text-decoration: none;
}

/* Ensure they stay white even after being clicked */
#settings-main-view a.nav-button:visited {
    color: #FFFFFF;
}

/* Keep the hover effect consistent */
#settings-main-view a.nav-button:hover {
    color: #FFFFFF;
}

#settings-menu {
    background-color: #222;
    padding: 0;
    border: 4px double #FFF;
    width: 90%;
    max-width: 850px;
    height: auto;
    max-height: 95vh; /* Increased to 95% of screen height */
    text-align: center;
    position: relative;
    z-index: 1001;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 0 20px rgba(0,0,0,0.8);
}

/* Header Bar */
.settings-header {
    background-color: #444;
    padding: 15px;
    border-bottom: 4px double #FFF;
    display: flex;
    justify-content: center;
    align-items: center;
}

.settings-header h3 {
    margin: 0;
    color: #ffd700;
    text-shadow: 2px 2px #000;
    font-size: 20px;
}

#close-settings-btn {
    top: 12px;
    right: 15px;
    font-size: 24px;
    color: #FFF;
    background: none;
    border: none;
    cursor: pointer;
}
#close-settings-btn:hover {
    color: #FF3333;
}

/* Main Dashboard Grid */
#settings-main-view {
    padding: 20px;
    display: grid;
    grid-template-columns: 1fr 1fr; /* Two columns */
    gap: 20px;
    overflow-y: auto; /* Scroll content if needed */
    max-height: 100%;
}

/* Groups (Cards) */
.settings-group {
    background-color: #333;
    border: 2px solid #555;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.settings-group h4 {
    margin: 0 0 10px 0;
    font-size: 14px;
    color: #87CEFA; /* Light Blue Title */
    text-transform: uppercase;
    border-bottom: 1px dashed #555;
    padding-bottom: 5px;
}

/* Volume Sliders inside the group */
.settings-volume-row {
    display: flex;
    flex-direction: column; /* Stack vertically */
    align-items: center;    /* Center align */
    justify-content: center;
    font-size: 12px;
    margin-bottom: 15px;    /* Space between Music and SFX rows */
    width: 100%;
}

.settings-volume-row label {
    width: 100%;
    text-align: center;     /* Center the text */
    margin-bottom: 19px;     /* Space between text and slider */
    font-weight: bold;
    color: #AAA;            /* Matching the aesthetic */
}

.settings-volume-row input {
    width: 90%;             /* Make slider almost full width */
    flex-grow: 0;
    margin: 0 auto;
}

/* Buttons inside groups */
.settings-group .nav-button {
    font-size: 12px;
    padding: 10px;
    text-align: center;
    background-color: #444;
    width: 100%;
    box-sizing: border-box;
}
.settings-group .nav-button:hover {
    background-color: #555;
}

/* Special Button Colors */
#reset-game-btn {
    background-color: #990000;
    border-color: #CC0000 #660000 #660000 #CC0000;
}
#export-save-btn, #import-save-btn {
    background-color: #004070;
    border-color: #1E90FF #002040 #002040 #1E90FF;
}
/* --- CUSTOM BUTTON STYLING (Support the Dev & Social Media) --- */

/* 1. Reset Ko-fi Button (Support the Dev) to default gray */
a.settings-menu-button[href*="ko-fi"] {
    background-color: #555 !important;
    border-color: #888 #333 #333 #888 !important;
    color: #FFF !important;
}

a.settings-menu-button[href*="ko-fi"]:active {
    border-style: inset !important;
    border-color: #333 #888 #888 #333 !important;
}

/* 2. Style Social Media (Instagram) Hot Pink */
a.settings-menu-button[href*="instagram"] {
    background-color: #E1306C; /* Hot Pink / Magenta */
    border-color: #FF69B4 #A32051 #A32051 #FF69B4; /* Lighter Pink / Dark Pink */
    color: #FFF;
}

/* FIX: Explicitly set the hover state to prevent gray override */
a.settings-menu-button[href*="instagram"]:hover {
    background-color: #B31E4D; /* Slightly darker pink on hover */
    border-color: #FF69B4 #A32051 #A32051 #FF69B4;
}

a.settings-menu-button[href*="instagram"]:active {
    border-style: inset;
    background-color: #B31E4D;
    border-color: #A32051 #FF69B4 #FF69B4 #A32051;
}
/* --- END CUSTOM BUTTON STYLING --- */

/* Sub-sections (Hidden by default, cover the grid when active) */
#how-to-play-section, #credits-section, #contact-section, #reset-section, #password-section, #dev-settings-section, #volume-section, #privacy-terms-section {
    padding: 20px;
    text-align: left;
    overflow-y: auto;
    height: 100%;
}

/* Mobile Adjustment for Settings */
@media (max-width: 600px) {
    #settings-main-view {
        grid-template-columns: 1fr; /* Single column on mobile */
    }
    #settings-menu {
        width: 95%;
        max-height: 90vh;
    }
}
/* --- END DASHBOARD STYLES --- */

/* --- STYLES FOR UPGRADES (MOVED INSIDE SHOP) --- */
#shop-upgrades-view #upgrades-container {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap; /* Allows stacking on mobile */
    gap: 15px;
    /* REMOVED padding-top, now on parent */
}

#shop-upgrades-view .upgrade-card {
    width: 180px;
    background-color: #333;
    border: 4px solid #00A3FF; /* "Common" blue border */
    padding: 15px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

#shop-upgrades-view .upgrade-icon {
    width: 48px;
    height: 48px;
    margin-bottom: 5px;
}

#shop-upgrades-view .upgrade-title {
    font-size: 14px;
    text-shadow: 2px 2px #000;
    color: #FFF;
    height: 14px;
}

#shop-upgrades-view .upgrade-info {
    font-size: 12px;
    color: #AAA;
    height: 12px;
}

#shop-upgrades-view .upgrade-buy-btn {
    font-size: 12px;
    padding: 8px 12px;
    width: 100%;
    background-color: #008000; /* Green */
    border-color: #00CC00 #004D00 #004D00 #00CC00;
}

    #shop-upgrades-view .upgrade-buy-btn:active {
        border-color: #004D00 #00CC00 #00CC00 #004D00;
    }
/* === END UPGRADE STYLES === */


/* === FIX: Disabled Sell Button Style === */
/* This is more specific, so it overrides the green */

#sell-duck-btn.is-disabled,
#sell-duck-btn-popup.is-disabled {
    background-color: #333; /* Darker grey */
    color: #888; /* Lighter grey text */
    border-color: #555 #222 #222 #555; /* Darker grey border */
}

    #sell-duck-btn.is-disabled:active,
    #sell-duck-btn-popup.is-disabled:active {
        border-style: outset; /* Don't "press" */
        border-color: #555 #222 #222 #555; /* Don't change border */
    }

/* --- STYLES FOR NOTICE POPUP --- */
#notice-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2500; /* Higher than other popups */
}

#notice-menu {
    background-color: #444;
    padding: 30px;
    border: 4px double #FFF;
    width: 90%;
    max-width: 500px;
    text-align: center;
}

    #notice-menu h3 {
        text-shadow: 3px 3px #000;
        margin-top: 0;
    }

    #notice-menu p {
        font-size: 14px;
        line-height: 1.6;
        margin: 15px 0 20px 0;
    }

/* --- @media (max-width: 600px) block removed --- */

/* --- NEW: Styles for Result Popup Buttons --- */
#pack-result-menu .popup-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
    width: 100%;
    margin-top: 15px;
}

#equip-result-btn {
    background-color: #008000; /* Green */
    border-color: #00CC00 #004D00 #004D00 #00CC00;
}

    #equip-result-btn:active {
        border-color: #004D00 #00CC00 #00CC00 #004D00;
    }

#send-result-to-pond-btn {
    background-color: #1E90FF; /* Blue */
    border-color: #87CEFA #104E8B #104E8B #87CEFA;
}

    #send-result-to-pond-btn:active {
        border-color: #104E8B #87CEFA #87CEFA #104E8B;
    }

/* --- NEW: Style for the sell value coin icon --- */
#sell-value-coin-icon {
    width: 14px;
    height: 14px;
    vertical-align: middle;
    margin-left: 4px;
    margin-bottom: 4px; /* Fine-tune vertical alignment */
}

/* --- MODIFIED: Renamed from #sell-value-display --- */
#sell-charge-display {
    z-index: 1000;
    font-size: 10px;
    color: #FFF; /* Changed from gold to grey */
    text-shadow: 2px 2px #000;
    margin-top: -15px; /* Space from button */
    height: 12px;
}

/* --- NEW: Style for the sell value coin icon (inside buttons) --- */
#sell-duck-btn img, #sell-duck-btn-popup img {
    width: 14px;
    height: 14px;
    vertical-align: middle;
    margin-left: 13px;
    margin-right: 4px;
    margin-bottom: 4px; /* Fine-tune vertical alignment */
}

/* --- NEW: Wrapper for pond sell button --- */
.sell-control-popup {
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* --- NEW: Text below pond sell button --- */
#sell-charge-display-popup {
    font-size: 12px;
    color: #AAA; /* Grey, same as main page */
    text-shadow: 2px 2px #000;
    margin-top: 5px;
    height: 12px;
}


/* === STYLES FOR UPGRADE CARDS (REMOVED FROM GLOBAL) === */


/* --- ACHIEVEMENT TOAST STYLES --- */
#achievement-toast {
    position: fixed;
    bottom: 20px;
    right: 20px; /* MODIFIED: Start in final X position */
    width: 300px;
    background-color: #333;
    border: 4px double #ffd700; /* Gold border */
    padding: 15px;
    z-index: 5000; /* Highest priority */
    text-align: left;
    /* --- MODIFIED ANIMATION --- */
    opacity: 0;
    transform: translateX(calc(100% + 20px)); /* Fly in from right */
    transition: transform 0.5s ease-out, opacity 0.5s ease-out;
    pointer-events: none; /* Allow clicks through when hidden */
}

    #achievement-toast.is-visible {
        opacity: 1;
        transform: translateX(0); /* Slide to final position */
        pointer-events: auto; /* Allow clicks when visible */
    }

    #achievement-toast h3 {
        margin: 0 0 10px 0;
        font-size: 14px;
        color: #ffd700; /* Gold */
        text-shadow: 2px 2px #000;
    }

    #achievement-toast p {
        font-size: 12px;
        margin: 0;
        line-height: 1.4;
    }

/* --- @media (max-width: 600px) block removed --- */
/* --- END ACHIEVEMENT TOAST STYLES --- */

/* --- NEW: ACHIEVEMENT *POPUP* STYLES --- */

/* The main overlay (copied from shop-overlay) */
#achievements-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.75);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000; /* Same as other popups */
}

/* The popup menu itself (copied from shop-menu) */
#achievements-menu {
    background-color: #444;
    padding: 20px;
    border: 4px double #FFF;
    width: 90%;
    max-width: 900px; /* Nice and wide */
    min-height: 500px; /* Taller */
    max-height: 80vh; /* Max 80% of viewport height */
    text-align: center;
    position: relative;
    z-index: 1001;
    display: flex; /* NEW: Use flex to make list container grow */
    flex-direction: column; /* NEW: Stack title and list */
}

    #achievements-menu h3 {
        text-shadow: 2px 2px #000;
        margin-top: 0;
        margin-bottom: 15px; /* Space below title */
        flex-shrink: 0; /* Don't shrink the title */
    }

/* The close button (copied from close-shop-btn) */
#close-achievements-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    padding: 0 8px;
    font-size: 20px;
}

/* Container for the scrollable list */
#achievements-list-container {
    flex-grow: 1; /* NEW: Make this container fill the space */
    min-height: 0; /* NEW: Fix for flex scroll */
    max-height: none; /* REMOVED: No longer need a fixed max-height */
    overflow-y: auto;
    background-color: #222;
    border: 4px inset #333;
    padding: 10px;
    margin-bottom: 0; /* REMOVED: No longer need margin-bottom */
}

/* Individual achievement item */
.achievement-item {
    background-color: #333;
    padding: 10px;
    margin-bottom: 8px;
    border-left: 5px solid #555; /* Default "locked" border */
}

    .achievement-item.is-unlocked {
        border-left: 5px solid #ffd700; /* Gold "unlocked" border */
    }

    .achievement-item h5 {
        font-size: 14px;
        margin: 0 0 5px 0;
        text-shadow: 2px 2px #000;
        color: #FFF; /* Default title color */
    }

    .achievement-item.is-unlocked h5 {
        color: #ffd700; /* Gold title for unlocked */
    }

    .achievement-item p {
        font-size: 11px;
        margin: 0 0 5px 0;
        color: #AAA; /* Description color */
    }

    .achievement-item .achievement-progress {
        font-size: 10px;
        color: #FFF;
        font-weight: bold;
    }
/* --- END ACHIEVEMENT LIST STYLES --- */

/* --- NEW: ACHIEVEMENT CLAIM BUTTON STYLES --- */
.achievement-claim-btn {
    font-family: 'Press Start 2P', cursive;
    background-color: #008000; /* Green */
    color: #FFF;
    border-style: outset;
    border-width: 4px;
    border-color: #00CC00 #004D00 #004D00 #00CC00;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 12px;
}

    .achievement-claim-btn:active {
        border-style: inset;
        border-color: #004D00 #00CC00 #00CC00 #004D00;
    }

    .achievement-claim-btn img {
        width: 12px;
        height: 12px;
        vertical-align: middle;
        margin-left: 5px;
        margin-bottom: 2px;
    }

.achievement-claimed-text {
    font-size: 12px;
    color: #00CC00; /* Green */
    text-shadow: 2px 2px #000;
}
/* --- END ACHIEVEMENT STYLES --- */

/* --- NEW: ACHIEVEMENT TOAST CLAIM BUTTON --- */
#achievement-toast-claim-wrapper {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed #777;
}

/* Re-use the existing claim button style for the toast */
#achievement-toast-claim-btn {
    font-family: 'Press Start 2P', cursive;
    background-color: #008000; /* Green */
    color: #FFF;
    border-style: outset;
    border-width: 4px;
    border-color: #00CC00 #004D00 #004D00 #00CC00;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 12px;
    width: 100%; /* Make button fill the toast */
}

    #achievement-toast-claim-btn:active {
        border-style: inset;
        border-color: #004D00 #00CC00 #00CC00 #004D00;
    }

    #achievement-toast-claim-btn img {
        width: 12px;
        height: 12px;
        vertical-align: middle;
        margin-left: 5px;
        margin-bottom: 2px;
    }
/* --- END TOAST BUTTON STYLES --- */
/* --- NEW: ACHIEVEMENT TOAST DESCRIPTION --- */
#achievement-toast-desc {
    font-size: 11px;
    color: #AAA; /* Greyer text */
    margin: 5px 0 0 0; /* Add a little space above it */
    line-height: 1.4;
}
/* --- END TOAST DESCRIPTION STYLES --- */

/* --- NEW: SET COMPLETE TOAST STYLES --- */
#set-complete-toast {
    position: fixed;
    bottom: 20px;
    right: 20px; /* MODIFIED: Start in final X position */
    width: 300px;
    background-color: #333;
    border: 4px double #1E90FF; /* Blue border */
    padding: 15px;
    z-index: 4900; /* Just below achievement toast */
    text-align: left;
    /* --- MODIFIED ANIMATION --- */
    opacity: 0;
    transform: translateX(calc(100% + 20px)); /* Fly in from right */
    transition: transform 0.5s ease-out, opacity 0.5s ease-out;
    pointer-events: none; /* Allow clicks through when hidden */
}

    #set-complete-toast.is-visible {
        opacity: 1;
        transform: translateX(0); /* Slide to final position */
        pointer-events: auto; /* Allow clicks when visible */
    }

    #set-complete-toast h3 {
        margin: 0 0 5px 0;
        font-size: 14px;
        color: #87CEFA; /* Light Blue */
        text-shadow: 2px 2px #000;
    }

    #set-complete-toast p {
        font-size: 12px;
        margin: 0;
        line-height: 1.4;
        color: #FFF; /* White text */
    }

/* --- @media (max-width: 600px) block removed --- */
/* --- END SET COMPLETE TOAST STYLES --- */

/* --- NEW: CREDITS SECTION STYLES --- */
#credits-section {
    text-align: left;
    font-size: 12px;
    line-height: 1.6;
    max-height: 400px; /* Give it a max height */
    overflow-y: auto; /* Add scroll if content gets too long */
}

    #credits-section h4 {
        text-align: center;
        margin-bottom: 25px; /* More space below title */
    }

    #credits-section p {
        margin-bottom: 20px;
    }

    /* Style for the roles */
    #credits-section strong {
        color: #ffd700; /* Gold */
        display: block;
        font-size: 14px;
        margin-bottom: 5px;
        text-shadow: 2px 2px #000;
    }
/* --- END CREDITS STYLES --- */
/* --- NEW: Hidden Achievement Toast Theme --- */
#achievement-toast.is-hidden {
    border-color: #00A3FF; /* Blue border */
}

    #achievement-toast.is-hidden h3 {
        color: #87CEFA; /* Light blue title */
    }

/* --- NEW: Hidden Achievement List Theme (in Settings) --- */
.achievement-item.is-hidden {
    border-left: 5px solid #00A3FF; /* Blue border */
}

    .achievement-item.is-hidden h5 {
        color: #87CEFA; /* Light blue */
    }

/* =============================================================================
--- BEGIN CORRECTED CARD FLIP STYLES ---
=============================================================================
*/

/* The inner container that actually flips */
.pack-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.6s;
    transform-style: preserve-3d;
    /* NOTE: backface-visibility is intentionally *NOT* here. 
       It goes on the faces.
    */
}

/* The hover effect that triggers the flip */
#shop-packs-view .pack-option:hover .pack-card-inner {
    transform: rotateY(180deg);
}

/* SHARED properties for both faces */
.pack-card-front,
.pack-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    /* THIS IS THE FIX: This hides the face that is turned away.
       The front face is hidden when it's > 90deg.
       The back face is hidden when it's < 90deg.
    */
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    /* Re-apply the original styling from .pack-option */
    background-color: #222;
    padding: 15px;
    box-sizing: border-box; /* IMPORTANT: Include padding in height/width */
    border: 4px solid #888; /* Default border */
}

/* Specific layout for the FRONT face */
.pack-card-front {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    /* Starts facing forward (transform: rotateY(0deg)) */
}

/* Specific layout for the BACK face */
.pack-card-back {
    transform: rotateY(180deg); /* Starts pre-flipped */

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between; /* Pushes content to top and button to bottom */
}

/* Apply specific border colors to the faces */
#buy-bronze-pack .pack-card-front,
#buy-bronze-pack .pack-card-back {
    border-color: #cd7f32;
}

#buy-silver-pack .pack-card-front,
#buy-silver-pack .pack-card-back {
    border-color: #c0c0c0;
}

#buy-gold-pack .pack-card-front,
#buy-gold-pack .pack-card-back {
    border-color: #ffd700;
}

/* Styling for the new content on the back */
.pack-card-back h5 {
    font-size: 16px;
    text-shadow: 2px 2px #000;
    margin: 5px 0 15px 0;
    text-align: center;
    color: #FFF;
}

.pack-chances {
    list-style-type: '▸ ';
    padding-left: 20px;
    margin: 0;
    font-size: 12px;
    line-height: 1.6;
    text-align: left;
}

    .pack-chances li {
        color: #AAA;
    }
/* --- END CARD FLIP STYLES --- */


/* --- FIX: Set static height on shop menu when packs are active --- */
#shop-menu.packs-tab-active {
    height: 405px;
    max-height: 405px; /* This overrides the flexible 80vh/70vh */
}

/* --- NEW: Pack Buy Button (on back of card) --- */
.pack-buy-btn {
    font-family: 'Press Start 2P', cursive;
    background-color: #008000; /* Green */
    color: #FFF;
    border-style: outset;
    border-width: 4px;
    border-color: #00CC00 #004D00 #004D00 #00CC00;
    padding: 10px 15px;
    cursor: pointer;
    white-space: nowrap;
    text-decoration: none;
    z-index: 900;
    font-size: 14px;
    width: 100%; /* Make button fill width */
}

    .pack-buy-btn:active {
        border-style: inset;
        border-color: #004D00 #00CC00 #00CC00 #004D00;
    }

/* --- NEW: Style for Ko-fi link in settings --- */
#settings-main-view a.settings-menu-button[href*="ko-fi.com"] {
    color: #ffd700; /* Gold */
    background-color: #4e431f; /* Dark gold background */
    border-color: #ffec8b #c5a100 #c5a100 #ffec8b;
}

    #settings-main-view a.settings-menu-button[href*="ko-fi.com"]:hover {
        color: #FFF;
        background-color: #6a5c2a;
    }

    #settings-main-view a.settings-menu-button[href*="ko-fi.com"]:active {
        color: #FFF;
        border-style: inset;
        border-color: #c5a100 #ffec8b #ffec8b #c5a100;
    }
/* --- END: Style for Ko-fi link --- */

/* --- NEW: Site Footer Styles --- */
/* --- NEW: Site Footer Styles --- */
.site-footer {
    width: 100%;
    padding: 5px 15px; /* MODIFIED: Reduced padding */
    margin-top: auto; /* This is the flexbox sticky footer rule */
    background-color: rgba(0, 0, 0, 0.25); /* MODIFIED: Was 0.6 */
    /* border-top: 2px solid #555; <-- REMOVED */
    color: #AAA;
    font-size: 8px;
    text-shadow: 1px 1px #000;
    display: flex;
    flex-wrap: wrap; /* Allow wrapping on small screens */
    justify-content: center;
    align-items: center;
    gap: 15px;
    box-sizing: border-box; /* Include padding in width */
}

    .site-footer a {
        color: #D3D3D3;
        text-decoration: underline;
    }

        .site-footer a:hover {
            color: #ffd700;
        }

    .site-footer span {
        white-space: nowrap;
    }

/* --- MODIFIED: Main Page Footer Override --- */
/* --- MODIFIED: Main Page & Pond Footer Override --- */
#footer-main,
#footer-pond {
    /* margin-top: 0; <-- THIS IS NOW REMOVED */
    padding-top: 10px; /* Reduce padding */
    padding-bottom: 10px; /* Reduce padding */
}

/* --- NEW: Gallery Footer Override --- */
/* This makes the footer text larger on sub-pages */
#footer-gallery {
    font-size: 10px; /* Larger than main page's 8px */
    padding: 15px 20px; /* More padding than main page's 10px */
}

/* --- NEW: VOLUME SETTINGS STYLES --- */
#volume-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 10px 0;
}

.volume-control {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    font-size: 14px;
}

    .volume-control label {
        white-space: nowrap;
    }


/* --- NEW: PIXELATED SLIDER STYLES --- */
input[type="range"] {
    -webkit-appearance: none; /* Hides the default slider */
    appearance: none;
    width: 70%; /* Slider width */
    height: 10px; /* Slider track height */
    background: #222; /* Slider track color */
    border: 2px outset #555;
    outline: none;
    cursor: pointer;
}

    /* --- Slider Thumb (Chrome/Safari) --- */
    input[type="range"]::-webkit-slider-thumb {
        -webkit-appearance: none; /* Hides the default thumb */
        appearance: none;
        width: 15px; /* Thumb width */
        height: 25px; /* Thumb height */
        background: #888; /* Thumb color */
        border: 2px outset #BBB;
        cursor: pointer;
    }

    input[type="range"]:active::-webkit-slider-thumb {
        border-style: inset;
    }

    /* --- Slider Thumb (Firefox) --- */
    input[type="range"]::-moz-range-thumb {
        width: 15px; /* Thumb width */
        height: 25px; /* Thumb height */
        background: #888; /* Thumb color */
        border: 2px outset #BBB;
        cursor: pointer;
    }

    input[type="range"]:active::-moz-range-thumb {
        border-style: inset;
    }


    /* Ensure this is in your style.css */
.marching-duck {
    position: absolute;
    width: 250px;
    height: 250px; /* This gives the element a height to flip around */
    cursor: pointer;
    /* z-index is set dynamically in script.js (100) */
}

/* --- IMPORT SAVE POPUP STYLES --- */
#import-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2600; /* Above notice popup */
}

#import-menu {
    background-color: #444;
    padding: 20px;
    border: 4px double #FFF;
    width: 90%;
    max-width: 500px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#import-menu h3 {
    text-shadow: 2px 2px #000;
    margin-top: 0;
    color: #FFF;
}

#import-save-input {
    font-family: 'Press Start 2P', cursive; /* Match game font */
    font-size: 10px; /* Keep it small so code fits */
    background-color: #222;
    color: #00CC00; /* Hacker green text */
    border: 4px inset #333;
    padding: 10px;
    width: 100%;
    height: 150px; /* Fixed height */
    box-sizing: border-box;
    resize: none; /* Disable resize handle */
    outline: none;
    line-height: 1.5;
}

#confirm-import-btn {
    background-color: #990000; /* Red warning color initially */
    border-color: #CC0000 #660000 #660000 #CC0000;
}
#confirm-import-btn:active {
     border-color: #660000 #CC0000 #CC0000 #660000;
}

/* ... existing css ... */

/* --- NEW: Instagram Popup Animation (Polished) --- */
#insta-popup {
    position: fixed;
    bottom: 20px;
    left: -350px; /* Start off-screen */
    width: 280px;
    
    /* MATCHING THE GAME UI */
    background-color: #444; 
    border: 4px double #FFF;
    box-shadow: 5px 5px 0px #000;
    
    padding: 20px;
    z-index: 3000;
    transition: left 0.5s ease-out;
    display: flex;
    flex-direction: column;
    gap: 15px; /* More space between text and button */
    text-align: center; /* Center the text like the Welcome menu */
}

#insta-popup.slide-in {
    left: 20px;
}

#insta-popup p {
    font-size: 10px; /* Match game text size */
    color: #FFF;
    line-height: 1.6; /* Better readability */
    margin: 0;
    text-shadow: 2px 2px #000; /* Standard game text shadow */
}

#insta-visit-btn {
    background-color: #E1306C; /* Keep Brand Color */
    color: #FFF;
    text-align: center;
    padding: 12px;
    text-decoration: none;
    font-family: 'Press Start 2P', cursive;
    font-size: 10px;
    cursor: pointer;

    /* THE GAME'S 3D BUTTON STYLE */
    border-style: outset;
    border-width: 4px;
    /* Custom 3D shading for the Pink button */
    border-color: #ff99cc #8a1c42 #8a1c42 #ff99cc; 
}

#insta-visit-btn:active {
    /* Pressed state */
    border-style: inset;
    border-color: #8a1c42 #ff99cc #ff99cc #8a1c42;
}

#close-insta-popup {
    position: absolute;
    top: 5px;
    right: 8px;
    background: none;
    border: none;
    color: #AAA;
    font-size: 18px;
    cursor: pointer;
    padding: 0;
    text-shadow: 2px 2px #000;
}

#close-insta-popup:hover {
    color: #FFF;
}

/* --- PRIVACY & TERMS BUTTON FIX --- */
#privacy-terms-section .nav-button {
    padding: 8px 0 !important; /* Slimmer (removed side padding, reduced top/bottom) */
    text-align: center !important; /* Force text to center */
    display: block !important; /* Ensures the button fills the width so centering works */
    width: 100%;
    box-sizing: border-box;
}

/* --- SUPERSIZED BOUNTY BOARD --- */

/* --- BOUNTY BOARD (SCALED DOWN) --- */

/* 1. The Overlay */
#bounty-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* 2. The Wooden Box */
.bounty-board-wrapper {
    background-color: #3e2723;
    background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAYAAACp8Z5+AAAAIklEQVQIW2NkQAKrVq36zwjjgzjwqkJYhDAMANIlKBJwKQBUCBN38/1+7wAAAABJRU5ErkJggg==');
    padding: 25px; 
    border: 5px ridge #8d6e63;
    border-radius: 10px;
    width: 90%;
    max-width: 850px; /* Reduced from 1000px */
    text-align: center;
    color: white;
    box-shadow: 0 0 30px #000;
}

.bounty-board-wrapper h2 {
    font-size: 28px; /* Slightly smaller title */
    margin-bottom: 15px;
    text-shadow: 2px 2px 0 #000;
}

/* Subtitle Style */
.bounty-subtitle {
    color: #ffcc80;
    font-size: 14px;
    margin-top: -10px;
    margin-bottom: 20px;
    font-style: italic;
    opacity: 0.9;
    text-shadow: 1px 1px 2px #000;
}

/* --- BOUNTY BOARD VISUAL UPDATE --- */
#bounty-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Ensure the title doesn't get cut off */
#bounty-overlay h2 {
    margin-top: 0;
    font-size: 2rem;
    color: inherit; /* Use the parent color */
}



/* --- 2. THE CONTAINER (Invisible Wrapper) --- */
#bounty-items-container {
    background: transparent !important; /* Invisible, so board shows through */
    
    /* Flex Layout: Put posters in a ROW */
    display: flex;
    flex-direction: row;
    justify-content: center; /* Center them */
    align-items: flex-end; /* Align bottom */
    gap: 15px; /* Space between posters */
    
    width: 100%;
    margin-top: 10px;
}

/* --- 3. THE POSTERS (Poster Sprites) --- */
.bounty-poster {
    /* Layout: 3 posters fit in a row */
    width: 30%;
    min-width: 150px; /* Prevent them from getting too small */
    aspect-ratio: 3 / 4; /* Keeps poster shape consistent */
    
    /* Remove default styles */
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
    
    /* Background Image is set in JS (poster1, poster2, etc.) */
    background-size: 100% 100%;
    background-repeat: no-repeat;
    
    /* Text alignment inside the poster */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 15px;
    text-align: center;
}


.bounty-poster:nth-child(2) { transform: rotate(1.5deg); }
.bounty-poster:nth-child(3) { transform: rotate(-1deg); }

.bounty-poster:hover {
    transform: scale(1.05) rotate(0deg) !important;
    z-index: 100;
    box-shadow: 0 10px 20px rgba(0,0,0,0.5);
    cursor: pointer;
}

/* 4. The Header Text */
.poster-header {
    font-family: 'Press Start 2P', cursive;
    font-size: 20px;
    font-weight: 900;
    /* Changed border and text to Very Dark Brown */
    border-bottom: 3px solid #261612; 
    color: #261612; 
    margin-bottom: 10px;
    width: 100%;
    text-align: center;
    letter-spacing: 1px;
}

/* 5. The Mugshot Area */
.poster-image-wrapper {
    position: relative;
    width: 150px; /* Reduced from 200px */
    height: 150px;
    background: #d5ab74;
    border: 3px solid #000000;
    margin-bottom: 5px;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.3);
}

.poster-image-wrapper img {
    position: absolute;
    top: -4vh; left: -5.5vh;
    width: 150%; height: 150%;
    object-fit: contain;
    image-rendering: auto;
}

/* 6. Info & Reward */
.poster-info {
    width: 100%;
    text-align: center;
    /* Added Very Dark Brown color for the duck Name/Description */
    color: #261612; 
}

.poster-info div:first-child {
    font-size: 0.75rem !important;
    font-weight: bold;
    margin-bottom: 5px;
}

.poster-reward {
    color: #c62828;
    font-weight: 900;
    font-size: 1.1rem; /* Reduced from 1.4rem */
    text-transform: uppercase;
    background: rgba(255, 255, 255, 0.0);
    padding: 3px;
    border-radius: 4px;
}

/* Mobile: Scale down slightly but keep them dominant */
@media (max-width: 800px) {
    .bounty-poster {
        width: 180px;
    }
    .poster-image-wrapper {
        width: 140px;
        height: 140px;
    }
    .poster-header { font-size: 18px; }
}

.bounty-subtitle {
    color: #ffcc80; /* Light wood color */
    font-size: 14px;
    margin-top: -15px; /* Pulls it closer to the H2 title */
    margin-bottom: 25px; /* Pushes the posters down slightly */
    font-style: italic;
    opacity: 0.9;
    text-shadow: 1px 1px 2px #000;
}

/* --- BOUNTY BUTTON STATE --- */
#sell-duck-btn.bounty-active {
    background-color: #D32F2F !important; /* Bright Red */
    border-bottom: 4px solid #B71C1C !important;
    animation: pulse-red 1.5s infinite;
    box-shadow: 0 0 15px #FF5252;
}

@keyframes pulse-red {
    0% { transform: scale(1); box-shadow: 0 0 10px #D32F2F; }
    50% { transform: scale(1.05); box-shadow: 0 0 20px #FF5252; }
    100% { transform: scale(1); box-shadow: 0 0 10px #D32F2F; }
}

/* --- VENATUS INTEGRATION --- */
/* We are using the Venatus TCF 2.0 CMP. 
   We must hide our custom banner to prevent double-popups. */
#cookie-consent-banner {
    display: none !important;
}

/* --- GOOGLE TRANSLATE FORCED OVERRIDES --- */

/* 1. HIDE THE TOP BANNER (Targeting all known IDs/Classes) */
iframe.goog-te-banner-frame {
    display: none !important;
    width: 0px !important;
    height: 0px !important;
    visibility: hidden !important;
}

.goog-te-banner-frame {
    display: none !important;
}


/* 3. HIDE POPUPS & TOOLTIPS (The "Original Text" hover) */
.goog-tooltip {
    display: none !important;
}

.goog-tooltip:hover {
    display: none !important;
}

.goog-text-highlight {
    background-color: transparent !important;
    border: none !important; 
    box-shadow: none !important;
}

/* 4. STYLE THE DROPDOWN (Targeting Generic + Simple classes) */
#google_translate_element {
    text-align: center;
    margin-bottom: 5px;
}

/* Target the generic container to ensure it looks like a button */
.goog-te-gadget-simple,
.goog-te-gadget-icon,
.goog-te-gadget {
    font-family: 'Press Start 2P', cursive !important;
    font-size: 10px !important;
    color: #FFF !important;
}

/* Hide the "Powered by Google" text */
.goog-te-gadget {
    color: transparent !important;
}

/* Force the inner text back to white */
.goog-te-gadget span,
.goog-te-gadget div {
    color: #FFF !important;
    display: inline-block !important;
}

/* Style the actual dropdown box */
.goog-te-gadget-simple {
    background-color: #555 !important;
    border: 4px outset #888 !important;
    padding: 8px !important;
    display: inline-block !important;
    cursor: pointer !important;
}

/* Hide Google Logo */
.goog-te-gadget img, 
.goog-te-gadget-simple img,
.goog-te-gadget-icon {
    display: none !important;
}

/* Style the actual dropdown box */
.goog-te-gadget-simple {
    /* Typography matching .nav-button */
    font-family: 'Press Start 2P', cursive !important;
    font-size: 12px !important; /* Matches Settings group buttons */
    color: #FFF !important;
    text-align: center !important;
    line-height: normal !important;

    /* Box Model - The "Robust" Responsive Logic */
    display: block !important;       /* Forces it to be a block element */
    width: 100% !important;          /* Fills the container width */
    box-sizing: border-box !important; /* Keeps padding inside the width */
    margin: -1.5vh !important;
    padding: 10px !important;        /* Matches your standard button padding */

    /* The 3D Button Look */
    background-color: #474747 !important;
    border-style: outset !important;
    border-width: 4px !important;
    border-color: #888 #333 #333 #888 !important;
    border-radius: 0 !important;     /* Removes any Google rounded corners */
    cursor: pointer !important;
    z-index: 2000 !important;
}

/* Add the "pressed" effect on click */
.goog-te-gadget-simple:active {
    border-style: inset !important;
    border-color: #333 #888 #888 #333 !important;
}

/* --- GLOBAL STAT CARD STYLES (Used in Pond & Shop) --- */
.stat-card {
    background-color: #333;
    border: 2px solid #555;
    padding: 10px;
    margin-bottom: 10px;
    text-align: left;
}

.stat-card-header {
    font-size: 14px;
    font-weight: bold;
    color: #FFF;
    text-shadow: 2px 2px #000;
    border-bottom: 1px dashed #777;
    padding-bottom: 5px;
    margin-bottom: 5px;
}

.stat-card-header.is-gold {
    color: #ffd700; /* Gold */
}

.stat-row {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    line-height: 1.8;
}

.stat-row .label {
    color: #CCC;
}

.stat-row .value {
    font-weight: bold;
}

.stat-row .value.positive { color: #33CC33; text-shadow: 1px 1px #000; }
.stat-row .value.negative { color: #FF3333; text-shadow: 1px 1px #000; }

.stat-breakdown-separator {
    font-size: 10px;
    color: #AAA;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 15px 0 10px 0;
    border-bottom: 1px dashed #555;
    padding-bottom: 5px;
    cursor: pointer;
    user-select: none;
}

.stat-breakdown-separator::after {
    content: ' ▼';
    display: inline-block;
    transition: transform 0.2s;
}

.stat-breakdown-separator.is-collapsed::after {
    transform: rotate(-90deg);
}

.stat-breakdown-content.is-collapsed {
    display: none;
}

.shiny-anim {
  animation: shinyPulse 1.6s infinite alternate ease-in-out;
}

@keyframes shinyPulse {
  from { filter: hue-rotate(0deg); }
  to   { filter: hue-rotate(180deg); }
}


/* --- MIGRATION POPUP STYLES --- */
#migration-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 3000; /* Highest priority */
}

#migration-menu {
    background-color: #222;
    padding: 30px;
    border: 4px double #ffd700; /* Gold border */
    width: 90%;
    max-width: 500px;
    text-align: center;
    color: #FFF;
}

#migration-menu h3 {
    color: #ffd700;
    text-shadow: 2px 2px #000;
    margin-top: 0;
}

.warning-text {
    color: #FF3333; /* Red warning */
    font-weight: bold;
    margin: 15px 0;
    font-size: 12px;
}

#migration-gain-list {
    text-align: left;
    background-color: #333;
    padding: 15px 15px 15px 35px;
    border: 2px inset #555;
    margin: 10px 0 20px 0;
    font-size: 12px;
    line-height: 1.6;
}

#migration-gain-list li {
    color: #33CC33; /* Green text */
}

#confirm-migration-btn {
    background-color: #990000; /* Scary Red Button */
    border-color: #CC0000 #660000 #660000 #CC0000;
    font-weight: bold;
}

#confirm-migration-btn:active {
    border-color: #660000 #CC0000 #CC0000 #660000;
}

@media (min-width: 601px) {
    #game-stage #footer-main {
        position: absolute;
        bottom: 0;
        left: 0;
        width: 100%;
        z-index: 600; /* Above background, below nav/popups */
        background-color: rgba(0, 0, 0, 0.25); /* Ensure visibility */
        padding: 5px 0; /* Compact padding */
    }
}

/* --- SURGICAL INJECTION: Top Nav Collision Fix --- */
/* Handles screens where the top bar is too narrow for absolute centering */
@media (min-width: 601px) and (max-width: 1350px) {
    
    /* 1. Stop the Title from floating over buttons */
    .top-nav h1 {
        position: static;      /* Puts it back in the flow */
        transform: none;       /* Removes the centering offset */
        margin: 0 10px;        /* Give it breathing room */
        font-size: 30px;       /* Shrink text slightly */
        flex-shrink: 0;        /* Prevent title from crushing */
        white-space: nowrap;   /* Don't let title wrap lines */
    }

    /* 2. Shrink Buttons & Coins to save space */
    .top-nav .nav-button,
    #coin-display {
        font-size: 10px;       /* Smaller text */
        padding: 8px 8px;      /* Tighter padding */
    }

    /* 3. Ensure the Flex container packs them nicely */
    .top-nav {
        justify-content: space-between; /* Push groups to edges, Title in center */
        align-items: center;            /* Vertical center */
    }
    
    /* 4. Tweak the Left/Right groups */
    .nav-links, .nav-links-left {
        gap: 5px; /* Reduce gap between buttons */
    }
}

/* --- CODE RED FIX: AD OVERLAY CONTAINMENT (FIXED POSITIONING) --- */

/* 1. Target ALL Ad Containers */
#vm-footer,
.venatus-sticky-footer,
div[id*="venatus"],
div[id*="sticky-footer"],
div[id^="vm-"],
.st-adunit,          
.st-reset,           
div[class*="goku"],  
div[class*="sticky-footer"] {
    /* Force the container to have NO height interaction unless it has content */
    height: auto !important;
    max-height: 100px !important; 
    
    /* CRITICAL: This makes clicks pass THROUGH the invisible container */
    pointer-events: none !important;
    
    /* Ensure the CONTAINER sticks to the bottom */
    bottom: 0 !important;
    top: auto !important;
}

/* 2. Re-enable clicks on content BUT DO NOT TOUCH POSITIONING */
#vm-footer iframe, #vm-footer img, #vm-footer a, #vm-footer svg,
.venatus-sticky-footer iframe, .venatus-sticky-footer img,
div[id^="vm-"] iframe, div[id^="vm-"] img,
.st-adunit iframe, .st-adunit img, .st-adunit svg, 
.st-adunit > div,
div[class*="goku"] iframe, div[class*="goku"] > div {
    /* Re-enable clicking for the ad itself */
    pointer-events: auto !important;
    
    /* REMOVED: position: relative !important; <--- THIS WAS THE CULPRIT */
    
    /* We still force Z-Index to ensure it stays visible */
    z-index: 2147483647 !important;
}

/* 3. Nuclear Option: Force Game UI above background layers */
#game-area, 
#my-duck-display, 
.top-nav {
    z-index: 1000 !important; 
}


/* --- INVENTORY TRAY (Cohesive "Black Border" Design) --- */
#inventory-tray {
    position: fixed;
    bottom: 0;
    
    /* ANIMATION: Hides to the left */
    left: 0; 
    transform: translateX(-100%); 
    
    /* SIZE */
    width: 28vw;
    max-width: 320px;
    height: 40vh;
    
    /* VISUALS: Dark Grey Box with Thick Black Border */
    background-color: #333;
    border: 4px solid #000; /* The requested black border */
    border-left: none; /* Open to the left wall */
    
    /* ROUNDED CORNERS: Top-Right and Bottom-Right */
    border-radius: 0 10px 10px 0; 
    
    /* DEPTH: Inner Highlights (Top/Left) and Shadows (Bottom/Right) */
    box-shadow: inset 3px 3px 0px #555, inset -3px -3px 0px #222;
    
    z-index: 2500;
    
    /* ANIMATION SPEED */
    transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1), 
                bottom 0.3s ease-out;
                
    display: flex;
    flex-direction: column;
    margin-bottom: 25px;
}

/* OPEN STATE */
#inventory-tray.open {
    transform: translateX(0);
}

/* ADAPTIVE JUMP (Ad Clearance) */
body.footer-active #inventory-tray {
    bottom: 100px !important;
}

/* --- THE HANDLE (Seamless Fusion) --- */
#inventory-tray-handle {
    position: absolute;
    
    /* POSITIONING: Sticks out to the right */
    right: -44px; /* Width (40) + Border (4) to fully clear */
    bottom: 10%;
    
    /* SIZE */
    width: 40px;
    height: 80px;
    
    /* VISUALS: Match the Tray exactly */
    background-color: #333;
    
    /* BORDER: Black, but remove Left so it merges */
    border: 4px solid #000;
    border-left: none; 
    
    /* ROUNDED: Match the tray style */
    border-radius: 0 10px 10px 0;
    
    /* DEPTH: Inner highlight to match */
    box-shadow: inset 0px 3px 0px #555, inset -3px -3px 0px #222;
    
    cursor: pointer;
    color: #FFF;
    font-family: 'Press Start 2P', cursive;
    font-size: 10px;
    
    display: flex;
    justify-content: center;
    align-items: center;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    
    /* DROP SHADOW: Behind the handle for pop */
    filter: drop-shadow(4px 4px 0 rgba(0,0,0,0.5));
}

/* SEAMLESS PATCH: Covers the tray's border line where handle connects */
#inventory-tray-handle::before {
    content: '';
    position: absolute;
    left: -4px; /* Shift left to cover the tray's right border */
    top: 0;
    width: 6px; /* Wide enough to bridge the gap */
    height: 100%;
    background-color: #333; /* Same color as tray/handle to erase the line */
    z-index: 2;
}

/* HOVER EFFECT: Handle pulls out slightly */
#inventory-tray-handle:hover {
    right: -48px; 
    background-color: #444; /* Lighten slightly */
    transition: right 0.1s, background-color 0.1s;
}

/* Ensure the patch lightens on hover too */
#inventory-tray-handle:hover::before {
    background-color: #444;
}

/* --- ITEM SHOP STYLES --- */
#game-items-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); /* Responsive Grid */
    gap: 15px;
    padding-top: 10px;
}

.item-shop-card {
    background-color: #333;
    border: 4px solid #555;
    display: flex;
    flex-direction: row; /* Horizontal layout */
    align-items: center;
    padding: 10px;
    gap: 15px;
    position: relative;
}

/* Specific Border Colors based on type */
.item-shop-card.type-tool { border-color: #bfa100; } /* Gold */
.item-shop-card.type-consumable { border-color: #1E90FF; } /* Blue */
.item-shop-card.type-gamble { border-color: #FF3333; } /* Red */
.item-shop-card.type-bell { border-color: #FFF; } /* White */

.item-card-icon {
    width: 64px;
    height: 64px;
    background-color: #222;
    border: 2px inset #444;
    padding: 5px;
    image-rendering: pixelated;
    flex-shrink: 0;
}

.item-card-details {
    flex: 1;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.item-card-name {
    font-size: 12px;
    font-weight: bold;
    color: #ffd700;
    text-shadow: 1px 1px 0 #000;
}

.item-card-desc {
    font-size: 8px;
    color: #AAA;
    line-height: 1.4;
}

.item-buy-btn {
    margin-top: 5px;
    font-size: 10px;
    padding: 8px;
    background-color: #008000;
    border-color: #00CC00 #004D00 #004D00 #00CC00;
    width: 100%;
}

.item-buy-btn:active {
    border-style: inset;
}

.item-buy-btn.owned {
    background-color: #555;
    border-color: #777;
    color: #888;
    cursor: default;
    border-style: solid;
}

/* Ensure Item Container Scrolls */
#shop-items-view {
    height: 400px; /* Fixed height container */
    overflow-y: auto; /* Enable scroll */
    padding-right: 5px; /* Space for scrollbar */
}

/* Responsive Grid for Items */
#game-items-container {
    display: grid;
    /* Auto-fit columns: Minimum 250px wide, fill available space */
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); 
    gap: 15px;
    padding-bottom: 20px;
}

/* --- INVENTORY TRAY CONTENT FIX --- */

/* 1. The Container inside the tray */
.tray-content {
    display: grid;
    /* This automatically fits as many 60px items as possible per row */
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr)); 
    gap: 8px; /* Space between items */
    padding: 15px;
    overflow-y: auto; /* Allow scrolling up/down if you have many items */
    height: 100%;
    align-content: start; /* Pack items at the top */
    box-sizing: border-box;
}

/* 2. The Individual Item Card */
.inventory-item {
    background-color: #333;
    border: 3px outset #666;
    border-radius: 4px;
    
    /* STRICTLY LOCK THE BOX SIZE */
    width: 60px !important;  
    height: 60px !important; 
    
    /* REMOVE PADDING so the bigger image fits inside */
    padding: 0 !important; 
    
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    cursor: pointer;
    box-sizing: border-box; /* Ensures borders don't add extra width */
}

.inventory-item:hover {
    border-color: #ffd700; /* Gold hover effect */
    background-color: #444;
}

.inventory-item:active {
    border-style: inset;
}

/* 3. The Icon Image */
.inventory-item img {
    /* 50px image fits inside the 60px box (leaving 5px border/space) */
    width: 50px;  
    height: 50px;
    
    object-fit: contain; 
    image-rendering: pixelated; 
}

/* 4. The Count Number (x5) */
.item-count {
    position: absolute;
    bottom: 2px;
    right: 2px;
    
    background-color: rgba(0, 0, 0, 0.85);
    color: #fff;
    border: 1px solid #999;
    border-radius: 4px;
    
    font-size: 8px;
    padding: 2px 4px;
    pointer-events: none; /* Let clicks pass through to the button */
    font-family: 'Press Start 2P', cursive;
}

/* --- INVENTORY TOOLTIP HOVER FIX (RIGHT SIDE) --- */

.item-tooltip {
    display: none;
    
    /* Position it floating to the RIGHT of the item */
    position: absolute;
    left: 105%; /* <--- CHANGED FROM right: 105% */
    top: 50%;
    transform: translateY(-50%);
    
    /* Styling */
    width: 160px; 
    background-color: rgba(17, 17, 17, 0.98);
    border: 2px solid #ffd700;
    padding: 10px;
    border-radius: 4px;
    z-index: 10000;
    box-shadow: 4px 4px 10px rgba(0,0,0,0.5);
    pointer-events: none;
    
    /* Text */
    color: #fff;
    font-size: 10px;
    line-height: 1.4;
    text-align: left;
    white-space: normal;
}

/* Keep the rest the same */
.inventory-item:hover .item-tooltip {
    display: block;
}

.inventory-item {
    overflow: visible !important;
}

/* Mobile: Force it above or below since "right" might go off-screen */
@media (max-width: 600px) {
    .item-tooltip {
        left: 50%; 
        right: auto;
        top: -100%; /* Pop above */
        transform: translateX(-50%); /* Center horizontally */
        width: 140px;
    }
}

/* --- GLOBAL INVENTORY TOOLTIP (Escapes the Tray) --- */
#global-inventory-tooltip {
    position: fixed;
    z-index: 1000000; /* God-tier z-index to sit above overlays/ads */
    background-color: rgba(17, 17, 17, 0.98);
    border: 2px solid #ffd700;
    padding: 10px;
    border-radius: 4px;
    color: #fff;
    font-family: 'Press Start 2P', cursive;
    font-size: 10px;
    line-height: 1.4;
    text-align: left;
    white-space: normal;
    width: 160px;
    box-shadow: 4px 4px 10px rgba(0,0,0,0.5);
    pointer-events: none; /* Let clicks pass through */
    display: none; /* Hidden by default */
}

#global-inventory-tooltip.is-visible {
    display: block;
}




/* --- TRAFFIC CONTROLLER (Refined Industrial Style) --- */
#traffic-control-ui {
    position: fixed;
    bottom: 20px;
    right: 20px;
    top: auto;
    left: auto;
    
    /* SCALED DOWN SIZES */
    width: 70px;
    height: 280px;
    
    /* Industrial Grey Theme */
    background-color: #222;
    border: 4px outset #888;
    box-shadow: -4px 4px 8px rgba(0,0,0,0.7);
    z-index: 1000;
    
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    box-sizing: border-box;
    margin-bottom: 20px;
}

/* Header Label */
#traffic-control-ui label {
    font-family: 'Press Start 2P', cursive;
    font-size: 8px; /* Smaller font */
    color: #fff;
    text-transform: uppercase;
    text-align: center;
    line-height: 1.4;
    text-shadow: 2px 2px 0 #000;
    margin-bottom: 5px;
    border-bottom: 2px solid #444;
    padding-bottom: 5px;
    width: 80%;
}

/* Digital Speed Readout */
#traffic-value {
    font-family: 'Press Start 2P', cursive;
    font-size: 10px; /* Smaller font */
    color: #fff; 
    text-shadow: 1px 1px 0 #000;
    
    background-color: #000;
    padding: 6px 4px;
    border: 2px inset #555;
    margin-top: 5px;
    width: 45px;
    text-align: center;
}

/* --- VERTICAL SLIDER (The Lever) --- */
#traffic-slider {
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    
    /* Dimensions (Rotated) */
    width: 180px; /* Reduced from 220 */
    height: 40px; /* Reduced touch target */
    
    /* Rotate vertically */
    transform: rotate(270deg);
    
    /* Spacing to compensate for rotation */
    margin: 70px 0; 
    cursor: grab;
}

#traffic-slider:active {
    cursor: grabbing;
}

/* The Track (Groove) */
#traffic-slider::-webkit-slider-runnable-track {
    width: 100%;
    height: 12px; /* Slightly thinner */
    background: #111;
    border: 2px solid #444;
    border-radius: 2px;
    box-shadow: inset 2px 2px 4px #000;
}

/* The Thumb (Red Handle) */
#traffic-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 32px; /* Smaller handle */
    width: 20px;  
    
    /* Red Industrial Lever Style */
    background-color: #cc0000; 
    border: 2px solid #ff6666; 
    border-right-color: #660000;
    border-bottom-color: #660000; 
    
    border-radius: 0;
    margin-top: -12px; /* Center on track */
    box-shadow: 3px 3px 4px rgba(0,0,0,0.5);
}

/* Handle Highlight on click */
#traffic-slider:active::-webkit-slider-thumb {
    background-color: #ff0000;
    transform: scale(0.95);
}

/* Mobile Adjustment */
@media (max-width: 600px) {
    #traffic-control-ui {
        /* Glue to the right edge */
        right: 0px !important;
        
        /* Lower it slightly to match the Duck's standing position */
        bottom: 100px !important; 
        
        /* Optional: Remove the right border/radius so it looks merged with the screen edge */
        border-right: none;
        border-top-right-radius: 0;
        border-bottom-right-radius: 0;

        /* Keep the scale */
        transform: scale(0.9); 
        transform-origin: bottom right;
    }
}



/* --- BUFF UI --- */
#active-buffs-container {
    position: fixed; /* Fixed so it stays on screen even if game scales */
    top: 90px;       /* Adjust vertical position */
    left: 10px;      /* Adjust horizontal position */
    z-index: 1000;
    pointer-events: none; /* Let clicks pass through */
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#battery-buff-wrapper {
    position: relative;
    width: 50px;
    height: 50px;
    display: flex;
    justify-content: center;
    align-items: center;
}

#battery-buff-icon {
    width: 24px;
    height: 24px;
    position: absolute;
    z-index: 1;
}

.buff-ring-svg {
    transform: rotate(-90deg); /* Start from top center */
}

#battery-ring-progress {
    stroke-dasharray: 125.6; /* 2 * PI * r (r=20) ≈ 125.6 */
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 0.1s linear; /* Smoothness */
}

/* --- TRAFFIC CONTROLLER AD JUSTMENT --- */
/* When the footer ad is detected, move the slider up AND squish it vertically */
body.footer-active #traffic-control-ui {
    bottom: 95px !important; /* Move it up to clear the ad */
    transform: scaleY(0.81);   /* Squish it to 70% height so it doesn't block the street */
    transform-origin: bottom right; /* Keep it anchored to the corner */
    transition: bottom 0.3s ease, transform 0.3s ease;
}

/* PERFORMANCE: Skip rendering for off-screen grids */
#gallery-container, 
#sets-container, 
#pond-duck-grid, 
#achievements-gallery-container {
    content-visibility: auto;
    contain-intrinsic-size: 100px 500px; /* Estimated height to prevent scrollbar jumping */
}

/* --- PERFORMANCE: AD ISOLATION (Safe Version) --- */
/* We keep this to stop ADS from lagging the game */
div[id^="slot-"],             
div[id^="venatus-"],          
.ad-sidebar,                  
#game-stage iframe {          
    contain: layout;          /* CHANGED: Removed 'paint' to prevent clipping issues */
    /* content-visibility: auto; <--- REMOVED this too, just to be safe for ads */
}

/* --- PERFORMANCE: GAME STAGE ISOLATION (Fixed) --- */
#game-area {
    will-change: transform;   /* Kept: This puts ducks on the GPU (Smoothness) */
    /* contain: strict;  <--- DELETED: This was the line that hid the ducks! */
}