/* Custom thin scrollbar for tier options scroll area */
#tier-scroll-area {
    scrollbar-width: thin;
    scrollbar-color: #facc15 #1e1b4b;
}

#tier-scroll-area::-webkit-scrollbar {
    width: 6px;
    background: #1e1b4b;
}
#tier-scroll-area::-webkit-scrollbar-thumb {
    background: #facc15;
    border-radius: 6px;
}
/* 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 40% of screen height */
#game-wrapper {
    width: 100%; height: 40vh; 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%; }

/* Allow full-width game on small screens */
@media (max-width: 768px) {
    #game-container { width: 100%; height: 100%; }
}

/* --- LAYOUT FIXES --- */
#content-area {
    width: 100%; height: 60vh; 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: grid; grid-template-columns: 48px 1fr 48px; grid-template-rows: auto auto; align-items: start; 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 {
    grid-column: 2;
    grid-row: 1 / span 2; /* Center block spans both rows */
    text-align: center;
}

#menu-btn {
    grid-column: 1;
    grid-row: 1; /* Align with the title row */
    align-self: start;
    justify-self: start;
    width: 48px; height: 36px;
    background: rgba(250, 204, 21, 0.1); border: 1px solid rgba(250, 204, 21, 0.3);
    border-radius: 8px; color: #facc15; font-size: 20px; cursor: pointer;
    display: grid; place-items: center;
}

/* --- 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;*/
    text-align: center;
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin: 0 0 15px 0;
    color: #facc15;
    font-size: 16px;
    font-weight: 800;
    letter-spacing: 0.5px;
}

.nav-arrow {
    color: #facc15;
    font-size: 18px;
    font-weight: bold;
    opacity: 0.8;
    user-select: none;
    padding: 0 10px;
}

/* Pulsing effect to hint that you can swipe */
.nav-arrow:active {
    color: #facc15;
    transform: scale(1.2);
}

/* This makes sure the hidden arrows still take up space 
   so the title stays perfectly centered */
.nav-arrow[style*="visibility: hidden"] {
    opacity: 0;
}

.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; }

/* Prevent iOS Safari from auto-inflating text sizes */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

/* 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: clamp(12px, 3.5vw, 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 */
    font-size: clamp(14px, 4vw, 16px);
    line-height: 1.15;
}
.pi-button:active { transform: translateY(2px); box-shadow: 0 2px 0px #ca8a04; }
/* Responsive action buttons for Game Over tier options */
.action-button {
    flex: 1;
    padding: clamp(10px, 3.3vw, 14px);
    background: linear-gradient(135deg, #facc15 0%, #f59e0b 100%);
    color: #000;
    font-weight: 700;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: clamp(14px, 4vw, 16px);
    line-height: 1.15;
}

/* Game Over tier option card */
.tier-option {
    margin-bottom: 24px;
    padding: clamp(12px, 3vw, 16px);
    border: 2px solid rgba(250, 204, 21, 0.3);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.3);
}

/* Tier option header row */
.tier-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.tier-title {
    margin: 0;
    color: #facc15;
    font-size: clamp(16px, 4.5vw, 18px);
}
.tier-price {
    font-size: clamp(18px, 5vw, 20px);
    font-weight: bold;
    color: #fff;
}

/* Boards list and rows */
.tier-boards {
    margin-bottom: 12px;
    font-size: clamp(13px, 3.5vw, 14px);
}
.tier-board-row {
    padding: 6px 0;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

/* Notes for included boards */
.tier-note {
    font-size: clamp(12px, 3.3vw, 13px);
    color: #fff;
    margin-bottom: 8px;
    font-style: italic;
}

/* Action row */
.tier-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}
.tier-or {
    color: #fff;
    font-weight: 600;
}

/* Loading indicator under ads */
.ad-loading {
    margin-top: 8px;
    font-size: clamp(13px, 3.5vw, 14px);
    color: #fff;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Overlay title and score line (responsive) */
.overlay-title {
    color: #facc15;
    margin-bottom: 5px;
    font-size: clamp(18px, 5.5vw, 22px);
}
.overlay-score-line {
    font-size: clamp(14px, 4.5vw, 18px);
    color: #1e1b4b;
    margin-bottom: 10px;
}
.overlay-score-value {
    color: #1e1b4b;
    font-weight: bold;
}
/* 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; }