/* =========================================================================
   FULL LENGTH TEST — RESULT, HISTORY, VAULTS

   Shared by the three analysis surfaces. Token-only.

   The centrepiece is the section-wise table: a full-length paper's whole point
   is knowing *which* section cost you the marks, which the main app's
   chapter-level result view can't answer.
   ========================================================================= */

/* ── Score hero ──────────────────────────────────────────────────────────── */

.ft-res-hero {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: var(--sp-6);
    align-items: center;
    padding: var(--sp-6);
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background:
        radial-gradient(circle at 0% 0%, color-mix(in srgb, var(--brand) 15%, transparent), transparent 55%),
        var(--surface);
    box-shadow: var(--shadow-sm);
}

.ft-score-ring {
    position: relative;
    width: 160px;
    height: 160px;
    flex: none;
}

.ft-score-ring canvas {
    position: relative;
    z-index: 1;
}

.ft-score-ring-center {
    position: absolute;
    inset: 0;
    display: grid;
    place-content: center;
    text-align: center;
    pointer-events: none;
}

.ft-score-ring-center b {
    display: block;
    font-size: 1.72rem;
    font-weight: 900;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.ft-score-ring-center span {
    display: block;
    margin-top: 3px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.ft-res-verdict h2 {
    margin: 0 0 var(--sp-2);
    font-size: 1.34rem;
    font-weight: 900;
    line-height: 1.25;
}

.ft-res-verdict p {
    margin: 0 0 var(--sp-4);
    font-size: 0.9rem;
    line-height: 1.62;
    color: var(--text-muted);
    max-width: 56ch;
}

.ft-verdict-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 14px;
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    margin-bottom: var(--sp-3);
}

.ft-verdict-pill.is-good {
    color: var(--brand-2);
    background: color-mix(in srgb, var(--brand-2) 14%, transparent);
}

.ft-verdict-pill.is-mid {
    color: var(--warning);
    background: color-mix(in srgb, var(--warning) 16%, transparent);
}

.ft-verdict-pill.is-low {
    color: var(--danger);
    background: color-mix(in srgb, var(--danger) 14%, transparent);
}

.ft-res-actions {
    display: flex;
    gap: var(--sp-2);
    flex-wrap: wrap;
}

/* ── KPI strip ───────────────────────────────────────────────────────────── */

.ft-kpi-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: var(--sp-3);
}

.ft-kpi {
    padding: var(--sp-4) var(--sp-4);
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    border-top: 3px solid var(--kpi-accent, var(--brand));
    background: var(--surface);
}

.ft-kpi span {
    display: block;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 5px;
}

.ft-kpi b {
    display: block;
    font-size: 1.44rem;
    font-weight: 900;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
    color: var(--kpi-accent, var(--brand));
}

.ft-kpi small {
    display: block;
    margin-top: 3px;
    font-size: 0.72rem;
    color: var(--text-muted);
}

/* ── Panels ──────────────────────────────────────────────────────────────── */

.ft-panel {
    padding: var(--sp-5);
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: var(--surface);
}

.ft-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-3);
    flex-wrap: wrap;
    margin-bottom: var(--sp-4);
}

.ft-panel-head h3 {
    margin: 0;
    font-size: 1.02rem;
    font-weight: 800;
}

.ft-panel-head p {
    margin: 3px 0 0;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.ft-two-col {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(330px, 1fr));
    gap: var(--sp-4);
}

.ft-chart-box {
    position: relative;
    height: 250px;
}

/* ── Section-wise table ──────────────────────────────────────────────────── */

/* Wide tables scroll inside their own container; the page body must never
   scroll sideways. */
.ft-table-scroll {
    overflow-x: auto;
    margin: 0 calc(var(--sp-5) * -1);
    padding: 0 var(--sp-5);
}

.ft-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.84rem;
    min-width: 620px;
}

.ft-table th,
.ft-table td {
    padding: 11px var(--sp-3);
    text-align: right;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.ft-table th:first-child,
.ft-table td:first-child {
    text-align: left;
    white-space: normal;
    min-width: 190px;
}

.ft-table thead th {
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
    border-bottom-color: color-mix(in srgb, var(--text-muted) 30%, transparent);
}

.ft-table tbody tr {
    transition: background-color .16s ease;
}

.ft-table tbody tr:hover {
    background: color-mix(in srgb, var(--brand) 5%, transparent);
}

.ft-table tfoot td {
    font-weight: 800;
    border-bottom: 0;
    border-top: 2px solid color-mix(in srgb, var(--text-muted) 30%, transparent);
    color: var(--text-main);
}

.ft-sec-name {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
}

.ft-sec-dot {
    width: 9px;
    height: 9px;
    flex: none;
    border-radius: 50%;
    background: var(--sec-color, var(--brand));
}

.ft-sec-name small {
    display: block;
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Inline accuracy bar inside the table cell — a number plus its shape reads
   faster than the number alone when comparing four sections. */
.ft-bar-cell {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    justify-content: flex-end;
}

.ft-bar {
    width: 62px;
    height: 6px;
    flex: none;
    border-radius: 999px;
    overflow: hidden;
    background: color-mix(in srgb, var(--text-muted) 20%, transparent);
}

.ft-bar > i {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: var(--bar-color, var(--brand));
}

.ft-delta {
    font-size: 0.76rem;
    font-weight: 800;
}

.ft-delta.is-up {
    color: var(--brand-2);
}

.ft-delta.is-down {
    color: var(--danger);
}

.ft-delta.is-flat {
    color: var(--text-muted);
}

/* ── AI mentor panel ─────────────────────────────────────────────────────── */

.ft-mentor {
    border-radius: var(--radius);
    border: 1px solid color-mix(in srgb, var(--brand) 28%, transparent);
    background:
        radial-gradient(circle at 100% 0%, color-mix(in srgb, var(--brand) 13%, transparent), transparent 60%),
        var(--surface);
    padding: var(--sp-5);
}

.ft-mentor-head {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    margin-bottom: var(--sp-4);
}

.ft-mentor-head i {
    width: 38px;
    height: 38px;
    flex: none;
    display: grid;
    place-items: center;
    border-radius: 11px;
    color: var(--brand);
    background: var(--brand-soft);
    border: 1px solid color-mix(in srgb, var(--brand) 26%, transparent);
}

.ft-mentor-head h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 800;
}

.ft-mentor-head small {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.ft-insight-list {
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
}

.ft-insight {
    display: flex;
    align-items: flex-start;
    gap: var(--sp-3);
    padding: var(--sp-3) var(--sp-4);
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    border-left: 3px solid var(--ins-accent, var(--brand));
    background: color-mix(in srgb, var(--surface-raised) 50%, transparent);
}

.ft-insight > i {
    flex: none;
    margin-top: 2px;
    font-size: 0.86rem;
    color: var(--ins-accent, var(--brand));
}

.ft-insight strong {
    display: block;
    font-size: 0.86rem;
    font-weight: 800;
    margin-bottom: 2px;
}

.ft-insight p {
    margin: 0;
    font-size: 0.82rem;
    line-height: 1.6;
    color: var(--text-muted);
}

.ft-insight p b {
    color: var(--text-main);
}

.ft-mentor-foot {
    margin-top: var(--sp-4);
    display: flex;
    gap: var(--sp-2);
    align-items: center;
    flex-wrap: wrap;
}

.ft-mentor-note {
    font-size: 0.76rem;
    color: var(--text-muted);
}

.ft-ai-answer {
    margin-top: var(--sp-4);
    padding: var(--sp-4);
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    background: var(--surface-solid);
    font-size: 0.86rem;
    line-height: 1.68;
    color: var(--text-main);
}

.ft-ai-answer h1,
.ft-ai-answer h2,
.ft-ai-answer h3 {
    font-size: 0.92rem;
    font-weight: 800;
    margin: var(--sp-4) 0 var(--sp-2);
    color: var(--brand);
}

.ft-ai-answer h1:first-child,
.ft-ai-answer h2:first-child,
.ft-ai-answer h3:first-child {
    margin-top: 0;
}

.ft-ai-answer ul,
.ft-ai-answer ol {
    margin: var(--sp-2) 0;
    padding-left: var(--sp-5);
}

.ft-ai-answer li {
    margin-bottom: 5px;
}

.ft-ai-answer code {
    padding: 1px 5px;
    border-radius: 4px;
    background: color-mix(in srgb, var(--text-muted) 16%, transparent);
    font-size: 0.9em;
}

/* ── Question review list ────────────────────────────────────────────────── */

.ft-seg-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
    gap: var(--sp-2);
    margin-bottom: var(--sp-4);
}

.ft-seg-card {
    padding: var(--sp-3);
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    background: transparent;
    font-family: inherit;
    color: var(--text-main);
    cursor: pointer;
    text-align: center;
    transition: all .18s ease;
}

.ft-seg-card:hover {
    border-color: color-mix(in srgb, var(--seg-color, var(--brand)) 44%, transparent);
}

.ft-seg-card.is-active {
    border-color: var(--seg-color, var(--brand));
    background: color-mix(in srgb, var(--seg-color, var(--brand)) 11%, transparent);
}

.ft-seg-card i {
    display: block;
    font-size: 1.02rem;
    margin-bottom: 5px;
    color: var(--seg-color, var(--brand));
}

.ft-seg-card span {
    display: block;
    font-size: 0.74rem;
    font-weight: 700;
    color: var(--text-muted);
}

.ft-seg-card b {
    display: block;
    margin-top: 2px;
    font-size: 1.06rem;
    font-weight: 900;
    font-variant-numeric: tabular-nums;
    color: var(--seg-color, var(--brand));
}

.ft-review-list {
    display: flex;
    flex-direction: column;
    gap: var(--sp-3);
}

.ft-review-item {
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    background: color-mix(in srgb, var(--surface-raised) 42%, transparent);
    overflow: hidden;
}

.ft-review-summary {
    display: flex;
    align-items: flex-start;
    gap: var(--sp-3);
    padding: var(--sp-4);
    cursor: pointer;
    text-align: left;
    width: 100%;
    border: 0;
    background: none;
    font-family: inherit;
    color: var(--text-main);
}

.ft-review-summary:hover {
    background: color-mix(in srgb, var(--brand) 5%, transparent);
}

.ft-rev-index {
    width: 30px;
    height: 30px;
    flex: none;
    display: grid;
    place-items: center;
    border-radius: 8px;
    font-size: 0.78rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.ft-rev-index.is-correct {
    color: var(--brand-2);
    background: color-mix(in srgb, var(--brand-2) 15%, transparent);
}

.ft-rev-index.is-incorrect {
    color: var(--danger);
    background: color-mix(in srgb, var(--danger) 14%, transparent);
}

.ft-rev-index.is-skipped {
    color: var(--text-muted);
    background: color-mix(in srgb, var(--text-muted) 15%, transparent);
}

.ft-rev-body {
    flex: 1;
    min-width: 0;
}

.ft-rev-q {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.6;
    font-weight: 600;
}

.ft-rev-tags {
    display: flex;
    gap: var(--sp-2);
    flex-wrap: wrap;
    margin-top: var(--sp-2);
}

.ft-tag {
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--text-muted);
    background: color-mix(in srgb, var(--text-muted) 13%, transparent);
    font-variant-numeric: tabular-nums;
}

.ft-tag.is-slow {
    color: var(--warning);
    background: color-mix(in srgb, var(--warning) 15%, transparent);
}

.ft-tag.is-subject {
    color: var(--brand);
    background: var(--brand-soft);
}

.ft-rev-chevron {
    flex: none;
    align-self: center;
    color: var(--text-muted);
    font-size: 0.78rem;
    transition: transform .2s ease;
}

.ft-review-item.is-open .ft-rev-chevron {
    transform: rotate(90deg);
}

.ft-review-detail {
    padding: 0 var(--sp-4) var(--sp-4);
    border-top: 1px solid var(--line);
}

.ft-review-item:not(.is-open) .ft-review-detail {
    display: none;
}

.ft-review-detail .ft-options {
    margin: var(--sp-4) 0;
    max-width: none;
}

.ft-explain {
    padding: var(--sp-3) var(--sp-4);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--exp-accent, var(--brand-2));
    background: color-mix(in srgb, var(--exp-accent, var(--brand-2)) 8%, transparent);
    font-size: 0.85rem;
    line-height: 1.68;
    color: var(--text-muted);
    margin-bottom: var(--sp-2);
}

.ft-explain strong {
    color: var(--exp-accent, var(--brand-2));
    display: block;
    margin-bottom: 4px;
    font-size: 0.78rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

/* The reading or cloze passage a review question hangs off. The markup is
   PassageReader's, shared with both exam engines; only its look lives here,
   in this page's own tokens so both themes follow. */
.ft-review-passage .passage-card {
    padding: var(--sp-3) var(--sp-4);
    margin-bottom: var(--sp-3);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: color-mix(in srgb, var(--brand-2) 5%, transparent);
}

.ft-review-passage .passage-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--sp-2);
    margin-bottom: var(--sp-2);
}

.ft-review-passage .passage-label {
    font-weight: 700;
    font-size: 0.85rem;
}

.ft-review-passage .passage-counter,
.ft-review-passage .passage-instruction {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.ft-review-passage .passage-instruction {
    font-style: italic;
    margin-bottom: var(--sp-2);
}

/* Capped and scrollable: a 3,000-character editorial would otherwise push the
   options and the explanation a full screen below the question. */
.ft-review-passage .passage-body {
    max-height: 320px;
    overflow-y: auto;
    font-size: 0.88rem;
    line-height: 1.7;
}

.ft-review-passage .passage-body p {
    margin: 0 0 var(--sp-2);
}

.ft-review-passage .cloze-blank sup {
    font-weight: 700;
    color: var(--brand-2);
}

.ft-rev-actions {
    display: flex;
    gap: var(--sp-2);
    flex-wrap: wrap;
    margin-top: var(--sp-3);
}

.ft-flag-btn {
    width: 34px;
    height: 34px;
    display: inline-grid;
    place-items: center;
    border-radius: 9px;
    border: 1px solid var(--line);
    background: transparent;
    color: var(--text-muted);
    font-size: 0.86rem;
    cursor: pointer;
    transition: all .18s ease;
}

.ft-flag-btn:hover {
    border-color: color-mix(in srgb, var(--flag-color, var(--brand)) 44%, transparent);
    color: var(--flag-color, var(--brand));
}

.ft-flag-btn.is-on {
    border-color: var(--flag-color, var(--brand));
    background: color-mix(in srgb, var(--flag-color, var(--brand)) 14%, transparent);
    color: var(--flag-color, var(--brand));
}

/* ── History ─────────────────────────────────────────────────────────────── */

.ft-attempt-row {
    display: flex;
    align-items: center;
    gap: var(--sp-4);
    padding: var(--sp-4);
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    background: color-mix(in srgb, var(--surface-raised) 42%, transparent);
    flex-wrap: wrap;
    transition: border-color .18s ease;
}

.ft-attempt-row:hover {
    border-color: color-mix(in srgb, var(--brand) 34%, transparent);
}

.ft-attempt-main {
    flex: 1;
    min-width: 200px;
}

.ft-attempt-main strong {
    display: block;
    font-size: 0.92rem;
    font-weight: 800;
    margin-bottom: 3px;
}

.ft-attempt-meta {
    display: flex;
    gap: var(--sp-3);
    flex-wrap: wrap;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.ft-attempt-meta b {
    color: var(--text-main);
    font-variant-numeric: tabular-nums;
}

.ft-attempt-score {
    flex: none;
    text-align: right;
}

.ft-attempt-score b {
    display: block;
    font-size: 1.24rem;
    font-weight: 900;
    font-variant-numeric: tabular-nums;
}

.ft-attempt-score span {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.ft-attempt-actions {
    display: flex;
    gap: var(--sp-2);
    flex: none;
}

.ft-compare-picker {
    display: flex;
    gap: var(--sp-2);
    align-items: center;
    flex-wrap: wrap;
}

.ft-compare-picker select {
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    background: var(--surface-solid);
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
}

/* ── Vaults ──────────────────────────────────────────────────────────────── */

.ft-vault-tabs {
    display: flex;
    gap: var(--sp-2);
    flex-wrap: wrap;
    margin-bottom: var(--sp-4);
}

.ft-search {
    position: relative;
    flex: 1;
    min-width: 200px;
    max-width: 340px;
}

.ft-search i {
    position: absolute;
    left: 13px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.82rem;
    color: var(--text-muted);
    pointer-events: none;
}

.ft-search input {
    width: 100%;
    padding: 9px 14px 9px 36px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--surface-solid);
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.84rem;
    box-sizing: border-box;
}

.ft-search input:focus {
    outline: none;
    border-color: var(--brand);
}

/* ── Vault cards: the study app's look, rebuilt on tokens ────────────────────

   These mirror the .vd-* components in features/smart-revision-engine.css so a
   vault opened here reads as the same surface the study app shows. They are NOT
   that file reused: it is written entirely in hardcoded dark hex (#18191c,
   #2d3139, #ffca28 …) with no light variant, so loading it on this page would
   give an unreadable vault in light mode. Same geometry, same colour intent,
   token-driven.
   ------------------------------------------------------------------------- */

.vd-question-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.vd-card {
    background: var(--surface-solid);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 20px 22px;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.25s ease, box-shadow 0.25s ease;
}

.vd-card:hover {
    transform: scale(1.008) translateY(-2px);
    border-color: color-mix(in srgb, var(--brand) 42%, transparent);
    box-shadow: var(--shadow-md);
}

.vd-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 10px;
}

.vd-card-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.vd-qnum-pill {
    background: var(--brand-soft);
    border: 1px solid color-mix(in srgb, var(--brand) 30%, transparent);
    color: var(--brand);
    font-size: 0.8rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 12px;
    font-variant-numeric: tabular-nums;
}

/* Subject chip — this page's addition, since a full-length vault mixes four
   subjects and the study app's per-subject vault never had to say which. */
.vd-subject-pill {
    background: color-mix(in srgb, var(--brand-2) 14%, transparent);
    border: 1px solid color-mix(in srgb, var(--brand-2) 32%, transparent);
    color: var(--brand-2);
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    padding: 3px 10px;
    border-radius: 12px;
}

.vd-topic-text {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.vd-tag-pill {
    background: color-mix(in srgb, var(--danger) 13%, transparent);
    color: var(--danger);
    border: 1px solid color-mix(in srgb, var(--danger) 32%, transparent);
    font-size: 0.78rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 12px;
    white-space: nowrap;
}

.vd-card-body {
    font-size: 0.98rem;
    line-height: 1.55;
    color: var(--text-main);
    margin-bottom: 10px;
}

.vd-options-container {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.vd-option-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: color-mix(in srgb, var(--surface-raised) 62%, transparent);
    font-size: 0.92rem;
    line-height: 1.5;
    color: var(--text-main);
    cursor: pointer;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.vd-option-item:hover {
    border-color: color-mix(in srgb, var(--brand) 40%, transparent);
    background: var(--brand-soft);
}

.vd-option-circle {
    width: 28px;
    height: 28px;
    flex: none;
    display: grid;
    place-items: center;
    border-radius: 50%;
    border: 1.5px solid var(--line);
    font-size: 0.8rem;
    font-weight: 800;
    color: var(--text-muted);
    transition: all 0.2s ease;
}

.vd-option-item.opt-correct {
    border-color: var(--brand-2);
    background: color-mix(in srgb, var(--brand-2) 13%, transparent);
}

.vd-option-item.opt-correct .vd-option-circle {
    border-color: var(--brand-2);
    background: var(--brand-2);
    color: var(--app-bg);
}

.vd-option-item.opt-incorrect {
    border-color: var(--danger);
    background: color-mix(in srgb, var(--danger) 12%, transparent);
}

.vd-option-item.opt-incorrect .vd-option-circle {
    border-color: var(--danger);
    background: var(--danger);
    color: var(--app-bg);
}

.vd-bulb-btn-container {
    margin-top: 14px;
}

.vd-bulb-btn {
    background: color-mix(in srgb, var(--warning) 13%, transparent);
    border: 1px solid color-mix(in srgb, var(--warning) 36%, transparent);
    color: var(--warning);
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 700;
    padding: 10px 18px;
    border-radius: 20px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: background-color 0.22s ease, color 0.22s ease, box-shadow 0.22s ease;
}

.vd-bulb-btn:hover {
    background: var(--warning);
    color: var(--app-bg);
    box-shadow: 0 4px 16px color-mix(in srgb, var(--warning) 34%, transparent);
}

.vd-explanation-box {
    margin-top: 12px;
    background: color-mix(in srgb, var(--surface-raised) 70%, transparent);
    border-left: 4px solid var(--warning);
    border-radius: 8px;
    padding: 14px 18px;
    font-size: 0.92rem;
    line-height: 1.6;
    color: var(--text-main);
}

/* Shown while a saved question's subject data is fetched so its explanation can
   be re-attached — see buildDetail() in ftVaults.js. Usually a few hundred
   milliseconds on the first card of a given subject, instant after that. */
.vd-detail-loading {
    padding: 18px;
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-dim, var(--text-main));
}

/* Row of per-question actions this page adds on top of the app's card:
   save / golden / video / open-in-subject-app. */
.vd-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
}

/* ── Responsive ──────────────────────────────────────────────────────────── */

@media (max-width: 720px) {
    .vd-card {
        padding: 16px 16px;
    }

    .vd-card:hover {
        transform: none;
    }

    .ft-res-hero {
        grid-template-columns: 1fr;
        justify-items: center;
        text-align: center;
        padding: var(--sp-5);
    }

    .ft-res-verdict p {
        max-width: none;
    }

    .ft-res-actions {
        justify-content: center;
    }

    .ft-score-ring {
        width: 138px;
        height: 138px;
    }

    .ft-panel {
        padding: var(--sp-4);
    }

    .ft-table-scroll {
        margin: 0 calc(var(--sp-4) * -1);
        padding: 0 var(--sp-4);
    }

    .ft-attempt-score {
        text-align: left;
    }
}

/* ── KPI gauges ──────────────────────────────────────────────────────────────
   The four headline numbers each get a ring, so the shape reads before the
   digits do. Colours come from tokens, which is what lets the same markup work
   in both themes — the study app's equivalent bakes its hexes in and cannot. */

.ft-kpi-gauge {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: var(--sp-2);
}

.ft-kpi-gauge span {
    margin-bottom: 0;
}

.ft-kpi-ring {
    position: relative;
    width: 92px;
    height: 92px;
}

.ft-kpi-ring-centre {
    position: absolute;
    inset: 0;
    display: grid;
    place-content: center;
    pointer-events: none;
}

.ft-kpi-ring-centre b {
    font-size: 1.12rem;
    font-weight: 900;
    font-variant-numeric: tabular-nums;
    color: var(--kpi-accent, var(--brand));
}

/* ── Breakdown donut + legend ────────────────────────────────────────────── */

.ft-donut-wrap {
    display: flex;
    align-items: center;
    gap: var(--sp-5);
    flex-wrap: wrap;
}

.ft-donut {
    position: relative;
    width: 150px;
    height: 150px;
    flex: none;
}

.ft-donut-centre {
    position: absolute;
    inset: 0;
    display: grid;
    place-content: center;
    text-align: center;
    pointer-events: none;
}

.ft-donut-centre b {
    display: block;
    font-size: 1.34rem;
    font-weight: 900;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    color: var(--brand-2);
}

.ft-donut-centre span {
    display: block;
    margin-top: 3px;
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.ft-donut-legend {
    flex: 1;
    min-width: 160px;
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
}

.ft-donut-legend span {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    font-size: 0.84rem;
    color: var(--text-muted);
}

.ft-donut-legend i {
    width: 11px;
    height: 11px;
    flex: none;
    border-radius: 3px;
}

.ft-donut-legend b {
    color: var(--text-main);
    font-variant-numeric: tabular-nums;
    margin-left: auto;
}

/* ── Marks ledger ────────────────────────────────────────────────────────── */

.ft-marks-ledger {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--sp-2);
    margin-top: var(--sp-4);
}

.ft-marks-ledger > div {
    padding: var(--sp-3);
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    text-align: center;
}

.ft-marks-ledger span {
    display: block;
    font-size: 0.66rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.ft-marks-ledger b {
    display: block;
    font-size: 1.18rem;
    font-weight: 900;
    font-variant-numeric: tabular-nums;
}

.ft-marks-ledger small {
    display: block;
    margin-top: 2px;
    font-size: 0.7rem;
    color: var(--text-muted);
}

.ft-marks-ledger .is-plus {
    border-color: color-mix(in srgb, var(--brand-2) 40%, transparent);
}

.ft-marks-ledger .is-plus b {
    color: var(--brand-2);
}

.ft-marks-ledger .is-minus {
    border-color: color-mix(in srgb, var(--danger) 40%, transparent);
}

.ft-marks-ledger .is-minus b {
    color: var(--danger);
}

.ft-marks-ledger .is-net {
    border-color: color-mix(in srgb, var(--brand) 45%, transparent);
    background: var(--brand-soft);
}

.ft-marks-ledger .is-net b {
    color: var(--brand);
}

/* ── Segmented toggle ────────────────────────────────────────────────────── */

.ft-toggle {
    display: inline-flex;
    padding: 3px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: color-mix(in srgb, var(--surface-raised) 60%, transparent);
}

.ft-toggle button {
    border: 0;
    background: transparent;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.74rem;
    font-weight: 700;
    padding: 5px 13px;
    border-radius: 999px;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color .18s ease, color .18s ease;
}

.ft-toggle button.is-active {
    background: var(--brand);
    color: var(--app-bg);
}

@media (max-width: 560px) {
    .ft-marks-ledger {
        grid-template-columns: 1fr;
    }

    .ft-donut-wrap {
        justify-content: center;
    }
}

/* ── Attempts picker + panel actions ─────────────────────────────────────── */

.ft-verdict-top {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    flex-wrap: wrap;
    margin-bottom: var(--sp-2);
}

.ft-attempt-picker {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    padding: 4px 10px 4px 12px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: color-mix(in srgb, var(--surface-raised) 60%, transparent);
    color: var(--text-muted);
    font-size: 0.76rem;
}

.ft-attempt-picker select {
    border: 0;
    background: transparent;
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.76rem;
    font-weight: 700;
    cursor: pointer;
    padding: 3px 2px;
    max-width: 210px;
}

.ft-attempt-picker select:focus {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
    border-radius: 4px;
}

.ft-panel-actions {
    display: flex;
    gap: var(--sp-2);
    flex-wrap: wrap;
}
