:root {
    /* Color Palette */
    --bg-color: #111b21; /* Duolingo-style dark theme background */
    --surface-color: rgba(255, 255, 255, 0.08);
    /* Glassy card background - elevated legibility */
    --surface-hover: rgba(255, 255, 255, 0.12);
    --border-color: rgba(255, 255, 255, 0.15);
    
    --primary-color: #58cc02; /* Vibrant Gamified Green */
    --primary-dark: #46a302;
    --accent-color: #ffc800; /* Star/Coin Gold */
    --accent-dark: #cca000;
    --accent-glow: rgba(255, 200, 0, 0.4);

    --text-main: #ffffff;
    --text-muted: #afafaf;

    --positive: #58cc02;
    --negative: #ff4b4b; /* Vibrant Red for mistakes */

    /* Typography */
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Nunito', sans-serif;

    /* Layout */
    --max-width: 1280px;
    --nav-height: 80px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: 1.05rem;
    line-height: 1.7;
    letter-spacing: 0.015em;
    overflow-x: hidden;
    position: relative;
    padding-top: var(--nav-height);
}

/* Background Gradients (Dynamic feel) */
body::before {
    content: '';
    position: fixed;
    top: -20vh;
    left: -20vw;
    width: 60vw;
    height: 60vh;
    border-radius: 50%;
    background: radial-gradient(circle, var(--primary-color), transparent 70%);
    opacity: 0.15;
    filter: blur(100px);
    z-index: -1;
}

body::after {
    content: '';
    position: fixed;
    bottom: -20vh;
    right: -10vw;
    width: 40vw;
    height: 50vh;
    border-radius: 50%;
    background: radial-gradient(circle, var(--accent-color), transparent 70%);
    opacity: 0.08;
    filter: blur(100px);
    z-index: -1;
}

a {
    color: inherit;
    text-decoration: none;
    transition: all 0.2s ease;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-heading);
    font-weight: 700;
    line-height: 1.2;
}

h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
}

h2 {
    font-size: 2.25rem;
    margin-bottom: 1rem;
}

h3 {
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
}

p {
    color: var(--text-muted);
}

.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 2rem;
}

/* Base Components */
.btn-primary {
    background-color: var(--accent-color);
    color: #000;
    padding: 12px 24px;
    border-radius: 1rem;
    font-weight: 800;
    font-size: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--accent-dark);
    border-bottom-width: 6px;
    cursor: pointer;
    box-shadow: inset 0 2px 0 rgba(255,255,255,0.2);
    text-transform: uppercase;
    transition: all 0.1s;
    font-family: var(--font-body);
}

.btn-primary:active {
    transform: translateY(4px);
    border-bottom-width: 2px;
}

.btn-secondary {
    background-color: var(--surface-color);
    color: var(--text-main);
    padding: 12px 24px;
    border-radius: 1rem;
    font-weight: 800;
    font-size: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--border-color);
    border-bottom-width: 6px;
    cursor: pointer;
    text-transform: uppercase;
    transition: all 0.1s;
    box-shadow: inset 0 2px 0 rgba(255,255,255,0.05);
    font-family: var(--font-body);
}

.btn-secondary:hover {
    background-color: var(--surface-hover);
    border-color: rgba(255,255,255,0.2);
}

.btn-secondary:active {
    transform: translateY(4px);
    border-bottom-width: 2px;
}

/* Glass Card */
.glass-card {
    background-color: #1a252b; /* Solid dark background instead of highly translucent */
    border: 2px solid var(--border-color);
    border-bottom-width: 8px;
    border-bottom-color: rgba(0,0,0,0.6);
    border-radius: 1.5rem;
    box-shadow: inset 0 2px 0 rgba(255,255,255,0.1), 0 10px 20px rgba(0,0,0,0.5);
    backdrop-filter: none;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.glass-card:hover {
    transform: translateY(-2px);
}

/* 3D Buttons & Elements */
.btn-3d {
    background-color: var(--primary-color);
    border: 2px solid var(--primary-dark);
    border-bottom-width: 6px;
    border-radius: 1rem;
    color: white;
    font-weight: 800;
    text-transform: uppercase;
    transition: all 0.1s;
    box-shadow: inset 0 2px 0 rgba(255,255,255,0.2);
}

.btn-3d:active {
    transform: translateY(4px);
    border-bottom-width: 2px;
}

.btn-3d-secondary {
    background-color: var(--surface-color);
    border: 2px solid var(--border-color);
    border-bottom-width: 6px;
    border-radius: 1rem;
    color: var(--text-main);
    font-weight: 800;
    text-transform: uppercase;
    transition: all 0.1s;
}

.btn-3d-secondary:active {
    transform: translateY(4px);
    border-bottom-width: 2px;
}

.btn-nav {
    background-color: transparent;
    color: var(--text-muted);
    padding: 0.7rem 1.6rem;
    border-radius: 9999px;
    font-weight: 800;
    font-size: 1rem;
    letter-spacing: 0.05em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 2px solid transparent;
    border-bottom-width: 4px;
    cursor: pointer;
    text-transform: uppercase;
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    overflow: hidden;
}

.btn-nav:hover,
.btn-nav.active {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.25);
    color: var(--text-main);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.2), inset 0 2px 0 rgba(255, 255, 255, 0.15);
    transform: translateY(-3px);
}

.btn-nav.active {
    background-color: rgba(255, 200, 0, 0.2);
    border-color: var(--accent-color);
    color: var(--accent-color);
    box-shadow: 0 0 20px var(--accent-glow), inset 0 2px 0 rgba(255, 200, 0, 0.4);
    text-shadow: 0 0 8px rgba(255, 200, 0, 0.6);
}

.btn-nav:active {
    transform: translateY(2px);
    border-bottom-width: 2px;
    box-shadow: none;
}

/* Navigation */
.navbar {
    height: var(--nav-height);
    display: flex;
    align-items: center;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    background: rgba(13, 8, 21, 0.7);
    backdrop-filter: blur(15px);
    border-bottom: 1px solid var(--border-color);
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* CSS Implementation of User's Logo */
.brand-wirute {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 2.8rem;
    color: var(--accent-color);
    line-height: 1;
    letter-spacing: -2px;
}

.brand-subtitle-wrapper {
    display: flex;
    align-items: center;
    margin-top: -6px;
}

.brand-capital {
    background-color: #fff;
    color: var(--primary-color);
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 0.6rem;
    letter-spacing: 2px;
    padding: 2px 6px;
    text-transform: uppercase;
}

.brand-motto {
    color: #fff;
    font-family: var(--font-body);
    font-weight: 300;
    font-size: 0.65rem;
    margin-left: 8px;
    position: relative;
    top: 1px;
}

.brand-logo-container {
    display: flex;
    flex-direction: column;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    list-style: none;
}

.nav-links a {
    color: var(--text-muted);
    font-weight: 600;
    font-size: 1.1rem;
    position: relative;
    padding: 0.5rem 0;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--accent-color);
    transition: width 0.3s ease;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--text-main);
}

.nav-links a:hover::after,
.nav-links a.active::after {
    width: 100%;
}

.nav-auth {
    display: flex;
    gap: 1rem;
    align-items: center;
}

/* Hamburger / Mobile Nav Toggle */
.hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    background: transparent;
    border: none;
    padding: 0.5rem;
    border-radius: 8px;
    transition: background 0.2s;
    z-index: 200;
}
.hamburger:hover {
    background: rgba(255,255,255,0.05);
}
.hamburger span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text-main);
    border-radius: 2px;
    transition: all 0.3s ease;
    transform-origin: center;
}
.hamburger.open span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}
.hamburger.open span:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}
.hamburger.open span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* Mobile Nav Drawer */
.mobile-nav-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 105;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}
.mobile-nav-overlay.open {
    opacity: 1;
    visibility: visible;
}

.mobile-nav {
    display: flex;
    position: fixed;
    top: 0;
    right: -300px;
    width: 280px;
    height: 100vh;
    background: rgba(13, 8, 21, 0.98);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border-left: 1px solid var(--border-color);
    padding: 5rem 1.5rem 3rem;
    z-index: 110;
    flex-direction: column;
    gap: 0.5rem;
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
}
.mobile-nav.open {
    right: 0;
}
.mobile-nav a, .mobile-nav button.mobile-nav-btn {
    color: var(--text-muted);
    font-size: 1rem;
    font-weight: 500;
    padding: 0.65rem 0;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    width: 100%;
    text-align: left;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
    cursor: pointer;
    font-family: var(--font-body);
    transition: color 0.2s;
    display: block;
}
.mobile-nav a:hover, .mobile-nav button.mobile-nav-btn:hover {
    color: var(--accent-color);
}
.mobile-nav .mobile-sub-links {
    padding-left: 1rem;
    border-left: 2px solid var(--primary-color);
    margin: 0.25rem 0 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0;
}
.mobile-nav .mobile-sub-links a {
    font-size: 0.9rem;
    color: var(--text-muted);
    padding: 0.4rem 0;
    border-bottom: none;
}
.mobile-nav-divider {
    height: 1px;
    background: rgba(255,255,255,0.07);
    margin: 0.5rem 0;
}
.mobile-nav-auth {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}
.mobile-nav-auth .btn-primary, .mobile-nav-auth .btn-secondary {
    flex: 1;
    text-align: center;
    padding: 10px 16px;
    font-size: 0.95rem;
}

/* Mobile Sticky Bottom Nav */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 70px;
    background: rgba(13, 8, 21, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--border-color);
    z-index: 100;
    justify-content: space-around;
    align-items: center;
    padding-bottom: env(safe-area-inset-bottom);
}
.mobile-bottom-nav a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex: 1;
    height: 100%;
}
.mobile-bottom-nav a svg {
    width: 22px;
    height: 22px;
    margin-bottom: 4px;
    opacity: 0.7;
    transition: all 0.2s ease;
}
.mobile-bottom-nav a.active, .mobile-bottom-nav a:hover {
    color: var(--accent-color);
}
.mobile-bottom-nav a.active svg, .mobile-bottom-nav a:hover svg {
    opacity: 1;
    stroke: var(--accent-color);
}

/* Password Eye Toggle */
.password-wrapper {
    position: relative;
}
.password-wrapper input {
    padding-right: 2.75rem !important;
}
.password-toggle {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: rgba(255,255,255,0.4);
    padding: 0.25rem;
    display: flex;
    align-items: center;
    transition: color 0.2s;
}
.password-toggle:hover {
    color: rgba(255,255,255,0.8);
}
.password-toggle svg {
    width: 18px;
    height: 18px;
}

/* Hero Section */
.hero {
    display: flex;
    align-items: center;
    padding: 3rem 0;
}

.hero-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: center;
}

.hero-tag {
    display: inline-block;
    padding: 6px 16px;
    background: rgba(171, 205, 22, 0.1);
    color: var(--accent-color);
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    border: 1px solid rgba(171, 205, 22, 0.2);
}

.hero-title {
    font-size: 4.5rem;
    line-height: 1.1;
    margin-bottom: 1.5rem;
    background: linear-gradient(to right, #fff, #a39eb2);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-desc {
    font-size: 1.25rem;
    margin-bottom: 2.5rem;
    max-width: 500px;
}

.hero-actions {
    display: flex;
    gap: 1rem;
}

/* Market Tracker Grid */
.market-ticker {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stock-card {
    display: flex;
    flex-direction: column;
}

.stock-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.stock-ticker {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.25rem;
}

.stock-price {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.stock-change {
    font-size: 0.9rem;
    font-weight: 600;
}

.change-pos {
    color: var(--positive);
}

.change-neg {
    color: var(--negative);
}

.stock-chart-mock {
    height: 40px;
    width: 100%;
    margin-top: 1rem;
    opacity: 0.7;
}

/* Section Common */
.section {
    padding: 3rem 0;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 1.5rem;
}

.section-title {
    margin-bottom: 0.5rem;
}

/* Grid Layouts */
.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
}

/* Article Cards */
.article-card {
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
}

.article-img {
    height: 200px;
    background: #2a1f40;
    width: 100%;
}

.article-content {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.article-category {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--accent-color);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.article-title {
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
    line-height: 1.3;
}

.article-title a::after {
    display: none;
}

.article-excerpt {
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
    flex: 1;
}

.article-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
    font-size: 0.85rem;
}

/* Footer */
footer {
    border-top: 1px solid var(--border-color);
    padding: 3rem 0 2rem;
    background: rgba(13, 8, 21, 0.9);
    margin-top: 2rem;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 3rem;
    margin-bottom: 3rem;
}

.footer-col h4 {
    color: var(--text-main);
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
}

.footer-links {
    list-style: none;
}

.footer-links li {
    margin-bottom: 0.75rem;
}

.footer-links a {
    color: var(--text-muted);
}

.footer-links a:hover {
    color: var(--accent-color);
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 992px) {
    .hero-grid {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .hero-title {
        font-size: 3.5rem;
    }

    .hero-desc {
        margin: 0 auto 2.5rem;
    }

    .hero-actions {
        justify-content: center;
    }

    .grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .nav-links {
        display: none;
    }
    /* Hide desktop auth buttons on mobile — they appear in the mobile drawer instead */
    .nav-auth {
        display: none !important;
    }
    .hamburger {
        display: flex;
    }
    .navbar {
        position: sticky;
        top: 0;
        z-index: 1000;
        overflow: visible;
    }
    /* Prevent any descendant from causing horizontal scroll */
    .navbar .container {
        overflow: visible;
        max-width: 100%;
    }

    .grid-3,
    .grid-2 {
        grid-template-columns: 1fr;
    }

    /* Footer: override span-2 so columns don't overflow */
    .footer-grid {
        grid-template-columns: 1fr;
    }
    .footer-grid > [style*="grid-column: span 2"],
    .footer-grid > [style*="grid-column:span 2"] {
        grid-column: span 1 !important;
    }

    body {
        padding-bottom: calc(70px + env(safe-area-inset-bottom));
    }
    .mobile-bottom-nav {
        display: flex;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    /* Markets table: horizontal scroll */
    .market-table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border-radius: 16px;
    }
    .market-table-wrapper::after {
        content: 'Scroll →';
        display: block;
        text-align: right;
        font-size: 0.75rem;
        color: var(--text-muted);
        padding: 0.4rem 0.5rem 0;
        opacity: 0.6;
    }
    .market-table-wrapper table {
        min-width: 580px;
    }

    /* Hero live-stack: add breathing room below carousel */
    .hero-live-stack {
        padding-top: 1.5rem;
        border-top: 1px solid var(--border-color);
    }

    /* Buttons full-width on very small screens */
    .hero-actions {
        flex-wrap: wrap;
    }
    .hero-actions .btn-primary,
    .hero-actions .btn-secondary {
        width: 100%;
        text-align: center;
    }
}

/* Prevent horizontal scroll on all pages */
html, body {
    max-width: 100%;
    overflow-x: hidden;
}

/* Small phone breakpoint */
@media (max-width: 480px) {
    .hero-title {
        font-size: 2.4rem !important;
        line-height: 1.15;
    }
    .hero-desc {
        font-size: 1rem;
    }
    .hero-tag {
        font-size: 0.75rem;
    }
    .container {
        padding: 0 1rem;
    }
    .navbar .container {
        padding: 0 1rem;
    }
    .section {
        padding: 2rem 0;
    }
    .btn-primary, .btn-secondary {
        font-size: 0.9rem;
        padding: 10px 18px;
    }
}

/* Custom Utilities */
.text-accent {
    color: var(--accent-color);
}

.mb-1 {
    margin-bottom: 0.5rem;
}

.mb-2 {
    margin-bottom: 1rem;
}

.mb-3 {
    margin-bottom: 1.5rem;
}

.mb-4 {
    margin-bottom: 2rem;
}

/* Hero Carousel Customizations */
.swiper-pagination-bullet {
    background: rgba(255, 255, 255, 0.4);
    opacity: 1;
}
.swiper-pagination-bullet-active {
    background: var(--accent-color);
    width: 24px;
    border-radius: 4px;
    transition: all 0.3s ease;
}
.heroSwiper {
    padding-bottom: 30px; /* Leave room for pagination */
}