@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;700&display=swap');

:root {
    --bg-color: #0b1a13;
    --surface-color: #12291d;
    --primary-color: #10b981; /* Emerald Green */
    --accent-color: #fbbf24; /* Yellow Accent */
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border-color: #1f422e;
    --card-bg: #0d1f13;
    --nav-height: 70px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Typography Scaling */
h1, h2, h3, h4 {
    margin-top: 0;
    margin-bottom: 0.5em;
    font-weight: 700;
}

h1 { font-size: clamp(1.8rem, 5vw, 2.8rem); }
h2 { font-size: clamp(1.5rem, 4vw, 2.2rem); }
h3 { font-size: clamp(1.2rem, 3vw, 1.8rem); }

/* Layout Components */
.container {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

main {
    min-height: 100vh;
}

/* Nav Bar - Icon only, top-right corner on all pages */
nav {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 0.5rem 1rem;
    height: auto;
    background: transparent;
    backdrop-filter: none;
    border-bottom: none;
    position: fixed;
    top: 0;
    right: 0;
    left: auto;
    width: auto;
    z-index: 2000;
}

nav h1 {
    margin: 0;
    font-size: 1.8rem;
    color: var(--primary-color);
}

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

.auth-links {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.nav-user {
    color: var(--primary-color);
    font-weight: 600;
    font-size: 0.85rem;
    padding: 0.4rem 0.8rem;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.25);
    border-radius: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Profile Dropdown */
.profile-dropdown {
    position: relative;
    display: inline-block;
}

.profile-trigger {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    font-family: inherit;
}

.dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 10px);
    background-color: var(--surface-color);
    min-width: 200px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    z-index: 1001;
    overflow: hidden;
    animation: fadeIn 0.2s ease-out;
}

.dropdown-content.show {
    display: block;
}

.dropdown-header {
    padding: 1rem;
    background: rgba(255,255,255,0.03);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.dropdown-header strong {
    color: var(--primary-color);
}

.dropdown-content a {
    color: var(--text-main);
    padding: 0.8rem 1rem;
    text-decoration: none;
    display: block;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.dropdown-content a:hover {
    background-color: rgba(16, 185, 129, 0.1);
}

/* Distraction Free Mode */
body.distraction-free {
    overflow: hidden;
}

body.distraction-free #main-nav {
    position: fixed;
    top: 5px;
    right: 5px;
    background: transparent;
    backdrop-filter: none;
    border: none;
    height: auto;
    padding: 0;
    width: auto;
    z-index: 2000;
}

body.distraction-free #main-nav h1 {
    display: none;
}

body.distraction-free #main-nav .auth-links {
    gap: 0;
}

body.distraction-free .nav-user {
    padding: 10px;
    font-size: 1.5rem; /* Larger icon for easy tapping */
    background: rgba(18, 41, 29, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
}

body.distraction-free .user-text {
    display: none;
}

body.distraction-free main {
    padding: 0;
}

body.distraction-free .container {
    max-width: 100vw;
    width: 100vw;
    padding: 0;
    margin: 0;
}

body.distraction-free #game-container {
    margin: 0;
    border-radius: 0;
    width: 100vw;
    height: 100vh;
    min-height: 100vh;
    max-height: 100vh;
    border: none;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
    background: #000;
}

body.distraction-free .mission-header {
    display: none;
}

/* Speed Control inside Profile Icon? Or Floating Small? 
   User asked: "put speed contol inisde a three profile icon after starting game"
   Interpretation: Speed control should be inside the dropdown of the profile icon which is now visible in gameplay.
*/

.dropdown-speed-container {
    padding: 0.8rem 1rem;
    background: rgba(0,0,0,0.2);
}

.dropdown-speed-container label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    display: block;
    margin-bottom: 5px;
}

/* Mobile Game Controls - STRICT BOTTOM POSITIONING */
.mobile-controls {
    position: fixed !important;
    bottom: 20px !important;
    top: auto !important;
    left: 0 !important;
    width: 100% !important;
    display: none;
    justify-content: space-between;
    padding: 0 20px !important;
    pointer-events: none;
    z-index: 9999 !important; /* Highest possible priority */
}

body.distraction-free .mobile-controls {
    display: flex !important;
}

.control-btn {
    width: 80px;
    height: 80px;
    background: rgba(16, 185, 129, 0.4);
    backdrop-filter: blur(10px);
    border: 2px solid var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: #fff;
    cursor: pointer;
    pointer-events: auto;
    user-select: none;
    transition: all 0.1s;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.control-btn:active {
    background: var(--primary-color);
    transform: scale(0.9);
}

.pause-btn {
    width: 64px;
    height: 64px;
    font-size: 1.8rem;
    background: rgba(251, 191, 36, 0.3);
    border-color: #fbbf24;
}

.pause-btn.paused {
    background: rgba(16, 185, 129, 0.5);
    border-color: #10b981;
    animation: pulse-glow 1.5s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 10px rgba(16, 185, 129, 0.3); }
    50% { box-shadow: 0 0 25px rgba(16, 185, 129, 0.6); }
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    font-family: inherit;
    text-align: center;
}

.nav-btn {
    padding: 0.45rem 1.1rem;
    font-size: 0.9rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), #059669);
    color: #fff;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
}

.btn-outline:hover {
    background: rgba(16, 185, 129, 0.1);
    transform: translateY(-2px);
}

.btn-accent {
    background: var(--accent-color);
    color: #0b1a13;
}

.btn-accent:hover {
    background: #eab308;
    transform: translateY(-2px);
}

/* Cards & Forms */
.card {
    background-color: var(--card-bg);
    padding: 2.5rem;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    width: 100%;
    margin-bottom: 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.form-input, select, textarea, input[type="text"], input[type="password"], input[type="email"], input[type="file"] {
    width: 100%;
    padding: 0.8rem 1rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-main);
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.2s ease;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

/* Auth Pages */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    min-height: calc(100vh - var(--nav-height));
}

.auth-card {
    width: 100%;
    max-width: 450px;
    padding: 3rem 2.5rem;
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    margin-top: 2rem;
}

/* Stats */
.stat-card {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 2rem;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1.2;
}

/* Advisory Card Specifics */
.advice-card {
    background: rgba(0,0,0,0.2); 
    padding: 1.5rem; 
    margin-bottom: 1rem; 
    border-radius: 4px 12px 12px 4px;
    overflow-wrap: break-word; /* Ensure long words wrap */
    word-wrap: break-word;
}

.advice-card p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.6;
    white-space: normal; /* Force normal wrapping */
}

/* Loading Overlay */
#loading-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(11, 26, 19, 0.95);
    backdrop-filter: blur(8px);
    z-index: 9999;
    align-items: center; justify-content: center;
    flex-direction: column;
    text-align: center;
    padding: 2rem;
}

.spinner {
    width: 64px; height: 64px;
    border: 6px solid var(--border-color);
    border-top: 6px solid var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1.5rem;
}

@keyframes spin { 100% { transform: rotate(360deg); } }

/* Animations */
.fade-in {
    animation: fadeIn 0.6s ease-out forwards;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

/* RESPONSIVE BREAKPOINTS */

/* Up to Tablet */
@media (max-width: 992px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

/* Desktop/Large Laptop */
@media (min-width: 993px) {
    .dashboard-grid {
        grid-template-columns: 3fr 2fr;
    }
}

/* Mobile Devices */
@media (max-width: 768px) {
    nav {
        padding: 0.3rem 0.5rem;
    }
    
    .auth-links {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }

    .container {
        padding: 1.5rem 1rem;
    }

    .card, .stat-card {
        padding: 1.5rem;
    }

    .nav-user {
        max-width: none;
    }
}

/* Small Phones */
@media (max-width: 480px) {
    .btn {
        width: 100%;
    }
    
    .auth-links {
        gap: 0.5rem;
    }
}

