:root {
    --primary: #ff9800;
    --accent: #00bcd4;
    --bg: #fffbe7;
    --card-bg: #fff;
    --text: #222;
    --shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Segoe UI', 'Arial', sans-serif;
    background: #f1f2f6;
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-size: 0.85rem;
}

.container {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 24px;
    flex: 1;
}

header {
    text-align: center;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: white;
}

header.header-hidden {
    visibility: hidden;
    opacity: 0;
    position: fixed;
    top: 0;
    width: 100%;
    pointer-events: none;
    transition: opacity 0.2s;
    z-index: 999;
}

.items-grid {
    display: grid;
    grid-template-columns: repeat(1, minmax(280px, 1fr));
    gap: 2rem;
    padding: 0;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(8px);
    border-radius: 1rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    width: 100%;
    margin: 0;
}

@media (min-width: 900px) {
    .items-grid {
        grid-template-columns: repeat(2, minmax(280px, 1fr));
    }
}

@media (min-width: 1200px) {
    .items-grid {
        grid-template-columns: repeat(3, minmax(280px, 1fr));
    }
}

.item-image {
    width: 120px;
    height: 120px;
    object-fit: contain;
    margin-bottom: 1.2rem;
    border-radius: 12px;
    background: #f3f4f6;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.item-title {
    font-size: 0.95rem;
    font-weight: 700;
    margin: 0.5rem 0 0.2rem 0;
    text-align: center;
    color: #222;
}

.item-price {
    font-size: 0.85rem;
    color: #10b981;
    font-weight: 600;
    margin-bottom: 1.1rem;
    text-align: center;
}

.item-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.7rem;
    margin-bottom: 0.7rem;
}

.item-qty {
    width: 70px;
    min-width: 70px;
    text-align: center;
    font-size: 1rem;
    font-family: 'Menlo', 'Consolas', 'monospace';
    border: 1.5px solid #e0e7ef;
    border-radius: 8px;
    padding: 0.4rem 0.4rem;
    background: #f9fafb;
    color: #222;
    outline: none;
    box-sizing: border-box;
    overflow: visible;
}

.buy-btn,
.sell-btn {
    background: linear-gradient(90deg, #10b981 60%, #34d399 100%);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 0.4rem 1rem;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.08);
}

.sell-btn {
    background: linear-gradient(90deg, #ff416c 0%, #ff4b2b 100%);
    color: #fff;
    border: 2px solid #ff416c;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(255, 65, 108, 0.15);
    font-weight: 700;
    letter-spacing: 0.5px;
    transition: background 0.2s, border 0.2s, transform 0.2s, box-shadow 0.2s;
}

.sell-btn:hover {
    background: linear-gradient(90deg, #ff4b2b 0%, #ff416c 100%);
    border: 2px solid #ff4b2b;
    filter: brightness(1.12);
    transform: scale(1.09) rotate(-2deg);
    box-shadow: 0 6px 24px rgba(255, 65, 108, 0.22);
}

.buy-btn:hover,
.sell-btn:hover {
    filter: brightness(1.08);
    transform: scale(1.07);
}

.total-spent {
    font-size: 0.8rem;
    color: #6366f1;
    margin-top: 0.5rem;
    min-height: 1.2em;
    text-align: center;
}

@media (max-width: 1400px) and (min-width: 1200px) {
    .container {
        max-width: 1200px;
        padding: 24px 24px 0 24px;
    }

    .items-grid {
        grid-template-columns: repeat(3, minmax(280px, 1fr));
        gap: 30px;
        padding: 30px 20px;
    }
}

@media (max-width: 1200px) {
    .container {
        max-width: 1000px;
        padding: 24px 24px 0 24px;
    }

    .items-grid {
        grid-template-columns: repeat(2, minmax(280px, 1fr));
        gap: 30px;
        padding: 30px 20px;
    }
}

@media (max-width: 1600px) {
    .container {
        max-width: 1800px;
        /* Even wider for ultra-wide screens */
        margin: 32px auto 0 auto;
        padding: 32px 60px 0 60px;
        /* More side padding */
        flex: 1;
        display: flex;
        flex-direction: column;
    }

    .items-grid {
        grid-template-columns: repeat(3, minmax(280px, 1fr)) !important;
    }

    @media (max-width: 1200px) {
        .container {
            max-width: 1200px;
            padding: 32px 32px 0 32px;
        }

        .items-grid {
            grid-template-columns: repeat(3, minmax(300px, 1fr));
        }
    }

    @media (max-width: 1200px) {
        .container {
            max-width: 1000px;
            padding: 24px 24px 0 24px;
        }

        .items-grid {
            grid-template-columns: repeat(2, minmax(280px, 1fr));
            gap: 30px;
            padding: 30px 20px;
        }
    }

    @media (max-width: 900px) {
        .container {
            padding: 12px 16px 0 16px;
            max-width: 100%;
        }

        .items-grid {
            grid-template-columns: 1fr;
            gap: 20px;
            padding: 20px 10px;
        }
    }
}

@media (max-width: 1399px) and (min-width: 800px) {
    .items-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 799px) {

    .item-emoji {
        font-size: 3.2rem;
        margin-bottom: 1rem;
    }
}

@media (max-width: 900px) and (min-width: 800px) {
    .container {
        max-width: 100vw;
        padding: 8px 2vw 0 2vw;
        box-sizing: border-box;
    }

    .items-grid {
        grid-template-columns: 1fr 1fr;
        gap: 16px;
        padding: 12px 2vw;
    }
}

header {
    text-align: center;
    margin-bottom: 16px;
    position: sticky;
    top: 0;
    z-index: 100;
    background: white;
    padding: 8px 0 6px 0;
    padding: 24px 0;
    transition: all 0.3s ease;
}

h1 {
    font-size: 1rem;
    margin-bottom: 4px;
    color: var(--primary);
    letter-spacing: 1px;
    font-weight: 800;
    text-shadow: 0 2px 8px rgba(255, 152, 0, 0.12);
}

#wealth-remaining {
    font-size: 2rem;
    font-weight: bold;
    /* margin-bottom: 4px; */
    color: rgb(0, 0, 0);
    /* background: rgba(255, 255, 255, 0.9); */
    display: inline-block;
    padding: 6px 20px;
    /* border-radius: 24px; */
    /* box-shadow: 0 2px 12px rgba(0, 188, 212, 0.12); */
    /* border: 1px solid var(--accent); */
}

#timer {
    font-size: 1.1rem;
    color: #795548;
    margin: 8px 20px 0 0;
    font-weight: 600;
    letter-spacing: 1px;
}

#reset-btn {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 8px 28px;
    border-radius: 22px;
    font-size: 0.85rem;
    cursor: pointer;
    margin-top: 10px;
    transition: background 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 8px rgba(255, 152, 0, 0.10);
    font-weight: 600;
}

#reset-btn:hover {
    background: #e65100;
    box-shadow: 0 4px 18px rgba(255, 152, 0, 0.18);
}

.item-card:hover {
    /* Remove transform and box-shadow for no hover animation */
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.10);
    /* No transform */
}

.item-emoji {
    font-size: 4.2rem;
    margin-bottom: 1.5rem;
}

.item-name {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 8px;
    text-align: center;
    color: #222;
}

.item-cost {
    font-size: 1.1rem;
    color: var(--primary);
    margin-bottom: 18px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.quantity-controls {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 10px;
}

.quantity-btn {
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 38px;
    height: 38px;
    font-size: 1.4rem;
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 8px rgba(0, 188, 212, 0.10);
    display: flex;
    align-items: center;
    justify-content: center;
}

.quantity-btn:hover {
    background: #00acc1;
    box-shadow: 0 4px 18px rgba(0, 188, 212, 0.18);
}

.quantity {
    font-size: 1.3rem;
    min-width: 32px;
    text-align: center;
    font-weight: 700;
}

.total-spent {
    font-size: 1.05rem;
    color: #388e3c;
    margin-top: 4px;
    font-weight: 600;
}

@media (max-width: 1400px) {

    /* New breakpoint for slightly smaller large screens */
    .container {
        max-width: 1100px;
        padding: 24px 24px 0 24px;
    }

    .items-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 30px;
        padding: 30px 20px;
    }
}

@media (max-width: 900px) {
    .container {
        padding: 12px 16px 0 16px;
        /* Adjusted padding */
        max-width: 100%;
        /* Ensure it doesn't exceed screen width */
    }

    .items-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        /* Ensure cards can fit */
        gap: 20px;
        /* Adjusted gap */
        padding: 20px 10px;
        /* Adjusted padding */
    }

    header {
        max-width: 100%;
    }
}

@media (max-width: 600px) {
    .container {
        padding: 10px 8px 0 8px;
        /* Adjusted padding */
    }

    .items-grid {
        grid-template-columns: 1fr;
        /* Single column for small screens */
        gap: 15px;
        /* Adjusted gap */
        padding: 15px 5px;
        /* Adjusted padding */
    }



    h1 {
        font-size: 1.3rem;
    }

    #wealth-remaining {
        font-size: 1.2rem;
        padding: 6px 10px;
    }
}

footer {
    text-align: center;
    font-size: 0.95rem;
    color: #888;
    margin: 24px 0 12px 0;
}

footer a {
    color: var(--accent);
    text-decoration: none;
}

/* Modal Styles */
.modal {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.45);
}

.modal-content {
    background: white;
    border-radius: 20px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
    text-align: center;
    min-width: 320px;
    max-width: 500px;
    padding: 18px 16px;
}

@keyframes popIn {
    0% {
        transform: scale(0.7) translateY(60px);
        opacity: 0;
    }

    70% {
        transform: scale(1.05) translateY(-8px);
        opacity: 1;
    }

    100% {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

#play-btn,
#result-modal button[type="submit"],
#result-modal button {
    background: linear-gradient(90deg, var(--accent) 60%, var(--accent) 100%);
    color: #fff;
    border: none;
    padding: 14px 38px;
    border-radius: 28px;
    font-size: 1.15rem;
    font-weight: 700;
    cursor: pointer;
    margin-top: 18px;
    margin-bottom: 6px;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.13);
    letter-spacing: 1px;
    transition: transform 0.18s, box-shadow 0.18s, background 0.18s;
    outline: none;
    position: relative;
    overflow: hidden;
}

#play-btn:hover,
#result-modal button[type="submit"]:hover,
#result-modal button:hover {
    background: linear-gradient(90deg, #11998e 0%, #38f9d7 100%);
    transform: scale(1.07) translateY(-2px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
}

#play-btn:active,
#result-modal button[type="submit"]:active,
#result-modal button:active {
    transform: scale(0.97);
}

#countdown-number {
    font-size: 4.5rem;
    color: var(--primary);
    font-weight: bold;
    animation: countdownPulse 1s infinite;
}

@keyframes countdownPulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.25);
        opacity: 0.7;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Add a confetti background to the result modal on success */
#result-modal.success .modal-content {
    background: linear-gradient(120deg, #fffbe7 60%, #ffe082 100%);
    box-shadow: 0 12px 40px rgba(255, 193, 7, 0.18);
    border: 2px solid var(--primary);
    position: relative;
    overflow: hidden;
}

#result-modal.success .modal-content::before {
    content: "";
    position: absolute;
    left: -40px;
    top: -40px;
    right: -40px;
    bottom: -40px;
    background: url('https://cdn.pixabay.com/photo/2017/01/31/13/14/confetti-2024631_1280.png') repeat;
    opacity: 0.08;
    z-index: 0;
    pointer-events: none;
}

#result-modal .modal-content>* {
    position: relative;
    z-index: 1;
}

#result-modal input,
#result-modal button {
    margin: 8px 0;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid #ddd;
    font-size: 1rem;
}

#result-modal button {
    background: var(--primary);
    color: #fff;
    border: none;
    cursor: pointer;
}

#result-modal button:hover {
    background: #e65100;
}

/* Leaderboard */
#leaderboard-section {
    width: 100%;
    margin: 15px auto 0 auto;
    border-radius: 18px;
    padding: 18px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 400px;
    background: none;
}

.leaderboard-table-wrapper {
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.07);
    padding: 32px 32px 24px 32px;
    margin: 0 auto;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

#leaderboard-table {
    margin: 0 auto;
    max-width: 900px;
    width: 100%;
}

#leaderboard-section h2 {
    text-align: center;
    color: var(--primary);
    margin-bottom: 10px;
    width: 100%;
}

#leaderboard-table th,
#leaderboard-table td {
    white-space: nowrap;
    padding: 4px 8px;
    /* Existing padding */
    font-size: 0.95em;
    /* Existing font size */
    vertical-align: middle;
    text-align: start;
}

@media (max-width: 600px) {
    .modal-content {
        margin: 24px 20px;
        max-width: 95vw;
        box-sizing: border-box;
    }
}

#leaderboard-section {
    padding: 8px 2px;
}

#leaderboard-table th,
#leaderboard-table td {
    font-size: 0.85em;
    /* Slightly smaller font for mobile */
    padding: 6px 4px;
    /* Adjust padding for mobile */
}

#leaderboard-table {
    min-width: auto;
    /* Remove min-width on mobile or set to a smaller value if needed */
}

@media (max-width: 600px) {
    #start-modal .modal-content {
        padding: 18px 6px 12px 6px;
        border-radius: 18px;
        min-width: 0;
        max-width: 96vw;
        max-height: 90vh;
        overflow-y: auto;
    }

    #start-modal h2 {
        font-size: 1.2rem;
        margin-bottom: 10px;
    }

    #start-modal .modal-description {
        font-size: 0.98rem;
        margin-bottom: 18px;
    }

    #play-btn.glow-button {
        font-size: 1.05rem;
        padding: 12px 18px;
        border-radius: 18px;
    }
}

@media (min-width: 600px) and (max-width: 1000px) {
    #start-modal .modal-content {
        min-width: 340px;
        max-width: 480px;
        padding: 32px 24px 24px 24px;
        border-radius: 28px;
    }

    #start-modal h2 {
        font-size: 1.7rem;
        margin-bottom: 14px;
    }

    #start-modal .modal-description {
        font-size: 1.13rem;
        margin-bottom: 24px;
    }

    #play-btn.glow-button {
        font-size: 1.18rem;
        padding: 16px 38px;
        border-radius: 24px;
    }
}

#compact-header {
    position: sticky;
    top: 0;
    left: 0;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 2.5vw;
    z-index: 1000;
    min-height: 48px;
    font-size: 2rem;
    transition: box-shadow 0.2s, background 0.2s;
}

.compact-header-center {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2.5em;
    width: 100%;
}

#compact-wealth-remaining {
    font-weight: bold;
    color: #000000;
    font-size: 1.1em;
}

#compact-timer {
    color: #795548;
    font-weight: 600;
    font-size: 1.1em;
}

@media (max-width: 600px) {
    #compact-header {
        font-size: 0.95rem;
        padding: 0.5rem 1vw;
    }

    .compact-header-center {
        gap: 1em;
    }
}

.site-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    /* padding: 0 16px; */
    width: 100%;
    box-sizing: border-box;
}


.game-card {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    padding: 1rem;
    border-radius: 8px;
    margin: 0 -16px;
}

.item-card {
    width: 100% !important;
    padding: 0 1rem;
    background: white;
    padding: 1rem;
}

.item-emoji {
    display: flex;
    justify-content: center;
    align-items: center;
}

@media (min-width:576px) {
    .item-card {
        width: 48% !important;
        background: white;
    }

    .game-card {

        margin: 0 -25px;
    }
}

@media (min-width:992px) {
    .item-card {
        width: 32% !important;
        background: white;
    }

    .game-card {

        margin: 0 -25px;
    }
}

.banner-ads-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 24px;
    margin: 16px 0;
}

.banner-ad {
    display: flex;
    justify-content: center;
    align-items: center;
}

.banner-ads-desktop {
    display: flex;
}

.banner-ads-mobile {
    display: none;
}

@media (max-width: 700px) {
    .banner-ads-desktop {
        display: none !important;
    }

    .banner-ads-mobile {
        display: flex !important;
        flex-direction: column;
        gap: 0;
    }

    .banner-ads-row {
        gap: 0;
        margin: 12px 0;
    }
}

.grid-banner-ad {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 24px 0;
    width: 100%;
    grid-column: 1 / -1;
}

@media (max-width: 700px) {
    .grid-banner-ad {
        margin: 16px 0;
    }
}

.thankyou-modal-content {
    padding: 0 !important;
    background: #fff;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    border-radius: 20px;
    overflow: hidden;
    max-width: 340px;
    width: 90vw;
}

.thankyou-modal-content img {
    width: 100%;
    height: 260px;
    object-fit: cover;
    display: block;
    border-radius: 0 0 0 0;
    margin: 0;
    padding: 0;
}

.thankyou-btn-attractive {
    width: 100%;
    padding: 18px 0;
    margin: 0;
    background: linear-gradient(90deg, #ff9800 0%, #00bcd4 100%);
    color: #fff;
    font-size: 1.35rem;
    font-weight: 800;
    border: none;
    border-radius: 0 0 20px 20px;
    cursor: pointer;
    letter-spacing: 1px;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.10);
    transition: background 0.2s, box-shadow 0.2s, transform 0.15s;
}

.thankyou-btn-attractive:hover {
    background: linear-gradient(90deg, #00bcd4 0%, #ff9800 100%);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
    transform: scale(1.04);
}