:root {
    --bg-dark: #0f172a;
    --bg-card: rgba(30, 41, 59, 0.7);
    --accent: #38bdf8;
    --accent-hover: #0ea5e9;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --glass-border: rgba(255, 255, 255, 0.1);
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

html {
    background-color: var(--bg-dark);
}

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    margin: 0 auto;
    max-width: 480px;
    overflow-x: hidden;
}

#app-wrapper {
    background-color: var(--bg-dark);
    width: 100%;
    min-height: 100vh;
    position: relative;
    overflow-x: clip;
    overflow-y: visible;
}

@media (min-width: 481px) {
    body {
        background-color: #f1f5f9;
    }
    #app-wrapper {
        box-shadow: var(--shadow);
    }
}

.container {
    padding: 0 1.5rem;
}

/* Background Glow (constrained inside app wrapper) */
.bg-glow {
    position: absolute;
    width: 300px;
    height: 300px;
    border-radius: 100%;
    background: radial-gradient(circle, rgba(56, 189, 248, 0.1) 0%, rgba(56, 189, 248, 0) 70%);
    z-index: -1;
    filter: blur(80px);
    pointer-events: none;
}

.bg-glow-1 {
    top: -100px;
    left: -100px;
}

.bg-glow-2 {
    bottom: -100px;
    right: -100px;
}

/* ════════════════════════════════════════════
   Preserved Reward Section (Exact Screenshot Style)
   ════════════════════════════════════════════ */
.reward-section {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    background: #fffde7;
    margin: 12px 0;
    border-radius: 18px;
    border: 1.5px solid #ffe082;
    width: 100%;
}

.coin-display {
    display: flex;
    align-items: center;
    gap: 7px;
    background: #ffffff;
    padding: 7px 16px;
    border-radius: 50px;
    border: 2.5px solid #f9a825;
}

.custom-coin-icon {
    width: 18px;
    height: 18px;
    background: #f9a825;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.custom-coin-inner {
    width: 6px;
    height: 10px;
    background: #ffffff;
    border-radius: 2px;
}

.coin-balance {
    font-size: 20px;
    font-weight: 900;
    color: #f9a825;
}

.earn-coins-btn {
    flex: 1;
    background: #4caf50;
    border: none;
    border-radius: 50px;
    padding: 11px 28px;
    color: #ffffff;
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
    transition: transform 0.2s;
    font-family: inherit;
    text-align: center;
}

.earn-coins-btn:active { transform: scale(0.97); }

/* ════════════════════════════════════════════
   Preserved Search + Categories (Exact Screenshot Style)
   ════════════════════════════════════════════ */
.search-category-container {
    background: #f0f0f0;
    border-radius: 18px;
    padding: 14px;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.search-container {
    background: #ffffff;
    border-radius: 50px;
    padding: 10px 18px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.search-svg {
    flex-shrink: 0;
}

.game-search-input {
    flex: 1;
    width: 100%;
    padding: 0;
    border: none;
    background: transparent;
    font-size: 15px;
    color: #333333;
    font-weight: 700;
    font-family: inherit;
    outline: none;
}

.game-search-input::placeholder {
    color: #bbbbbb;
    font-weight: 700;
}

.category-filters {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 2px;
}
.category-filters::-webkit-scrollbar { display: none; }

.category-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 14px;
    background: #ffffff;
    border: none;
    border-radius: 14px;
    cursor: pointer;
    transition: transform 0.2s;
    flex-shrink: 0;
}

.cat-icon {
    font-size: 22px;
    line-height: 1;
}

.cat-label {
    font-size: 10px;
    font-weight: 800;
    color: #555555;
    letter-spacing: 0.5px;
    font-family: inherit;
}

.category-btn:active { transform: scale(0.95); }

.category-btn.active {
    background: #1a1a24;
    color: #ffffff;
    box-shadow: 0 6px 12px rgba(26, 26, 36, 0.3);
}

.category-btn.active .cat-label {
    color: #ffffff;
}

/* Header */
header {
    height: 80px;
    border-bottom: 1px solid var(--glass-border);
}

.header-content {
    height: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo-icon {
    font-size: 2rem;
}

.logo h1 {
    font-size: 1.5rem;
    letter-spacing: 2px;
    font-weight: 700;
    color: #fff;
}

.logo h1 span {
    color: var(--accent);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

/* Note: .coin-balance and .earn-coins-btn are already defined above for the preserved section. 
   We'll use those definitions unless they clash. */

/* Ad Containers */
.ad-container {
    width: 100%;
    max-width: 100%;
    margin: 2rem auto;
    padding: 0 1rem;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    overflow: hidden;
    min-height: 100px;
}

.ad-container .adsbygoogle {
    width: 100%;
    min-height: 90px;
}

.ad-label {
    font-size: 0.6rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 0.5rem;
    text-align: center;
    width: 100%;
    opacity: 0.6;
}

/* Section Common */
.section-header {
    margin-bottom: 1.5rem;
    position: relative;
}

.section-title {
    font-size: 1.5rem;
    color: #fff;
    font-weight: 700;
    display: inline-block;
}

.section-underline {
    width: 100px;
    height: 3px;
    background: var(--accent);
    margin-top: 0.5rem;
}

/* Game Grid */
.game-grid,
.recent-grid {
    margin: 2rem 0 4rem;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

/* Game Card */
.game-card {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    overflow: hidden;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    display: flex;
    flex-direction: column;
}

.game-card:hover {
    transform: translateY(-8px);
    border-color: var(--accent);
    box-shadow: var(--shadow);
}

.game-thumb {
    width: 100%;
    aspect-ratio: 16/9;
    background: #1e293b;
    position: relative;
    overflow: hidden;
}

.game-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.game-card:hover .game-thumb img {
    transform: scale(1.1);
}

.game-info {
    padding: 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.game-info .title {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.game-info .sub {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.play-badge {
    position: absolute;
    bottom: 1.2rem;
    right: 1.2rem;
    background: var(--accent);
    color: var(--bg-dark);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    opacity: 0;
    transform: scale(0.5);
    transition: var(--transition);
}

.game-card:hover .play-badge {
    opacity: 1;
    transform: scale(1);
}

/* Recent Badge Tag */
.recent-badge-tag {
    position: absolute;
    top: 10px;
    left: 10px;
    background: #22c55e;
    color: #fff;
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 700;
    z-index: 5;
    text-transform: uppercase;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}

/* Modal */
.game-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
}

.modal-overlay {
    position: absolute;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
}

.modal-content {
    position: relative;
    width: 95%;
    height: 90%;
    max-width: 1000px;
    background: var(--bg-dark);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    z-index: 1001;
    box-shadow: var(--shadow);
}

.modal-header {
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.02);
}

.close-btn {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
}

.game-wrapper {
    flex: 1;
    background: #000;
}

#game-frame {
    width: 100%;
    height: 100%;
    border: none;
}

.modal-footer {
    padding: 0.8rem 1.5rem;
    background: rgba(255, 255, 255, 0.02);
    display: flex;
    justify-content: flex-end;
}

.fullscreen-btn {
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
}

.fullscreen-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
}

/* Footer */
footer {
    padding: 3rem 0;
    border-top: 1px solid var(--glass-border);
    margin-top: 2rem;
}

.footer-content {
    text-align: center;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    transition: var(--transition);
}

.footer-links a:hover {
    color: var(--accent);
}

.footer-content p {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

/* About Section */
.about-section {
    margin-top: 2rem;
    padding: 2rem;
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    backdrop-filter: blur(10px);
}

.about-section h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--accent);
}

.about-section p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 1rem;
}

.about-section ul {
    list-style: none;
    padding-left: 0;
}

.about-section li {
    position: relative;
    padding-left: 1.5rem;
    margin-bottom: 0.8rem;
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.5;
}

.about-section li::before {
    content: "➜";
    position: absolute;
    left: 0;
    color: var(--accent);
}

/* Legal Content */
.legal-content {
    padding: 2rem 0 4rem;
}

.legal-content h1 {
    font-size: 2rem;
    margin-bottom: 2rem;
    color: var(--accent);
}

.legal-content h2 {
    font-size: 1.3rem;
    margin: 2rem 0 1rem;
    color: #fff;
}

.legal-content p {
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 1.2rem;
}

.legal-content-card {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: 20px;
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
}

/* Loader */
.loader {
    text-align: center;
    color: var(--text-secondary);
    padding: 2rem 1rem;
    font-size: 0.85rem;
}