/* --- 1. Theme Variables --- */
:root {
    --bg-color: #f0f2f5;
    --text-color: #1c1e21;
    --card-bg: #ffffff;
    --toolbar-bg: #ffffff;
    --chat-bg: #fdfdfd;
    --border-color: #e2e8f0;
    --input-bg: #ffffff;
}

body.dark-theme {
    --bg-color: #18191a;
    --text-color: #e4e6eb;
    --card-bg: #242526;
    --toolbar-bg: #242526;
    --chat-bg: #18191a;
    --border-color: #3a3b3c;
    --input-bg: #3a3b3c;
}

/* --- 2. Base Styles --- */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding: 0;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.toolbar {
    background: var(--toolbar-bg);
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.nav-links { display: flex; gap: 10px; }

.nav-btn {
    background: none;
    border: none;
    font-weight: bold;
    color: #718096;
    cursor: pointer;
    padding: 8px 24px;
    border-radius: 50px;
    transition: 0.3s;
}

.nav-btn.active {
    background: #4A90E2;
    color: white;
}

#user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 2px solid #4A90E2;
    object-fit: cover;
    cursor: pointer;
}

.container {
    max-width: 600px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 0 15px;
}

h1 { text-align: center; color: #4A90E2; margin-top: 10px; }

.card {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

h2 { 
    margin-top: 0; 
    font-size: 1.2rem; 
    border-bottom: 2px solid var(--border-color); 
    padding-bottom: 10px; 
}

/* --- 3. UI Components --- */
.settings-content {
    background-color: var(--card-bg);
    color: var(--text-color);
    margin: 15vh auto;
    padding: 30px;
    border-radius: 16px;
    width: 280px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    border: 1px solid var(--border-color);
    position: relative;
    transition: background-color 0.3s ease;
}

.chat {
    height: 200px;
    background: var(--chat-bg);
    border: 1px solid var(--border-color);
    margin-bottom: 10px;
    padding: 10px;
    overflow-y: auto;
    border-radius: 8px;
}

.input-group { display: flex; gap: 10px; }

input { 
    flex: 1; 
    padding: 10px; 
    background: var(--input-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color); 
    border-radius: 6px; 
}

.btn {
    background: #4A90E2;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
}

.btn:hover { background: #357abd; }

/* --- 4. Toast Notifications --- */
.toast {
    background: #48bb78; /* Default Green Success */
    color: white;
    padding: 15px 25px;
    border-radius: 8px;
    margin-bottom: 10px;
    position: relative;
    min-width: 220px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    animation: slideIn 0.3s ease-out;
}

/* Error Toast Logic */
.toast.error {
    background: #e53e3e; /* Red Background for Errors */
}

.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 4px;
    background: rgba(255,255,255,0.5);
    width: 100%;
    border-bottom-left-radius: 8px;
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* --- 5. Game & Tab Logic --- */
.game-container {
    position: relative;
    width: 100%;
    max-width: 300px;
    margin: 0 auto;
}

canvas {
    background: #fafafa;
    border: 1px solid #ddd;
    border-radius: 8px;
    width: 100%;
    max-width: 300px;
    touch-action: none; 
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.tab-content { display: none; }
.tab-content.active { display: block; }

/* --- 6. Mobile Controls & Buttons --- */
.shoot-btn, .mobile-only-btn, .mobile-only-text {
    display: none; /* Hidden on Desktop */
}

/* Mobile/Touch Device Rules */
@media (pointer: coarse) {
    .shoot-btn {
        display: block;
        position: absolute;
        bottom: 20px;
        right: 15px;
        width: 85px;
        height: 85px;
        border-radius: 50%;
        background: #9c0000; /* Playful Vibrant Red */
        color: white;
        border: 4px solid white;
        font-family: 'Fredoka One', cursive; /* Playful Font */
        font-size: 1.1rem;
        box-shadow: 0 4px 15px rgba(0,0,0,0.3);
        cursor: pointer;
        z-index: 50;
        -webkit-tap-highlight-color: transparent;
    }

    .shoot-btn:active {
        transform: scale(0.9);
        background: #d53f8c;
    }

    .mobile-only-btn {
        display: inline-block;
    }

    .mobile-only-text {
        display: block;
    }

    .desktop-only-text {
        display: none;
    }
}

/* Full Screen Support */
#game-container:fullscreen {
    background-color: var(--bg-color);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100vw;
    height: 100vh;
}

/* --- Desktop: Normal Look --- */
.menu-toggle { display: none; }

/* --- Mobile: Dropdown Logic --- */
@media (max-width: 480px) {
    .menu-container { position: relative; }

    .menu-toggle {
        display: block;
        background: var(--border-color);
        border: none;
        padding: 8px 12px;
        border-radius: 8px;
        cursor: pointer;
        color: var(--text-color);
    }

    .nav-links {
        display: none; /* Hide by default */
        flex-direction: column;
        position: absolute;
        top: 45px;
        left: 0;
        background: var(--card-bg);
        border: 1px solid var(--border-color);
        border-radius: 8px;
        padding: 10px;
        box-shadow: 0 4px 12px rgba(0,0,0,0.15);
        z-index: 1000;
        min-width: 120px;
    }

    /* Show class for JS to toggle */
    .nav-links.open {
        display: flex;
    }

    .nav-btn {
        width: 100%;
        text-align: left;
        border-radius: 4px;
    }

    /* Keep Title and Avatar small to fit everything */
    h1 { font-size: 1.2rem; margin: 0; }
}

#game-container:fullscreen {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #000; /* Or your game's sky color */
}

#jumpGame {
    /* Prevents the browser from trying to "smooth" the pixels */
    image-rendering: pixelated; 
    background-color: #ebf8ff; /* Match your game sky */
}

/* --- Fix for rogue underlining --- */
* {
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Ensure our special buttons never underline */
.nav-btn, .btn, .nav-btn:hover, .btn:hover {
    text-decoration: none !important;
}

/* Prevent the score from underlining */
#jumpScore, .controls p {
    text-decoration: none !important;
    display: inline-block;
}

/* THE ULTIMATE FIX FOR ROGUE UNDERLINES */

/* 1. Force-remove underlines from everything by default */
* {
    text-decoration: none !important;
}

/* 2. Only allow underlines for actual links inside cards or specific text */
a, .card a, #powered-by-link {
    text-decoration: none !important;
}

/* 3. Only show underline when the mouse is SPECIFICALLY over a link */
a:hover, #powered-by-link:hover {
    text-decoration: underline !important;
}

/* 4. Ensure navigation and buttons are NEVER underlined */
.nav-btn, .btn, .nav-btn *, .btn * {
    text-decoration: none !important;
}

/* Cage the Google Sign-In button */
.account-zone {
    position: relative;
    overflow: hidden; /* Prevents invisible links from leaking out */
    max-height: 40px;
}

/* Cage the Barca Widget */
#widget-container {
    position: relative;
    overflow: hidden;
    z-index: 1;
}

/* The 'Nuclear' Fix: If an invisible link is covering the page, 
   this forces it to have a size of 0 unless it's inside a valid container */
body > a {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

/* Ensure your container is the only thing taking up space */
.container {
    position: relative;
    z-index: 10; /* Keeps your content ABOVE any rogue background links */
}
