:root {
    /* Colors */
    --bg-dark: #0a0a12;
    --bg-card: #151520;
    --primary-gold: #d4af37;
    --primary-gold-bright: #f1c40f;
    --accent-purple: #9b59b6;
    --text-main: #ecf0f1;
    --text-muted: #bdc3c7;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);

    /* Typography */
    --font-heading: 'Montserrat', sans-serif;
    --font-body: 'Inter', sans-serif;

    /* Spacing */
    --container-width: 1200px;
    --header-height: 80px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-body);
    line-height: 1.6;
    overflow-x: hidden;
    margin: 0;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-heading);
    color: white;
    text-transform: uppercase;
    letter-spacing: 1px;
}

a {
    text-decoration: none;
    color: inherit;
    transition: color 0.3s ease;
}

/* Utilities */
.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 20px;
}

/* Fix for fixed header overlap on subpages */
main.container {
    padding-top: 120px;
    /* 80px Header + 40px Spacing */
    min-height: 100vh;
}

.t-gold {
    color: var(--primary-gold);
}

.t-center {
    text-align: center;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 12px 30px;
    background: linear-gradient(135deg, var(--primary-gold) 0%, #b8860b 100%);
    color: #000;
    font-family: var(--font-heading);
    font-weight: 700;
    text-transform: uppercase;
    border-radius: 50px;
    border: none;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.3);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(212, 175, 55, 0.5);
    background: linear-gradient(135deg, var(--primary-gold-bright) 0%, #daa520 100%);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary-gold);
    color: var(--primary-gold);
}

.btn-outline:hover {
    background: var(--primary-gold);
    color: #000;
}

/* Header */
header {
    height: var(--header-height);
    background: rgba(10, 10, 18, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--glass-border);
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.logo {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--primary-gold);
    letter-spacing: 2px;
}

.nav-links {
    display: flex;
    gap: 30px;
}

.nav-links a {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--primary-gold);
}

/* Dropdown Menu */
.dropdown {
    position: relative;
    display: inline-block;
}

/* Welcome Popup */
#welcome-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    animation: popupFadeIn 0.5s forwards;
}

@keyframes popupFadeIn {
    to {
        opacity: 1;
    }
}

#welcome-popup img {
    max-width: 80%;
    max-height: 50vh;
    animation: logoScaleUp 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes logoScaleUp {
    from {
        transform: scale(0.5);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

#welcome-popup .enter-btn {
    margin-top: 30px;
    padding: 15px 40px;
    font-size: 1.5rem;
    background: var(--primary-gold);
    color: #000;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    font-weight: bold;
    text-transform: uppercase;
    transition: transform 0.2s, box-shadow 0.2s;
    animation: btnSlideUp 1s ease-out 0.5s backwards;
}

@keyframes btnSlideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

#welcome-popup .enter-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 20px var(--primary-gold);
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: rgba(10, 10, 18, 0.95);
    min-width: 160px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.5);
    z-index: 1001;
    border: 1px solid var(--primary-gold);
    border-radius: 4px;
    top: 100%;
}

.dropdown-content a {
    color: var(--text-muted);
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    font-size: 0.9rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.dropdown-content a:hover {
    background-color: rgba(212, 175, 55, 0.1);
    color: var(--primary-gold);
}

.dropdown:hover .dropdown-content {
    display: block;
}

/* Hero Section */
.hero {
    height: 80vh;
    background: radial-gradient(circle at center, #2c1e3e 0%, var(--bg-dark) 70%);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding-top: var(--header-height);
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23d4af37' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    opacity: 0.5;
}

.hero-content {
    position: relative;
    z-index: 1;
    max-width: 800px;
    padding: 0 20px;
}

.hero h1 {
    font-size: 4rem;
    margin-bottom: 20px;
    text-shadow: 0 0 20px rgba(212, 175, 55, 0.3);
}

.hero p {
    font-size: 1.2rem;
    color: var(--text-muted);
    margin-bottom: 40px;
}

/* Game Grid */
.games-section {
    padding: 80px 0;
}

.section-title {
    font-size: 2.5rem;
    margin-bottom: 40px;
    text-align: center;
}

.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
}

.content-section {
    padding: 60px 20px;
    background: var(--bg-card);
    border-radius: 12px;
    margin-top: 40px;
    border: 1px solid var(--glass-border);
}

.text-content {
    max-width: 800px;
    margin: 0 auto;
    color: var(--text-muted);
}

.text-content h2,
.text-content h3 {
    color: var(--primary-gold);
    margin-bottom: 20px;
    margin-top: 30px;
}

.text-content h2:first-child {
    margin-top: 0;
}

.text-content ul {
    list-style-type: disc;
    padding-left: 20px;
    margin-bottom: 20px;
}

.text-content li {
    margin-bottom: 10px;
}

.text-content .small-text {
    font-size: 0.9rem;
    opacity: 0.7;
    margin-top: 30px;
    border-top: 1px solid #333;
    padding-top: 20px;
}

.game-card {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s;
    position: relative;
}

.game-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    border-color: var(--primary-gold);
}

.game-thumb {
    height: 180px;
    background: #2c3e50;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: rgba(255, 255, 255, 0.1);
}

.game-info {
    padding: 20px;
}

.game-title {
    font-size: 1.2rem;
    margin-bottom: 5px;
    color: white;
}

.game-desc {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.play-btn {
    margin-top: 15px;
    width: 100%;
    text-align: center;
}

/* Slots specific */
.slot-machine-mockup {
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(45deg,
            #2c3e50,
            #2c3e50 10px,
            #34495e 10px,
            #34495e 20px);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Footer */
footer {
    padding: 50px 0;
    background: var(--bg-card);
    border-top: 1px solid var(--glass-border);
    text-align: center;
    color: var(--text-muted);
}

/* Ad Placeholders */
.ad-space {
    background: rgba(255, 255, 255, 0.02);
    border: 1px dashed rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #444;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.ad-leaderboard {
    width: 100%;
    height: 90px;
    margin: 20px 0;
}

.ad-sidebar {
    width: 300px;
    height: 250px;
    /* or 600px */
    margin: 0 auto;
}

/* Mobile Navigation */
.menu-toggle {
    display: none;
    font-size: 1.5rem;
    color: var(--primary-gold);
    cursor: pointer;
    z-index: 1001;
}

@media (max-width: 900px) {
    .nav-container {
        position: relative;
    }

    .menu-toggle {
        display: block;
    }

    .nav-links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background: rgba(10, 10, 18, 0.98);
        flex-direction: column;
        padding: 20px;
        text-align: center;
        border-bottom: 1px solid var(--glass-border);
    }

    .nav-links.active {
        display: flex;
    }

    /* Game Layouts Mobile */
    .game-container {
        grid-template-columns: 1fr;
    }

    .ad-sidebar {
        display: none;
        /* Optional: Hide sidebar ads on mobile or move to bottom */
    }

    /* Adjust Game Boards */
    #slot-machine,
    #blackjack-table,
    #roulette-table,
    #poker-machine {
        height: auto;
        min-height: 500px;
        padding: 10px;
    }

    /* Scale Slots */
    .reels-container,
    .reels-grid {
        gap: 5px;
        transform: scale(0.8);
        /* Scale down if needed */
    }

    .reel-cell,
    .reel {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }

    /* Blackjack Cards */
    .cards-area {
        flex-wrap: wrap;
        min-height: auto;
    }

    .card {
        width: 70px;
        height: 100px;
        font-size: 1.2rem;
    }

    /* Roulette Wheel */
    .wheel-container {
        width: 250px;
        height: 250px;
    }

    /* Wheel of Fortune */
    .wheel-wrapper {
        width: 300px;
        height: 300px;
    }

    .hero h1 {
        font-size: 2.5rem;
    }
}

/* Maya Smash Theme */
.aztec-container {
    min-height: 100vh;
    /* Changed from height to min-height */
    width: 100vw;
    position: relative;
    /* overflow: hidden; Removed to allow scrolling */
    background: #0f2d1e;
    padding-top: 120px;
    /* Header clearance */
    display: flex;
    flex-direction: column;
    /* Allow content stacking */
    align-items: center;
    justify-content: flex-start;
    /* Start from top */
    font-family: 'Montserrat', sans-serif;
    padding-bottom: 80px;
}

.jungle-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, #1e4d3a 0%, #05140d 90%);
    z-index: 1;
}

.jungle-bg::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg width='40' height='40' viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M20 20l10-10L20 0 10 10z' fill='%23ffffff' fill-opacity='0.03'/%3E%3C/svg%3E");
    opacity: 0.3;
}

.aztec-wrapper {
    position: relative;
    /* Enforce z-index context */
    z-index: 10;
    display: flex;
    gap: 20px;
    align-items: center;
    margin-top: 40px;
    /* Added spacing from top */
    margin-bottom: 20px;
}

.stone-frame {
    background: #3e3a36;
    border: 8px solid #6d665e;
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.aztec-header h2 {
    color: #f1c40f;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    margin-bottom: 15px;
    font-size: 1.5rem;
    letter-spacing: 2px;
    text-align: center;
    width: 100%;
}

.aztec-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 8px;
    background: #2b2724;
    padding: 10px;
    border: 2px solid #1a1816;
}

.reel-cell.aztec-cell {
    width: 70px;
    height: 70px;
    background: #1c1a18;
    border: 1px solid #444;
    border-radius: 8px;
    font-size: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.7);
    transition: transform 0.2s, opacity 0.2s;
    user-select: none;
}

/* Multiplier Sidebar */
.multiplier-bar {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: rgba(0, 0, 0, 0.5);
    padding: 10px;
    border-radius: 20px;
    border: 2px solid #555;
}

.mult-item {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #333;
    color: #777;
    font-weight: 800;
    border: 2px solid transparent;
}

.mult-item.active {
    background: #f1c40f;
    color: #000;
    box-shadow: 0 0 15px #f1c40f;
    border-color: #fff;
    transform: scale(1.1);
}

/* Bottom Controls */
.aztec-controls {
    position: relative;
    /* Changed from fixed */
    width: 600px;
    /* Limit width */
    max-width: 100%;
    height: auto;
    background: rgba(10, 15, 12, 0.9);
    border: 2px solid #8e6e2f;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
    margin-top: 20px;
    z-index: 10;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
}

.control-group {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.control-group .label {
    font-size: 0.7rem;
    color: #aaa;
    text-transform: uppercase;
    margin-bottom: 2px;
}

.control-group .value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #f1c40f;
    font-family: monospace;
}

.bet-adjuster {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #222;
    padding: 5px 15px;
    border-radius: 30px;
    border: 1px solid #444;
}

.bet-adjuster button {
    background: #444;
    border: none;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    line-height: 1;
}

.bet-adjuster button:active {
    background: #666;
}

#bet-display {
    color: white;
    font-weight: 700;
    min-width: 40px;
    text-align: center;
    font-size: 1.2rem;
}

.aztec-spin-btn {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: radial-gradient(circle, #27ae60 0%, #145a32 100%);
    border: 4px solid #1e8449;
    color: white;
    font-size: 2.5rem;
    cursor: pointer;
    box-shadow: 0 0 20px rgba(46, 204, 113, 0.3);
    transition: transform 0.1s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.aztec-spin-btn:hover {
    box-shadow: 0 0 30px rgba(46, 204, 113, 0.6);
    transform: scale(1.05);
}

.aztec-spin-btn:active {
    transform: scale(0.95);
}

.aztec-spin-btn:disabled {
    filter: grayscale(1);
    cursor: wait;
}

.aztec-msg {
    margin-top: 10px;
    color: #f1c40f;
    font-weight: 700;
    height: 20px;
    text-align: center;
    text-shadow: 0 2px 2px black;
    width: 100%;
}

@media (max-width: 900px) {
    .aztec-container {
        padding: 5px;
        /* height: auto; removed to allow min-height */
        display: block;
    }

    .aztec-wrapper {
        flex-direction: column;
        width: 100%;
        padding: 5px;
        gap: 10px;
    }

    .aztec-header h2 {
        font-size: 1.5rem;
    }

    .stone-frame {
        padding: 5px;
        border-width: 15px;
        box-shadow: none;
        /* Reduce paint cost */
        max-width: 100%;
        /* overflow-x: hidden; Safer */
    }

    .aztec-grid {
        gap: 2px;
        padding: 2px;
        /* Force 5 columns fit */
        grid-template-columns: repeat(5, 1fr);
        max-width: 100%;
    }

    .reel-cell.aztec-cell {
        width: auto;
        /* Let grid define width */
        height: auto;
        aspect-ratio: 1 / 1;
        /* Square cells */
        font-size: 3rem;
        /* Emojis large enough */
        display: flex;
        align-items: center;
        justify-content: center;
        color: white;
        text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
        overflow: hidden;
        /* Clip spills */
        padding-top: 5px;
        /* Center emoji vertical */
    }

    .multiplier-bar {
        flex-direction: row;
        width: 100%;
        height: auto;
        padding: 5px;
        gap: 5px;
        justify-content: space-between;
    }

    .mult-item {
        width: 50px;
        height: 30px;
        font-size: 0.8rem;
    }

    /* Controls move to relative flow */
    .aztec-controls {
        position: relative;
        bottom: auto;
        left: auto;
        transform: none;
        width: 100%;
        background: rgba(0, 0, 0, 0.85);
        padding: 10px;
        margin-top: 0px;
        border-top: 2px solid #5d4037;
        border-radius: 8px;
        /* Slight roundness */

        flex-direction: row;
        flex-wrap: wrap;
        /* allow wrapping on very small screens */
        height: auto;
        justify-content: space-around;
    }

    .aztec-spin-btn {
        width: 70px;
        height: 70px;
        font-size: 2rem;
        border-width: 3px;
    }

    .control-group .label {
        font-size: 0.6rem;
    }

    .control-group .value {
        font-size: 1.1rem;
    }

    .bet-adjuster {
        padding: 2px 5px;
        gap: 5px;
    }

    .bet-adjuster button {
        width: 25px;
        height: 25px;
        font-size: 1rem;
    }

    .text-content {
        margin-top: 20px;
        padding: 15px;
    }
}

/* Desktop Optimization (Cabinet Style) */
@media (min-width: 1024px) {
    .aztec-wrapper {
        flex-direction: row;
        align-items: flex-start;
        /* Align top */
        max-width: 1400px;
        /* Much wider container */
        gap: 30px;
        margin: 0 auto;
    }

    /* 1. Expand Grid Area */
    .stone-frame {
        width: 800px;
        /* Significantly larger */
        max-width: none;
        padding: 40px;
        /* More internal spaciousness */
    }

    .reel-cell.aztec-cell {
        font-size: 4.5rem;
        /* Huge symbols */
        width: 130px;
        height: 130px;
    }

    /* 2. Horizontal Layout for Center Column */
    .center-column {
        flex-direction: row !important;
        /* Force row layout */
        align-items: center;
        /* Center vertically relative to each other */
        gap: 30px;
    }

    /* 3. Controls as Vertical Sidebar (Right Side) */
    .aztec-controls {
        position: relative;
        left: auto;
        bottom: auto;
        transform: none;

        width: 250px;
        height: 600px;
        /* Match grid height roughly */

        flex-direction: column;
        justify-content: center;
        gap: 40px;

        background: linear-gradient(145deg, #2c1a12, #1a0f0a);
        border: 4px solid #ffd700;
        box-shadow: -5px 5px 20px rgba(0, 0, 0, 0.5);
    }

    .control-group {
        width: 100%;
        text-align: center;
    }

    .control-group .label {
        font-size: 1rem;
        margin-bottom: 10px;
        color: #ffd700;
    }

    .control-group .value {
        font-size: 2rem;
    }

    /* Bet Adjuster Vertical */
    .bet-adjuster {
        flex-direction: column;
        /* Stack - 20 + */
        gap: 15px;
        padding: 15px;
    }

    .bet-adjuster button {
        width: 50px;
        height: 50px;
    }

    /* Huge Spin Button */
    .aztec-spin-btn {
        width: 140px;
        height: 140px;
        font-size: 4rem;
        box-shadow: 0 10px 0 #8b0000, 0 15px 20px rgba(0, 0, 0, 0.5);
    }

    .aztec-spin-btn:active {
        box-shadow: 0 5px 0 #8b0000, 0 5px 10px rgba(0, 0, 0, 0.5);
    }

    /* Adjust Multiplier Bar (Left Side) to match height */
    .multiplier-bar {
        height: 600px;
        justify-content: center;
        gap: 20px;
        width: 100px;
    }

    .mult-item {
        width: 80px;
        height: 80px;
        font-size: 1.5rem;
    }
}