/* Math Adventure Island Design System */
@import url('https://fonts.googleapis.com/css2?family=ZCOOL+KuaiLe&family=Nunito:wght@400;600;700;800&display=swap');

:root {
    /* Colors */
    --primary-start: #4FACFE;
    --primary-end: #00F2FE;
    --secondary-start: #FF9A9E;
    --secondary-end: #FECFEF;
    --accent-yellow: #FFD200;
    --accent-green: #2ecc71;
    --text-dark: #2C3E50;
    --text-light: #FDFBF7;
    --bg-cream: #FDFBF7;
    --card-bg: #FFFFFF;
    --shadow-sm: 0 4px 6px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 10px 15px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 20px 25px rgba(0, 0, 0, 0.1);

    /* Spacing */
    --radius-lg: 24px;
    --radius-md: 16px;
    --radius-sm: 8px;

    /* Theme Transition */
    --transition-speed: 0.3s;
}

body.dark-mode {
    --bg-cream: #1a1a2e;
    --text-dark: #ecf0f1;
    --card-bg: #16213e;
    --primary-start: #0f3460;
    --primary-end: #533483;
    --secondary-start: #e94560;
    --secondary-end: #fa99a8;
}

body.dark-mode .hero {
    background: radial-gradient(circle at top right, #16213e, transparent 40%),
        radial-gradient(circle at bottom left, #0f3460, transparent 40%);
}

body.dark-mode .problem-section:nth-child(even) {
    background-color: #111;
}

body.dark-mode .concept-box,
body.dark-mode .challenge-box {
    background: #1f2833;
    color: #ecf0f1;
    border-color: #333;
}

body.dark-mode .input-group input {
    background: #0f3460;
    color: white;
    border-color: #533483;
}

body.dark-mode .topic-card.completed {
    background: linear-gradient(to bottom right, #16213e, #0f3460);
    border-color: var(--accent-green);
}

/* Theme Toggle Button */
.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s;
}

.theme-toggle:hover {
    transform: rotate(30deg) scale(1.1);
}

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

body {
    font-family: 'Nunito', sans-serif;
    background-color: var(--bg-cream);
    color: var(--text-dark);
    line-height: 1.6;
    overflow-x: hidden;
}

h1,
h2,
h3,
h4 {
    font-family: 'ZCOOL KuaiLe', cursive;
    /* Playful font for headers */
    color: var(--text-dark);
}

/* Utilities */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.btn {
    display: inline-block;
    padding: 12px 32px;
    border-radius: 50px;
    font-family: 'ZCOOL KuaiLe', cursive;
    font-size: 1.2rem;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: none;
    box-shadow: var(--shadow-md);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-start), var(--primary-end));
    color: white;
}

.btn-secondary {
    background: linear-gradient(135deg, var(--secondary-start), var(--secondary-end));
    color: white;
}

.btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: var(--shadow-lg);
}

.section-title {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 2rem;
    background: linear-gradient(135deg, var(--primary-start), var(--primary-end));
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    -webkit-text-fill-color: transparent;
    display: inline-block;
}

/* Animation Container */
.lab-visual {
    width: 100%;
    min-width: 500px;
    margin: 2rem auto;
    display: block;
}

/* Animations */
@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-20px);
    }
}

@keyframes popIn {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}


/* Progress Bar */
.progress-container {
    width: 100%;
    max-width: 600px;
    background-color: rgba(255, 255, 255, 0.5);
    border-radius: 50px;
    margin: 1.5rem auto;
    padding: 4px;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.8);
}

.progress-bar {
    height: 20px;
    background: linear-gradient(90deg, #FFD200, #F7971E);
    border-radius: 50px;
    width: 0%;
    transition: width 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    box-shadow: 0 2px 5px rgba(255, 210, 0, 0.4);
    position: relative;
}

.progress-text {
    position: absolute;
    right: 10px;
    top: -25px;
    font-size: 0.9rem;
    font-weight: bold;
    color: #7f8c8d;
}

/* Stars */
.star-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 1.5rem;
    opacity: 0.2;
    transform: scale(0.8);
    transition: all 0.4s ease;
    filter: grayscale(100%);
}

.topic-card.completed .star-badge {
    opacity: 1;
    transform: scale(1.2) rotate(15deg);
    filter: grayscale(0%);
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.topic-card.completed {
    border-color: var(--accent-green);
    background: linear-gradient(to bottom right, #ffffff, #f0fff4);
}

/* Hero Section */
.hero {
    min-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    background: radial-gradient(circle at top right, #eefbfc, transparent 40%),
        radial-gradient(circle at bottom left, #fff0f1, transparent 40%);
    position: relative;
    overflow: hidden;
}

.hero-content {
    z-index: 2;
    animation: popIn 0.8s ease-out;
}

.hero h1 {
    font-size: 4.5rem;
    margin-bottom: 1rem;
    text-shadow: 2px 2px 0px rgba(0, 0, 0, 0.1);
}

.hero p {
    font-size: 1.5rem;
    color: #7f8c8d;
    margin-bottom: 2.5rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.floating-shape {
    position: absolute;
    opacity: 0.1;
    z-index: 1;
    animation: float 6s ease-in-out infinite;
}

/* Topic Grid */
.level-title {
    grid-column: 1 / -1;
    font-size: 1.8rem;
    color: var(--text-dark);
    margin: 2rem 0 1rem;
    padding-left: 1rem;
    border-left: 5px solid var(--primary-start);
}

.topic-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    padding: 4rem 0;
}

.topic-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 2rem;
    text-align: center;
    transition: all 0.4s ease;
    cursor: pointer;
    border: 2px solid transparent;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.topic-card:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-end);
}

.topic-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    display: block;
    transition: transform 0.3s ease;
}

.topic-card:hover .topic-icon {
    transform: scale(1.2) rotate(10deg);
}

.topic-card h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.topic-card p {
    color: #7f8c8d;
    font-size: 0.95rem;
}

/* Problem Detail Sections */
.problem-section {
    padding: 6rem 0;
    min-height: 80vh;
    border-bottom: 1px dashed #e0e0e0;
}

.problem-section:nth-child(even) {
    background-color: #f8fcfd;
}

.problem-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    align-items: start;
}

.concept-box {
    background: white;
    padding: 2.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border-left: 8px solid var(--primary-start);
}

.example-box {
    background: #2C3E50;
    color: white;
    padding: 2rem;
    border-radius: var(--radius-md);
    margin-top: 1.5rem;
    font-family: 'Nunito', monospace;
}

.example-box h4 {
    color: var(--accent-yellow);
    margin-bottom: 1rem;
}

.challenge-box {
    background: linear-gradient(135deg, #fff, #fefefe);
    padding: 2.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    border: 2px solid var(--secondary-start);
}

.input-group {
    margin: 1.5rem 0;
}

.input-group input {
    width: 100%;
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-size: 1.1rem;
    outline: none;
    transition: border-color 0.3s;
}

.input-group input:focus {
    border-color: var(--secondary-start);
}

.result-message {
    margin-top: 1rem;
    font-weight: bold;
    opacity: 0;
    transition: opacity 0.3s;
}

.result-message.success {
    color: var(--accent-green);
    opacity: 1;
}

.result-message.error {
    color: #e74c3c;
    opacity: 1;
}

/* Footer */
footer {
    text-align: center;
    padding: 3rem;
    background: var(--text-dark);
    color: white;
    font-family: 'ZCOOL KuaiLe', cursive;
}

/* Responsive */
@media (max-width: 768px) {
    .hero h1 {
        font-size: 2.5rem;
    }

    .problem-container {
        grid-template-columns: 1fr;
    }
}

/* Navbar */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    padding: 1rem 2rem;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

body.dark-mode .navbar {
    background: rgba(22, 33, 62, 0.9);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.nav-brand {
    font-family: 'ZCOOL KuaiLe', cursive;
    font-size: 1.5rem;
    text-decoration: none;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-links {
    display: flex;
    gap: 0.8rem;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
}

.nav-link {
    text-decoration: none;
    color: var(--text-dark);
    font-weight: 600;
    transition: color 0.3s;
    font-size: 1.1rem;
}

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

.nav-btn {
    padding: 8px 20px;
    font-size: 1rem;
    border-radius: 20px;
}

/* [NEW] Points Capsule for Subpages */
.nav-points-capsule {
    background: rgba(255, 255, 255, 0.9);
    padding: 5px 12px;
    border-radius: 20px;
    font-weight: bold;
    color: #f59e0b;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05); /* Match var(--shadow-sm) equivalent */
    display: flex;
    align-items: center;
    gap: 5px;
    margin-right: 10px;
    backdrop-filter: blur(8px);
    border: 2px solid transparent; /* Prepare for potential border */
    transition: all 0.3s ease;
}

.nav-points-capsule:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
}

body.dark-mode .nav-points-capsule {
    background: rgba(30, 41, 59, 0.9); /* Dark nav bg */
    color: #fbbf24; /* Amber-400 */
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Stream Animation Specifics */
.stream-demo-container {
    position: relative;
    width: 100%;
    height: 200px;
    background: linear-gradient(180deg, #4FACFE 0%, #00F2FE 100%);
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 2rem;
    border: 4px solid white;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.1);
}

.wave {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 200%;
    height: 100%;
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1440 320"><path fill="%23ffffff" fill-opacity="0.2" d="M0,192L48,197.3C96,203,192,213,288,229.3C384,245,480,267,576,250.7C672,235,768,181,864,181.3C960,181,1056,235,1152,234.7C1248,235,1344,181,1440,170.7L1440,320L1344,320C1248,320,1152,320,1056,320C960,320,864,320,768,320C672,320,576,320,480,320C384,320,288,320,192,320C96,320,0,320,0,320Z"></path></svg>');
    background-repeat: repeat-x;
    background-size: 50% 100%;
    animation: flow 10s linear infinite;
}

.boat {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 3rem;
    transition: all 0.5s ease;
    filter: drop-shadow(0 4px 4px rgba(0, 0, 0, 0.2));
    z-index: 10;
}

/* Animation States */
@keyframes flow {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(-50%);
    }
}

@keyframes moveRight {
    0% {
        left: 0%;
    }

    100% {
        left: 100%;
    }
}

@keyframes moveLeft {
    0% {
        left: 100%;
    }

    100% {
        left: 0%;
    }
}

/* Control Panel */
.control-panel {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 2rem;
    background: rgba(255, 255, 255, 0.8);
    padding: 15px;
    border-radius: 12px;
    backdrop-filter: blur(5px);
}

/* Navbar Dropdown */
.user-info {
    position: relative;
    cursor: pointer;
    display: flex;
    /* Ensure flex layout */
    align-items: center;
    /* Center items vertically */
    gap: 0.5rem;
    /* Space between avatar and name */
    padding: 5px 10px;
    border-radius: 20px;
    transition: background-color 0.3s;
}

.user-info:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

body.dark-mode .user-info:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.dropdown-menu-user {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    width: 180px;
    background-color: var(--card-bg);
    box-shadow: var(--shadow-dropdown);
    border-radius: var(--radius-md);
    z-index: 1001;
    overflow: hidden;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    margin-top: 10px;
}

.dropdown-menu-user .dd-link {
    color: var(--text-dark);
    padding: 10px 12px;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.2s;
    border-radius: 8px;
    font-size: 0.95rem;
}

.dropdown-menu-user .dd-link:hover {
    background-color: var(--primary-start);
    color: white;
    /* Contrast color for hover state */
    transform: translateX(3px);
}

body.dark-mode .dropdown-menu-user .dd-link:hover {
    background-color: var(--primary-start);
}




/* --- Profile Page Styles --- */
.profile-container {
    padding-top: 2rem;
    padding-bottom: 4rem;
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 2rem;
}

@media (max-width: 768px) {
    .profile-container {
        grid-template-columns: 1fr;
    }
}

/* Sidebar & User Card */
.user-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 2rem;
    text-align: center;
    position: relative;
    overflow: hidden;
    margin-bottom: 2rem;
}

.card-header-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 80px;
    background: linear-gradient(135deg, var(--primary-start), var(--primary-end));
    z-index: 0;
}

.avatar-large {
    width: 100px;
    height: 100px;
    background: white;
    border-radius: 50%;
    margin: 40px auto 1rem;
    /* Push down due to header bg */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    font-weight: bold;
    color: var(--primary-start);
    border: 5px solid white;
    box-shadow: var(--shadow-sm);
    position: relative;
    z-index: 1;
}

.username-display {
    margin: 0.5rem 0 0.2rem;
    font-size: 1.5rem;
}

.user-id {
    color: #95a5a6;
    font-size: 0.8rem;
    margin-bottom: 1.5rem;
}

/* Rank Badge */
.rank-badge {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 50px;
    padding: 0.5rem 1rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.rank-badge .rank-icon {
    font-size: 1.2rem;
}

body.dark-mode .rank-badge {
    background: #1f2833;
    border-color: #333;
}

/* Stats Row */
.stats-row {
    display: flex;
    justify-content: space-around;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #eee;
}

.stat-val {
    font-family: 'ZCOOL KuaiLe', cursive;
    font-size: 1.5rem;
    color: var(--primary-start);
}

.stat-label {
    font-size: 0.9rem;
    color: #7f8c8d;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.9rem;
}

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

.btn-outline:hover {
    background: var(--primary-start);
    color: white;
}

.full-width {
    width: 100%;
    display: block;
}

/* Progress Section */
.mt-4 {
    margin-top: 1.5rem;
}

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

.card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 1.5rem;
}

.card h3 {
    margin-bottom: 1rem;
    font-size: 1.3rem;
    border-left: 4px solid var(--accent-yellow);
    padding-left: 0.8rem;
}

.progress-bar-bg {
    width: 100%;
    height: 10px;
    background: #eee;
    border-radius: 10px;
    margin-top: 2rem;
    /* space for text above if needed */
    position: relative;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-start), var(--primary-end));
    border-radius: 10px;
    transition: width 0.5s ease;
}

.progress-text {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: #7f8c8d;
    margin-top: 0.5rem;
}

/* Activity List */
.activity-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.activity-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 12px;
    transition: transform 0.2s;
}

body.dark-mode .activity-item {
    background: #1f2833;
}

.activity-item:hover {
    transform: translateX(5px);
}

.activity-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.activity-icon {
    width: 40px;
    height: 40px;
    background: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    box-shadow: var(--shadow-sm);
}

body.dark-mode .activity-icon {
    background: #16213e;
}

.activity-title {
    font-weight: bold;
    font-size: 1rem;
}

.activity-date {
    font-size: 0.8rem;
    color: #95a5a6;
}

.score-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: bold;
}

.score-badge.high {
    background: #d1fae5;
    color: #065f46;
}

.score-badge.low {
    background: #fee2e2;
    color: #991b1b;
}

.empty-state {
    text-align: center;
    color: #95a5a6;
    padding: 2rem;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: var(--card-bg);
    margin: 10% auto;
    padding: 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    position: relative;
    animation: popIn 0.3s ease;
}

.small-modal {
    max-width: 400px;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    color: var(--text-dark);
}

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
    color: var(--text-dark);
}

.form-input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    background: var(--bg-cream);
    color: var(--text-dark);
}

.form-input:focus {
    border-color: var(--primary-start);
    outline: none;
}

/* Store Styles */
.store-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 2rem;
    padding: 2rem 0;
}

.store-item {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    text-align: center;
    box-shadow: var(--shadow-sm);
    transition: transform 0.3s;
    position: relative;
    overflow: hidden;
    border: 2px solid transparent;
}

.store-item:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
    border-color: var(--secondary-start);
}

.item-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    display: block;
}

.item-name {
    font-weight: bold;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: var(--text-dark);
}

.item-desc {
    font-size: 0.9rem;
    color: #7f8c8d;
    margin-bottom: 1.5rem;
    height: 40px;
    /* Two lines approx */
    overflow: hidden;
}

.price-tag {
    display: inline-block;
    background: #fdf2f8;
    color: #db2777;
    padding: 4px 12px;
    border-radius: 20px;
    font-family: 'ZCOOL KuaiLe', cursive;
    margin-bottom: 1rem;
    font-size: 1rem;
}

.btn-buy {
    width: 100%;
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    border: none;
    padding: 10px;
    border-radius: 25px;
    cursor: pointer;
    font-weight: bold;
    transition: opacity 0.3s;
}

.btn-buy:disabled {
    background: #ccc;
    cursor: not-allowed;
    opacity: 0.7;
}

.btn-buy:not(:disabled):hover {
    opacity: 0.9;
    transform: scale(1.02);
}

.stock-label {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 0.8rem;
    background: rgba(0, 0, 0, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    color: #666;
}

/* --- UI/UX Pro Max Design System (Island Edition) --- */
:root {
    --primary: #3b82f6;
    /* Ocean Blue */
    --primary-light: #dbeafe;
    --accent: #f59e0b;
    /* Sun Yellow */
    --success: #10b981;
    /* Grass Green */
    --text-main: #1e293b;
    --text-muted: #64748b;
    --bg-page: #f0f9ff;
    --bg-nav: rgba(255, 255, 255, 0.9);
    --bg-dropdown: #ffffff;
    --border-color: rgba(0, 0, 0, 0.05);

    --shadow-card: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-float: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-dropdown: 0 20px 40px rgba(0, 0, 0, 0.1);
    --radius-card: 16px;
}

/* Dark Mode */
[data-theme="dark"] {
    --primary: #60a5fa;
    --primary-light: #1e3a8a;
    --accent: #fbbf24;
    --success: #34d399;
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --bg-page: #0f172a;
    --bg-nav: rgba(30, 41, 59, 0.9);
    --bg-dropdown: #1e293b;
    --border-color: rgba(255, 255, 255, 0.1);

    --shadow-card: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
    --shadow-float: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
    --shadow-dropdown: 0 20px 40px rgba(0, 0, 0, 0.5);
}

body {
    font-family: 'Nunito', 'Microsoft YaHei', sans-serif;
    background-color: var(--bg-page);
    background-image:
        radial-gradient(circle at 10% 20%, rgba(59, 130, 246, 0.05) 0%, transparent 20%),
        radial-gradient(circle at 90% 80%, rgba(16, 185, 129, 0.05) 0%, transparent 20%);
    color: var(--text-main);
    margin: 0;
    padding-top: 70px;
    /* For fixed nav */
}

/* --- Navbar with Dropdown --- */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 70px;
    background: var(--bg-nav);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    box-sizing: border-box;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.nav-brand {
    font-family: 'ZCOOL KuaiLe';
    font-size: 1.4rem;
    color: var(--primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.nav-menu {
    display: flex;
    gap: 1.5rem;
    height: 100%;
    align-items: center;
}

.nav-item {
    position: relative;
    height: 100%;
    display: flex;
    align-items: center;
}

.nav-link {
    text-decoration: none;
    color: var(--text-main);
    font-weight: bold;
    font-size: 0.95rem;
    padding: 0 0.6rem;
    height: 100%;
    display: flex;
    align-items: center;
    transition: color 0.2s;
    cursor: pointer;
}

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

/* Mega Dropdown */
.dropdown-menu {
    position: absolute;
    top: 70px;
    right: -100px;
    /* Center-ish relative to item, or fixed width */
    width: 900px;
    background: var(--bg-dropdown);
    border-radius: 0 0 20px 20px;
    box-shadow: var(--shadow-dropdown);
    padding: 2rem;
    display: none;
    /* Hidden by default */
    grid-template-columns: repeat(5, 1fr);
    gap: 2rem;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.3s, transform 0.3s;
    border: 1px solid var(--border-color);
}

/* Special positioning for leftmost menu items to prevent overflow */
.nav-item:nth-child(2) .dropdown-menu,
.nav-item:nth-child(3) .dropdown-menu {
    left: -200px;
    right: auto;
}

/* Grade 4 menu */
.nav-item:nth-child(4) .dropdown-menu {
    left: -100px;
    right: auto;
}


/* Grade 5 and Grade 6 menus - align to right */
.nav-item:nth-child(5) .dropdown-menu,
.nav-item:nth-child(6) .dropdown-menu,
.nav-item:nth-child(7) .dropdown-menu {
    left: auto;
    right: 0;
}

/* Hover Group: When hovering .nav-item, show .dropdown-menu */
.nav-item:hover .dropdown-menu {
    display: grid;
    opacity: 1;
    transform: translateY(0);
}

/* Dropdown Columns */
.dd-col h4 {
    margin: 0 0 1rem 0;
    color: var(--primary);
    border-bottom: 2px solid var(--primary-light);
    padding-bottom: 5px;
    font-size: 1rem;
}

.dd-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.dd-list li {
    margin-bottom: 0.8rem;
}

.dd-link {
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    padding: 5px;
    border-radius: 6px;
}

.dd-link:hover {
    background: var(--primary-light);
    color: var(--primary);
    transform: translateX(5px);
}


.user-info {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    position: relative;
    cursor: pointer;
    flex-shrink: 0;
}

.user-avatar {
    width: 36px;
    height: 36px;
    background: var(--bg-page);
    border: 2px solid var(--primary);
    color: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    padding: 0;
    box-sizing: border-box;
}

.user-avatar:hover {
    background: var(--primary);
    color: white;
    transform: scale(1.1);
}

.logout-btn {
    width: 36px;
    height: 36px;
    background: var(--bg-page);
    border: 2px solid var(--success);
    color: var(--success);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 0;
    flex-shrink: 0;
}

.logout-btn:hover {
    background: var(--success);
    color: white;
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

/* Tooltip */
[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: -35px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 1;
    pointer-events: none;
    z-index: 1001;
    animation: fadeIn 0.2s;
}

/* Theme Toggle */
.theme-toggle {
    background: var(--bg-page);
    border: 2px solid var(--accent);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all 0.3s;
    color: var(--accent);
    flex-shrink: 0;
}

.theme-toggle:hover {
    transform: rotate(15deg) scale(1.1);
    background: #e0f2fe;
}


/* --- Main Content --- */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Hero Section */
.hero {
    text-align: center;
    padding: 4rem 1rem;
    position: relative;
    overflow: hidden;
    background: white;
    border-radius: 30px;
    box-shadow: 0 20px 60px rgba(59, 130, 246, 0.1);
    margin: 2rem;
    margin-top: 1rem;
}

.hero h1 {
    font-size: 3.5rem;
    background: linear-gradient(135deg, var(--primary) 0%, #8b5cf6 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 1rem;
    letter-spacing: -1px;
}

.hero p {
    font-size: 1.25rem;
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto 2rem;
    line-height: 1.6;
}

/* Cards Grid */
.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    padding: 1rem 2rem 4rem;
}

.card {
    background: white;
    border-radius: var(--radius-card);
    padding: 2rem;
    text-align: center;
    text-decoration: none;
    color: var(--text-main);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-float);
    border-color: var(--primary-light);
}

.card-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    transition: transform 0.3s;
}

.card:hover .card-icon {
    transform: scale(1.2) rotate(10deg);
}

.card h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.card p {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.5;
}

.badge {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: #ecfdf5;
    color: var(--success);
    font-size: 0.75rem;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-weight: bold;
    border: 1px solid #a7f3d0;
}

.card.completed {
    background: #f0fdf4;
    border-color: var(--success);
}

.card.completed::after {
    content: "✅";
    position: absolute;
    top: 1rem;
    left: 1rem;
    font-size: 1.5rem;
}

/* Section Divider */
.section-header {
    text-align: center;
    margin: 4rem 0 2rem;
    position: relative;
}

.section-header h2 {
    font-size: 2rem;
    display: inline-block;
    padding: 0 1rem;
    background: var(--bg-page);
    position: relative;
    z-index: 1;
    color: var(--primary);
}

.section-header::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 10%;
    right: 10%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--border-color), transparent);
    z-index: 0;
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    border-top: 1px solid var(--border-color);
    background: white;
}