:root {
    --bg-color: #0f172a;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-color: #3b82f6;
    --accent-glow: rgba(59, 130, 246, 0.5);
    --card-bg: rgba(30, 41, 59, 0.7);
    --card-border: rgba(255, 255, 255, 0.1);
    --glass-blur: 16px;
    --font-main: 'Outfit', sans-serif;
    --font-tc: 'Noto Sans TC', sans-serif;
    --nav-height: 70px;
    --gradient-1: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    --gradient-2: linear-gradient(135deg, #3b82f6 0%, #2dd4bf 100%);
    --gradient-3: linear-gradient(135deg, #f43f5e 0%, #fb923c 100%);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-main), var(--font-tc);
    /* Default EN font first */
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
}

/* Background Animation */
.background-globes {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.globe {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
    animation: float 20s infinite ease-in-out alternate;
}

.globe-1 {
    width: 400px;
    height: 400px;
    background: #6366f1;
    top: -100px;
    left: -100px;
}

.globe-2 {
    width: 500px;
    height: 500px;
    background: #ec4899;
    bottom: -100px;
    right: -100px;
    animation-delay: -5s;
}

.globe-3 {
    width: 300px;
    height: 300px;
    background: #06b6d4;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: -10s;
}

@keyframes float {
    0% {
        transform: translate(0, 0) scale(1);
    }

    100% {
        transform: translate(30px, 50px) scale(1.1);
    }
}

/* Navbar */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--nav-height);
    background: rgba(15, 23, 42, 0.85);
    /* Slightly more opaque */
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border-bottom: 1px solid var(--card-border);
    z-index: 1000;
    display: flex;
    justify-content: center;
}

.nav-container {
    width: 100%;
    max-width: 1200px;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-family: var(--font-main);
    font-size: 1.5rem;
    font-weight: 700;
    background: var(--gradient-2);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo i {
    color: #3b82f6;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.nav-links {
    display: flex;
    gap: 2rem;
}

.nav-item {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    position: relative;
    font-size: 0.95rem;
}

.nav-item:hover,
.nav-item.active {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.nav-item.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 2px;
    background: var(--accent-color);
    border-radius: 2px;
}

/* Language Switcher */
.lang-btn {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: var(--accent-color);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    cursor: pointer;
    font-family: var(--font-main);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.lang-btn:hover {
    background: var(--accent-color);
    color: white;
    box-shadow: 0 0 15px var(--accent-glow);
}

/* Main Content */
.main-content {
    margin-top: var(--nav-height);
    padding: 4rem 2rem;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

.hero {
    text-align: center;
    margin-bottom: 5rem;
    animation: fadeInDown 0.8s ease-out;
}

.hero h1 {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    background: linear-gradient(to right, #fff, #94a3b8);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    letter-spacing: -1px;
}

.hero p {
    font-size: 1.25rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
}

/* Sections */
.level-section {
    margin-bottom: 6rem;
    animation: fadeInUp 0.8s ease-out forwards;
    opacity: 0;
}

.level-header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 2.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--card-border);
}

.level-icon {
    font-size: 3rem;
    background: rgba(255, 255, 255, 0.05);
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 20px;
}

.level-info h2 {
    font-size: 2.2rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.level-info p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Topics Grid */
.topics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2rem;
}

.topic-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    padding: 2rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
}

.topic-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--gradient-2);
    opacity: 0.7;
}

.topic-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    border-color: rgba(59, 130, 246, 0.4);
}

.topic-image {
    width: 100%;
    height: 160px;
    margin-bottom: 1.5rem;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    background: rgba(0, 0, 0, 0.2);
}

.topic-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.topic-card:hover .topic-image img {
    transform: scale(1.05);
}

.topic-title {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: #e2e8f0;
    font-weight: 600;
}

/* Formulas */
.formula-item {
    background: rgba(15, 23, 42, 0.5);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.formula-item:last-child {
    margin-bottom: 0;
}

.formula-header {
    margin-bottom: 0.8rem;
}

.formula-name {
    font-weight: 700;
    color: var(--accent-color);
    font-size: 1.1rem;
    letter-spacing: 0.02em;
}

.formula-explanation {
    font-size: 0.95rem;
    color: #cbd5e1;
    margin-bottom: 1rem;
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.badget {
    font-size: 0.7rem;
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    color: #64748b;
    font-weight: 600;
    text-transform: uppercase;
}

.formula-display {
    background: rgba(0, 0, 0, 0.3);
    padding: 1.25rem;
    border-radius: 12px;
    margin: 1rem 0;
    display: flex;
    justify-content: center;
    overflow-x: auto;
    border: 1px solid rgba(255, 255, 255, 0.03);
}

.formula-example {
    font-size: 0.9rem;
    color: #94a3b8;
    padding-top: 1rem;
    border-top: 1px dashed rgba(255, 255, 255, 0.1);
    margin-top: 1rem;
}

.example-label {
    color: #64748b;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-right: 0.5rem;
    display: block;
    margin-bottom: 0.5rem;
}

/* Footer */
.footer {
    text-align: center;
    padding: 3rem;
    border-top: 1px solid var(--card-border);
    margin-top: 4rem;
    color: var(--text-secondary);
    background: rgba(15, 23, 42, 0.8);
}

/* Utilities & Animations */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .nav-container {
        padding: 0 1rem;
    }

    .logo {
        font-size: 1.2rem;
    }

    .nav-links {
        display: none;
        /* Hide for mobile for now, can transform to hamburger if needed */
    }

    .hero h1 {
        font-size: 2.5rem;
    }

    .level-header {
        flex-direction: column;
        text-align: center;
    }

    .topics-grid {
        grid-template-columns: 1fr;
    }
}