/* Global Page Reset & Box Sizing */
html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    overflow-x: hidden; /* Prevent horizontal scrollbars globally */
    box-sizing: border-box;
    scroll-behavior: smooth; /* Added for smooth scrolling on anchor links */
}

*, *::before, *::after {
    box-sizing: inherit; /* All elements inherit box-sizing from html/body */
}

body {
    font-family: Arial, sans-serif;
    background-color: #166534; /* User specified page background */
    display: flex;
    flex-direction: column; /* Stack children vertically */
    align-items: center; /* Center children horizontally */
    justify-content: flex-start; /* Align content to the top */
    min-height: 100vh;
    padding-top: 10px; /* Reduced top padding to accommodate logo */
}

/* Logo styles */
#logo-container {
    text-align: center;
    margin-bottom: 15px;
    width: 100%;
}

#site-logo {
    max-width: 100px;
    height: auto;
    display: block;
    margin: 0 auto;
}

/* New Top Bar Styles */
#page-top-bar {
    /* background: linear-gradient(to bottom, #3a3a3a, #282828); /* Subtle dark gradient - REMOVE */
    background: linear-gradient(to bottom, rgba(22, 101, 52, 0.85), rgba(20, 80, 45, 0.95)); /* Dark green translucent gradient */
    padding: 10px 25px; /* Reduced top/bottom padding */
    width: 100%;
    box-sizing: border-box;
    text-align: center;
    border-bottom: 2px solid rgba(10, 60, 30, 0.9); /* Darker, almost opaque green border */
    box-shadow: 0 2px 5px rgba(0,0,0,0.2); /* Keep a subtle shadow for depth */
}

#page-title-main {
    font-family: 'Arial Black', Gadget, sans-serif;
    font-size: 3em; /* Slightly larger */
    color: #fff;
    margin: 0 0 15px 0; /* More space below title */
    text-shadow: 2px 2px 4px #000000, 0 0 10px rgba(255,183,50,0.3); /* Add a subtle orange glow to shadow */
    letter-spacing: 1px; /* Added subtle letter spacing */
}

#page-menu a {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; /* Cleaner font for menu */
    color: #FFD700; /* Brighter Gold/Yellow color */
    text-decoration: none;
    margin: 0 10px; /* More margin */
    font-size: 0.95em; /* Slightly larger font */
    padding: 5px 8px; /* Add padding to make them more like buttons */
    border-radius: 4px; /* Rounded corners for button feel */
    transition: background-color 0.2s ease, color 0.2s ease;
}

#page-menu a:hover {
    text-decoration: none; /* Remove underline on hover for button feel */
    background-color: rgba(255, 215, 0, 0.15); /* Light gold highlight on hover */
    color: #fff;
}

#page-menu a#back-to-games-link {
    background-color: rgba(255, 255, 255, 0.05); /* Slightly different background */
    padding: 5px 10px;
    border: 1px solid rgba(255, 215, 0, 0.3);
}
#page-menu a#back-to-games-link:hover {
    background-color: rgba(255, 215, 0, 0.25);
    border-color: rgba(255, 215, 0, 0.6);
}

#page-menu a.disabled-look,
#page-menu a.disabled { /* Group with existing disabled style */
    color: #777 !important; /* Grey out disabled link, ensure override */
    pointer-events: none; /* Prevent clicks */
    text-decoration: none;
    background-color: transparent !important; /* Ensure no hover background persists */
}
/* End New Top Bar Styles */

/* Board-based game info overlay */
#board-game-info {
    position: absolute;
    top: 10px;
    left: 20px;
    right: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: Arial, sans-serif;
    color: white;
    font-size: 0.9em;
    z-index: 10;
    pointer-events: none; /* Allow clicks to pass through to cards below */
}

#board-game-info > * {
    pointer-events: auto; /* Re-enable pointer events for child elements */
}

.board-info-left {
    display: flex;
    gap: 20px;
}

.board-info-left span {
    background-color: transparent;
    padding: 2px 4px;
    border-radius: 2px;
    font-weight: normal;
    font-size: 1em;
    color: rgba(255, 255, 255, 0.7);
    text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.5);
}

.board-info-right {
    display: flex;
    gap: 8px;
}

.board-button {
    color: white;
    text-decoration: none;
    padding: 4px 8px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    background-color: rgba(0, 0, 0, 0.6);
    transition: background-color 0.2s ease, border-color 0.2s ease;
    font-size: 0.85em;
    cursor: pointer;
    font-family: Arial, sans-serif;
}

.board-button:hover:not(.disabled) {
    background-color: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
}

.board-button.disabled {
    color: #777 !important;
    background-color: rgba(100, 100, 100, 0.3) !important;
    border-color: rgba(120, 120, 120, 0.3) !important;
    pointer-events: none;
    text-decoration: none;
}

/* Old #game-info span rule - no longer needed as .game-info-left handles it */
/* #game-info span {
    margin: 0 15px;
    white-space: nowrap;
} */

/* Add a title style like in the screenshot */
#game-title {
    font-family: 'Arial Black', Gadget, sans-serif; /* Bolder font */
    font-size: 2.5em;
    color: white;
    text-align: center;
    margin-bottom: 10px; /* Space below title */
    letter-spacing: 2px;
    text-shadow: 2px 2px 3px #000000;
    /* width: 100%; -- Not needed if body is centering it */
    max-width: 700px; /* Consistent with game-info */
}

#game-board {
    display: grid;
    grid-template-areas:
        "stock-waste foundation"
        "tableau tableau";
    grid-template-columns: auto 1fr; 
    grid-template-rows: auto 1fr; /* Make top row auto, tableau row take remaining space and grow */
    gap: 20px;
    padding: 50px 50px 20px 50px; /* 50px top (more space for overlay), 50px left/right, 20px bottom */
    background-color: #15803d; /* Reverted to previous specified green */
    border: 1px solid #103F2E; /* Darker, related green border */
    border-radius: 12px; /* Slightly more pronounced radius */
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25); /* Softer, slightly more defined shadow */
    width: 100%; 
    max-width: 650px; 
    margin: 30px auto 20px auto; 
    min-height: 70vh; /* Match front page height */ 
    perspective: 1000px; /* Re-added for 3D card flips within the board */
    position: relative; /* Enable absolute positioning for overlay */
    order: 1;
}

#stock-waste-area {
    grid-area: stock-waste;
    display: flex;
    gap: 10px;
}

#foundation-area {
    grid-area: foundation;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

#tableau-area {
    grid-area: tableau;
    display: flex;
    gap: 10px;
    justify-content: space-between;
    align-items: flex-start; /* Add this to prevent stretching of tableau piles */
}

.card-pile {
    width: 72px; /* Adjusted to accommodate the new card width */
    height: 100px; /* Base height */
    border: 1px solid rgba(255, 255, 255, 0.1); /* Reverted to original subtler border */
    border-radius: 5px;
    background-color: rgba(0, 0, 0, 0.12); /* Reverted to original placeholder background */
    display: flex;
    justify-content: center;
    align-items: center; /* For placeholder text */
    font-size: 12px;
    color: #cccccc; /* Reverted to original light text */
    box-shadow: inset 0 0 5px rgba(0,0,0,0.2);
    position: relative; 
}

/* Styles for the stock count indicator */
#stock .stock-count-indicator {
    position: absolute;
    bottom: 5px;
    right: 5px;
    background-color: rgba(0, 0, 0, 0.6);
    color: white;
    padding: 2px 5px;
    font-size: 10px;
    border-radius: 3px;
    line-height: 1;
    z-index: 5; /* Ensure it's above the card visuals */
}

/* Foundation Pile Placeholders */
.card-pile.foundation.empty {
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: rgba(0, 0, 0, 0.15); /* Slightly more defined empty foundation */
}

.card-pile.foundation.empty::before {
    font-family: Arial, sans-serif; /* Or a specific card symbol font if available */
    font-size: 40px; /* Large suit symbol */
    font-weight: bold;
    line-height: 1;
}

.card-pile.foundation.empty[data-suit-for-placeholder="♥"]::before { 
    content: "♥"; 
    color: #D90000; /* Red for hearts */
}
.card-pile.foundation.empty[data-suit-for-placeholder="♠"]::before { 
    content: "♠"; 
    color: #333; /* Black for spades */
}
.card-pile.foundation.empty[data-suit-for-placeholder="♦"]::before { 
    content: "♦"; 
    color: #D90000; /* Red for diamonds */
}
.card-pile.foundation.empty[data-suit-for-placeholder="♣"]::before { 
    content: "♣"; 
    color: #333; /* Black for clubs */
}
/* End Foundation Pile Placeholders */

.foundation {
    background-color: #e0e0e0;
}

.tableau {
    height: auto; 
    align-items: flex-start; 
}

/* Make Tableau Piles Transparent - specific rule for tableau might not be needed if general .card-pile is okay */
.card-pile.tableau {
    /* background-color: transparent; /* Let's see how it looks with the new default .card-pile */
    /* box-shadow: none; /* Inset shadow already removed from general .card-pile */
}

.card-pile.tableau.empty {
    height: 100px; /* Ensure empty tableau piles have card height for hit detection */
}

#stock {
    cursor: pointer;
    /* border: 2px dashed #6f876f; /* Original dashed border */
    border: 2px dashed rgba(255, 255, 255, 0.25); /* Lighter dashed border */
    background-color: transparent; /* No background if it shows card back */
    position: relative; 
}

/* Placeholder for cards - to be added via JS */
.card {
    width: 67px; /* Adjusted to match aspect ratio 549/776 = 0.707 */
    height: 95px; /* Desktop card height */
    /* border: 1px solid #000; remove direct border, apply to faces if needed */
    /* background-color: white; remove direct background */
    position: absolute; 
    /* display: flex; remove, will be handled by inner */
    /* flex-direction: column; remove */
    /* justify-content: space-between; remove */
    /* padding: 3px; remove, apply to faces */
    box-sizing: border-box;
    font-size: 14px; 
    font-weight: bold;
    user-select: none; 
    cursor: grab; 
    transition: none !important; 
    transform-style: preserve-3d; /* For 3D flip */
}

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.6s;
    transform-style: preserve-3d;
    /* No initial rotation here */
}

/* This class on .card will make it show its back */
.card.is-face-down .card-inner {
    transform: rotateY(180deg);
}

.card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden; /* Safari */
    backface-visibility: hidden;
    border-radius: 6px; /* Increased border-radius */
    border: 1px solid #333;
    box-sizing: border-box;
    display: flex; /* For centering content if needed */
    flex-direction: column;
    justify-content: space-between;
    padding: 3px;
}

.card-front {
    background-color: white;
    /* color will be set by .red or .black */
}

.card-back {
    background-color: transparent; /* Remove blue background */
    background-image: url('../assets/back-card.png'); /* Use the new card back image */
    background-size: contain; /* Changed from cover to contain to avoid cropping */
    background-position: center; /* Center the background image */
    transform: rotateY(180deg); /* Pre-rotate the back face itself */
    /* Content for card back can go here if desired */
    display: flex;
    align-items: center;
    justify-content: center;
    color: white; /* For any text on the back */
}

/* .card.hidden will no longer be used, handled by flip */

.card-drag-source-faded {
    opacity: 0 !important; /* Make original card invisible during drag */
    pointer-events: none !important; /* Prevent interaction with the invisible original */
}

.card .rank {
    position: absolute; 
    top: 3px;
    left: 4px;
    font-size: 16px;
    font-weight: bold;
}

.card .suit {
    position: absolute; 
    bottom: 3px;
    right: 4px;
    font-size: 26px; 
}

/* Top right suit icon */
.card .suit-top-right {
    position: absolute;
    top: 3px;
    right: 4px;
    font-size: 16px;
}

.card.red .card-front {
    color: red;
}

.card.black .card-front {
    color: black;
}

/* Ensure pile elements can contain the new card structure */
.card-pile {
    width: 72px; /* Adjusted to accommodate the new card width */
    height: 100px; /* Base height */
    border: 1px solid rgba(255, 255, 255, 0.1); /* Reverted to original subtler border */
    border-radius: 5px;
    background-color: rgba(0, 0, 0, 0.12); /* Reverted to original placeholder background */
    display: flex;
    justify-content: center;
    align-items: center; /* For placeholder text */
    font-size: 12px;
    color: #cccccc; /* Reverted to original light text */
    box-shadow: inset 0 0 5px rgba(0,0,0,0.2);
    position: relative; 
}

.tableau { /* This rule applies to .card-pile.tableau elements */
    height: auto; 
    align-items: flex-start; 
}

/* NEW MOBILE STYLES UNDER 520px */
@media (max-width: 519px) {
    html, body {
        /* overflow-x: hidden; /* Allow game board to scroll */
        /* Consider if html,body still need overflow-x hidden or if it can be wrapper only */
        padding-top: 5px; /* Reduced top padding for mobile */
    }

    body {
        /* Revert centering for mobile if game board wrapper handles scrolling */
        /* display: block; */
        /* align-items: stretch; */
        padding-left: 0; /* No padding on sides to maximize space */
        padding-right: 0;
    }

    #page-title-main {
        font-size: 2em; /* Slightly smaller title on mobile */
    }
    #page-menu a {
        font-size: 0.8em;
        margin: 0 5px;
    }

    #board-game-info {
        top: 5px;
        left: 10px;
        right: 10px;
        font-size: 0.7em;
    }

    .board-info-left {
        gap: 8px;
    }

    .board-info-left span {
        font-size: 0.65em;
        padding: 1px 2px;
    }

    .board-info-right {
        gap: 5px;
    }

    .board-button {
        padding: 3px 6px;
        font-size: 0.75em;
    }

    #game-board-wrapper {
        width: 100%; /* Full width for the scrollable wrapper */
        overflow-x: auto; /* Enable horizontal scrolling */
        -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
        margin-bottom: 10px;
    }

    #game-board {
        /* width: 98vw; /* REMOVE: Let it expand with content */
        padding: 35px 10px 10px 10px; /* Top padding for overlay, reduced other padding */
        gap: 8px;     /* Further Reduced gap for tighter layout */
        display: inline-grid; /* Allows it to size to content and then scroll */
    }

    #stock-waste-area,
    #foundation-area,
    #tableau-area {
        flex-wrap: nowrap; /* Ensure these rows don't wrap */
        gap: 6px; /* Further reduced gap for piles */
    }

    #stock-waste-area .card-pile,
    #foundation-area .card-pile,
    .card-pile.tableau {
        width: 57px;  /* Adjusted to accommodate the new card width */
        height: 80px; /* Reduced fixed height for piles */
        font-size: 9px; /* Reduced font size for pile text (if any) */
    }
    
    #stock {
        border-width: 1px; /* Fixed border */
    }

    .card {
        width: 53px; /* Adjusted to match aspect ratio 549/776 = 0.707 */
        height: 75px; /* Reduced fixed card height */
        border-radius: 4px; /* Increased radius for mobile */
    }

    .card-face { 
        padding: 1px; /* Reduced padding */
        border-radius: 4px; /* Ensure this matches .card or is slightly less - Increased for mobile */
    }

    .card .rank {
        font-size: 14px; /* Reduced font size */
        top: 1px;
        left: 1px;
    }

    .card .suit {
        font-size: 14px; /* Reduced font size */
        bottom: 1px;
        right: 1px;
    }
    
    .card-pile.foundation.empty::before {
        font-size: 24px; /* Reduced font size for foundation placeholders */
    }

    .card-back .card-count {
        font-size: 10px; /* Reduced font size for stock count */
        bottom: 3px;
        right: 3px;
    }

    .card-pile.tableau.empty {
        height: 80px; /* Ensure empty tableau piles have card height for hit detection on mobile */
    }
    
    #stock {
        border-width: 1px; /* Fixed border */
    }
}

/* Styles for the card count on stock pile */
.animation-clone {
    /* Ensure clones don't pick up any strange media query specifics if not intended */
    /* Their size should be set by JS directly */
    /* width: 65px !important; /* REMOVE - Let JS control this */
    /* height: 95px !important; /* REMOVE - Let JS control this */
}

/* Ensure dragged element clone has a high z-index */
.card-drag-source-faded {
    opacity: 0 !important; /* Make original card invisible during drag */
    pointer-events: none !important; /* Prevent interaction with the invisible original */
}

/* Style for indicating a valid drop target */
.drop-target-highlight {
    border: 2px dashed #33FF33 !important; /* Bright green dashed border */
    box-shadow: 0 0 8px rgba(51, 255, 51, 0.7), inset 0 0 8px rgba(51, 255, 51, 0.5); /* Green glow */
}

/* Static Rules Section Styles */
#rules-section {
    /* background-color: #f0f0f0; /* Light grey background for the section - REMOVE */
    background-color: transparent !important; /* Ensure transparent background */
    color: #e0e0e0; /* Light text color for readability on dark background */
    padding: 25px 30px; /* Adjusted padding */
    margin: 40px auto; /* Adjusted margin, centered horizontally */
    width: 90%;
    max-width: 750px; /* Slightly adjusted max width */
    border-radius: 6px; /* Slightly less rounded */
    /* box-shadow: 0 2px 4px rgba(0,0,0,0.1); /* REMOVE shadow */
    border: 1px solid rgba(255, 255, 255, 0.15); /* Subtle light border */
}

#rules-section h2, #rules-section h3, #rules-section h4 {
    /* color: #15803d; /* Use the game board green for headers - too dark now */
    color: #a3d9a5; /* Lighter, desaturated green for headers */
    /* alt: color: #FFD700; /* Or match menu link gold for accent */
    margin-top: 1.2em;
    margin-bottom: 0.6em;
}

#rules-section h2 {
    text-align: center;
    margin-top: 0;
    font-size: 1.8em; /* Adjusted size */
}

#rules-section h3 {
    font-size: 1.4em;
}

#rules-section h4 {
    font-size: 1.1em;
}

#rules-section ul {
    padding-left: 25px; /* Slightly more padding for lists */
}
#rules-section ul ul {
    padding-left: 25px;
}

#rules-section li, #rules-section p {
    margin-bottom: 0.6em;
    line-height: 1.6; /* Improved line height for readability */
}

#rules-section strong {
    color: #f5f5f5; /* Make bold text slightly brighter */
    font-weight: 600;
}

#rules-section a {
    color: #FFD700; /* Style links within rules like menu links */
    text-decoration: none;
}

#rules-section a:hover {
    text-decoration: underline;
}

/* Confirmation Modal Styles */
#confirmation-modal {
    position: fixed;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6); /* Semi-transparent background */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 99999; /* Ensure it's above everything - Increased z-index */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0s linear 0.3s;
}

#confirmation-modal.modal-visible {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease;
}

.modal-content {
    background-color: #fefefe;
    padding: 25px 35px;
    border: 1px solid #888;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    text-align: center;
    width: auto;
    max-width: 400px;
    min-width: 280px; /* Ensure a minimum width */
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

#confirmation-modal.modal-visible .modal-content {
    transform: scale(1);
}

#modal-message {
    font-size: 1.1em;
    color: #333;
    margin-top: 0;
    margin-bottom: 20px;
    line-height: 1.5;
}

.modal-buttons button {
    background-color: #4CAF50; /* Green */
    color: white;
    padding: 10px 20px;
    margin: 5px 10px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.2s ease;
}

.modal-buttons button:hover {
    background-color: #45a049;
}

.modal-buttons button#modal-cancel-button {
    background-color: #f44336; /* Red */
}

.modal-buttons button#modal-cancel-button:hover {
    background-color: #c82333;
    border-color: #bd2130;
}

/* Styles for win dialog buttons */
#confirmation-modal.win-dialog-active .modal-buttons #modal-confirm-button,
#confirmation-modal.win-dialog-active .modal-buttons #modal-cancel-button {
    display: none; /* Hide standard confirm/cancel in win dialog */
}

#confirmation-modal.win-dialog-active .modal-buttons .win-modal-button {
    display: inline-block; /* Show win-specific buttons */
    margin: 0 5px;
}

/* Ensure win-modal-buttons also get base button styling if not already inherited */
.win-modal-button {
    padding: 10px 20px;
    border: none; /* Remove border for a flatter look */
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    font-weight: bold;
    color: white;
    transition: background-color 0.2s ease, transform 0.1s ease;
    margin: 5px 10px !important; /* Consistent margin with other modal buttons */
}

.win-modal-button:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

#modal-new-game-button.win-modal-button { /* Be more specific */
    background-color: #007bff; 
}

#modal-restart-game-button.win-modal-button { /* Be more specific */
    background-color: #28a745; 
}

/* Pause Overlay Styles */
#pause-overlay {
    position: absolute; /* Positioned relative to #game-board-wrapper */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.75); /* Darker overlay */
    color: white;
    /* font-size: 2.5em; /* Moved to h2 */
    /* font-weight: bold; /* Moved to h2 */
    display: flex;
    flex-direction: column; /* Stack PAUSED text and button vertically */
    justify-content: center;
    align-items: center;
    z-index: 1500; /* Above game board content, below modal */
    border-radius: 12px; /* Match game-board border-radius as it's now a child */
    text-align: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0s linear 0.3s;
    pointer-events: none; /* Allow clicks to pass through when hidden */
}

#pause-overlay.visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto; /* Block clicks when visible */
    transition: opacity 0.3s ease;
}

#pause-overlay h2 {
    font-size: 2.5em;
    font-weight: bold;
    margin-bottom: 20px; /* Space between PAUSED and button */
    color: white; /* Ensure it's white if not inherited properly */
    text-shadow: 1px 1px 3px rgba(0,0,0,0.5);
}

#resume-button-overlay {
    padding: 8px 18px; /* Smaller padding */
    font-size: 1em;    /* Smaller font size */
    color: white;
    background-color: #4CAF50; /* Green */
    border: none;
    border-radius: 5px;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    transition: background-color 0.2s ease;
}

#resume-button-overlay:hover {
    background-color: #45a049; /* Darker green */
}

/* Styles for win dialog specifically */
#confirmation-modal.win-dialog-active .modal-content {
    background-color: #f0fff0; /* Light honeydew green for win */
    border-left: 5px solid #28a745; /* Green accent border */
    border-right: 5px solid #28a745;
}

#confirmation-modal.win-dialog-active #modal-message div {
    color: #155724; /* Darker green text for readability on honeydew */
}

#confirmation-modal.win-dialog-active #modal-message div:first-child { /* The "Congratulations" line */
    font-size: 1.3em;
    font-weight: bold;
    color: #FFD700;
}

/* Add rules-container class to match the rules section styling */
.rules-container {
    background-color: transparent !important;
    color: #e0e0e0;
    padding: 25px 30px;
    margin: 40px auto;
    width: 90%;
    max-width: 750px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

/* Add heading styles for rules-container class */
.rules-container h2, .rules-container h3, .rules-container h4 {
    color: #a3d9a5;
    margin-top: 1.2em;
    margin-bottom: 0.6em;
}

.rules-container h2 {
    text-align: center;
    margin-top: 0;
    font-size: 1.8em;
}

.rules-container h3 {
    font-size: 1.4em;
}

.rules-container h4 {
    font-size: 1.1em;
}

.rules-container ul {
    padding-left: 25px;
}

.rules-container ul ul {
    padding-left: 25px;
}

.rules-container li, .rules-container p {
    margin-bottom: 0.6em;
    line-height: 1.6;
}

.rules-container strong {
    color: #f5f5f5;
    font-weight: 600;
}

.rules-container a {
    color: #FFD700;
    text-decoration: none;
}

.rules-container a:hover {
    text-decoration: underline;
}

/* --- Ad Container Styles (updated for flex layout) --- */
.game-board-flex-row {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: flex-start;
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    gap: 32px;
}
.side-ad-container {
    width: 160px !important;
    min-width: 160px !important; /* Ensure minimum width for AdSense */
    max-width: 160px !important; /* Lock maximum width */
    min-height: 300px;
    display: flex !important;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    visibility: visible !important; /* Ensure containers are visible */
    position: relative; /* Add positioning context */
    flex-shrink: 0 !important; /* Prevent shrinking */
}
.side-ad-left {
    /* Left ad specific styles if needed */
    order: 0;
}
.side-ad-right {
    /* Right ad specific styles if needed */
    order: 2;
}
.ad-label {
    width: 100%;
    text-align: center;
    font-size: 12px;
    font-weight: normal;
    color: #999;
    margin-bottom: 6px;
    letter-spacing: 1px;
}
.ad-banner {
    width: 100%;
    min-width: 160px; /* Ensure minimum width for AdSense */
    min-height: 250px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative; /* Add positioning context */
}
.ad-banner .adsbygoogle {
    width: 160px !important; /* Set explicit width instead of 100% */
    min-width: 160px !important;
    max-width: 160px !important; /* Add max-width constraint */
    min-height: 250px !important; /* Add minimum height */
    height: auto !important; /* Allow height to adjust */
    display: block !important;
    visibility: visible !important; /* Ensure visibility */
    position: relative !important; /* Ensure positioning context */
}
.ad-placeholder {
    width: 100%;
    height: 250px;
    background-color: rgba(255, 255, 255, 0.1);
    border: 2px dashed rgba(255, 255, 255, 0.3);
    display: flex;
    justify-content: center;
    align-items: center;
    color: rgba(255, 255, 255, 0.6);
    font-size: 14px;
    font-weight: bold;
    text-align: center;
    border-radius: 4px;
}
@media (max-width: 1100px) {
    .side-ad-container {
        display: none;
    }
    .game-board-flex-row {
        max-width: 100%;
        gap: 0;
    }
} 