/* css/doge-game.css - Styles specific to the Doge 2048 game variant */

/* ------------------------------------------------------------- */
/* Doge Game Container & Layout (Mimics classic/cupcakes structure) */
/* ------------------------------------------------------------- */

/* Game Container (now acts as the main card) */
.game-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    /* gap: 20px; <-- Removed gap here, using margin-bottom on children for control */

    background: var(--text-color-light); /* White background for the game card (from _base.css) */
    padding: 25px; /* Consistent padding around the game content */
    border-radius: 15px;
    box-shadow: var(--box-shadow-light); /* Light shadow (from _base.css) */
    max-width: 550px; /* Limit overall game section width */
    width: 100%; /* Take full width of its parent */
    margin-bottom: 0; /* Managed by parent .game-main-area's gap */
    flex-shrink: 0; /* IMPORTANT: Prevent game card from shrinking when side ads are present */
    position: relative; /* IMPORTANT: For absolute positioning of cover-screen */
}

/* Spacing for direct children of game-section */
.game-section > *:not(:last-child) {
    margin-bottom: 20px; /* Provides spacing between main blocks like title, header area, grid */
}
.game-section > *:last-child {
    margin-bottom: 0; /* No margin-bottom for the last child */
}


/* Heading for the Doge 2048 game */
.game-section .multi-game-heading {
    color: #DAA520; /* Golden/yellow color for Doge title */
    font-size: 2.8em; /* Slightly larger than standard multi-game-heading */
    margin: 0; /* Reset margins */
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    text-align: center;
    line-height: 1.2;
}

/* Game Header Area (Contains score and controls) */
.game-header-area {
    display: flex;
    flex-direction: column; /* Stack score-board and game-controls vertically */
    width: 100%;
    gap: 15px; /* Space between score board and game controls */
}

/* Score Board */
.score-board {
    display: flex;
    justify-content: flex-end; /* Push scores to the right */
    gap: 10px; /* Space between score boxes */
    width: 100%; /* Take full width of parent */
}

/* Score Display (Mimics classic 2048 compact style) */
.score-display {
    background-color: #fce18d; /* Light yellow/gold for score boxes */
    color: #8B4513; /* Saddle Brown for text */
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 0.8em;
    font-weight: bold;
    text-align: center;
    flex: 0 0 auto; /* Don't grow, don't shrink, size based on content */
    display: flex;
    flex-direction: column; /* Stack label and value */
    align-items: center; /* Center horizontally */
    line-height: 1.2;
    min-width: 70px; /* Ensure a minimum width for score boxes */
}

.score-display .label {
    font-size: 0.7em;
    color: rgba(139, 69, 19, 0.7); /* Slightly muted brown */
    margin-bottom: 2px;
    font-weight: 600;
    text-transform: uppercase;
}

.score-display .value {
    font-size: 1.5em;
    font-weight: 700;
    color: #8B4513;
}

/* Game Controls (New Game, Undo buttons) */
.game-controls {
    display: flex;
    justify-content: center; /* Center buttons horizontally */
    gap: 15px;
    margin-top: 20px;
    width: 100%;
    flex-wrap: wrap; /* Allow buttons to wrap on smaller screens */
}

.game-controls button,
#restart-btn {
    /* Inherits general button styles from _base.css */
    flex: 1; /* Allow buttons to share space */
    max-width: 150px;
    padding: 12px 25px;
    font-size: 1.1em;
    font-weight: bold;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    background-color: #DAA520; /* Goldenrod for buttons */
    color: white;
    transition: background-color 0.3s ease, transform 0.1s ease;
    outline: none;
    white-space: nowrap; /* Prevent button text from wrapping */
}

.game-controls button:hover,
#restart-btn:hover {
    background-color: #B8860B; /* Darker goldenrod */
    transform: translateY(-2px);
}

#undo-btn:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
    opacity: 0.6;
}

/* The 2048 Grid */
.grid {
    width: 400px; /* Fixed width for the grid on desktop */
    height: 400px; /* Fixed height for the grid on desktop */
    background-color: #bbada0; /* Classic 2048 board background */
    border-radius: 10px;
    padding: 15px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-gap: 15px; /* Gap between cells */
    margin: 0 auto; /* Center the grid */
    user-select: none;
    -webkit-user-select: none;
    -ms-user-select: none;
    touch-action: manipulation;
    overflow: hidden; /* Important for tile animations */
}

/* Individual Tiles within the Grid (Specific to Doge - using background images) */
.cell {
    background-color: #EED29B; /* Light Doge-ish background for empty cells */
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0; /* Hide text content as images are used */
    transition: all 0.15s ease-in-out;
    width: 100%; /* Fill grid cell width */
    height: 100%; /* Fill grid cell height */
    aspect-ratio: 1; /* Ensure cells are square */
    background-size: cover; /* Ensure images cover the box */
    background-position: center;
    background-repeat: no-repeat;
    /* Default background color for image tiles (e.g., if image has transparency or is missing) */
    background-color: #fff; /* or a neutral color to blend with images */
}

/* Game Over/Win Screen (Full Page Overlay) */
.cover-screen {
    position: fixed; /* Covers the entire viewport */
    top: 0;
    left: 0;
    width: 100vw; /* Covers full viewport width */
    height: 100vh; /* Covers full viewport height */
    background: rgba(238, 228, 218, 0.9); /* Lighter, semi-transparent background */
    z-index: 9999; /* High z-index to ensure it's on top of everything */
    display: none; /* Hidden by default in CSS, shown by JS */
    flex-direction: column;
    justify-content: center; /* Center content vertically */
    align-items: center; /* Center content horizontally */
}

.cover-screen h2 {
    font-size: 3.5em;
    font-weight: bold;
    color: #776e65; /* Text color */
    margin-bottom: 30px;
    font-family: 'Clear Sans', sans-serif;
    text-align: center;
    line-height: 1.2;
}

/* Styling for "Play Again" button inside cover screen */
#restart-btn {
    /* Inherits game-button, but some overrides for larger size/style on overlay */
    padding: 15px 30px;
    font-size: 1.2em;
    background-color: var(--primary-color); /* Green, consistent with new game button */
    color: var(--text-color-light);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    border-radius: 25px; /* More rounded */
    
    /* NEW: Flexbox for perfect text centering */
    display: flex;
    justify-content: center;
    align-items: center;
}

#restart-btn:hover {
    background-color: #388E3C; /* Darker green on hover */
}


/* ------------------------------------------------------------- */
/* Layout for Game Section and Vertical Side Ads (Copied from main.css) */
/* ------------------------------------------------------------- */
.game-main-area {
    display: flex;
    justify-content: center; /* Center the game content and ads */
    align-items: flex-start; /* Align items to the top (important for varying ad heights) */
    width: 100%;
    gap: 20px; /* Space between side ads and the game section */
    margin-bottom: 30px; /* Space below this whole game area */
    flex-wrap: wrap; /* Allow wrapping on smaller screens */
}

/* AdSense Slot Styling (General) - Needed for placeholders */
.adsense-slot {
    background-color: #f0f0f0;
    border: 1px dashed #ccc;
    padding: 10px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8em;
    color: #777;
    border-radius: 8px;
    overflow: hidden;
    box-sizing: border-box;
}

/* Styles for the inner placeholder content or actual ad container */
.adsense-placeholder-content {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    color: #777;
    font-size: 0.8em;
    padding: 5px;
}

/* Styles for Vertical Side Ad Banners */
.adsense-slot.vertical-side-ad {
    margin: 0; /* Remove auto margins when in flex context */
    flex-shrink: 0; /* Prevent from shrinking */
    width: 100%; /* Take full width of its column */
    max-width: 160px; /* Standard vertical banner width (e.g., 160x600) */
    min-height: 400px; /* Minimum height for a noticeable vertical ad */
    align-self: flex-start; /* Align to the top of the flex container */
    display: none; /* Hidden by default and only shown on larger screens */
}


/* ------------------------------------------------------------- */
/* Responsive Adjustments */
/* ------------------------------------------------------------- */

/* Smaller Screens (up to 767px) - Mobile */
@media (max-width: 767px) {
    .game-section {
        padding: 15px; /* Reduce padding for game section */
    }
    .game-section .multi-game-heading {
        font-size: 2em; /* Smaller title on very small screens */
    }
    .score-display {
        padding: 6px 8px; /* Tighter score boxes */
        min-width: 60px;
    }
    .score-display .label {
        font-size: 0.6em; /* Smaller label */
    }
    .score-display .value {
        font-size: 1.2em; /* Smaller value */
    }
    .game-controls button {
        font-size: 0.9em;
        padding: 8px 15px;
        max-width: 120px;
    }
    .grid {
        width: min(280px, 100% - 16px); /* Even smaller grid */
        height: min(280px, 100% - 16px);
        padding: 8px;
        grid-gap: 8px;
    }
    .cell {
        /* font-size: 25px; (hidden by font-size:0 for image) */
    }
    .cover-screen h2 {
        font-size: 2em;
    }

    /* Layout on small screens: Stack game and hide side ads */
    .game-main-area {
        flex-direction: column; /* Stack game section vertically */
        align-items: center;
        gap: 20px;
    }
    .adsense-slot.vertical-side-ad {
        display: none; /* Keep vertical side ads hidden on small screens */
    }
}

/* Tablet / Larger Mobile (768px - 991px) */
@media (min-width: 768px) and (max-width: 991px) {
    .game-section .multi-game-heading {
        font-size: 2.2em; /* Mid-size title */
    }
    /* Layout on tablets: Still stack game and hide side ads */
    .game-main-area {
        flex-direction: column;
        align-items: center;
        gap: 20px;
    }
    .adsense-slot.vertical-side-ad {
        display: none; /* Keep vertical side ads hidden */
    }
}

/* Desktop (992px and up) */
@media (min-width: 992px) {
    /* Layout on desktop: Game and side ads horizontally */
    .game-main-area {
        flex-direction: row; /* Layout game and ads horizontally */
        justify-content: center; /* Center the game content and ads as a group */
        align-items: flex-start; /* Align game and ads to the top */
        gap: 20px; /* Space between game and ads */
        flex-wrap: nowrap; /* Prevent wrapping */
        width: 100%; /* Take full width of its parent */
    }
    .adsense-slot.vertical-side-ad {
        display: flex; /* Show vertical side ads on desktop */
    }
}