/*
 * DerivativeCalculus.com — Homepage Consolidated Styles
 * Derived from index.html (10 standalone style blocks; the 2 blocks embedded
 * in the buildPrintDocument JS template were excluded) + CalcMentor style.css (v3.1 base)
 * Order matters: homepage rules first, CalcMentor base LAST so shared selectors match CalcMentor.
 */

/* ==== Homepage style block 1 ==== */
* {
            margin: 0;
            padding: 0;
            box-sizing: border-box
        }

        :root {
            --primary: #0891b2;
            --secondary: #14b8a6;
            --accent: #06b6d4;
            --success: #10b981;
            --danger: #ef4444;
            --warning: #f59e0b;
            --dark: #0f172a;
            --light: #f8fafc;
            --border: #e2e8f0;
            --text: #0f172a;
            --text-light: #64748b
        }

        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
            line-height: 1.6;
            color: var(--text);
            background: linear-gradient(135deg, #0891b2 0%, #14b8a6 100%);
            min-height: 100vh
        }

        nav {
            background: rgba(255, 255, 255, .98);
            backdrop-filter: blur(10px);
            box-shadow: 0 4px 20px rgba(0, 0, 0, .1);
            position: sticky;
            top: 0;
            z-index: 1000;
            border-bottom: 3px solid var(--secondary)
        }

        .nav-container {
            max-width: 1400px;
            margin: 0 auto;
            padding: 0 30px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            height: 80px
        }

        .logo-container {
            display: flex;
            align-items: center;
            gap: 15px;
            text-decoration: none
        }

        .logo-img {
            width: 50px;
            height: 50px;
            object-fit: contain;
            filter: drop-shadow(0 4px 8px rgba(8, 145, 178, .3))
        }

        .logo-text {
            font-size: 22px;
            font-weight: 800;
            background: linear-gradient(135deg, var(--primary), var(--secondary));
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text
        }

        .container {
            max-width: 1400px;
            margin: 0 auto;
            padding: 40px 30px
        }

        .hero {
            background: #fff;
            border-radius: 24px;
            padding: 60px 50px;
            margin-bottom: 40px;
            box-shadow: 0 25px 70px rgba(0, 0, 0, .15);
            text-align: center;
            position: relative;
            overflow: hidden
        }

        .hero::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            height: 5px;
            background: linear-gradient(90deg, var(--primary), var(--secondary), var(--accent))
        }

        h1 {
            font-size: 52px;
            margin-bottom: 20px;
            background: linear-gradient(135deg, var(--primary), var(--secondary));
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
            font-weight: 900;
            letter-spacing: -1px
        }

        .subtitle {
            font-size: 22px;
            color: var(--text-light);
            margin-bottom: 15px;
            font-weight: 500
        }

        .calculator-wrapper {
            background: #fff;
            border-radius: 24px;
            padding: 50px;
            box-shadow: 0 25px 70px rgba(0, 0, 0, .15);
            margin-bottom: 40px;
            border: 1px solid var(--border)
        }

        .section-title {
            font-size: 28px;
            font-weight: 800;
            color: var(--primary);
            margin-bottom: 30px;
            display: flex;
            align-items: center;
            gap: 12px
        }

        input[type="text"] {
            width: 100%;
            padding: 20px 28px;
            border: 2px solid var(--border);
            border-radius: 14px;
            font-size: 19px;
            transition: all .3s;
            font-family: 'Courier New', monospace;
            background: var(--light)
        }

        input[type="text"]:focus {
            outline: none;
            border-color: var(--primary);
            box-shadow: 0 0 0 4px rgba(8, 145, 178, .1);
            background: #fff
        }

        .btn-primary {
            padding: 22px 40px;
            background: linear-gradient(135deg, var(--primary), var(--secondary));
            color: #fff;
            border: none;
            border-radius: 14px;
            font-size: 19px;
            font-weight: 800;
            cursor: pointer;
            transition: all .3s;
            box-shadow: 0 12px 30px rgba(8, 145, 178, .35);
            text-transform: uppercase;
            letter-spacing: .5px
        }

        .btn-primary:hover {
            transform: translateY(-3px);
            box-shadow: 0 18px 40px rgba(8, 145, 178, .45)
        }

        /* Performance: add will-change to frequently animated elements */
        .btn-primary, .btn-secondary, .example-btn, .calc-card, .feature-card, .result-card, .alternate-form-item {
            will-change: transform;
        }

        .mobile-toggle {
            display: none;
            flex-direction: column;
            gap: 5px;
            cursor: pointer;
            padding: 10px;
            z-index: 1001
        }

        .mobile-toggle span {
            width: 28px;
            height: 3px;
            background: var(--primary);
            border-radius: 3px;
            transition: all .3s
        }

        @media (max-width:768px) {
            .nav-menu {
                position: fixed;
                left: 0;
                top: 80px;
                transform: translateX(-100%);
                flex-direction: column;
                background: #fff;
                width: 100%;
                padding: 30px;
                box-shadow: 0 10px 30px rgba(0, 0, 0, .2);
                transition: transform .3s cubic-bezier(0.4,0,0.2,1);
                gap: 20px;
                height: calc(100vh - 80px);
                overflow-y: auto;
                will-change: transform
            }

            .nav-menu.active {
                transform: translateX(0)
            }

            .mobile-toggle {
                display: flex
            }

            .hero,
            .calculator-wrapper {
                padding: 30px 20px
            }

            h1 {
                font-size: 36px
            }

            .subtitle {
                font-size: 18px
            }

            .container {
                padding: 20px 15px
            }
        }

        /* Fix the overlapping issue */
        .math-input-container {
            position: relative;
        }

        #enhancedFunctionInput {
            position: relative;
            z-index: 10;
            background: white;
            color: #0f172a;
        }

        /* NEW CALCULATOR STYLES */
        .calculator-container {
            background: var(--card-bg);
            border-radius: 16px;
            overflow: hidden;
        }

        .input-section {
            background: linear-gradient(to right, #f8fafc, #f1f5f9);
            padding: 30px;
            border-bottom: 2px solid var(--border);
        }

        .input-group {
            margin-bottom: 20px;
        }

        .input-label {
            display: block;
            font-weight: 600;
            margin-bottom: 8px;
            color: var(--text);
            font-size: 0.95rem;
        }

        .function-input {
            width: 100%;
            padding: 16px;
            font-size: 1.1rem;
            border: 2px solid var(--border);
            border-radius: 8px;
            font-family: 'Courier New', monospace;
            transition: all 0.3s;
            background: white;
            color: var(--text);
        }

        .function-input:focus {
            outline: none;
            border-color: var(--primary);
            box-shadow: 0 0 0 3px rgba(8, 145, 178, 0.1);
        }

        .options-row {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
            gap: 15px;
            margin-bottom: 20px;
        }

        .select-wrapper {
            position: relative;
        }

        select {
            width: 100%;
            padding: 12px;
            font-size: 1rem;
            border: 2px solid var(--border);
            border-radius: 8px;
            background: white;
            cursor: pointer;
            transition: all 0.3s;
            color: var(--text);
        }

        select:focus {
            outline: none;
            border-color: var(--primary);
        }

        .button-row {
            display: flex;
            gap: 12px;
            flex-wrap: wrap;
            margin-bottom: 20px;
        }

        .btn-secondary {
            padding: 14px 28px;
            font-size: 1rem;
            font-weight: 600;
            border: 2px solid var(--primary);
            border-radius: 8px;
            cursor: pointer;
            transition: all 0.3s;
            flex: 1;
            min-width: 150px;
            background: white;
            color: var(--primary);
        }

        .btn-secondary:hover {
            background: #f0f9ff;
            transform: translateY(-2px);
        }

        .symbol-buttons {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
            gap: 6px;
            margin-top: 15px;
        }

        .symbol-btn {
            padding: 8px 6px;
            background: white;
            border: 2px solid var(--border);
            border-radius: 6px;
            font-size: 0.82rem;
            min-width: 0;
            width: 100%;
            cursor: pointer;
            transition: all 0.2s;
            color: var(--text);
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            text-align: center;
            line-height: 1.2;
            font-weight: 600;
        }

        .symbol-btn:hover {
            background: var(--primary);
            color: white;
            border-color: var(--primary);
        }

        .examples-section {
            margin-top: 15px;
            padding: 15px;
            background: white;
            border-radius: 8px;
            border: 1px solid var(--border);
        }

        .example-buttons {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
            margin-top: 10px;
        }

        .example-btn {
            padding: 8px 16px;
            background: #f1f5f9;
            border: 1px solid var(--border);
            border-radius: 6px;
            font-size: 0.9rem;
            cursor: pointer;
            transition: all 0.2s;
            min-width: auto;
            flex: 0;
            color: var(--text);
        }

        .example-btn:hover {
            background: var(--primary);
            color: white;
        }

        .results-section {
            padding: 30px;
        }

        .result-card {
            background: white;
            border: 1px solid var(--border);
            border-radius: 12px;
            padding: 25px;
            margin-bottom: 20px;
            box-shadow: var(--shadow);
        }

        .result-card h3 {
            color: var(--primary);
            margin-bottom: 15px;
            font-size: 1.3rem;
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .math-display {
            background: #f8fafc;
            padding: 20px;
            border-radius: 8px;
            margin: 15px 0;
            overflow-x: auto;
            border-left: 4px solid var(--primary);
        }

        .step {
            background: white;
            padding: 15px;
            margin: 10px 0;
            border-radius: 8px;
            border-left: 4px solid var(--success);
            transition: all 0.3s;
        }

        .step:hover {
            box-shadow: var(--shadow);
            transform: translateX(5px);
        }

        .step-number {
            display: inline-block;
            background: var(--success);
            color: white;
            width: 30px;
            height: 30px;
            border-radius: 50%;
            text-align: center;
            line-height: 30px;
            font-weight: 600;
            margin-right: 10px;
        }

        .rule-badge {
            display: inline-block;
            background: #dbeafe;
            color: var(--primary);
            padding: 4px 12px;
            border-radius: 12px;
            font-size: 0.85rem;
            font-weight: 600;
            margin-left: 10px;
        }

        .chain-rule {
            background: #dbeafe;
            color: #1e40af;
        }

        .product-rule {
            background: #d1fae5;
            color: #065f46;
        }

        .quotient-rule {
            background: #fce7f3;
            color: #9f1239;
        }

        .power-rule {
            background: #fef3c7;
            color: #92400e;
        }

        .error-message {
            background: #fee2e2;
            color: #991b1b;
            padding: 15px;
            border-radius: 8px;
            border-left: 4px solid var(--danger);
            margin: 15px 0;
        }

        .success-message {
            background: #d1fae5;
            color: #065f46;
            padding: 15px;
            border-radius: 8px;
            border-left: 4px solid var(--success);
            margin: 15px 0;
        }

        .loading {
            text-align: center;
            padding: 40px;
        }

        .spinner {
            border: 4px solid #f3f4f6;
            border-top: 4px solid var(--primary);
            border-radius: 50%;
            width: 50px;
            height: 50px;
            animation: spin 1s linear infinite;
            margin: 0 auto;
        }

        @keyframes spin {
            0% {
                transform: rotate(0deg);
            }

            100% {
                transform: rotate(360deg);
            }
        }

        @keyframes fadeInUp {
            from { opacity: 0; transform: translateX(-50%) translateY(10px); }
            to { opacity: 1; transform: translateX(-50%) translateY(0); }
        }

        .syntax-help {
            background: #fffbeb;
            border: 1px solid #fbbf24;
            border-radius: 8px;
            padding: 15px;
            margin-top: 15px;
            font-size: 0.9rem;
        }

        .syntax-help h4 {
            color: #92400e;
            margin-bottom: 10px;
        }

        .syntax-help code {
            background: white;
            padding: 2px 6px;
            border-radius: 4px;
            font-family: 'Courier New', monospace;
        }

        #derivativeChart {
            max-width: 100%;
            height: 400px;
        }

        .properties-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
            gap: 15px;
            margin-top: 15px;
        }

        .property-item {
            background: #f8fafc;
            padding: 15px;
            border-radius: 8px;
            border: 1px solid var(--border);
        }

        .property-label {
            font-weight: 600;
            color: var(--text-light);
            font-size: 0.9rem;
            margin-bottom: 5px;
        }

        .property-value {
            font-size: 1rem;
            color: var(--text);
        }

        .alternate-forms-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
            gap: 20px;
            margin-top: 15px;
        }

        .alternate-form-item {
            background: #f8fafc;
            padding: 20px;
            border-radius: 8px;
            border: 2px solid var(--border);
            transition: all 0.3s;
        }

        .alternate-form-item:hover {
            border-color: var(--primary);
            box-shadow: var(--shadow);
            transform: translateY(-2px);
        }

        .form-label {
            font-weight: 600;
            color: var(--primary);
            margin-bottom: 12px;
            font-size: 0.95rem;
        }

        /* ── DUAL ENGINE ROW ── */
        .engine-row{display:flex;align-items:center;gap:12px;margin-bottom:22px;padding:12px 18px;background:var(--light);border-radius:12px;border:2px solid var(--border);flex-wrap:wrap;}
        .engine-label{font-size:14px;font-weight:700;color:var(--text-light);white-space:nowrap;}
        .engine-btn{padding:9px 18px;border:2px solid var(--border);background:white;border-radius:8px;cursor:pointer;font-size:13px;font-weight:700;color:var(--text);transition:.2s;}
        .engine-btn:hover{border-color:var(--primary);color:var(--primary);}
        .engine-btn.active{background:linear-gradient(135deg,var(--primary),var(--secondary));color:white;border-color:var(--primary);}
        .engine-status{font-size:12px;color:var(--text-light);display:flex;align-items:center;gap:6px;}
        .spinner-sm{width:14px;height:14px;border:2px solid #cbd5e1;border-top-color:var(--primary);border-radius:50%;animation:spin .8s linear infinite;display:inline-block;}

        /* ── VOTING & RATINGS ── */
        .voting-section{margin-top:28px;padding:24px;background:linear-gradient(135deg,#fffbeb,#fef9c3);border-radius:16px;border:2px solid #fbbf24;text-align:center;display:none;}
        .voting-section.show{display:block;}
        .voting-title{font-size:17px;font-weight:800;color:#92400e;margin-bottom:6px;}
        .voting-subtitle{font-size:13px;color:#b45309;margin-bottom:16px;}
        .stars{display:flex;justify-content:center;gap:10px;margin-bottom:10px;}
        .star{font-size:36px;color:#d1d5db;cursor:pointer;transition:color .15s,transform .15s;user-select:none;}
        .star:hover,.star.active{color:#f59e0b;transform:scale(1.2);}
        .vote-labels{display:flex;justify-content:space-between;font-size:11px;color:#92400e;font-weight:600;max-width:220px;margin:0 auto 12px;}
        .vote-thanks{font-size:14px;font-weight:700;color:#15803d;min-height:20px;}
        .ratings-dashboard{background:#fff;border-radius:20px;padding:36px;margin-bottom:40px;box-shadow:0 10px 40px rgba(0,0,0,.1);border:1px solid var(--border);}
        .ratings-dashboard h2{font-size:22px;font-weight:800;color:var(--primary);margin-bottom:8px;}
        .rd-bar-row{display:flex;align-items:center;gap:12px;margin:8px 0;}
        .rd-bar-label{font-size:14px;font-weight:700;color:var(--text);min-width:50px;text-align:right;}
        .rd-bar-track{flex:1;height:12px;background:#f1f5f9;border-radius:6px;overflow:hidden;}
        .rd-bar-fill{height:100%;background:linear-gradient(90deg,var(--primary),var(--secondary));border-radius:6px;transition:width .6s ease;}
        .rd-bar-count{font-size:13px;color:var(--text-light);min-width:30px;}
        .rd-summary{display:flex;gap:30px;align-items:center;margin-bottom:20px;flex-wrap:wrap;}
        .rd-big-score{font-size:52px;font-weight:900;color:var(--primary);line-height:1;}
        .rd-stars-row{font-size:22px;color:#f59e0b;margin-bottom:4px;}
        .rd-total{font-size:14px;color:var(--text-light);}
        .rd-recent{margin-top:20px;}
        .rd-recent h3{font-size:15px;font-weight:700;color:var(--text);margin-bottom:10px;}
        .rd-recent-item{display:flex;align-items:center;gap:10px;padding:8px 0;border-bottom:1px solid var(--border);font-size:13px;color:var(--text-light);}

        /* Print Button */
        .print-button {
            margin-top: 20px;
        }

        .btn-print {
            width: 100%;
            padding: 14px 28px;
            font-size: 1rem;
            font-weight: 600;
            border: none;
            border-radius: 8px;
            cursor: pointer;
            transition: all 0.3s;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
            background: linear-gradient(135deg, #8b5cf6, #7c3aed);
            color: white;
            box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
        }

        .btn-print:hover {
            background: linear-gradient(135deg, #7c3aed, #6d28d9);
            transform: translateY(-2px);
            box-shadow: 0 6px 16px rgba(139, 92, 246, 0.4);
        }

        /* Responsive adjustments */
        @media (max-width: 768px) {
            .options-row {
                grid-template-columns: 1fr;
            }

            .button-row {
                flex-direction: column;
            }

            .btn-primary,
            .btn-secondary {
                min-width: 100%;
            }

            .symbol-buttons {
                grid-template-columns: repeat(auto-fit, minmax(50px, 1fr));
            }

            .export-buttons {
                flex-direction: column;
            }

            .btn-export {
                min-width: 100%;
            }
        }

/* ==== Homepage style block 2 ==== */
/* nav-mobile-fix */.mobile-toggle{background:none!important;border:none!important;}

/* ==== Homepage style block 3 ==== */
.trust-module * {
                        margin: 0;
                        padding: 0;
                        box-sizing: border-box;
                    }

                    .calculator-trust-banner {
                        display: flex;
                        align-items: center;
                        justify-content: space-between;
                        flex-wrap: wrap;
                        gap: 20px;
                    }

                    .trust-badge-group {
                        display: flex;
                        align-items: center;
                        gap: 15px;
                        flex-wrap: wrap;
                    }

                    .trust-badge {
                        display: flex;
                        align-items: center;
                        gap: 8px;
                        padding: 10px 18px;
                        background: rgba(255, 255, 255, 0.15);
                        border-radius: 10px;
                        backdrop-filter: blur(10px);
                        font-size: 14px;
                        font-weight: 600;
                    }

                    .trust-badge-icon {
                        font-size: 18px;
                    }

                    .trust-accuracy {
                        text-align: right;
                    }

                    .trust-accuracy-number {
                        font-size: 32px;
                        font-weight: 900;
                        line-height: 1;
                    }

                    .trust-accuracy-label {
                        font-size: 13px;
                        opacity: 0.9;
                        font-weight: 600;
                    }

                    @media (max-width: 768px) {
                        .calculator-trust-banner {
                            flex-direction: column;
                            text-align: center;
                        }

                        .trust-accuracy {
                            text-align: center;
                        }
                    }

/* ==== Homepage style block 4 ==== */
#dc-banner {
  width: 100%;
  background: linear-gradient(135deg, #0891b2 0%, #14b8a6 100%);
  padding: 18px 20px;
  position: relative;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  contain: layout style;
}


#dc-b-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 25px;
  flex-wrap: wrap;
  padding-right: 30px;
}

#dc-b-left {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
  min-width: 220px;
}

#dc-b-icon {
  font-size: 36px;
  flex-shrink: 0;
}

#dc-b-title {
  font-size: 18px;
  font-weight: 800;
  color: white;
  margin-bottom: 4px;
}

#dc-b-sub {
  font-size: 13px;
  color: rgba(255,255,255,0.85);
}

#dc-b-sub strong { color: white; }

#dc-b-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.dc-pill {
  background: rgba(255,255,255,0.18);
  color: white;
  border-radius: 20px;
  padding: 5px 13px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

#dc-b-btns {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

#dc-b-main {
  background: white;
  color: #0891b2;
  padding: 11px 24px;
  border-radius: 8px;
  font-weight: 800;
  font-size: 14px;
  text-decoration: none;
  text-align: center;
  white-space: nowrap;
}

#dc-b-main:hover { background: #f0fdff; }

#dc-b-sec {
  background: rgba(255,255,255,0.15);
  color: white;
  padding: 9px 20px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 13px;
  text-decoration: none;
  text-align: center;
  border: 1.5px solid rgba(255,255,255,0.3);
  white-space: nowrap;
}

#dc-b-sec:hover { background: rgba(255,255,255,0.25); }

@media (max-width: 768px) {
  #dc-b-inner { gap: 15px; }
  #dc-b-pills { display: none; }
  #dc-b-btns { flex-direction: row; }
  #dc-b-title { font-size: 16px; }
}

@media (max-width: 480px) {
  #dc-b-btns { flex-direction: column; width: 100%; }
  #dc-b-main, #dc-b-sec { width: 100%; }
}

/* ==== Homepage style block 5 ==== */
.calc-tabs { display:flex; flex-wrap:wrap; gap:8px; margin-bottom:28px; }
                .calc-tab-btn {
                    padding:10px 20px; border:2px solid var(--border); background:#fff;
                    border-radius:30px; cursor:pointer; font-size:14px; font-weight:700;
                    color:var(--text-light); transition:all 0.25s; white-space:nowrap;
                }
                .calc-tab-btn:hover { border-color:var(--primary); color:var(--primary); }
                .calc-tab-btn.active {
                    background:linear-gradient(135deg,var(--primary),var(--secondary));
                    color:#fff; border-color:transparent;
                    box-shadow:0 6px 20px rgba(8,145,178,0.3);
                }
                .calc-tab-panel { display:none; }
                .calc-tab-panel.active { display:grid; grid-template-columns:repeat(auto-fill,minmax(260px,1fr)); gap:18px; }
                .calc-card-new {
                    background:#fff; border:2px solid var(--border); border-radius:16px;
                    padding:22px 24px; text-decoration:none; color:var(--text);
                    transition:all 0.3s; display:flex; flex-direction:column; gap:8px;
                    position:relative; overflow:hidden;
                }
                .calc-card-new::before {
                    content:''; position:absolute; top:0; left:0; right:0; height:4px;
                    background:linear-gradient(90deg,var(--primary),var(--secondary));
                    opacity:0; transition:opacity 0.3s;
                }
                .calc-card-new:hover { border-color:var(--primary); transform:translateY(-4px); box-shadow:0 12px 30px rgba(8,145,178,0.15); }
                .calc-card-new:hover::before { opacity:1; }
                .calc-card-icon { font-size:26px; line-height:1; }
                .calc-card-title { font-size:15px; font-weight:800; color:var(--primary); }
                .calc-card-desc { font-size:13px; color:var(--text-light); line-height:1.6; flex:1; }
                .calc-card-badge {
                    display:inline-block; font-size:10px; font-weight:700;
                    padding:2px 9px; border-radius:20px; width:fit-content;
                    background:rgba(8,145,178,0.1); color:var(--primary); border:1px solid rgba(8,145,178,0.2);
                }
                .calc-card-badge.hot { background:rgba(239,68,68,0.1); color:#ef4444; border-color:rgba(239,68,68,0.2); }
                .calc-card-badge.new { background:rgba(16,185,129,0.1); color:#10b981; border-color:rgba(16,185,129,0.2); }
                .calc-card-badge.ai { background:rgba(139,92,246,0.1); color:#8b5cf6; border-color:rgba(139,92,246,0.2); }
                @media(max-width:600px) {
                    .calc-tab-btn { padding:8px 14px; font-size:13px; }
                    .calc-tab-panel.active { grid-template-columns:1fr; }
                }

/* ==== Homepage style block 6 ==== */
block + the <div>)
  and paste it anywhere on any page of your site.

  ✅ Safe to paste inside any existing page
  ✅ Will NOT affect or disturb any other styles
  ✅ Works on mobile, tablet, and desktop
  ✅ No external libraries needed
==========================================================
-->

<!-- ① BANNER STYLES — fully isolated with unique prefix "wsgb-" -->
<style>
/* === RESET ONLY FOR BANNER ELEMENTS === */
.wsgb-wrap *, .wsgb-wrap *::before, .wsgb-wrap *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* === OUTER WRAPPER === */
.wsgb-wrap {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    margin: 32px 0;
    width: 100%;
}

/* === CARD === */
.wsgb-card {
    position: relative;
    background: #ffffff;
    border-radius: 20px;
    border: 2px solid #e0f2fe;
    box-shadow: 0 8px 32px rgba(8, 145, 178, 0.12);
    overflow: hidden;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    max-width: 860px;
    margin: 0 auto;
}

.wsgb-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 48px rgba(8, 145, 178, 0.2);
}

/* === TOP ACCENT BAR === */
.wsgb-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 5px;
    background: linear-gradient(90deg, #0891b2, #14b8a6, #06b6d4);
}

/* === BACKGROUND DECORATION === */
.wsgb-card::after {
    content: '';
    position: absolute;
    top: -60px; right: -60px;
    width: 220px; height: 220px;
    background: radial-gradient(circle, rgba(8,145,178,0.07) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

/* === INNER LAYOUT === */
.wsgb-inner {
    display: flex;
    align-items: center;
    gap: 28px;
    padding: 32px 36px;
    position: relative;
    z-index: 1;
}

/* === ICON BLOCK === */
.wsgb-icon-block {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    border-radius: 18px;
    background: linear-gradient(135deg, #0891b2, #14b8a6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    box-shadow: 0 6px 20px rgba(8,145,178,0.3);
}

/* === TEXT BLOCK === */
.wsgb-text {
    flex: 1;
    min-width: 0;
}

.wsgb-label {
    display: inline-block;
    background: linear-gradient(135deg, rgba(8,145,178,0.1), rgba(20,184,166,0.1));
    color: #0891b2;
    border: 1px solid rgba(8,145,178,0.25);
    border-radius: 20px;
    padding: 3px 12px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.wsgb-title {
    font-size: clamp(17px, 2.5vw, 22px);
    font-weight: 900;
    color: #0f172a;
    line-height: 1.25;
    margin-bottom: 6px;
}

.wsgb-title span {
    background: linear-gradient(135deg, #0891b2, #14b8a6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.wsgb-desc {
    font-size: 14px;
    color: #64748b;
    line-height: 1.6;
    margin-bottom: 14px;
}

/* === FEATURE PILLS === */
.wsgb-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.wsgb-pill {
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    color: #0369a1;
    border-radius: 20px;
    padding: 3px 10px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

/* === CTA BUTTON BLOCK === */
.wsgb-cta {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.wsgb-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: linear-gradient(135deg, #0891b2, #14b8a6);
    color: #ffffff !important;
    text-decoration: none !important;
    padding: 14px 26px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 800;
    white-space: nowrap;
    box-shadow: 0 6px 20px rgba(8,145,178,0.35);
    transition: all 0.25s ease;
    border: none;
    cursor: pointer;
    font-family: inherit;
    line-height: 1;
}

.wsgb-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 28px rgba(8,145,178,0.45);
    color: #ffffff !important;
    text-decoration: none !important;
}

.wsgb-free-badge {
    font-size: 12px;
    color: #10b981;
    font-weight: 700;
    letter-spacing: 0.3px;
}

/* === STATS ROW (bottom strip) === */
.wsgb-stats {
    display: flex;
    border-top: 1px solid #f0f9ff;
    background: linear-gradient(135deg, #f8fbff, #f0fafb);
}

.wsgb-stat {
    flex: 1;
    text-align: center;
    padding: 12px 8px;
    border-right: 1px solid #e0f2fe;
}

.wsgb-stat:last-child {
    border-right: none;
}

.wsgb-stat-num {
    display: block;
    font-size: 17px;
    font-weight: 900;
    color: #0891b2;
    line-height: 1.1;
}

.wsgb-stat-lbl {
    display: block;
    font-size: 10px;
    color: #94a3b8;
    font-weight: 600;
    margin-top: 2px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

/* === RESPONSIVE === */
@media (max-width: 640px) {
    .wsgb-inner {
        flex-direction: column;
        text-align: center;
        padding: 28px 22px;
        gap: 20px;
    }

    .wsgb-pills {
        justify-content: center;
    }

    .wsgb-cta {
        width: 100%;
    }

    .wsgb-btn {
        width: 100%;
        padding: 15px 20px;
    }

    .wsgb-stat-num {
        font-size: 15px;
    }
}

@media (max-width: 400px) {
    .wsgb-stats {
        flex-wrap: wrap;
    }
    .wsgb-stat {
        flex: 0 0 50%;
        border-right: none;
        border-bottom: 1px solid #e0f2fe;
    }
    .wsgb-stat:nth-child(odd) {
        border-right: 1px solid #e0f2fe;
    }
}

/* ==== Homepage style block 7 ==== */
block + the <div>)
  and paste it anywhere on any page of your site.

  ✅ Safe to paste inside any existing page
  ✅ Will NOT affect or disturb any other styles
  ✅ Works on mobile, tablet, and desktop
  ✅ No external libraries needed
==========================================================
-->

<!-- ① BANNER STYLES — fully isolated with unique prefix "wsgb-" -->
<style>
/* === RESET ONLY FOR BANNER ELEMENTS === */
.wsgb-wrap *, .wsgb-wrap *::before, .wsgb-wrap *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* === OUTER WRAPPER === */
.wsgb-wrap {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    margin: 32px 0;
    width: 100%;
}

/* === CARD === */
.wsgb-card {
    position: relative;
    background: #ffffff;
    border-radius: 20px;
    border: 2px solid #e0f2fe;
    box-shadow: 0 8px 32px rgba(8, 145, 178, 0.12);
    overflow: hidden;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    max-width: 860px;
    margin: 0 auto;
}

.wsgb-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 48px rgba(8, 145, 178, 0.2);
}

/* === TOP ACCENT BAR === */
.wsgb-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 5px;
    background: linear-gradient(90deg, #0891b2, #14b8a6, #06b6d4);
}

/* === BACKGROUND DECORATION === */
.wsgb-card::after {
    content: '';
    position: absolute;
    top: -60px; right: -60px;
    width: 220px; height: 220px;
    background: radial-gradient(circle, rgba(8,145,178,0.07) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

/* === INNER LAYOUT === */
.wsgb-inner {
    display: flex;
    align-items: center;
    gap: 28px;
    padding: 32px 36px;
    position: relative;
    z-index: 1;
}

/* === ICON BLOCK === */
.wsgb-icon-block {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    border-radius: 18px;
    background: linear-gradient(135deg, #0891b2, #14b8a6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    box-shadow: 0 6px 20px rgba(8,145,178,0.3);
}

/* === TEXT BLOCK === */
.wsgb-text {
    flex: 1;
    min-width: 0;
}

.wsgb-label {
    display: inline-block;
    background: linear-gradient(135deg, rgba(8,145,178,0.1), rgba(20,184,166,0.1));
    color: #0891b2;
    border: 1px solid rgba(8,145,178,0.25);
    border-radius: 20px;
    padding: 3px 12px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.wsgb-title {
    font-size: clamp(17px, 2.5vw, 22px);
    font-weight: 900;
    color: #0f172a;
    line-height: 1.25;
    margin-bottom: 6px;
}

.wsgb-title span {
    background: linear-gradient(135deg, #0891b2, #14b8a6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.wsgb-desc {
    font-size: 14px;
    color: #64748b;
    line-height: 1.6;
    margin-bottom: 14px;
}

/* === FEATURE PILLS === */
.wsgb-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.wsgb-pill {
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    color: #0369a1;
    border-radius: 20px;
    padding: 3px 10px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

/* === CTA BUTTON BLOCK === */
.wsgb-cta {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.wsgb-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: linear-gradient(135deg, #0891b2, #14b8a6);
    color: #ffffff !important;
    text-decoration: none !important;
    padding: 14px 26px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 800;
    white-space: nowrap;
    box-shadow: 0 6px 20px rgba(8,145,178,0.35);
    transition: all 0.25s ease;
    border: none;
    cursor: pointer;
    font-family: inherit;
    line-height: 1;
}

.wsgb-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 28px rgba(8,145,178,0.45);
    color: #ffffff !important;
    text-decoration: none !important;
}

.wsgb-free-badge {
    font-size: 12px;
    color: #10b981;
    font-weight: 700;
    letter-spacing: 0.3px;
}

/* === STATS ROW (bottom strip) === */
.wsgb-stats {
    display: flex;
    border-top: 1px solid #f0f9ff;
    background: linear-gradient(135deg, #f8fbff, #f0fafb);
}

.wsgb-stat {
    flex: 1;
    text-align: center;
    padding: 12px 8px;
    border-right: 1px solid #e0f2fe;
}

.wsgb-stat:last-child {
    border-right: none;
}

.wsgb-stat-num {
    display: block;
    font-size: 17px;
    font-weight: 900;
    color: #0891b2;
    line-height: 1.1;
}

.wsgb-stat-lbl {
    display: block;
    font-size: 10px;
    color: #94a3b8;
    font-weight: 600;
    margin-top: 2px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

/* === RESPONSIVE === */
@media (max-width: 640px) {
    .wsgb-inner {
        flex-direction: column;
        text-align: center;
        padding: 28px 22px;
        gap: 20px;
    }

    .wsgb-pills {
        justify-content: center;
    }

    .wsgb-cta {
        width: 100%;
    }

    .wsgb-btn {
        width: 100%;
        padding: 15px 20px;
    }

    .wsgb-stat-num {
        font-size: 15px;
    }
}

@media (max-width: 400px) {
    .wsgb-stats {
        flex-wrap: wrap;
    }
    .wsgb-stat {
        flex: 0 0 50%;
        border-right: none;
        border-bottom: 1px solid #e0f2fe;
    }
    .wsgb-stat:nth-child(odd) {
        border-right: 1px solid #e0f2fe;
    }
}

/* ==== Homepage style block 8 ==== */
.page-card:hover {
                    transform: translateY(-10px);
                    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.15);
                    border-color: var(--primary);
                }

                @media (max-width: 768px) {
                    .top-pages-grid {
                        grid-template-columns: 1fr;
                    }
                }

/* ==== Homepage style block 9 ==== */
.social-proof-container {
                    background: white;
                    border-radius: 24px;
                    padding: 40px;
                    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.1);
                }

                .social-proof-header {
                    text-align: center;
                    margin-bottom: 40px;
                }

                .social-proof-header h2 {
                    color: var(--primary);
                    font-size: 32px;
                    margin-bottom: 15px;
                    font-weight: 800;
                }

                .social-proof-grid {
                    display: grid;
                    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
                    gap: 25px;
                    margin-bottom: 40px;
                }

                .social-proof-card {
                    padding: 25px;
                    background: var(--light);
                    border-radius: 16px;
                    text-align: center;
                    transition: 0.3s;
                    border: 1px solid var(--border);
                }

                .social-proof-card:hover {
                    transform: translateY(-5px);
                    border-color: var(--primary);
                }

                .social-proof-icon {
                    font-size: 32px;
                    margin-bottom: 15px;
                    color: var(--primary);
                }

                .social-proof-card h3 {
                    color: var(--dark);
                    margin-bottom: 10px;
                    font-size: 18px;
                    font-weight: 700;
                }

                .social-proof-card p {
                    color: #475569;
                    font-size: 14px;
                    line-height: 1.6;
                    margin: 0;
                }

                .social-proof-stats {
                    display: flex;
                    justify-content: center;
                    flex-wrap: wrap;
                    gap: 30px;
                    margin-top: 40px;
                    padding-top: 40px;
                    border-top: 1px solid var(--border);
                }

                .social-proof-stat {
                    text-align: center;
                }

                .social-proof-stat-number {
                    font-size: 40px;
                    font-weight: 900;
                    color: var(--primary);
                    line-height: 1;
                }

                .social-proof-stat-label {
                    font-size: 14px;
                    color: var(--text-light);
                    font-weight: 600;
                    margin-top: 8px;
                }

                @media (max-width: 768px) {
                    .social-proof-container {
                        padding: 30px 20px;
                    }

                    .social-proof-header h2 {
                        font-size: 24px;
                    }

                    .social-proof-grid {
                        grid-template-columns: 1fr;
                    }
                }

/* ==== Homepage style block 10 ==== */
/* Rest of CSS styles (non-critical) */
        .nav-menu {
            display: flex;
            gap: 35px;
            list-style: none;
            align-items: center
        }

        .nav-menu a {
            text-decoration: none;
            color: var(--text);
            font-weight: 600;
            font-size: 16px;
            transition: all .3s;
            position: relative;
            padding: 5px 0
        }

        .nav-menu a:hover,
        .nav-menu a.active {
            color: var(--primary)
        }

        .nav-menu a::after {
            content: '';
            position: absolute;
            bottom: -5px;
            left: 0;
            width: 0;
            height: 3px;
            background: linear-gradient(90deg, var(--primary), var(--secondary));
            transition: width .3s
        }

        .nav-menu a:hover::after,
        .nav-menu a.active::after {
            width: 100%
        }

        .mobile-toggle.active span:nth-child(1) {
            transform: rotate(45deg) translate(8px, 8px)
        }

        .mobile-toggle.active span:nth-child(2) {
            opacity: 0
        }

        .mobile-toggle.active span:nth-child(3) {
            transform: rotate(-45deg) translate(7px, -7px)
        }

        .hero-badges {
            display: flex;
            justify-content: center;
            gap: 20px;
            margin-top: 25px;
            flex-wrap: wrap
        }

        .badge {
            padding: 10px 20px;
            background: var(--light);
            border-radius: 25px;
            font-size: 14px;
            font-weight: 600;
            color: var(--primary);
            border: 2px solid var(--border)
        }

        .advanced-input-container {
            position: relative;
            margin-bottom: 30px
        }

        .input-with-tools {
            display: flex;
            gap: 15px;
            margin-bottom: 15px
        }

        .math-input-container {
            flex: 1;
            position: relative
        }

        .latex-preview {
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            pointer-events: none;
            padding: 20px 28px;
            font-size: 19px;
            font-family: 'Cambria Math', 'Latin Modern Math', serif;
            color: #0f172a;
            opacity: .8;
            z-index: 1;
            display: none
        }

        .latex-preview.active {
            display: block
        }

        .math-toolbar {
            display: flex;
            gap: 10px;
            flex-wrap: wrap;
            margin-bottom: 15px;
            padding: 15px;
            background: var(--light);
            border-radius: 12px;
            border: 2px solid var(--border)
        }

        .math-btn-group {
            display: flex;
            gap: 8px;
            align-items: center;
            background: #fff;
            padding: 8px;
            border-radius: 8px;
            border: 1px solid var(--border)
        }

        .math-btn {
            padding: 10px 15px;
            background: #fff;
            border: 2px solid var(--border);
            border-radius: 8px;
            cursor: pointer;
            font-family: 'Cambria Math', serif;
            font-size: 16px;
            transition: all .2s;
            color: var(--text)
        }

        .math-btn:hover {
            background: var(--primary);
            color: #fff;
            border-color: var(--primary);
            transform: translateY(-2px)
        }

        label {
            display: block;
            font-weight: 700;
            margin-bottom: 12px;
            color: var(--text);
            font-size: 17px
        }

        .variable-selector {
            display: flex;
            gap: 12px;
            margin-top: 18px;
            flex-wrap: wrap;
            align-items: center
        }

        .var-label {
            font-weight: 700;
            color: var(--text);
            font-size: 15px
        }

        .var-btn {
            padding: 12px 24px;
            border: 2px solid var(--border);
            background: #fff;
            border-radius: 10px;
            cursor: pointer;
            transition: all .3s;
            font-weight: 700;
            font-size: 16px;
            color: var(--text)
        }

        .var-btn:hover {
            border-color: var(--primary);
            color: var(--primary);
            transform: translateY(-2px)
        }

        .var-btn.active {
            background: linear-gradient(135deg, var(--primary), var(--secondary));
            color: #fff;
            border-color: transparent;
            box-shadow: 0 6px 20px rgba(8, 145, 178, .3)
        }

        .btn-primary:active {
            transform: translateY(-1px)
        }

        .advanced-options {
            background: #fff;
            border: 2px solid var(--border);
            border-radius: 16px;
            padding: 25px;
            margin: 25px 0;
        }

        .options-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
            gap: 20px;
            margin-top: 20px
        }

        .option-group {
            display: flex;
            flex-direction: column;
            gap: 10px
        }

        .option-label {
            font-weight: 700;
            color: var(--text);
            font-size: 15px;
            display: flex;
            align-items: center;
            gap: 8px
        }

        .option-select {
            padding: 12px 15px;
            border: 2px solid var(--border);
            border-radius: 10px;
            font-size: 15px;
            background: #fff;
            cursor: pointer;
            font-family: inherit
        }

        .option-checkbox {
            display: flex;
            align-items: center;
            gap: 10px;
            cursor: pointer;
            user-select: none
        }

        .option-checkbox input[type="checkbox"] {
            width: 18px;
            height: 18px;
            accent-color: var(--primary)
        }

        .examples {
            margin: 30px 0;
            padding: 30px;
            background: linear-gradient(135deg, rgba(8, 145, 178, .05), rgba(20, 184, 166, .05));
            border-radius: 16px;
            border: 2px solid var(--border)
        }

        .examples h3 {
            margin-bottom: 20px;
            color: var(--primary);
            font-size: 20px;
            font-weight: 800;
            display: flex;
            align-items: center;
            gap: 10px
        }

        .example-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
            gap: 12px
        }

        .example-btn {
            padding: 14px 20px;
            background: #fff;
            border: 2px solid var(--border);
            border-radius: 10px;
            cursor: pointer;
            transition: all .3s;
            font-family: 'Courier New', monospace;
            font-size: 16px;
            font-weight: 600;
            color: var(--text);
            text-align: center
        }

        .example-btn:hover {
            border-color: var(--primary);
            color: var(--primary);
            transform: translateY(-3px);
            box-shadow: 0 8px 20px rgba(8, 145, 178, .2);
            background: var(--light)
        }

        .results {
            background: #fff;
            border-radius: 24px;
            padding: 50px;
            margin-bottom: 40px;
            box-shadow: 0 25px 70px rgba(0, 0, 0, .15);
            display: none;
            border: 1px solid var(--border)
        }

        .results.show {
            display: block;
            animation: slideUp .5s ease
        }

        @keyframes slideUp {
            from {
                opacity: 0;
                transform: translateY(30px)
            }

            to {
                opacity: 1;
                transform: translateY(0)
            }
        }

        .enhanced-results {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
            gap: 20px;
            margin: 25px 0
        }

        .result-card {
            background: #fff;
            border: 2px solid var(--border);
            border-radius: 16px;
            padding: 25px;
            transition: all .3s
        }

        .result-card:hover {
            border-color: var(--primary);
            box-shadow: 0 10px 30px rgba(8, 145, 178, .1);
            transform: translateY(-5px)
        }

        .result-card-title {
            font-weight: 800;
            color: var(--primary);
            margin-bottom: 15px;
            font-size: 16px;
            display: flex;
            align-items: center;
            gap: 10px
        }

        .result-card-content {
            font-family: 'Cambria Math', 'Latin Modern Math', serif;
            font-size: 18px;
            color: var(--text);
            line-height: 1.6;
            padding: 15px;
            background: var(--light);
            border-radius: 10px;
            border: 1px solid var(--border);
            min-height: 60px
        }

        .interactive-graph {
            margin: 30px 0;
            background: #fff;
            border-radius: 20px;
            padding: 30px;
            border: 2px solid var(--border);
            box-shadow: 0 10px 40px rgba(0, 0, 0, .08)
        }

        .graph-tools {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 20px;
            flex-wrap: wrap;
            gap: 15px
        }

        .graph-controls {
            display: flex;
            gap: 10px;
            flex-wrap: wrap
        }

        .graph-btn {
            padding: 10px 20px;
            background: #fff;
            border: 2px solid var(--border);
            border-radius: 8px;
            cursor: pointer;
            font-size: 14px;
            font-weight: 600;
            color: var(--text);
            transition: all .2s;
            display: flex;
            align-items: center;
            gap: 5px
        }

        .graph-btn:hover {
            background: var(--primary);
            color: #fff;
            border-color: var(--primary)
        }

        .graph-container-3d {
            width: 100%;
            height: 500px;
            border-radius: 12px;
            overflow: hidden;
            margin-top: 20px;
            display: none
        }

        .graph-container-3d.show {
            display: block;
            animation: fadeIn .5s ease
        }

        .derivative-table-container {
            overflow-x: auto;
            margin: 30px 0;
            background: #fff;
            border-radius: 16px;
            padding: 25px;
            border: 2px solid var(--border)
        }

        .derivative-table {
            width: 100%;
            border-collapse: collapse;
            min-width: 600px
        }

        .derivative-table th {
            background: linear-gradient(135deg, var(--primary), var(--secondary));
            color: #fff;
            padding: 15px;
            text-align: left;
            font-weight: 700;
            font-size: 15px
        }

        .derivative-table td {
            padding: 15px;
            border-bottom: 1px solid var(--border);
            font-family: 'Courier New', monospace;
            font-size: 15px
        }

        .derivative-table tr:hover {
            background: rgba(8, 145, 178, .05)
        }

        .result-box {
            padding: 30px;
            background: linear-gradient(135deg, rgba(8, 145, 178, .05), rgba(20, 184, 166, .05));
            border-radius: 16px;
            margin: 25px 0;
            border-left: 5px solid var(--secondary);
            box-shadow: 0 4px 15px rgba(0, 0, 0, .05)
        }

        .result-label {
            font-weight: 800;
            color: var(--primary);
            margin-bottom: 12px;
            font-size: 15px;
            text-transform: uppercase;
            letter-spacing: 1.2px
        }

        .result-value {
            font-size: 26px;
            font-family: 'Courier New', monospace;
            color: var(--text);
            padding: 20px;
            background: #fff;
            border-radius: 12px;
            border: 2px solid var(--border);
            font-weight: 600
        }

        .step-accordion {
            margin: 20px 0
        }

        .step-item {
            margin-bottom: 10px;
            border: 2px solid var(--border);
            border-radius: 12px;
            overflow: hidden
        }

        .step-header {
            padding: 18px 25px;
            background: #fff;
            cursor: pointer;
            display: flex;
            justify-content: space-between;
            align-items: center;
            font-weight: 700;
            color: var(--text);
            transition: all .3s
        }

        .step-header:hover {
            background: var(--light)
        }

        .step-header.active {
            background: linear-gradient(135deg, rgba(8, 145, 178, .1), rgba(20, 184, 166, .1));
            color: var(--primary)
        }

        .step-content {
            padding: 0;
            max-height: 0;
            overflow: hidden;
            transition: all .3s ease;
            background: #fff
        }

        .step-content.show {
            padding: 25px;
            max-height: 1000px
        }

        .step-math {
            font-family: 'Cambria Math', 'Latin Modern Math', serif;
            font-size: 18px;
            margin: 15px 0;
            padding: 15px;
            background: var(--light);
            border-radius: 8px;
            border: 1px solid var(--border)
        }

        .step-explanation {
            color: var(--text-light);
            line-height: 1.7;
            margin-top: 10px
        }

        .steps {
            margin-top: 40px
        }

        .step {
            padding: 25px;
            margin: 18px 0;
            background: #fff;
            border-radius: 14px;
            border-left: 5px solid var(--success);
            box-shadow: 0 4px 15px rgba(0, 0, 0, .05);
            transition: all .3s
        }

        .step:hover {
            transform: translateX(5px);
            box-shadow: 0 6px 20px rgba(0, 0, 0, .1)
        }

        .step-number {
            display: inline-block;
            width: 35px;
            height: 35px;
            background: linear-gradient(135deg, var(--success), #34d399);
            color: #fff;
            border-radius: 50%;
            text-align: center;
            line-height: 35px;
            font-weight: 800;
            margin-right: 15px;
            box-shadow: 0 4px 12px rgba(16, 185, 129, .3)
        }

        .step-content-old {
            display: inline-block;
            vertical-align: top;
            width: calc(100% - 60px)
        }

        .step-title {
            font-weight: 700;
            color: var(--primary);
            margin-bottom: 8px
        }

        .step-description {
            color: var(--text-light);
            line-height: 1.6
        }

        .quick-actions {
            display: flex;
            gap: 10px;
            margin: 20px 0;
            flex-wrap: wrap
        }

        .quick-action-btn {
            padding: 12px 20px;
            background: #fff;
            border: 2px solid var(--border);
            border-radius: 10px;
            cursor: pointer;
            font-size: 14px;
            font-weight: 600;
            color: var(--text);
            display: flex;
            align-items: center;
            gap: 8px;
            transition: all .2s
        }

        .quick-action-btn:hover {
            background: var(--primary);
            color: #fff;
            border-color: var(--primary);
            transform: translateY(-2px)
        }

        .action-buttons {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
            gap: 15px;
            margin-top: 30px
        }

        .btn-secondary {
            padding: 16px 28px;
            background: #fff;
            color: var(--primary);
            border: 2px solid var(--primary);
            border-radius: 12px;
            font-weight: 700;
            cursor: pointer;
            transition: all .3s;
            font-size: 15px;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px
        }

        .btn-secondary:hover {
            background: linear-gradient(135deg, var(--primary), var(--secondary));
            color: #fff;
            border-color: transparent;
            transform: translateY(-2px);
            box-shadow: 0 8px 20px rgba(8, 145, 178, .3)
        }

        .enhanced-loading {
            text-align: center;
            padding: 50px;
            background: #fff;
            border-radius: 20px;
            margin: 20px 0;
            display: none
        }

        .enhanced-loading.show {
            display: block;
            animation: fadeIn .3s ease
        }

        .loading-dots {
            display: flex;
            justify-content: center;
            gap: 8px;
            margin: 20px 0
        }

        .loading-dots span {
            width: 12px;
            height: 12px;
            background: var(--primary);
            border-radius: 50%;
            animation: bounce 1.4s infinite ease-in-out
        }

        .loading-dots span:nth-child(1) {
            animation-delay: -.32s
        }

        .loading-dots span:nth-child(2) {
            animation-delay: -.16s
        }

        @keyframes bounce {

            0%,
            80%,
            100% {
                transform: scale(0)
            }

            40% {
                transform: scale(1)
            }
        }

        .enhanced-alert {
            padding: 20px;
            border-radius: 12px;
            margin: 20px 0;
            display: none;
            animation: slideIn .3s ease;
            border-left: 5px solid
        }

        .enhanced-alert.show {
            display: flex;
            align-items: center;
            gap: 15px
        }

        .alert-icon {
            font-size: 24px
        }

        .alert {
            padding: 18px 25px;
            border-radius: 12px;
            margin: 25px 0;
            display: none;
            font-weight: 600
        }

        .alert.show {
            display: block;
            animation: slideUp .3s ease
        }

        .alert-error {
            background: #fef2f2;
            color: #991b1b;
            border-left: 5px solid #dc2626
        }

        .alert-tip {
            background: #f0f9ff;
            color: #0c4a6e;
            border-left: 5px solid #0891b2
        }

        .history-panel {
            position: fixed;
            right: -400px;
            top: 80px;
            width: 380px;
            height: calc(100vh - 80px);
            background: #fff;
            box-shadow: -5px 0 30px rgba(0, 0, 0, .1);
            z-index: 999;
            transition: right .3s ease;
            padding: 25px;
            overflow-y: auto
        }

        .history-panel.show {
            right: 0
        }

        .history-item {
            padding: 15px;
            margin: 10px 0;
            background: var(--light);
            border-radius: 10px;
            border: 1px solid var(--border);
            cursor: pointer;
            transition: all .2s
        }

        .history-item:hover {
            background: #fff;
            border-color: var(--primary);
            transform: translateX(-5px)
        }

        .action-buttons {
            display: flex;
            gap: 10px;
            margin: 20px 0;
            flex-wrap: wrap
        }

        .action-buttons button,
        .share-dropdown {
            position: relative;
            padding: 10px 16px;
            border: none;
            border-radius: 8px;
            font-size: 15px;
            font-weight: 600;
            cursor: pointer;
            transition: all .25s ease;
            display: flex;
            align-items: center;
            gap: 8px;
            min-width: 44px;
            min-height: 44px;
            justify-content: center
        }

        .btn-calculate {
            background: linear-gradient(135deg, var(--primary), var(--secondary));
            color: #fff;
            flex: 1;
            max-width: 150px
        }

        .btn-clear {
            background: #f1f5f9;
            color: var(--text);
            flex: 0 0 auto
        }

        .btn-export {
            background: #10b981;
            color: #fff;
            flex: 0 0 auto
        }

        .btn-share {
            background: #3b82f6;
            color: #fff;
            flex: 0 0 auto
        }

        .action-buttons button:not(:disabled):hover,
        .share-dropdown:hover .btn-share {
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(0, 0, 0, .15);
            opacity: .95
        }

        .action-buttons button:active,
        .share-dropdown:active .btn-share {
            transform: translateY(0)
        }

        .share-dropdown {
            position: relative;
            display: inline-block
        }

        .share-dropdown-content {
            display: none;
            position: absolute;
            right: 0;
            background-color: #fff;
            min-width: 200px;
            box-shadow: 0 8px 16px rgba(0, 0, 0, .1);
            border-radius: 8px;
            z-index: 1000;
            padding: 8px 0;
            margin-top: 8px;
            opacity: 0;
            transform: translateY(-10px);
            transition: opacity .2s, transform .2s
        }

        .share-dropdown:hover .share-dropdown-content {
            display: block;
            opacity: 1;
            transform: translateY(0)
        }

        .share-dropdown-content a {
            color: var(--text);
            padding: 10px 16px;
            text-decoration: none;
            display: flex;
            align-items: center;
            gap: 10px;
            transition: background-color .2s
        }

        .share-dropdown-content a:hover {
            background-color: #f8fafc
        }

        .share-dropdown-content i {
            width: 20px;
            text-align: center
        }

        .action-buttons button:focus-visible,
        .share-dropdown-content a:focus-visible {
            outline: 3px solid #3b82f6;
            outline-offset: 2px
        }

        @media (max-width:768px) {
            .action-buttons {
                gap: 8px
            }

            .action-buttons button {
                padding: 10px 12px;
                font-size: 14px
            }

            .btn-calculate {
                flex: 1 0 100%;
                max-width: 100%
            }

            .share-dropdown-content {
                min-width: 180px;
                right: 0;
                left: auto
            }
        }

        .fab {
            position: fixed;
            bottom: 30px;
            right: 30px;
            width: 60px;
            height: 60px;
            background: linear-gradient(135deg, var(--primary), var(--secondary));
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            box-shadow: 0 10px 30px rgba(8, 145, 178, .3);
            z-index: 100;
            transition: all .3s;
            color: #fff;
            font-size: 24px
        }

        .fab:hover {
            transform: scale(1.1) rotate(90deg);
            box-shadow: 0 15px 40px rgba(8, 145, 178, .4)
        }

        .fab-menu {
            position: absolute;
            bottom: 70px;
            right: 0;
            background: #fff;
            border-radius: 15px;
            box-shadow: 0 10px 40px rgba(0, 0, 0, .15);
            padding: 15px;
            display: none;
            flex-direction: column;
            gap: 10px;
            min-width: 200px
        }

        .fab-menu.show {
            display: flex;
            animation: slideUp .3s ease
        }

        .fab-item {
            padding: 12px 15px;
            background: #fff;
            border-radius: 8px;
            cursor: pointer;
            display: flex;
            align-items: center;
            gap: 10px;
            transition: all .2s;
            font-size: 14px;
            color: var(--text)
        }

        .fab-item:hover {
            background: var(--light);
            color: var(--primary)
        }

        .features {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
            gap: 30px;
            margin: 40px 0
        }

        .feature-card {
            background: #fff;
            padding: 40px 35px;
            border-radius: 20px;
            box-shadow: 0 12px 35px rgba(0, 0, 0, .1);
            transition: all .3s;
            border: 2px solid transparent
        }

        .feature-card:hover {
            transform: translateY(-8px);
            box-shadow: 0 20px 50px rgba(0, 0, 0, .15);
            border-color: var(--secondary)
        }

        .feature-icon {
            font-size: 48px;
            margin-bottom: 20px
        }

        .feature-card h3 {
            margin-bottom: 12px;
            color: var(--primary);
            font-size: 22px;
            font-weight: 800
        }

        .feature-card p {
            color: var(--text-light);
            line-height: 1.7;
            font-size: 15px
        }

        .calculator-types {
            background: #fff;
            border-radius: 24px;
            padding: 50px;
            margin-bottom: 40px;
            box-shadow: 0 25px 70px rgba(0, 0, 0, .15)
        }

        .calc-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
            gap: 20px;
            margin-top: 30px
        }

        .calc-card {
            padding: 25px;
            background: linear-gradient(135deg, rgba(8, 145, 178, .05), rgba(20, 184, 166, .05));
            border-radius: 16px;
            border: 2px solid var(--border);
            transition: all .3s;
            cursor: pointer;
            text-decoration: none;
            display: block
        }

        .calc-card:hover {
            border-color: var(--primary);
            transform: translateY(-5px);
            box-shadow: 0 12px 30px rgba(8, 145, 178, .2)
        }

        .calc-card h4 {
            color: var(--primary);
            margin-bottom: 10px;
            font-size: 18px;
            font-weight: 700
        }

        .calc-card p {
            color: var(--text-light);
            font-size: 14px;
            line-height: 1.6
        }

        footer {
            background: rgba(8, 145, 178, .95);
            color: #fff;
            padding: 60px 30px 30px;
            margin-top: 60px
        }

        .footer-container {
            max-width: 1400px;
            margin: 0 auto;
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
            gap: 40px;
            margin-bottom: 40px
        }

        .footer-section h3 {
            margin-bottom: 20px;
            font-size: 20px;
            font-weight: 800;
            color: var(--secondary)
        }

        .footer-section ul {
            list-style: none
        }

        .footer-section ul li {
            margin-bottom: 12px
        }

        .footer-section a {
            color: rgba(255, 255, 255, .8);
            text-decoration: none;
            transition: all .3s;
            font-size: 15px
        }

        .footer-section a:hover {
            color: var(--secondary);
            padding-left: 5px
        }

        .footer-bottom {
            text-align: center;
            padding-top: 30px;
            border-top: 1px solid rgba(255, 255, 255, .1);
            color: rgba(255, 255, 255, .7)
        }

        .loading {
            display: none;
            text-align: center;
            padding: 40px
        }

        .loading.show {
            display: block
        }

        .spinner {
            border: 5px solid var(--border);
            border-top: 5px solid var(--primary);
            border-radius: 50%;
            width: 60px;
            height: 60px;
            animation: spin 1s linear infinite;
            margin: 0 auto 20px
        }

        @keyframes spin {
            0% {
                transform: rotate(0deg)
            }

            100% {
                transform: rotate(360deg)
            }
        }

        @media (max-width:768px) {
            .hero-badges {
                flex-direction: column;
                align-items: center
            }

            .section-title {
                font-size: 24px
            }

            .calculator-wrapper,
            .results,
            .calculator-types {
                padding: 30px 20px
            }

            .action-buttons {
                grid-template-columns: 1fr
            }

            .features {
                grid-template-columns: 1fr
            }

            .input-with-tools {
                flex-direction: column
            }

            .math-toolbar {
                justify-content: center
            }

            .math-btn {
                padding: 8px 12px;
                font-size: 14px
            }

            .options-grid {
                grid-template-columns: 1fr
            }

            .graph-tools {
                flex-direction: column;
                align-items: stretch
            }

            .graph-controls {
                justify-content: center
            }

            .history-panel {
                width: 100%;
                right: -100%
            }

            .derivative-table-container {
                margin: 15px -20px;
                border-radius: 0;
                border-left: none;
                border-right: none
            }

            .graph-container-3d {
                height: 300px
            }

            .enhanced-results {
                grid-template-columns: 1fr
            }

            .quick-actions {
                flex-direction: column
            }

            .quick-action-btn {
                width: 100%;
                justify-content: center
            }
        }

        @media (max-width:480px) {

            .calc-grid,
            .example-grid {
                grid-template-columns: 1fr
            }

            h1 {
                font-size: 28px
            }

            .subtitle {
                font-size: 16px
            }

            .hero {
                padding: 30px 20px
            }

            .math-btn {
                padding: 6px 10px;
                font-size: 13px
            }

            .graph-container-3d {
                height: 250px
            }

            /* Ensure order selector label is always visible on mobile */
            .order-label, label[for="derivOrder"], [data-label="order"] {
                display: block !important;
                font-size: 13px !important;
                white-space: normal !important;
                overflow: visible !important;
                clip: auto !important;
            }

            select#derivOrder {
                width: 100%;
                font-size: 14px;
                padding: 8px;
            }
        }

        /* Accessibility fixes */
        .sr-only {
            position: absolute;
            width: 1px;
            height: 1px;
            padding: 0;
            margin: -1px;
            overflow: hidden;
            clip: rect(0, 0, 0, 0);
            white-space: nowrap;
            border: 0;
        }


/*
 * ==== CalcMentor Premium Base (style.css v3.1) — wins on conflicts ====
 */

/*
 * CalcMentor Premium Styles v3.1
 * ────────────────────────────────
 * v3.1 fixes:
 *   FIX 8  — Long equations now scroll horizontally instead of overflowing
 *   FIX 8b — step-display-math and step-body both overflow-x:auto on mobile
 *   NEW    — #voice-hint styles for the voice-confirm toast
 *   NEW    — #graph-container canvas fully responsive
 *   NEW    — solve-btn loading state text handled gracefully
 */

/* ═══ RESET & BASE ═══════════════════════════════════════════════════ */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --primary:    #0891b2;
    --secondary:  #14b8a6;
    --accent:     #06b6d4;
    --success:    #10b981;
    --warning:    #f59e0b;
    --danger:     #ef4444;
    --dark:       #0f172a;
    --light:      #f8fafc;
    --border:     #e2e8f0;
    --text:       #0f172a;
    --text-light: #64748b;
    --card-bg:    #ffffff;
    --radius:     14px;
    --shadow-sm:  0 2px 8px rgba(0,0,0,.06);
    --shadow:     0 4px 20px rgba(0,0,0,.10);
    --shadow-lg:  0 12px 40px rgba(0,0,0,.14);
}

html { overflow-x: hidden; scroll-behavior: smooth; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    line-height: 1.65;
    color: var(--text);
    background: #f0f9ff;
    min-height: 100vh;
    overflow-x: hidden;
    max-width: 100vw;
}

/* ═══ NAVIGATION ═══════════════════════════════════════════════════ */
nav {
    background: rgba(255,255,255,0.98);
    backdrop-filter: blur(12px);
    box-shadow: 0 2px 16px rgba(0,0,0,0.08);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 3px solid var(--secondary);
    width: 100%;
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 72px;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    flex-shrink: 0;
}

.logo-img { width: 46px; height: 46px; border-radius: 10px; }

.logo-text {
    font-size: 20px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-menu { display: flex; gap: 28px; list-style: none; align-items: center; }
.nav-menu a { text-decoration: none; color: var(--text); font-weight: 600; font-size: 14.5px; transition: color .25s; }
.nav-menu a:hover, .nav-menu a.active { color: var(--primary); }

.mobile-toggle { display: none; flex-direction: column; gap: 5px; cursor: pointer; padding: 8px; background: none; border: none; }
.mobile-toggle span { width: 26px; height: 2.5px; background: var(--primary); border-radius: 3px; transition: all .3s; }

/* ═══ LAYOUT ════════════════════════════════════════════════════════ */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 24px;
}

/* ═══ BREADCRUMB ════════════════════════════════════════════════════ */
.breadcrumb {
    background: white;
    padding: 12px 20px;
    border-radius: var(--radius);
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
    overflow-x: auto;
}
.breadcrumb-list { display: flex; align-items: center; gap: 8px; list-style: none; font-size: 13.5px; white-space: nowrap; }
.breadcrumb-list a { color: var(--primary); text-decoration: none; font-weight: 600; }
.breadcrumb-list li:not(:last-child)::after { content: '›'; color: var(--text-light); margin-left: 8px; }

/* ═══ ARTICLE ═══════════════════════════════════════════════════════ */
.article-container {
    background: white;
    border-radius: 24px;
    padding: 52px 56px;
    box-shadow: var(--shadow-lg);
    margin-bottom: 36px;
    border-top: 5px solid var(--primary);
    overflow: hidden;
}

.article-header {
    text-align: center;
    margin-bottom: 44px;
    padding-bottom: 28px;
    border-bottom: 2px solid var(--border);
}

h1 {
    font-size: 44px;
    margin-bottom: 16px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 900;
    line-height: 1.2;
    word-break: break-word;
}

.article-meta { display: flex; justify-content: center; gap: 20px; flex-wrap: wrap; margin-top: 16px; color: var(--text-light); font-size: 13.5px; }
.article-intro { font-size: 19px; line-height: 1.8; color: var(--text-light); margin-top: 22px; text-align: left; }

h2 { font-size: 32px; color: var(--primary); margin: 44px 0 22px; font-weight: 800; border-left: 5px solid var(--secondary); padding-left: 18px; word-break: break-word; }
h3 { font-size: 24px; color: var(--text); margin: 28px 0 16px; font-weight: 700; }

p  { font-size: 16.5px; line-height: 1.8; margin-bottom: 18px; }
ul, ol { margin: 18px 0; padding-left: 28px; }
li { margin: 8px 0; line-height: 1.8; }
strong { color: var(--primary); font-weight: 700; }
code { font-family: 'Menlo', 'Monaco', 'Consolas', monospace; font-size: 13px; background: #f1f5f9; padding: 2px 6px; border-radius: 5px; color: var(--dark); }

/* ═══ INFO BOXES ════════════════════════════════════════════════════ */
.tip-box {
    background: linear-gradient(135deg, rgba(16,185,129,.07), rgba(52,211,153,.07));
    border-left: 5px solid var(--success);
    padding: 18px 22px;
    border-radius: 14px;
    margin: 22px 0;
}
.tip-title { font-size: 17px; font-weight: 800; color: var(--success); margin-bottom: 8px; }

.application-box {
    background: var(--light);
    border: 2px solid var(--border);
    border-radius: 18px;
    padding: 28px;
    margin: 26px 0;
    border-left: 6px solid var(--primary);
}
.application-title { font-size: 22px; font-weight: 800; color: var(--primary); margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }

/* ═══ CALCULATOR AREA ═══════════════════════════════════════════════ */
.calc-main-area { max-width: 980px; margin: 0 auto; }

/* Input */
.input-wrapper { position: relative; }

.math-input {
    width: 100%;
    padding: 20px 60px 20px 22px;
    font-size: 18px;
    border: 3px solid var(--border);
    border-radius: 16px;
    outline: none;
    transition: border-color .25s, box-shadow .25s;
    font-family: 'Georgia', 'Cambria Math', 'Times New Roman', serif;
    background: white;
    color: var(--text);
    line-height: 1.5;
    resize: vertical;
    min-height: 62px;
}
.math-input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(8,145,178,.12); }
.math-input::placeholder { color: #94a3b8; font-family: -apple-system, sans-serif; font-size: 15px; }
.math-input.shake { animation: shake .45s; }
@keyframes shake { 0%,100% { transform: translateX(0); } 20%,60% { transform: translateX(-6px); } 40%,80% { transform: translateX(6px); } }

#voice-btn {
    position: absolute; right: 16px; top: 50%; transform: translateY(-50%);
    background: none; border: none; cursor: pointer; font-size: 22px;
    color: var(--text-light); transition: all .25s; padding: 7px; border-radius: 50%;
}
#voice-btn:hover { color: var(--primary); background: rgba(8,145,178,.08); }
#voice-btn.listening { color: var(--danger); animation: pulse-mic 1s infinite; }
@keyframes pulse-mic { 0%,100% { transform: translateY(-50%) scale(1); } 50% { transform: translateY(-50%) scale(1.2); } }

/* FIX — Voice hint toast (shown after speech recognition result) */
#voice-hint {
    display: none;
    margin-top: 8px;
    padding: 8px 14px;
    background: rgba(8,145,178,.08);
    border: 1px solid rgba(8,145,178,.2);
    border-radius: 10px;
    font-size: 13px;
    color: var(--primary);
    font-weight: 500;
}

/* Solve Button */
.solve-btn {
    width: 100%; margin-top: 16px; padding: 18px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white; border: none; border-radius: 16px;
    font-size: 18px; font-weight: 800; cursor: pointer;
    transition: all .25s; box-shadow: 0 8px 24px rgba(8,145,178,.28);
    letter-spacing: .3px; display: flex; align-items: center; justify-content: center; gap: 8px;
}
.solve-btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 12px 32px rgba(8,145,178,.38); }
.solve-btn:disabled { opacity: .65; cursor: not-allowed; transform: none; }
.solve-btn.loading { background: linear-gradient(135deg, #0e7490, #0d9488); }

/* Examples */
.examples-row { display: flex; gap: 9px; flex-wrap: wrap; margin-top: 16px; }
.example-btn {
    padding: 7px 15px; background: white; border: 2px solid var(--border);
    border-radius: 24px; font-size: 12.5px; cursor: pointer; transition: all .2s;
    color: var(--text-light); font-weight: 600; white-space: nowrap;
}
.example-btn:hover { border-color: var(--primary); color: var(--primary); background: rgba(8,145,178,.04); transform: translateY(-1px); }

/* ═══ LOADER ═════════════════════════════════════════════════════════ */
#loader-container {
    text-align: center; padding: 40px 24px; margin-top: 28px;
    background: white; border-radius: 20px; border: 2px solid var(--border);
    box-shadow: var(--shadow-sm);
}
.loader-spinner {
    border: 4px solid #e2e8f0; border-top: 4px solid var(--primary);
    border-radius: 50%; width: 44px; height: 44px;
    animation: spin .75s linear infinite; margin: 0 auto 16px;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
#loader-text { color: var(--primary); font-weight: 700; font-size: 17px; margin-bottom: 16px; }
.stage-item { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-light); padding: 5px 0; }
.stage-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border); flex-shrink: 0; transition: background .3s; }
.stage-item.active .stage-dot { background: var(--primary); animation: pulse-dot 1s infinite; }
.stage-item.done  .stage-dot { background: var(--success); }
.stage-item.active { color: var(--primary); font-weight: 600; }
.stage-item.done   { color: var(--success); }
@keyframes pulse-dot { 0%,100% { transform: scale(1); } 50% { transform: scale(1.4); } }
#loader-stages { max-width: 320px; margin: 0 auto; text-align: left; }

/* ═══ RESULT SECTION ═════════════════════════════════════════════════ */
#result-section {
    background: linear-gradient(135deg, #f0f9ff, #f0fdfa);
    border: 2px solid var(--primary); border-radius: 22px;
    padding: 36px; margin-top: 36px; overflow: hidden;
}

#final-answer {
    background: white; padding: 24px 28px; border-radius: 16px;
    margin-bottom: 24px; border: 1px solid var(--border);
    overflow-x: auto; word-break: break-word;
}

/* Confidence badges */
.answer-badge {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 13px; font-weight: 700; padding: 5px 14px;
    border-radius: 20px; margin-bottom: 16px;
}
.conf-high   { background: rgba(16,185,129,.12); color: #065f46; border: 1px solid rgba(16,185,129,.3); }
.conf-medium { background: rgba(245,158,11,.12); color: #92400e; border: 1px solid rgba(245,158,11,.3); }
.conf-low    { background: rgba(239,68,68,.12);  color: #7f1d1d; border: 1px solid rgba(239,68,68,.3);  }

/* Answer display — FIX 8: always scrollable for long equations */
.answer-display {
    font-size: 22px;
    margin: 12px 0 18px;
    overflow-x: auto;         /* FIX 8 — scroll long answers horizontally */
    max-width: 100%;
    padding: 8px 0;
}
.answer-display .katex-display {
    overflow-x: auto;
    overflow-y: hidden;
    padding: 6px 0;
    max-width: 100%;
}
.answer-display .katex { font-size: 1.4em; }

/* Action buttons */
.answer-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.action-btn {
    padding: 9px 18px; border: 1.5px solid var(--border); border-radius: 10px;
    background: white; font-size: 13.5px; font-weight: 600; cursor: pointer;
    color: var(--text); transition: all .2s;
}
.action-btn:hover { border-color: var(--primary); color: var(--primary); background: rgba(8,145,178,.04); transform: translateY(-1px); }

/* Engine cross-check */
.engine-checks {
    margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border);
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
    overflow-x: auto;           /* FIX 8 — engine tags scroll on mobile */
}
.engine-label { font-size: 12px; color: var(--text-light); font-weight: 700; text-transform: uppercase; letter-spacing: .5px; white-space: nowrap; }
.engine-tag {
    font-size: 12px; background: var(--light); border: 1px solid var(--border);
    border-radius: 7px; padding: 3px 10px; color: var(--text-light);
    white-space: nowrap; max-width: 280px; overflow: hidden; text-overflow: ellipsis;
}
.engine-tag strong { color: var(--primary); margin-right: 3px; }
.engine-tag code { background: none; padding: 0; font-size: 11.5px; }

/* Result metadata */
#result-meta {
    display: flex; flex-wrap: wrap; gap: 16px; margin-top: 14px;
    font-size: 12.5px; color: var(--text-light);
    padding-top: 12px; border-top: 1px solid var(--border);
}
#result-meta strong { color: var(--text); }

/* Error box */
.error-box {
    padding: 20px; border: 2px solid rgba(239,68,68,.25);
    border-radius: 14px; background: rgba(239,68,68,.04);
}
.error-box strong { color: var(--danger); display: block; font-size: 17px; margin-bottom: 8px; }
.error-box p { color: var(--text-light); margin-bottom: 4px; font-size: 15px; }
.error-hint { font-size: 13px !important; opacity: .75; }

/* ═══ GRAPH CONTAINER ════════════════════════════════════════════════ */
/* FIX 4 (confirm) — graph-container was already in HTML but main.js
   was not resetting display:none before checking. Now fixed in main.js.
   CSS here ensures the canvas is always responsive. */
#graph-container {
    background: white;
    padding: 20px;
    border-radius: 16px;
    margin-bottom: 24px;
    border: 1px solid var(--border);
    overflow: hidden;
}
#graph-container h3 {
    margin-top: 0;
    color: var(--primary);
    font-size: 17px;
    margin-bottom: 16px;
}
#math-chart {
    max-height: 320px;
    width: 100% !important;     /* override Chart.js inline width */
    max-width: 100%;
}

/* ═══ STEPS ══════════════════════════════════════════════════════════ */
.steps-wrapper { margin-top: 8px; }

.step-item {
    background: white;
    border: 1px solid var(--border);
    border-radius: 14px;
    margin-bottom: 10px;
    overflow: hidden;
    transition: box-shadow .25s;
}
.step-item:hover { box-shadow: 0 4px 14px rgba(0,0,0,.07); }

.step-header {
    padding: 15px 20px; cursor: pointer;
    display: flex; justify-content: space-between; align-items: center;
    user-select: none; transition: background .2s;
}
.step-header:hover { background: rgba(8,145,178,.03); }

.step-number-title { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.step-num {
    width: 30px; height: 30px; border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white; font-size: 13px; font-weight: 800;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.step-title { font-weight: 700; color: var(--primary); font-size: 15px; word-break: break-word; }
.step-arrow { font-size: 11px; color: var(--text-light); flex-shrink: 0; margin-left: 10px; }

/* FIX 8 — step-body: long equations scroll horizontally, never overflow */
.step-body {
    padding: 18px 22px;
    border-top: 1px solid var(--border);
    line-height: 1.9;
    font-size: 15px;
    color: #374151;
    word-break: break-word;
    overflow-x: auto;           /* FIX 8 — horizontal scroll for long content */
    max-width: 100%;
}
.step-body .katex-display {
    margin: 14px 0;
    overflow-x: auto;           /* FIX 8 — KaTeX display equations scroll */
    overflow-y: hidden;
    background: #f8fafc;
    padding: 12px;
    border-radius: 10px;
    border: 1px solid var(--border);
    max-width: 100%;
}
.step-body .katex { font-size: 1.1em; }

/* ═══ HISTORY ════════════════════════════════════════════════════════ */
.history-card {
    background: white; border: 2px solid var(--border);
    border-radius: 20px; padding: 22px; margin-top: 28px;
}
.history-card h3 { margin-top: 0; font-size: 17px; border-bottom: 2px solid var(--border); padding-bottom: 10px; margin-bottom: 14px; }

.history-item {
    padding: 11px 13px;
    border-bottom: 1px solid #f1f5f9;
    cursor: pointer;
    font-size: 13.5px;
    color: var(--text-light);
    transition: all .2s;
    border-radius: 8px;
    margin-bottom: 3px;
}
.history-item:hover { color: var(--primary); background: #f0f9ff; transform: translateX(4px); }
.history-item:last-child { border-bottom: none; }
.history-query { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-time { font-size: 11px; opacity: .6; margin-top: 2px; }
.history-empty { text-align: center; color: var(--text-light); padding: 18px; font-size: 13.5px; }

#clear-history {
    width: 100%; margin-top: 12px;
    background: none; border: 1px solid var(--border);
    padding: 9px; border-radius: 10px; font-size: 13px;
    cursor: pointer; color: var(--text-light); transition: all .2s; font-weight: 600;
}
#clear-history:hover { border-color: var(--danger); color: var(--danger); }

/* ═══ EXAMPLE CARDS GRID ═════════════════════════════════════════════ */
.examples-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; margin: 28px 0; }
.example-card {
    background: white; border: 2px solid var(--border); border-radius: 18px;
    padding: 22px; cursor: pointer; transition: all .25s;
    border-top: 4px solid var(--primary);
}
.example-card:focus { outline: 2px solid var(--primary); outline-offset: 2px; }
.example-card:hover { border-color: var(--primary); box-shadow: 0 8px 24px rgba(8,145,178,.15); transform: translateY(-3px); }
.example-card-title { font-size: 16px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.example-card-query { font-size: 13px; color: var(--text-light); font-family: 'Georgia', serif; margin-bottom: 10px; }
.example-card-answer { font-size: 13px; color: var(--primary); font-weight: 600; }

/* ═══ CTA SECTION ════════════════════════════════════════════════════ */
.cta-section {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white; padding: 48px; border-radius: 22px;
    text-align: center; margin: 48px 0;
    box-shadow: 0 14px 36px rgba(8,145,178,.28);
}
.cta-section h2 { color: white; margin: 0 0 18px; border: none; padding: 0; -webkit-text-fill-color: white; font-size: 30px; }
.cta-section p { color: rgba(255,255,255,.9); margin-bottom: 28px; font-size: 17px; }
.cta-button {
    display: inline-block; background: white; color: var(--primary);
    padding: 16px 38px; border-radius: 14px; text-decoration: none;
    font-weight: 800; font-size: 17px; transition: all .3s;
    box-shadow: 0 6px 18px rgba(0,0,0,.15);
}
.cta-button:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(0,0,0,.22); }

/* ═══ FOOTER ═════════════════════════════════════════════════════════ */
footer {
    background: linear-gradient(135deg, #0c4a6e, #0f766e);
    color: white; padding: 56px 24px 28px; margin-top: 56px;
}
.footer-container {
    max-width: 1400px; margin: 0 auto;
    display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 36px; margin-bottom: 36px;
}
.footer-section h3 { margin-bottom: 18px; font-size: 18px; font-weight: 800; color: var(--secondary); }
.footer-section p { color: rgba(255,255,255,.7); line-height: 1.8; font-size: 14px; }
.footer-section ul { list-style: none; padding: 0; }
.footer-section ul li { margin-bottom: 10px; }
.footer-section a { color: rgba(255,255,255,.8); text-decoration: none; transition: all .25s; font-size: 14px; }
.footer-section a:hover { color: var(--secondary); padding-left: 4px; }
.footer-bottom { text-align: center; padding-top: 28px; border-top: 1px solid rgba(255,255,255,.1); color: rgba(255,255,255,.65); font-size: 13.5px; }

/* ═══ KATEX GLOBAL FIXES ═════════════════════════════════════════════ */
/* FIX 8 — all KaTeX display blocks scroll horizontally, never clip */
.katex-display {
    overflow-x: auto;
    overflow-y: hidden;
    max-width: 100%;
}
.katex { font-size: 1.05em; }

/* ═══ ANSWER INTRO ═══════════════════════════════════════════════════ */
.answer-intro {
    font-size: 16px;
    line-height: 1.7;
    color: #1e3a5f;
    background: linear-gradient(135deg, rgba(8,145,178,.06), rgba(20,184,166,.04));
    border-left: 4px solid var(--primary);
    border-radius: 0 10px 10px 0;
    padding: 14px 18px;
    margin: 16px 0 20px;
    font-style: italic;
}

/* ═══ STEP BODY STRUCTURED ELEMENTS ══════════════════════════════════ */
.step-section-title {
    display: block; font-weight: 700; font-size: 14px; color: var(--primary);
    margin: 10px 0 4px; text-transform: uppercase; letter-spacing: .5px;
}

.steps-empty {
    text-align: center; padding: 28px 20px;
    color: var(--text-light); font-style: italic; font-size: 15px;
}

.step-list { margin: 8px 0; padding-left: 22px; }
.step-list li { margin-bottom: 5px; line-height: 1.65; color: var(--text); }

.step-numbered-item { display: flex; align-items: flex-start; gap: 8px; margin: 6px 0; line-height: 1.65; }
.step-num-inline { flex-shrink: 0; font-weight: 700; color: var(--primary); min-width: 22px; }

.step-conclusion {
    margin: 12px 0 6px; padding: 10px 16px;
    background: rgba(16,185,129,.07); border-left: 3px solid var(--success);
    border-radius: 0 8px 8px 0; font-weight: 600; color: #065f46;
}

/* FIX 8 — display math inside steps scrolls horizontally */
.step-display-math {
    margin: 10px auto;
    text-align: center;
    overflow-x: auto;           /* FIX 8 */
    max-width: 100%;
    padding: 4px 0;
}

.step-spacer { height: 8px; }

/* ═══ PRINT STYLES ═══════════════════════════════════════════════════ */
/* FIX 6 — Print is now handled by _printSolution() which opens a new
   clean window. This @media print block applies to any accidental
   direct browser print (Ctrl+P) to hide chrome and show only content. */
@media print {
    nav, .solve-btn, .example-btn, .examples-row, .history-card,
    .cta-section, footer, .answer-actions, #loader-container,
    .breadcrumb, #graph-container, .tip-box { display: none !important; }
    body { background: white; }
    .article-container { box-shadow: none; padding: 20px; }
    .step-body { display: block !important; overflow-x: auto; }
    .katex-display { overflow-x: auto; }
}

/* ═══ RESPONSIVE ═════════════════════════════════════════════════════ */
@media (max-width: 900px) {
    .article-container { padding: 36px 28px; }
}

@media (max-width: 768px) {
    .nav-menu {
        position: fixed; left: -100%; top: 72px;
        flex-direction: column; background: white;
        width: 100%; padding: 20px; box-shadow: 0 8px 24px rgba(0,0,0,.14);
        transition: left .3s; gap: 16px; z-index: 999;
    }
    .nav-menu.active { left: 0; }
    .mobile-toggle { display: flex; }

    h1 { font-size: 30px; }
    h2 { font-size: 26px; }
    h3 { font-size: 20px; }
    .container { padding: 16px; }
    .article-container { padding: 22px 16px; }
    .article-intro { font-size: 16px; }

    .math-input { font-size: 15px; padding: 16px 50px 16px 16px; }
    .solve-btn { font-size: 16px; padding: 16px; }
    #result-section { padding: 22px 16px; }
    #final-answer { padding: 16px; }
    .answer-display .katex { font-size: 1.2em; }

    .examples-row { gap: 7px; }
    .example-btn { font-size: 12px; padding: 6px 11px; }

    .cta-section { padding: 28px 18px; }
    .cta-section h2 { font-size: 24px; }

    .step-header { padding: 13px 15px; }
    .step-body { padding: 14px 16px; font-size: 14.5px; }

    .engine-checks { flex-direction: column; align-items: flex-start; }
    #result-meta { gap: 10px; }
}

@media (max-width: 480px) {
    h1 { font-size: 26px; }
    .logo-text { font-size: 16px; }
    .answer-display .katex { font-size: 1.1em; }
    .answer-actions { flex-direction: column; }
    .action-btn { width: 100%; text-align: center; }

    /* FIX 8 — on very small screens, step body font slightly smaller for long equations */
    .step-body { font-size: 14px; }
    .step-body .katex { font-size: 1em; }
}

/* ═══ MATH KEYBOARD ══════════════════════════════════════════════════ */
.math-keyboard {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
    background: #f8fafc;
    padding: 10px;
    border-radius: 12px;
    border: 1px solid var(--border);
}
.key-btn {
    flex: 1 1 calc(10% - 6px);
    min-width: 44px;
    height: 36px;
    font-size: 13.5px;
    font-weight: 700;
    color: var(--primary);
    background: white;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    user-select: none;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.key-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: translateY(-1px);
    box-shadow: 0 3px 6px rgba(8,145,178,0.25);
}
.key-btn:active {
    transform: translateY(0);
}

/* ═══ IMAGE SOLVER ZONE ══════════════════════════════════════════════ */
.image-solver-zone {
    margin-top: 14px;
    border: 2px dashed #cbd5e1;
    border-radius: 12px;
    background: #faf8fc;
    transition: all 0.25s;
    padding: 16px;
    text-align: center;
}
.image-solver-zone.dragover {
    border-color: var(--primary);
    background: rgba(8,145,178,0.04);
}
.image-upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    color: var(--text-light);
    font-size: 13.5px;
    font-weight: 600;
    transition: color 0.2s;
}
.image-upload-label:hover {
    color: var(--primary);
}
.upload-icon {
    font-size: 24px;
}
#image-preview-container {
    position: relative;
    display: inline-block;
    max-width: 100%;
    margin-top: 4px;
}
#image-preview {
    max-height: 120px;
    border-radius: 8px;
    border: 1.5px solid var(--border);
    box-shadow: 0 4px 10px rgba(0,0,0,0.08);
}
#remove-image-btn {
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--danger);
    color: white;
    border: none;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
    transition: transform 0.15s;
}
#remove-image-btn:hover {
    transform: scale(1.15);
}

/* ═══ FOLLOW-UP QUESTIONS ════════════════════════════════════════════ */
.followup-container {
    margin-top: 24px;
    padding-top: 18px;
    border-top: 1.5px solid var(--border);
}
.followup-title {
    font-size: 14px;
    font-weight: 800;
    color: var(--text-light);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.followup-pills {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.followup-btn {
    text-align: left;
    width: 100%;
    padding: 12px 16px;
    background: white;
    border: 1.5px solid var(--border);
    border-radius: 12px;
    color: var(--primary);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}
.followup-btn:hover {
    background: rgba(8,145,178,0.04);
    border-color: var(--primary);
    transform: translateX(4px);
}
.followup-btn::after {
    content: "→";
    font-size: 16px;
    opacity: 0.7;
    transition: transform 0.2s;
}
.followup-btn:hover::after {
    transform: translateX(2px);
}

@media (max-width: 600px) {
    .key-btn {
        flex: 1 1 calc(20% - 6px);
        font-size: 12.5px;
        height: 32px;
    }
}

/* ═══ MODAL OVERLAY (Welcome + Image Confirmation) ═══════════════════ */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(15,23,42,.65); backdrop-filter: blur(4px);
    z-index: 10000; display: flex; align-items: center; justify-content: center;
    padding: 20px; animation: fadeIn .3s;
}
@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }

.modal-box {
    background: white; border-radius: 24px; max-width: 540px; width: 100%;
    box-shadow: 0 24px 64px rgba(0,0,0,.3); overflow: hidden;
    animation: slideUp .35s ease-out; max-height: 90vh; overflow-y: auto;
}
@keyframes slideUp { from { transform:translateY(30px); opacity:0; } to { transform:translateY(0); opacity:1; } }

.modal-header {
    padding: 24px 28px 16px; text-align: center;
    border-bottom: 1px solid var(--border);
}
.modal-icon { font-size: 36px; display: block; margin-bottom: 8px; }
.modal-header h2 { margin:0; font-size:22px; border:none; padding:0; color:var(--dark); }

.modal-body { padding: 20px 28px; }
.modal-intro { font-size:15px; color:var(--text-light); margin-bottom:16px; text-align:center; }
.modal-footnote { font-size:13px; color:#94a3b8; text-align:center; margin:16px 0 0; }

.welcome-tips { display:flex; flex-direction:column; gap:12px; }
.tip-card {
    display:flex; align-items:flex-start; gap:14px;
    background:var(--light); border:1px solid var(--border);
    border-radius:14px; padding:14px 16px; transition:all .2s;
}
.tip-card:hover { border-color:var(--primary); }
.tip-num {
    width:28px; height:28px; border-radius:50%;
    background:linear-gradient(135deg,var(--primary),var(--secondary));
    color:white; font-size:14px; font-weight:800;
    display:flex; align-items:center; justify-content:center; flex-shrink:0;
}
.tip-card strong { display:block; font-size:14px; margin-bottom:3px; }
.tip-card span { font-size:13px; color:var(--text-light); line-height:1.5; }

.modal-footer { padding:16px 28px 24px; }
.modal-btn {
    width:100%; padding:14px; border:none; border-radius:14px;
    background:linear-gradient(135deg,var(--primary),var(--secondary));
    color:white; font-size:16px; font-weight:800; cursor:pointer;
    transition:all .25s; box-shadow:0 4px 16px rgba(8,145,178,.28);
}
.modal-btn:hover { transform:translateY(-1px); box-shadow:0 6px 20px rgba(8,145,178,.38); }
.modal-btn-secondary {
    background:white; color:var(--text); box-shadow:none;
    border:1.5px solid var(--border); flex:0 1 auto;
}
.modal-btn-secondary:hover { border-color:var(--primary); color:var(--primary); transform:none; box-shadow:none; }

/* Extracted text area */
.extracted-textarea {
    width:100%; padding:14px; font-size:17px; font-family:'Georgia','Cambria Math',serif;
    border:2px solid var(--border); border-radius:12px; outline:none;
    resize:vertical; min-height:80px; color:var(--text); line-height:1.6;
}
.extracted-textarea:focus { border-color:var(--primary); box-shadow:0 0 0 3px rgba(8,145,178,.1); }

@media (max-width: 480px) {
    .modal-box { max-width:100%; border-radius:18px; }
    .modal-header { padding:20px 20px 12px; }
    .modal-body { padding:16px 20px; }
    .modal-footer { padding:12px 20px 20px; }
    .modal-header h2 { font-size:19px; }
}

/* ══════════════════════════════════════════════
   PRACTICE TEST STYLES — MULTIPLE CHOICE
   ══════════════════════════════════════════════ */
.pt-section {
    background:#fff; border:1.5px solid var(--border); border-radius:16px;
    padding:18px 22px; margin-top:18px;
}
.pt-header {
    display:flex; align-items:center; justify-content:space-between; gap:12px;
}
.pt-header-left { display:flex; align-items:center; gap:12px; }
.pt-icon { font-size:26px; }
.pt-title { font-size:17px; font-weight:700; color:var(--text); }
.pt-subtitle { font-size:12.5px; color:var(--text-light); margin-top:1px; }
.pt-generate-btn {
    padding:9px 20px; border:none; border-radius:10px;
    background:linear-gradient(135deg,var(--primary),var(--secondary));
    color:#fff; font-size:14px; font-weight:700; cursor:pointer;
    white-space:nowrap; transition:all .25s; flex-shrink:0;
}
.pt-generate-btn:hover { transform:translateY(-1px); box-shadow:0 4px 14px rgba(8,145,178,.35); }
.pt-generate-btn:disabled { opacity:.5; cursor:not-allowed; transform:none; box-shadow:none; }
.pt-content { margin-top:16px; }
.pt-loading { text-align:center; padding:32px 16px; color:var(--text-light); }
.pt-loading .loader-spinner {
    width:36px; height:36px; border:3px solid var(--border);
    border-top-color:var(--primary); border-radius:50%;
    animation:spin .7s linear infinite; margin:0 auto 12px;
}
.pt-error {
    padding:18px; border-radius:10px; background:#fef2f2;
    border:1px solid #fecaca; color:#dc2626; text-align:center;
    font-size:14px; font-weight:600;
}
.pt-test-container { animation:fadeIn .3s ease; }
@keyframes fadeIn { from{opacity:0;transform:translateY(8px)} to{opacity:1;transform:translateY(0)} }
.pt-test-header {
    display:flex; align-items:center; justify-content:space-between;
    margin-bottom:12px; padding-bottom:10px; border-bottom:2px solid var(--border);
}
.pt-test-title { font-size:17px; font-weight:700; color:var(--text); }
.pt-test-count { font-size:13px; color:var(--text-light); background:#f1f5f9; padding:3px 12px; border-radius:20px; font-weight:600; }

/* Progress dots */
.pt-progress-bar { display:flex; gap:6px; justify-content:center; margin-bottom:16px; }
.pt-dot { width:10px; height:10px; border-radius:50%; background:var(--border); transition:all .25s; }
.pt-dot-current { background:var(--primary); transform:scale(1.3); }
.pt-dot-correct { background:#22c55e; }
.pt-dot-wrong { background:#ef4444; }

/* Question area */
.pt-question-area {
    background:#fff; border:1.5px solid var(--border); border-radius:14px;
    padding:18px 20px 16px; transition:border-color .3s;
}
.pt-question-area.pt-result-correct { border-color:#22c55e; background:#fafefc; }
.pt-question-area.pt-result-wrong { border-color:#ef4444; background:#fefafa; }
.pt-q-header { display:flex; gap:10px; margin-bottom:16px; }
.pt-q-num {
    width:28px; height:28px; border-radius:50%;
    background:linear-gradient(135deg,var(--primary),var(--secondary));
    color:#fff; font-size:12px; font-weight:800;
    display:flex; align-items:center; justify-content:center; flex-shrink:0;
}
.pt-q-text { flex:1; font-weight:600; font-size:15px; color:var(--text); line-height:1.6; padding-top:3px; }

/* Option cards */
.pt-q-options { display:flex; flex-direction:column; gap:8px; margin-bottom:14px; }
.pt-opt {
    display:flex; align-items:center; gap:10px;
    padding:10px 14px; border:1.5px solid var(--border); border-radius:10px;
    cursor:pointer; transition:all .2s; user-select:none;
    background:#fafcff; position:relative;
}
.pt-opt:hover { border-color:#94a3b8; background:#f1f5f9; }
.pt-opt-selected { border-color:var(--primary); background:#f0f9ff; box-shadow:0 0 0 1px rgba(8,145,178,.15); }
.pt-opt-correct { border-color:#22c55e; background:#f0fdf4; cursor:default; }
.pt-opt-wrong { border-color:#ef4444; background:#fef2f2; cursor:default; }
.pt-opt input[type="radio"] { display:none; }
.pt-opt-radio {
    width:18px; height:18px; border:2px solid #cbd5e1; border-radius:50%;
    display:flex; align-items:center; justify-content:center; flex-shrink:0;
    transition:all .2s;
}
.pt-opt-selected .pt-opt-radio { border-color:var(--primary); background:var(--primary); }
.pt-opt-selected .pt-opt-radio::after { content:''; width:6px; height:6px; border-radius:50%; background:#fff; }
.pt-opt-correct .pt-opt-radio { border-color:#22c55e; background:#22c55e; }
.pt-opt-correct .pt-opt-radio::after { content:''; width:6px; height:6px; border-radius:50%; background:#fff; }
.pt-opt-wrong .pt-opt-radio { border-color:#ef4444; background:#ef4444; }
.pt-opt-wrong .pt-opt-radio::after { content:''; width:6px; height:6px; border-radius:50%; background:#fff; }
.pt-opt-letter {
    width:20px; height:20px; border-radius:6px; background:#e2e8f0;
    display:flex; align-items:center; justify-content:center;
    font-size:11px; font-weight:800; color:#475569; flex-shrink:0;
}
.pt-opt-selected .pt-opt-letter { background:var(--primary); color:#fff; }
.pt-opt-correct .pt-opt-letter { background:#22c55e; color:#fff; }
.pt-opt-wrong .pt-opt-letter { background:#ef4444; color:#fff; }
.pt-opt-text { flex:1; font-size:14px; color:var(--text); line-height:1.5; }
.pt-opt-icon { font-size:16px; font-weight:700; }

/* Result banner */
.pt-banner {
    text-align:center; padding:10px; border-radius:8px; font-size:15px;
    font-weight:700; margin-bottom:12px;
}
.pt-banner-correct { background:#dcfce7; color:#166534; }
.pt-banner-wrong { background:#fee2e2; color:#991b1b; }

/* Action buttons */
.pt-q-actions { display:flex; gap:8px; flex-wrap:wrap; align-items:center; }
.pt-submit-mc-btn, .pt-next-btn, .pt-steps-toggle {
    padding:9px 20px; border:none; border-radius:10px;
    font-size:14px; font-weight:700; cursor:pointer;
    transition:all .2s;
}
.pt-submit-mc-btn {
    background:linear-gradient(135deg,var(--primary),var(--secondary));
    color:#fff; flex:1; min-width:100px;
}
.pt-submit-mc-btn:hover { transform:translateY(-1px); box-shadow:0 4px 14px rgba(8,145,178,.35); }
.pt-next-btn {
    background:linear-gradient(135deg,var(--primary),var(--secondary));
    color:#fff; flex:1; min-width:100px;
}
.pt-next-btn:hover { transform:translateY(-1px); box-shadow:0 4px 14px rgba(8,145,178,.35); }
.pt-steps-toggle {
    background:linear-gradient(135deg,#1e293b,#334155); color:#fff;
}
.pt-steps-toggle:hover { transform:translateY(-1px); box-shadow:0 4px 14px rgba(30,41,59,.3); }
.pt-steps-hide { background:#f1f5f9; color:var(--text); }
.pt-steps-hide:hover { background:#e2e8f0; transform:none; box-shadow:none; }

/* Steps display */
.pt-steps-container {
    margin-top:14px; padding:14px 16px; background:#f8fafc;
    border:1px solid var(--border); border-radius:10px;
    animation:fadeIn .3s ease;
}
.pt-step-item {
    display:flex; gap:10px; margin-bottom:8px; padding-bottom:8px;
    border-bottom:1px solid #e2e8f0;
}
.pt-step-item:last-child { border-bottom:none; margin-bottom:0; padding-bottom:0; }
.pt-step-num {
    width:22px; height:22px; border-radius:50%; background:var(--primary);
    color:#fff; font-size:11px; font-weight:700;
    display:flex; align-items:center; justify-content:center; flex-shrink:0; margin-top:1px;
}
.pt-step-body { flex:1; font-size:13.5px; color:var(--text); line-height:1.7; }
.pt-step-body .step-list { margin:4px 0; padding-left:18px; }
.pt-step-body .step-list li { margin-bottom:2px; }

/* Score card */
.pt-score-card {
    text-align:center; padding:22px 20px;
    background:linear-gradient(135deg,#f0f9ff,#f0fdfa);
    border:2px solid var(--primary); border-radius:14px; margin-bottom:20px;
}
.pt-score-pct { font-size:42px; font-weight:800; color:var(--text); line-height:1; }
.pt-score-label { font-size:15px; color:var(--text-light); margin:6px 0 14px; }
.pt-score-track { height:10px; background:#e2e8f0; border-radius:5px; overflow:hidden; }
.pt-score-fill { height:100%; background:linear-gradient(90deg,var(--primary),#14b8a6); border-radius:5px; transition:width .6s ease; }

/* Review list */
.pt-review-list { display:flex; flex-direction:column; gap:10px; }
.pt-review-item {
    border:1.5px solid var(--border); border-radius:10px; overflow:hidden;
}
.pt-review-correct { border-color:#86efac; }
.pt-review-wrong { border-color:#fca5a5; }
.pt-review-q {
    padding:10px 14px; font-weight:600; font-size:14px; color:var(--text);
    background:#f8fafc; border-bottom:1px solid var(--border);
}
.pt-review-ans { padding:8px 14px; font-size:13px; color:var(--text-light); }
.pt-review-correct .pt-review-ans { color:#166534; font-weight:600; }
.pt-review-wrong .pt-review-ans { color:#991b1b; font-weight:600; }
.pt-review-steps { border-top:1px solid var(--border); }
.pt-review-steps summary {
    padding:8px 14px; font-size:13px; font-weight:600; color:var(--primary);
    cursor:pointer; user-select:none;
}
.pt-review-steps summary:hover { color:#0e7490; }
.pt-review-steps-body { padding:10px 14px 14px; background:#fafcff; }

/* Legacy - shared buttons */
.pt-retry-btn, .pt-print-btn, .pt-close-btn {
    padding:9px 18px; border:none; border-radius:10px;
    font-size:13px; font-weight:700; cursor:pointer;
    transition:all .2s;
}
.pt-retry-btn { background:linear-gradient(135deg,#059669,#10b981); color:#fff; }
.pt-retry-btn:hover { transform:translateY(-1px); box-shadow:0 4px 14px rgba(5,150,105,.35); }
.pt-print-btn { background:linear-gradient(135deg,#1e293b,#334155); color:#fff; }
.pt-print-btn:hover { transform:translateY(-1px); box-shadow:0 4px 14px rgba(30,41,59,.3); }
.pt-close-btn { background:#f1f5f9; color:var(--text); }
.pt-close-btn:hover { background:#e2e8f0; }

/* Steps text fallback */
.pt-steps-text { font-size:13.5px; color:var(--text); line-height:1.7; }

@media (max-width: 600px) {
    .pt-header { flex-direction:column; align-items:stretch; }
    .pt-q-actions { flex-direction:column; }
    .pt-submit-mc-btn, .pt-next-btn { width:100%; }
    .pt-question-area { padding:14px 14px 12px; }
    .pt-opt { padding:8px 12px; }
}