/* =========================================================================
   FULL LENGTH TEST — SHELL

   Page chrome, catalogue, hero, feature tiles, paper cards, buttons, modals.

   Every colour here is a token from premium-ui.css, which carries both the
   :root (dark) and html.theme-light values. No hardcoded hex anywhere in this
   file — that is what makes light mode work without a second stylesheet, and
   it is the mistake #result-view in the main app made 500 lines of.
   ========================================================================= */

.ft-body {
    margin: 0;
    min-height: 100dvh;
    color: var(--text-main);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    letter-spacing: -0.006em;
}

.ft-page {
    min-height: 100dvh;
}

.ft-page[hidden] {
    display: none;
}

/* ── Topbar ──────────────────────────────────────────────────────────────── */

.ft-topbar {
    position: sticky;
    top: 0;
    z-index: 60;
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-3) var(--sp-5);
    background: color-mix(in srgb, var(--surface-solid) 86%, transparent);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(18px);
}

.ft-brand {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    min-width: 0;
}

.ft-brand-mark {
    width: 40px;
    height: 40px;
    flex: none;
    border-radius: 12px;
    display: grid;
    place-items: center;
    font-size: 1rem;
    color: var(--brand);
    background: var(--brand-soft);
    border: 1px solid color-mix(in srgb, var(--brand) 26%, transparent);
}

.ft-brand-mark-result {
    color: var(--brand-2);
    background: color-mix(in srgb, var(--brand-2) 13%, transparent);
    border-color: color-mix(in srgb, var(--brand-2) 28%, transparent);
}

.ft-brand-mark-history {
    color: var(--warning);
    background: color-mix(in srgb, var(--warning) 14%, transparent);
    border-color: color-mix(in srgb, var(--warning) 30%, transparent);
}

.ft-brand-mark-vault {
    color: var(--danger);
    background: color-mix(in srgb, var(--danger) 13%, transparent);
    border-color: color-mix(in srgb, var(--danger) 28%, transparent);
}

.ft-brand strong {
    display: block;
    font-size: 0.98rem;
    font-weight: 800;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ft-brand small {
    display: block;
    font-size: 0.74rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ft-topbar-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: var(--sp-2);
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */

.ft-icon-btn {
    width: 38px;
    height: 38px;
    flex: none;
    display: inline-grid;
    place-items: center;
    border-radius: 50%;
    border: 1px solid var(--line);
    background: var(--surface-raised);
    color: var(--text-main);
    font-size: 0.9rem;
    cursor: pointer;
    text-decoration: none;
    transition: background-color .18s ease, transform .18s ease, border-color .18s ease;
}

.ft-icon-btn:hover {
    background: var(--brand-soft);
    border-color: color-mix(in srgb, var(--brand) 34%, transparent);
}

.ft-icon-btn:active {
    transform: scale(0.94);
}

.ft-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-2);
    padding: 10px 18px;
    border-radius: 999px;
    border: 1px solid transparent;
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 700;
    letter-spacing: -0.005em;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color .18s ease, transform .16s ease, border-color .18s ease, opacity .18s ease;
}

.ft-btn:active:not(:disabled) {
    transform: scale(0.97);
}

.ft-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.ft-btn-lg {
    padding: 14px 26px;
    font-size: 0.96rem;
}

.ft-btn-block {
    width: 100%;
}

.ft-btn-primary {
    background: var(--brand);
    color: var(--app-bg);
    box-shadow: 0 6px 18px color-mix(in srgb, var(--brand) 30%, transparent);
}

.ft-btn-primary:hover:not(:disabled) {
    background: color-mix(in srgb, var(--brand) 88%, var(--text-main));
}

.ft-btn-ghost {
    background: var(--surface-raised);
    border-color: var(--line);
    color: var(--text-main);
}

.ft-btn-ghost:hover:not(:disabled) {
    background: var(--brand-soft);
    border-color: color-mix(in srgb, var(--brand) 30%, transparent);
}

.ft-btn-outline {
    background: transparent;
    border-color: var(--line);
    color: var(--text-muted);
}

.ft-btn-outline:hover:not(:disabled) {
    color: var(--text-main);
    border-color: color-mix(in srgb, var(--brand) 36%, transparent);
    background: var(--brand-soft);
}

.ft-btn-submit {
    background: var(--brand-2);
    color: var(--app-bg);
    font-weight: 800;
}

.ft-btn-submit:hover:not(:disabled) {
    background: color-mix(in srgb, var(--brand-2) 88%, var(--text-main));
}

.ft-btn-danger {
    background: color-mix(in srgb, var(--danger) 14%, transparent);
    border-color: color-mix(in srgb, var(--danger) 40%, transparent);
    color: var(--danger);
}

:where(.ft-btn, .ft-icon-btn):focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
}

/* ── Layout ──────────────────────────────────────────────────────────────── */

.ft-main {
    max-width: 1180px;
    margin: 0 auto;
    padding: var(--sp-6) var(--sp-5) var(--sp-8);
    display: flex;
    flex-direction: column;
    gap: var(--sp-6);
}

.ft-eyebrow {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--brand);
}

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

.ft-section-head h2 {
    margin: 2px 0 0;
    font-size: 1.24rem;
    font-weight: 800;
}

/* ── Hero ────────────────────────────────────────────────────────────────── */

.ft-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
    gap: var(--sp-6);
    align-items: center;
    padding: var(--sp-8) var(--sp-6);
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background:
        radial-gradient(circle at 8% 0%, color-mix(in srgb, var(--brand) 16%, transparent), transparent 60%),
        radial-gradient(circle at 96% 100%, color-mix(in srgb, var(--brand-2) 14%, transparent), transparent 58%),
        var(--surface);
    box-shadow: var(--shadow-sm);
}

.ft-hero h1 {
    margin: var(--sp-2) 0 var(--sp-2);
    font-size: clamp(1.5rem, 3.4vw, 2.05rem);
    font-weight: 900;
    line-height: 1.2;
}

.ft-hero p {
    margin: 0 0 var(--sp-5);
    color: var(--text-muted);
    font-size: 0.94rem;
    line-height: 1.6;
    max-width: 48ch;
}

.ft-hero-cta {
    display: flex;
    gap: var(--sp-3);
    flex-wrap: wrap;
}

.ft-hero-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--sp-3);
}

.ft-stat-tile {
    padding: var(--sp-4);
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    background: color-mix(in srgb, var(--surface-solid) 70%, transparent);
}

.ft-stat-tile span {
    display: block;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.ft-stat-tile b {
    font-size: 1.42rem;
    font-weight: 900;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}

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

.ft-stat-tile.is-accent b {
    color: var(--brand);
}

.ft-stat-tile.is-good b {
    color: var(--brand-2);
}

.ft-stat-tile.is-warn b {
    color: var(--warning);
}

/* ── Feature tiles ───────────────────────────────────────────────────────── */

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

.ft-feature-tile {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: var(--sp-3);
    padding: var(--sp-4) var(--sp-5);
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    background: var(--surface);
    text-align: left;
    font-family: inherit;
    color: var(--text-main);
    cursor: pointer;
    overflow: hidden;
    transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}

.ft-feature-tile::before {
    content: '';
    position: absolute;
    inset: 0 auto 0 0;
    width: 3px;
    background: var(--tile-accent, var(--brand));
}

.ft-feature-tile:hover {
    transform: translateY(-2px);
    border-color: color-mix(in srgb, var(--tile-accent, var(--brand)) 40%, transparent);
    box-shadow: var(--shadow-sm);
}

.ft-feature-tile i {
    width: 34px;
    height: 34px;
    flex: none;
    display: grid;
    place-items: center;
    border-radius: 10px;
    font-size: 0.92rem;
    color: var(--tile-accent, var(--brand));
    background: color-mix(in srgb, var(--tile-accent, var(--brand)) 13%, transparent);
}

.ft-feature-tile h3 {
    margin: 0 0 2px;
    font-size: 0.92rem;
    font-weight: 800;
}

.ft-feature-tile p {
    margin: 0;
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.45;
}

.ft-feature-tile .ft-tile-count {
    margin-left: auto;
    flex: none;
    align-self: center;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    color: var(--tile-accent, var(--brand));
    background: color-mix(in srgb, var(--tile-accent, var(--brand)) 13%, transparent);
}

/* ── Pattern filter chips ────────────────────────────────────────────────── */

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

.ft-chip {
    padding: 6px 14px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: transparent;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    transition: all .18s ease;
}

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

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

/* ── Paper cards ─────────────────────────────────────────────────────────── */

.ft-paper-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--sp-4);
}

.ft-paper-card {
    display: flex;
    flex-direction: column;
    gap: var(--sp-3);
    padding: var(--sp-5);
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: var(--surface);
    transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}

.ft-paper-card:hover {
    transform: translateY(-3px);
    border-color: color-mix(in srgb, var(--brand) 38%, transparent);
    box-shadow: var(--shadow-md);
}

.ft-paper-card-top {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    flex-wrap: wrap;
}

.ft-pattern-chip {
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--brand);
    background: var(--brand-soft);
    border: 1px solid color-mix(in srgb, var(--brand) 24%, transparent);
}

/* Same chip, said in the video track's colour so the two shelves are one
   glance apart wherever a board is shown out of its folder. */
.ft-pattern-chip.is-video {
    color: var(--danger);
    background: color-mix(in srgb, var(--danger) 12%, transparent);
    border-color: color-mix(in srgb, var(--danger) 26%, transparent);
    text-transform: none;
    letter-spacing: 0;
}

.ft-paper-card h3 {
    margin: 0;
    font-size: 1.02rem;
    font-weight: 800;
    line-height: 1.35;
}

.ft-skeleton-card {
    gap: var(--sp-3);
    pointer-events: none;
}

/* ── Coming soon ─────────────────────────────────────────────────────────── */

.ft-upcoming-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: var(--sp-3);
}

.ft-upcoming-card {
    padding: var(--sp-4);
    border-radius: var(--radius-sm);
    border: 1px dashed var(--line);
    background: color-mix(in srgb, var(--surface-solid) 45%, transparent);
}

.ft-upcoming-card strong {
    display: block;
    font-size: 0.9rem;
    font-weight: 800;
    margin-bottom: 4px;
}

.ft-upcoming-card span {
    font-size: 0.76rem;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.ft-empty {
    padding: var(--sp-8) var(--sp-5);
    text-align: center;
    color: var(--text-muted);
    border: 1px dashed var(--line);
    border-radius: var(--radius);
}

.ft-empty i {
    font-size: 1.9rem;
    color: var(--brand);
    opacity: 0.6;
    margin-bottom: var(--sp-3);
    display: block;
}

.ft-empty strong {
    display: block;
    color: var(--text-main);
    font-size: 1rem;
    margin-bottom: 4px;
}

.ft-empty p {
    margin: 0;
    font-size: 0.85rem;
    line-height: 1.6;
}

/* ── Pre-exam instructions ───────────────────────────────────────────────── */

.ft-instr-wrap {
    min-height: 100dvh;
    display: grid;
    place-items: center;
    padding: var(--sp-5);
}

.ft-instr-card {
    width: 100%;
    max-width: 760px;
    max-height: calc(100dvh - var(--sp-8));
    display: flex;
    flex-direction: column;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: var(--surface-solid);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.ft-instr-head {
    display: flex;
    align-items: flex-start;
    gap: var(--sp-3);
    padding: var(--sp-5) var(--sp-5) var(--sp-4);
    border-bottom: 1px solid var(--line);
}

.ft-instr-head h2 {
    margin: 2px 0 0;
    font-size: 1.2rem;
    font-weight: 800;
}

.ft-instr-head .ft-icon-btn {
    margin-left: auto;
}

.ft-instr-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1px;
    background: var(--line);
    border-bottom: 1px solid var(--line);
}

.ft-instr-meta div {
    padding: var(--sp-3) var(--sp-4);
    background: var(--surface-solid);
    text-align: center;
}

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

.ft-instr-meta b {
    font-size: 1.02rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.ft-instr-body {
    padding: var(--sp-5);
    overflow-y: auto;
    flex: 1;
}

.ft-instr-body h3 {
    margin: 0 0 var(--sp-3);
    font-size: 0.92rem;
    font-weight: 800;
    color: var(--brand);
}

.ft-instr-body h3:not(:first-child) {
    margin-top: var(--sp-6);
}

.ft-instr-body ol {
    margin: 0;
    padding-left: var(--sp-5);
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
}

.ft-instr-body li {
    font-size: 0.86rem;
    line-height: 1.6;
    color: var(--text-muted);
}

.ft-instr-body li b {
    color: var(--text-main);
}

.ft-legend-guide {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--sp-2) var(--sp-4);
}

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

.ft-swatch {
    width: 22px;
    height: 22px;
    flex: none;
    border-radius: 5px;
    border: 1px solid var(--line);
}

.ft-instr-foot {
    padding: var(--sp-4) var(--sp-5) var(--sp-5);
    border-top: 1px solid var(--line);
    background: color-mix(in srgb, var(--surface-raised) 60%, transparent);
    display: flex;
    flex-direction: column;
    gap: var(--sp-3);
}

.ft-lang-choice {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    flex-wrap: wrap;
}

.ft-lang-label {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-muted);
}

.ft-lang-choice label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 999px;
    border: 1px solid var(--line);
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    transition: all .18s ease;
}

.ft-lang-choice label:has(input:checked) {
    color: var(--brand);
    border-color: var(--brand);
    background: var(--brand-soft);
}

.ft-lang-choice input {
    accent-color: var(--brand);
}

.ft-declare {
    display: flex;
    align-items: flex-start;
    gap: var(--sp-3);
    font-size: 0.85rem;
    line-height: 1.55;
    cursor: pointer;
}

.ft-declare input {
    margin-top: 2px;
    width: 18px;
    height: 18px;
    flex: none;
    accent-color: var(--brand);
    cursor: pointer;
}

/* ── Modal ───────────────────────────────────────────────────────────────── */

.ft-modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: grid;
    place-items: center;
    padding: var(--sp-5);
    background: color-mix(in srgb, var(--app-bg) 72%, transparent);
    backdrop-filter: blur(10px);
}

.ft-modal[hidden] {
    display: none;
}

.ft-modal-card {
    width: 100%;
    max-width: 440px;
    max-height: calc(100dvh - var(--sp-8));
    display: flex;
    flex-direction: column;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: var(--surface-solid);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    animation: ft-pop .2s ease;
}

.ft-modal-wide .ft-modal-card {
    max-width: 860px;
}

@keyframes ft-pop {
    from { opacity: 0; transform: translateY(10px) scale(0.98); }
}

.ft-modal-card header {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-4) var(--sp-5);
    border-bottom: 1px solid var(--line);
}

.ft-modal-card header h3 {
    margin: 0;
    font-size: 1.02rem;
    font-weight: 800;
}

.ft-modal-card header .ft-icon-btn {
    margin-left: auto;
}

.ft-modal-body {
    padding: var(--sp-5);
    overflow-y: auto;
    font-size: 0.88rem;
    line-height: 1.62;
    color: var(--text-muted);
}

.ft-modal-body strong {
    color: var(--text-main);
}

.ft-modal-card footer {
    padding: var(--sp-4) var(--sp-5);
    border-top: 1px solid var(--line);
    display: flex;
    gap: var(--sp-2);
    justify-content: flex-end;
    flex-wrap: wrap;
}

/* Submit-confirmation summary grid */
.ft-confirm-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
    gap: var(--sp-2);
    margin-top: var(--sp-4);
}

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

.ft-confirm-grid span {
    display: block;
    font-size: 0.66rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: 3px;
}

.ft-confirm-grid b {
    font-size: 1.2rem;
    font-weight: 900;
    font-variant-numeric: tabular-nums;
}

/* ── Processing overlay ──────────────────────────────────────────────────── */

.ft-overlay {
    position: fixed;
    inset: 0;
    z-index: 300;
    display: grid;
    place-items: center;
    background: color-mix(in srgb, var(--app-bg) 88%, transparent);
    backdrop-filter: blur(14px);
}

.ft-overlay[hidden] {
    display: none;
}

.ft-overlay-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-8) var(--sp-6);
    min-width: 280px;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: var(--surface-solid);
    box-shadow: var(--shadow-md);
    text-align: center;
}

.ft-overlay-card strong {
    font-size: 1rem;
    font-weight: 800;
}

.ft-overlay-card span {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.ft-spinner {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 3px solid color-mix(in srgb, var(--brand) 22%, transparent);
    border-top-color: var(--brand);
    animation: ft-spin .8s linear infinite;
}

@keyframes ft-spin {
    to { transform: rotate(360deg); }
}

.ft-progress {
    width: 100%;
    height: 5px;
    border-radius: 999px;
    overflow: hidden;
    background: color-mix(in srgb, var(--text-muted) 20%, transparent);
}

.ft-progress > div {
    height: 100%;
    width: 0;
    border-radius: 999px;
    background: var(--brand);
    transition: width .28s ease;
}

/* ── Toast ───────────────────────────────────────────────────────────────── */

.ft-toast {
    position: fixed;
    left: 50%;
    bottom: 28px;
    z-index: 400;
    transform: translate(-50%, 18px);
    max-width: min(90vw, 420px);
    padding: 11px 20px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--surface-solid);
    box-shadow: var(--shadow-md);
    color: var(--text-main);
    font-size: 0.85rem;
    font-weight: 600;
    text-align: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity .22s ease, transform .22s ease;
}

.ft-toast.is-visible {
    opacity: 1;
    transform: translate(-50%, 0);
}

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

@media (max-width: 900px) {
    .ft-hero {
        grid-template-columns: 1fr;
        padding: var(--sp-6) var(--sp-5);
    }

    .ft-main {
        padding: var(--sp-5) var(--sp-4) var(--sp-8);
        gap: var(--sp-5);
    }
}

@media (max-width: 560px) {
    .ft-topbar {
        padding: var(--sp-3) var(--sp-4);
    }

    .ft-brand small {
        display: none;
    }

    .ft-hero-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .ft-paper-grid,
    .ft-feature-grid {
        grid-template-columns: 1fr;
    }
}

/* ── Folder browser ─────────────────────────────────────────────────────────
   A hundred and fifty papers do not belong on one screen. They are filed —
   board › exam › test type — and each level is a row you open, carrying the
   count and how far through it you are. The row is deliberately wide rather
   than a grid of squares: what decides which folder to open is the sentence
   under the name, and a square has nowhere to put one.                      */

.ft-crumbs {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.ft-crumb {
    padding: 5px 10px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    transition: color .15s ease, background .15s ease;
}

.ft-crumb:hover {
    color: var(--text-main);
    background: var(--brand-soft);
}

.ft-crumb.is-current {
    color: var(--text-main);
    cursor: default;
}

.ft-crumb-sep {
    font-size: 0.68rem;
    color: var(--text-muted);
    opacity: .55;
}

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

.ft-folder {
    display: flex;
    align-items: center;
    gap: var(--sp-4);
    width: 100%;
    padding: var(--sp-4) var(--sp-5);
    text-align: left;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    color: inherit;
    font-family: inherit;
    transition: transform .15s ease, border-color .15s ease;
}

button.ft-folder {
    cursor: pointer;
}

button.ft-folder:hover {
    transform: translateY(-2px);
    border-color: color-mix(in srgb, var(--folder-accent, var(--brand)) 45%, transparent);
}

/* A track with no papers still shows, because the reason it is empty is worth
   reading. It is not a button and must not look like one. */
.ft-folder.is-empty {
    opacity: .6;
}

.ft-folder-icon {
    flex: none;
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    border-radius: 14px;
    font-size: 1.05rem;
    color: var(--folder-accent, var(--brand));
    background: color-mix(in srgb, var(--folder-accent, var(--brand)) 13%, transparent);
}

.ft-folder-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.ft-folder-body strong {
    font-size: 0.98rem;
    font-weight: 800;
}

.ft-folder-body small {
    font-size: 0.78rem;
    line-height: 1.45;
    color: var(--text-muted);
}

.ft-folder-bar {
    display: block;
    height: 4px;
    max-width: 280px;
    margin-top: 5px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--text-muted) 18%, transparent);
    overflow: hidden;
}

.ft-folder-bar i {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: var(--folder-accent, var(--brand));
    transition: width .3s ease;
}

.ft-folder-meta {
    flex: none;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    line-height: 1.3;
}

.ft-folder-meta b {
    font-size: 1.3rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.ft-folder-meta small,
.ft-folder-meta em {
    font-size: 0.7rem;
    font-style: normal;
    color: var(--text-muted);
}

.ft-folder-go {
    flex: none;
    font-size: 0.82rem;
    color: var(--text-muted);
}

@media (max-width: 720px) {
    .ft-folder { padding: var(--sp-4); gap: var(--sp-3); }
    .ft-folder-icon { width: 40px; height: 40px; border-radius: 12px; }
    .ft-folder-go { display: none; }
    .ft-crumbs { width: 100%; }
}

/* ── Series board ───────────────────────────────────────────────────────────
   Thirty papers per exam, so a paper gets a numbered tile rather than a card.
   Everything a card used to repeat — question count, duration, marks, whether
   there is negative marking — is true of all thirty and is said once, in the
   series header. What is left per paper is its number and the student's best
   score, which is exactly what a tile can hold.                            */

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

.ft-series {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    overflow: hidden;
}

.ft-series-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--sp-4);
    flex-wrap: wrap;
    padding: var(--sp-5);
    border-bottom: 1px solid var(--line);
}

.ft-series-id h3 {
    margin: var(--sp-2) 0 4px;
    font-size: 1.12rem;
    font-weight: 800;
}

.ft-series-id p {
    margin: 0;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.ft-series-progress {
    min-width: 190px;
    text-align: right;
}

.ft-series-progress-num {
    display: flex;
    align-items: baseline;
    justify-content: flex-end;
    gap: 6px;
}

.ft-series-progress-num b {
    font-size: 1.4rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.ft-series-progress-num span,
.ft-series-progress small {
    font-size: 0.74rem;
    color: var(--text-muted);
}

.ft-progress-track {
    height: 5px;
    margin: 7px 0 5px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--text-muted) 18%, transparent);
    overflow: hidden;
}

.ft-progress-track i {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: var(--brand);
    transition: width .3s ease;
}

.ft-tier-band {
    display: flex;
    align-items: flex-start;
    gap: var(--sp-4);
    padding: var(--sp-4) var(--sp-5);
}

.ft-tier-band + .ft-tier-band {
    border-top: 1px dashed color-mix(in srgb, var(--line) 90%, transparent);
}

.ft-tier-label {
    flex: 0 0 150px;
    padding-top: 6px;
}

.ft-tier-label strong {
    display: block;
    font-size: 0.82rem;
    font-weight: 800;
}

.ft-tier-label small {
    font-size: 0.7rem;
    line-height: 1.35;
    color: var(--text-muted);
}

.ft-tile-row {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(62px, 1fr));
    gap: var(--sp-2);
}

.ft-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 9px 4px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: transparent;
    color: inherit;
    cursor: pointer;
    transition: transform .15s ease, border-color .15s ease, background .15s ease;
}

.ft-tile:hover {
    transform: translateY(-2px);
    border-color: color-mix(in srgb, var(--brand) 45%, transparent);
    background: var(--brand-soft);
}

.ft-tile b {
    font-size: 1.02rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    line-height: 1;
}

.ft-tile-foot {
    font-size: 0.64rem;
    font-weight: 700;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

/* Attempted tiles carry their best score in the same three bands the result
   screen and the old best-badge use, so a colour means one thing everywhere. */
.ft-tile.is-good { border-color: color-mix(in srgb, var(--brand-2) 45%, transparent); background: color-mix(in srgb, var(--brand-2) 10%, transparent); }
.ft-tile.is-good .ft-tile-foot { color: var(--brand-2); }
.ft-tile.is-mid  { border-color: color-mix(in srgb, var(--warning) 45%, transparent); background: color-mix(in srgb, var(--warning) 11%, transparent); }
.ft-tile.is-mid .ft-tile-foot { color: var(--warning); }
.ft-tile.is-low  { border-color: color-mix(in srgb, var(--danger) 42%, transparent); background: color-mix(in srgb, var(--danger) 10%, transparent); }
.ft-tile.is-low .ft-tile-foot { color: var(--danger); }

@media (max-width: 720px) {
    .ft-series-head { align-items: flex-start; }
    .ft-series-progress { min-width: 0; text-align: left; }
    .ft-series-progress-num { justify-content: flex-start; }

    /* The label stops being a gutter and becomes a heading above the row.
       align-items must go back to stretch with it: left at flex-start from the
       desktop rule, a column band shrinks the tile row to its narrowest grid
       column and the tiles come out stacked one per line. */
    .ft-tier-band { flex-direction: column; align-items: stretch; gap: var(--sp-2); padding: var(--sp-4); }
    .ft-tier-label { flex: none; padding-top: 0; }
    .ft-tile-row { grid-template-columns: repeat(auto-fill, minmax(54px, 1fr)); }
}

/* ── Interface chooser ──────────────────────────────────────────────────────
   The last screen before the clock starts. Two cards rather than two radios:
   this decides what the next hour looks like, and it was previously a pair of
   unstyled radio inputs in the instructions footer that nobody ever saw.     */

.ft-iface-lede {
    margin: 0 0 var(--sp-4);
    font-size: 0.84rem;
    color: var(--text-muted);
}

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

.ft-iface-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: var(--sp-4);
    text-align: left;
    font-family: inherit;
    color: var(--text-main);
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    background: var(--surface);
    cursor: pointer;
    transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}

.ft-iface-card:hover,
.ft-iface-card:focus-visible {
    transform: translateY(-2px);
    border-color: color-mix(in srgb, var(--brand) 55%, transparent);
    box-shadow: var(--shadow-md);
}

/* The one they sat last time, so a student drilling ten papers taps once
   without having to read both cards again. */
.ft-iface-card.is-current {
    border-color: color-mix(in srgb, var(--brand) 45%, transparent);
    background: var(--brand-soft);
}

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

.ft-iface-head strong {
    font-size: 0.98rem;
    font-weight: 800;
}

.ft-iface-head em {
    flex: none;
    font-style: normal;
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--brand);
}

.ft-iface-desc {
    font-size: 0.78rem;
    line-height: 1.45;
    color: var(--text-muted);
}

.ft-iface-note {
    font-size: 0.74rem;
    font-weight: 700;
    color: var(--brand);
}

/* The Eduquity engine's frame. It owns the whole viewport while a paper is
   running — the engine draws its own header, palette and clock, so nothing of
   this page may show through or scroll behind it. */
.ft-engine-shell {
    position: fixed;
    inset: 0;
    z-index: 9000;
    background: #fff;
}

.ft-engine-shell[hidden] {
    display: none;
}

.ft-engine-shell iframe {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
}

body.ft-engine-active {
    overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: .01ms !important;
        transition-duration: .01ms !important;
    }
}
