:root {
    /* Declare native color scheme support to prevent Android force-dark */
    color-scheme: light dark;

    /* Modern Palette - Light Mode */
    --primary-color: #4F46E5;
    --primary-dark: #4338ca;
    --secondary-color: #8B5CF6;
    --accent-color: #EC4899;

    --text-primary: #111827;
    --text-secondary: #4B5563;
    --text-light: #9CA3AF;

    --bg-primary: #ffffff;
    --bg-secondary: #F3F4F6;
    --bg-tertiary: #E5E7EB;
    --card-bg: #ffffff;

    --gradient-primary: linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%);
    --gradient-surface: linear-gradient(180deg, rgba(255,255,255,0.8) 0%, rgba(255,255,255,0.4) 100%);

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);

    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.5);
    --glass-blur: 12px;

    --card-border: rgba(0,0,0,0.05);
}

[data-theme="dark"] {
    /* Modern Palette - Dark Mode */
    --primary-color: #6366F1;
    --primary-dark: #818CF8;
    --secondary-color: #A78BFA;
    --accent-color: #F472B6;

    --text-primary: #F9FAFB;
    --text-secondary: #9CA3AF;
    --text-light: #6B7280;

    --bg-primary: #0F172A;
    --bg-secondary: #1E293B;
    --bg-tertiary: #334155;
    --card-bg: #1E293B;

    --gradient-primary: linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%);
    --gradient-surface: linear-gradient(180deg, rgba(30,41,59,0.8) 0%, rgba(30,41,59,0.4) 100%);

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.4);

    --glass-bg: rgba(15, 23, 42, 0.7);
    --glass-border: rgba(255, 255, 255, 0.05);

    --card-border: rgba(255,255,255,0.05);
}

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    overflow-x: hidden;
}

body {
    font-family: 'Inter', sans-serif;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    line-height: 1.6;
    min-height: 100vh;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Helper Classes */
.hidden {
    display: none !important;
}

/* Background Decoration */
.background-decoration {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.background-decoration::before,
.background-decoration::after {
    content: '';
    position: absolute;
    width: 800px;
    height: 800px;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.15;
    animation: floatBg 20s ease-in-out infinite alternate;
}

.background-decoration::before {
    background: var(--primary-color);
    top: -200px;
    left: -200px;
}

.background-decoration::after {
    background: var(--secondary-color);
    bottom: -200px;
    right: -200px;
    animation-delay: -10s;
}

@keyframes floatBg {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(100px, 50px) scale(1.1); }
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

a {
    text-decoration: none;
    color: inherit;
}

/* Header & Nav */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(var(--glass-blur));
    background: var(--glass-bg);
    border-bottom: 1px solid var(--glass-border);
    transition: all 0.3s ease;
}

.nav {
    padding: 1rem 0;
}

.nav-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
}

.logo:hover {
    color: var(--text-primary);
    text-decoration: none;
}

.logo-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--gradient-primary);
    color: white;
    border-radius: 10px;
    font-family: 'Prompt', sans-serif;
    font-size: 1.5rem;
    font-weight: 500;
    box-shadow: var(--shadow-md);
}

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

.nav-link {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.875rem;
    transition: color 0.2s;
}

.nav-link:hover {
    color: var(--text-primary);
}

.nav-auth {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    margin-left: 0.5rem;
    padding-left: 1.5rem;
    border-left: 1px solid var(--card-border);
}

.nav-auth .nav-link {
    font-size: 0.875rem;
}

.nav-auth .nav-link:not(.btn) {
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
}

.nav-auth .nav-link:not(.btn):hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

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

/* Language Switcher */
.lang-switcher {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-left: 1rem;
    padding-left: 1rem;
    border-left: 1px solid var(--card-border);
}

.lang-link {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 0.25rem;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.lang-link:hover {
    color: var(--primary-color);
    background: var(--bg-secondary);
}

.lang-link.active {
    color: var(--primary-color);
    background: var(--bg-secondary);
    font-weight: 600;
}

.lang-sep {
    color: var(--text-light);
    font-size: 0.75rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-weight: 500;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
    font-size: 0.875rem;
    letter-spacing: 0.01em;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    filter: none;
}

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

.btn-secondary:hover {
    background: var(--bg-secondary);
    transform: translateY(-1px);
    border-color: rgba(0,0,0,0.1);
}

.btn-white {
    background: white;
    color: #4F46E5; /* Always primary for this specific button */
}

.btn-white:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}

.btn-large {
    padding: 0.875rem 2rem;
    font-size: 1.1rem;
}

/* Hero Section */
.hero {
    padding: 8rem 0 6rem;
    position: relative;
    overflow: hidden;
}

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

.badge-pill {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary-color);
    border-radius: 100px;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.hero-title {
    font-size: 4rem;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    letter-spacing: -0.03em;
}

.gradient-text {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: 2.5rem;
    max-width: 540px;
}

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

/* Hero Visual (Floating Cards) */
.hero-visual {
    position: relative;
    height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.character-showcase {
    position: relative;
    width: 100%;
    height: 100%;
}

.showcase-card {
    position: absolute;
    width: 160px;
    height: 180px;
    background: var(--bg-primary);
    border-radius: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--card-border);
    transition: transform 0.3s;
}

.thai-char {
    font-family: 'Noto Sans Thai Looped', serif;
    font-size: 5rem;
    color: var(--text-primary);
    line-height: 1;
}

.thai-name {
    margin-top: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
}

.floating-1 {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
    animation: float1 6s ease-in-out infinite;
}

.floating-2 {
    top: 20%;
    left: 10%;
    transform: scale(0.8) rotate(-10deg);
    z-index: 1;
    opacity: 0.8;
    animation: float2 7s ease-in-out infinite;
}

.floating-3 {
    bottom: 20%;
    right: 10%;
    transform: scale(0.8) rotate(10deg);
    z-index: 1;
    opacity: 0.8;
    animation: float3 8s ease-in-out infinite;
}

@keyframes float1 {
    0%, 100% { transform: translate(-50%, -50%); }
    50% { transform: translate(-50%, -60%); }
}
@keyframes float2 {
    0%, 100% { transform: translate(0, 0) scale(0.8) rotate(-10deg); }
    50% { transform: translate(0, -20px) scale(0.8) rotate(-10deg); }
}
@keyframes float3 {
    0%, 100% { transform: translate(0, 0) scale(0.8) rotate(10deg); }
    50% { transform: translate(0, -20px) scale(0.8) rotate(10deg); }
}

/* Features Section */
.features {
    padding: 6rem 0;
}

.section-header {
    text-align: center;
    margin-bottom: 4rem;
}

.section-title {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.section-desc {
    font-size: 1.125rem;
    color: var(--text-secondary);
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 2rem;
}

.feature-card {
    background: var(--bg-secondary);
    padding: 2rem;
    border-radius: 1.5rem;
    border: 1px solid var(--card-border);
    transition: all 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-5px);
    background: var(--bg-primary);
    box-shadow: var(--shadow-lg);
    border-color: rgba(99, 102, 241, 0.2);
}

.feature-icon-bg {
    width: 3rem;
    height: 3rem;
    background: var(--bg-primary);
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.feature-icon {
    font-size: 1.5rem;
}

.feature-title {
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.feature-description {
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1.6;
}

/* Stats Section */
.stats-section {
    padding: 4rem 0;
    border-top: 1px solid var(--card-border);
    border-bottom: 1px solid var(--card-border);
    background: var(--bg-secondary);
}

.stats-grid {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4rem;
}

.stats-grid-5 {
    gap: 2.5rem;
}

.stats-grid-5 .stat-number {
    font-size: 2.75rem;
}

.stats-grid-5 .stat-separator {
    height: 50px;
}

.stats-grid-6 {
    gap: 1.75rem;
}

.stats-grid-6 .stat-number {
    font-size: 2.25rem;
}

.stats-grid-6 .stat-separator {
    height: 45px;
}

.stat-item {
    text-align: center;
}

.stat-number {
    font-size: 3.5rem;
    font-weight: 800;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1;
    margin-bottom: 0.5rem;
}

.stat-label {
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.875rem;
    letter-spacing: 0.05em;
}

.stat-separator {
    width: 1px;
    height: 60px;
    background: var(--card-border);
}

/* CTA */
.cta {
    padding: 6rem 0;
}

.cta-card {
    background: var(--gradient-primary);
    border-radius: 2rem;
    padding: 4rem 2rem;
    text-align: center;
    color: white;
    box-shadow: var(--shadow-xl);
    position: relative;
    overflow: hidden;
}

.cta-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at top right, rgba(255,255,255,0.2), transparent 60%);
}

.cta-title {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    position: relative;
    color: white;
}

.cta-subtitle {
    font-size: 1.25rem;
    margin-bottom: 2.5rem;
    opacity: 0.9;
    position: relative;
}

.cta .btn {
    position: relative;
    z-index: 1;
}

/* Footer */
.footer {
    padding: 4rem 0;
    background: var(--bg-primary);
    border-top: 1px solid var(--card-border);
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.footer-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
}

.footer-logo:hover {
    color: var(--text-primary);
    text-decoration: none;
}

.footer-text {
    margin-top: 1rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.footer-right {
    display: flex;
    gap: 2rem;
}

.footer-link {
    color: var(--text-secondary);
    font-weight: 500;
    transition: color 0.2s;
}

.footer-link:hover {
    color: var(--primary-color);
}

/* Mobile & Responsive */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 20px;
    cursor: pointer;
    z-index: 1001;
}

.mobile-menu-btn span {
    width: 100%;
    height: 2px;
    background: var(--text-primary);
    transition: all 0.3s;
}

@media (max-width: 768px) {
    .hero-grid {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 3rem;
    }

    .hero-content {
        order: 2;
    }

    .hero-visual {
        order: 1;
        height: 300px;
    }

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

    .hero-subtitle {
        margin-left: auto;
        margin-right: auto;
    }

    .hero-actions {
        justify-content: center;
        flex-direction: column;
    }

    .stats-grid {
        flex-direction: column;
        gap: 2rem;
    }

    .stat-separator {
        width: 60px;
        height: 1px;
    }

    .mobile-menu-btn {
        display: flex;
    }

    .nav-links {
        position: fixed;
        top: 0;
        right: 0;
        height: 100vh;
        width: 80%;
        max-width: 300px;
        background: var(--bg-primary);
        flex-direction: column;
        padding: 6rem 2rem;
        box-shadow: var(--shadow-xl);
        border-left: 1px solid var(--card-border);
        transform: translateX(100%);
        visibility: hidden;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.3s;
    }

    .nav-links.active {
        transform: translateX(0);
        visibility: visible;
    }

    .footer-content {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 2rem;
    }

    .stats-grid-5 {
        gap: 1rem;
    }

    .stats-grid-5 .stat-number {
        font-size: 2rem;
    }

    .stats-grid-5 .stat-separator {
        display: none;
    }

    .stats-grid-6 {
        gap: 0.75rem;
    }

    .stats-grid-6 .stat-number {
        font-size: 1.75rem;
    }

    .stats-grid-6 .stat-separator {
        display: none;
    }

    .training-modes {
        flex-direction: column;
    }
}

/* Training Preview Section */
.training-preview {
    padding: 6rem 0;
    background: var(--bg-secondary);
}

.training-modes {
    display: flex;
    gap: 2rem;
    justify-content: center;
}

.training-mode-card {
    background: var(--card-bg);
    border-radius: 1.5rem;
    padding: 2rem;
    flex: 1;
    max-width: 400px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--card-border);
    transition: transform 0.3s, box-shadow 0.3s;
}

.training-mode-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.mode-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.mode-icon {
    font-size: 1.75rem;
}

.mode-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.mode-demo {
    background: var(--bg-secondary);
    border-radius: 1rem;
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.demo-question {
    text-align: center;
    margin-bottom: 1.25rem;
}

.demo-thai {
    font-size: 3.5rem;
    font-family: 'Noto Sans Thai Looped', serif;
    color: var(--primary-color);
    font-weight: 600;
}

.demo-transcription {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary-color);
}

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

.demo-option {
    background: var(--card-bg);
    padding: 0.625rem 1rem;
    border-radius: 0.5rem;
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-secondary);
    border: 1px solid var(--card-border);
}

.demo-option-thai {
    font-family: 'Noto Sans Thai Looped', serif;
    font-size: 1.5rem;
    padding: 0.5rem 1rem;
}

.mode-description {
    color: var(--text-secondary);
    font-size: 0.95rem;
    text-align: center;
}

/* CTA Buttons */
.cta-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    position: relative;
    z-index: 1;
}

.btn-outline-white {
    background: transparent;
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.5);
}

.btn-outline-white:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.8);
}

/* Secondary Button */
.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--card-border);
}

.btn-secondary:hover {
    background: var(--bg-tertiary);
}
