/* Import Google Fonts: Poppins & Playfair Display */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@1,500&family=Poppins:wght@400;500;600;700;800;900&display=swap');

:root {
    --bg-color: #f8fafc;
    --grid-color: #cbd5e1;
    --primary-text: #0f172a;

    --bg-gradient: linear-gradient(135deg, #eef6ff, #ffffff);
    --navbar-bg: rgba(243, 244, 246, 0.92);
    --navbar-border: #E5E7EB;
    --text-primary: #1F2937;
    --text-secondary: #374151;
    --text-muted: #475569;
    --accent-primary: #FF8A00;
    --accent-hover: #F97316;
    --accent-active: #EA580C;
    --accent-light: #EEF2FF;
    --card-bg: rgba(255, 255, 255, 0.7);
    --card-border: rgba(255, 255, 255, 0.5);

    --button-primary: #3b82f6;
    --button-primary-hover: #2563eb;
    --button-text: #ffffff;
    --correct-color: #10b981;
    --wrong-color: #ef4444;

    /* Blue gradient theme for cards */
    --card-bg-1: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%);
    --card-bg-2: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    --card-bg-3: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    --card-bg-4: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
    --card-bg-5: linear-gradient(135deg, #1e40af 0%, #1e3a8a 100%);
}


body.dark-theme {
    --bg-color: #09090B;
    --bg-gradient: #09090B;
    --navbar-bg: #111827;
    --navbar-border: #27272A;
    --text-primary: #F8FAFC;
    --text-secondary: #CBD5E1;
    --text-muted: #94A3B8;

    --accent-primary: #8B5CF6;
    --accent-hover: #A855F7;
    --accent-active: #7C3AED;
    --accent-light: #C4B5FD;

    --card-bg: #18181B;
    --card-border: #27272A;

    --button-primary: #8B5CF6;
    --button-primary-hover: #A855F7;
    --button-text: #F8FAFC;
}

body,
nav,
div,
button,
a,
svg,
span,
p,
h1,
h2,
h3,
header,
main,
section,
article,
.glass-card,
input,
select,
.theme-toggle {
    transition: background-color 0.3s ease-in-out, color 0.3s ease-in-out, border-color 0.3s ease-in-out, box-shadow 0.3s ease-in-out, fill 0.3s ease-in-out, stroke 0.3s ease-in-out;
}


* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
    -webkit-tap-highlight-color: transparent;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-color);
    overflow-x: hidden;
    width: 100%;
}

.website-container {
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ==========================================================
   Hero Section (Full Viewport)
   ========================================================== */
.hero-section {
    position: relative;
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    overflow: hidden;
    background-color: var(--bg-color);
}

/* White graph-paper background */
.hero-bg-grid {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        linear-gradient(var(--grid-color) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-color) 1px, transparent 1px);
    background-size: 30px 30px;
    background-position: center;
    opacity: 0.6;
    z-index: 1;
}

/* Grid fade out at the bottom */
.hero-bg-grid::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40vh;
    background: linear-gradient(to top, #ffffff, transparent);
    z-index: 2;
}

.hero-content {
    position: relative;
    z-index: 10;
    padding: 0 20px;
    animation: fadeIn 1.2s ease-out forwards;
}

/* Elegant Quote Section */
.hero-quote-container {
    margin-bottom: 50px;
    animation: fadeUpQuote 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
    opacity: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.hero-quote {
    font-family: 'Playfair Display', serif;
    font-style: italic;
    font-weight: 500;
    
    color: #2F3A56;
    line-height: 1.5;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
    max-width: 800px;
    transition: color .3s ease, background .3s ease, text-shadow .3s ease;
}

.hero-quote-author {
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    
    color: #4A6FB5;
    transition: color .3s ease, background .3s ease, text-shadow .3s ease, font-weight .3s ease;
}

body.dark-theme .hero-quote {
    background: linear-gradient(90deg, #C084FC 0%, #E879F9 45%, #F0ABFC 100%);
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
    text-shadow: 0 0 8px rgba(192, 132, 252, .20), 0 0 18px rgba(232, 121, 249, .12);
}

body.dark-theme .hero-quote-author {
    color: #C4B5FD;
    font-weight: 700;
}

@keyframes fadeUpQuote {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Large centered 3D title */
.title {
    
    font-weight: 900;
    color: #1a398c;
    letter-spacing: 2px;
    margin-bottom: 25px;
    text-transform: uppercase;
    text-shadow:
        3px 3px 0px #97c4f5,
        6px 6px 0px #70a9ea,
        12px 12px 25px rgba(0, 0, 0, 0.3);
    animation: float 5s ease-in-out infinite;
}

.subtitle {
    
    font-weight: 600;
    color: var(--text-primary);
    background: var(--card-bg);
    padding: 12px 40px;
    border-radius: 50px;
    display: inline-block;
    backdrop-filter: blur(12px);
    box-shadow: 0 8px 32px rgba(31, 38, 135, 0.1);
    border: 1px solid var(--card-border);
}

/* ==========================================================
   Mathematics Knowledge Hub
   ========================================================== */
.formulas-view,
.categories-view {
    position: fixed;
    inset: 0;
    z-index: 1500;
    display: none;
    overflow-y: auto;
    background: var(--bg-color);
}

.formulas-view.active,
.categories-view.active {
    display: block;
    animation: slideInUpView 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.categories-subpage {
    min-height: 100%;
    padding: 112px 20px 80px;
    background: var(--bg-color);
}

.categories-subpage-inner {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

.categories-subpage h2 {
    color: var(--text-primary);
    
    font-weight: 800;
    line-height: 1.15;
}

.categories-subpage p:not(.knowledge-hub-eyebrow) {
    max-width: 620px;
    margin-top: 12px;
    color: var(--text-muted);
    line-height: 1.7;
}

.categories-subpage .important-formulas-button {
    margin-top: 28px;
}

.knowledge-hub {
    width: 100%;
    padding: 20px 20px 110px;
    background: var(--bg-color);
    scroll-margin-top: 96px;
}

.formulas-back-button {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 22px;
    padding: 8px 0;
    color: var(--accent-active);
    font: inherit;
    font-size: 0.85rem;
    font-weight: 800;
    background: transparent;
    border: 0;
    cursor: pointer;
}

.formulas-back-button svg {
    width: 17px;
}

.knowledge-hub-inner {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

.knowledge-hub-heading {
    max-width: 720px;
    margin-bottom: 28px;
}

.knowledge-hub-eyebrow {
    margin-bottom: 8px;
    color: var(--accent-primary);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.knowledge-hub h2 {
    color: var(--text-primary);
    
    font-weight: 800;
    line-height: 1.15;
}

.knowledge-hub-heading>p:last-child {
    margin-top: 12px;
    color: var(--text-muted);
    font-size: 1rem;
    line-height: 1.7;
}

.formula-search {
    display: flex;
    align-items: center;
    gap: 12px;
    width: min(100%, 480px);
    margin-bottom: 30px;
    padding: 0 16px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.formula-search svg {
    width: 20px;
    color: var(--accent-primary);
}

.formula-search input {
    width: 100%;
    min-width: 0;
    padding: 15px 0;
    color: #1f2937;
    font: inherit;
    outline: none;
    border: 0;
    background: transparent;
}

.formula-search:focus-within {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent-primary) 14%, transparent);
}

.topic-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
}

.topic-card {
    position: relative;
    min-height: 238px;
    padding: 22px;
    overflow: hidden;
    color: #1f2937;
    text-align: left;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
    cursor: pointer;
    transition: transform 300ms ease, box-shadow 300ms ease, border-color 300ms ease;
}

.topic-card::before {
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    height: 4px;
    content: '';
    background: var(--accent-primary);
}

.topic-card:hover,
.topic-card:focus-visible,
.topic-card.is-active {
    border-color: color-mix(in srgb, var(--accent-primary) 40%, #e2e8f0);
    box-shadow: 0 18px 34px rgba(15, 23, 42, 0.12);
    outline: none;
    transform: translateY(-6px);
}

.topic-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.topic-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    color: var(--accent-primary);
    background: color-mix(in srgb, var(--accent-primary) 10%, #ffffff);
    border-radius: 12px;
}

.topic-icon svg {
    width: 21px;
}

.difficulty-badge {
    padding: 5px 8px;
    color: var(--accent-active);
    font-size: 0.68rem;
    font-weight: 800;
    line-height: 1;
    background: color-mix(in srgb, var(--accent-primary) 12%, #ffffff);
    border-radius: 999px;
}

.topic-card h3 {
    margin-top: 22px;
    color: #172033;
    font-size: 1.05rem;
    font-weight: 800;
    line-height: 1.35;
}

.topic-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
    color: #64748b;
    font-size: 0.78rem;
}

.topic-meta span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.topic-meta svg {
    width: 14px;
}

.topic-view-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 22px;
    color: var(--accent-active);
    font-size: 0.82rem;
    font-weight: 800;
}

.topic-view-link svg {
    width: 16px;
    transition: transform 300ms ease;
}

.topic-card:hover .topic-view-link svg {
    transform: translateX(4px);
}

.topic-detail {
    grid-column: 1 / -1;
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition: max-height 500ms ease, opacity 300ms ease, margin 300ms ease;
}

.topic-detail.is-open {
    max-height: 3000px;
    margin-bottom: 4px;
    opacity: 1;
}

.topic-detail-panel {
    padding: clamp(22px, 4vw, 38px);
    color: #1f2937;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-top: 4px solid var(--accent-primary);
    border-radius: 20px;
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.08);
}

.topic-detail-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
}

.topic-detail-heading h3,
.formula-section-title {
    color: #172033;
    font-size: 1.3rem;
    font-weight: 800;
}

.topic-detail-heading p {
    max-width: 740px;
    margin-top: 8px;
    color: #64748b;
    line-height: 1.7;
}

.topic-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    color: #64748b;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
}

.topic-close svg {
    width: 18px;
}

.formula-section-title {
    margin-top: 30px;
}

.formula-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.formula-card {
    padding: 20px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
}

.formula-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
}

.formula-expression {
    color: var(--accent-active);
    font-family: 'Plus Jakarta Sans', 'Poppins', sans-serif;
    font-size: 1.08rem;
    font-weight: 800;
    line-height: 1.5;
}

.formula-bookmark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    color: #64748b;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
}

.formula-bookmark svg {
    width: 17px;
}

.formula-bookmark.is-bookmarked {
    color: var(--accent-active);
    background: color-mix(in srgb, var(--accent-primary) 12%, #ffffff);
}

.formula-facts {
    display: grid;
    gap: 10px;
    margin-top: 18px;
}

.formula-fact {
    color: #475569;
    font-size: 0.84rem;
    line-height: 1.55;
}

.formula-fact strong {
    color: #172033;
}

.topic-practice-button {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    margin-top: 28px;
    padding: 13px 18px;
    color: #ffffff;
    font: inherit;
    font-size: 0.9rem;
    font-weight: 800;
    background: var(--accent-primary);
    border: 0;
    border-radius: 10px;
    box-shadow: 0 8px 16px color-mix(in srgb, var(--accent-primary) 25%, transparent);
    cursor: pointer;
    overflow: hidden;
}

.topic-practice-button:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
}

.topic-practice-button svg {
    width: 17px;
}

.topic-practice-button::after {
    position: absolute;
    inset: 0;
    content: '';
    background: rgba(255, 255, 255, 0.24);
    opacity: 0;
    transform: scale(0);
}

.topic-practice-button:active::after {
    animation: hub-button-ripple 450ms ease-out;
}

@keyframes hub-button-ripple {
    from {
        opacity: 0.6;
        transform: scale(0);
    }

    to {
        opacity: 0;
        transform: scale(2);
    }
}

.topic-empty-state {
    padding: 44px 20px;
    color: var(--text-muted);
    text-align: center;
    background: #ffffff;
    border: 1px dashed #cbd5e1;
    border-radius: 12px;
}

body.dark-theme .formula-search,
body.dark-theme .topic-card,
body.dark-theme .topic-detail-panel,
body.dark-theme .topic-empty-state {
    background: #18181b;
    border-color: #27272a;
}

body.dark-theme .formula-search input,
body.dark-theme .topic-card,
body.dark-theme .topic-card h3,
body.dark-theme .topic-detail-heading h3,
body.dark-theme .formula-section-title,
body.dark-theme .formula-fact strong {
    color: #f8fafc;
}

body.dark-theme .topic-meta,
body.dark-theme .topic-detail-heading p,
body.dark-theme .formula-fact {
    color: #94a3b8;
}

body.dark-theme .topic-icon,
body.dark-theme .difficulty-badge,
body.dark-theme .formula-bookmark.is-bookmarked {
    background: rgba(139, 92, 246, 0.16);
}

body.dark-theme .formula-card,
body.dark-theme .topic-close,
body.dark-theme .formula-bookmark {
    background: #111827;
    border-color: #27272a;
}

@media (max-width: 1024px) {
    .topic-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .knowledge-hub {
        padding: 10px 15px 72px;
    }

    .topic-grid,
    .formula-grid {
        grid-template-columns: 1fr;
    }

    .topic-card {
        min-height: 212px;
    }

    .topic-detail-heading {
        gap: 12px;
    }
}



/* ==========================================================
   Navigation Cards Section
   ========================================================== */
.cards-section {
    position: relative;
    z-index: 10;
    width: 100%;
    padding: 100px 20px;
    background-color: var(--bg-color);
    display: flex;
    justify-content: center;
    scroll-margin-top: 100px;
}

.cards-grid {
    width: 100%;
    max-width: 1200px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 30px;
}

.important-formulas-button {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    color: #ffffff;
    font: inherit;
    font-size: 0.95rem;
    font-weight: 800;
    background: var(--accent-primary);
    border: 0;
    border-radius: 10px;
    box-shadow: 0 8px 16px color-mix(in srgb, var(--accent-primary) 25%, transparent);
    cursor: pointer;
    transition: transform 300ms ease, background-color 300ms ease, box-shadow 300ms ease;
}

.important-formulas-button:hover {
    background: var(--accent-hover);
    box-shadow: 0 12px 22px color-mix(in srgb, var(--accent-primary) 32%, transparent);
    transform: translateY(-3px);
}

.important-formulas-button svg {
    width: 18px;
}

/* Card Items with Glassmorphism */
.card-item {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    align-items: center;
    padding: 40px 50px;
    text-decoration: none;
    color: white;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.4s ease;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

#card-leaderboard {
    scroll-margin-top: 100px;
}

/* Specific Card Styling */
#card-start {
    background: var(--card-bg-1);
    grid-column: 1 / -1;
    /* Make start quiz span full width on desktop/tablet */
    padding: 60px 60px;
}

#card-start .card-text {
    font-size: 3.5rem;
}

#card-start .card-icon {
    font-size: 4.5rem;
}

#card-categories {
    background: var(--card-bg-2);
}

#card-leaderboard {
    background: var(--card-bg-3);
}

#card-settings {
    background: var(--card-bg-4);
}

#card-about {
    background: var(--card-bg-5);
}

.card-item:hover,
.card-item:focus {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
    z-index: 2;
    outline: none;
}

.card-content {
    position: relative;
    z-index: 2;
    display: flex;
    justify-content: space-between;
    align-items: center;
    align-items: center;
    width: 100%;
}

.card-text {
    font-size: 2.2rem;
    font-weight: 700;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.25);
    letter-spacing: 1px;
}

.premium-action-btn {
    background-color: #C8F3D0 !important;
    color: #173A2A !important;
    border-radius: 18px !important;
    border: none !important;
    font-size: 17px !important;
    font-weight: 700 !important;
    height: 46px !important;
    min-width: 140px !important;
    max-width: 180px !important;
    width: fit-content !important;
    padding: 12px 22px !important;
    box-shadow: 0 10px 24px rgba(34, 120, 70, 0.15) !important;
    transition: all 250ms ease !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    pointer-events: none !important;
    text-shadow: none !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    box-sizing: border-box !important;
}

.premium-action-btn i,
.premium-action-btn svg {
    font-size: 20px !important;
    color: #173A2A !important;
}

@media (max-width: 768px) {
    .premium-action-btn i,
    .premium-action-btn svg {
        font-size: 18px !important;
    }
}

.card-item:hover .card-text {
    color: #ffffff;
}

.card-item:hover .premium-action-btn {
    transform: translateY(-2px) scale(1.02) !important;
    background-color: #D6F7DD !important;
    box-shadow: 0 14px 28px rgba(34, 120, 70, 0.25) !important;
}

.card-item:active .premium-action-btn {
    transform: scale(0.98) !important;
}

/* Glass effect highlight */
.card-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.25), transparent);
    z-index: 1;
    pointer-events: none;
}

/* Ripple Animation Elements */
.ripple-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow: hidden;
    border-radius: inherit;
    z-index: 0;
    pointer-events: none;
}

.ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    transform: scale(0);
    animation: ripple-animation 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    pointer-events: none;
}

/* ==========================================================
   Animations
   ========================================================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(40px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes float {
    0% {
        transform: translateY(0px);
    }

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

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



@keyframes ripple-animation {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* ==========================================================
   Responsive Constraints (Mobile-First approach overrides)
   ========================================================== */
@media (max-width: 992px) {
    .cards-section {
        padding: 80px 20px;
    }

    #card-start .card-text {
        font-size: 3rem;
    }

    #card-start .card-icon {
        font-size: 4rem;
    }
}

@media (max-width: 768px) {

    /* Tablet & Large Mobile */
    .cards-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    #card-start {
        padding: 40px 40px;
    }

    .card-item {
        padding: 30px 40px;
    }

    .card-text {
        font-size: 2rem;
    }

    .card-icon {
        font-size: 2.5rem;
    }
}

@media (max-width: 480px) {

    /* Mobile */
    .cards-section {
        padding: 60px 15px;
    }

    #card-start {
        padding: 35px 25px;
    }

    .card-item {
        padding: 25px 25px;
        border-radius: 18px;
    }

    #card-start .card-text,
    .card-text {
        font-size: 1.8rem;
    }

    #card-start .card-icon,
    .card-icon {
        font-size: 2.2rem;
    }

    .subtitle {
        padding: 10px 20px;
    }
}

/* ==========================================================
   Header and Brand Styles
   ========================================================== */
.premium-navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 76px;
    background-color: var(--navbar-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--navbar-border);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 30px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 80px;
    padding: 0 24px;
}

.site-header {
    display: flex;
    align-items: center;
}

.brand-link {
    display: flex;
    align-items: center;
    gap: 0;
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
}

.brand-link:hover {
    transform: scale(1.05);
}

.brand-logo {
    height: 48px;
    width: auto;
    object-fit: contain;
}

.brand-name {
    display: flex;
    align-items: center;
    gap: 0;
    margin-left: -6px;
    font-family: 'Plus Jakarta Sans', sans-serif;
    line-height: 1;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    white-space: nowrap;
}

.brand-numerically {
    font-size: 34px;
    font-weight: 600;
    color: #EF4444;
    letter-spacing: -0.03em;
}

.brand-inclined {
    font-size: 34px;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.03em;
}

.orange-dot {
    position: relative;
    display: inline-block;
}

.orange-dot::after {
    content: '';
    position: absolute;
    top: 0.16em;
    left: 50%;
    transform: translateX(-50%);
    width: 0.13em;
    height: 0.13em;
    background-color: var(--accent-primary);
    border-radius: 50%;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 18px;
}

.premium-nav-link {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 600;
    font-size: 15px;
    transition: all 0.25s ease;
    padding: 10px 18px;
    border: 1px solid transparent;
    border-radius: 14px;
    cursor: pointer;
}

.premium-nav-link svg {
    color: var(--text-secondary);
    transition: all 0.25s ease;
}

.premium-nav-link:hover {
    color: var(--nav-text-hover, var(--text-primary));
    transform: translateY(-2px);
}

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

.premium-nav-link.active {
    background: var(--nav-active-bg, var(--accent-light));
    border: 1px solid var(--nav-active-border, #CBD5E1);
    color: var(--nav-active-color, var(--button-primary));
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.10);
}

.premium-nav-link.active svg {
    color: var(--nav-active-color, var(--button-primary));
}

.premium-nav-link:focus-visible {
    outline: 2px solid var(--nav-focus-ring, #2563EB);
    outline-offset: 2px;
}

.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    align-items: center;
    justify-content: center;
}

@media (max-width: 1024px) {
    .premium-navbar {
        padding: 0 20px;
    }

    .brand-logo {
        height: 42px;
    }

    .nav-links {
        gap: 16px;
    }

    .premium-nav-link {
        font-size: 15px;
        padding: 10px 16px;
    }
}

@media (max-width: 768px) {
    .premium-navbar {
        padding: 0 16px;
    }

    .nav-links {
        display: none;
    }

    .mobile-menu-toggle {
        display: flex;
        margin-left: auto;
    }

    .brand-logo {
        height: 38px;
    }

    .brand-numerically {
        font-size: 30px;
    }

    .brand-inclined {
        font-size: 30px;
    }
}

@media (max-width: 480px) {
    .premium-navbar {
        padding: 0 16px;
    }

    .brand-logo {
        height: 38px;
    }

    .brand-numerically {
        font-size: 24px;
    }

    .brand-inclined {
        font-size: 24px;
    }
}


/* ==========================================================
   Quiz Styles (Merged)
   ========================================================== */

body.quiz-active {
    overflow: hidden;
    background: var(--bg-gradient);
}

#quiz-view {
    width: 100%;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 10;
    display: none;
    /* Hidden by default */
    justify-content: center;
    align-items: center;
}

#quiz-view.active {
    display: flex;
}

/* SPA View Transitions */
.view-section {
    transition: opacity 0.5s ease-in-out, transform 0.5s ease-in-out;
}

.fade-out {
    opacity: 0;
    pointer-events: none;
}

.hidden-view {
    display: none !important;
}



.slide-in-up {
    animation: slideInUpView 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes slideInUpView {
    from {
        opacity: 0;
        transform: translateY(40px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Transparent Abacus Background */
.quiz-bg {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url('../assets/images/abacus-transparent.png');
    background-position: center;
    background-repeat: no-repeat;
    background-size: 70%;
    opacity: 0.15;
    filter: blur(2px);
    pointer-events: none;
    z-index: 0;
}

/* Hide unused layers */
.quiz-bg-blur,
.quiz-overlay {
    display: none;
}

/* Container */
.quiz-container {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;

    width: 100%;
    max-width: 600px;
    margin: 0 auto;
}

/* Centered glassmorphism card */
.glass-card {
    width: 100%;
    max-width: 600px;
    background: rgba(255, 255, 255, 0.78);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: 28px;
    padding: 50px 40px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    text-align: center;
    transition: all 0.3s ease;
    animation: slideUp 0.5s ease-out forwards;
    position: relative;
    z-index: 10;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hidden {
    display: none !important;
}

/* Header */
.quiz-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 25px;
}

/* Timer */
.timer-container {
    width: 100%;
    height: 12px;
    background: #e2e8f0;
    border-radius: 6px;
    margin-bottom: 30px;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

.timer-bar {
    height: 100%;
    width: 100%;
    background: #10b981;
    /* Default green */
    transition: width 0.1s linear, background-color 0.3s;
}

/* Question Styling (Handwritten) */
.question-display {
    margin: 40px 0;
}

#math-question {
    font-family: 'Kalam', cursive;
    /* Handwritten font */
    font-size: clamp(32px, 8vw, 60px);
    color: #0f172a;
    /* Dark blue/slate text */
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.05);
}

/* Answer Area */
.answer-section {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 25px;
    flex-wrap: wrap; /* allow wrapping on tiny screens */
}

#answer-input {
    font-size: clamp(1.5rem, 5vw, 2rem);
    font-weight: 600;
    padding: 10px 20px;
    width: 100%;
    max-width: 250px;
    border: 2px solid #cbd5e1;
    border-radius: 16px;
    text-align: center;
    outline: none;
    font-family: 'Poppins', sans-serif;
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.8);
    transition: border-color 0.2s, box-shadow 0.2s;
}

#answer-input:focus {
    border-color: var(--button-primary);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.2);
}

#submit-btn {
    background: var(--button-primary);
    color: white;
    border: none;
    padding: 10px 35px;
    font-size: 1.3rem;
    font-weight: 600;
    border-radius: 16px;
    cursor: pointer;
    box-shadow: 0 6px 15px rgba(37, 99, 235, 0.3);
    transition: transform 0.2s, box-shadow 0.2s;
}

#submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.4);
}

#submit-btn:active {
    transform: translateY(0);
}

/* Feedback */
.feedback-msg {
    height: 30px;
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 30px;
    opacity: 0;
    transition: opacity 0.3s;
}

.feedback-msg.show {
    opacity: 1;
}

.correct {
    color: #10b981;
}

.wrong {
    color: #ef4444;
}

/* Progress */
.progress-container {
    width: 100%;
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    width: 0%;
    background: var(--button-primary);
    transition: width 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* Results Screen */
.results-icon {
    font-size: 4rem;
    color: #f59e0b;
    margin-bottom: 10px;
}

#results-screen h2 {
    font-size: 2.5rem;
    color: var(--text-primary);
    margin-bottom: 20px;
}

.results-stats {
    display: flex;
    justify-content: space-around;
    background: rgba(255, 255, 255, 0.6);
    padding: 20px;
    border-radius: 16px;
    margin-bottom: 25px;
}

.results-stats p {
    font-size: 1.1rem;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.results-stats strong {
    font-size: 1.5rem;
    color: var(--text-primary);
}

/* Leaderboard */
.leaderboard {
    margin: 0 0 30px 0;
    background: rgba(255, 255, 255, 0.7);
    padding: 20px;
    border-radius: 16px;
    text-align: left;
}

.leaderboard h3 {
    color: var(--text-primary);
    margin-bottom: 15px;
    text-align: center;
}

.leaderboard ul {
    list-style: none;
}

.leaderboard li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    border-bottom: 1px solid #cbd5e1;
    font-weight: 500;
}

.leaderboard li:last-child {
    border-bottom: none;
}

.leaderboard li strong {
    color: var(--button-primary);
}

/* Buttons */
.action-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.action-buttons button,
.home-btn {
    padding: 12px 30px;
    border-radius: 14px;
    font-weight: 600;
    font-size: 1.1rem;
    text-decoration: none;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: transform 0.2s, box-shadow 0.2s;
}

#play-again-btn {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

#play-again-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4);
}

.home-btn {
    background: #f1f5f9;
    color: var(--text-primary);
    border: 1px solid #cbd5e1;
}

.home-btn:hover {
    background: #e2e8f0;
    transform: translateY(-2px);
}

/* Responsive constraints */
@media (max-width: 500px) {
    #math-question {
        font-size: 48px;
    }

    .glass-card {
        padding: 30px 20px;
    }

    .results-stats {
        flex-direction: column;
        gap: 15px;
    }

    .quiz-header {
        font-size: 1rem;
    }

    #answer-input {
        width: 120px;
    }

    .action-buttons {
        flex-direction: column;
    }
}


/* Theme Toggle Styles */
.theme-toggle {
    width: 56px;
    height: 56px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-primary);
    position: relative;
    overflow: hidden;
}



.theme-toggle:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

.theme-toggle .sun-icon,
.theme-toggle .moon-icon {
    position: absolute;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

/* Light mode state */
.theme-toggle .sun-icon {
    opacity: 0;
    transform: rotate(-90deg) scale(0.5);
}

.theme-toggle .moon-icon {
    opacity: 1;
    transform: rotate(0) scale(1);
}

/* Dark mode state */
body.dark-theme .theme-toggle .sun-icon {
    opacity: 1;
    transform: rotate(0) scale(1);
}

body.dark-theme .theme-toggle .moon-icon {
    opacity: 0;
    transform: rotate(90deg) scale(0.5);
}

.navbar-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Premium Light Grey Navbar override in Dark Mode */
body.dark-theme .premium-navbar {
    --navbar-bg: rgba(243, 244, 246, 0.92);
    --navbar-border: #E5E7EB;
    --text-primary: #1F2937;
    --text-secondary: #374151;
    --nav-text-hover: #111827;
    --nav-icon-hover: #8B5CF6;
    --nav-active-bg: #EDE9FE;
    --nav-active-border: #C4B5FD;
    --nav-active-color: #7C3AED;
    --nav-focus-ring: #8B5CF6;
    box-shadow: 0 8px 30px rgba(0, 0, 0, .06);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

/* Premium Quiz Countdown Timer */
.quiz-countdown {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #EDE9FE;
    border: 1px solid #C4B5FD;
    color: #7C3AED;
    border-radius: 14px;
    padding: 10px 18px;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-weight: 700;
    font-size: 18px;
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.1);
    transition: background 0.3s ease, border-color 0.3s ease, color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
}

.quiz-countdown.warning {
    background: #FEF3C7;
    border-color: #FBBF24;
    color: #F59E0B;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.1);
}

.quiz-countdown.danger {
    background: #FEE2E2;
    border-color: #F87171;
    color: #EF4444;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.1);
}

.quiz-countdown.pulse {
    animation: timerPulse 1s infinite;
}

@keyframes timerPulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
    }

    50% {
        transform: scale(1.05);
        box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

/* Premium landing-page hierarchy */
.website-container {
    background: var(--bg-color);
}

.premium-hero {
    min-height: 90vh;
    padding: 130px 20px 72px;
    text-align: left;
    align-items: stretch;
    justify-content: center;
}

.premium-hero .hero-bg-grid::after {
    height: 34%;
    background: linear-gradient(to top, var(--bg-color), transparent);
}

.premium-hero-inner,
.section-shell {
    position: relative;
    z-index: 10;
    width: min(1200px, 100%);
    margin: 0 auto;
}

.premium-hero-inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(360px, .82fr);
    align-items: center;
    gap: clamp(48px, 8vw, 112px);
}

.hero-copy {
    max-width: 660px;
}

.hero-badge,
.section-heading>p {
    display: inline-flex;
    align-items: center;
    padding: 7px 10px;
    color: var(--accent-active);
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
    background: color-mix(in srgb, var(--accent-primary) 12%, transparent);
    border-radius: 999px;
}

.premium-hero .hero-quote-container {
    display: block;
    margin: 22px 0 30px;
    opacity: 1;
    animation: none;
}

.premium-hero .hero-quote {
    max-width: 670px;
    margin-bottom: 16px;
    color: var(--text-primary);
    font-family: 'Plus Jakarta Sans', 'Poppins', sans-serif;
    
    font-style: normal;
    font-weight: 800;
    letter-spacing: 0;
    line-height: 1.1;
}

.premium-hero .hero-quote-author {
    color: var(--text-muted);
    font-size: .96rem;
    font-weight: 600;
}

.premium-hero .hero-quote-author::before {
    content: '— ';
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.hero-actions button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 46px;
    width: fit-content;
    min-width: 140px;
    max-width: 180px;
    padding: 12px 22px;
    font-size: 17px;
    font-weight: 700;
    border-radius: 18px;
    cursor: pointer;
    background-color: #C8F3D0 !important;
    color: #173A2A !important;
    border: none !important;
    box-shadow: 0 10px 24px rgba(34, 120, 70, 0.15) !important;
    transition: all 250ms ease !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-sizing: border-box !important;
}

.hero-actions button i,
.hero-actions button svg {
    font-size: 20px !important;
    width: auto !important;
    height: auto !important;
    color: #173A2A !important;
}

@media (max-width: 768px) {
    .hero-actions button i,
    .hero-actions button svg {
        font-size: 18px !important;
    }
}

.hero-actions button:hover {
    transform: translateY(-2px) scale(1.02) !important;
    background-color: #D6F7DD !important;
    box-shadow: 0 14px 28px rgba(34, 120, 70, 0.25) !important;
}

.hero-actions button:active {
    transform: scale(0.98) !important;
}

.hero-actions button:disabled {
    opacity: 0.6 !important;
    pointer-events: none !important;
}

.hero-primary-button {}
.hero-secondary-button {}

.hero-benefits {
    display: grid;
    grid-template-columns: repeat(2, max-content);
    gap: 14px 24px;
    margin-top: 34px;
    color: var(--text-muted);
    font-size: .8rem;
    font-weight: 600;
}

.hero-benefits span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.hero-benefits svg {
    width: 16px;
    color: var(--accent-primary);
}

.hero-media-card {
    position: relative;
    aspect-ratio: .9;
    overflow: visible;
    border: 10px solid rgba(255, 255, 255, .72);
    border-radius: 28px;
    box-shadow: 0 28px 56px rgba(15, 23, 42, .2);
    animation: landingFloat 6s ease-in-out infinite;
}

.hero-media-card img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    border-radius: 19px;
}

.hero-media-badge {
    position: absolute;
    right: -18px;
    bottom: 28px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    color: var(--text-primary);
    font-size: .78rem;
    font-weight: 800;
    background: rgba(255, 255, 255, .94);
    border: 1px solid rgba(255, 255, 255, .86);
    border-radius: 10px;
    box-shadow: 0 14px 28px rgba(15, 23, 42, .15);
}

.hero-media-badge svg {
    width: 17px;
    color: var(--accent-primary);
}

.landing-section {
    padding: 96px 20px;
}

.platform-stats-section {
    padding-top: 12px;
}

.stat-cards {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}

.stat-card,
.journey-dashboard {
    background: rgba(255, 255, 255, .86);
    border: 1px solid #e2e8f0;
    box-shadow: 0 12px 28px rgba(15, 23, 42, .06);
}

.stat-card {
    display: grid;
    gap: 8px;
    min-height: 152px;
    padding: 22px;
    border-radius: 14px;
    transition: transform 300ms ease, box-shadow 300ms ease;
}

.stat-card:hover {
    box-shadow: 0 20px 34px rgba(15, 23, 42, .1);
    transform: translateY(-5px);
}

.stat-card svg {
    width: 20px;
    color: var(--accent-primary);
}

.stat-number {
    color: var(--text-primary);
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 1.8rem;
    font-weight: 800;
}

.stat-card>span:last-child {
    color: var(--text-muted);
    font-size: .79rem;
    font-weight: 700;
}

.feature-section-shell,
.journey-shell {
    display: grid;
    grid-template-columns: minmax(0, .84fr) minmax(360px, 1.16fr);
    gap: 38px;
    align-items: center;
}

.section-heading h2 {
    margin-top: 14px;
    color: var(--text-primary);
    font-family: 'Plus Jakarta Sans', sans-serif;
    
    font-weight: 800;
    line-height: 1.15;
}

.section-heading span {
    display: block;
    max-width: 520px;
    margin-top: 14px;
    color: var(--text-muted);
    line-height: 1.7;
}

.landing-section .card-item {
    min-height: 260px;
    padding: 34px;
    border: 1px solid rgba(255, 255, 255, .28);
    border-radius: 18px;
    box-shadow: 0 18px 38px rgba(15, 23, 42, .14);
}

.landing-section #card-start {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
}

.landing-section #card-categories {
    background: linear-gradient(135deg, #0f766e, #0f5f73);
}

.landing-section #card-leaderboard {
    background: linear-gradient(135deg, #7c3aed, #5b21b6);
}

.landing-section #card-settings {
    background: linear-gradient(135deg, #334155, #1e293b);
}

.landing-section #card-about {
    background: linear-gradient(135deg, #b45309, #92400e);
}

.landing-section .card-text {
    font-family: 'Plus Jakarta Sans', sans-serif;
    
    letter-spacing: 0;
}

.landing-section .card-icon {
    font-size: 3.2rem;
}

.utility-section {
    padding-top: 20px;
}

.utility-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.utility-grid .card-item {
    min-height: 190px;
}

.utility-grid .card-text {
    
}

.journey-section {
    padding-top: 28px;
}

.journey-shell {
    grid-template-columns: .7fr 1.3fr;
    align-items: start;
}

.journey-dashboard {
    padding: 28px;
    border-radius: 16px;
}

.practice-heatmap {
    display: grid;
    grid-template-columns: repeat(14, minmax(12px, 1fr));
    gap: 6px;
}

.practice-heatmap i {
    display: block;
    aspect-ratio: 1;
    min-width: 12px;
    background: #FFFFFF;
    border: 1px solid #E5E7EB;
    box-sizing: border-box;
    border-radius: 3px;
}

.practice-heatmap i[data-level="1"] {
    background: #DDD6FE;
    border: none;
}

.practice-heatmap i[data-level="2"] {
    background: #C4B5FD;
    border: none;
}

.practice-heatmap i[data-level="3"] {
    background: #8B5CF6;
    border: none;
}

.practice-heatmap i[data-level="4"] {
    background: #6D28D9;
    border: none;
}

.journey-legend {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    margin-top: 14px;
    color: var(--text-muted);
    font-size: .68rem;
}

.journey-legend i {
    width: 11px;
    height: 11px;
    background: #EDE9FE;
    border-radius: 2px;
    box-sizing: border-box;
}

.journey-legend i:nth-of-type(1) {
    background: #FFFFFF;
    border: 1px solid #E5E7EB;
}

.journey-legend i:nth-of-type(2) {
    background: #DDD6FE;
}

.journey-legend i:nth-of-type(3) {
    background: #C4B5FD;
}

.journey-legend i:nth-of-type(4) {
    background: #8B5CF6;
}

.journey-legend i:nth-of-type(5) {
    background: #6D28D9;
}

.journey-metrics {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 10px;
    margin-top: 28px;
}

.journey-metrics article {
    padding: 12px 8px;
    border-top: 1px solid #e2e8f0;
}

.journey-metrics article span {
    display: block;
    color: var(--text-primary);
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 1.3rem;
    font-weight: 800;
}

.journey-metrics small {
    display: block;
    margin-top: 5px;
    color: var(--text-muted);
    font-size: .66rem;
    font-weight: 700;
    line-height: 1.35;
}

.site-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    width: min(1200px, calc(100% - 40px));
    margin: 0 auto;
    padding: 34px 0 48px;
    color: var(--text-muted);
    border-top: 1px solid var(--card-border);
}

.site-footer>div {
    display: grid;
    gap: 6px;
}

.site-footer strong {
    color: var(--text-primary);
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 1rem;
}

.site-footer span,
.site-footer a {
    font-size: .76rem;
    font-weight: 600;
}

.site-footer nav {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
}

.site-footer a {
    color: var(--text-muted);
    text-decoration: none;
}

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

body.dark-theme .hero-media-card {
    border-color: #27272a;
    box-shadow: 0 28px 56px rgba(0, 0, 0, .38);
}

body.dark-theme .hero-media-badge,
body.dark-theme .stat-card,
body.dark-theme .journey-dashboard {
    color: #f8fafc;
    background: #18181b;
    border-color: #27272a;
}

body.dark-theme .hero-secondary-button {
    color: #f8fafc;
    background: #18181b;
    border-color: #27272a;
}

body.dark-theme .stat-number,
body.dark-theme .journey-metrics article span {
    color: #f8fafc;
}

body.dark-theme .practice-heatmap i,
body.dark-theme .journey-legend i {
    background: #312E81;
    border: none;
}

body.dark-theme .journey-legend i:nth-of-type(1) {
    border: none;
}

body.dark-theme .practice-heatmap i[data-level="1"],
body.dark-theme .journey-legend i:nth-of-type(2) {
    background: #4C1D95;
}

body.dark-theme .practice-heatmap i[data-level="2"],
body.dark-theme .journey-legend i:nth-of-type(3) {
    background: #6D28D9;
}

body.dark-theme .practice-heatmap i[data-level="3"],
body.dark-theme .journey-legend i:nth-of-type(4) {
    background: #8B5CF6;
}

body.dark-theme .practice-heatmap i[data-level="4"],
body.dark-theme .journey-legend i:nth-of-type(5) {
    background: #C4B5FD;
}

body.dark-theme .journey-metrics article {
    border-color: #27272a;
}

@keyframes landingFloat {

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

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

/* ==========================================================================
   Multiplication Tables Module
   ========================================================================== */

/* Green Theme Variables */
:root {
    --table-bg: #0F5132;
    --table-card: #145A32;
    --table-primary: #22C55E;
    --table-accent: #86EFAC;
    --table-text: #FFFFFF;
}

.tables-view {
    display: none;
    animation: fadeIn 0.3s ease forwards;
}

.tables-view:not([aria-hidden="true"]) {
    display: block;
}

.tables-subpage {
    padding: 100px 20px 60px;
    min-height: 100vh;
    background: #f8fafc;
}

body.dark-theme .tables-subpage {
    background: #09090b;
}

.tables-subpage-inner {
    max-width: 1000px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Green Category Button */
.green-category-btn {
    background: #0F5132 !important;
    color: white !important;
    border: none !important;
}

.green-category-btn:hover {
    background: #145A32 !important;
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(15, 81, 50, 0.2);
}

.green-category-btn i {
    color: #86EFAC !important;
}

/* Hero Section */
.premium-hero-green {
    background: linear-gradient(135deg, var(--table-bg), var(--table-card));
    border-radius: 24px;
    padding: 48px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: center;
    color: var(--table-text);
    box-shadow: 0 20px 40px rgba(15, 81, 50, 0.15);
    position: relative;
    overflow: hidden;
}

.premium-hero-green::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(134, 239, 172, 0.1) 0%, transparent 60%);
    pointer-events: none;
}

.premium-hero-green .hero-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
    z-index: 1;
}

.premium-hero-green h2 {
    font-size: 2.8rem;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.03em;
    margin: 0;
}

.premium-hero-green p {
    font-size: 1.1rem;
    opacity: 0.9;
    line-height: 1.6;
}

.green-primary-btn {
    background: var(--table-primary) !important;
    color: #0F5132 !important;
    border: none !important;
}

.green-primary-btn:hover {
    background: #4ade80 !important;
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(34, 197, 94, 0.3);
}

.green-secondary-btn {
    background: rgba(255, 255, 255, 0.1) !important;
    color: white !important;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
}

.green-secondary-btn:hover {
    background: rgba(255, 255, 255, 0.15) !important;
}

.premium-hero-green .hero-illustration {
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1;
}

.large-math-icon {
    width: 160px;
    height: 160px;
    color: var(--table-accent);
    opacity: 0.9;
    filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.2));
    animation: landingFloat 6s ease-in-out infinite;
}

/* Table Selector */
.table-selector {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 20px;
}

.table-selector h3 {
    font-size: 1.5rem;
    color: var(--text-primary);
}

body.dark-theme .table-selector h3 {
    color: #f8fafc;
}

.table-selector-grid {
    display: grid;

    gap: 16px;
}


.number-tile {
    background-color: #FFFFFF !important;
    color: #145A32 !important;
}


/* Single Table View */
.single-table-view {
    background: white;
    border: 1px solid var(--card-border);
    border-radius: 24px;
    padding: 32px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    gap: 32px;
    max-width: 600px;
    margin: 0 auto;
    width: 100%;
}

body.dark-theme .single-table-view {
    background: #18181b;
    border-color: #27272a;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.single-table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.single-table-header h3 {
    font-size: 1.8rem;
    color: var(--table-bg);
    margin: 0;
}

body.dark-theme .single-table-header h3 {
    color: var(--table-primary);
}

.table-actions {
    display: flex;
    gap: 8px;
}

.single-table-content {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px 32px;
    font-size: 1.3rem;
    font-family: 'JetBrains Mono', monospace;
}

.table-row {
    display: flex;
    justify-content: space-between;
    padding: 12px 16px;
    background: #f8fafc;
    border-radius: 12px;
    color: var(--text-primary);
}

body.dark-theme .table-row {
    background: #09090b;
    color: #f8fafc;
}

.table-row-ans {
    font-weight: 700;
    color: var(--table-bg);
}

body.dark-theme .table-row-ans {
    color: var(--table-primary);
}

.full-width {
    width: 100%;
    justify-content: center;
    padding: 18px !important;
    font-size: 1.1rem !important;
}

/* ==========================================================================
   Squares Module Additional Styles
   ========================================================================== */

.squares-selector-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.squares-search {
    display: flex;
    align-items: center;
    gap: 8px;
    background: white;
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 8px 16px;
    flex: 1;
    max-width: 400px;
}

body.dark-theme .squares-search {
    background: #18181b;
    border-color: #27272a;
}

.squares-search input {
    border: none;
    background: transparent;
    width: 100%;
    font-size: 1rem;
    color: var(--text-primary);
    outline: none;
}

body.dark-theme .squares-search input {
    color: #f8fafc;
}

.squares-search i {
    color: var(--text-muted);
}

.squares-grid {

}

.single-square-display {
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: #f8fafc;
    border-radius: 16px;
    padding: 32px;
}

body.dark-theme .single-square-display {
    background: #09090b;
}

.square-equation {
    font-size: 3.5rem;
    font-weight: 800;
    color: var(--table-bg);
}

body.dark-theme .square-equation {
    color: var(--table-primary);
}


.square-trick {
    margin-top: 16px;
    padding: 16px;
    background: rgba(34, 197, 94, 0.1);
    color: var(--table-bg);
    border-radius: 12px;
    font-size: 1.1rem;
    border: 1px dashed var(--table-primary);
}

body.dark-theme .square-trick {
    color: var(--table-primary);
    background: rgba(34, 197, 94, 0.05);
}

.square-navigation {
    display: flex;
    justify-content: space-between;
    gap: 16px;
}

.square-navigation button {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    background: #f1f5f9 !important;
    color: var(--text-primary) !important;
    border: none !important;
}

body.dark-theme .square-navigation button {
    background: #27272a !important;
    color: #f8fafc !important;
}

.square-navigation button:hover {
    background: #e2e8f0 !important;
}

body.dark-theme .square-navigation button:hover {
    background: #3f3f46 !important;
}

/* MCQ Choices */
.mcq-choices {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    width: 100%;
    margin-top: 16px;
}

.mcq-choices button {
    background: white;
    border: 2px solid var(--card-border);
    border-radius: 12px;
    padding: 16px;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
}

body.dark-theme .mcq-choices button {
    background: #18181b;
    border-color: #27272a;
    color: #f8fafc;
}

.mcq-choices button:hover {
    border-color: var(--table-primary);
    background: rgba(34, 197, 94, 0.05);
    transform: translateY(-2px);
}

.mcq-choices button.correct {
    background: #22C55E;
    color: white;
    border-color: #22C55E;
}

.mcq-choices button.wrong {
    background: #EF4444;
    color: white;
    border-color: #EF4444;
}

/* Toasts */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 9999;
    pointer-events: none;
}

.toast {
    background: var(--table-bg);
    color: white;
    padding: 16px 24px;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
    animation: slideInRight 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.toast i {
    color: #FACC15;
    /* Gold star */
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }

    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

@media (max-width: 900px) {

    .premium-hero-inner,
    .feature-section-shell,
    .journey-shell {
        grid-template-columns: 1fr;
    }

    .premium-hero {
        min-height: auto;
        padding-top: 118px;
    }

    .hero-media-card {
        width: min(530px, calc(100% - 20px));
        margin: 12px auto 0;
        aspect-ratio: 1.2;
    }

    .stat-cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .premium-hero {
        padding: 108px 16px 54px;
    }

    .landing-section {
        padding: 64px 16px;
    }

    .platform-stats-section {
        padding-top: 8px;
    }

    .hero-benefits {
        grid-template-columns: 1fr;
        gap: 11px;
    }

    .hero-actions {
        display: grid;
        grid-template-columns: 1fr;
    }

    .hero-actions button {
        width: 100%;
    }

    .hero-media-card {
        border-width: 6px;
        border-radius: 22px;
    }

    .hero-media-card img {
        border-radius: 15px;
    }

    .hero-media-badge {
        right: -8px;
        bottom: 18px;
    }

    .stat-cards,
    .utility-grid {
        grid-template-columns: 1fr;
    }

    .landing-section .card-item {
        min-height: 190px;
        padding: 26px;
    }

    .journey-dashboard {
        padding: 20px;
        overflow-x: auto;
    }

    .practice-heatmap {
        min-width: 290px;
    }

    .journey-metrics {
        min-width: 500px;
    }

    .site-footer {
        align-items: flex-start;
        flex-direction: column;
        width: calc(100% - 32px);
    }

    /* Responsive Tables module */
    .premium-hero-green {
        grid-template-columns: 1fr;
        text-align: center;
        padding: 32px 24px;
    }

    .premium-hero-green .hero-illustration {
        display: none;
    }

    .single-table-content {
        grid-template-columns: 1fr;
    }
}

/* Settings Modal Redesign */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.modal:not([aria-hidden="true"]) {
    visibility: visible;
    opacity: 1;
}

.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(16px);
}

.modal-content {
    position: relative;
    width: 90%;
    max-width: 500px;
    background: linear-gradient(180deg, #0B3D2E 0%, #0F5132 100%);
    border-radius: 28px;
    padding: 32px;
    z-index: 1;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
    border: none;
    transform: translateY(20px) scale(0.95);
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);

    width: 90%;
    max-width: 500px;
}

.modal:not([aria-hidden="true"]) .modal-content {
    transform: translateY(0) scale(1);

    width: 90%;
    max-width: 500px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.modal-header h2 {
    font-size: 42px;
    font-weight: 800;
    color: white;
    margin: 0;
}

.modal-header .icon-button {
    color: white;
}

.modal-header .icon-button:hover {
    background: rgba(255, 255, 255, 0.1);
}

.settings-group {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 32px;
}

.settings-group h3 {
    font-size: 1.1rem;
    color: #E8F5E9;
    margin-bottom: 8px;
}

.setting-radio {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 28px;
    border-radius: 22px;
    border: 2px solid #1E8449;
    background: #145A32;
    cursor: pointer;
    transition: 300ms;
}

.setting-radio:hover {
    background: #196f3d;
}

.setting-radio input[type="radio"] {
    margin-top: 2px;
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid #D5F5E3;
    background: transparent;
    position: relative;
    transition: 300ms;
    cursor: pointer;
    flex-shrink: 0;
}

.setting-radio input[type="radio"]:checked {
    border-color: white;
    background: white;
}

.setting-radio input[type="radio"]:checked::after {
    content: '';
    position: absolute;
    inset: 5px;
    background: #FF8C00;
    border-radius: 50%;
}

.setting-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-weight: 600;
    color: #F5F5F5;
}

.setting-text small {
    font-weight: 400;
    color: #D5F5E3;
    font-size: 0.85rem;
    line-height: 1.4;
}

/* Selected State */
.setting-radio:has(input:checked) {
    background: #FF8C00;
    border: 2px solid #FFA726;
    box-shadow: 0 10px 30px rgba(255, 140, 0, 0.35);
    transform: scale(1.02);
}

.setting-radio:has(input:checked) .setting-text {
    color: white;
}

.setting-radio:has(input:checked) .setting-text small {
    color: rgba(255, 255, 255, 0.92);
}

/* Avoid theme override */
body.dark-theme .setting-radio:has(input:checked) {
    background: #FF8C00;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
}

#save-settings-btn {
    background: #22C55E;
    color: white;
    border-radius: 18px;
    height: 64px;
    font-weight: 700;
    border: none;
    font-size: 1.1rem;
    cursor: pointer;
    transition: 200ms;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

#save-settings-btn:hover {
    background: #16A34A;
}



.number-tile,
.number-tile.is-selected {
    box-sizing: border-box !important;
    width: 100% !important;
    height: 100% !important;
    border: 2px solid transparent !important;
    border-radius: 24px !important;
    padding: 24px 16px !important;
    margin: 0 !important;
    font-size: 1.6rem !important;
    font-weight: 700 !important;
    text-align: center !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    outline: none !important;
    transform: none !important;
    transition: none !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04) !important;
    cursor: pointer !important;
    font-family: inherit !important;
    line-height: normal !important;
    gap: 8px !important;
}

.number-tile {
    background-color: #FFFFFF !important;
    color: #145A32 !important;
}

.number-tile.is-selected {
    background-color: #4E8540 !important;
    color: #FFFFFF !important;
}
.table-selector-grid, .squares-grid, .cubes-grid, .topic-grid {
    display: grid !important;
    gap: 15px;
    padding: 20px 0;
    width: 100%;
}
@media (min-width: 1440px) {
    .table-selector-grid, .squares-grid, .cubes-grid { grid-template-columns: repeat(10, 1fr) !important; }
    .topic-grid { grid-template-columns: repeat(6, 1fr) !important; }
}
@media (max-width: 1439px) and (min-width: 1024px) {
    .table-selector-grid, .squares-grid, .cubes-grid { grid-template-columns: repeat(8, 1fr) !important; }
    .topic-grid { grid-template-columns: repeat(4, 1fr) !important; }
}
@media (max-width: 1023px) and (min-width: 768px) {
    .table-selector-grid, .squares-grid, .cubes-grid { grid-template-columns: repeat(5, 1fr) !important; }
    .topic-grid { grid-template-columns: repeat(3, 1fr) !important; }
}
@media (max-width: 767px) and (min-width: 480px) {
    .table-selector-grid, .squares-grid, .cubes-grid { grid-template-columns: repeat(4, 1fr) !important; }
    .topic-grid { grid-template-columns: repeat(2, 1fr) !important; }
}
@media (max-width: 479px) {
    .table-selector-grid, .squares-grid, .cubes-grid { grid-template-columns: repeat(3, 1fr) !important; }
    .topic-grid { grid-template-columns: repeat(1, 1fr) !important; }
}
.number-tile {
    aspect-ratio: 1 / 1;
    display: flex;
    justify-content: center;
    align-items: center;
}
