:root {
    /* Color Palette - Bright Academia & Premium Gradient */
    --bg-light: #f8fafc;
    /* Slate 50 */
    --bg-panel: rgba(255, 255, 255, 0.65);
    --bg-glass: rgba(255, 255, 255, 0.75);
    --border-glass: rgba(0, 0, 0, 0.06);

    --primary: #0ea5e9;
    /* Sky 500 - Vivid Blue */
    --secondary: #8b5cf6;
    /* Violet 500 - Noble Purple */
    --accent: #ec4899;
    /* Pink 500 - Energetic Pink */

    --success: #10b981;
    /* Emerald 500 */
    --error: #ef4444;
    /* Red 500 */

    --text-main: #0f172a;
    /* Slate 900 - Deep dark blue-black for high contrast */
    --text-muted: #64748b;
    /* Slate 500 */
    --text-inverse: #ffffff;
    /* For buttons */

    /* Typography */
    --font-ui: 'Inter', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    --font-math: 'KaTeX_Main', 'Times New Roman', serif;

    /* Spacing & Radius */
    --radius-lg: 20px;
    --radius-md: 12px;
    --radius-sm: 8px;

    /* Shadows - Soft & Premium */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.025);
    --shadow-glow: 0 0 20px rgba(14, 165, 233, 0.2);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-light);
    background-image:
        radial-gradient(circle at 0% 0%, rgba(14, 165, 233, 0.08) 0%, transparent 40%),
        radial-gradient(circle at 100% 100%, rgba(139, 92, 246, 0.08) 0%, transparent 40%);
    color: var(--text-main);
    font-family: var(--font-ui);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Layout */
#app {
    display: grid;
    grid-template-columns: 280px 1fr;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar */
#sidebar {
    background: var(--bg-glass);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-right: 1px solid var(--border-glass);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    overflow-y: auto;
    box-shadow: var(--shadow-sm);
    z-index: 10;
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.05em;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-glass);
}

.nav-group h3 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    font-weight: 700;
    margin-bottom: 1rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
}

.nav-item:hover {
    background: rgba(14, 165, 233, 0.08);
    /* Primary color low opacity */
    color: var(--primary);
}

.nav-item.active {
    background: white;
    color: var(--text-main);
    box-shadow: var(--shadow-md);
    border-left: none;
    /* Removed the left border for a cleaner card look */
}

/* Sub Navigation */
.sub-nav-list {
    margin-left: 2.5rem;
    padding-left: 0.5rem;
    border-left: 1px solid var(--border-glass);
    margin-top: -0.5rem;
    margin-bottom: 1rem;
}

.sub-nav-item {
    font-size: 0.8rem;
    padding: 0.4rem 0.75rem;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.sub-nav-item:hover {
    color: var(--primary);
    background: rgba(14, 165, 233, 0.05);
}

/* Main Content */
#content {
    padding: 3rem;
    overflow-y: auto;
    scroll-behavior: smooth;
    background: linear-gradient(to bottom right, transparent, rgba(255, 255, 255, 0.5));
}

.content-body {
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.hero-section {
    max-width: 800px;
    animation: fadeIn 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

h1 {
    font-size: 3.5rem;
    font-weight: 800;
    margin-bottom: 1rem;
    line-height: 1.1;
    letter-spacing: -0.03em;
    color: var(--text-main);
}

.subtitle {
    font-size: 1.25rem;
    color: var(--text-muted);
    font-weight: 400;
    max-width: 600px;
    margin-bottom: 2rem;
}

/* Glass Panels with cleaner look */
.glass-panel {
    background: var(--bg-panel);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: 2rem;
    margin-top: 2rem;
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border: none;
    padding: 1rem 2.5rem;
    border-radius: var(--radius-md);
    color: var(--text-inverse);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1rem;
    box-shadow: 0 4px 6px -1px rgba(14, 165, 233, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(14, 165, 233, 0.4);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Math Block - Enhanced Visibility */
.math-block {
    font-size: 1.35rem;
    /* Increased from 1.15rem */
    padding: 2rem;
    background: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    margin: 1.5rem 0;
    border: 1px solid var(--border-glass);
    color: var(--text-main);
    overflow-x: auto;
}

/* Problem Cards */
.problem-card {
    background: white;
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: 2rem;
    margin-top: 1.5rem;
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
}

.problem-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.problem-card.solved {
    border-color: var(--success);
    background: rgba(16, 185, 129, 0.03);
}

.problem-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e2e8f0;
}

.badge {
    padding: 0.35rem 0.85rem;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.badge-diff-1 {
    background: #dcfce7;
    color: #15803d;
}

/* Green */
.badge-diff-2 {
    background: #e0f2fe;
    color: #0369a1;
}

/* Blue */
.badge-diff-3 {
    background: #fef9c3;
    color: #a16207;
}

/* Yellow */
.badge-diff-4 {
    background: #fee2e2;
    color: #b91c1c;
}

/* Red */

.options-grid {
    display: grid;
    grid-template-columns: 1fr;
    /* Stack on mobile, grid on desktop handled in media query if needed but 1fr looks clean for text options */
    gap: 0.75rem;
    margin-top: 1.5rem;
}

@media (min-width: 768px) {
    .options-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.option-btn {
    background: #f1f5f9;
    /* Slate 100 */
    border: 1px solid transparent;
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    color: var(--text-main);
    cursor: pointer;
    text-align: left;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 500;
}

.option-btn:hover {
    background: #e2e8f0;
    /* Slate 200 */
}

.option-btn.correct {
    background: #dcfce7;
    border-color: var(--success);
    color: #14532d;
}

.option-btn.wrong {
    background: #fee2e2;
    border-color: var(--error);
    color: #7f1d1d;
}

.short-answer-box {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.short-answer-box input {
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    color: var(--text-main);
    padding: 0.85rem 1rem;
    border-radius: var(--radius-md);
    flex: 1;
    font-size: 1rem;
    font-family: var(--font-mono);
    transition: border-color 0.2s;
}

.short-answer-box input:focus {
    outline: none;
    border-color: var(--primary);
}

.btn-check {
    background: var(--text-main);
    color: white;
    border: none;
    padding: 0 2rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-check:hover {
    background: #334155;
    /* Slate 700 */
    box-shadow: var(--shadow-md);
}

.explanation {
    margin-top: 1.5rem;
    padding: 1.5rem;
    background: #ecfdf5;
    /* Emerald 50 */
    border-radius: var(--radius-md);
    border: 1px solid #a7f3d0;
    color: #064e3b;
    animation: fadeIn 0.3s ease-out;
}

.hidden {
    display: none !important;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    /* Slate 300 */
    border-radius: 5px;
    border: 2px solid var(--bg-light);
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
    /* Slate 400 */
}