/* ===========================
   IPM Learning App - Clean Design
   =========================== */

/* CSS Variables */
:root {
    --bg: #f8f9fa;
    --bg-card: #ffffff;
    --text: #1a1a1a;
    --text-muted: #666666;
    --accent: #ffb300;
    --accent-light: #fff8e1;
    --accent-dark: #f57f17;
    --border: #e0e0e0;
    --success: #2e7d32;
    --error: #c62828;
    --highlight: #fffde7;
    --shadow: rgba(0, 0, 0, 0.08);

    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;

    --radius-sm: 2px;
    --radius-md: 4px;
    --radius-lg: 4px;
}

/* Base Reset */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    font-size: 17px;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    min-height: 100vh;
    overflow-x: hidden;
    width: 100%;
}

/* ===========================
   Navigation Bar - Clean White
   =========================== */
.nav-bar {
    position: sticky !important;
    top: 0 !important;
    z-index: 100 !important;
    background: white !important;
    border-bottom: 1px solid var(--border);
    padding: var(--space-sm) var(--space-md);
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
    visibility: visible !important;
    opacity: 1 !important;
}


.nav-logo {
    font-family: 'Inter', sans-serif;
    font-size: 22px;
    font-weight: 800;
    color: var(--accent);
    letter-spacing: -1px;
    flex-shrink: 0;
}

.nav-center {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    justify-content: center;
    flex: 1;
}

@media (max-width: 600px) {
    .nav-bar {
        padding: 8px 12px !important;
    }

    .nav-logo {
        font-size: 18px;
        /* Slightly smaller but visible */
        display: block !important;
    }

    .nav-center {
        /* Hide text buttons on mobile if mostly relying on bottom nav, 
           but user said "make its size bigger". 
           Let's keep them but make them compact or scrollable.
           Actually user said "Top make it same way it was before... IBM left... reset OK"
        */
        flex: 1;
        justify-content: center;
        gap: 4px;
        /* Tighten gap */
    }

    /* Make the middle buttons specific */
    .nav-btn {
        padding: 6px 10px;
        font-size: 13px;
        /* Standard readable size */
    }

    #header-reset-btn {
        display: flex !important;
        padding: 4px;
    }
}

.nav-btn {
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 600;
    padding: 10px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-btn svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
}

.nav-btn:hover {
    background: var(--accent-light);
    color: var(--accent-dark);
}

.nav-btn.active {
    background: var(--accent);
    color: #000;
    font-weight: 700;
}

.icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: var(--space-sm);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.icon-btn:hover {
    background: var(--accent-light);
    color: var(--accent-dark);
}

/* ===========================
   Unit Containers - CRITICAL FIX
   =========================== */
.unit-container {
    display: none !important;
}

.unit-container.active {
    display: block !important;
    padding: var(--space-md);
    max-width: 700px;
    margin: 0 auto;
    width: 100%;
    min-height: 100px;
}

/* ===========================
   Topic Filter with Ping-Pong Scroll
   =========================== */
.filter-scroll-wrapper {
    position: relative;
    margin-bottom: var(--space-md);
    margin-left: -8px;
    margin-right: -8px;
    width: calc(100% + 16px);
    padding-left: 8px;
}

/* Faded edges gradient - softer fade */
.filter-scroll-wrapper::before,
.filter-scroll-wrapper::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 20px;
    pointer-events: none;
    z-index: 2;
}

.filter-scroll-wrapper::before {
    left: 0;
    background: linear-gradient(to right, rgba(248, 249, 250, 0.9) 0%, transparent 100%);
}

.filter-scroll-wrapper::after {
    right: 0;
    background: linear-gradient(to left, rgba(248, 249, 250, 0.9) 0%, transparent 100%);
}

/* Arrow indicators */
.filter-scroll-wrapper .scroll-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
    color: #999;
    z-index: 3;
    pointer-events: none;
}

.filter-scroll-wrapper .scroll-arrow.left {
    left: 8px;
}

.filter-scroll-wrapper .scroll-arrow.right {
    right: 8px;
}

.filter-scroll {
    display: flex;
    gap: var(--space-sm);
    overflow-x: auto;
    padding: var(--space-sm) var(--space-xl);
    padding-bottom: 12px;
    -webkit-overflow-scrolling: touch;
}

/* Tiny ping-pong paddle scrollbar */
.filter-scroll::-webkit-scrollbar {
    height: 6px;
}

.filter-scroll::-webkit-scrollbar-track {
    background: #eee;
    border-radius: 0;
    margin: 0 40px;
}

.filter-scroll::-webkit-scrollbar-thumb {
    background: #ffe082;
    border-radius: 0;
    min-width: 40px;
}

.filter-scroll::-webkit-scrollbar-thumb:hover {
    background: #ffd54f;
}



.topic-chip {
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    font-weight: 500;
    padding: 8px 14px;
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.15s ease;
    flex-shrink: 0;
    min-height: 34px;
}

.topic-chip:hover {
    border-color: var(--accent);
    color: var(--text);
}

.topic-chip.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #000;
    font-weight: 600;
}

/* ===========================
   Problem Card
   =========================== */
.card-container {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-lg) 0;
    min-height: 300px;
}

.problem-card {
    width: 100%;
    max-width: 500px;
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: 0 4px 12px var(--shadow);
    padding: var(--space-lg);
}

.difficulty {
    display: none;
}

.topic-label {
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--accent-dark);
    margin-bottom: var(--space-md);
}

.problem-text {
    font-size: 18px;
    line-height: 1.6;
    color: var(--text);
    margin-bottom: var(--space-md);
}

.sim-interpretation {
    background: #f0f7ff;
    padding: var(--space-md);
    border-radius: var(--radius-sm);
    margin-top: var(--space-md);
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-color);
    border-left: 4px solid var(--accent);
}

.sim-briefing {
    background: #fdfdfd;
    padding: var(--space-sm) var(--space-md);
    border-top: 1px solid #eee;
    color: #666;
    font-size: 13px;
    margin-top: 12px;
}

/* --- FIXED CONTROLS --- */
.fixed-controls {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    padding: var(--space-md);
    padding-bottom: max(var(--space-md), env(safe-area-inset-bottom));
    border-top: 1px solid var(--border);
    z-index: 50;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.05);
}

.tap-hint-container {
    text-align: center;
    margin-bottom: 12px;
}

.tap-hint {
    font-size: 11px;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 500;
}

.button-row {
    display: flex;
    gap: 12px;
}

.control-btn {
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
    border-radius: var(--radius-sm);
    /* iOS style rounded rect */
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.big-btn {
    flex: 3;
    /* Takes up most space */
    background: var(--accent);
    color: white;
    font-size: 16px;
    padding: 14px;
    box-shadow: 0 4px 6px rgba(255, 179, 0, 0.2);
}

.big-btn:active {
    transform: scale(0.97);
}

.small-btn {
    flex: 1;
    /* Smaller share */
    background: #f0f0f0;
    color: #444;
    font-size: 14px;
}

.small-btn:active {
    background: #e0e0e0;
}

/* Add padding to container so content doesn't get hidden behind fixed footer */
.unit-container.active {
    padding-bottom: 120px !important;
}

.card-footer {
    text-align: center;
    padding-top: var(--space-md);
    border-top: 1px solid var(--border);
}

.hint-text {
    gap: 10px;
}

.control-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    /* Pillow shape */
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    border: none;
    transition: transform 0.1s ease, background 0.2s;
    min-width: 100px;
    /* Ensure decent touch target */
}

.control-btn.primary {
    background: var(--accent);
    color: white;
    box-shadow: 0 4px 6px rgba(255, 179, 0, 0.3);
}

.control-btn.primary:active {
    transform: scale(0.95);
    background: var(--accent-dark);
}

.control-btn.secondary {
    background: white;
    border: 1px solid #ddd;
    color: var(--text-muted);
}

.control-btn.secondary:active {
    background: #f0f0f0;
}

.tap-hint {
    font-size: 12px;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

/* Control Bar */
.control-bar {
    display: flex;
    justify-content: center;
    padding: var(--space-md) 0;
}

#next-problem-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-xl);
    background: var(--accent);
    color: #000;
    border: none;
    border-radius: var(--radius-sm);
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
}

#next-problem-btn:hover {
    /* No color change */
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 179, 0, 0.3);
}

/* ===========================
   Solution Overlay (for click-outside-close)
   =========================== */
.solution-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 150;
}

.solution-overlay.open {
    display: block;
}

/* ===========================
   Solution Panel
   =========================== */
.solution-panel {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%) translateY(100%);
    width: 100%;
    max-width: 600px;
    background: white;
    border-top: 2px solid var(--accent);
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    box-shadow: 0 -4px 20px var(--shadow);
    transition: transform 0.3s ease;
    max-height: 70vh;
    overflow-y: auto;
    z-index: 200;
}

.solution-panel.open {
    transform: translateX(-50%) translateY(0);
}

.solution-header {
    position: sticky;
    top: 0;
    background: var(--accent);
    color: #000;
    padding: var(--space-md);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 14px;
}

.close-btn {
    background: none;
    border: none;
    color: #000;
    font-size: 24px;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Fancy Question Display in Solution Panel */
.solution-q-fancy {
    text-align: left;
    /* Better for long text */
    color: #444;
    font-size: 16px;
    font-weight: 500;
    line-height: 1.6;
    padding: 24px 24px;
    margin: 0 0 24px 0;
    background: #f8f9fa;
    border-top: 1px solid #e0e0e0;
    border-bottom: 2px solid #e0e0e0;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8) inset,
        0 -1px 0 rgba(0, 0, 0, 0.05) inset;
}

.solution-q-fancy p {
    margin: 0;
    padding: 0;
}

.solution-q-fancy strong,
.solution-q-fancy b {
    color: #555;
    font-weight: 600;
}

/* Mobile optimization for solution question */
@media (max-width: 600px) {
    .solution-q-fancy {
        font-size: 15px;
        padding: 20px 20px;
        margin-bottom: 24px;
    }
}

.solution-steps {
    padding: var(--space-lg);
}

.step {
    background: var(--bg);
    border-left: 3px solid var(--accent);
    padding: var(--space-md);
    margin-bottom: var(--space-md);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.step-number {
    font-family: 'Inter', sans-serif;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--accent-dark);
    margin-bottom: var(--space-xs);
}

.step-equation {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 15px;
    margin: var(--space-sm) 0;
}

.step-explain {
    font-size: 14px;
    color: var(--text-muted);
}

.interpretation {
    background: var(--highlight);
    border: 2px solid var(--accent);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    margin-top: var(--space-lg);
}

/* ===========================
   Theory Unit
   =========================== */
.theory-header h2,
.equations-header h2,
.simulator-header h2 {
    font-family: 'Inter', sans-serif;
    font-size: 20px;
    font-weight: 700;
    margin-bottom: var(--space-lg);
    color: var(--text);
}

.theory-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    margin-bottom: var(--space-md);
}

.theory-card h3 {
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    font-weight: 600;
    color: var(--accent-dark);
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-sm);
    border-bottom: 1px solid var(--border);
}

.theory-content {
    font-family: 'Merriweather', Georgia, serif;
    font-size: 15px;
    line-height: 1.7;
    color: var(--text);
}

.theory-content p {
    margin-bottom: var(--space-md);
}

/* ===========================
   Equations Unit
   =========================== */
.equation-section {
    margin-bottom: var(--space-md);
}

.section-header {
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 600;
    padding: var(--space-md);
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.15s;
}

.section-header:hover {
    background: var(--accent-light);
}

.section-header .arrow {
    transition: transform 0.2s;
}

.section-header.open .arrow {
    transform: rotate(180deg);
}

.section-content {
    display: none;
    padding-top: var(--space-md);
}

.section-content.open {
    display: block;
}

.equation-box {
    background: white;
    border-left: 4px solid var(--accent);
    padding: var(--space-md);
    margin: var(--space-sm) 0;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.equation-label {
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    font-weight: 600;
    color: var(--accent-dark);
    margin-bottom: var(--space-xs);
}

.equation {
    font-family: 'Roboto Mono', monospace;
    font-size: 15px;
    padding: var(--space-sm) 0;
    overflow-x: auto;
}

/* --- Practice Controls (Settings) --- */
.practice-controls {
    padding: 0 1rem 0.5rem 1rem;
    display: flex;
    justify-content: flex-start;
    position: relative;
    z-index: 90;
}

.settings-trigger {
    background: none;
    border: none;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 6px;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.settings-trigger:hover {
    background: var(--surface-hover);
    color: var(--text);
    border-color: var(--border);
}

.settings-popover {
    display: none;
    position: absolute;
    top: 36px;
    left: 1rem;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    z-index: 150;
    min-width: 180px;
    animation: popIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.settings-popover.open {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

@keyframes popIn {
    from {
        opacity: 0;
        transform: translateY(-8px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.popover-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-tertiary);
    letter-spacing: 1px;
    margin-bottom: 4px;
    font-weight: 600;
}

.setting-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.95rem;
    cursor: pointer;
    color: var(--text);
    padding: 4px 0;
}

.setting-row input[type="checkbox"] {
    accent-color: var(--primary);
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* Equation Explain Styles */
.equation-explain {
    margin-top: 1rem;
    color: var(--text-muted);
}

/* ===========================
   Simulator Unit
   =========================== */
.sim-grid {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

.simulator-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    padding: var(--space-lg);
    box-shadow: 0 2px 8px var(--shadow);
    display: none;
    /* Hidden by default */
}

.simulator-card.active {
    display: block !important;
    /* Force visible */
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}
}

.simulator-title {
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 16px;
    color: var(--accent-dark);
    margin-bottom: var(--space-md);
    text-align: center;
}

.simulator-canvas {
    width: 100%;
    height: 250px;
    background: #fafafa;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.simulator-controls {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-lg);
    justify-content: center;
    margin-top: var(--space-lg);
    padding: var(--space-md);
    background: var(--bg);
    border-radius: var(--radius-sm);
}

.control-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-xs);
    min-width: 100px;
}

.control-label {
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
    text-align: center;
}

.control-slider {
    width: 100%;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--border);
    border-radius: 3px;
}

/* --- Simulator Controls & Tables --- */
.chart-container {
    position: relative;
    width: 100%;
    height: 300px;
    /* Fixed height for consistency */
    margin-bottom: 20px;
}

.simulator-card canvas {
    /* Chart.js handles responsive sizing, but needs block display */
    display: block;
    width: 100%;
    height: 100%;
}

.sim-controls {
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 12px;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.control-group label {
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    justify-content: space-between;
    color: #444;
}

.control-group span {
    color: var(--accent-dark);
    font-weight: 700;
    font-family: 'Source Serif 4', serif;
}

input[type=range] {
    width: 100%;
    accent-color: var(--accent);
}

.sim-interpretation {
    margin-top: 15px;
    padding: 12px;
    background: #fff8e1;
    /* Light yellow tint */
    border-left: 4px solid var(--accent);
    font-size: 0.95rem;
    line-height: 1.5;
    border-radius: 4px;
    color: #444;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 2px;
}

/* ===========================
   Mobile Bottom Navigation
   =========================== */
.mobile-bottom-nav {
    display: none !important;
}

/* ===========================
   Responsive
   =========================== */
@media (max-width: 768px) {

    /* --- Existing Mobile Tweaks --- */
    .problem-card {
        padding: var(--space-md);
    }

    .simulator-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .control-group {
        min-width: 100%;
    }

    /* Mobile Swipe Indicators */
    .swipe-indicators {
        display: none;
    }

    @media (max-width: 600px) {
        .swipe-indicators {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
            padding: 8px 0;
            color: #999;
            font-size: 11px;
            opacity: 0.4;
        }

        .swipe-arrow {
            color: #999;
            opacity: 0.5;
            animation: pulse-swipe 2s ease-in-out infinite;
        }

        .swipe-text {
            font-style: italic;
        }

        .swipe-arrow.swipe-right {
            animation-delay: 0.3s;
        }

        @keyframes pulse-swipe {

            0%,
            100% {
                opacity: 0.3;
                transform: translateX(0);
            }

            50% {
                opacity: 0.7;
                transform: translateX(3px);
            }
        }
    }

    /* --- Mobile Navigation --- */

    /* SHOW Top Nav on Mobile */
    .nav-center {
        display: flex !important;
        flex: 1;
        justify-content: center;
        gap: 4px;
    }

    .nav-btn {
        font-size: 11px !important;
        padding: 6px 8px !important;
    }

    /* Adjust Main Container */
    main.app-container {
        padding-bottom: 20px;
    }

    /* Top Bar Cleanup */
    .nav-bar {
        padding: 8px 12px;
        justify-content: space-between;
        display: flex !important;
    }

    /* Fixed Bottom Nav - HIDDEN */
    .mobile-bottom-nav {
        display: none !important;
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 64px;
        background: rgba(255, 255, 255, 0.96);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        border-top: 1px solid var(--border);
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.04);
        z-index: 1000;
        justify-content: space-around;
        align-items: center;
        padding-bottom: env(safe-area-inset-bottom);
        box-sizing: content-box;
    }

    /* Bottom Nav Buttons */
    .mobile-bottom-nav .nav-btn {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 4px;
        height: 100%;
        background: transparent !important;
        border: none;
        color: var(--text-muted);
        font-family: 'Inter', sans-serif;
        font-size: 10px;
        font-weight: 500;
        padding: 4px 0;
        border-radius: 0;
        margin: 0;
        cursor: pointer;
    }

    .mobile-bottom-nav .nav-btn svg {
        width: 24px;
        height: 24px;
        color: var(--text-muted);
        transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
        stroke-width: 2px;
    }

    /* Active State */
    .mobile-bottom-nav .nav-btn.active {
        color: var(--accent-dark);
        font-weight: 600;
    }

    .mobile-bottom-nav .nav-btn.active svg {
        color: var(--accent);
        transform: translateY(-2px);
        stroke-width: 2.5px;
    }
}

/* ===========================
   DROPDOWN SELECTOR (Simulators & Calculators)
   =========================== */
.dropdown-selector-wrapper {
    display: flex;
    justify-content: center;
    margin-bottom: var(--space-lg);
    position: relative;
}

.dropdown-selector-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: white;
    border: 2px solid var(--accent);
    border-radius: var(--radius-sm);
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(255, 179, 0, 0.15);
}

.dropdown-selector-btn:hover {
    background: var(--accent-light);
}

.dropdown-selector-btn svg {
    transition: transform 0.2s ease;
}

.dropdown-selector-btn.open svg {
    transform: rotate(180deg);
}

.dropdown-popup {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    z-index: 200;
    min-width: 260px;
    max-width: 90vw;
    padding: 8px 0;
    animation: dropIn 0.2s ease;
}

.dropdown-popup.open {
    display: block;
}

@keyframes dropIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-8px);
    }

    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.dropdown-item {
    padding: 12px 20px;
    font-size: 14px;
    color: var(--text);
    cursor: pointer;
    transition: background 0.15s ease;
}

.dropdown-item:hover {
    background: var(--accent-light);
}

.dropdown-item.active {
    background: var(--accent);
    color: #000;
    font-weight: 600;
}

/* Dropdown overlay to close on outside click */
.dropdown-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 150;
}

.dropdown-overlay.open {
    display: block;
}

/* ===========================
   CALCULATOR UNIT STYLES
   =========================== */
#calculator-container {
    max-width: 500px;
    margin: 0 auto;
}

.calculator-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: 0 4px 12px var(--shadow);
    padding: var(--space-lg);
    display: none;
}

.calculator-card.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

.calc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-sm);
    border-bottom: 1px solid var(--border);
}

.calc-header h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--accent-dark);
    margin: 0;
}

.calc-reset-btn {
    background: var(--success);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: background 0.15s ease;
}

.calc-reset-btn:hover {
    background: #1b5e20;
}

.calc-inputs {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.calc-input-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.calc-input-group label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
}

.calc-input-group input {
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 16px;
    font-family: 'Roboto Mono', monospace;
    transition: border-color 0.15s ease;
}

.calc-input-group input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.calc-input-row {
    display: flex;
    gap: var(--space-md);
}

.calc-input-row .calc-input-group {
    flex: 1;
}

.calc-btn {
    width: 100%;
    padding: 14px;
    background: var(--accent);
    color: #000;
    border: none;
    border-radius: var(--radius-md);
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
}

.calc-btn:hover {
    background: var(--accent-dark);
    color: white;
}

.calc-btn:active {
    transform: scale(0.98);
}

/* Step-by-step solution display */
.calc-solution {
    margin-top: var(--space-lg);
    padding: var(--space-md);
    background: var(--accent-light);
    border-radius: var(--radius-md);
    border-left: 4px solid var(--accent);
    display: none;
}

.calc-solution.show {
    display: block;
    animation: fadeIn 0.3s ease;
}

.calc-solution-title {
    font-weight: 700;
    font-size: 14px;
    color: var(--accent-dark);
    margin-bottom: var(--space-sm);
}

.calc-step {
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 179, 0, 0.2);
    font-family: 'Roboto Mono', monospace;
    font-size: 14px;
}

.calc-step:last-child {
    border-bottom: none;
}

.calc-step-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}

.calc-step-value {
    font-weight: 600;
    color: var(--text);
}

.calc-result {
    padding: var(--space-md);
    background: var(--success);
    color: white;
    border-radius: var(--radius-sm);
    margin-top: var(--space-sm);
    text-align: center;
}

.calc-result-label {
    font-size: 12px;
    opacity: 0.9;
}

.calc-result-value {
    font-size: 24px;
    font-weight: 700;
    font-family: 'Roboto Mono', monospace;
}

/* Dynamic rows for multi-input calculators */
.calc-dynamic-rows {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

.calc-row {
    display: flex;
    gap: var(--space-sm);
    align-items: center;
}

.calc-row input {
    flex: 1;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: 'Roboto Mono', monospace;
}

.calc-row-remove {
    background: var(--error);
    color: white;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    flex-shrink: 0;
}

.calc-add-row-btn {
    padding: 10px;
    background: transparent;
    border: 2px dashed var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.calc-add-row-btn:hover {
    border-color: var(--accent);
    color: var(--accent-dark);
    background: var(--accent-light);
}

/* Practice Controls alignment fix */
.practice-controls {
    display: flex;
    justify-content: flex-start;
    margin-bottom: var(--space-md);
    position: relative;
    padding-left: 0;
}

/* Filter scroll wrapper - tighter left margin */
.filter-scroll-wrapper {
    margin-left: 0;
    padding-left: 0;
}

.filter-scroll {
    padding-left: var(--space-md);
}

/* Fix button row width to match card */
.fixed-controls {
    max-width: 532px;
    margin: 0 auto;
    left: 0;
    right: 0;
}

/* ===========================
   SETTINGS TOGGLE (Yellow Style)
   =========================== */
.settings-popover {
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    padding: var(--space-md);
    z-index: 100;
    min-width: 160px;
    display: none;
}

.settings-popover.open {
    display: block;
}

.popover-title {
    font-weight: 600;
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: var(--space-sm);
}

.setting-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    cursor: pointer;
    font-size: 14px;
}

.setting-row input[type="checkbox"] {
    display: none;
}

.setting-row span {
    padding: 6px 12px;
    border-radius: 20px;
    background: #f0f0f0;
    color: var(--text-muted);
    font-weight: 500;
    transition: all 0.15s ease;
}

.setting-row input[type="checkbox"]:checked+span {
    background: var(--accent);
    color: #000;
}

/* Settings trigger button */
.settings-trigger {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s ease;
}

.settings-trigger:hover {
    border-color: var(--accent);
    color: var(--text);
}

/* ===========================
   ABOUT MODAL
   =========================== */
.about-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    justify-content: center;
    align-items: center;
}

.about-modal-overlay.open {
    display: flex;
}

.about-modal {
    background: white;
    border-radius: var(--radius-md);
    max-width: 340px;
    width: 90%;
    padding: var(--space-xl);
    position: relative;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.about-close-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    background: none;
    border: none;
    font-size: 24px;
    color: #999;
    cursor: pointer;
    line-height: 1;
}

.about-close-btn:hover {
    color: #333;
}

.about-content {
    text-align: center;
    margin-bottom: var(--space-lg);
}

.about-text {
    font-family: 'Georgia', serif;
    font-size: 14px;
    color: #666;
    line-height: 1.6;
    margin-bottom: 8px;
}

.about-year {
    font-family: 'Georgia', serif;
    font-size: 12px;
    color: #999;
    margin-top: 4px;
    margin-bottom: 0;
}

.about-reset-section {
    border-top: 1px solid var(--border);
    padding-top: var(--space-md);
    text-align: center;
}

.about-reset-btn {
    background: var(--error);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    padding: 10px 24px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.15s ease;
}

.about-reset-btn:hover {
    background: #c0392b;
}

.about-reset-hint {
    font-size: 11px;
    color: #999;
    margin-top: 8px;
}

.about-heading {
    color: var(--accent);
    font-size: 18px;
    font-weight: 600;
    margin-bottom: var(--space-md);
    font-family: 'Inter', sans-serif;
}

.about-divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: var(--space-sm) 0;
}

.about-divider.thick {
    border-top: 2px solid #bbb;
    margin-top: var(--space-md);
}

.about-orchestrated {
    font-family: 'Roboto Mono', 'Courier New', monospace;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 3px;
    color: #888;
    margin-top: var(--space-lg);
    margin-bottom: 4px;
}