/* Global Styles & Variables */
/* Variables inherited from shared.css */
:root {
    --sidebar-width: 300px;
    --transition-speed: 0.3s;
    /* Re-pointed to the Gonit Ongon design system (design-system.css) */
    --primary-color: var(--color-accent);
    --primary-hover: var(--color-accent-hover);
    --secondary-color: var(--emerald-700);
    --text-color: var(--color-ink);
    --text-muted: var(--color-ink-2);
}

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

body {
    font-family: 'Poppins', sans-serif;
    background: transparent; /* Inherit from shared.css */
    height: 100vh;
    overflow: hidden;
    color: var(--text-color);
    display: flex;
}

/* Sidebar Styles (Light Glassmorphism) */
.glass-sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.1);
    display: flex;
    flex-direction: column;
    position: absolute;
    left: 0;
    top: 0;
    z-index: 1000;
    transition: transform 0.5s cubic-bezier(0.25, 1, 0.5, 1);
}

.glass-sidebar.hidden {
    transform: translateX(-100%);
}

.sidebar-header {
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.sidebar-header h3 {
    font-weight: 600;
    letter-spacing: 1px;
    color: var(--primary-color);
}

.close-btn, .sidebar-toggle-btn {
    background: none;
    border: none;
    color: #4c6081; /* Darker gray for better visibility */
    cursor: pointer;
    font-size: 1.2rem;
    padding: 5px;
    transition: color 0.3s;
}

.close-btn:hover, .sidebar-toggle-btn:hover {
    color: var(--primary-color);
}

/* Sidebar Toggle Button (Floating) */
.sidebar-toggle-btn {
    position: absolute;
    left: 20px;
    top: 20px;
    z-index: 900;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(5px);
    padding: 10px 15px;
    border-radius: 50%;
    border: 1px solid white;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s, transform 0.3s;
}

.sidebar-toggle-btn.visible {
    opacity: 1;
    pointer-events: auto;
}

.sidebar-toggle-btn:hover {
    transform: scale(1.1);
    background: white;
    color: var(--primary-color);
}

/* Sidebar Content */
.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

/* Scrollbar styling */
.sidebar-content::-webkit-scrollbar {
    width: 6px;
}
.sidebar-content::-webkit-scrollbar-track {
    background: transparent;
}
.sidebar-content::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
}

.menu-item {
    margin-bottom: 10px;
}

.menu-btn {
    width: 100%;
    padding: 12px 15px;
    background: #f0f4f8;
    border: none;
    border-radius: 12px;
    color: #1a202c; /* Near black for maximum contrast */
    text-align: left;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1rem;
    font-weight: 700; /* Increased to bold */
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 
        5px 5px 10px rgba(163, 177, 198, 0.4), 
        -5px -5px 10px rgba(255, 255, 255, 0.8);
}

.menu-btn:hover {
    transform: translateY(-2px);
    background: #ffffff;
    color: var(--primary-color);
    box-shadow: 
        6px 6px 12px rgba(163, 177, 198, 0.5), 
        -6px -6px 12px rgba(163, 161, 161, 0.9);
}

.menu-btn:active {
    transform: translateY(0);
    box-shadow: inset 3px 3px 6px rgba(163, 177, 198, 0.4), 
                inset -3px -3px 6px rgba(141, 140, 140, 0.8);
}

.menu-btn.active {
    background: var(--primary-color);
    color: white;
    box-shadow: 
        4px 4px 8px rgba(67, 97, 238, 0.4), 
        -4px -4px 8px rgba(255, 255, 255, 0.2);
}

.menu-btn i.arrow {
    transition: transform 0.3s;
}

.menu-btn.active i.arrow {
    transform: rotate(180deg);
}

/* Dropdown Content */
.dropdown-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 0 0 8px 8px;
    margin-top: -5px;
}

.dropdown-content.show {
    max-height: 1000px;
    padding-bottom: 10px;
}

.chapter-item {
    padding: 10px 15px 10px 40px;
    cursor: pointer;
    font-size: 0.9rem;
    color: #000000; /* Better text visibility */
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.chapter-item:hover {
    color: var(--primary-color);
    background: rgba(255, 255, 255, 0.5);
}

.chapter-item.active {
    color: var(--primary-color);
    font-weight: 600;
    border-left-color: var(--primary-color);
    background: rgba(255, 255, 255, 0.8);
}

/* Main Container */
.main-container {
    flex: 1;
    margin-left: var(--sidebar-width); /* Sidebar width */
    height: 100vh;
    overflow: hidden;
    position: relative;
    transition: margin-left 0.5s cubic-bezier(0.25, 1, 0.5, 1);
    display: flex;
    flex-direction: column; /* Changed to column for Navbar */
    justify-content: flex-start; /* Align top */
    padding: 0; /* Remove padding from container, move to children if needed */
}

.main-container.full-width {
    margin-left: 0;
}

/* Navbar Styles */
.main-navbar {
    width: 100%;
    height: 70px;
    background: rgba(240, 248, 255, 0.85); /* Light bluish tone */
    backdrop-filter: blur(12px);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 40px;
    box-shadow: 
        0 4px 20px rgba(67, 97, 238, 0.08),
        0 1px 0 rgba(255, 255, 255, 0.5);
    z-index: 100;
    flex-shrink: 0;
    border-bottom: 1px solid rgba(67, 97, 238, 0.1);
}

.nav-brand {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 30px;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 1rem;
    transition: color 0.3s;
    position: relative;
}

.nav-links a:hover, .nav-links a.active {
    color: var(--primary-color);
}

.nav-links a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -5px;
    left: 0;
    background-color: var(--primary-color);
    transition: width 0.3s;
}

.nav-links a:hover::after, .nav-links a.active::after {
    width: 100%;
}

.nav-user {
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.3s;
}

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

/* Animation Stage */
.animation-stage {
    width: calc(100% - 20px);
    margin: 10px;
    flex: 1; /* Take remaining height */
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
    padding: 20px; /* Add padding here */
    
    /* Classy Glassmorphism Look */
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: 20px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.7));
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    box-shadow: 
        0 10px 30px rgba(0, 0, 0, 0.05),
        inset 0 0 20px rgba(255, 255, 255, 0.8);
}

/* Sidebar Footer / Tools */
.sidebar-footer {
    padding: 20px;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.tools-grid {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.tool-btn {
    background: #f0f4f8;
    border: none;
    color: #2d3748; /* Even darker gray/black for maximum visibility */
    font-size: 1.2rem;
    font-weight: 600; /* Added weight */
    cursor: pointer;
    width: 45px;
    height: 45px;
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 
        4px 4px 8px rgba(163, 177, 198, 0.4), 
        -4px -4px 8px rgba(255, 255, 255, 0.8);
}

.tool-btn:hover {
    color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 
        5px 5px 10px rgba(163, 177, 198, 0.5), 
        -5px -5px 10px rgba(255, 255, 255, 0.9);
}

.tool-btn:active {
    transform: translateY(0);
    box-shadow: inset 3px 3px 6px rgba(163, 177, 198, 0.4), 
                inset -3px -3px 6px rgba(255, 255, 255, 0.8);
}

/* Loader */
.loader {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.chapter-content {
    text-align: center;
}

.chapter-content-title {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.chapter-content-text {
    font-size: 1.2rem;
    color: var(--text-muted);
}

.loader-circle {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(67, 97, 238, 0.2);
    border-top: 5px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* --- Real Number Visualization Styles --- */
.real-number-container {
    width: 90%;
    max-width: 1000px;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.instruction-banner {
    text-align: center;
    margin-bottom: 25px;
}

.chapter-title {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.input-section {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
    align-items: center;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(10px);
    padding: 10px 20px;
    border-radius: 50px;
    box-shadow: 
        inset 2px 2px 5px rgba(163, 177, 198, 0.3), 
        inset -2px -2px 5px rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.input-section input {
    padding: 10px 15px;
    border: none;
    background: #f0f4f8;
    border-radius: 12px;
    font-size: 1rem;
    width: 150px;
    outline: none;
    transition: all 0.3s;
    box-shadow: inset 2px 2px 5px rgba(163, 177, 198, 0.3), 
                inset -2px -2px 5px rgba(255, 255, 255, 0.8);
}

.input-section input:focus {
    background: #ffffff;
    box-shadow: inset 1px 1px 3px rgba(163, 177, 198, 0.4), 
                inset -1px -1px 3px rgba(255, 255, 255, 0.9),
                0 0 0 2px var(--primary-color);
}

.btn-primary, .btn-secondary {
    padding: 10px 25px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    letter-spacing: 0.5px;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    box-shadow: 
        4px 4px 10px rgba(67, 97, 238, 0.4), 
        -4px -4px 10px rgba(255, 255, 255, 0.2);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 
        6px 6px 14px rgba(67, 97, 238, 0.5), 
        -6px -6px 14px rgba(255, 255, 255, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: inset 2px 2px 5px rgba(0, 0, 0, 0.2);
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: white;
    box-shadow: 
        4px 4px 10px rgba(63, 55, 201, 0.4), 
        -4px -4px 10px rgba(255, 255, 255, 0.2);
}

.btn-secondary:hover {
    opacity: 0.95;
    transform: translateY(-2px);
    box-shadow: 
        6px 6px 14px rgba(63, 55, 201, 0.5), 
        -6px -6px 14px rgba(255, 255, 255, 0.3);
}

.btn-secondary:active {
    transform: translateY(0);
    box-shadow: inset 2px 2px 5px rgba(0, 0, 0, 0.2);
}

.svg-wrapper {
    width: 100%;
    background: white;
    border-radius: 10px;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.03);
    border: 1px solid rgba(0,0,0,0.05);
    margin-bottom: 20px;
    overflow: hidden; /* Critical for zoom effect */
}

#number-line-svg {
    width: 100%;
    height: auto;
    display: block;
}

.step-info {
    font-size: 1.2rem;
    font-weight: 500;
    color: var(--text-color);
    min-height: 1.5em;
}

.tick-label {
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    fill: var(--text-muted);
}

/* --- Set and Functions Visualization Styles --- */
.sets-container {
    width: 100%;
    max-width: 900px;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-radius: 18px;
    padding: 14px 18px;
    box-shadow:
        0 10px 28px rgba(67, 97, 238, 0.06),
        inset 0 0 0 1px rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(67, 97, 238, 0.08);
    height: 100%;
    max-height: 100%;
    box-sizing: border-box;
}

.sets-container .chapter-title {
    font-size: 1.3rem;
    margin-bottom: 4px;
}

.sets-main-area {
    display: flex;
    flex: 1;
    min-height: 0;
    width: 100%;
    gap: 12px;
}

.sets-instruction {
    margin-bottom: 8px;
    font-size: 0.82rem;
    text-align: center;
    color: var(--text-muted);
    flex-shrink: 0;
    letter-spacing: 0.2px;
}

.venn-wrapper {
    position: relative;
    flex: 1;
    min-width: 0;
    aspect-ratio: 4 / 3;
    max-height: 100%;
    background: linear-gradient(145deg, #ffffff 0%, #f8faff 100%);
    border-radius: 14px;
    box-shadow:
        inset 0 0 24px rgba(67, 97, 238, 0.03),
        0 2px 8px rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(67, 97, 238, 0.08);
    overflow: hidden;
    user-select: none;
}

.venn-circle {
    position: absolute;
    width: 45%;
    height: 0;
    padding-bottom: 45%;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.6rem;
    font-weight: 700;
    color: rgba(0,0,0,0.35);
    mix-blend-mode: multiply;
    transition: all 0.35s ease;
    border: 2px solid rgba(255,255,255,0.5);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

/* Circle Colors - matching reference image layout */
.circle-a {
    background: radial-gradient(circle at 40% 40%, rgba(255, 99, 71, 0.55), rgba(255, 99, 71, 0.3));
    top: 6%;
    left: 12%;
}

.circle-b {
    background: radial-gradient(circle at 60% 40%, rgba(65, 105, 225, 0.55), rgba(65, 105, 225, 0.3));
    top: 6%;
    right: 12%;
}

.circle-c {
    background: radial-gradient(circle at 50% 60%, rgba(255, 215, 0, 0.55), rgba(255, 215, 0, 0.3));
    bottom: 4%;
    left: 50%;
    transform: translateX(-50%);
}

.circle-label {
    position: absolute;
    font-weight: 800;
    font-size: 1rem;
    color: rgba(0,0,0,0.5);
    pointer-events: none;
    text-shadow: 0 1px 2px rgba(255,255,255,0.6);
}

.label-a { top: 9%; left: 17%; }
.label-b { top: 9%; right: 17%; }
.label-c { bottom: 7%; left: 50%; transform: translateX(-50%); }

.number-bank-container {
    width: 130px;
    flex-shrink: 0;
    padding: 10px 8px;
    background: linear-gradient(180deg, rgba(243, 246, 255, 0.8) 0%, rgba(241, 243, 245, 0.5) 100%);
    border-radius: 14px;
    border: 1px solid rgba(67, 97, 238, 0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-y: auto;
    max-height: 100%;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.04);
}

.number-bank-title {
    font-size: 0.72rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--primary-color);
    text-align: center;
    line-height: 1.2;
    letter-spacing: 0.8px;
    text-transform: uppercase;
}

.number-bank {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    justify-items: center;
    min-height: 0;
    width: 100%;
}

.draggable-number {
    width: 38px;
    height: 38px;
    background: #fff;
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: grab;
    box-shadow:
        3px 3px 6px rgba(163, 177, 198, 0.35),
        -3px -3px 6px rgba(255, 255, 255, 0.9);
    font-weight: 700;
    font-size: 0.88rem;
    color: var(--text-color);
    user-select: none;
    z-index: 10;
    transition: transform 0.15s, box-shadow 0.25s, background-color 0.3s, border-color 0.3s;
    border: 2px solid transparent;
}

.draggable-number:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow:
        4px 4px 10px rgba(67, 97, 238, 0.18),
        -3px -3px 6px rgba(255, 255, 255, 1);
    border-color: rgba(67, 97, 238, 0.2);
}

.draggable-number:active {
    cursor: grabbing;
    transform: scale(1.12);
    box-shadow: 0 8px 18px rgba(67, 97, 238, 0.2);
}

.draggable-number.dragging {
    position: fixed;
    pointer-events: none;
    z-index: 9999;
    box-shadow: 0 12px 24px rgba(67, 97, 238, 0.25);
}

.draggable-number.success {
    background: linear-gradient(135deg, #06d6a0, #2ec4b6);
    color: white;
    border-color: #06d6a0;
    box-shadow: 0 4px 12px rgba(6, 214, 160, 0.3);
}

.draggable-number.error {
    background: linear-gradient(135deg, #ef476f, #e71d36);
    color: white;
    animation: shake 0.5s;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* Set Definitions Panel */
.set-definitions {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
    flex-wrap: wrap;
    justify-content: center;
    flex-shrink: 0;
}

.set-def {
    padding: 6px 14px;
    border-radius: 10px;
    font-size: 0.78rem;
    font-weight: 600;
    background: rgba(255,255,255,0.7);
    border: 1px solid rgba(0,0,0,0.06);
    box-shadow: 2px 2px 6px rgba(0,0,0,0.04);
    transition: transform 0.2s, box-shadow 0.2s;
}

.set-def:hover {
    transform: translateY(-1px);
    box-shadow: 3px 3px 8px rgba(0,0,0,0.08);
}

.def-a { border-left: 4px solid rgba(255, 99, 71, 1); }
.def-b { border-left: 4px solid rgba(65, 105, 225, 1); }
.def-c { border-left: 4px solid rgba(255, 215, 0, 1); }

/* Responsive */
@media (max-width: 768px) {
    :root {
        --sidebar-width: 260px;
    }
    .real-number-container, .sets-container {
        padding: 14px;
        width: 95%;
    }
    .input-section {
        flex-direction: column;
        border-radius: 10px;
    }
    .input-section input {
        width: 100%;
    }
    .btn-primary, .btn-secondary {
        width: 100%;
    }
    
    .sets-main-area {
        flex-direction: column;
    }
    .number-bank-container {
        width: 100%;
        flex-direction: column;
        max-height: none;
    }
    .number-bank {
        grid-template-columns: repeat(5, 1fr);
        gap: 6px;
    }
    .venn-wrapper {
        width: 100%;
        aspect-ratio: 4 / 3;
    }
}

/* ==========================================================================
   ░░  VISUAL MATH 2.0 — DE-AI-IFICATION OVERRIDE LAYER  ░░
   Appended last → supersedes the glass/neumorphism above. design-system.css
   is loaded before this file, so var(--color-*) tokens resolve here.
   Removes: glass sidebar/navbar/stage · claymorphic buttons · bluish navbar.
   Installs: flat slate/emerald system · deep-slate header · crisp surfaces.
   ========================================================================== */

body {
    font-family: var(--font-sans);
    background: var(--color-bg);
    color: var(--color-ink);
}

/* --- Left drawer ("Math Tutor") : clean surface rail, no glass ----------- */
.glass-sidebar {
    background: var(--color-surface);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    border-right: 1px solid var(--color-border);
    box-shadow: var(--shadow-sm);
}
.sidebar-header { border-bottom: 1px solid var(--color-border); }
.sidebar-header h3 {
    color: var(--color-ink);
    font-weight: var(--weight-bold);
    letter-spacing: var(--tracking-tight);
}
.close-btn, .sidebar-toggle-btn { color: var(--color-muted); }
.close-btn:hover, .sidebar-toggle-btn:hover { color: var(--color-accent); }
.sidebar-toggle-btn {
    background: var(--color-surface);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}
.sidebar-toggle-btn:hover { background: var(--color-surface-2); transform: translateY(-1px); }

/* Category + chapter menu */
.menu-btn {
    background: var(--color-surface-2);
    color: var(--color-ink);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-weight: var(--weight-semibold);
    box-shadow: none;
    transition: var(--transition-base);
}
.menu-btn:hover { background: var(--color-surface); color: var(--color-accent); border-color: var(--color-accent); transform: none; box-shadow: none; }
.menu-btn:active { transform: translateY(1px); box-shadow: none; }
.menu-btn.active { background: var(--color-accent); color: #fff; border-color: var(--color-accent); box-shadow: var(--btn-inset); }
.dropdown-content { background: transparent; }
.chapter-item { color: var(--color-ink-2); border-left: 3px solid transparent; border-radius: var(--radius-sm); }
.chapter-item:hover { color: var(--color-accent); background: var(--color-surface-2); }
.chapter-item.active { color: var(--color-accent-active); font-weight: var(--weight-semibold); border-left-color: var(--color-accent); background: var(--color-accent-soft); }

/* --- Top bar : solid deep-slate header (matches the rest of the site) ---- */
.main-navbar {
    background: var(--color-header);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    box-shadow: var(--shadow-sm);
}
.nav-brand { color: #fff; }
.nav-links a { color: var(--color-on-dark-muted); font-weight: var(--weight-medium); }
.nav-links a:hover, .nav-links a.active { color: #fff; }
.nav-links a.active { color: var(--emerald-500); }
.nav-links a::after { background-color: var(--color-accent); }
.nav-user { color: var(--color-on-dark-muted); }
.nav-user:hover { color: var(--emerald-500); }

/* --- Animation stage : clean surface, not frosted glass ------------------ */
.animation-stage {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    background: var(--color-surface);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    box-shadow: var(--shadow-sm);
}
.placeholder-content h1 { color: var(--color-ink); letter-spacing: var(--tracking-tight); }
.placeholder-content p { color: var(--color-ink-2); }

/* --- Footer tools -------------------------------------------------------- */
.sidebar-footer { border-top: 1px solid var(--color-border); }
.tool-btn {
    background: var(--color-surface-2);
    color: var(--color-ink-2);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: none;
    transition: var(--transition-base);
}
.tool-btn:hover { color: var(--color-accent); border-color: var(--color-accent); background: var(--color-surface); transform: translateY(-1px); box-shadow: none; }
.tool-btn:active { transform: translateY(1px); box-shadow: none; }

/* --- Loader + chapter headings ------------------------------------------- */
.chapter-content-title, .chapter-title { color: var(--color-ink); }
.loader-circle { border: 5px solid var(--color-accent-soft); border-top: 5px solid var(--color-accent); }

/* --- Chapter 1 (Real Number) + shared controls --------------------------- */
.real-number-container {
    background: var(--color-surface);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
}
.input-section {
    background: var(--color-surface-2);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: none;
}
.input-section input {
    background: var(--color-surface);
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-md);
    box-shadow: none;
}
.input-section input:focus { background: var(--color-surface); box-shadow: var(--focus-ring); }

.btn-primary, .btn-secondary {
    border-radius: var(--radius-md);
    font-family: var(--font-sans);
    letter-spacing: 0;
    transition: transform var(--dur-fast) var(--ease-spring), background-color var(--dur) var(--ease-standard), box-shadow var(--dur) var(--ease-standard);
}
.btn-primary {
    background: var(--color-accent); color: #fff; box-shadow: var(--btn-inset);
}
.btn-primary:hover { background: var(--color-accent-hover); transform: translateY(-1px); box-shadow: var(--btn-inset), var(--shadow-accent-hover); }
.btn-primary:active { transform: translateY(1px) scale(0.98); box-shadow: inset 0 2px 4px rgba(0,0,0,0.18); }
.btn-secondary {
    background: var(--color-surface); color: var(--color-ink);
    border: 1px solid var(--color-border-strong); box-shadow: var(--btn-inset-light);
}
.btn-secondary:hover { background: var(--color-surface-2); border-color: var(--color-accent); opacity: 1; transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.btn-secondary:active { transform: translateY(1px) scale(0.98); box-shadow: none; }

.svg-wrapper { border: 1px solid var(--color-border); box-shadow: none; }
.tick-label { font-family: var(--font-sans); fill: var(--color-muted); }

/* --- Chapter 2 (Sets / Venn) --------------------------------------------- */
.sets-container {
    background: var(--color-surface);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
}
.venn-wrapper {
    background: var(--color-surface-2);
    border: 1px solid var(--color-border);
    box-shadow: none;
}
.number-bank-container {
    background: var(--color-surface-2);
    border: 1px solid var(--color-border);
    box-shadow: none;
}
.number-bank-title { color: var(--color-accent-active); }
.draggable-number {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    color: var(--color-ink);
}
.draggable-number:hover { border-color: var(--color-accent); box-shadow: var(--shadow-pop); }
.draggable-number.success { background: var(--color-accent); border-color: var(--color-accent); color: #fff; box-shadow: var(--shadow-sm); }
.draggable-number.error { background: var(--color-danger); border-color: var(--color-danger); color: #fff; }
.set-def { background: var(--color-surface); border: 1px solid var(--color-border); box-shadow: none; }

/* --- Mobile: sidebar becomes an overlay drawer (auto-hidden by JS); the
       top navbar scrolls horizontally; the stage gets the full width. ------ */
@media (max-width: 900px) {
    .main-container,
    .main-container.full-width { margin-left: 0; }
    .glass-sidebar {
        width: min(85vw, 320px);
        box-shadow: var(--shadow-lg);
        z-index: 1200;
    }
    .sidebar-toggle-btn { z-index: 1100; }
    .main-navbar {
        padding: 0 14px;
        height: 60px;
        gap: 10px;
    }
    .nav-brand { font-size: 1.1rem; flex-shrink: 0; }
    .nav-brand img { height: 30px !important; }
    .nav-links {
        gap: 14px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        white-space: nowrap;
        flex: 1;
        min-width: 0;
    }
    .nav-links::-webkit-scrollbar { display: none; }
    .nav-links a { font-size: 0.85rem; }
    .animation-stage {
        margin: 6px;
        width: calc(100% - 12px);
        padding: 10px;
        overflow: auto;                 /* let tall chapter content scroll */
        -webkit-overflow-scrolling: touch;
        align-items: flex-start;
    }
}

/* --- Global safety lever: no frosted glass anywhere inside the stage.
       Chapters self-inject their CSS after load, so !important guarantees the
       blur is gone even for a chapter not yet individually de-slopped. ------ */
#animation-stage, #animation-stage * {
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
}
/* SVG text in chapter diagrams → brand typeface (was Poppins) */
#animation-stage text { font-family: var(--font-sans); }


