/* quiz.css — self-contained styling for the Quiz view (D-076).
 * Sits on top of kb.css (loaded by kb_head): DM Sans, the breadcrumb and the
 * view-switcher pills come from there; everything below is quiz-local. */

.kbq-wrap {
    max-width: 1180px;
    margin: 0 auto;
    /* Offset the fixed 52px topbar — the shared chrome's breadcrumb/switcher are
     * sticky top:0, so without this the breadcrumb renders behind the topbar (the
     * standard .right-panel shell offsets via margin-top; this module's own wrap
     * must do it too). */
    padding: calc(var(--topbar-h) + 12px) 16px 48px;
}
/* Keep the sticky chrome pinned BELOW the topbar on scroll, not behind it. */
.kbq-wrap .rp-breadcrumb-nav { top: var(--topbar-h); }
.kbq-wrap .kb-view-switcher  { top: calc(var(--topbar-h) + 38px); }

.kbq-stage { margin-top: 18px; }

/* ── Shell: info rail · quiz card · info rail (D-096) ────────────────────── */
.kbq-shell {
    display: grid;
    grid-template-columns: 220px minmax(0, 640px) 220px;
    gap: 22px;
    justify-content: center;
    align-items: start;
    margin-top: 18px;
}
.kbq-shell .kbq-stage { margin-top: 0; }
.kbq-rail { position: sticky; top: 16px; }
.kbq-panel {
    background: #fff;
    border: 1px solid #e5e9f0;
    border-radius: 14px;
    padding: 16px 18px;
    box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
}
.kbq-panel-h {
    font-size: .72rem; font-weight: 700; letter-spacing: .07em;
    text-transform: uppercase; color: #2f80ed; margin-bottom: 12px;
}
.kbq-stat { color: #5b6472; font-size: .92rem; margin-bottom: 7px; }
.kbq-stat-n { font-weight: 800; color: #1c2333; font-size: 1.05rem; margin-right: 2px; }
.kbq-stat-new .kbq-stat-n { color: #b45309; }
.kbq-diffbar {
    display: flex; height: 8px; gap: 2px; margin: 12px 0 6px;
    border-radius: 4px; overflow: hidden; background: #eaeef4;
}
.kbq-diff-e { background: #22a35a; }
.kbq-diff-m { background: #2f80ed; }
.kbq-diff-h { background: #b45309; }
.kbq-difflegend { font-size: .78rem; color: #8b95a5; }
.kbq-notes { margin: 0; padding-left: 18px; color: #5b6472; font-size: .88rem; line-height: 1.5; }
.kbq-notes li { margin-bottom: 8px; }

/* ── Focus chips (level / New) — share the length-chip look ──────────────── */
.kbq-focus { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 0 0 18px; }
.kbq-foc-n { opacity: .6; font-size: .8em; margin-left: 1px; }
.kbq-foc-new { border-color: #e6c07a; }
.kbq-foc-new.active { background: #b45309; border-color: #b45309; color: #fff; }

/* ── Admin: printable-test link on the intro (D-106) ────────────────────── */
.kbq-admin-print {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px dashed #e0e6ee;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.kbq-printlink {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: .9rem;
    font-weight: 600;
    color: #2f80ed;
    text-decoration: none;
}
.kbq-printlink:hover { text-decoration: underline; }
.kbq-printhint { color: #8b95a5; font-size: .82rem; }

@media (max-width: 980px) {
    .kbq-shell {
        grid-template-columns: 1fr;
        max-width: 640px;
        margin-left: auto; margin-right: auto;
    }
    .kbq-rail { position: static; }
}

/* ── Cards ──────────────────────────────────────────────────────────────── */
.kbq-card {
    background: #fff;
    border: 1px solid #e5e9f0;
    border-radius: 14px;
    padding: 28px 30px;
    box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
}

.kbq-kicker {
    font-size: .8rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #2f80ed;
    margin-bottom: 8px;
}
.kbq-kicker .bi { margin-right: 4px; }

.kbq-title { font-size: 1.7rem; font-weight: 700; color: #1c2333; margin: 0 0 8px; }
.kbq-sub   { color: #5b6472; margin: 0 0 20px; max-width: 46em; }

/* ── Buttons ────────────────────────────────────────────────────────────── */
.kbq-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid #d3dae4;
    background: #fff;
    color: #1c2333;
    border-radius: 10px;
    padding: 10px 20px;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, border-color .15s;
}
.kbq-btn:hover { background: #f4f7fb; }
.kbq-btn-primary {
    background: #2f80ed;
    border-color: #2f80ed;
    color: #fff;
}
.kbq-btn-primary:hover { background: #1e6fdc; }

/* ── Length chips (intro card) ──────────────────────────────────────────── */
.kbq-lengths {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 18px;
}
.kbq-lengths-label { font-size: .85rem; font-weight: 600; color: #5b6472; margin-right: 2px; }
.kbq-len {
    border: 1px solid #d3dae4;
    background: #fff;
    color: #2a3242;
    border-radius: 999px;
    padding: 5px 14px;
    font: inherit;
    font-size: .88rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, border-color .15s, color .15s;
}
.kbq-len:hover { border-color: #2f80ed; }
.kbq-len.active {
    background: #2f80ed;
    border-color: #2f80ed;
    color: #fff;
}

/* ── Progress row ───────────────────────────────────────────────────────── */
.kbq-progress {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
}
.kbq-progress-label { font-size: .85rem; font-weight: 600; color: #5b6472; white-space: nowrap; }
.kbq-progress-track {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: #eaeef4;
    overflow: hidden;
}
.kbq-progress-fill {
    display: block;
    height: 100%;
    width: 0;
    border-radius: 3px;
    background: #2f80ed;
    transition: width .3s ease;
}
.kbq-score-chip {
    font-size: .8rem;
    font-weight: 700;
    color: #15803d;
    background: #ecfdf3;
    border: 1px solid #bbe7c9;
    border-radius: 999px;
    padding: 2px 10px;
    white-space: nowrap;
}
/* Admin-only DB id of the current question — for noting revamp targets (D-108). */
.kbq-qid {
    font-size: .72rem;
    font-weight: 700;
    color: #8a94a6;
    background: #f1f4f8;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 2px 8px;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

/* ── Question + options ─────────────────────────────────────────────────── */
.kbq-qtext { font-size: 1.2rem; font-weight: 700; color: #1c2333; margin: 0 0 18px; line-height: 1.45; }

.kbq-options { display: grid; gap: 10px; }

.kbq-opt {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    width: 100%;
    text-align: left;
    background: #fbfcfe;
    border: 1px solid #dde3ec;
    border-radius: 10px;
    padding: 12px 14px;
    font: inherit;
    color: #2a3242;
    cursor: pointer;
    transition: border-color .15s, background .15s;
}
.kbq-opt:hover:not(:disabled) { border-color: #2f80ed; background: #f2f7ff; }
.kbq-opt:disabled { cursor: default; opacity: .92; }

.kbq-opt-key {
    flex: 0 0 auto;
    width: 26px;
    height: 26px;
    border-radius: 8px;
    background: #eaeef4;
    color: #475569;
    font-size: .8rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 1px;
}
.kbq-opt-text { line-height: 1.4; }

.kbq-opt.correct {
    border-color: #22a35a;
    background: #ecfdf3;
}
.kbq-opt.correct .kbq-opt-key { background: #22a35a; color: #fff; }
.kbq-opt.wrong {
    border-color: #e05252;
    background: #fdf0ef;
}
.kbq-opt.wrong .kbq-opt-key { background: #e05252; color: #fff; }

/* ── Post-answer feedback ───────────────────────────────────────────────── */
.kbq-feedback {
    margin-top: 18px;
    border-top: 1px dashed #e0e6ee;
    padding-top: 16px;
}
.kbq-verdict { font-weight: 700; font-size: 1rem; margin-bottom: 6px; }
.kbq-verdict.ok { color: #15803d; }
.kbq-verdict.ko { color: #b42323; }
.kbq-verdict .bi { margin-right: 6px; }

.kbq-explanation { color: #444d5c; margin: 0 0 10px; line-height: 1.55; }

.kbq-termlink {
    display: inline-block;
    font-size: .92rem;
    color: #2f80ed;
    text-decoration: none;
}
.kbq-termlink:hover { text-decoration: underline; }

.kbq-actions { margin-top: 18px; text-align: right; }

/* ── Question palette (jump to any question; answered/current state) ─────── */
/* Single horizontal strip (not a wrapping grid): compact for a 10-question
 * round, scrollable for a big "All" round. renderPalette() keeps the current
 * dot centered by nudging this element's scrollLeft (offsetLeft math needs the
 * relative position + non-shrinking dots below). */
.kbq-palette {
    display: flex;
    flex-wrap: nowrap;
    gap: 7px;
    margin: 0 0 18px;
    position: relative;
    overflow-x: auto;
    scroll-behavior: smooth;
    padding-bottom: 6px;             /* keep dots clear of the scrollbar */
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
}
.kbq-palette::-webkit-scrollbar { height: 6px; }
.kbq-palette::-webkit-scrollbar-thumb { background: #d3dae4; border-radius: 3px; }
.kbq-dot {
    flex: 0 0 auto;
    min-width: 30px;
    height: 30px;
    padding: 0 6px;
    border: 1px solid #d3dae4;
    background: #fff;
    color: #5b6472;
    border-radius: 8px;
    font: inherit;
    font-size: .82rem;
    font-weight: 700;
    cursor: pointer;
    transition: border-color .15s, background .15s, color .15s, box-shadow .15s;
}
.kbq-dot:hover     { border-color: #2f80ed; }
.kbq-dot.is-correct { background: #ecfdf3; border-color: #bbe7c9; color: #15803d; }
.kbq-dot.is-wrong   { background: #fdf0ef; border-color: #f2c4c0; color: #b42323; }
.kbq-dot.is-current {
    border-color: #2f80ed;
    box-shadow: 0 0 0 2px rgba(47, 128, 237, .25);
    color: #1c2333;
}

/* ── Nav actions row (Prev · Skip/Next · Finish) ────────────────────────── */
.kbq-nav {
    display: flex;
    align-items: center;
    gap: 10px;
    text-align: left;
}
.kbq-nav-spacer { flex: 1; }
.kbq-btn-ghost { background: #fff; }
.kbq-btn:disabled { opacity: .45; cursor: default; }
.kbq-btn:disabled:hover { background: #fff; }

.kbq-recap-skip { font-size: .78rem; color: #b45309; font-weight: 600; white-space: nowrap; }

/* ── Results ────────────────────────────────────────────────────────────── */
.kbq-scorebig { font-size: 2.6rem; font-weight: 800; color: #1c2333; margin: 4px 0; }
.kbq-scoremsg { color: #5b6472; margin: 0 0 20px; }

.kbq-recap { list-style: none; margin: 0; padding: 0; }
.kbq-recap-row {
    display: flex;
    align-items: baseline;
    gap: 10px;
    padding: 10px 4px;
    border-top: 1px solid #eef1f6;
    line-height: 1.4;
}
.kbq-recap-row .bi { flex: 0 0 auto; }
.kbq-recap-row.ok .bi { color: #22a35a; }
.kbq-recap-row.ko .bi { color: #e05252; }
.kbq-recap-q { flex: 1; color: #2a3242; }
.kbq-recap-term { white-space: nowrap; color: #2f80ed; text-decoration: none; font-size: .9rem; }
.kbq-recap-term:hover { text-decoration: underline; }

/* ── Mobile ─────────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
    .kbq-card { padding: 20px 16px; }
    .kbq-title { font-size: 1.35rem; }
    .kbq-qtext { font-size: 1.05rem; }
    .kbq-actions { text-align: center; }
    .kbq-actions .kbq-btn { width: 100%; justify-content: center; }
    /* keep the nav row a single wrapping line of buttons, not full-width stacks */
    .kbq-nav { flex-wrap: wrap; }
    .kbq-nav .kbq-btn { flex: 1 1 auto; width: auto; }
    .kbq-nav-spacer { display: none; }
    .kbq-palette { gap: 6px; }
    .kbq-dot { min-width: 28px; height: 28px; }
}
