/* ===== VARIABLES ===== */
:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary: #10b981;
    --accent: #f59e0b;
    --danger: #ef4444;
    --success: #22c55e;
    
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f5f9;
    
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    
    --border: #e2e8f0;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    
    --radius: 12px;
    --radius-lg: 20px;
    --transition: all 0.3s ease;
    
    /* Safe area insets for iPhone notch/Dynamic Island */
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-left: env(safe-area-inset-left, 0px);
    --safe-right: env(safe-area-inset-right, 0px);
    
    /* Touch-friendly sizes */
    --touch-target: 44px;
    --touch-target-large: 48px;
}

/* Dark Theme */
[data-theme="dark"] {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    
    --border: #475569;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
}

/* ===== RESET & BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    min-height: 100dvh; /* Dynamic viewport height for mobile */
    transition: var(--transition);
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    padding-top: var(--safe-top);
    padding-bottom: calc(var(--safe-bottom) + 70px); /* Space for mobile nav */
}

/* Accessibility - Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ===== HEADER ===== */
.header {
    background: var(--bg-secondary);
    padding: 0.75rem 1rem;
    padding-left: calc(1rem + var(--safe-left));
    padding-right: calc(1rem + var(--safe-right));
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow);
    position: sticky;
    top: var(--safe-top);
    z-index: 100;
    gap: 0.5rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
    white-space: nowrap;
    cursor: pointer;
}

.logo-img {
    height: 36px !important;
    max-height: 36px !important;
    max-width: 60px !important;
    width: auto !important;
    object-fit: contain !important;
    flex-shrink: 0;
}

.logo i {
    font-size: 1.5rem;
}

/* Desktop navigation - ALWAYS hidden on mobile */
.nav-menu {
    display: none;
    gap: 0.5rem;
}

/* Mobile navigation - hidden by default */
.mobile-nav {
    display: none;
}

/* MOBILE: Hide desktop nav ALWAYS, show mobile nav when visible */
@media (max-width: 767px) {
    .nav-menu,
    .nav-menu.nav-visible,
    #mainNav {
        display: none !important;
        visibility: hidden !important;
        width: 0 !important;
        height: 0 !important;
        overflow: hidden !important;
        position: absolute !important;
        pointer-events: none !important;
    }
    
    .mobile-nav.nav-visible {
        display: flex !important;
        visibility: visible !important;
        width: auto !important;
        height: auto !important;
        position: fixed !important;
        pointer-events: auto !important;
    }
}

/* DESKTOP: Show desktop nav when visible, hide mobile nav */
@media (min-width: 768px) {
    .nav-menu.nav-visible {
        display: flex !important;
    }
    
    .mobile-nav,
    .mobile-nav.nav-visible {
        display: none !important;
    }
}

.nav-btn {
    background: transparent;
    border: none;
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-height: var(--touch-target);
}

.nav-btn:hover {
    background: var(--bg-tertiary);
    color: var(--primary);
}

.nav-btn.active {
    background: #312e81;
    color: #e0e7ff;
}

.theme-toggle {
    background: var(--bg-tertiary);
    border: none;
    width: var(--touch-target);
    height: var(--touch-target);
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    color: var(--text-secondary);
    transition: var(--transition);
    flex-shrink: 0;
}

.theme-toggle:hover {
    background: var(--primary);
    color: white;
    transform: rotate(20deg);
}

/* ===== MOBILE BOTTOM NAVIGATION ===== */
.mobile-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    padding-bottom: var(--safe-bottom);
    border-top: 1px solid var(--border);
}

.mobile-nav-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 0.25rem;
    min-height: 60px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.65rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    gap: 0.25rem;
    position: relative;
}

.mobile-nav-btn i {
    font-size: 1.25rem;
    transition: var(--transition);
}

.mobile-nav-btn.active {
    color: #312e81;
}

[data-theme="dark"] .mobile-nav-btn.active {
    color: #a5b4fc;
}

.mobile-nav-btn.active i {
    transform: scale(1.1);
}

.mobile-nav-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%) scaleX(0);
    width: 50%;
    height: 3px;
    background: var(--primary);
    border-radius: 0 0 3px 3px;
    transition: transform 0.3s ease;
}

.mobile-nav-btn.active::before {
    transform: translateX(-50%) scaleX(1);
}

/* ===== MAIN CONTENT ===== */
.main-content {
    padding: 1rem;
    padding-left: calc(1rem + var(--safe-left));
    padding-right: calc(1rem + var(--safe-right));
    max-width: 1400px;
    margin: 0 auto;
}

.section {
    display: none;
    animation: fadeIn 0.5s ease;
}

.section.active {
    display: block;
}

/* Subject selector needs flex when active */
#subject-selector.active {
    display: flex !important;
}

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

/* ===== SUBJECT SELECTOR SECTION ===== */
#subject-selector {
    min-height: calc(100vh - 80px);
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.subject-hero {
    text-align: center;
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
}

.subject-hero > h1,
.main-title {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subject-hero > .subtitle,
.main-subtitle {
    color: var(--text-secondary);
    font-size: 1.2rem;
    margin-bottom: 3rem;
}

/* Card Titles - Light Mode (Dark text for visibility) */
.card-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
}

.te2-title {
    color: #4338ca !important; /* Dark indigo for light mode */
}

.ent-title {
    color: #047857 !important; /* Dark emerald for light mode */
}

/* Card Titles - Dark Mode (Light text) */
[data-theme="dark"] .te2-title {
    color: #a5b4fc !important; /* Light indigo for dark mode */
}

[data-theme="dark"] .ent-title {
    color: #6ee7b7 !important; /* Light emerald for dark mode */
}

/* Card Description */
.card-desc {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
    line-height: 1.6;
    max-width: 280px;
    margin-left: auto;
    margin-right: auto;
}

/* Subject Icons */
.subject-icon {
    width: 90px !important;
    height: 90px !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin: 0 auto 1.75rem !important;
    font-size: 2.25rem !important;
    color: white !important;
    box-shadow: 0 12px 30px -8px rgba(0, 0, 0, 0.3) !important;
}

.subject-card .subject-icon.te2-icon,
.te2-icon {
    background: linear-gradient(135deg, #6366f1, #4f46e5) !important;
}

.subject-card .subject-icon.ent-icon,
.ent-icon {
    background: linear-gradient(135deg, #10b981, #059669) !important;
}

/* Subject Buttons */
.subject-btn {
    color: white !important;
    border: none !important;
    padding: 1rem 2.5rem !important;
    border-radius: 50px !important;
    font-weight: 600 !important;
    font-size: 1rem !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.75rem !important;
    font-family: inherit !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2) !important;
}

.subject-card .subject-btn.te2-btn,
.subject-card button.te2-btn,
button.te2-btn,
.te2-btn {
    background: linear-gradient(135deg, #6366f1, #4f46e5) !important;
    color: white !important;
}

.subject-card .subject-btn.ent-btn,
.subject-card button.ent-btn,
button.ent-btn,
.ent-btn {
    background: linear-gradient(135deg, #10b981, #059669) !important;
    color: white !important;
}

.subject-btn:hover {
    transform: scale(1.05) !important;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3) !important;
}

.subject-btn:active {
    transform: scale(0.98);
}

/* Subject Meta Accent Colors */
.te2-accent {
    color: #6366f1 !important;
}

.ent-accent {
    color: #10b981 !important;
}

.subject-cards {
    display: grid !important;
    grid-template-columns: 1fr;
    gap: 2rem;
    margin-top: 2rem;
    padding: 0 1rem;
}

div.subject-card {
    background-color: #ffffff !important;
    border-radius: 24px !important;
    padding: 2.5rem 2rem !important;
    box-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.2) !important;
    border: 2px solid #e2e8f0 !important;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
    position: relative;
    overflow: hidden;
}

[data-theme="dark"] div.subject-card {
    background-color: #1e293b !important;
    border-color: #475569 !important;
}

.subject-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    transform: scaleX(0);
    transition: transform 0.4s ease;
}

.subject-card:hover::before {
    transform: scaleX(1);
}

.subject-card:hover {
    transform: translateY(-8px);
    border-color: var(--primary);
    box-shadow: 0 25px 50px -15px rgba(99, 102, 241, 0.3);
}

.subject-card:active {
    transform: translateY(-4px) scale(0.98);
}

.subject-card h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.subject-card > p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
    line-height: 1.6;
    max-width: 280px;
    margin-left: auto;
    margin-right: auto;
}

.subject-meta {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 1.75rem;
    flex-wrap: wrap;
}

.subject-meta span {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
}

.subject-meta span i {
    color: var(--primary);
    font-size: 1rem;
}

/* Back to Subjects Button */
.back-to-subjects-btn {
    background: #312e81;
    border: none;
    color: #e0e7ff;
    padding: 0.5rem 1rem;
    border-radius: 25px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: inherit;
}

.back-to-subjects-btn:hover {
    background: #3730a3;
    color: white;
}

/* ===== ABOUT US LINK ON SUBJECT SELECTOR ===== */
.about-link-container {
    margin-top: 3rem;
    text-align: center;
    padding-bottom: 2rem;
}

.about-link-btn {
    background: rgba(99, 102, 241, 0.1);
    border: 2px solid rgba(99, 102, 241, 0.3);
    color: var(--primary);
    padding: 0.875rem 1.75rem;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-family: inherit;
    min-height: var(--touch-target);
    min-width: 150px;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.about-link-btn:hover,
.about-link-btn:active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px -5px rgba(99, 102, 241, 0.4);
}

.about-link-btn:active {
    transform: scale(0.98);
}

.about-link-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.3);
}

.about-link-btn:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

[data-theme="dark"] .about-link-btn {
    background: rgba(99, 102, 241, 0.15);
    border-color: rgba(99, 102, 241, 0.4);
    color: #a5b4fc;
}

[data-theme="dark"] .about-link-btn:hover,
[data-theme="dark"] .about-link-btn:active {
    background: var(--primary);
    color: white;
}

/* ===== ABOUT US SECTION ===== */
#about-us {
    padding: 1rem;
}

.about-container {
    max-width: 800px;
    margin: 0 auto;
}

.back-btn {
    background: transparent;
    border: 2px solid var(--border);
    color: var(--text-secondary);
    padding: 0.6rem 1.2rem;
    border-radius: 50px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: inherit;
    margin-bottom: 2rem;
}

.back-btn:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.about-hero {
    text-align: center;
    margin-bottom: 3rem;
}

.about-icon {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    font-size: 2.5rem;
    color: white;
    box-shadow: 0 15px 40px -10px rgba(99, 102, 241, 0.4);
}

.about-title {
    font-size: 2.2rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

.about-subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
    font-style: italic;
}

/* About Cards */
.about-card {
    background: var(--bg-secondary);
    border-radius: 20px;
    padding: 2rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
}

.about-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
}

.about-card-icon {
    width: 60px;
    height: 60px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
    margin-bottom: 1rem;
}

.mission-card .about-card-icon {
    background: linear-gradient(135deg, #6366f1, #4f46e5);
}

.whatwedo-card .about-card-icon {
    background: linear-gradient(135deg, #10b981, #059669);
}

.contribute-card .about-card-icon {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

.future-card .about-card-icon {
    background: linear-gradient(135deg, #ec4899, #db2777);
}

.about-card h2 {
    font-size: 1.4rem;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.about-card p {
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 1rem;
}

.about-card strong {
    color: var(--primary);
}

.about-card em {
    color: var(--secondary);
    font-style: normal;
    font-weight: 600;
}

/* Features Grid */
.features-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-top: 1.5rem;
}

.feature-item {
    background: var(--bg-tertiary);
    padding: 1rem;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: var(--transition);
}

.feature-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.feature-item i {
    color: var(--primary);
    font-size: 1.2rem;
}

.feature-item span {
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.9rem;
}

/* Email Box */
.email-box {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(16, 185, 129, 0.1));
    padding: 1.25rem;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin: 1.5rem 0;
    border: 2px dashed var(--primary);
}

.email-box i {
    color: var(--primary);
    font-size: 1.3rem;
}

.email-box a {
    color: var(--primary);
    font-weight: 600;
    font-size: 1.1rem;
    text-decoration: none;
    transition: var(--transition);
}

.email-box a:hover {
    color: var(--secondary);
}

.email-note {
    font-size: 0.9rem;
    text-align: center;
    color: var(--text-muted) !important;
}

/* Quote Box */
.quote-box {
    background: var(--bg-tertiary);
    padding: 1.5rem;
    border-radius: 12px;
    border-left: 4px solid var(--primary);
    margin-top: 1.5rem;
    position: relative;
}

.quote-box i {
    color: var(--primary);
    font-size: 1.5rem;
    opacity: 0.5;
    position: absolute;
    top: 1rem;
    left: 1rem;
}

.quote-box p {
    color: var(--text-primary) !important;
    font-style: italic;
    font-size: 1.1rem;
    padding-left: 2rem;
    margin: 0 !important;
}

/* Creator Card */
.creator-card {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1.5rem 2rem;
}

.creator-card::before {
    background: linear-gradient(90deg, #6366f1, #10b981);
}

.creator-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: white;
    flex-shrink: 0;
}

.creator-info h3 {
    font-size: 1.3rem;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.creator-role {
    color: var(--primary) !important;
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 0.5rem !important;
}

.creator-desc {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin: 0 !important;
}

/* About Us Responsive */
@media (max-width: 480px) {
    .about-title {
        font-size: 1.8rem;
    }
    
    .about-icon {
        width: 80px;
        height: 80px;
        font-size: 2rem;
    }
    
    .features-grid {
        grid-template-columns: 1fr;
    }
    
    .creator-card {
        flex-direction: column;
        text-align: center;
    }
    
    .email-box {
        flex-direction: column;
        gap: 0.5rem;
    }
}

@media (min-width: 768px) {
    .about-title {
        font-size: 2.8rem;
    }
    
    .about-card {
        padding: 2.5rem;
    }
    
    .about-icon {
        width: 120px;
        height: 120px;
        font-size: 3rem;
    }
}

/* Tablet and Desktop styles for subject cards */
@media (min-width: 640px) {
    .subject-cards {
        grid-template-columns: repeat(2, 1fr);
        gap: 2rem;
        padding: 0;
    }
    
    .subject-hero > h1 {
        font-size: 3rem;
    }
    
    .subject-hero > .subtitle {
        font-size: 1.3rem;
    }
}

@media (min-width: 768px) {
    .subject-card {
        padding: 3rem 2.5rem;
    }
    
    .subject-icon {
        width: 110px;
        height: 110px;
        font-size: 2.75rem;
    }
    
    .subject-card h2 {
        font-size: 1.75rem;
    }
}

/* ===== HOME SECTION ===== */
.hero {
    text-align: center;
    padding: 1rem 0;
}

.hero h1 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.3;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
}

.stats-overview {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-secondary);
    padding: 1rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.stat-card i {
    font-size: 1.5rem;
    color: var(--primary);
    margin-bottom: 0.25rem;
}

.stat-card h3,
.stat-card .stat-number {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    display: block;
}

.stat-card p {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.category-selector {
    margin-bottom: 2rem;
}

.category-selector h2 {
    margin-bottom: 1rem;
    color: var(--text-primary);
    font-size: 1.1rem;
}

.categories {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
}

.category-btn {
    background: var(--bg-secondary);
    border: 2px solid var(--border);
    padding: 1rem;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.75rem;
    font-family: inherit;
    min-height: var(--touch-target-large);
    text-align: left;
}

.category-btn:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.category-btn.active {
    border-color: var(--primary);
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
}

.category-btn i {
    font-size: 1.5rem;
    color: var(--primary);
    width: 40px;
    text-align: center;
    flex-shrink: 0;
}

.category-btn.active i {
    color: white;
}

.category-btn span {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9rem;
    flex: 1;
}

.category-btn.active span {
    color: white;
}

.category-btn small {
    color: var(--text-muted);
    font-size: 0.75rem;
    flex-shrink: 0;
}

.category-btn.active small {
    color: rgba(255,255,255,0.8);
}

.quick-start h2 {
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.quick-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.action-btn {
    padding: 1rem 1.5rem;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: var(--transition);
    min-height: var(--touch-target-large);
    width: 100%;
}

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

.action-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(99, 102, 241, 0.3);
}

.action-btn.secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 2px solid var(--border);
}

.action-btn.secondary:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.action-btn.tertiary {
    background: linear-gradient(135deg, var(--secondary), #059669);
    color: white;
}

/* ===== LEARN SECTION ===== */
.learn-container {
    max-width: 900px;
    margin: 0 auto;
}

.learn-container h1 {
    text-align: center;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 1.3rem;
}

.learn-filter {
    display: flex;
    justify-content: flex-start;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding-bottom: 0.5rem;
}

.learn-filter::-webkit-scrollbar {
    display: none;
}

.filter-btn {
    padding: 0.5rem 1rem;
    border: 2px solid var(--border);
    background: var(--bg-secondary);
    border-radius: 25px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 500;
    font-size: 0.85rem;
    color: var(--text-primary);
    transition: var(--transition);
    white-space: nowrap;
    min-height: var(--touch-target);
    flex-shrink: 0;
}

.filter-btn:hover,
.filter-btn.active {
    border-color: var(--primary);
    background: var(--primary);
    color: white;
}

.learn-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.learn-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.learn-card:hover {
    box-shadow: var(--shadow-lg);
}

.learn-card-header {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    padding: 1rem 1.5rem;
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.learn-card-header h2,
.learn-card-header h3,
.learn-card-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
}

.learn-card-content {
    padding: 1.5rem;
}

.learn-card-content p {
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 1rem;
}

.learn-card-content .highlight {
    background: linear-gradient(120deg, rgba(99, 102, 241, 0.1) 0%, rgba(99, 102, 241, 0.2) 100%);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-weight: 600;
    color: var(--primary);
}

.learn-card-content ul {
    list-style: none;
    margin: 1rem 0;
}

.learn-card-content ul li {
    padding: 0.5rem 0;
    padding-left: 1.5rem;
    position: relative;
    color: var(--text-secondary);
}

.learn-card-content ul li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--success);
    font-weight: bold;
}

.learn-image {
    width: 100%;
    max-width: 400px;
    margin: 1rem auto;
    display: block;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.tip-box {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(16, 185, 129, 0.2));
    border-left: 4px solid var(--secondary);
    padding: 1rem;
    border-radius: 0 var(--radius) var(--radius) 0;
    margin: 1rem 0;
}

.tip-box h4 {
    color: var(--secondary);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.formula-box {
    background: var(--bg-tertiary);
    padding: 1rem 1.5rem;
    border-radius: var(--radius);
    font-family: 'Courier New', monospace;
    font-size: 1.1rem;
    text-align: center;
    margin: 1rem 0;
    border: 2px dashed var(--border);
}

/* ===== FLASHCARDS SECTION ===== */
.flashcard-container {
    max-width: 700px;
    margin: 0 auto;
    text-align: center;
}

.flashcard-container h1 {
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.flashcard-progress {
    margin-bottom: 1rem;
}

.flashcard-progress span {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.9rem;
}

.progress-bar {
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 10px;
    overflow: hidden;
    margin-top: 0.5rem;
}

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

.flashcard-wrapper {
    perspective: 1000px;
    margin-bottom: 1.5rem;
}

.flashcard {
    width: 100%;
    height: 280px;
    cursor: pointer;
    position: relative;
    touch-action: manipulation;
}

.flashcard-inner {
    width: 100%;
    height: 100%;
    transition: transform 0.6s;
    transform-style: preserve-3d;
    position: relative;
}

.flashcard.flipped .flashcard-inner {
    transform: rotateY(180deg);
}

.flashcard-front,
.flashcard-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 1.25rem;
    box-shadow: var(--shadow-lg);
}

.flashcard-front {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
}

.flashcard-back {
    background: var(--bg-secondary);
    transform: rotateY(180deg);
    border: 3px solid var(--secondary);
}

.card-category {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    background: rgba(255,255,255,0.2);
    padding: 0.25rem 0.6rem;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 500;
}

.flashcard-front p {
    font-size: 1.1rem;
    font-weight: 500;
    line-height: 1.5;
}

.flip-hint {
    position: absolute;
    bottom: 0.75rem;
    font-size: 0.8rem;
    opacity: 0.8;
}

.flashcard-back p {
    font-size: 1rem;
    color: var(--text-primary);
    line-height: 1.5;
}

.flashcard-back .explanation {
    margin-top: 0.75rem;
    padding: 0.75rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.flashcard-controls {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.control-btn {
    padding: 0.75rem 1rem;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: var(--transition);
    min-height: var(--touch-target);
}

.control-btn.wrong {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: 2px solid var(--danger);
}

.control-btn.wrong:hover {
    background: var(--danger);
    color: white;
}

.control-btn.correct {
    background: rgba(34, 197, 94, 0.1);
    color: var(--success);
    border: 2px solid var(--success);
}

.control-btn.correct:hover {
    background: var(--success);
    color: white;
}

.control-btn.prev,
.control-btn.next {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.control-btn.prev:hover,
.control-btn.next:hover {
    background: var(--primary);
    color: white;
}

.flashcard-stats {
    display: flex;
    justify-content: center;
    gap: 3rem;
}

.flashcard-stats .stat {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
}

.flashcard-stats .stat.correct {
    color: var(--success);
}

.flashcard-stats .stat.wrong {
    color: var(--danger);
}

/* ===== QUIZ SECTION ===== */
.quiz-container {
    max-width: 800px;
    margin: 0 auto;
}

.quiz-setup {
    text-align: center;
    padding: 1.5rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.quiz-setup h1 {
    margin-bottom: 0.5rem;
    font-size: 1.3rem;
}

.quiz-setup > p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.option-group {
    text-align: left;
}

.option-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.option-group select {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
    min-height: var(--touch-target);
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
}

.option-group select:focus {
    outline: none;
    border-color: var(--primary);
}

.start-quiz-btn {
    width: 100%;
    padding: 1rem 2rem;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: var(--transition);
    min-height: var(--touch-target-large);
}

.start-quiz-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(99, 102, 241, 0.3);
}

.quiz-game {
    animation: fadeIn 0.5s ease;
}

.quiz-header {
    margin-bottom: 1rem;
}

.quiz-progress {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.question-card {
    background: var(--bg-secondary);
    padding: 1.25rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    margin-bottom: 1rem;
}

.question-category {
    display: inline-block;
    background: var(--primary);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    margin-bottom: 0.75rem;
}

.question-card h2 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    line-height: 1.5;
}

.answers {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.answer-btn {
    width: 100%;
    padding: 0.875rem 1rem;
    background: var(--bg-tertiary);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.9rem;
    text-align: left;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-primary);
    min-height: var(--touch-target-large);
}

.answer-btn:hover:not(.disabled) {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
}

.answer-btn.selected {
    border-color: var(--primary);
    background: var(--primary);
    color: white;
}

.answer-btn.correct {
    border-color: var(--success);
    background: var(--success);
    color: white;
}

.answer-btn.wrong {
    border-color: var(--danger);
    background: var(--danger);
    color: white;
}

.answer-btn.disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

.answer-letter {
    width: 28px;
    height: 28px;
    background: var(--bg-secondary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.answer-btn.selected .answer-letter,
.answer-btn.correct .answer-letter,
.answer-btn.wrong .answer-letter {
    background: rgba(255,255,255,0.3);
}

.quiz-score {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    font-size: 0.95rem;
    font-weight: 600;
}

.text-success { color: var(--success); }
.text-danger { color: var(--danger); }

/* Quiz Results */
.quiz-results {
    animation: fadeIn 0.5s ease;
}

.results-card {
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    text-align: center;
}

.results-icon {
    font-size: 3rem;
    margin-bottom: 0.75rem;
}

.results-card h1 {
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.score-circle {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
}

.score-circle span {
    font-size: 2rem;
    font-weight: 700;
    color: white;
}

.results-stats {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin: 1.5rem 0;
    flex-wrap: wrap;
}

.result-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.result-stat i {
    font-size: 1.25rem;
    margin-bottom: 0.25rem;
}

.result-stat i.fa-check-circle { color: var(--success); }
.result-stat i.fa-times-circle { color: var(--danger); }
.result-stat i.fa-clock { color: var(--accent); }

.result-stat span {
    font-size: 1.25rem;
    font-weight: 700;
}

.result-stat small {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.wrong-answers-review {
    text-align: left;
    margin: 1.5rem 0;
    padding: 1rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
}

.wrong-answers-review h3 {
    margin-bottom: 0.75rem;
    color: var(--danger);
    font-size: 1rem;
}

.wrong-answer-item {
    padding: 0.75rem;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
    border-left: 4px solid var(--danger);
    font-size: 0.9rem;
}

.wrong-answer-item p {
    margin-bottom: 0.35rem;
}

.wrong-answer-item .your-answer {
    color: var(--danger);
}

.wrong-answer-item .correct-answer-review {
    color: var(--success);
    font-weight: 600;
}

.results-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

/* ===== FILL SECTION ===== */
.fill-container {
    max-width: 700px;
    margin: 0 auto;
    text-align: center;
}

.fill-container h1 {
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.fill-progress {
    margin-bottom: 1rem;
}

.fill-card {
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    margin-bottom: 1rem;
}

.fill-category {
    display: inline-block;
    background: var(--accent);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    margin-bottom: 1rem;
}

.fill-sentence {
    font-size: 1.1rem;
    line-height: 1.7;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.fill-sentence .blank {
    display: inline-block;
    min-width: 100px;
    border-bottom: 3px dashed var(--primary);
    margin: 0 0.25rem;
    color: var(--primary);
    font-weight: 600;
}

.fill-input-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    align-items: center;
}

.fill-input-wrapper input {
    width: 100%;
    max-width: 100%;
    padding: 1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 1rem;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: var(--transition);
    min-height: var(--touch-target);
}

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

.check-btn {
    width: 100%;
    padding: 1rem 1.5rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: var(--transition);
    min-height: var(--touch-target);
}

.check-btn:hover {
    background: var(--primary-dark);
}

.fill-feedback {
    margin-top: 1rem;
    padding: 0.75rem;
    border-radius: var(--radius);
}

.fill-feedback.correct {
    background: rgba(34, 197, 94, 0.1);
    border: 2px solid var(--success);
}

.fill-feedback.wrong {
    background: rgba(239, 68, 68, 0.1);
    border: 2px solid var(--danger);
}

.fill-feedback p {
    margin-bottom: 0.35rem;
    font-size: 0.9rem;
}

.fill-hint {
    margin-top: 0.75rem;
    padding: 0.75rem;
    background: rgba(245, 158, 11, 0.1);
    border-radius: var(--radius);
    color: var(--accent);
    font-size: 0.9rem;
}

.fill-controls {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.control-btn.hint {
    background: rgba(245, 158, 11, 0.1);
    color: var(--accent);
    border: 2px solid var(--accent);
}

.control-btn.hint:hover {
    background: var(--accent);
    color: white;
}

.control-btn.skip {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.fill-stats {
    display: flex;
    justify-content: center;
    gap: 2rem;
}

/* ===== PROGRESS SECTION ===== */
.progress-container {
    max-width: 900px;
    margin: 0 auto;
}

.progress-container h1 {
    text-align: center;
    margin-bottom: 1.5rem;
    font-size: 1.3rem;
}

.progress-overview {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
}

.progress-card {
    background: var(--bg-secondary);
    padding: 1.25rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.progress-card.main {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.big-progress-circle {
    position: relative;
    width: 150px;
    height: 150px;
}

.big-progress-circle svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.circle-bg {
    fill: none;
    stroke: var(--bg-tertiary);
    stroke-width: 3;
}

.circle-progress {
    fill: none;
    stroke: url(#gradient);
    stroke-width: 3;
    stroke-linecap: round;
    transition: stroke-dasharray 1s ease;
}

.big-progress-circle span {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
}

.progress-card h3 {
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
}

.mini-progress {
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 10px;
    overflow: hidden;
    margin-top: 0.5rem;
}

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

.category-progress h2 {
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.category-bars {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.category-bar {
    background: var(--bg-secondary);
    padding: 0.875rem 1rem;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.category-bar i {
    font-size: 1.25rem;
    color: var(--primary);
    width: 30px;
}

.category-bar-info {
    flex: 1;
}

.category-bar-info span {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.35rem;
    font-size: 0.85rem;
}

.study-history {
    margin-top: 1.5rem;
}

.study-history h2 {
    margin-bottom: 0.75rem;
    font-size: 1.1rem;
}

.history-list {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    overflow: hidden;
}

.history-item {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
}

.history-item:last-child {
    border-bottom: none;
}

.history-item .date {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.reset-btn {
    margin-top: 1.5rem;
    width: 100%;
    padding: 0.875rem 1.5rem;
    background: transparent;
    border: 2px solid var(--danger);
    color: var(--danger);
    border-radius: var(--radius);
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    min-height: var(--touch-target);
}

.reset-btn:hover {
    background: var(--danger);
    color: white;
}

/* ===== TOAST ===== */
.toast {
    position: fixed;
    bottom: calc(80px + var(--safe-bottom));
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--bg-secondary);
    padding: 0.875rem 1.25rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: transform 0.3s ease, opacity 0.3s ease;
    z-index: 9999;
    max-width: calc(100% - 2rem);
    font-size: 0.9rem;
    opacity: 0;
    pointer-events: none;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.toast i {
    color: var(--primary);
}

/* ===== FOOTER ===== */
.footer {
    text-align: center;
    padding: 1.5rem 1rem;
    padding-bottom: calc(1.5rem + 70px + var(--safe-bottom));
    color: var(--text-muted);
    font-size: 0.85rem;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    margin-top: 2rem;
}

@media (min-width: 768px) {
    .footer {
        padding-bottom: 1.5rem;
    }
}

/* ===== UTILITIES ===== */
.hidden {
    display: none !important;
}

/* ===== RESPONSIVE - TABLET & UP (768px+) ===== */
@media (min-width: 768px) {
    body {
        padding-bottom: 0;
    }
    
    .header {
        padding: 1rem 2rem;
    }
    
    .logo {
        font-size: 1.5rem;
    }
    
    .logo-img {
        height: 42px !important;
        max-height: 42px !important;
        max-width: 80px !important;
    }
    
    .logo i {
        font-size: 2rem;
    }
    
    /* Desktop/mobile nav visibility is now controlled via nav-visible class */
    
    .main-content {
        padding: 2rem;
    }
    
    .hero h1 {
        font-size: 2rem;
    }
    
    .subtitle {
        font-size: 1.1rem;
    }
    
    .stats-overview {
        grid-template-columns: repeat(4, 1fr);
        gap: 1.5rem;
    }
    
    .stat-card {
        padding: 1.5rem;
    }
    
    .stat-card i {
        font-size: 2rem;
    }
    
    .stat-card h3,
    .stat-card .stat-number {
        font-size: 2rem;
    }
    
    .stat-card p {
        font-size: 0.9rem;
    }
    
    .categories {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .category-btn {
        flex-direction: column;
        text-align: center;
        padding: 1.5rem;
    }
    
    .category-btn i {
        font-size: 2rem;
        width: auto;
    }
    
    .quick-actions {
        flex-direction: row;
        justify-content: center;
    }
    
    .action-btn {
        width: auto;
    }
    
    .flashcard {
        height: 350px;
    }
    
    .flashcard-front p {
        font-size: 1.4rem;
    }
    
    .flashcard-back p {
        font-size: 1.2rem;
    }
    
    .flashcard-controls {
        display: flex;
        justify-content: center;
        gap: 1rem;
    }
    
    .quiz-setup {
        padding: 2.5rem;
    }
    
    .quiz-options {
        flex-direction: row;
        gap: 1.5rem;
    }
    
    .option-group {
        flex: 1;
    }
    
    .start-quiz-btn {
        width: auto;
    }
    
    .question-card {
        padding: 2rem;
    }
    
    .question-card h2 {
        font-size: 1.3rem;
    }
    
    .fill-input-wrapper {
        flex-direction: row;
    }
    
    .fill-input-wrapper input {
        max-width: 300px;
    }
    
    .check-btn {
        width: auto;
    }
    
    .fill-controls {
        display: flex;
        justify-content: center;
    }
    
    .progress-overview {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 1.5rem;
    }
    
    .progress-card.main {
        grid-row: 1 / 3;
    }
    
    .results-actions {
        flex-direction: row;
        justify-content: center;
    }
    
    .toast {
        bottom: 2rem;
    }
}

/* ===== RESPONSIVE - DESKTOP (1024px+) ===== */
@media (min-width: 1024px) {
    .hero h1 {
        font-size: 2.5rem;
    }
    
    .subtitle {
        font-size: 1.2rem;
    }
    
    .categories {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .progress-overview {
        grid-template-columns: 1fr 1fr 1fr;
    }
    
    .big-progress-circle {
        width: 200px;
        height: 200px;
    }
    
    .big-progress-circle span {
        font-size: 2.5rem;
    }
}

/* ===== RESPONSIVE - LARGE DESKTOP (1200px+) ===== */
@media (min-width: 1200px) {
    .main-content {
        padding: 2rem 3rem;
    }
}

/* ===== SMALL PHONES (320px-374px) - iPhone SE, older devices ===== */
@media (max-width: 374px) {
    .hero h1 {
        font-size: 1.3rem;
    }
    
    .stat-card h3,
    .stat-card .stat-number {
        font-size: 1.25rem;
    }
    
    .category-btn span {
        font-size: 0.8rem;
    }
    
    .flashcard {
        height: 250px;
    }
    
    .flashcard-front p {
        font-size: 1rem;
    }
    
    .mobile-nav-btn {
        font-size: 0.6rem;
    }
    
    .mobile-nav-btn i {
        font-size: 1.1rem;
    }
}

/* ===== iPhone 14/15/16 (390px) ===== */
@media (min-width: 390px) and (max-width: 427px) {
    .flashcard {
        height: 300px;
    }
    
    .hero h1 {
        font-size: 1.6rem;
    }
}

/* ===== iPhone 14/15/16 Pro Max & Plus (428px+) ===== */
@media (min-width: 428px) and (max-width: 767px) {
    .stats-overview {
        gap: 1rem;
    }
    
    .stat-card {
        padding: 1.25rem;
    }
    
    .hero h1 {
        font-size: 1.75rem;
    }
    
    .flashcard {
        height: 320px;
    }
}

/* ===== LANDSCAPE MODE FOR PHONES ===== */
@media (max-height: 500px) and (orientation: landscape) {
    body {
        padding-bottom: calc(var(--safe-bottom) + 60px);
    }
    
    .mobile-nav {
        padding-bottom: calc(var(--safe-bottom) / 2);
    }
    
    .mobile-nav-btn {
        min-height: 50px;
        padding: 0.35rem 0.25rem;
    }
    
    .flashcard {
        height: 200px;
    }
    
    .hero {
        padding: 0.5rem 0;
    }
    
    .stats-overview {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ===== iPAD PORTRAIT (768px - 1024px) ===== */
@media (min-width: 768px) and (max-width: 1023px) {
    .quiz-options {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ===== HOVER STATES - Only for devices that support hover ===== */
@media (hover: hover) and (pointer: fine) {
    .category-btn:hover {
        transform: translateY(-3px);
        box-shadow: var(--shadow-lg);
    }
    
    .action-btn.primary:hover {
        transform: translateY(-3px);
        box-shadow: 0 10px 20px rgba(99, 102, 241, 0.3);
    }
    
    .stat-card:hover {
        transform: translateY(-5px);
    }
}

/* ===== TOUCH DEVICES - Disable hover effects ===== */
@media (hover: none) {
    .category-btn:hover,
    .action-btn:hover,
    .stat-card:hover {
        transform: none;
    }
    
    .theme-toggle:hover {
        transform: none;
    }
}

/* ===== DARK MODE ADJUSTMENTS FOR MOBILE ===== */
@media (prefers-color-scheme: dark) {
    :root {
        --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    }
}

/* ===== HIGH CONTRAST MODE ===== */
@media (prefers-contrast: high) {
    :root {
        --border: #000;
    }
    
    .answer-btn {
        border-width: 3px;
    }
}

/* ===== PRINT STYLES ===== */
@media print {
    .mobile-nav,
    .header,
    .theme-toggle {
        display: none !important;
    }
    
    body {
        padding: 0;
    }
    
    .main-content {
        max-width: 100%;
    }
}
