/* =========================
   Base / Reset
   ========================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

body {
    margin: 0;
    padding: 40px 20px;
    font-family: -apple-system, BlinkMacSystemFont, sans-serif;
    /* background-image:
        linear-gradient(rgba(200, 200, 200, 0.05) 3px, transparent 3px),
        linear-gradient(90deg, rgba(200, 200, 200, 0.05) 3px, transparent 3px);
    background-size: 30px 30px; */
    min-height: 100vh;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    /* centered before chat starts */
}

/* =========================
   Greeting / Header
   ========================= */
.greeting {
    font-size: 48px;
    color: #333;
    margin-bottom: 20px;
    text-align: center;
}

.star {
    color: #ff6b35;
    /* margin-right: 15px; */
}



.greeting,
.greeting .star {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
        Arial, "Noto Sans", Inter, sans-serif;

}

.title-grid .title-text {
    grid-column: 2;
    grid-row: 1;
}

.title-grid .subtitle {
    grid-column: 2;
    grid-row: 2;
    font: 500 16px/1.2 -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
    color: #cbd5e1;
}

html:not(.dark) .title-grid .subtitle {
    color: #4b5563;
}

.title-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    /* logo | text */
    grid-template-rows: auto auto;
    column-gap: 8px;
    align-items: end;
}

.title-grid .logo-math {
    grid-column: 1;
    grid-row: 1 / 3;
    /* span both rows */
}

.title-grid .title-text {
    grid-column: 2;
    /* same column */
    grid-row: 1;
    justify-self: start;
    /* or center/end */
}

.title-grid .subtitle {
    grid-column: 2;
    /* same column */
    grid-row: 2;
    justify-self: start;
    /* align exactly under title; use center if you want centered */
    margin-top: 2px;
    /* tiny spacing */
}


.fa-paper-plane {

    color: #ff6b35;
    cursor: pointer;
    font-size: 20px;
}

/* =========================
   Chat column
   ========================= */
.chat-container {
    width: 100%;
    max-width: 700px;
    position: relative;
}

/* Model info chip */
.model-info {
    /* position: absolute; */
    right: 0;
    /* top: -40px; */
    color: #666;
    font-size: 14px;
    /* display: flex; */
    /* align-items: center; */
    gap: 8px;
    text-align: center;
}

/* Suggestions row */
.suggestions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    flex-wrap: wrap;
    justify-content: center;
    flex-direction: column;
}

.suggestion {
    background: white;
    border: none;
    padding: 12px 20px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    color: #333;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s;


}



.suggestion:hover {
    transform: translateY(-2px);
}

/* =========================
   Composer (input area)
   ========================= */
.input-wrapper {
    background: #fff;
    border-radius: 15px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    position: relative;
    padding: 18px 60px 18px 24px;
    border: 1px solid lightgray;
}

textarea {
    width: 100%;
    height: 60px;
    border: none;
    outline: none;
    font-size: 16px;
    font-family: inherit;
    resize: none;
    background: transparent;
    overflow: hidden;

    /* no tiny scrollbar */
}

textarea::placeholder {
    color: #666;
}

.input-icons {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    gap: 12px;
}

.icon {
    width: 20px;
    height: 20px;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.icon:hover {
    opacity: 1;
}

/* =========================
   Conversation (messages list)
   ========================= */
.conversation {
    /* Use browser/page scroll — no inner scrollbars */
    overflow: visible;
    max-height: none;

    /* margin-bottom: 50px; */
    border-radius: 12px;

    /* Ensure last message isn’t hidden behind fixed composer */
    /* padding-bottom: 132px; */
    /* ≈ composer height + air */
}


/* Base message styling */
.conversation {
    unicode-bidi: plaintext;
    /* better mixed LTR/RTL handling */
}

/* RTL computed direction (even if dir="auto") */
.bubble:dir(rtl),
.bubble-plain:dir(rtl) {
    padding-inline-start: 16px;
    /* right side in RTL */
    padding-inline-end: 0;
}

/* If you want extra space inside rows too */
.bubble:dir(rtl) .msg-row,
.bubble-plain:dir(rtl) .msg-row {
    padding-right: 8px;
}

/* Keep math LTR even inside RTL bubbles */
.bubble:dir(rtl) .katex,
.bubble:dir(rtl) .katex-display,
.bubble:dir(rtl) .katex-html {
    direction: ltr;
    unicode-bidi: isolate;
    text-align: left;
    /* optional for display math */
}





body.chat-started .conversation {
    margin-bottom: 50px;
}

/* =========================
   Messages / Bubbles
   ========================= */
.user-message,
.ai-response {
    margin: 10px 0;
    padding: 10px 14px;
    border-radius: 16px;
    max-width: 85%;
}

.user-message {
    background: #dbeafe;
    /* light blue */
    margin-left: auto;
    /* right align */
}

.ai-response {
    background: #f3f4f6;
    /* light gray */
    margin-right: auto;
    /* left align */
    max-width: 100%;
    /* fill the column like the input */
    white-space: pre-wrap;
    /* <-- critical */
    line-height: 1.6;
}

.bubble {
    display: block;
    width: 100%;
    white-space: pre-line;
    /* preserve \n from JSON as real line breaks */
    line-height: 1.6;
    /* readability */
    font-size: 16px;
}

.message-label {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 4px;
}

/* Paragraph / block spacing (avoid span to not affect KaTeX) */
.bubble p+p,
.bubble ul,
.bubble ol,
.bubble pre,
.bubble blockquote {
    margin-top: 0.5em;
}

/* =========================
   Chat-started state
   ========================= */
body.chat-started {
    justify-content: flex-start;
    /* push layout to top once chat begins */
}

/* Hide header extras (no gap left) */
body.chat-started .greeting,
body.chat-started .suggestions,
body.chat-started .model-info {
    display: none !important;
}

/* Use page (browser) scroll, not a 100vh flex column */
body.chat-started .chat-container {
    display: block !important;
    height: auto !important;
}

/* Center the card itself + center its inner content */
#composer #addImage {
    /* your existing styles ... */

    margin: 0 auto;
    /* horizontally center the box */
    min-height: 50px;
    /* give it height so vertical centering is visible */

    display: flex;
    /* center the contents */
    align-items: center;
    /* vertical */
    justify-content: center;
    /* horizontal */
    text-align: center;
    /* inline text/icons */

    border: 1px dashed #c9c9c9;
    border-bottom: 0;
    border-radius: 12px;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    padding: 14px;
    background: #fafafa;
    width: 90%;


}



/* Pin composer to viewport bottom, centered to the 700px column */
body.chat-started #composer-stack {
    position: fixed !important;
    left: 50%;
    transform: translateX(-50%);
    bottom: 30px;
    width: calc(100% - 40px);
    /* match body side padding (20px each) */
    max-width: 700px;
    /* align with .chat-container width */
    z-index: 100;
    /* background: #fff; */
    /* border-radius: 24px; */
    /* box-shadow: 0 -6px 20px rgba(0, 0, 0, 0.06); */
}

.conversation.has-messages {
    padding-bottom: 185px;
    /* composer height + breathing room */
}

body>header {
    position: fixed;
    top: 12px;
    left: 0;
    right: 0;
    z-index: 200;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 8px 20px;
    pointer-events: none;
    /* let clicks pass except on links */
}

body>header nav {
    display: flex;
    gap: 12px;
    align-items: center;
    font-family: inherit;
    pointer-events: auto;
    /* re-enable on the nav itself */
}

body>header nav a {
    text-decoration: none;
    color: #333;
    font-weight: 600;
    padding: 8px 12px;
    /* border-radius: 999px; */
    /* border: 1px solid #ff6b35; */
    /* background: #fff; */
    /* box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06); */
}

body>header nav a:last-child {
    border: 1px solid #ff6b35;
    /* background-color: #ff6b35; */
    color: #ff6b35;
    border-radius: 10px;
    font-weight: 700;
}

body.chat-started>header {
    /* keep header visible after chat starts */
    top: 8px;
}

summary {

    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    /* background: #fff; */
    /* border: 1px solid lightgray; */
    /* box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08); */
    padding: 10px 14px;
    /* border-radius: 12px; */
    font-weight: 600;
    color: #333;
}

/* Make the math pill span the input width (leaving room for send icons) */
#math-input {
    position: absolute;
    left: 24px;
    right: 24px;
    /* keep clear of the send button/icons on the right */
    bottom: 12px;
    margin: 0 !important;
    z-index: 1300;
}

#math-input>summary {
    display: inline-flex;
    /* shrink to content */
    align-items: center;
    gap: 6px;
    padding: 4px 8px !important;
    /* ↓ smaller */
    font-size: 12px !important;
    /* ↓ smaller text */
    line-height: 1.1;
    border-radius: 8px !important;
    /* ↓ smaller corners */
    white-space: nowrap;
    /* keep on one line */
}

/* Open the keypad DOWNWARD and match the input width */
#math-input .kb-panel {
    position: absolute;
    top: calc(60%);
    /* ⬅️ below the pill */
    left: 0;
    right: 0;
    /* stretch to the same width as #math-input */
    /* bottom: auto; */
    /* no upward anchoring */

    background: #fff;
    border: 1px solid #eaeaea;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    padding: 10px;

    min-width: 260px;
    width: 100% !important;
    /* your requested min width */
    max-width: none;
    /* cap at input width */
    /* width: auto; */
    /* fill available space */
}

/* Only show when open (keep your existing rule) */
#math-input:not([open]) .kb-panel {
    display: none;
}

/* (Optional) ensure the wrapper doesn't clip the popover */
.input-wrapper {
    overflow: visible;
}


/* nicer key buttons (if you didn't inline styles) */
#math-input .keys button {
    border: 1px solid #eee;
    background: #fff;
    border-radius: 8px;
    padding: 6px 8px;
    cursor: pointer;
}

/* When the composer stack is fixed at the bottom, open UP instead */
body.chat-started #composer-stack #math-input .kb-panel {
    top: auto;
    bottom: calc(100% + 70px);

    /* pop above the pill */
    max-height: 40vh;
    /* avoid overflowing the viewport */
    overflow: auto;
    z-index: 999;
    /* stay above the input wrapper */
}

.input-wrapper textarea {

    /* send icon space */
    margin-bottom: 20px;
    /* f(x) pill space */
    box-sizing: border-box;
}

/* Pin ONLY the Models <select> to the top-left of the page */
/* Top-left floating model picker */
.model-picker {
    position: fixed;
    top: 20px;
    left: 80px;
    z-index: 220;
    /* above page chrome, below modals */
    font-family: inherit;
}

/* Summary “button” */
.model-picker>summary {
    list-style: none;
    user-select: none;
    display: flex;
    gap: 8px;
    align-items: baseline;
    padding: 10px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    cursor: pointer;
}

.model-picker>summary::-webkit-details-marker {
    display: none;
}

.model-picker .mp-title {
    font-weight: 700;
    color: #374151;
}

.model-picker .mp-current {
    color: #6b7280;
    font-weight: 600;
}

/* Dropdown card */
.model-picker[open] .mp-menu {
    margin-top: 8px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
    padding: 8px;
    min-width: 260px;
}

/* Items */
.mp-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    /* radio, texts, check */
    align-items: start;
    gap: 10px;
    padding: 10px 8px;
    border-radius: 10px;
    cursor: pointer;
}

.mp-item:hover {
    background: #f9fafb;
}

.mp-item+.mp-item {
    margin-top: 2px;
}

/* Hide native radio visually, keep accessible */
.mp-item>input {
    margin-top: 2px;
    appearance: none;
    width: 14px;
    height: 14px;
    border: 1px solid #cbd5e1;
    border-radius: 50%;
    position: relative;
}

.mp-item>input:checked {
    border-color: #111827;
}

.mp-item>input:checked::after {
    content: "";
    position: absolute;
    inset: 3px;
    border-radius: 50%;
    background: #111827;
}

/* Two-line text */
.mp-texts {
    line-height: 1.25;
}

.mp-line1 {
    font-weight: 600;
    color: #111827;
}

.mp-line2 {
    font-size: 12px;
    color: #6b7280;
}

/* Checkmark on selected */
.mp-check {
    visibility: hidden;
    color: #111827;
    font-weight: 700;
}

.mp-item>input:checked~.mp-check {
    visibility: visible;
}

/* Upgrade pill */
.mp-pill {
    font-size: 11px;
    font-weight: 700;
    border: 1px solid #e5e7eb;
    color: #111827;
    padding: 2px 8px;
    border-radius: 999px;
    margin-left: 6px;
}

.signOut {


    color: #111827 !important;
    border: 1px solid rgb(229, 231, 235);
    border-radius: 10px;
}

:root {
    --panel: #fff;
    --text: #111;
    --muted: #6b7280;
    --border: #e5e7eb;
    --primary: #ef4444;
    --primary-600: #1d4ed8;
    --danger: #ef4444;
    --sidebar: #f8fafc;
    --footer-h: 44px;
    /* footer height (tweak if your footer is taller/shorter) */
    --composer-gap: 12px;
}

/* Modal root */
#settings-modal[hidden] {
    display: none;
}

#settings-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    /* covers whole screen */
}

/* Close button fixed to screen corner */
#settings-modal .close-global {
    position: fixed;
    top: 10px;
    right: 20px;
    z-index: 10001;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 0;
    background: #fff;
    color: #111;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    /* box-shadow: 0 6px 18px rgba(0, 0, 0, .12); */
}

#settings-modal .close-global:hover {
    background: #f9fafb;
}

/* Panel spans entire viewport */
.settings-panel {
    position: fixed;
    inset: 0;
    background: var(--panel);
    color: var(--text);
    display: grid;
    grid-template-columns: 280px 1px 1fr;
    height: 100vh;
    width: 100vw;
}

/* Left sidebar + divider + content */
.settings-sidebar {
    background: var(--sidebar);
    display: flex;
    flex-direction: column;
}

.settings-divider {
    background: var(--border);
}

.settings-content {
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: auto;
}

/* Sidebar header */
.settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    /* border-bottom: 1px solid var(--border); */
}

/* Vertical tabs */
.tabs--vertical {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 12px;
}

.tabs--vertical [role="tab"] {
    text-align: left;
    /* background: #fff; */
    border: 0;
    padding: 10px 12px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    color: #374151;
}

.tabs--vertical [role="tab"][aria-selected="true"] {
    background: #e8f0ff;
    border-color: #c7d2fe;
    color: #111;
}

/* Panels/content */
[role="tabpanel"] {
    padding: 18px 20px;
    outline: none;
}

/* Inputs */
.form-row {
    display: grid;
    gap: 6px;
    margin-bottom: 14px;
}

.form-row label {
    font-weight: 600;
    color: #111;
}

.form-row input,
.form-row select {
    background: #fff;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    padding: 10px 12px;
    font: inherit;
}

.form-row input:focus,
.form-row select:focus {
    border-color: #93c5fd;
    outline: none;
    box-shadow: 0 0 0 3px rgba(147, 197, 253, .35);
}

.choice {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    color: #111;
}

.hint {
    color: var(--muted);
    margin: 6px 0 16px;
}

.actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.primary,
.secondary,
.danger {
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid transparent;
    cursor: pointer;
    font-weight: 600;
}

.primary {
    background: var(--primary);
    color: #fff;
}

/* .primary:hover {
            background: var(--primary-600);
        } */

.secondary {
    background: #fff;
    color: #111;
    border-color: var(--border);
}

.secondary:hover {
    background: #f9fafb;
}

.danger {
    background: #fff;
    color: #ef4444;
    border-color: #fecaca;
}

.danger:hover {
    background: #fff1f2;
}

/* Plans */
.billing-toggle {
    display: inline-flex;
    border: 1px solid var(--border);
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 14px;
    background: #fff;
}

.toggle-btn {
    padding: 8px 14px;
    border: 0;
    background: transparent;
    cursor: pointer;
    font-weight: 600;
}

.toggle-btn.is-active {
    background: #111;
    color: #fff;
}

.save-pill {
    background: #dcfce7;
    color: #166534;
    padding: 2px 6px;
    border-radius: 999px;
    font-size: .75rem;
    margin-left: 6px;
}

.plans {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 14px;
    margin-bottom: 16px;
}

.plan-card {
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 5px;
    background: #fff;
}

.plan-card--highlight {
    border-color: #c7d2fe;
    box-shadow: 0 8px 24px rgba(37, 99, 235, .12);
}

.plan-card header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}

.plan-card h3 {
    margin: 0;
    font-size: 1.1rem;
}

.price {
    margin: 0;
    font-weight: 700;
}

.price .amount {
    font-size: 1.25rem;
    margin-right: 4px;
}

.price .per {
    color: #6b7280;
}

.features {
    margin: 0 0 12px;
    padding-left: 18px;
    list-style: none;
}

.features li {
    margin: 4px 0;
}

.stack {
    margin-top: 8px;
    padding-top: 12px;
    /* border-top: 1px dashed var(--border); */
}

#conversation.has-messages {
    margin-top: 40px;
}

#app-settings summary {
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 8px;
    background: var(--panel, #fff);
    /* box-shadow: 0 6px 18px rgba(0, 0, 0, .08); */
}

/* dark theme */
html.dark #app-settings summary {
    border-color: #374151;
    background: #0f172a;
    box-shadow: 0 10px 28px rgba(0, 0, 0, .55);
}


@media all {

    .mode-btn {

        left: 175px !important;

    }

    .mode-btn-flashcard {

        left: 210px !important;

    }

    .tools-menu {

        left: 210px !important;

    }



    /* keep textarea stable */
    #userInput {
        resize: none !important;
        overflow: hidden;
        /* no extra bottom padding here—reserve space on the wrapper instead */
    }

    @supports (-webkit-touch-callout: none) {
        .model-picker.floating {
            left: 100px;
            bottom: 8px;
        }

    }

    /* 2) Pin the picker inside the wrapper */
    .model-picker.floating {
        position: absolute !important;
        left: 60px;
        /* just to the right of the keyboard button */
        bottom: 12px;
        top: auto !important;
        /* ← IMPORTANT: cancel any earlier 'top' */
        margin: 0 !important;
        z-index: 1900 !important;
    }



    /* tiny, button-like summary */
    .model-picker.floating>summary {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        padding: 4px 8px;
        border: 1px solid lightgray;
        border-radius: 4px;
        background: var(--panel, #fff);
        cursor: pointer;
        list-style: none;
        white-space: nowrap;
        font-size: 12px;
        box-shadow: none;
        margin-bottom: -2px;
    }

    .tools-summary,
    .model-picker.floating>summary {

        height: 25px;


    }

    /* menu overlays upward so the button doesn't move */
    .model-picker.floating .mp-menu {
        position: absolute !important;
        bottom: 100%;
        left: 0;
        margin-bottom: 6px !important;
        z-index: 2000;
    }

    .signOut {

        border: 0;
        border-radius: 0;
    }


}

#app-settings {
    position: fixed !important;
    left: auto !important;
    /* <-- UNSET the inline left:16px */
    bottom: auto !important;
    display: block !important;
    right: 585px !important;
    top: 20px !important;

}

#app-settings.has-messages {


    top: 17px !important;

}

@media (max-width: 1156px) {

    #app-settings {

        right: 120px !important;
        top: 22.2px !important;
    }

    .settings-sidebar {
        padding-bottom: 0;
        /* remove space reserved for the footer p */
    }

    .settings-sidebar>p {
        display: none !important;
        /* hide it on small screens */
        position: static;
        /* undo absolute positioning */
        left: auto;
        right: auto;
        bottom: auto;
        margin: 0;
    }

    .settings-panel {
        grid-template-columns: 1fr;
        /* stack */
    }

    .settings-sidebar {
        position: sticky;
        top: 0;
        z-index: 1;
        border-bottom: 1px solid var(--border);
    }

    .settings-divider {
        display: none;
    }

    /* Tabs become horizontal pills */
    .tabs--vertical {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 8px;
        padding: 12px 16px;
        background: var(--sidebar);
        border-top: 1px solid var(--border);
    }

    .tabs--vertical [role="tab"] {
        border-radius: 999px;
        padding: 8px 12px;
    }

    /* Content gets comfy padding */
    [role="tabpanel"] {
        padding: 16px;
    }

    /* Plan cards: single column on very narrow screens */
    .plans {
        grid-template-columns: 1fr;
    }

    /* Close button smaller */
    #settings-modal .close-global {
        top: 10px;
        right: 10px;
        width: 36px;
        height: 36px;
        font-size: 22px;
    }

    .settings-panel {
        /* keep it a grid, but define rows */
        grid-template-columns: 1fr;
        /* already there */
        grid-template-rows: auto 1fr;
        /* <-- sidebar fits content, content fills remainder */
        align-content: start;
        /* no vertical stretching of rows */
    }

    .settings-sidebar {
        position: sticky;
        /* you already set this */
        top: 0;
        align-self: start;
        /* don't stretch to 100vh */
    }

    /* Optional: trim extra spacing so the panel content hugs the tabs */
    .settings-header {
        margin: 0;
    }

    .tabs--vertical {
        margin: 0;
    }

    .settings-content {
        padding-top: 0;
    }

    [role="tabpanel"] {
        margin-top: 0;
    }
}


.footer-smallscreen {

    display: none;
}

@media (max-width: 657px) {


    .site-footer span {

        font-size: 11px;
    }

}


@media (max-width: 589px) {

    .site-footer span {

        font-size: 10px;
    }
}

@media (max-width: 550px) {

    .site-footer span {

        font-size: 12px;
    }

    .footer-items {

        display: none;
    }

    .footer-smallscreen {

        display: block;
    }
}

@media (max-width: 520px) {

    /* Trim paddings further */
    .settings-header {
        padding: 12px;
    }

    .tabs--vertical {
        padding: 10px 12px;
    }

    [role="tabpanel"] {
        padding: 12px;
    }

    .plan-card {
        padding: 12px;
    }



    .trust-badge-3,
    .parents-cta-3 {

        display: block !important;
    }

    .model-info {

        margin-bottom: 10px;
    }

    /* Center the whole title block */
    .title-grid {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        /* horizontal centering */
        justify-content: center !important;
        text-align: center !important;
        margin: 0 auto !important;
        padding: 0 !important;
    }

    /* Kill any old grid positioning */
    .title-grid .logo-math,
    .title-grid .title-text,
    .title-grid .subtitle {
        display: block !important;
        grid-column: auto !important;
        grid-row: auto !important;
        margin: 0 auto !important;
        /* centers the inline/block children */
    }


    .title-grid .title-text {

        font-size: 30px;
    }

    /* KaTeX spans need an inline-block to center nicely */
    .title-grid .katex,
    .title-grid .katex-html {
        display: inline-block !important;
        margin: 0 auto !important;
    }

    /* tighten vertical rhythm */
    .title-grid .title-text {
        margin-top: 4px !important;
    }

    .title-grid .subtitle {
        margin-top: 2px !important;
    }

}

@media(max-width: 492px) {



    .model-picker {

        top: 70px !important;

    }
}

/* Dark theme is applied when <html class="dark"> is present */
html.dark body {
    color: #e5e7eb;
    background-color: #0b1220;
    /* background-image:
        linear-gradient(rgba(255, 255, 255, 0.05) 3px, transparent 3px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.05) 3px, transparent 3px); */
}

/* Practice card picks up theme colors */
.practice-card {
    background: var(--panel) !important;
    color: var(--text) !important;
    border-color: var(--border) !important;
}

/* Choices readable in both themes */
.practice-card button[type="button"] {
    background: var(--panel) !important;
    color: var(--text) !important;
    /* border-color: var(--border) !important; */
}

/* Make steps/explanations + KaTeX inherit theme text color */
/* Steps container picks up theme */
.practice-steps {
    background: var(--panel) !important;
    color: var(--text) !important;
    border-color: var(--border) !important;
}

/* Each <details> card */
.practice-steps details {
    background: var(--panel) !important;
    border: 1px solid var(--border) !important;
    border-radius: 10px !important;
    padding: 8px 12px !important;
    margin: 10px 0 !important;
}

/* Summary/title + all text (including KaTeX) use theme color */
.practice-steps summary,
.practice-steps *,
.practice-steps .katex {
    color: var(--text) !important;
}

/* Tidy summary marker + hover (optional) */
.practice-steps summary::-webkit-details-marker {
    display: none;
}

.practice-steps summary {
    cursor: pointer;
    font-weight: 600;
    list-style: none;
}

.practice-steps details:hover {
    box-shadow: 0 2px 10px rgba(0, 0, 0, .06);
}

/* Keep disabled options fully visible */
.practice-card button[disabled] {
    opacity: 1 !important;
}

html.dark .greeting {
    color: #e5e7eb;
}

html.dark .model-info {
    color: #9ca3af;
}

html.dark .suggestion {
    background: #0f172a;
    color: #e5e7eb;
    border: 1px solid #374151;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .4);
}

html.dark .user-message {
    background: #1f2937;
    color: #e5e7eb;
}

html.dark .ai-response {
    background: #0f172a;
    color: #e5e7eb;
}

html.dark .input-wrapper {
    background: #0b1220;
    border-color: #374151;
    box-shadow: 0 4px 20px rgba(0, 0, 0, .6);
}

html.dark textarea {
    color: #e5e7eb;
}

html.dark textarea::placeholder {
    color: #9ca3af;
}

html.dark body>header nav a {
    color: #e5e7eb;
}

html.dark .signOut {
    color: #e5e7eb !important;
}

html.dark summary {
    background: #0f172a;
    border-color: #374151;
    color: #e5e7eb;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .5);
}

/* Model picker */
html.dark .model-picker>summary {
    background: #0f172a;
    border-color: #374151;
    color: #e5e7eb;
}

html.dark .model-picker[open] .mp-menu {
    background: #0f172a;
    border-color: #374151;
}

html.dark .mp-item:hover {
    background: #111827;
}

html.dark .mp-item>input {
    border-color: #475569;
}

html.dark .mp-line1 {
    color: #e5e7eb;
}

html.dark .mp-line2 {
    color: #9ca3af;
}

/* Settings modal: flip its CSS variables + pieces that used hard colors */
html.dark {
    --panel: #0b1220;
    --text: #e5e7eb;
    --muted: #9ca3af;
    --border: #374151;
    --sidebar: #0a0f1a;
}

html.dark #settings-modal .close-global {
    background: transparent;
    color: #e5e7eb;
    /* border: 1px solid #374151; */
}

html.dark .tabs--vertical [role="tab"] {
    background: #0f172a;
    border-color: #374151;
    color: #cbd5e1;
}

html.dark .tabs--vertical [role="tab"][aria-selected="true"] {
    background: #1f2937;
    border-color: #4f46e5;
    color: #fff;
}

html.dark .billing-toggle {
    background: #0f172a;
    border-color: #374151;
    color: white !important;
}

html.dark .toggle-btn.is-active {
    background: #2563eb;
    color: #fff;
}

html.dark .toggle-btn {

    color: white !important;
}

html.dark .plan-card {
    background: #0f172a;
}

html.dark .price .per {
    color: #9ca3af;
}

html.dark .form-row input,
html.dark .form-row select {
    background: #0f172a;
    border-color: #374151;
    color: #e5e7eb;
}

html.dark .form-row input:focus,
html.dark .form-row select:focus {
    border-color: #60a5fa;
    box-shadow: 0 0 0 3px rgba(96, 165, 250, .35);
}

/* Math keypad (overrides inline light styles) */
html.dark #math-input>summary {
    background: #0f172a !important;
    border-color: #374151 !important;
    color: #e5e7eb !important;
}

html.dark #math-input .kb-panel {
    background: #0f172a !important;
    border-color: #374151 !important;
}

html.dark #math-input .keys button {
    background: #111827 !important;
    border-color: #374151 !important;
    color: #e5e7eb !important;
}

html.dark .upgrade-link {

    color: #969faf !important;
}

/* Theme toggle button itself */
html.dark #theme-toggle {
    background: #0f172a;
    border-color: #374151;
    color: #e5e7eb;
}

.discord {

    text-decoration: none;
    color: #374151;
    border: 1px solid rgb(229, 231, 235);
    border-radius: 10px;
}

.r-toast-root {
    position: fixed;
    left: 50%;
    bottom: 16px;
    transform: translateX(-50%);
    z-index: 10050;
    display: grid;
    gap: 8px;
    width: min(92vw, 560px);
    pointer-events: none;
}

.r-toast {
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 10px;
    background: #fff;
    color: #111;
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 12px;
    padding: 10px 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .16);
    animation: toast-in .25s ease;
}

.r-toast--success {
    border-left: 4px solid #16a34a;
}

.r-toast--error {
    border-left: 4px solid #ef4444;
}

.r-toast--info {
    border-left: 4px solid #2563eb;
}

.r-toast__msg {
    flex: 1;
    line-height: 1.4;
}

.r-toast__action {
    background: #111;
    color: #fff;
    border: 0;
    border-radius: 8px;
    padding: 6px 10px;
    cursor: pointer;
}

.r-toast__close {
    background: transparent;
    border: 0;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    color: inherit;
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

@keyframes toast-out {
    to {
        opacity: 0;
        transform: translateX(-50%) translateY(8px);
    }
}

/* Dark mode (compatible with your html.dark toggler) */
html.dark .r-toast {
    background: #0f172a;
    color: #e5e7eb;
    border-color: #374151;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .5);
}

.monthly-sub,
.changePassword {
    opacity: .5;
    /* fade it */
    cursor: not-allowed;
    /* show disabled cursor */
    filter: saturate(.8);
    /* optional: slightly desaturate */
}

.plan_name_container {

    border-top: 1px dashed #e4e6e9;
    border-bottom: 1px dashed #e4e6e9;
    padding-top: 20px;
    padding-bottom: 20px;

}

.trail-period {

    /* border-top: 1px dashed #e4e6e9; */
    border-bottom: 1px dashed #e4e6e9;
    padding-top: 20px;
    padding-bottom: 20px;

}

.settings-sidebar {
    position: relative;
    /* establish containing block */
    padding-bottom: 56px;
    /* space so content doesn't hide behind the footer p */
}

.settings-sidebar>p {
    position: absolute;
    left: 16px;
    /* tweak to your padding */
    right: 16px;
    bottom: 16px;
    /* distance from bottom */
    margin: 0;
}


/* Sticky footer note */
.site-footer {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    /* default when chat not started */
    /* below your composer (z=100) */
    text-align: center;
    padding: 8px 12px;
    font-size: 12px;
    color: #6b7280;
    pointer-events: auto;
    /* keeps clicks going to page */
    background: transparent;
    height: var(--footer-h);
    line-height: var(--footer-h);
    z-index: 120;
}

body.chat-started .site-footer {
    bottom: 0 !important;
}

.site-footer a,
.site-footer a:link,
.site-footer a:visited {
    color: inherit !important;
    /* or set a hex color you want */
    text-decoration: none !important;
    /* keeps underline off */
}

.site-footer a:hover,
.site-footer a:focus {
    text-decoration: underline;
    /* optional hover style */
}

/* Dark theme color */
html.dark .site-footer {
    color: #9ca3af;

}


/* No bubble chrome for notices */
.bubble-plain,
.notice-row .bubble {
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    padding: 0 !important;
}

/* Center the notice row and hide any label just in case */
.notice-row {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.notice-row .message-label {
    display: none !important;
}

/* Optional: constrain width so your inline <small> looks tidy */
.notice-row .bubble-plain {
    max-width: 820px;
    width: 100%;
}



/* optional: nicer ordered lists from markdown */
.ai-response .bubble ol {
    padding-left: 1.25rem;
}

.ai-response .bubble ul {
    padding-left: 1.25rem;
}

/* B) Hide iOS Safari disclosure arrow on all relevant <summary> */
.model-picker>summary::-webkit-details-marker,
#math-input>summary::-webkit-details-marker,
summary::-webkit-details-marker {
    display: none !important;
}

/* also suppress list-style bullets some browsers show */
.model-picker>summary,
#math-input>summary,
summary {
    list-style: none;
}

/* Safari-only override: avoid fixed+transform glitch */
@supports (-webkit-hyphens: none) {
    body.chat-started #composer-stack {
        left: 0;
        right: 0;
        transform: none;
        /* <-- key fix */
        margin-left: auto;
        margin-right: auto;
    }
}



/* nuke all shadows on the component */
.upgrading-msg,
.upgrading-msg *,
.upgrading-msg::before,
.upgrading-msg::after {
    box-shadow: none !important;
    /* replaces 0 */
    text-align: center !important;
    text-shadow: none !important;
    /* if text looks glowy */
    filter: none !important;
    /* kills drop-shadow() */
    outline: none !important;
    /* focus outline */
    text-align: center;
    --tw-shadow: 0 0 #0000 !important;
    /* Tailwind shadow var */
    --tw-ring-shadow: 0 0 #0000 !important;
    /* Tailwind ring var */
    --tw-ring-offset-shadow: 0 0 #0000 !important;

}

/* placement + look */
.suggestion.upgrading-msg {
    margin-top: 10px;
    text-align: right;
}

/* link styling */
.upgrade-link {
    font-size: 13.5px;
    font-weight: 500;
    color: #4B5563;
    /* slate-600 */
    text-decoration: none;
}

.upgrade-link:hover {
    /* color: #111827; */
    text-decoration: underline;
}

/* Default: center above the trigger */
.tooltip {
    position: relative;
    display: inline-block;
}

/* .tooltip::after {
    content: attr(data-tip);
    position: absolute;
    left: 50%;

    bottom: 140%;
 
    transform: translateX(-50%) translateY(6px);
    background: #111827;
    color: #fff;
    padding: 8px 10px;
    border-radius: 8px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .15);
    z-index: 50;
    font-size: 12.5px;
    line-height: 1.25;
    opacity: 0;
    pointer-events: none;
    transition: opacity .15s ease, transform .15s ease;


    max-width: min(320px, calc(100vw - 24px));
    white-space: normal;

    text-align: center;
} */

/* .tooltip::before {
    content: "";
    position: absolute;
    left: 50%;
    bottom: calc(140% - 6px);
    transform: translateX(-50%) translateY(6px);
    border: 6px solid transparent;
    border-top-color: #111827;
    opacity: 0;
    transition: opacity .15s ease, transform .15s ease;
} */

.tooltip:hover::after,
.tooltip:hover::before,
.tooltip:focus-within::after,
.tooltip:focus-within::before {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Small screens: if space is tight above, show BELOW, centered full-width-ish */
@media (max-width: 480px) {
    .tooltip::after {
        bottom: auto;
        top: 120%;
        left: 50%;
        transform: translateX(-50%) translateY(-6px);
        max-width: calc(100vw - 24px);
    }

    .tooltip::before {
        bottom: auto;
        top: calc(120% - 6px);
        left: 50%;
        transform: translateX(-50%) translateY(-6px);
        border-top-color: transparent;
        border-bottom-color: #111827;
        /* arrow points up when tooltip is below */
    }


    #addImage label span:first-child {
        display: none;
    }

    #addImage label span:last-child {
        display: none;
    }

    #addImage label::before {
        content: "\f083";
        /* camera-retro */
        font-family: "Font Awesome 6 Free";
        font-weight: 900;
        font-size: 18px;
        /* margin-right: 8px; */
    }

    #addImage label::after {
        content: "Tap to select or take a photo";
        /* font-size: 15px; */
        /* color: #666; */
    }
}


/* Ultra-small screens: show ABOVE again */
@media (max-width: 348px) {
    .tooltip::after {
        top: auto;
        /* undo 480px rule */
        bottom: 140%;
        /* place above */
        left: 50%;
        transform: translateX(-50%) translateY(6px);
        max-width: calc(100vw - 16px);
        /* a bit tighter padding on tiny screens */
    }

    .tooltip::before {
        top: auto;
        /* undo 480px rule */
        bottom: calc(100% - 6px);
        left: 50%;
        transform: translateX(-50%) translateY(6px);
        border-bottom-color: transparent;
        /* arrow points down when above */
        border-top-color: #111827;
    }

    /* optional: shrink font slightly on very small screens */
    .tooltip::after {
        font-size: 12px;
    }
}

@media(max-width: 328px) {


    #addImage label {
        flex-direction: column;
    }

    #addImage label::before {
        display: block;
        margin: 0 0 6px 0;
        line-height: 1;
    }

    #addImage label::after {
        display: block;
        text-align: center;
        /* font-size: 12px; */
        line-height: 1.2;
    }


}

/* Short landscape: remove giant top gap */
@media (orientation: landscape) and (max-height: 603px) {
    body {
        /* kill the 40px top padding in this mode */
        padding: 12px 12px 20px 12px !important;
        justify-content: flex-start;
        /* keep content visible */
    }

    .greeting {
        margin-top: 0 !important;
        padding-top: clamp(4px, env(safe-area-inset-top, 0px), 10px) !important;
    }
}

/* Dock summary near the send icon */
.tool-menu {
    position: absolute;
    right: 56px;
    /* just left of the send icon */
    bottom: 12px;
    z-index: 1300;
}

/* Summary button */
.tool-summary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px;
    padding-left: 8px;
    font-size: 12px;
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    user-select: none;
}

/* ↓ OPEN DOWNWARD (below the summary) */
.tool-panel {
    position: absolute;
    top: 120%;
    /* ⬅️ open below */
    right: 0;
    background: #fff;
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .12);
    padding: 8px;
    min-width: 180px;
    max-height: 40vh;
    /* avoid overflow if near viewport bottom */
    overflow: auto;
}

.tool-menu:not([open]) .tool-panel {
    display: none;
}

/* Items */
.tool-item {
    display: block;
    width: 100%;
    text-align: left;
    background: #fff;
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 8px 10px;
    cursor: pointer;
    font: inherit;
}

.tool-item:hover {
    background: #f9fafb;
}

/* Selected state */
.tool-item[aria-checked="true"] {
    border-color: #c7d2fe;
    background: #eef2ff;
    font-weight: 600;
}

/* Dark theme mirrors */
html.dark .tool-summary {
    background: #0f172a;
    color: #e5e7eb;
    border-color: #374151;
}

html.dark .tool-panel {
    background: #0f172a;
    color: #e5e7eb;
    border-color: #374151;
}

html.dark .tool-item {
    background: transparent;
    color: #e5e7eb;
}

html.dark .tool-item:hover {
    background: #111827;
}

html.dark .tool-item[aria-checked="true"] {
    background: #1f2937;
    border-color: #4f46e5;
}

/* Keep it sensible on small screens */
@media (max-width:520px) {
    .tool-menu {
        right: 48px;
    }

    /* 
    .greeting {

        margin-top: 70px !important;


    } */
}

/* Default: open downward */
.tool-panel {
    position: absolute;
    top: 120%;
    bottom: auto;
    /* <— important */
    right: 0;
}

/* When conversation has messages → open upward */
.conversation.has-messages~#composer .tool-menu .tool-panel {
    top: auto;
    bottom: 120%;
}

#log {
    white-space: pre-wrap;
    font: 12px ui-monospace, monospace;
    color: #a6b2d1;
    background: #0f0f23;
    border: 1px solid #2b2b40;
    border-radius: 8px;
    padding: 10px;
    max-height: 260px;
    overflow: auto
}

a[download] {
    display: none
}

.progress {
    height: 10px;
    background: #2b2b40;
    border-radius: 999px;
    overflow: hidden
}

.progress .bar {
    height: 100%;
    width: 0%;
    background: #00d9ff;
    transition: width .2s ease
}

#player {
    width: 100%;
    max-width: 960px;
    border-radius: 10px;
    display: none
}

.row {
    display: flex;
    gap: 10px;
    align-items: center
}

/* Offscreen one-time line renderer */
#lineRenderStage {
    position: absolute;
    left: -9999px;
    top: -9999px;
    width: var(--w);
    padding: 0;
    margin: 0
}

/* Force light text for offscreen snapshots so html2canvas captures visible glyphs */
#lineRenderStage,
#lineRenderStage .katex,
#lineRenderStage .katex * {
    color: #eaeaf0 !important;
}

/* Video-only sizing: make rendered math/text larger inside the snapshot stage */
#lineRenderStage .katex {
    font-size: 2.6em !important;
    /* try 2.4–2.8em to taste */
}

#lineRenderStage .katex * {
    font-size: inherit !important;
    /* prevent KaTeX children from double-scaling */
}

#lineRenderStage .text {
    font-size: 26px !important;
    /* was ~22px in your demo */
    line-height: 1.5 !important;
}


/* Inline content for rasterization (no inline numbers) */
.line {
    width: calc(var(--w) - 40px);
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 0;
    margin: 0;
    background: transparent;
}

.katex {
    font-size: 2.2em
}

.text {
    font-size: 22px;
    line-height: 1.4;
    white-space: pre-wrap
}

.card {
    background: #1a1a2e;
    border: 1px solid #24324d;
    border-radius: 10px;
    padding: 16px
}

.pricing-container {
    display: flex;
    gap: 24px;
    max-width: 1200px;
    width: 100%;
    flex-wrap: wrap;
    justify-content: center;
}

.pricing-card {
    background: #ffffff;
    /* border: 1px solid rgba(255, 255, 255, 0.1); */
    border-radius: 16px;
    padding: 32px;
    flex: 1;
    min-width: 280px;
    max-width: 400px;
    position: relative;
    color: black;
}

html.dark .pricing-card {
    background: rgba(30, 35, 50, 0.9);
    color: white;
}

.card-header {
    margin-bottom: 24px;
}

.plan-name {
    /* color: #ffffff; */
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.popular-badge {
    background: #ff6b35;
    /* color: white; */
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.price {
    display: flex;
    align-items: baseline;
    gap: 4px;
    margin-bottom: 12px;
}

.price-amount {
    /* color: #ffffff; */
    font-size: 56px;
    font-weight: 700;
    line-height: 1;
}

.price-currency {
    /* color: #ffffff; */
    font-size: 18px;
    font-weight: 500;
}

.price-period {
    /* color: rgba(255, 255, 255, 0.7); */
    font-size: 14px;
}

.plan-description {
    /* color: rgba(255, 255, 255, 0.8); */
    font-size: 15px;
    margin-bottom: 24px;
}

.cta-button {
    width: 100%;
    background: #ff6b35;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 14px 24px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 24px;
}

.cta-button:hover {
    background: #ff5722;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.4);
}

.features-list {
    list-style: none;
}

.feature-item {
    /* color: rgba(255, 255, 255, 0.8); */
    font-size: 14px;
    padding: 12px 0;
    display: flex;
    align-items: center;
    gap: 12px;
    /* border-bottom: 1px solid lightgray !important; */
}

.feature-item:last-child {
    border-bottom: none;
}

.feature-icon {
    width: 20px;
    height: 20px;
    opacity: 0.6;
}

.section-title {
    /* color: #ffffff; */
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 12px;
    margin-top: 8px;
}

@media (max-width: 768px) {
    .pricing-container {
        flex-direction: column;
    }

    .pricing-card {
        max-width: 100%;
    }
}



html.dark .plan-card {
    background: rgba(30, 35, 50, 0.9);
}

/* Layout for the plans inside the settings modal */
#settings-modal .plans {
    display: flex !important;
    justify-content: center !important;
    /* center horizontally */
    align-items: center !important;
    /* center vertically */
    gap: 24px !important;
    flex-wrap: wrap !important;
    width: 100% !important;
    margin: 0 auto !important;
    /* padding: 8px 0 !important; */
    min-height: auto !important;
}

/* Make each card a tidy block and center its content */
#settings-modal .plan-card {
    flex: 0 1 420px !important;
    /* target width; shrinks on small screens */
    max-width: 560px !important;
    text-align: center !important;
    align-self: center !important;
}

/* Keep the CTA/buttons centered inside cards */
#settings-modal .plan-card button {
    margin-left: auto !important;
    margin-right: auto !important;
    display: block !important;
}

/* Small screens: stack neatly with breathing room */
@media (max-width: 720px) {
    #settings-modal .plans {
        min-height: 0 !important;
        /* let content define height on phones */
        padding: 12px 0 !important;
    }

    #settings-modal .plan-card {
        flex-basis: 100% !important;
        max-width: 520px !important;
    }
}

/* Billing toggle affects layout around the cards, including Free */
#settings-modal .billing-toggle {
    display: flex !important;
    justify-content: center !important;
    /* horizontal center */
    align-items: center !important;
    /* vertical center */
    gap: 12px !important;
    width: 100% !important;
    border: 0;
    margin-top: 12px;
}

#settings-modal .billing-toggle+h3,
#settings-modal .billing-toggle+*:is(.plans, .plan-card, section) {
    margin-top: 0 !important;
}

/* Mobile: keep centered and allow wrapping if needed */
@media (max-width: 720px) {
    #settings-modal .billing-toggle {
        flex-wrap: wrap !important;
        min-height: 64px !important;
        gap: 10px !important;
    }
}

/* Keep buttons neat and consistent */
#settings-modal .billing-toggle .toggle-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 10px 16px !important;
    border-radius: 10px !important;
    font-weight: 600 !important;
    white-space: nowrap !important;
}

html.dark #settings-modal .billing-toggle {

    background-color: transparent;
}

/* Center the billing toggle (horiz + vert) */


/* Trusted badge block */
.trust-badge {
    margin-top: 10px;
    text-align: center;
    font-size: 13px;
    color: #4b5563;
    /* slate-600 */
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* Stars row */
.trust-stars {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    justify-content: center;
}

.trust-stars i {
    color: #f59e0b;
    /* amber-500 star color */
    font-size: 14px;
}

.trust-rating {
    margin-left: 4px;
    font-weight: 600;
    color: #374151;
}

/* Text line */
.trust-text strong {
    font-weight: 600;
}

/* Avatars row — overlapping like the screenshot */
.trust-avatars {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0;
    margin-top: 6px;
}

/* Circular avatars (using initials A/M/S for now) */
.trust-avatar,
.trust-avatar-main {
    width: 40px;
    height: 40px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    background: #e5e7eb;
    /* light circle */
    color: #374151;
    border: 2px solid #ffffff;
    /* white ring */
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.25);
    overflow: hidden;

    /* overlap effect */
    margin-left: -10px;
}

/* first one not shifted left */
.trust-avatar:first-child,
.trust-avatar-main:first-child {
    margin-left: 0;
}

/* special styling if later you use a real Gmail photo here */
.trust-avatar-main {
    border-width: 3px;
}

/* Dark theme: keep badge + avatars light and readable */
html.dark .trust-badge {
    color: #e5e7eb;
}

html.dark .trust-rating {
    color: #e5e7eb;
}

html.dark .trust-stars i {
    color: #fbbf24;
    /* brighter amber */
}

html.dark .trust-avatar,
html.dark .trust-avatar-main {
    background: #111827;
    color: #e5e7eb;
    border-color: #e5e7eb;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.7);
}

/* Make avatar images fill the circle */
.trust-avatar img,
.trust-avatar-main img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    /* removes weird inline spacing */
}

.parents-cta {
    margin-top: 12px;
    padding: 10px;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    border-radius: 8px;
    font-size: 13px;
    text-align: center;
    color: #9a3412;

}

.parents-link {
    font-weight: 600;
    color: #c2410c;
    text-decoration: underline;
    cursor: pointer;
}

.parents-link:hover {
    color: #9a3412;
}

/* ================
   Parents CTA – Dark Mode
   ================ */
html.dark .parents-cta {
    background: #1e293b;
    /* slate-800 */
    border: 1px solid #334155;
    /* slate-700 */
    color: #f8fafc;
    /* near-white */
}

html.dark .parents-link {
    color: #f97316;
    /* orange-500 */
}

html.dark .parents-link:hover {
    color: #fb923c;
    /* orange-400 */
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.modal {
    background: #ffffff;
    max-width: 420px;
    width: 90%;
    border-radius: 16px;
    padding: 24px 24px 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.18);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    text-align: left;
}

.modal h2 {
    margin-bottom: 8px;
    font-size: 22px;
    text-align: center;
}

.modal .modal-p {

    margin-bottom: 16px;
    font-size: 14px;
    line-height: 1.4;
    text-align: center;

}

.modal-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
}

#signupNowBtn {
    padding: 8px 16px;
    border-radius: 10px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    background-color: #FF6B35;
    color: white;
}

.model-discord {

    padding: 8px 16px;
    border-radius: 10px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    background-color: #4654C0;
    color: white;

}

.model-discord a {

    text-decoration: none;
    color: white;
}

#closeSignupModal.secondary {

    background: transparent;
    border: none;
    font-size: 13px;
    cursor: pointer;
    opacity: 0.8;
    border: 1px solid lightgray;
}


/* Dark mode for signup modal */
html.dark .modal-backdrop {
    background: rgba(15, 23, 42, 0.85);
}

html.dark .modal {
    background: #0f172a;
    color: #e5e7eb;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
}

html.dark .modal h2 {
    color: #f9fafb;
}

html.dark .modal p {
    color: #e5e7eb;
}

/* Keep primary button bright in dark mode */
html.dark #signupNowBtn {
    background-color: #ff6b35;
    color: #ffffff;
}

/* Tweak secondary button for dark background */
html.dark #closeSignupModal.secondary {
    background: transparent;
    border: 1px solid #4b5563;
    color: #e5e7eb;
    opacity: 0.9;
}

/* Video mode button – same level as math keyboard */
.mode-btn {
    position: absolute;
    left: 55px;
    bottom: 12px;
    /* same vertical level as #math-input pill */
    width: 30px;
    height: 23px;
    /* border-radius: 10px; */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    /* border: 1px solid #e5e7eb; */
    /* color: #ff6b35; */
    z-index: 1400;
    /* ⬅️ important: above #math-input (1300) */
    pointer-events: auto;
    /* border: 1px solid #E6E6E6; */
    border-radius: 8px;
    color: #4B5563;
}



.tools-summary {
    list-style: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px;
    border-radius: 5px;
    border: 0;
    /* background: #fff; */
    font-size: 12px;
    border: 1px solid lightgray;
}

.tools-summary::-webkit-details-marker {
    display: none;
}

/* instead of relative + inline-block */
.tools-menu {
    position: absolute;
    /* was: relative */
    left: 88px;
    /* adjust to where you want it */
    bottom: 10px;
    /* same vertical level as input */
    z-index: 1500;
}

/* keep the rest, just ensure it's anchored above the trigger */
.tools-panel {
    position: absolute;
    right: 0;
    bottom: calc(100% + 4px);
    /* opens upward above the tools button */
    padding: 6px 0;
    min-width: 140px;
    border-radius: 10px;
    border: 1px solid #e6e6e6;
    background: #fff;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
    z-index: 20;
}



.tools-link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    font-size: 13px;
    text-decoration: none;
    color: #111827;
}

.tools-link:hover {
    background: #f3f4f6;
}


.mode-btn-home {

    position: absolute;
    left: 20px;
    bottom: 9px;
    /* same vertical level as #math-input pill */
    width: 30px;
    height: 30px;
    /* border-radius: 10px; */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    /* border: 1px solid #e5e7eb; */
    color: #ff6b35;
    z-index: 1400;
    /* ⬅️ important: above #math-input (1300) */
    pointer-events: auto;
}

.mode-btn-flashcard-video {


    position: absolute;
    left: 55px;
    bottom: 12px;
    /* same vertical level as #math-input pill */
    width: 30px;
    height: 23px;
    /* border-radius: 10px; */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    /* border: 1px solid #e5e7eb; */
    color: #4B5563;
    z-index: 1400;
    /* ⬅️ important: above #math-input (1300) */
    pointer-events: auto;
    border: 1px solid #E6E6E6;
    border-radius: 8px;

}

.followup-on {
    border-color: #ff6b35 !important;
    background: #ff6b35 !important;
    color: white !important;
}

.followup-off {
    border-color: #ff6b35 !important;
    background: white !important;
    color: black !important;
}

@media (max-width: 538px) {

    .followup-on,
    .followup-off {

        margin-bottom: 10px;

    }
}

.feedback-modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.35);
    z-index: 9999;
}

.feedback-dialog {
    background: #fff;
    max-width: 420px;
    width: 90%;
    border-radius: 12px;
    padding: 16px 18px 18px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.18);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: #111827;
}

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

.feedback-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.feedback-close {
    border: none;
    background: transparent;
    font-size: 18px;
    cursor: pointer;
    line-height: 1;
    color: inherit;
}

.feedback-subtitle {
    margin: 0 0 10px;
    font-size: 13px;
    color: #555;
}

/* centered row, bigger stars */
.feedback-stars-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 10px;
    font-size: 13px;
    text-align: center;
}

.feedback-label {
    font-size: 13px;
    color: #444;
}

.feedback-stars {
    display: flex;
    gap: 4px;
    cursor: pointer;
    font-size: 50px;
    /* bigger stars */
}

.feedback-star {
    color: #999;
    user-select: none;
}

.feedback-current {
    font-size: 11px;
    color: #888;
}

.feedback-text-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 12px;
}

.feedback-text-row label {
    font-size: 15x;
    color: #444;
}

#feedbackText {
    width: 100%;
    resize: vertical;
    border-radius: 8px;
    border: 1px solid #ddd;
    padding: 6px 8px;
    font-size: 15px;
    font-family: inherit;
    background: #fff;
    color: #111827;
    height: 150px;
}

.feedback-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 4px;
}

.feedback-btn-secondary {
    border-radius: 999px;
    padding: 6px 12px;
    border: 1px solid #ddd;
    background: #fff;
    font-size: 13px;
    cursor: pointer;
    color: #111827;
}

.feedback-btn-primary {
    border-radius: 999px;
    padding: 6px 14px;
    border: none;
    background: #ff6b35;
    color: #fff;
    font-size: 13px;
    cursor: pointer;
}

/* dark theme when html has .dark like your body rule */
html.dark .feedback-modal {
    background: rgba(11, 18, 32, 0.9);
}

html.dark .feedback-dialog {
    background: #0b1220;
    color: #e5e7eb;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.9);
}

html.dark .feedback-subtitle {
    color: #9ca3af;
}

html.dark .feedback-label {
    color: #e5e7eb;
}

html.dark .feedback-star {
    color: #6b7280;
}

html.dark .feedback-current {
    color: #9ca3af;
}

html.dark #feedbackText {
    background: #020617;
    border-color: #374151;
    color: #e5e7eb;
}

html.dark .feedback-btn-secondary {
    background: #020617;
    border-color: #4b5563;
    color: #e5e7eb;
}

html.dark .feedback-btn-primary {
    background: #f97316;
}

html.dark .mode-btn {

    color: white;
}

/* Style all tables, td, and tr elements */
table {
    width: 100%;
    max-width: 400px;
    margin: 16px auto;
    border-collapse: collapse;
    border: 2px solid #e6e6e6;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
}

thead {
    background: #f8f9fa;
}

th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: #333;
    border-bottom: 2px solid #e6e6e6;
    border-right: 1px solid #e6e6e6;
}

th:last-child {
    border-right: none;
}

td {
    padding: 10px 16px;
    text-align: left;
    border-bottom: 1px solid #f0f0f0;
    border-right: 1px solid #f0f0f0;
    color: #555;
}

td:last-child {
    border-right: none;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover {
    background: #f8f9fa;
}

tbody tr:nth-child(even) {
    background: #fafafa;
}

/* SEO Content Section - shows after scrolling */

/* SEO Content - positioned below fold, doesn't affect layout */
.seo-content {
    position: absolute;
    top: 100vh;
    /* Start right below the viewport */
    left: 0;
    right: 0;
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    padding: 40px 20px;
    transform: translateY(30px);

}



/* Rest of your SEO styles stay the same */
.seo-hero {
    text-align: center;
    margin-bottom: 50px;
}

/* ... keep all other styles ... */

.seo-hero h2 {
    font-size: 32px;
    font-weight: 700;
    color: #111827;
    margin-bottom: 12px;
}

.seo-hero p {
    font-size: 18px;
    color: #6b7280;
    line-height: 1.6;
    max-width: 700px;
    margin: 0 auto;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 60px;
}

.feature-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

.feature-icon {
    font-size: 36px;
    color: #ff6b35;
    margin-bottom: 40px;
    /* Add these lines: */
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.feature-card h3 {
    font-size: 18px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 8px;
}

.feature-card p {
    font-size: 14px;
    color: #6b7280;
    line-height: 1.5;
}

.faq-section {
    margin-bottom: 60px;
}

.faq-section h2 {
    font-size: 28px;
    font-weight: 700;
    color: #111827;
    text-align: center;
    margin-bottom: 32px;
}

.faq-item {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    margin-bottom: 12px;
    /* overflow: hidden; */
}

.faq-question {
    width: 100%;
    text-align: left;
    background: transparent;
    border: none;
    padding: 18px 20px;
    font-size: 16px;
    font-weight: 600;
    color: #111827;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.faq-question:hover {
    background: #f9fafb;
}

.faq-icon {
    transition: transform 0.3s;
    color: #6b7280;
}

/* hide default marker */
.faq-question::-webkit-details-marker {
    display: none;
}

.faq-question::marker {
    content: "";
}

/* native <details> behavior */
.faq-answer {
    /* overflow: visible; */
    max-height: none;
    transition: none;
    margin-top: 10px;
}

/* rotate icon when open */
.faq-item[open] .faq-icon {
    transform: rotate(180deg);
}


.faq-answer p {
    padding: 0 20px 18px;
    color: #4b5563;
    line-height: 1.6;
    font-size: 15px;
}

.topics-section {
    text-align: center;
    margin-bottom: 40px;
}

.topics-section h3 {
    font-size: 20px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 20px;
}

.topics-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.topic-tag {
    background: #f3f4f6;
    color: #374151;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
}

html.dark .seo-hero h2 {
    color: #e5e7eb;
}

html.dark .seo-hero p {
    color: #9ca3af;
}

html.dark .feature-card {
    background: #0f172a;
    border-color: #374151;
}

html.dark .feature-card h3 {
    color: #e5e7eb;
}

html.dark .feature-card p {
    color: #9ca3af;
}

html.dark .faq-item {
    background: #0f172a;
    border-color: #374151;
}

html.dark .faq-question {
    color: #e5e7eb;
}

html.dark .faq-question:hover {
    background: #111827;
}

html.dark .faq-answer p {
    color: #9ca3af;
}

html.dark .topic-tag {
    background: #1f2937;
    color: #e5e7eb;
}

@media (max-width: 640px) {
    .seo-hero h2 {
        font-size: 24px;
    }

    .seo-hero p {
        font-size: 16px;
    }

    .features-grid {
        grid-template-columns: 1fr;
    }

    .faq-section h2 {
        font-size: 22px;
    }
}


body.scrolled-down #seoContent .faq-section {
    display: block;
}

body.chat-started #seoContent .faq-section {
    display: none !important;
}

.features-grid-how-to .feature-card {
    margin-top: 20px !important;

}

.features-grid-how-to {

    margin-bottom: 40px;
}

.examples-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
}

.example-card {
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 14px;
    padding: 14px;
    /* background: #fff; */
}

.example-label {
    font-weight: 700;
    margin-bottom: 8px;
}

.example-input code {
    display: block;
    padding: 10px 12px;
    border-radius: 10px;
    /* background: rgba(0, 0, 0, 0.04); */
    overflow-x: auto;
    font-weight: bold;
}

.examples-block,
.tasks-block {
    margin-top: 80px !important;
    margin-bottom: 80px;
}

.tasks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 18px;
}

.task-card {
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 14px;
    padding: 16px;
    background: #fff;
}

.task-card h3 {
    margin: 0 0 8px 0;
    font-weight: 700;
}

.task-card p {
    margin: 0;
    opacity: 0.9;
}

.trust-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.trust-logo {

    width: 140px;
    height: 32px;
}

.howto-section,
.examples-block,
.tasks-block {

    text-align: center;
}


/* Anti-blink protection for streaming tables */
/* Maximum anti-blink protection */
.ai-response[data-typing="1"] .bubble table {
    table-layout: fixed;
    opacity: 0.95;
    transform: translateZ(0);
    contain: strict;
    will-change: contents;
    backface-visibility: hidden;
    -webkit-font-smoothing: subpixel-antialiased;
    pointer-events: none;
    /* Prevent interaction during streaming */
    filter: blur(0.3px);
    /* Subtle blur masks the blink */
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

.ai-response .bubble table {
    opacity: 1;
    filter: blur(0);
    pointer-events: auto;
    transition: all 0.3s ease-in;
}

/* Force hardware acceleration on the entire bubble */
.ai-response[data-typing="1"] .bubble {
    transform: translateZ(0);
    will-change: contents;
}

.social-proof-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin: 14px 0 18px;
}

.stat-card {
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 14px;
    padding: 14px;
}

.stat-number {
    font-size: 24px;
    font-weight: 800;
    color: #111827;
    line-height: 1.1;
}

.stat-label {
    margin-top: 6px;
    font-size: 14px;
    color: #374151;
}

/* Dark mode wrapper (use whatever you already use: .dark, body.dark, [data-theme="dark"]) */
.dark .tasks-block .task-card,
.dark .social-proof .stat-card {
    background: #0F172A;
    border: 1px solid rgba(255, 255, 255, 0.10);
}

/* Text colors */
.dark .tasks-block .task-card h3,
.dark .tasks-block .task-card p,
.dark .social-proof .stat-label,
.dark .social-proof .stat-number {
    color: #f2f2f2;
}

/* Slightly muted paragraph text */
.dark .tasks-block .task-card p,
.dark .social-proof .stat-label {
    color: rgba(255, 255, 255, 0.78);
}

/* Icons in stats */
.dark .social-proof .stat-number i {
    color: rgba(255, 255, 255, 0.85);
}

/* Optional: make big number pop a bit */
.dark .social-proof .stat-number {
    font-weight: 700;
}

.dark .faq-section h2,
.dark .topics-section h3 {

    color: #f2f2f2;
}

body.chat-started .seo-content {

    display: none !important;
}

/* ONLY KEYBOARD STYLING - NO INPUT CHANGES */

/* Position toggle button at same level as other buttons */
.math-toggle-btn {
    position: absolute;
    left: 24px;
    bottom: 12px;
    width: 30px;
    height: 23px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    /* border: 1px solid #E6E6E6; */
    border-radius: 8px;
    background: #fff;
    color: #4B5563;
    cursor: pointer;
    z-index: 1400;
    font-size: 14px;
    border: 0;
    font-size: 20px;
    bottom: 11px;
    right: 20px;
}

.math-toggle-btn:hover {
    background: #f9fafb;
}

.math-toggle-btn.active {

    color: #ff6b35;

}

/* Keyboard panel - RESPONSIVE */
.math-keyboard {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    padding: 12px;
    width: 100%;
    margin: 0 auto;
    z-index: 1500;
}



.math-keyboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-weight: 600;
    font-size: 14px;
}

.math-close {
    background: transparent;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    line-height: 1;
}

.math-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(50px, 1fr));
    gap: 6px;
}

.math-buttons button {
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    font-size: 12px;
    padding: 4px 2px;
    /* Very tight horizontal padding */
    min-height: 36px;
    /* width: 50%; */
    box-sizing: border-box;
}

.math-buttons button .katex,
.math-buttons button .katex-display {
    margin: 0 !important;
    /* removes big empty margins */
    padding: 0 !important;

}

.math-buttons button .katex {

    line-height: 1;
}


@media (min-width: 400px) {
    .math-buttons {
        grid-template-columns: repeat(10, 1fr);
    }

    .math-buttons button {
        font-size: 13px;
    }
}

.math-buttons button:hover {
    background: #f3f4f6;
}

/* Dark mode */
html.dark .math-toggle-btn {
    background: #0f172a;
    border-color: #374151;
    color: #e5e7eb;
}

html.dark .math-keyboard {
    background: #0f172a;
    border-color: #374151;
}

html.dark .math-buttons button {
    background: #1e293b;
    border-color: #374151;
    color: #e5e7eb;
}

html.dark .math-buttons button:hover {
    background: #334155;
}

html.dark .math-close {
    color: #e5e7eb;
}

/* Math field wrapper styling */
.math-field-wrapper {
    display: inline-block;
    margin: 0 2px;
    padding: 2px 6px;
    background: #f0f9ff;
    border: 1px solid #3b82f6;
    border-radius: 4px;
    vertical-align: middle;
}

/* Remove MathQuill's default borders */
.math-field-wrapper .mq-editable-field,
.math-field-wrapper .mq-root-block,
.math-field-wrapper .mq-math-mode {
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    background: transparent !important;
}

.math-field-wrapper .mq-editable-field.mq-focused {
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
}

html.dark .math-field-wrapper {
    background: #1e293b;
    border-color: #3b82f6;
}

#richInput:empty:before {
    content: attr(placeholder);
    color: #666;
    pointer-events: none;
}

html.dark #richInput:empty:before {
    color: #9ca3af;
}

html.dark .math-field-wrapper {
    background: #1e293b;
    border-color: #3b82f6;
}

/* Add this for placeholder: */
#richInput:empty:before {
    content: attr(placeholder);
    color: #666;
    pointer-events: none;
}

html.dark #richInput:empty:before {
    color: #9ca3af;
}

/* switch button */
.kb-mode-switch {
    border: 1px solid #e5e7eb;
    background: #fff;
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 12px;
    cursor: pointer;
    color: #4B5563;
}

html.dark .kb-mode-switch {
    background: #0f172a;
    border-color: #374151;
    color: #e5e7eb;
}



@media (max-width: 420px) {
    .math-buttons {
        grid-template-columns: repeat(4, minmax(56px, 1fr));
    }
}


.kb-tabs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 6px 4px 10px 4px;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 10px;
}

.kb-tab {
    border: 1px solid #e5e7eb;
    background: #fff;
    border-radius: 5px;
    padding: 6px 10px;
    font-size: 15px;
    cursor: pointer;
    color: #111827;
    white-space: nowrap;
    font-weight: bold;
}

.kb-tab.active {
    background: #ff6b35;
    border-color: #ff6b35;
    color: #fff;
}

html.dark .kb-tabs {
    border-bottom-color: #374151;
}

html.dark .kb-tab {
    background: #0f172a;
    border-color: #374151;
    color: #e5e7eb;
}

.kb-panels {
    max-height: 160px;
    overflow-y: auto;
}

/* LEFT VERTICAL RAIL */
.side-rail {
    width: 64px;
    flex-shrink: 0;
    background: #050816;
    padding: 16px 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    position: fixed;
    height: 100%;
    z-index: 9999;
    left: 0;
    top: 0;

}

.side-rail-small {
    display: none;
    width: 64px;
    flex-shrink: 0;

    padding: 16px 8px;

    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    position: fixed;
    height: 100%;

    left: 0;

    top: 0;

}


/* Light mode: just a bit darker than the page, with a soft border */
html:not(.dark) .side-rail {
    background: #F9F9F9;
    backdrop-filter: saturate(120%) blur(2px);
    /* subtle depth (optional) */
}

/* Dark mode: a distinct slate tone, readable border */
html.dark .side-rail {
    background: rgba(2, 6, 23, 0.82);
    /* near #020617 */
    border-color: rgba(148, 163, 184, 0.20);
    /* slate-300-ish */
}

/* Mobile: hide desktop rail + side panel */
@media (max-width: 1260px) {

    .side-rail {
        display: none;
    }

    .side-rail-small {

        display: flex;
    }

    body.rail-open .side-rail {
        display: flex;
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        z-index: 1800;
        width: var(--rail-w);
        border-right: 1px solid #e5e7eb;
        background: var(--panel, #fff);
    }

    html.dark body.rail-open .side-rail {
        background: #0f172a;
        border-color: #374151;
    }
}

.sr-logo {

    color: #f97316;
    font-size: 20px !important;
    font-weight: bold;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: background 0.15s ease;

}


.sr-logo svg {
    filter:
        drop-shadow(0.5px 0 0 currentColor) drop-shadow(-0.5px 0 0 currentColor) drop-shadow(0 0.5px 0 currentColor) drop-shadow(0 -0.5px 0 currentColor);
}

.sr-main,
.sr-bottom {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.sr-main {
    margin-top: 40px;
    /* moves the 3 buttons a bit down from logo */
}

.sr-item a,
.sr-item .sr-sum {
    width: 40px;
    height: 40px;
    border-radius: 999px;
    border: 1px solid transparent;
    background: rgba(255, 187, 138, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #e5e7eb;
    font-size: 18px;
    transition: background 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
}

.sr-item a:hover {
    background: #fb923c;
    /* border-color: #4b5563; */
    transform: translateY(-1px);
}

#rail-profile {

    background-color: transparent;
    border: 0;
    /* margin-top: 20px; */
}

/* .profile-email-text{

    margin-top: 20px;
} */

.sr-item .fa-user-circle {
    color: #bd5704;

}

.sr-label {
    font-size: 10px;
    line-height: 1;

}

.sr-item .fa-infinity {

    color: #bd5704;

}

/* Add a parent rule */
.sr-item-wrap a,
.sr-item-wrap a:link,
.sr-item-wrap a:visited,
.sr-item-wrap a:hover {
    text-decoration: none !important;
}

.sr-item--primary {

    /* 80% opaque */
    color: #bd5704;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 0;
    background: transparent;

}




.sr-item.library {

    background: transparent;

}


/* lib has NO hover effect */
.sr-item.library:hover {
    /* background: #111827; */
    /* same as normal background */
    border-color: transparent;
    /* same as normal border */
    transform: none;
    /* no lift on hover */
}




.sr-item-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    margin-top: 20px;
    /* tight spacing under the circle */
}

.upgrade-text {

    margin-top: 10px;

}

html:not(.dark) .sr-item.library {

    color: #050816;
}

.sr-sum {
    font-size: 15px;
    line-height: 1;
}



/* space between logo and the 3 main buttons */
.sr-logo {
    margin-bottom: 12px;
    /* adjust: 8px / 16px if you want */
}

/* pin bottom icons to the bottom of the rail */
.sr-bottom {
    margin-top: auto;
    /* you already have this */
    padding-bottom: 20px;
    /* bump up amount */
    gap: 14px;
    /* optional spacing */
    align-items: center;
}

.fa-plus {
    font-size: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #bd5704;
}

.reload {
    text-decoration: none;
    color: #bd5704;
}

.reload:hover {
    background: #fb923c;
}

.library {
    text-decoration: none;
}

.tutorPage {
    text-decoration: none;
    color: black;
}

html.dark .tutorPage {
    color: white;
}

/* --- Profile popover --- */
.profile-popover {
    position: fixed;
    left: 72px;
    /* sits to the right of the rail */
    bottom: 18px;
    /* above the account button */
    z-index: 99999;
    width: 220px;
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 12px;
    background: #fff;
    color: #111;
    box-shadow: 0 16px 38px rgba(0, 0, 0, .15);
    padding: 8px;
}

.profile-popover[hidden] {
    display: none !important;
}

.profile-popover .pp-email {
    font: 600 12px/1.2 system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
    border-bottom: 1px dashed var(--border, #e5e7eb);
    padding: 8px 10px;
    margin-bottom: 6px;
    word-break: break-word;
    opacity: .85;
}

.profile-popover .pp-item {
    display: flex;
    gap: 8px;
    align-items: center;
    width: 100%;
    padding: 10px;
    border-radius: 8px;
    border: 0;
    background: transparent;
    color: inherit;
    cursor: pointer;
    text-align: left;
    font: 600 13px/1 system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
}

.profile-popover .pp-item:hover {
    background: rgba(0, 0, 0, .05);
}

.profile-popover .pp-item.danger {
    color: #b91c1c;
    text-decoration: none;
}

/* Dark mode */
html.dark .profile-popover {
    background: #0f172a;
    color: #e5e7eb;
    border-color: #374151;
    box-shadow: 0 16px 38px rgba(0, 0, 0, .45);
}

html.dark .profile-popover .pp-item:hover {
    background: rgba(255, 255, 255, .06);
}

.sr-history {
    width: 100%;
    margin-top: 14px;
}

.sr-history-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 10px;
    border-radius: 12px;
    cursor: pointer;
}

.sr-history-icon {
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    flex-shrink: 0;
    transform: translate(-6px);

}

.fa-comments {

    font-size: 20px;
    color: #bd5704;
}

.sr-history-title {
    font-size: 14px;
    font-weight: 600;
    overflow: hidden;
    white-space: nowrap;
    max-width: 0;
    opacity: 0;
}

.sr-history-list {
    margin-top: 8px;
    padding: 4px 6px;
    border-radius: 12px;

    overflow-y: auto;
    max-height: 0;
    opacity: 0;
    pointer-events: none;

    transition: max-height 300ms ease, opacity 300ms ease;
}

.sr-history-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 10px;
    border-radius: 10px;
    text-decoration: none;
    color: black;
}

html.dark .sr-history-item {

    color: white;
}

.sr-history-dot {
    width: 6px;
    height: 6px;
    border-radius: 999px;
    flex-shrink: 0;
}

.sr-history-text {
    font-size: 13px;
    line-height: 1.25;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;

}

/* default (closed) */
.social-row {

    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: center;
    width: 100%;


}

.social-row a {

    text-decoration: none;
}

/* open rail */
.side-rail.is-open .social-row {
    flex-direction: row;
    justify-content: flex-start;
    padding-left: 10px;
    margin-top: 20px !important;


}

.settings {

    font-size: 10px;
}

.tooltip {
    position: relative;
}

.tooltiptext {
    visibility: hidden;
    opacity: 0;
    width: 100px;
    background-color: #EE4444;
    color: white;
    text-align: center;
    border-radius: 6px;
    padding: 5px 0;
    position: absolute;
    left: 55px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    font-size: 14px;
    pointer-events: none;
    transition: opacity 0.2s ease;
    font-weight: bold;
}

.tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
}

/* when rail is open, never show tooltip */
.side-rail.is-open .tooltiptext {
    display: none;
}

.side-rail.no-tooltip .tooltiptext {
    display: none !important;
}

.es .tooltiptext {

    left: 43px;
}

.brand-name {

    font-size: 50px;
   

}