@import url('https://fonts.googleapis.com/css2?family=Baloo+2:wght@400..800&display=swap');

.MathJax {
    display: inline-block !important;
    max-width: 100% !important;
    vertical-align: middle !important;
}

mjx-container {
    max-width: 100% !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
}

* {
    box-sizing: border-box;
    font-family: "Baloo 2", sans-serif;
}

:root {
    --bg: #f4f7fb;
    --card: #ffffff;
    --border: #e3e9f2;
    --text: #0f172a;
    --muted: #64748b;
    --primary: #6657ff;
    --primary-soft: #eef0ff;
    --green: #10b981;
    --green-soft: #e9fff5;
    --shadow: 0 8px 22px rgba(15, 23, 42, 0.06);
}

html,
body {
    margin: 0;
    width: 100%;
    height: 100%;
    background: var(--bg);
    color: var(--text);
}

body {
    height: 100vh;
    overflow: hidden;
}

.app {
    height: 100vh;
    display: grid;
    grid-template-rows: auto 1fr;
}

/* TOP BAR */

.topbar {
    min-height: 84px;
    padding: 14px 24px;
    background: #fff;
    border-bottom: 1px solid var(--border);
    display: grid;
    grid-template-columns: minmax(300px, 1fr) auto;
    gap: 20px;
    align-items: center;
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.logo {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    color: #fff;
    font-size: 19px;
    font-weight: 950;
    background: linear-gradient(135deg, #6657ff, #7c4dff);
    box-shadow: 0 10px 22px rgba(102, 87, 255, 0.22);
}

.brand h1 {
    margin: 0;
    font-size: 25px;
    line-height: 1.05;
    font-weight: 950;
    letter-spacing: -0.05em;
}

.brand p {
    margin: 5px 0 0;
    color: #53637e;
    font-size: 13px;
    line-height: 1.3;
}

.controls {
    display: flex;
    align-items: end;
    gap: 12px;
    flex-wrap: wrap;
}

.field {
    display: grid;
    gap: 5px;
}

.field label {
    font-size: 10px;
    font-weight: 950;
    color: #8a98ae;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

input {
    height: 40px;
    min-width: 140px;
    border: 1px solid var(--border);
    outline: none;
    border-radius: 11px;
    background: #f8fafc;
    color: #263247;
    padding: 0 14px;
    font-size: 14px;
    font-weight: 780;
}

input:focus {
    background: #fff;
    border-color: rgba(102, 87, 255, 0.55);
    box-shadow: 0 0 0 3px rgba(102, 87, 255, 0.10);
}

.threshold-input {
    width: 88px;
    min-width: 88px;
    text-align: center;
}

button {
    height: 40px;
    border: 0;
    border-radius: 11px;
    padding: 0 20px;
    background: linear-gradient(135deg, #6657ff, #7c4dff);
    color: #fff;
    font-size: 13px;
    font-weight: 950;
    cursor: pointer;
    box-shadow: 0 10px 20px rgba(102, 87, 255, 0.20);
    transition: 0.15s ease;
}

button:hover {
    transform: translateY(-1px);
}

button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

/* LAYOUT */

.layout {
    min-height: 0;
    padding: 16px 24px 18px;
    display: grid;
    grid-template-columns: 50% 50%;
    gap: 18px;
}

.panel {
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.panel-head {
    height: 36px;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.panel-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 21px;
    font-weight: 950;
    letter-spacing: -0.04em;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: var(--primary);
    box-shadow: 0 0 0 4px rgba(102, 87, 255, 0.10);
}

.right-panel .dot {
    background: var(--green);
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.12);
}

.chip {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: #53637e;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 900;
    box-shadow: 0 3px 10px rgba(15, 23, 42, 0.04);
}

/* BOXES */

.question-list,
.right-body {
    flex: 1;
    min-height: 0;
    overflow: auto;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: var(--shadow);
}

.question-list {
    padding: 12px;
}

.right-body {
    padding: 0;
}

.question-list::-webkit-scrollbar,
.right-body::-webkit-scrollbar {
    width: 7px;
}

.question-list::-webkit-scrollbar-thumb,
.right-body::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 999px;
}

/* QUESTIONS COMPACT */

.q-item {
    border: 1px solid var(--border);
    background: #fff;
    border-radius: 15px;
    padding: 14px 16px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: 0.15s ease;
}

.q-item:hover {
    border-color: #cdd5ff;
    box-shadow: 0 7px 18px rgba(15, 23, 42, 0.055);
}

.q-item.active {
    border-color: rgba(102, 87, 255, 0.45);
    box-shadow: 0 0 0 3px rgba(102, 87, 255, 0.08);
}

.q-top,
.q-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.q-no {
    min-width: 42px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: var(--primary-soft);
    color: var(--primary);
    border: 1px solid #dde1ff;
    font-size: 12px;
    font-weight: 950;
}


.q-preview,
.q-preview.full-question {
    margin: 0 0 10px;
    color: #111827;
    font-size: 14px;
    line-height: 1.42;
    font-weight: 720;
    letter-spacing: -0.01em;
}

.q-preview img,
.q-preview.full-question img {
    max-width: 240px;
    max-height: 110px;
    object-fit: contain;
    display: block;
    margin: 8px auto;
}

/* OPTIONS COMPACT */

.q-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 10px;
}

.option,
.q-options .option {
    min-height: 38px;
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    color: #1e293b;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px 10px;
    font-size: 13px;
    line-height: 1.25;
    font-weight: 760;
    box-shadow: none;
}

.option b {
    width: 23px;
    height: 23px;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--primary-soft);
    color: var(--primary);
    font-size: 11px;
    font-weight: 950;
}

.q-footer,
.q-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 11px;
    flex-wrap: wrap;
}

.mini-btn,
.q-actions button {
    height: 36px;
    padding: 0 16px;
    border-radius: 10px;
    font-size: 12px;
}

.answer-pill {
    height: 36px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    border-radius: 10px;
    background: var(--green-soft);
    color: #047857;
    border: 1px solid #a7f3d0;
    padding: 0 13px;
    font-size: 12px;
    font-weight: 950;
}

.answer-pill::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: var(--green);
}

/* SUGGESTIONS COMPACT */

.suggestion-title {
    position: sticky;
    top: 0;
    z-index: 5;
    height: 66px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0 20px;
    background: #fff;
    border-bottom: 1px solid var(--border);
}

.suggestion-title h2 {
    margin: 0;
    font-size: 21px;
    font-weight: 950;
    letter-spacing: -0.04em;
}

#matchCount {
    background: var(--primary-soft);
    color: var(--primary);
    border-color: #dde1ff;
    box-shadow: none;
}

.suggestion-grid {
    display: grid;
    grid-template-columns: 1fr !important;
}

.suggestion-item {
    position: relative;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 15px;
    padding: 15px 16px;
    box-shadow: none;
}

.suggestion-item::before {
    content: "";
    position: absolute;
    left: 16px;
    top: 15px;
    bottom: 15px;
    width: 2px;
    background: #e6eef8;
}

.score {
    display: inline-flex;
    align-items: center;
    margin-left: 14px;
    margin-bottom: 10px;
    border-radius: 999px;
    background: #dcfce7;
    color: #166534;
    padding: 6px 10px;
    font-size: 11px;
    font-weight: 950;
}

.suggestion-question {
    margin-left: 14px;
    color: #111827;
    font-size: 18px;
    line-height: 1.3;
    font-weight: 900;
    letter-spacing: -0.03em;
}

.suggestion-question img {
    max-width: 260px;
    max-height: 130px;
    object-fit: contain;
    display: block;
    margin: 8px auto;
}

.suggestion-item .options {
    margin: 12px 0 0 14px;
    padding: 10px 12px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 5px;
    background: #f8fafc;
    border: 1px solid #edf2f7;
    border-radius: 12px;
}

.suggestion-item .option {
    min-height: 28px;
    padding: 3px 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    color: #475569;
    font-size: 13px;
    font-weight: 740;
}

.suggestion-item .option b {
    width: 24px;
    height: 24px;
    background: transparent;
    color: var(--primary);
}

.small-meta {
    margin: 10px 0 0 14px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
}

.suggestion-answer {
    margin: 10px 0 0 14px;
}

/* EMPTY / ERROR */

.empty {
    min-height: 140px;
    display: grid;
    place-items: center;
    text-align: center;
    color: #7b8aa4;
    border: 1px dashed #cbd5e1;
    border-radius: 14px;
    background: #fff;
    padding: 20px;
    font-weight: 850;
    line-height: 1.5;
}

.error {
    display: none;
    margin: 12px 12px 0;
    background: #fff1f2;
    color: #b91c1c;
    border: 1px solid #fecdd3;
    border-radius: 12px;
    padding: 11px 13px;
    font-size: 13px;
    font-weight: 850;
}

/* RESPONSIVE */

@media (max-width: 1200px) {
    body {
        height: auto;
        min-height: 100vh;
        overflow: auto;
    }

    .app {
        height: auto;
        min-height: 100vh;
    }

    .layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {
    .topbar {
        grid-template-columns: 1fr;
        padding: 16px;
    }

    .controls {
        justify-content: stretch;
    }

    .controls .field {
        flex: 1 1 130px;
    }

    .controls button {
        flex: 1 1 180px;
    }

    .layout {
        padding: 14px;
    }
}

@media (max-width: 680px) {
    .brand h1 {
        font-size: 22px;
    }

    .brand p {
        font-size: 13px;
    }

    .controls,
    .controls .field,
    .controls input,
    .controls button {
        width: 100%;
    }

    .threshold-input {
        min-width: 100%;
    }

    .q-options {
        grid-template-columns: 1fr;
    }

    .suggestion-item::before {
        display: none;
    }

    .score,
    .suggestion-question,
    .suggestion-item .options,
    .small-meta,
    .suggestion-answer {
        margin-left: 0;
    }
}

/* MORE COMPACT: 5-10 QUESTIONS SCREEN ME DIKHENGE */

.topbar {
    min-height: 72px;
    padding: 10px 22px;
}

.logo {
    width: 44px;
    height: 44px;
    font-size: 18px;
}

.brand h1 {
    font-size: 23px;
}

.brand p {
    font-size: 12px;
    margin-top: 4px;
}

input,
button {
    height: 36px;
}

.layout {
    padding: 12px 22px 14px;
    gap: 16px;
}

.panel-head {
    height: 30px;
    margin-bottom: 7px;
}

.panel-title {
    font-size: 19px;
}

.question-list {
    padding: 9px;
}

.q-item {
    padding: 10px 12px;
    margin-bottom: 8px;
    border-radius: 13px;
}

.q-top,
.q-row {
    margin-bottom: 7px;
}

.q-no {
    height: 23px;
    min-width: 38px;
    font-size: 11px;
}

.q-preview,
.q-preview.full-question {
    font-size: 12.5px;
    line-height: 1.35;
    margin-bottom: 7px;
}

.q-preview img,
.q-preview.full-question img {
    max-width: 180px;
    max-height: 75px;
    margin: 5px auto;
}

.q-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    margin-top: 7px;
}

.option,
.q-options .option {
    min-height: 30px;
    padding: 6px 8px;
    border-radius: 9px;
    font-size: 11.5px;
    gap: 6px;
}

.option b {
    width: 20px;
    height: 20px;
    font-size: 10px;
}

.q-footer,
.q-actions {
    margin-top: 8px;
    gap: 8px;
}

.mini-btn,
.q-actions button {
    height: 31px;
    padding: 0 12px;
    font-size: 11px;
}

.answer-pill {
    height: 31px;
    padding: 0 10px;
    font-size: 11px;
}

/* SUGGESTION COMPACT + OPTIONS 2 COLUMN */

.suggestion-title {
    height: 52px;
    padding: 0 16px;
}

.suggestion-title h2 {
    font-size: 18px;
}

.suggestion-grid {
    padding: 9px;
    gap: 9px;
}

.suggestion-item {
    padding: 11px 13px;
    border-radius: 13px;
}

.suggestion-item::before {
    left: 13px;
    top: 11px;
    bottom: 11px;
}

.score {
    margin-left: 12px;
    margin-bottom: 7px;
    padding: 5px 9px;
    font-size: 10.5px;
}

.suggestion-question {
    margin-left: 12px;
    font-size: 14.5px;
    line-height: 1.25;
    font-weight: 850;
}

.suggestion-question img {
    max-width: 190px;
    max-height: 85px;
    margin: 5px auto;
}

/* IMPORTANT: suggestion options 2 columns */
.suggestion-item .options {
    margin: 9px 0 0 12px;
    padding: 8px 10px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px 10px;
}

.suggestion-item .option {
    min-height: 24px;
    padding: 2px 0;
    font-size: 11.5px;
    line-height: 1.25;
}

.suggestion-item .option b {
    width: 20px;
    height: 20px;
    font-size: 10px;
}

.small-meta {
    margin: 7px 0 0 12px;
    font-size: 10px;
}

.suggestion-answer {
    margin: 7px 0 0 12px;
}

.empty {
    min-height: 110px;
    padding: 16px;
    font-size: 12px;
}

@media (max-width: 680px) {
    .suggestion-item .options {
        grid-template-columns: 1fr;
    }
}

/* ===== HARD COMPACT MODE ===== */

/* REMOVE EXTRA LEFT SPACE IN SUGGESTION */
.suggestion-item::before {
    display: none;
}

/* REMOVE LEFT OFFSET */
.score,
.suggestion-question,
.suggestion-item .options,
.small-meta,
.suggestion-answer {
    margin-left: 0 !important;
}

/* REDUCE RIGHT PANEL PADDING */
.right-body {
    padding: 6px !important;
}

/* REDUCE GRID GAP */
.suggestion-grid {
    gap: 6px !important;
    padding: 6px !important;
}

/* TIGHT CARD */
.suggestion-item {
    padding: 8px 10px !important;
    border-radius: 10px !important;
}

/* QUESTION TEXT SMALL */
.suggestion-question {
    font-size: 13px !important;
    line-height: 1.2 !important;
    font-weight: 800;
}

/* OPTIONS BOX ULTRA COMPACT */
.suggestion-item .options {
    margin-top: 6px !important;
    padding: 5px 6px !important;
    border-radius: 8px !important;
    gap: 4px !important;
}

/* OPTIONS INLINE STYLE */
.suggestion-item .option {
    font-size: 11px !important;
    line-height: 1.15 !important;
    padding: 1px 0 !important;
}

/* OPTION LABEL SMALL */
.suggestion-item .option b {
    width: 16px;
    height: 16px;
    font-size: 9px;
}

/* META SMALL */
.small-meta {
    font-size: 9px !important;
    margin-top: 4px !important;
}

/* ANSWER SMALL */
.suggestion-answer {
    margin-top: 4px !important;
}

/* HEADER HEIGHT REDUCE */
.suggestion-title {
    height: 42px !important;
    padding: 0 10px !important;
}

/* HEADER TEXT */
.suggestion-title h2 {
    font-size: 16px !important;
}

/* CHIP SMALL */
#matchCount {
    font-size: 11px;
    padding: 4px 8px;
}

/* TOP ROW: Q NO LEFT, BUTTON CENTER/RIGHT, SUBJECT RIGHT */
.q-top,
.q-row {
    display: grid !important;
    grid-template-columns: auto 1fr auto !important;
    align-items: center !important;
    gap: 8px !important;
}

.q-top .mini-btn {
    justify-self: end !important;
    height: 28px !important;
    padding: 0 10px !important;
    font-size: 10.5px !important;
    border-radius: 8px !important;
}


/* REMOVE OLD FOOTER SPACE */
.q-footer,
.q-actions {
    display: none !important;
}

/* CORRECT ANSWER GREEN */
.correct-option {
    background: #ecfdf5 !important;
    border-color: #86efac !important;
    color: #047857 !important;
    font-weight: 950 !important;
}

.correct-option b {
    background: #10b981 !important;
    color: #fff !important;
}

/* SUGGESTION META SAME ROW */
.suggestion-meta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
}

.score {
    margin: 0 !important;
}

.record-pill {
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 10.5px;
    font-weight: 850;
    color: #64748b;
    background: #f8fafc;
    border: 1px solid #e3e9f2;
    border-radius: 999px;
    padding: 5px 8px;
}

/* META ROW KI WAJAH SE HEIGHT KAM */
.small-meta {
    display: none !important;
}

/* suggestion-title removed */
.suggestion-title {
    display: none !important;
}

.header-chips {
    display: flex;
    align-items: center;
    gap: 8px;
}

.match-chip {
    color: #6657ff;
    background: #eef0ff;
    border-color: #dde1ff;
}

.right-body {
    padding: 6px !important;
}

.suggestion-grid {
    padding: 6px !important;
    gap: 6px !important;
}

.suggestion-item {
    padding: 8px 10px !important;
    border-radius: 10px !important;
}

.suggestion-meta-row {
    margin-bottom: 5px !important;
}

.suggestion-question {
    font-size: 13px !important;
    line-height: 1.2 !important;
    margin-left: 0 !important;
}

.suggestion-item .options {
    margin: 6px 0 0 0 !important;
    padding: 5px 6px !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 4px 8px !important;
}

.suggestion-item .option {
    min-height: 22px !important;
    font-size: 11px !important;
    line-height: 1.15 !important;
    padding: 1px 0 !important;
}

.score {
    margin: 0 !important;
    font-size: 10.5px !important;
    padding: 4px 8px !important;
}

.record-pill {
    font-size: 10px !important;
    padding: 4px 7px !important;
}

/* HARD FIX: NO HORIZONTAL SCROLL */

.right-body,
.suggestion-grid {
    overflow-x: hidden !important;
}

/* ensure cards never overflow */
.suggestion-item {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

/* long text break */
.suggestion-question,
.suggestion-item .option {
    word-break: break-word;
    overflow-wrap: anywhere;
}

/* fix options grid overflow */
.suggestion-item .options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    /* important */
}

/* prevent any child from pushing width */
.suggestion-item * {
    max-width: 100%;
}

/* record id long string fix */
.record-pill {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* images control */
.suggestion-question img {
    max-width: 100%;
    height: auto;
}

/* FORCE SINGLE COLUMN — FINAL FIX */
#suggestionList {
    display: flex !important;
    flex-direction: column !important;
}

#suggestionList .suggestion-item {
    width: 100% !important;
}

/* ===== FORCE 1 COLUMN — NEVER BREAK ===== */

#suggestionList.suggestion-grid {
    display: flex !important;
    flex-direction: column !important;
    flex-wrap: nowrap !important;
}

#suggestionList.suggestion-grid>.suggestion-item {
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 100% !important;
}

/* kill any grid behavior completely */
#suggestionList {
    grid-template-columns: none !important;
}

/* safety: prevent browser auto multi column */
.suggestion-grid {
    column-count: 1 !important;
}

.solution-actions {
    margin-top: 6px;
    display: flex;
    justify-content: flex-end;
}

.solution-btn {
    height: 26px !important;
    padding: 0 10px !important;
    border-radius: 8px !important;
    font-size: 10.5px !important;
}

.solution-box {
    margin-top: 6px;
    padding: 8px 10px;
    border-radius: 9px;
    background: #ffffb8;
    border: 1px solid #dbe5f0;
    color: #0f172a;
    font-size: 12px;
    line-height: 1.35;
    font-weight: 700;
    overflow-x: auto;
}

.suggestion-left-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.tiny-solution-btn {
    height: 24px !important;
    padding: 0 8px !important;
    font-size: 10px !important;
    border-radius: 999px !important;
    box-shadow: none !important;
}

.solution-actions {
    display: none !important;
}