/* ================= CSS STYLES & VARIABLES ================= */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;700;900&family=Poppins:wght@300;500;700&display=swap');

:root {
    --bg-base: #030712; 
    --bg-surface: #111827; 
    --bg-surface-light: #1f2937;
    --accent-primary: #3b82f6; 
    --accent-secondary: #8b5cf6; 
    --accent-orange: #f97316;
    --success: #10b981; 
    --danger: #ef4444; 
    --text-primary: #f9fafb; 
    --text-secondary: #9ca3af;
    --font-heading: 'Montserrat', sans-serif; 
    --font-body: 'Poppins', sans-serif;
    --glass-border: rgba(255, 255, 255, 0.05);
}

/* Base Reset & Strict Mobile Overflow Lock */
* { margin: 0; padding: 0; box-sizing: border-box; scroll-behavior: smooth; }
html, body { 
    background-color: var(--bg-base); 
    color: var(--text-primary); 
    font-family: var(--font-body); 
    width: 100%;
    max-width: 100%;
    overflow-x: hidden; /* Prevents mobile right-side gap */
    position: relative; 
}

/* Custom Scrollbar */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--bg-surface-light); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-primary); }

/* Dynamic Background Elements */
.cyber-grid { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-image: linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px); background-size: 30px 30px; z-index: -2; pointer-events: none;}
.ambient-glow { position: fixed; border-radius: 50%; filter: blur(150px); z-index: -1; pointer-events: none;}
.glow-blue { top: -20%; left: -10%; width: 50vw; height: 50vw; background: rgba(59, 130, 246, 0.15); }
.glow-purple { bottom: -20%; right: -10%; width: 40vw; height: 40vw; background: rgba(139, 92, 246, 0.15); }
.text-gradient { background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }

/* ================= HEADER NAVBAR ================= */
.glass-navbar { position: sticky; top: 0; z-index: 100; background: rgba(3, 7, 18, 0.8); backdrop-filter: blur(20px); border-bottom: 1px solid var(--glass-border); padding: 15px 0; width: 100%; }
.nav-container { max-width: 1400px; margin: 0 auto; padding: 0 20px; display: flex; justify-content: space-between; align-items: center; width: 100%; }
.brand-logo { font-family: var(--font-heading); font-size: 22px; font-weight: 900; cursor: pointer; display: flex; align-items: center; gap: 8px; }
.brand-logo i { color: var(--accent-primary); }
.nav-links { display: flex; gap: 30px; }
.nav-links a { color: var(--text-secondary); text-decoration: none; font-weight: 500; transition: 0.3s; }
.nav-links a:hover, .nav-links a.active { color: var(--text-primary); }
.nav-store-link { color: var(--accent-orange) !important; font-weight: 700 !important; }
.nav-actions { display: flex; align-items: center; gap: 15px; }

.wallet-pill { background: rgba(249, 115, 22, 0.1); border: 1px solid rgba(249, 115, 22, 0.3); padding: 5px 12px 5px 5px; border-radius: 30px; display: flex; align-items: center; gap: 8px; cursor: pointer; transition: 0.3s; }
.wallet-pill:hover { box-shadow: 0 0 15px rgba(249, 115, 22, 0.3); }
.coin-icon-wrapper { background: var(--accent-orange); color: #fff; width: 24px; height: 24px; border-radius: 50%; display: flex; justify-content: center; align-items: center; font-size: 12px; }
.wallet-pill span { font-weight: 700; color: var(--accent-orange); font-size: 14px; }
.pts-text { font-size: 12px !important; }

.user-profile-trigger { display: flex; align-items: center; gap: 8px; cursor: pointer; background: var(--bg-surface); padding: 5px 10px 5px 5px; border-radius: 30px; border: 1px solid var(--glass-border); transition: 0.3s; }
.user-profile-trigger:hover { border-color: var(--accent-primary); }
.avatar-img { width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--accent-primary); }
.username { font-size: 14px; font-weight: bold; }

/* ================= MAIN HUB & LAYOUT ================= */
.hub-layout { max-width: 1000px; margin: 0 auto; padding: 40px 20px; display: flex; width: 100%; }
.center-wrapper { display: flex; flex-direction: column; align-items: center; text-align: center; width: 100%; }

.hero-section { padding: 40px 0; max-width: 800px; width: 100%; }
.beta-badge { display: inline-block; background: rgba(59, 130, 246, 0.1); color: var(--accent-primary); padding: 8px 20px; border-radius: 30px; font-weight: 700; font-size: 13px; margin-bottom: 25px; border: 1px solid rgba(59, 130, 246, 0.3); letter-spacing: 1px; }
.hero-title { font-family: var(--font-heading); font-size: 50px; font-weight: 900; line-height: 1.1; margin-bottom: 20px; text-transform: uppercase; }
.hero-subtitle { font-size: 16px; color: var(--text-secondary); margin-bottom: 40px; line-height: 1.6; max-width: 700px; margin-left: auto; margin-right: auto; }
.hero-buttons { display: flex; justify-content: center; gap: 20px; width: 100%; flex-wrap: wrap; }

/* Global Buttons */
.btn-primary { padding: 12px 24px; border-radius: 12px; font-weight: 700; font-family: var(--font-heading); font-size: 14px; cursor: pointer; border: none; text-transform: uppercase; background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary)); color: #fff; transition: 0.3s; display: flex; align-items: center; gap: 8px; justify-content: center;}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 5px 15px rgba(59,130,246,0.4); }
.btn-secondary { padding: 12px 24px; border-radius: 12px; font-weight: 700; font-family: var(--font-heading); font-size: 14px; cursor: pointer; display: flex; justify-content: center; align-items: center; gap: 8px; border: 1px solid rgba(255,255,255,0.1); background: var(--bg-surface); color: var(--text-primary); transition: 0.3s;}
.btn-secondary:hover { background: var(--bg-surface-light); border-color: var(--text-secondary); }
.btn-store-redirect { padding: 12px 24px; border-radius: 12px; font-weight: 700; font-family: var(--font-heading); font-size: 14px; cursor: pointer; display: flex; justify-content: center; align-items: center; gap: 8px; border: none; text-transform: uppercase; background: linear-gradient(90deg, #f97316, #ea580c); color: #fff; transition: 0.3s;}
.btn-store-redirect:hover { transform: translateY(-2px); box-shadow: 0 5px 15px rgba(249,115,22,0.4); }

/* ================= MASSIVE GAMES GRID ================= */
.games-showcase { width: 100%; text-align: center; }
.massive-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 25px; width: 100%; text-align: left; }
.game-card { background: var(--bg-surface); border: 1px solid var(--glass-border); border-radius: 20px; overflow: hidden; transition: 0.4s; position: relative; width: 100%; }
.game-card:hover { transform: translateY(-10px); border-color: var(--accent-primary); box-shadow: 0 15px 40px rgba(59,130,246,0.2); }
.card-image-box { height: 180px; background-size: cover; background-position: center; display: flex; justify-content: center; align-items: center; position: relative; }

/* BLANK IMAGE URLS AS REQUESTED 
   Add your local image paths here (e.g., url('images/arrow-game.jpg'))
*/
.arrow-bg { background-image: url(''); background-color: #0f172a; } 
.sudoku-bg { background-image: url(''); background-color: #064e3b; } 
.merge-bg { background-image: url(''); background-color: #451a03; } 
.slide-bg { background-image: url(''); background-color: #3b0764; } 
.spin-bg { background-image: url(''); background-color: #713f12; }

.card-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); display: flex; justify-content: center; align-items: center; opacity: 0; transition: 0.3s; backdrop-filter: blur(2px); }
.game-card:hover .card-overlay { opacity: 1; }
.btn-play-game { background: var(--accent-primary); color: #fff; border: none; padding: 12px 24px; border-radius: 30px; font-family: var(--font-heading); font-weight: 700; text-transform: uppercase; cursor: pointer; transition: 0.2s; transform: scale(0.9); }
.game-card:hover .btn-play-game { transform: scale(1); }
.btn-play-game:hover { background: var(--accent-secondary); box-shadow: 0 0 20px rgba(139, 92, 246, 0.6); }

.card-info { padding: 25px; }
.card-tags { display: flex; gap: 10px; margin-bottom: 15px; flex-wrap: wrap; }
.tag { font-size: 11px; font-weight: 700; text-transform: uppercase; padding: 4px 10px; border-radius: 20px; }
.tag-reward { background: rgba(249, 115, 22, 0.1); color: var(--accent-orange); border: 1px solid rgba(249, 115, 22, 0.3); }
.tag-skill { background: rgba(59, 130, 246, 0.1); color: var(--accent-primary); border: 1px solid rgba(59, 130, 246, 0.3); }

.card-info h3 { font-family: var(--font-heading); font-size: 18px; font-weight: 700; margin-bottom: 8px; }
.card-info p { color: var(--text-secondary); font-size: 13px; line-height: 1.5; }

/* ================= GAMEPLAY SCREENS & LAYOUTS ================= */
.gameplay-layout { display: none; justify-content: center; align-items: center; min-height: 80vh; padding: 20px; width: 100%; flex-direction: column; }
.play-container { background: var(--bg-surface); width: 100%; max-width: 500px; padding: 25px; border-radius: 24px; border: 1px solid var(--glass-border); box-shadow: 0 20px 50px rgba(0,0,0,0.5); }
.board-play-container { max-width: 800px; width: 100%; }
.play-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.btn-exit { background: transparent; color: var(--text-secondary); border: 1px solid var(--glass-border); padding: 8px 12px; border-radius: 8px; cursor: pointer; transition: 0.2s; font-weight: bold; font-size: 13px; }
.btn-exit:hover { background: rgba(255,255,255,0.05); color: #fff; border-color: var(--danger); }
.match-stats { font-weight: bold; color: var(--accent-primary); font-size: 14px; font-family: var(--font-heading); text-transform: uppercase; letter-spacing: 1px; text-align: right; }

/* Phaser Canvas Wrapper for Puzzles */
.board-wrapper { 
    background: #000; 
    border-radius: 12px; 
    border: 2px solid var(--glass-border); 
    overflow: hidden; 
    position: relative; 
    width: 100%; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    margin-bottom: 20px; 
    aspect-ratio: 1 / 1; 
    max-height: 70vh; 
    box-shadow: inset 0 0 50px rgba(0,0,0,0.8);
    /* THIS FIXES MOBILE GHOST CLICKS AND SCROLLING ON CANVAS */
    touch-action: none; 
    user-select: none;
}
#phaser-game-container canvas { 
    display: block; 
    width: 100% !important; 
    height: 100% !important; 
    object-fit: contain; 
}

/* ================= SCOREBOARDS & MODALS ================= */
.result-board { background: var(--bg-surface); padding: 40px 20px; border-radius: 24px; text-align: center; max-width: 450px; width: 100%; border: 2px solid var(--success); box-shadow: 0 0 30px rgba(16, 185, 129, 0.3); margin: 0 auto; }
.result-title { font-family: var(--font-heading); font-weight: 900; font-size: 24px; margin-bottom: 15px; color: #fff; }
.points-earned-box { background: rgba(249,115,22,0.1); border: 1px dashed var(--accent-orange); padding: 20px; border-radius: 12px; margin: 20px 0; }
.points-earned-box p { font-size: 12px; text-transform: uppercase; color: var(--text-secondary); margin-bottom: 5px; font-weight: bold; }
.points-earned-box h1 { font-family: var(--font-heading); font-size: 40px; font-weight: 900; }

.screen-overlay { position: fixed; inset: 0; width: 100%; height: 100%; background: rgba(3, 7, 18, 0.92); z-index: 500; display: none; justify-content: center; align-items: center; backdrop-filter: blur(8px); padding: 20px; }
.feedback-card { background: var(--bg-surface); padding: 25px; border-radius: 24px; text-align: center; width: 100%; max-width: 450px; position: relative; border: 1px solid rgba(255,255,255,0.1); box-shadow: 0 20px 50px rgba(0,0,0,0.6); max-height: 90vh; overflow-y: auto; }

.btn-close-modal { position: absolute; right: 20px; top: 20px; background: none; border: none; color: var(--text-secondary); font-size: 22px; cursor: pointer; transition: 0.2s; }
.btn-close-modal:hover { color: #fff; transform: rotate(90deg); }

.form-input { width: 100%; padding: 14px; border-radius: 8px; background: var(--bg-base); border: 1px solid var(--glass-border); color: #fff; outline: none; transition: 0.3s; margin-bottom: 15px; font-size: 14px; font-family: var(--font-body); }
.form-input:focus { border-color: var(--accent-primary); box-shadow: 0 0 10px rgba(59,130,246,0.2); }

/* Other Specific Modals */
.profile-card h2 { margin-bottom: 5px; font-size: 24px; }
.divider { width: 50px; height: 3px; background: var(--accent-primary); margin: 0 auto 20px; }
.stat-box { flex: 1; background: var(--bg-surface-light); padding: 15px 10px; border-radius: 12px; border: 1px solid var(--glass-border); }
.stat-box p { font-size: 11px; color: var(--text-secondary); text-transform: uppercase; margin-bottom: 5px; font-weight: bold; }
.stat-box h3 { font-size: 20px; color: #fff; }

.lb-row { background: var(--bg-surface-light); padding: 12px 15px; border-radius: 12px; margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; border: 1px solid transparent; font-size: 14px; }
.lb-pts { color: var(--success); font-weight: bold; font-family: var(--font-heading); }
.lb-highlight { border-color: var(--accent-orange); background: rgba(249, 115, 22, 0.1); }

#rules-content ul { padding-left: 20px; text-align: left; }
#rules-content li { margin-bottom: 8px; }

/* Wheel Animation Styles (FIXED ALIGNMENT) */
.wheel-container { position: relative; width: 260px; height: 260px; margin: 0 auto 25px; }
.wheel-pointer { position: absolute; top: -15px; left: 50%; transform: translateX(-50%); width: 0; height: 0; border-left: 15px solid transparent; border-right: 15px solid transparent; border-top: 35px solid var(--danger); z-index: 10; filter: drop-shadow(0 4px 4px rgba(0,0,0,0.5));}
.wheel { width: 100%; height: 100%; border-radius: 50%; border: 6px solid #fbbf24; transition: transform 4s cubic-bezier(0.17, 0.67, 0.12, 0.99); overflow: hidden; position: relative; background: conic-gradient(#10b981 0deg 36deg, #047857 36deg 72deg, #10b981 72deg 108deg, #047857 108deg 144deg, #10b981 144deg 180deg, #047857 180deg 216deg, #10b981 216deg 252deg, #047857 252deg 288deg, #10b981 288deg 324deg, #047857 324deg 360deg); box-shadow: 0 0 25px rgba(0,0,0,0.5); }

/* Fixed Text Center Alignment */
.wheel-text { 
    position: absolute; 
    top: 50%; 
    left: 50%; 
    font-weight: 900; 
    color: white; 
    font-size: 16px; 
    text-shadow: 2px 2px 4px rgba(0,0,0,0.9); 
    width: 40px;
    margin-left: -20px; 
    margin-top: -11px;  
    text-align: center;
    transform-origin: center center;
}

/* ================= FOOTER ================= */
.heavy-footer { background: #02040a; border-top: 1px solid var(--glass-border); padding: 60px 20px 20px; margin-top: 60px; width: 100%; }
.footer-grid { max-width: 1400px; margin: 0 auto; display: grid; grid-template-columns: 2fr 1fr; gap: 40px; margin-bottom: 40px; }
.footer-logo { font-family: var(--font-heading); font-size: 24px; font-weight: 900; margin-bottom: 15px; color: var(--text-primary); }
.footer-logo span { color: var(--accent-primary); }
.social-links { display: flex; gap: 15px; margin-top: 20px; }
.social-links a { width: 35px; height: 35px; border-radius: 50%; background: var(--bg-surface-light); display: flex; justify-content: center; align-items: center; color: var(--text-primary); text-decoration: none; transition: 0.3s; border: 1px solid var(--glass-border); font-size: 14px;}
.social-links a:hover { background: var(--accent-primary); border-color: var(--accent-primary); }
.footer-col h3 { font-family: var(--font-heading); font-size: 14px; font-weight: 700; margin-bottom: 20px; color: #fff; text-transform: uppercase; letter-spacing: 1px; }
.contact-col p { color: var(--text-secondary); font-size: 13px; line-height: 1.6; display: flex; gap: 10px; align-items: flex-start; }
.contact-col i { color: var(--accent-primary); font-size: 14px; margin-top: 3px; }
.footer-bottom { text-align: center; border-top: 1px solid rgba(255,255,255,0.05); padding-top: 20px; color: var(--text-secondary); font-size: 12px; }

/* Mobile Responsiveness */
@media(max-width: 992px) {
    .massive-grid { grid-template-columns: 1fr; }
    .footer-grid { grid-template-columns: 1fr; }
    .hero-title { font-size: 38px; }
    .nav-links { display: none; }
    .brand-logo { font-size: 20px; }
}
@media(max-width: 480px) {
    .hero-title { font-size: 32px; }
    .wheel-container { width: 220px; height: 220px; }
    .wheel-text { font-size: 14px; margin-top: -10px; }
}