/* CSS for overall layout and styling */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body {
    margin: 0; padding: 0; background-color: #1e1b4b;
    display: flex; flex-direction: column; height: 100vh; width: 100vw;
    overflow: hidden; font-family: 'Inter', sans-serif; /* Added a more modern font */
}
/* Game area wrapper - takes top 50% of screen height */
#game-wrapper {
    width: 100%; height: 50vh; background-color: #0f0c29; /* Dark space background */
    display: flex; justify-content: center; align-items: center;
    position: relative; border-bottom: 2px solid rgba(250, 204, 21, 0.3); /* Subtle divider */
    flex-shrink: 0; z-index: 10;
}
/* Actual Phaser game container, scaled to fit wrapper */
#game-container { width: 100%; height: 100%; max-width: 450px; }

/* --- LAYOUT FIXES --- */
#content-area {
    width: 100%; height: 50vh; position: relative;
    background: linear-gradient(180deg, #1e1b4b 0%, #000000 100%);
    display: flex; flex-direction: column;
    padding: 0; /* Removed padding so header and pages fit edge-to-edge */
}

/* NEW: Fixed Header for Title & Hamburger */
#content-header {
    width: 100%; padding: 15px 20px;
    display: flex; flex-direction: row-reverse; justify-content: center; align-items: center; position: relative;
    z-index: 100; background: rgba(30, 27, 75, 0.8);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

#content-header > div {
    text-align: center;
    margin-right: 40px; /* Balances the space taken by the hamburger button */
}

#menu-btn {
    position: absolute; left: 20px;
    background: rgba(250, 204, 21, 0.1); border: 1px solid rgba(250, 204, 21, 0.3);
    padding: 8px 12px; border-radius: 8px; color: #facc15; font-size: 20px; cursor: pointer;
}

/* --- CAROUSEL STRUCTURE --- */
#carousel-viewport { flex-grow: 1; width: 100%; overflow: hidden; position: relative; }

#carousel-container {
    display: flex; width: 400%; height: 100%; 
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.page { 
    width: 25%; height: 100%; padding: 20px; 
    display: flex; flex-direction: column; align-items: center;
    overflow-y: auto; /* THIS ENABLES SCROLLING IN THE BOTTOM BOX */
    -webkit-overflow-scrolling: touch;
    position: relative;
}

/* Only the visible page should be interactive to avoid adjacent overlap capturing */
.page { pointer-events: none; }
.page.active { pointer-events: auto; }

/* Leaderboard Timeframe Toggle - Pill Style */
.leaderboard-toggle {
    display: flex;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50px; /* Round pill shape */
    padding: 3px;
    margin-bottom: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    width: 90%;
    position: relative;
    z-index: 5; /* Ensure toggle stays above nearby content */
}

.leaderboard-toggle button {
    flex: 1;
    background: transparent;
    border: none;
    color: #94a3b8;
    padding: 6px 0;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    cursor: pointer;
    border-radius: 50px;
    transition: all 0.2s ease;
}

.leaderboard-toggle button.active {
    background: #facc15;
    color: #1e1b4b;
}

/* Data Box for Personal Stats */
.data-box {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 20px;
    width: 100%;
}

/* --- SIDE MENU --- */
#side-menu {
    position: fixed; top: 0; left: -280px; width: 280px; height: 100%;
    background: #0f0c29; z-index: 4000; transition: 0.3s ease;
    padding: 40px 20px; border-right: 2px solid #facc15;
}
#side-menu.open { left: 0; }
#menu-overlay { 
    position: fixed; top: 0; left: 0; width: 100%; height: 100%; 
    background: rgba(0,0,0,0.7); display: none; z-index: 3500; 
}

.table-title {
    margin: 0 0 10px 0;
    color: #facc15;
    font-size: 16px;
    text-align: center;
}

.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    color: #cbd5e1;
}

.leaderboard-table th {
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding: 8px;
    text-align: left;
    color: #94a3b8;
    font-size: 11px;
    text-transform: uppercase;
}

.leaderboard-table td {
    padding: 10px 8px;
    border-bottom: 1px solid rgba(255,255,255,0.03);
}
/* Styling for the title */
h1 { color: #facc15; font-size: 28px; margin: 0; text-transform: lowercase; }
h1 span { color: #ffffff; }

/* Full-screen overlay for onboarding/modals */
.overlay-screen {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(15, 12, 41, 0.95); /* Semi-transparent dark overlay */
    z-index: 1000; /* Ensure it's on top */
    display: none; justify-content: center; align-items: center; padding: 20px;
}
/* Card within the overlay */
.modal-card {
    background: #ffffff; color: #1e1b4b; padding: 30px;
    border-radius: 24px; width: 90%; max-width: 380px; text-align: center;
}
/* Primary action button styling */
.pi-button {
    background-color: #facc15; color: #2e1065; border: none; padding: 16px;
    border-radius: 14px; font-weight: 700; width: 100%; cursor: pointer;
    box-shadow: 0 4px 0px #ca8a04; margin-top: 10px;
    transition: transform 0.1s ease, box-shadow 0.1s ease; /* Smooth button press */
}
.pi-button:active { transform: translateY(2px); box-shadow: 0 2px 0px #ca8a04; }
/* Dropdown select styling */
select {
    width: 100%; padding: 12px; margin: 10px 0; border-radius: 8px;
    border: 2px solid #e2e8f0; background: #f8fafc; font-size: 16px; outline: none;
}

/* Styling for legal text readability */
#legal-content h2 { color: #1e1b4b; margin-top: 0; }
#legal-content p { font-size: 13px; line-height: 1.5; color: #475569; margin-bottom: 15px; }
#legal-content ul { padding-left: 20px; font-size: 13px; color: #475569; }