:root {
    color-scheme: light;
    --ink-950: #102f37;
    --ink-900: #173b46;
    --ink-800: #23515c;
    --ink-700: #386a73;
    --ink-500: #6f8f95;
    --ink-300: #b8cbce;
    --paper: #fbfaf5;
    --paper-strong: #ffffff;
    --paper-muted: #f1f3ed;
    --line: #dce4df;
    --brand: #0f756e;
    --brand-strong: #075d58;
    --brand-soft: #dff2ec;
    --accent: #e3a132;
    --accent-soft: #fff2d6;
    --danger: #b85047;
    --danger-soft: #fbe8e4;
    --shadow-sm: 0 8px 24px rgba(21, 61, 69, 0.08);
    --shadow-lg: 0 28px 70px rgba(10, 46, 55, 0.18);
    --radius-sm: 10px;
    --radius-md: 18px;
    --radius-lg: 28px;
    --space-1: 0.375rem;
    --space-2: 0.75rem;
    --space-3: 1rem;
    --space-4: 1.5rem;
    --space-5: 2rem;
    --space-6: 3rem;
    --font-sans: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, -apple-system, sans-serif;
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    background: var(--paper);
    font-family: var(--font-sans);
    color: var(--ink-950);
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--paper);
}

a {
    color: inherit;
}

button,
input,
select,
textarea {
    font: inherit;
}

.skip-link {
    position: fixed;
    z-index: 100;
    top: 0.75rem;
    left: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--paper-strong);
    border-radius: var(--radius-sm);
    color: var(--ink-950);
    transform: translateY(-180%);
    transition: transform 160ms ease;
}

.skip-link:focus {
    transform: translateY(0);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.brand-mark {
    display: inline-grid;
    width: 2.4rem;
    height: 2.4rem;
    place-items: center;
    border-radius: 0.8rem 0.8rem 0.2rem 0.8rem;
    background: var(--accent);
    color: #332209;
    font-size: 1rem;
    font-weight: 900;
}

.brand--light {
    color: var(--paper-strong);
}

.eyebrow {
    margin: 0 0 var(--space-2);
    color: var(--brand);
    font-size: 0.75rem;
    font-weight: 850;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.eyebrow--light {
    color: #aee0d7;
}

.button {
    display: inline-flex;
    min-height: 2.8rem;
    align-items: center;
    justify-content: center;
    padding: 0.72rem 1.1rem;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-weight: 750;
    text-decoration: none;
    cursor: pointer;
    transition: transform 150ms ease, background 150ms ease, box-shadow 150ms ease;
}

.button:hover {
    transform: translateY(-1px);
}

.button:focus-visible,
.text-link:focus-visible,
.nav-link:focus-visible,
.row-link:focus-visible {
    outline: 3px solid rgba(227, 161, 50, 0.5);
    outline-offset: 3px;
}

.button--primary {
    background: var(--brand);
    color: var(--paper-strong);
    box-shadow: 0 8px 16px rgba(15, 117, 110, 0.2);
}

.button--primary:hover {
    background: var(--brand-strong);
}

.button--secondary {
    border-color: var(--line);
    background: var(--paper-strong);
    color: var(--ink-900);
}

.button--full {
    width: 100%;
}

.text-link {
    color: var(--brand-strong);
    font-weight: 750;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.25rem;
}

/* Public and login pages */

.public-page {
    background:
        radial-gradient(circle at 12% 10%, rgba(59, 151, 137, 0.32), transparent 28rem),
        linear-gradient(135deg, var(--ink-950), #174d57 62%, #1e6063);
}

.landing-shell {
    display: grid;
    width: min(1180px, calc(100% - 3rem));
    min-height: 100vh;
    margin: 0 auto;
    grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.75fr);
    align-items: center;
    gap: clamp(3rem, 7vw, 7rem);
    padding: 4rem 0;
}

.landing-copy {
    color: var(--paper-strong);
}

.landing-copy .brand {
    margin-bottom: clamp(3.5rem, 8vh, 6rem);
}

.landing-copy h1 {
    max-width: 18ch;
    margin: 0;
    font-size: clamp(2.55rem, 6vw, 5.3rem);
    line-height: 1.07;
    letter-spacing: -0.045em;
}

.landing-summary {
    max-width: 46rem;
    margin: 1.75rem 0 2.5rem;
    color: #d5e8e5;
    font-size: clamp(1rem, 1.7vw, 1.2rem);
    line-height: 1.9;
}

.feature-list {
    display: grid;
    max-width: 46rem;
    margin: 0;
    padding: 0;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    list-style: none;
}

.feature-list li {
    display: grid;
    gap: 0.7rem;
    padding-top: 1.2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.22);
    color: #e7f1ef;
    line-height: 1.6;
}

.feature-list span {
    color: var(--accent);
    font-size: 0.8rem;
    font-weight: 800;
}

.login-card,
.auth-card {
    padding: clamp(1.6rem, 4vw, 2.7rem);
    border: 1px solid rgba(255, 255, 255, 0.75);
    border-radius: var(--radius-lg);
    background: rgba(251, 250, 245, 0.96);
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(14px);
}

.login-card h2,
.auth-card h1 {
    margin: 0 0 0.75rem;
    font-size: clamp(1.7rem, 3vw, 2.25rem);
    letter-spacing: -0.03em;
}

.login-card > div:first-child > p:last-child,
.auth-card > p {
    margin: 0 0 1.7rem;
    color: var(--ink-700);
    line-height: 1.7;
}

.login-help,
.privacy-note {
    display: flex;
    gap: 0.6rem;
    margin-top: 1.2rem;
    color: var(--ink-700);
    font-size: 0.85rem;
    line-height: 1.5;
}

.login-help {
    flex-direction: column;
    padding: 1rem;
    border-radius: var(--radius-sm);
    background: var(--paper-muted);
}

.privacy-note {
    align-items: flex-start;
}

.privacy-dot {
    width: 0.58rem;
    height: 0.58rem;
    margin-top: 0.3rem;
    flex: 0 0 auto;
    border-radius: 999px;
    background: var(--brand);
}

.auth-shell {
    display: grid;
    width: min(520px, calc(100% - 2rem));
    min-height: 100vh;
    margin: 0 auto;
    align-content: center;
    gap: 2rem;
    padding: 3rem 0;
}

.auth-shell--wide {
    width: min(760px, calc(100% - 2rem));
}

.auth-form {
    display: grid;
    gap: 0.7rem;
}

.auth-form label {
    margin-top: 0.45rem;
    color: var(--ink-900);
    font-size: 0.9rem;
    font-weight: 750;
}

.auth-form input {
    width: 100%;
    min-height: 3rem;
    padding: 0.75rem 0.9rem;
    border: 1px solid var(--ink-300);
    border-radius: var(--radius-sm);
    background: var(--paper-strong);
    color: var(--ink-950);
}

.auth-form input:focus {
    border-color: var(--brand);
    outline: 3px solid rgba(15, 117, 110, 0.15);
}

.password-field-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.password-field-wrapper input {
    padding-right: 2.8rem;
}

.password-toggle-btn {
    position: absolute;
    right: 0.6rem;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.35rem;
    color: var(--ink-500);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: color 0.15s ease;
}

.password-toggle-btn:hover {
    color: var(--ink-900);
}

.auth-form .button {
    margin-top: 0.8rem;
}

.registration-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.8rem 1rem;
}

.registration-grid p {
    display: grid;
    align-content: start;
    gap: 0.35rem;
    margin: 0;
}

.registration-grid__wide {
    grid-column: 1 / -1;
}

.registration-grid small,
.candidate-form-grid small {
    color: var(--ink-600);
    line-height: 1.5;
}

.auth-form .errorlist {
    margin: 0;
    padding: 0;
    color: var(--danger);
    font-size: 0.82rem;
    list-style: none;
}

.password-help {
    margin-top: 0.9rem;
    padding: 0.8rem 1rem;
    border-radius: var(--radius-sm);
    background: var(--paper-muted);
    color: var(--ink-700);
    font-size: 0.85rem;
}

.password-help summary {
    color: var(--ink-900);
    font-weight: 800;
    cursor: pointer;
}

.password-help ul {
    margin-bottom: 0;
    padding-left: 1.2rem;
}

.auth-switch,
.pending-note {
    margin: 1.2rem 0 0;
    color: var(--ink-700);
    text-align: center;
}

.registration-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
    margin: 1.4rem 0;
}

.registration-summary div {
    padding: 0.85rem 1rem;
    border-radius: var(--radius-sm);
    background: var(--paper-muted);
}

.registration-summary__wide {
    grid-column: 1 / -1;
}

.registration-summary dt {
    color: var(--ink-500);
    font-size: 0.78rem;
    font-weight: 800;
}

.registration-summary dd {
    margin: 0.25rem 0 0;
    color: var(--ink-950);
    font-weight: 800;
    overflow-wrap: anywhere;
}

.registration-steps {
    display: grid;
    gap: 0.75rem;
    margin: 1.5rem 0;
    padding: 0;
    list-style: none;
}

.registration-steps li {
    display: grid;
    gap: 0.25rem;
    padding: 1rem;
    border: 1px solid var(--line);
    border-left: 5px solid var(--ink-300);
    border-radius: var(--radius-sm);
}

.registration-steps li.is-current {
    border-left-color: var(--accent);
}

.registration-steps li.is-done {
    border-left-color: var(--success);
}

.registration-steps span {
    color: var(--ink-700);
    line-height: 1.5;
}

.form-alert {
    margin: 1rem 0;
    padding: 0.9rem 1rem;
    border-left: 4px solid var(--danger);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    background: var(--danger-soft);
    color: #743029;
}

.button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.login-card > .button + .button {
    margin-top: 0.75rem;
}

.auth-card > .text-link {
    display: inline-block;
    margin-top: 1.5rem;
}

.page-preview {
    margin: 1rem 0 1.5rem;
}

.page-preview img {
    display: block;
    width: min(100%, 52rem);
    height: auto;
    border: 1px solid var(--line);
    border-radius: 0.75rem;
    background: #fff;
    box-shadow: 0 0.75rem 2rem rgb(27 45 66 / 8%);
}

.page-preview figcaption {
    margin-top: 0.5rem;
    color: var(--ink-700);
    font-size: 0.8rem;
}

/* Application shell */

.app-shell {
    display: grid;
    min-height: 100vh;
    grid-template-columns: 236px minmax(0, 1fr);
}

.sidebar {
    position: sticky;
    top: 0;
    display: flex;
    height: 100vh;
    padding: 1.5rem 1.1rem;
    flex-direction: column;
    background: var(--ink-950);
    color: #eef7f5;
}

.sidebar .brand {
    padding: 0.3rem 0.55rem 1.8rem;
}

.side-nav {
    display: grid;
    gap: 0.4rem;
}

.nav-link {
    display: flex;
    min-height: 2.75rem;
    align-items: center;
    gap: 0.8rem;
    padding: 0.7rem 0.8rem;
    border-radius: var(--radius-sm);
    color: #c7dbd8;
    text-decoration: none;
}

.nav-link span {
    color: #6d9797;
    font-size: 0.7rem;
    font-weight: 850;
}

.nav-link:hover,
.nav-link.is-current {
    background: rgba(255, 255, 255, 0.09);
    color: var(--paper-strong);
}

.nav-link.is-current span {
    color: var(--accent);
}

.sidebar-profile {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    margin-top: auto;
    padding: 1rem 0.5rem 0;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.avatar {
    display: grid;
    width: 2.25rem;
    height: 2.25rem;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 50%;
    background: var(--brand);
    font-weight: 850;
}

.sidebar-profile span:last-child {
    display: grid;
}

.sidebar-profile small {
    margin-top: 0.15rem;
    color: #9ebcba;
}

.workspace {
    min-width: 0;
    padding: clamp(1.2rem, 3vw, 2.7rem);
    background:
        linear-gradient(rgba(245, 247, 242, 0.88), rgba(245, 247, 242, 0.96)),
        repeating-linear-gradient(0deg, transparent, transparent 31px, rgba(29, 89, 90, 0.035) 32px);
}

.preview-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 0.8rem 1rem;
    border: 1px solid #ead59f;
    border-radius: var(--radius-sm);
    background: var(--accent-soft);
    color: #69491b;
    font-size: 0.85rem;
}

.preview-bar nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.preview-bar a {
    padding: 0.35rem 0.55rem;
    border-radius: 0.5rem;
    text-decoration: none;
}

.preview-bar a.is-active {
    background: #6d4c1c;
    color: #fff8e8;
}

.workspace-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 2rem;
    margin-bottom: 2rem;
}

.workspace-header > div:first-child {
    max-width: 760px;
}

.workspace-header h1 {
    margin: 0;
    font-size: clamp(1.8rem, 3.5vw, 3.2rem);
    line-height: 1.18;
    letter-spacing: -0.045em;
}

.workspace-header p:last-child {
    margin: 0.8rem 0 0;
    color: var(--ink-700);
    line-height: 1.7;
}

.header-actions {
    display: flex;
    flex: 0 0 auto;
    gap: 0.7rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.stat-card,
.panel,
.workflow-strip {
    border: 1px solid rgba(188, 207, 204, 0.78);
    background: rgba(255, 255, 255, 0.9);
    box-shadow: var(--shadow-sm);
}

.stat-card {
    display: grid;
    min-height: 148px;
    padding: 1.25rem;
    align-content: space-between;
    border-radius: var(--radius-md);
}

.stat-card span {
    color: var(--ink-700);
    font-size: 0.88rem;
    font-weight: 700;
}

.stat-card strong {
    margin: 0.55rem 0;
    font-size: clamp(1.8rem, 4vw, 2.65rem);
    letter-spacing: -0.04em;
}

.stat-card small {
    color: var(--ink-500);
    line-height: 1.45;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(280px, 0.65fr);
    gap: 1rem;
}

.panel {
    padding: 1.4rem;
    border-radius: var(--radius-md);
}

.panel-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.panel h2,
.workflow-strip h2 {
    margin: 0;
    font-size: clamp(1.15rem, 2vw, 1.45rem);
    letter-spacing: -0.025em;
}

.task-list {
    display: grid;
}

.task-row {
    display: grid;
    min-width: 0;
    align-items: center;
    grid-template-columns: 0.6rem minmax(0, 1fr) auto auto;
    gap: 0.85rem;
    padding: 1rem 0;
    border-top: 1px solid var(--line);
}

.task-marker {
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 50%;
    background: var(--ink-300);
}

.task-marker--warning {
    background: var(--accent);
}

.task-marker--success {
    background: var(--brand);
}

.task-copy {
    display: grid;
    min-width: 0;
    gap: 0.25rem;
}

.task-copy strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.task-copy small {
    color: var(--ink-500);
}

/* 工作中心自己的列：刻意不沿用 .task-row，因為 dashboard 也在用那組樣式。
   這裡每列的元素比 dashboard 多（失敗原因、重新排隊按鈕），
   硬套四欄 grid 會把標題擠成一個字一行，狀態也會和失敗原因疊在一起。 */
.job-row {
    display: grid;
    grid-template-columns: 0.6rem minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.5rem 0.85rem;
    padding: 1rem 0;
    border-top: 1px solid var(--line);
}

.job-row__copy {
    display: grid;
    min-width: 0;
    gap: 0.25rem;
}

.job-row__copy strong {
    overflow-wrap: anywhere;
}

.job-row__copy small {
    color: var(--ink-500);
    overflow-wrap: anywhere;
}

/* 失敗原因與操作各自獨立一列、跨到最後一欄，才不會和狀態標籤搶同一格 */
.job-row__reason {
    grid-column: 2 / -1;
    color: var(--ink-500);
    overflow-wrap: anywhere;
}

.job-row__action {
    grid-column: 2 / -1;
    justify-self: start;
}

@media (max-width: 820px) {
    .job-row {
        grid-template-columns: 0.6rem minmax(0, 1fr);
    }

    .job-row__status {
        grid-column: 2;
        justify-self: start;
    }
}

.status {
    padding: 0.35rem 0.6rem;
    border-radius: 999px;
    background: var(--paper-muted);
    color: var(--ink-700);
    font-size: 0.75rem;
    font-weight: 750;
    white-space: nowrap;
}

.status--warning {
    background: var(--accent-soft);
    color: #78531d;
}

.status--success {
    background: var(--brand-soft);
    color: var(--brand-strong);
}

.row-link {
    color: var(--brand-strong);
    font-size: 0.83rem;
    font-weight: 750;
    text-underline-offset: 0.2rem;
}

.upload-panel {
    overflow: hidden;
    background: linear-gradient(160deg, var(--ink-900), var(--ink-950));
    color: var(--paper-strong);
}

.upload-panel .eyebrow {
    color: #83cec1;
}

.upload-panel p:not(.eyebrow) {
    color: #c8ddda;
    line-height: 1.7;
}

.upload-panel .button {
    margin: 0.7rem 0 0.9rem;
    background: var(--accent);
    color: #332209;
    box-shadow: none;
}

.upload-panel > small {
    display: block;
    color: #8fb1ae;
    line-height: 1.5;
}

.upload-illustration {
    position: relative;
    height: 88px;
    margin-bottom: 1.1rem;
}

.upload-illustration span {
    position: absolute;
    display: grid;
    width: 76px;
    height: 76px;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.08);
    font-size: 0.75rem;
    font-weight: 850;
    letter-spacing: 0.08em;
    transform: rotate(-5deg);
}

.upload-illustration span:last-child {
    left: 58px;
    top: 10px;
    background: rgba(227, 161, 50, 0.18);
    transform: rotate(7deg);
}

.workflow-strip {
    display: grid;
    align-items: center;
    grid-template-columns: minmax(260px, 0.7fr) minmax(0, 1.3fr);
    gap: 2rem;
    margin-top: 1rem;
    padding: 1.4rem;
    border-radius: var(--radius-md);
}

.workflow-strip ol {
    display: grid;
    margin: 0;
    padding: 0;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.4rem;
    list-style: none;
}

.workflow-strip li {
    display: grid;
    min-width: 0;
    justify-items: center;
    gap: 0.45rem;
    color: var(--ink-500);
    font-size: 0.72rem;
    text-align: center;
}

.workflow-strip li span {
    display: grid;
    width: 2rem;
    height: 2rem;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: var(--paper-strong);
    font-weight: 800;
}

.workflow-strip li.is-done,
.workflow-strip li.is-current {
    color: var(--ink-900);
    font-weight: 700;
}

.workflow-strip li.is-done span {
    border-color: var(--brand);
    background: var(--brand);
    color: white;
}

.workflow-strip li.is-current span {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-soft);
}

/* Question library */

.library-page {
    background: linear-gradient(145deg, #f4f7f1 0%, var(--paper) 48%, #eef5f3 100%);
}

.library-shell {
    width: min(1440px, calc(100% - 3rem));
    min-height: 100vh;
    margin: 0 auto;
    padding: 2.5rem 0 5rem;
}

.library-header,
.panel-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1.5rem;
}

.library-header h1,
.panel-heading h2 {
    margin: 0;
}

.library-header > div > p:last-child {
    color: var(--ink-700);
}

.filter-panel,
.library-results,
.detail-panel {
    margin-top: 1.5rem;
    padding: 1.5rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.9);
    box-shadow: var(--shadow-sm);
}

.filter-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
}

.filter-grid p {
    display: grid;
    align-content: start;
    gap: 0.4rem;
    margin: 0;
}

.filter-grid label {
    color: var(--ink-800);
    font-size: 0.8rem;
    font-weight: 800;
}

.filter-grid input:not([type="checkbox"]),
.filter-grid select {
    width: 100%;
    min-height: 2.8rem;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--ink-300);
    border-radius: var(--radius-sm);
    background: var(--paper-strong);
    color: var(--ink-950);
}

.filter-grid select[multiple] {
    min-height: 7.5rem;
}

.filter-search {
    grid-column: span 2;
}

.filter-check {
    display: flex !important;
    align-items: center;
    align-self: end;
    min-height: 2.8rem;
    grid-auto-flow: column;
    justify-content: start;
}

.filter-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1.2rem;
}

.question-table-wrap {
    margin-top: 1rem;
    overflow-x: auto;
}

.question-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.question-bank-table {
    min-width: 68rem;
    table-layout: auto;
}

.question-table th,
.question-table td {
    padding: 0.85rem 0.75rem;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
}

.question-table th {
    color: var(--ink-700);
    font-size: 0.72rem;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.question-table td small,
.question-table td span {
    display: block;
    margin-top: 0.25rem;
}

.question-table td {
    overflow-wrap: anywhere;
    word-break: break-word;
}

.question-bank-table td:nth-child(1) {
    width: 7rem;
}

.question-bank-table td:nth-child(2) {
    min-width: 24rem;
}

.question-bank-table td:nth-child(3) {
    min-width: 10rem;
}

.question-bank-table td:nth-child(8) {
    width: 5rem;
    white-space: nowrap;
}

.question-summary {
    min-width: 15rem;
    max-width: 28rem;
    color: var(--ink-700);
    line-height: 1.5;
}

.question-thumb,
.thumb-placeholder {
    display: grid;
    width: 4.5rem;
    height: 5.8rem;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 0.55rem;
    background: var(--paper-muted);
    color: var(--ink-500);
    font-size: 0.7rem;
    object-fit: cover;
    object-position: top;
}

.empty-cell {
    padding: 3rem !important;
    color: var(--ink-700);
    text-align: center !important;
}

.pagination {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 1.5rem;
}

.pagination a {
    color: var(--brand-strong);
    font-weight: 800;
}

.question-detail-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
    gap: 1.5rem;
}

.detail-panel h2 {
    margin-top: 0;
}

.source-page-image {
    display: block;
    width: 100%;
    max-height: 52rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    object-fit: contain;
    background: white;
}

.shared-material,
.question-stem {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: var(--radius-sm);
    background: var(--paper-muted);
    line-height: 1.8;
}

.option-list,
.solution-sections {
    line-height: 1.8;
}

.solution-sections dt {
    margin-top: 1rem;
    color: var(--ink-800);
    font-weight: 850;
}

.solution-sections dd {
    margin: 0.35rem 0 0;
    color: var(--ink-700);
}

.attempt-list {
    display: grid;
    gap: 0.6rem;
}

.attempt-list article {
    display: grid;
    grid-template-columns: minmax(140px, 1fr) minmax(180px, 1fr) auto;
    gap: 1rem;
    padding: 0.8rem 0;
    border-bottom: 1px solid var(--line);
}

.notice-panel,
.page-add-panel,
.candidate-list {
    margin-top: 1.5rem;
    padding: 1.5rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.92);
    box-shadow: var(--shadow-sm);
}

.notice-panel {
    border-left: 5px solid var(--brand);
}

.notice-panel--danger {
    border-left-color: var(--danger);
}

.notice-panel p,
.page-add-panel p {
    color: var(--ink-700);
}

.page-add-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
}

.page-add-panel h2 {
    margin: 0;
}

.page-add-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.6rem;
}

.manual-add-panel {
    margin-top: 1.5rem;
    padding: 1rem 1.25rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.78);
}

.manual-add-panel summary {
    cursor: pointer;
    color: var(--ink-800);
    font-weight: 700;
}

.manual-add-panel p { color: var(--ink-700); }

.candidate-card {
    display: grid;
    grid-template-columns: 7rem minmax(0, 1fr) auto;
    align-items: center;
    gap: 1rem;
    margin-top: 1rem;
    padding: 1rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: white;
}

.mistake-card {
    grid-template-columns: minmax(0, 1fr) auto;
}

.mistake-table {
    min-width: 72rem;
}

.mistake-table th,
.mistake-table td {
    padding: 0.85rem 0.7rem;
}

.mistake-select-column {
    width: 3.5rem;
    text-align: center !important;
}

.mistake-select {
    width: 1.25rem;
    height: 1.25rem;
    margin: 0;
    accent-color: var(--brand);
}

.mistake-image-cell {
    width: 10rem;
}

.mistake-thumb {
    display: block;
    width: 8.5rem;
    height: 6.75rem;
    border: 1px solid var(--line);
    border-radius: 0.55rem;
    background: var(--paper-muted);
    object-fit: contain;
    object-position: top;
}

.mistake-image-cell .thumb-placeholder {
    width: 8.5rem;
    height: 6.75rem;
    padding: 0.5rem;
    text-align: center;
}

.mistake-question-cell {
    min-width: 25rem;
    max-width: 42rem;
}

.mistake-question-text {
    display: block;
}

.mistake-question-link {
    color: inherit;
    text-decoration: none;
}

.mistake-question-link:hover .mistake-question-text,
.mistake-question-link:focus-visible .mistake-question-text {
    color: var(--brand-strong);
    text-decoration: underline;
    text-underline-offset: 0.15em;
}

.mistake-question-text {
    margin-top: 0.35rem;
    color: var(--ink-800);
    line-height: 1.6;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.mistake-meta-cell {
    min-width: 9rem;
}

/* -------------------------------------------------------------------------
   Practice Paper Sheet & Cards
   ------------------------------------------------------------------------- */
.practice-paper-sheet {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    margin-top: 1.5rem;
    width: 100%;
}

.practice-paper-card {
    display: block;
    width: 100%;
    padding: 1.5rem 1.75rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-md, 0.75rem);
    background: white;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.practice-paper-card:hover {
    border-color: var(--line-strong, #94a3b8);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}

.practice-card-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding-bottom: 0.85rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--line-light, #f1f5f9);
}

.practice-number-group {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.practice-number-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    background: var(--brand-tint, #e0f2fe);
    color: var(--brand-strong, #0369a1);
    font-weight: 700;
    font-size: 1rem;
    border-radius: 9999px;
    letter-spacing: 0.02em;
}

.practice-orig-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.6rem;
    background: var(--paper-muted, #f1f5f9);
    color: var(--ink-500, #64748b);
    font-size: 0.85rem;
    font-weight: 500;
    border-radius: 0.375rem;
    border: 1px solid var(--line, #e2e8f0);
}

.practice-meta-tags {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.practice-meta-tags .meta-tag {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    font-size: 0.8rem;
    color: var(--ink-600, #475569);
    background: #f8fafc;
    border: 1px solid var(--line, #e2e8f0);
    border-radius: 0.35rem;
}

.practice-meta-tags .meta-tag--difficulty {
    color: var(--brand, #0284c7);
    font-weight: 600;
    background: #f0f9ff;
    border-color: #bae6fd;
}

.practice-question-body {
    width: 100%;
}

.practice-question-stem {
    color: var(--ink-900, #0f172a);
    font-size: 1.05rem;
    line-height: 1.8;
    overflow-wrap: anywhere;
    word-break: break-word;
    letter-spacing: 0.01em;
}

.practice-stem-line {
    margin-bottom: 0.35rem;
}

.practice-stem-line--indent {
    margin-left: 1.5rem;
}

.math-fraction {
    display: inline-flex;
    flex-direction: column;
    vertical-align: middle;
    text-align: center;
    padding: 0 0.2em;
    font-size: 0.88em;
    line-height: 1;
}

.math-fraction .num {
    border-bottom: 1.5px solid currentColor;
    padding-bottom: 1px;
}

.math-fraction .den {
    padding-top: 1px;
}

@media (max-width: 768px) {
    .practice-paper-card {
        padding: 1.15rem 1rem;
    }

    .practice-card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .practice-question-stem {
        font-size: 1rem;
        line-height: 1.7;
    }
}

.candidate-source img {
    display: block;
    width: 7rem;
    height: 8.5rem;
    border: 1px solid var(--line);
    border-radius: 0.55rem;
    object-fit: cover;
    object-position: top;
}

.candidate-meta {
    display: flex;
    align-items: center;
    gap: 0.7rem;
}

.candidate-summary p {
    margin: 0.55rem 0;
    color: var(--ink-800);
    line-height: 1.6;
}

/* The mistake list uses this class for a normal content column. Keep the
   accordion-only summary rules below from turning its text into a flex row. */
.candidate-card .candidate-summary {
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.candidate-summary small {
    color: var(--ink-500);
}

.candidate-review-grid {
    display: grid;
    grid-template-columns: minmax(340px, 0.8fr) minmax(0, 1.2fr);
    gap: 1.5rem;
}

.candidate-evidence {
    align-self: start;
    position: sticky;
    top: 1rem;
}

.recognized-text {
    max-height: 24rem;
    padding: 1rem;
    overflow: auto;
    border-radius: var(--radius-sm);
    background: var(--paper-muted);
    color: var(--ink-700);
    line-height: 1.7;
}

.candidate-form fieldset {
    margin: 0 0 1.5rem;
    padding: 0;
    border: 0;
}

.candidate-form legend {
    width: 100%;
    margin-bottom: 1rem;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid var(--line);
    color: var(--ink-950);
    font-size: 1.05rem;
    font-weight: 850;
}

.candidate-form-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.candidate-form-grid--wide p:first-child,
.candidate-form-grid--wide p:nth-child(n+10) {
    grid-column: 1 / -1;
}

.candidate-form-grid p {
    display: grid;
    align-content: start;
    gap: 0.35rem;
    margin: 0;
}

.candidate-form-grid label {
    color: var(--ink-800);
    font-size: 0.8rem;
    font-weight: 800;
}

.candidate-form-grid input,
.candidate-form-grid select,
.candidate-form-grid textarea {
    width: 100%;
    padding: 0.65rem 0.75rem;
    border: 1px solid var(--ink-300);
    border-radius: var(--radius-sm);
    background: white;
    color: var(--ink-950);
}

.candidate-form-grid textarea {
    resize: vertical;
}

.candidate-form .errorlist {
    margin: 0;
    padding: 0;
    color: var(--danger);
    font-size: 0.8rem;
    list-style: none;
}

.candidate-form-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.8rem;
}

.text-button {
    padding: 0.65rem 0.4rem;
    border: 0;
    background: transparent;
    color: var(--brand-strong);
    font-weight: 800;
    cursor: pointer;
}

.text-button--danger {
    color: var(--danger);
}

.status-message {
    margin: 1rem 0;
    padding: 0.9rem 1rem;
    border-left: 5px solid var(--brand);
    border-radius: var(--radius-sm);
    background: white;
    box-shadow: var(--shadow-sm);
}

.status-message--error {
    border-left-color: var(--danger);
}

.status-message--success {
    border-left-color: var(--success);
}

.decision-actions {
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.classroom-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}

.classroom-card {
    padding: 1.25rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: white;
    box-shadow: var(--shadow-sm);
}

.classroom-card > p {
    color: var(--ink-700);
}

.classroom-card dl {
    display: grid;
    gap: 0.75rem;
    margin: 1rem 0;
}

.classroom-card dl div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.classroom-card dt {
    color: var(--ink-500);
    font-size: 0.82rem;
    font-weight: 800;
}

.classroom-card dd {
    margin: 0;
    font-weight: 850;
}

.join-code {
    padding: 0.35rem 0.55rem;
    border-radius: 0.45rem;
    background: var(--paper-muted);
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    letter-spacing: 0.08em;
}

.checkbox-field {
    display: flex !important;
    grid-column: 1 / -1;
    align-items: center;
    grid-template-columns: auto 1fr;
}

.checkbox-field input {
    width: auto;
}

@media (max-width: 1080px) {
    .app-shell {
        grid-template-columns: 84px minmax(0, 1fr);
    }

    .brand-copy,
    .nav-link:not(.is-current),
    .sidebar-profile span:last-child {
        font-size: 0;
    }

    .nav-link {
        justify-content: center;
    }

    .nav-link span {
        font-size: 0.75rem;
    }

    .sidebar-profile {
        justify-content: center;
    }

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

    .workflow-strip {
        grid-template-columns: 1fr;
    }
}
@media (max-width: 820px) {
    .library-shell {
        width: min(100% - 1.25rem, 700px);
        padding-top: 1rem;
    }

    .library-header {
        flex-direction: column;
    }

    .filter-grid,
    .question-detail-grid,
    .candidate-review-grid,
    .candidate-form-grid,
    .classroom-grid {
        grid-template-columns: 1fr;
    }

    .filter-search {
        grid-column: auto;
    }

    .question-table-wrap {
        overflow: visible;
    }

    .question-bank-table {
        min-width: 0;
    }

    .question-bank-table td:nth-child(1),
    .question-bank-table td:nth-child(2),
    .question-bank-table td:nth-child(3),
    .question-bank-table td:nth-child(8) {
        width: auto;
        min-width: 0;
    }

    .mistake-table {
        min-width: 0;
    }

    .mistake-table .mistake-select-column,
    .mistake-table .mistake-image-cell,
    .mistake-table .mistake-question-cell,
    .mistake-table .mistake-meta-cell {
        width: auto;
        min-width: 0;
        max-width: none;
    }

    .mistake-thumb {
        width: 100%;
        max-width: 16rem;
        height: 10rem;
    }

    .mistake-image-cell .thumb-placeholder {
        width: 100%;
        max-width: 16rem;
        height: 10rem;
    }

    .question-table thead {
        display: none;
    }

    .question-table,
    .question-table tbody,
    .question-table tr,
    .question-table td {
        display: block;
        width: 100%;
    }

    .question-table tbody {
        display: grid;
        gap: 1rem;
    }

    .question-table tr {
        padding: 0.5rem 0.8rem;
        border: 1px solid var(--line);
        border-radius: var(--radius-sm);
        background: white;
    }

    .question-table td {
        display: grid;
        min-width: 0;
        padding: 0.65rem 0;
        border-bottom: 1px solid var(--line);
        grid-template-columns: 6.5rem minmax(0, 1fr);
        gap: 0.75rem;
        overflow-wrap: anywhere;
    }

    .question-table td > * {
        min-width: 0;
        overflow-wrap: anywhere;
    }

    .question-table td[data-label]::before {
        content: attr(data-label);
        color: var(--ink-500);
        font-size: 0.75rem;
        font-weight: 800;
    }

    .question-table td:last-child {
        border-bottom: 0;
    }

    .question-table .empty-cell {
        display: block;
    }

    .attempt-list article {
        grid-template-columns: 1fr;
        gap: 0.3rem;
    }

    .page-add-panel,
    .candidate-card {
        align-items: stretch;
        grid-template-columns: 1fr;
    }

    .page-add-panel {
        flex-direction: column;
    }

    .page-add-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .candidate-source img {
        width: 100%;
        height: 12rem;
        object-fit: contain;
    }

    .candidate-evidence {
        position: static;
    }

    .candidate-form-grid--wide p:first-child,
    .candidate-form-grid--wide p:nth-child(n+10) {
        grid-column: auto;
    }
}
@media (max-width: 820px) {
    .landing-shell {
        width: min(640px, calc(100% - 2rem));
        grid-template-columns: 1fr;
        gap: 2.5rem;
        padding: 2rem 0 3rem;
    }

    .landing-copy .brand {
        margin-bottom: 3.5rem;
    }

    .feature-list {
        grid-template-columns: 1fr;
    }

    .app-shell {
        display: block;
    }

    .sidebar {
        position: static;
        display: flex;
        width: 100%;
        height: auto;
        padding: 0.75rem 1rem;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }

    .sidebar .brand {
        padding: 0;
    }

    .sidebar .brand-mark {
        width: 2.1rem;
        height: 2.1rem;
    }

    .side-nav {
        display: flex;
    }

    .nav-link {
        min-width: 2.4rem;
        min-height: 2.4rem;
        padding: 0.55rem;
    }

    .nav-link:not(.is-current) {
        display: none;
    }

    .nav-link.is-current {
        font-size: 0;
    }

    .nav-link.is-current span {
        font-size: 0.75rem;
    }

    .sidebar-profile {
        display: none;
    }

    .workspace-header {
        align-items: flex-start;
        flex-direction: column;
    }

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

    .upload-panel {
        order: -1;
    }
}

@media (max-width: 560px) {
    .registration-grid,
    .registration-summary {
        grid-template-columns: 1fr;
    }

    .registration-grid__wide,
    .registration-summary__wide {
        grid-column: auto;
    }

    .decision-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .workspace {
        padding: 1rem;
    }

    .preview-bar {
        align-items: flex-start;
        flex-direction: column;
    }

    .workspace-header {
        gap: 1.2rem;
        margin-bottom: 1.4rem;
    }

    .header-actions {
        width: 100%;
    }

    .header-actions .button {
        min-width: 0;
        flex: 1;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.7rem;
    }

    .stat-card {
        min-height: 130px;
        padding: 1rem;
    }

    .stat-card strong {
        font-size: 1.7rem;
    }

    .panel {
        padding: 1.05rem;
    }

    .panel-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .task-row {
        grid-template-columns: 0.55rem minmax(0, 1fr) auto;
    }

    .status {
        grid-column: 2;
        justify-self: start;
    }

    .row-link {
        grid-column: 3;
        grid-row: 1 / span 2;
    }

    .workflow-strip ol {
        overflow-x: auto;
        grid-template-columns: repeat(5, minmax(76px, 1fr));
        padding: 0.35rem 0 0.6rem;
        scrollbar-width: thin;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}

.review-shell { width: min(1440px, calc(100% - 2rem)); margin: 0 auto; padding: 2rem 0; }
.review-header { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; margin-bottom: 1.25rem; }
.review-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(340px, 0.85fr); gap: 1.25rem; align-items: start; }
.source-pane, .form-pane { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 1.25rem; box-shadow: var(--shadow); min-width: 0; }
.source-pane img { display: block; width: 100%; height: auto; border-radius: 10px; }
.form-pane textarea, .form-pane select { width: 100%; max-width: 100%; }
.form-pane ul { padding-left: 1.25rem; }
.answer-reference { background: var(--surface-muted); border-radius: 12px; padding: 1rem; margin: 1rem 0; }
.answer-reference h3 { margin: 0.75rem 0 0.25rem; }
.answer-reference h3:first-child { margin-top: 0; }
.answer-correction { margin: 1rem 0; }
.answer-correction h3 { margin-bottom: 0.35rem; }
.helptext { color: var(--ink-700); font-size: 0.92rem; }
.confirmation-choice { margin: 1.25rem 0; border: 0; padding: 0; }
.confirmation-choice legend { font-weight: 800; margin-bottom: 0.7rem; }
.confirmation-choice div { display: grid; gap: 0.6rem; }
.confirmation-choice label { display: flex; gap: 0.6rem; align-items: center; padding: 0.8rem; border: 1px solid var(--line); border-radius: 10px; }
.mobile-source-link { display: none; }

@media (max-width: 760px) {
    .review-shell { width: min(100% - 1rem, 1440px); padding: 0.75rem 0; }
    .review-header { flex-direction: column; }
    .review-grid { grid-template-columns: minmax(0, 1fr); }
    .form-pane { order: 1; }
    .source-pane { order: 2; }
    .source-pane, .form-pane { padding: 1rem; border-radius: 14px; }
    .form-actions { display: grid; grid-template-columns: 1fr; }
    .form-actions .button { width: 100%; }
    .mobile-source-link { display: inline-block; margin: 0.25rem 0 1rem; font-weight: 700; }
    .candidate-actions .button { width: 100%; }
}

/* Batch review keeps each question and its choices readable on narrow screens. */
.batch-review-card { padding: 1.2rem 0; border-top: 1px solid var(--border, #dce3e8); min-width: 0; overflow-wrap: anywhere; }
.batch-review-form, .batch-review-card fieldset { min-width: 0; }
.batch-review-card .candidate-meta { flex-wrap: wrap; }
.batch-review-card .confirmation-choice label { min-height: 44px; }
.batch-source-image { display: block; max-width: 100%; height: auto; margin-top: 1rem; }
.batch-question-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; align-items: start; }
.batch-question-source, .batch-question-answer { min-width: 0; }
.question-crop-link { display: block; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: white; }
.question-crop { display: block; width: 100%; height: auto; }
.question-image-hint { margin: 8px 0; font-size: .85rem; color: var(--ink-700); }
.question-text { font-size: .95rem; margin-top: 12px; }
.question-text summary { cursor: pointer; min-height: 44px; padding: 10px 0; }
.batch-question-answer .answer-reference { margin-top: 0; overflow-wrap: anywhere; }
.batch-question-answer .answer-reference p { margin: 0 0 12px; }
.batch-question-answer .confirmation-choice label:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
@media (min-width: 900px) {
    .batch-question-grid { grid-template-columns: minmax(0, 1.3fr) minmax(280px, 1fr); gap: 28px; }
}
@media (max-width: 900px) {
    .review-page .review-grid { grid-template-columns: minmax(0, 1fr); }
    .review-page .source-pane { order: 1; }
    .review-page .form-pane { order: 2; }
}

/* Document progress: one current step, actionable notices, optional detail. */
.document-shell { width: min(940px, calc(100% - 40px)); margin: 40px auto 72px; }
.document-header { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.document-header > div { min-width: 0; }
.document-header h1 { margin: 8px 0; font-size: clamp(1.25rem, 3vw, 1.85rem); overflow-wrap: anywhere; }
.document-header p { margin: 0; color: var(--ink-700); }
.document-header .button { flex-shrink: 0; }
.progress-card { background: white; border: 1px solid var(--line); border-radius: 24px; padding: 32px; box-shadow: var(--shadow-sm); }
.progress-headline { display: flex; align-items: center; gap: 16px; }
.progress-headline .eyebrow { margin: 0 0 6px; }
.progress-headline h2 { margin: 0; font-size: clamp(1.3rem, 4vw, 1.8rem); }
.progress-symbol { display: grid; place-items: center; flex: 0 0 52px; height: 52px; border-radius: 16px; background: var(--brand-soft); color: var(--brand-strong); font-size: 1.8rem; font-weight: 700; }
.progress-card--failed .progress-symbol, .progress-card--retake .progress-symbol { background: var(--accent-soft); color: #805207; }
.progress-card--processing .progress-symbol { animation: progress-breathe 2s ease-in-out infinite; }
@keyframes progress-breathe { 50% { opacity: .5; } }
.progress-description { color: var(--ink-700); line-height: 1.7; margin: 20px 0 24px; }
.progress-steps { list-style: none; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); padding: 0; margin: 0 0 24px; gap: 12px; }
.progress-steps li { border-top: 3px solid var(--line); padding-top: 14px; display: flex; align-items: flex-start; gap: 9px; font-weight: 700; }
.step-number { display: grid; place-items: center; width: 26px; height: 26px; flex-shrink: 0; border-radius: 50%; background: var(--paper-muted); font-size: .8rem; }
.progress-steps small { display: block; font-size: .75rem; font-weight: 400; color: var(--ink-700); margin-top: 5px; }
.progress-steps .progress-step--completed, .progress-steps .progress-step--current { border-color: var(--brand); }
.progress-step--current .step-number { background: var(--brand); color: white; }
.progress-step--completed .step-number { background: var(--brand-soft); color: var(--brand-strong); }
.page-progress label { display: block; font-weight: 700; margin-bottom: 10px; }
.page-progress progress { display: block; width: 100%; height: 12px; border: none; border-radius: 99px; overflow: hidden; background: var(--paper-muted); accent-color: var(--brand); }
.page-progress progress::-webkit-progress-bar { background: var(--paper-muted); }
.page-progress progress::-webkit-progress-value { background: var(--brand); border-radius: 99px; }
.page-progress progress::-moz-progress-bar { background: var(--brand); }
.page-progress small { display: block; margin-top: 10px; line-height: 1.6; color: var(--ink-700); }
.progress-alert { background: var(--accent-soft); border: 1px solid #ecd8ae; border-radius: 14px; padding: 18px 20px; margin-top: 24px; }
.progress-alert h3 { margin: 0 0 8px; font-size: 1.1rem; }
.progress-alert p { margin: 0 0 8px; line-height: 1.6; }
.progress-alert ul { list-style: none; padding: 0; margin: 0; }
.progress-alert li { margin-top: 10px; line-height: 1.6; overflow-wrap: anywhere; }
.progress-alert a { display: inline-block; margin-left: 12px; font-weight: 700; padding: 8px 0; }
.progress-note { color: var(--ink-700); }
.progress-connection { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 16px 0; }
.progress-connection p { color: var(--ink-700); font-size: .85rem; margin: 0; }
.progress-connection .connection-error { color: #92392f; }
.progress-connection .button { flex-shrink: 0; font-size: .85rem; }
.progress-connection .button[hidden] { display: none; }
.document-shell .panel-heading { flex-wrap: wrap; gap: 8px; margin-top: 30px; }
.document-shell .panel-heading h2 { margin: 0; font-size: 1.25rem; }
.document-shell .panel-heading p { margin: 0; color: var(--ink-700); font-size: .85rem; }
.document-page-row { background: white; border: 1px solid var(--line); border-radius: 12px; margin: 10px 0; overflow: hidden; }
.document-page-row > summary { padding: 17px 20px; cursor: pointer; font-weight: 700; }
.document-page-row .page-state { display: inline-block; float: right; font-size: .85rem; font-weight: 400; color: var(--ink-700); }
.document-page-row--retake, .document-page-row--warning { border-color: #d9b86d; }
.document-page-row--retake .page-state, .document-page-row--warning .page-state { color: #805207; }
.document-page-row--failed .page-state { color: #92392f; }
.document-page-row--completed .page-state { color: var(--brand-strong); }
.document-page-content { padding: 0 20px 20px; overflow-wrap: anywhere; }
.document-page-image { display: block; max-width: 100%; max-height: 600px; width: auto; height: auto; object-fit: contain; margin: 12px 0; border-radius: 8px; }
.document-page-content form { display: grid; gap: 12px; margin-top: 20px; }
.document-page-content input[type=file] { width: 100%; min-width: 0; }
.document-details { margin-top: 24px; border-top: 1px solid var(--line); padding: 20px 0; color: var(--ink-700); overflow-wrap: anywhere; }
.document-details summary { cursor: pointer; min-height: 44px; padding: 10px 0; }
.document-details li { margin: 8px 0; line-height: 1.6; }
@media (max-width: 600px) {
    .document-shell { width: calc(100% - 28px); margin-top: 22px; }
    .document-header { align-items: flex-start; gap: 12px; }
    .document-header .button { padding: 10px; font-size: .8rem; }
    .progress-card { padding: 22px 18px; border-radius: 18px; }
    .progress-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 20px; }
    .progress-alert { padding: 16px; }
    .progress-alert a { display: block; margin-left: 0; }
    .progress-headline { gap: 12px; }
    .progress-symbol { flex-basis: 40px; height: 40px; border-radius: 12px; }
    .progress-connection { align-items: flex-start; }
    .document-page-row > summary { padding: 16px 12px; }
    .document-page-row .page-state { float: none; display: block; margin: 7px 0 0 20px; }
}
@media (prefers-reduced-motion: reduce) {
    .progress-card--processing .progress-symbol { animation: none; }
}

/* Batch Review Accordion & Mobile-First Redesign */
.review-summary-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin: 16px 0;
    padding: 14px 18px;
    background: white;
    border: 1px solid var(--line);
    border-radius: 14px;
}
.summary-stats-group {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}
.stat-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 12px;
    border-radius: 9999px;
    font-size: 0.88rem;
    font-weight: 600;
    border: 1px solid transparent;
}
.stat-tag--total {
    background: var(--paper-muted);
    color: var(--ink-800);
    border-color: var(--line);
}
.stat-tag--correct {
    background: #ecfdf5;
    color: #065f46;
    border-color: #a7f3d0;
}
.stat-tag--wrong {
    background: #fef2f2;
    color: #991b1b;
    border-color: #fecaca;
}
.stat-tag--unknown {
    background: #fffbeb;
    color: #92400e;
    border-color: #fde68a;
}
.review-hint-box {
    margin: 12px 0 20px;
    padding: 12px 18px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 12px;
    font-size: 0.92rem;
    color: #166534;
}
.review-hint-box p {
    margin: 0;
    line-height: 1.6;
}
.candidate-accordion-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 28px;
}
.batch-review-card {
    background: white;
    border: 1.5px solid var(--line);
    border-radius: 14px;
    overflow: hidden;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.batch-review-card[open] {
    border-color: var(--brand);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}
.batch-review-card:not([open]) > :not(summary) {
    display: none !important;
}
.batch-review-card > summary.candidate-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    min-height: 52px;
    cursor: pointer;
    user-select: none;
    background: white;
    list-style: none;
    transition: background 0.15s ease;
}
.batch-review-card > summary.candidate-summary::-webkit-details-marker {
    display: none;
}
.batch-review-card > summary.candidate-summary:hover {
    background: #f8fafc;
}
.batch-review-card[open] > summary.candidate-summary {
    border-bottom: 1px solid var(--line);
    background: #f8fafc;
}
.summary-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}
.chevron-icon {
    display: inline-block;
    font-size: 0.75rem;
    color: var(--ink-500);
    transition: transform 0.2s ease, color 0.2s ease;
    flex-shrink: 0;
}
.batch-review-card[open] .chevron-icon {
    transform: rotate(90deg);
    color: var(--brand);
}
.summary-num {
    font-size: 1.05rem;
    color: var(--ink-900);
}
.summary-source {
    font-size: 0.85rem;
    color: var(--ink-500);
}
.summary-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 9999px;
    font-size: 0.85rem;
    font-weight: 700;
    border: 1px solid transparent;
    white-space: nowrap;
}
.status-badge--correct {
    background: #ecfdf5;
    color: #047857;
    border-color: #a7f3d0;
}
.status-badge--wrong {
    background: #fef2f2;
    color: #b91c1c;
    border-color: #fecaca;
}
.status-badge--unknown {
    background: #fffbeb;
    color: #b45309;
    border-color: #fde68a;
}
.status-badge--unanswered {
    background: #f1f5f9;
    color: #475569;
    border-color: #cbd5e1;
}
.batch-question-body {
    padding: 20px;
    background: white;
}
.batch-question-answer .answer-text {
    font-size: 1rem;
    color: var(--ink-900);
    line-height: 1.6;
    padding: 8px 12px;
    background: var(--paper-muted);
    border-radius: 8px;
    margin: 6px 0 14px;
}
.confirmation-choice {
    margin: 16px 0 0;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fafafa;
}
.confirmation-choice legend {
    font-weight: 700;
    padding: 0 6px;
    font-size: 0.95rem;
}
.choice-options-wrapper ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 8px;
}
.confirmation-choice label {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border: 1.5px solid var(--line);
    border-radius: 10px;
    background: white;
    cursor: pointer;
    font-weight: 600;
    min-height: 48px;
    transition: all 0.15s ease;
}
.confirmation-choice label:hover {
    border-color: var(--brand-muted);
    background: #f8fafc;
}
.confirmation-choice label:has(input:checked) {
    border-color: var(--brand);
    background: var(--brand-soft);
    color: var(--brand-strong);
    font-weight: 700;
    box-shadow: 0 0 0 1px var(--brand);
}
.sticky-action-bar {
    position: sticky;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(8px);
    border-top: 1px solid var(--line);
    padding: 16px 20px;
    margin-top: 24px;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.06);
    z-index: 100;
}
.sticky-action-inner {
    max-width: 940px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}
.sticky-action-hint {
    font-size: 0.95rem;
    color: var(--ink-700);
}
.button--lg {
    padding: 14px 28px;
    font-size: 1.05rem;
    font-weight: 700;
}
@media (max-width: 640px) {
    .batch-review-card > summary.candidate-summary {
        padding: 12px 14px;
    }
    .summary-left {
        gap: 8px;
    }
    .summary-num {
        font-size: 0.98rem;
    }
    .summary-source {
        display: none;
    }
    .status-badge {
        padding: 3px 8px;
        font-size: 0.78rem;
    }
    .batch-question-body {
        padding: 14px;
    }
    .sticky-action-inner {
        justify-content: center;
    }
    .sticky-action-inner button {
        width: 100%;
    }
    .sticky-action-hint {
        display: none;
    }
}

.completion-banner {
    margin: 24px 0 40px;
    padding: 24px;
    background: #f0fdf4;
    border: 1.5px solid #86efac;
    border-radius: 16px;
    box-shadow: 0 4px 14px rgba(22, 101, 52, 0.08);
}
.completion-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}
.completion-inner h3 {
    margin: 0 0 6px;
    font-size: 1.25rem;
    color: #166534;
}
.completion-inner p {
    margin: 0;
    color: #15803d;
    font-size: 0.95rem;
}
.completion-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
@media (max-width: 640px) {
    .completion-actions {
        width: 100%;
        flex-direction: column;
    }
    .completion-actions .button {
        width: 100%;
        text-align: center;
    }
}

/* 練習卷圖形：只放圖形本身 */
.practice-figure { margin: 0.75rem 0; text-align: center; }
.practice-figure img { max-width: min(100%, 420px); height: auto; border: 1px solid #e2e8f0; border-radius: 4px; background: #fff; }


/* 共用導覽（2026-09-17）：手機底部列；平板與電腦固定左側欄，所有登入後頁面一致 */
.app-nav { position: fixed; z-index: 50; right: 0; bottom: 0; left: 0; background: var(--ink-950); color: #eef7f5; box-shadow: 0 -0.25rem 1rem rgb(0 0 0 / 18%); padding-bottom: env(safe-area-inset-bottom); }
.app-nav__brand, .app-nav__account { display: none; }
.app-nav__list { display: flex; margin: 0; padding: 0; list-style: none; }
.app-nav__list li { flex: 1 1 0; min-width: 0; }
.app-nav__link { display: flex; min-height: 3.6rem; flex-direction: column; align-items: center; justify-content: center; gap: 0.1rem; color: #c7dbd8; font-size: 0.78rem; text-decoration: none; }
.app-nav__icon { font-size: 1.2rem; line-height: 1; }
.app-nav__link[aria-current="page"] { color: #fff; background: rgba(255, 255, 255, 0.1); box-shadow: inset 0 3px 0 var(--accent); }
body.has-app-nav { padding-bottom: calc(3.8rem + env(safe-area-inset-bottom)); }
.app-shell--single { grid-template-columns: minmax(0, 1fr) !important; }
.app-nav__logout { border: 1px solid rgba(255, 255, 255, 0.25); border-radius: var(--radius-sm); background: transparent; color: #eef7f5; cursor: pointer; font: inherit; padding: 0.45rem 0.9rem; }
.first-step-card { margin-bottom: 1.25rem; padding: 1.1rem 1.25rem; border: 2px solid var(--accent); border-radius: var(--radius-sm); background: var(--accent-soft); }
.first-step-card h2 { margin: 0.2rem 0 0.4rem; }
.settings-logout { display: none; margin: 0 0 1rem; }

@media (max-width: 767px) {
    .settings-logout { display: block; }
}

@media (min-width: 768px) {
    .app-nav { top: 0; right: auto; width: 200px; display: flex; flex-direction: column; padding: 1.2rem 0.8rem; box-shadow: none; }
    .app-nav__brand { display: flex; align-items: center; gap: 0.55rem; margin: 0 0.3rem 1.4rem; color: #fff; font-weight: 800; text-decoration: none; }
    .app-nav__list { flex-direction: column; gap: 0.3rem; }
    .app-nav__link { min-height: 2.8rem; flex-direction: row; justify-content: flex-start; gap: 0.7rem; padding: 0 0.8rem; border-radius: var(--radius-sm); font-size: 0.95rem; }
    .app-nav__link[aria-current="page"] { box-shadow: inset 3px 0 0 var(--accent); }
    .app-nav__account { display: grid; gap: 0.2rem; margin-top: auto; padding: 1rem 0.4rem 0; border-top: 1px solid rgba(255, 255, 255, 0.12); }
    .app-nav__name { font-weight: 700; overflow-wrap: anywhere; }
    .app-nav__class { color: #9ebcba; font-size: 0.85rem; }
    .app-nav__account form { margin-top: 0.5rem; }
    body.has-app-nav { padding-bottom: 0; padding-left: 200px; }
}

/* 共用密碼欄位 */
.password-field-wrapper { position: relative; display: flex; align-items: center; width: 100%; }
.password-field-wrapper input { width: 100%; padding-right: 2.8rem; box-sizing: border-box; }
.password-toggle-btn { position: absolute; top: 50%; right: 0.6rem; display: flex; width: 2rem; height: 2rem; align-items: center; justify-content: center; margin: 0; padding: 0; transform: translateY(-50%); border: none; background: transparent; box-shadow: none; color: #64748b; cursor: pointer; }
.password-toggle-btn:hover { color: #0f172a; }
.upload-rules { margin: 0.5rem 0 1rem; color: var(--ink-700); font-size: 0.9rem; }
.upload-privacy { margin: 0 0 1rem; padding: 0.7rem 0.85rem; border-left: 4px solid var(--brand); border-radius: var(--radius-sm, 6px); background: var(--paper-muted); color: var(--ink-700); font-size: 0.9rem; line-height: 1.6; }

/* 科目標籤按鈕（取代手機原生下拉清單）；Django 會把 class 同時加在外框與 radio 上 */
div.subject-chips { display: flex; flex-wrap: wrap; gap: 0.45rem; margin: 0.35rem 0 0; padding: 0; }
div.subject-chips > div { margin: 0; }
div.subject-chips label { display: inline-flex; align-items: center; gap: 0.4rem; min-height: 2.5rem; padding: 0.35rem 0.95rem; border: 1px solid #cbd5e1; border-radius: 999px; background: #fff; white-space: nowrap; cursor: pointer; }
div.subject-chips label:has(input:checked) { border-color: var(--brand); background: var(--brand); color: #fff; }
.filter-grid input.subject-chips[type="radio"] { width: 1rem; height: 1rem; min-height: 0; margin: 0; padding: 0; }

/* 工作台標題固定一行：依字數與可用寬度縮放字級（2026-09-17 使用者要求） */
.workspace-header > div:first-child { flex: 1 1 auto; min-width: 0; align-self: stretch; }
.one-line-title { white-space: nowrap; font-size: min(3.2rem, calc((100vw - 3rem) / (var(--chars) * 0.955 + 0.4))); }
@supports (container-type: inline-size) {
    .workspace-header > div:first-child { container-type: inline-size; }
    .workspace-header .one-line-title { font-size: min(3.2rem, calc(100cqi / (var(--chars) * 0.955 + 0.4))); }
}

/* ===== 2026-09-17 窄手機排版修正批次 ===== */

/* 防止內容把手機版面撐寬（撐寬會讓瀏覽器縮小整頁、底部導覽被推出螢幕） */
.auth-shell > *, .auth-card > *, .library-shell > *, .review-shell > * { min-width: 0; }
.auth-card label, .auth-card p { overflow-wrap: anywhere; }
.auth-card input[type="file"], .library-shell input[type="file"] { display: block; width: 100%; max-width: 100%; }
img, table, pre { max-width: 100%; }

/* 手機頂端列：平台名稱＋目前登入者＋登出（平板以上改用左側欄） */
.app-topbar { position: sticky; z-index: 49; top: 0; display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; padding: 0.45rem 0.75rem; background: var(--ink-950); color: #eef7f5; }
.app-topbar__brand { display: flex; min-width: 0; align-items: center; gap: 0.45rem; color: #fff; font-weight: 800; font-size: 0.95rem; text-decoration: none; white-space: nowrap; }
.app-topbar__brand .brand-mark { width: 1.8rem; height: 1.8rem; font-size: 0.85rem; }
.app-topbar__account { display: flex; min-width: 0; align-items: center; gap: 0.5rem; }
.app-topbar__name { overflow: hidden; max-width: 7.5rem; color: #c7dbd8; font-size: 0.85rem; text-overflow: ellipsis; white-space: nowrap; }
.app-topbar__logout { min-height: 2.2rem; padding: 0.25rem 0.75rem; border: 1px solid rgba(255, 255, 255, 0.35); border-radius: var(--radius-sm); background: transparent; color: #fff; cursor: pointer; font: inherit; font-size: 0.85rem; white-space: nowrap; }
.app-topbar form { margin: 0; }
@media (min-width: 768px) { .app-topbar { display: none; } }
@media (max-width: 340px) { .app-topbar__brand span:last-child { font-size: 0.85rem; } .app-topbar__name { max-width: 5rem; } }

/* 標題列按鈕：手機上等寬兩欄；練習卷次要按鈕收進「更多」 */
.paper-actions { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 0.6rem; }
.paper-actions form { margin: 0; }
.more-actions { position: relative; }
.more-actions > summary { display: inline-flex; min-height: 2.8rem; align-items: center; padding: 0.72rem 1.1rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; cursor: pointer; font-weight: 750; list-style: none; }
.more-actions > summary::-webkit-details-marker { display: none; }
.more-actions[open] { display: grid; gap: 0.5rem; }
@media (max-width: 820px) {
    .library-header { align-items: stretch; }
    .library-header .form-actions, .paper-actions { display: grid; width: 100%; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6rem; }
    .library-header .form-actions > *, .paper-actions > *, .paper-actions form .button { width: 100%; }
    .paper-actions .more-actions { grid-column: 1 / -1; }
    .more-actions > summary { width: 100%; justify-content: center; }
}

/* 錯題詳細頁題號改小字 */
.question-code { margin: 0.2rem 0 0; color: var(--ink-700); font-size: 0.8rem; }

/* 首頁：手機把登入／註冊放在介紹前面；大標題依斷句換行並縮放 */
.landing-title-line { display: block; white-space: nowrap; }
.landing-quick-actions { display: none; }
@media (max-width: 820px) {
    .landing-copy h1 { max-width: none; font-size: min(2.55rem, calc((100vw - 2.5rem) / 12.6)); }
    .landing-copy .brand { margin-bottom: 1.5rem; }
    .landing-summary { margin: 1rem 0 1.25rem; }
    .landing-quick-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6rem; margin: 0 0 2rem; }
}

/* 平板側欄平台名稱不斷行 */
@media (min-width: 768px) { .app-nav__brand { font-size: 0.92rem; white-space: nowrap; } .app-nav__brand .brand-mark { flex: 0 0 auto; } }

/* ===== 2026-09-18 第 1 批介面小修 ===== */
/* hidden 屬性對 SVG 無效，必須用 CSS 明確隱藏，否則兩個眼睛圖示會同時出現 */
.password-toggle-btn svg[hidden] { display: none; }
/* 按鈕文字一律不換行；空間不足時縮小字級而不是斷行 */
.button { white-space: nowrap; }
@media (max-width: 820px) {
    .button { font-size: clamp(0.82rem, 3.6vw, 1rem); padding-inline: 0.8rem; }
    /* 手機只留上方「登入／學生註冊」，避免與登入卡片重複 */
    .landing-shell .login-card { display: none; }
}
/* 「更多」改成不佔整排的文字樣式 */
.more-actions > summary { border: none; background: transparent; color: var(--brand); text-decoration: underline; }
.landing-quick-actions .landing-quick-help { grid-column: 1 / -1; margin: 0.2rem 0 0; color: #d5e8e5; font-size: 0.85rem; line-height: 1.7; }

/* 可點的統計卡片與即時題數 */
.stat-card--link { display: grid; color: inherit; text-decoration: none; }
.stat-card--link:hover, .stat-card--link:focus-visible { border-color: var(--brand); box-shadow: 0 0.4rem 1rem rgb(27 45 66 / 10%); }
.stat-card__cta { color: var(--brand); font-size: 0.82rem; font-weight: 700; }
.match-count { margin: 0.4rem 0 0; font-weight: 700; }
/* 窄螢幕：處理流程五格改成可換行，避免撐出畫面 */
@media (max-width: 480px) {
    .workflow-strip { grid-template-columns: 1fr; gap: 1rem; padding: 1rem; }
    .workflow-strip ol { grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: 0.8rem; }
}

/* ===== 2026-09-18 第 3 批：錯題卡片與版面高度 ===== */
:root { --app-chrome: 0px; }
@media (max-width: 767px) { :root { --app-chrome: 7.2rem; } }  /* 手機頂端列 + 底部導覽 */

.mistake-card-list { display: grid; gap: 0.8rem; margin-top: 1rem; }
.mistake-card { display: grid; gap: 0.5rem; padding: 0.9rem 1rem; border: 1px solid var(--line); border-radius: var(--radius-md); background: #fff; }
.mistake-card__head { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; }
.mistake-card__select { display: inline-flex; align-items: center; gap: 0.45rem; font-size: 0.9rem; }
.mistake-card__select input { width: 1.1rem; height: 1.1rem; }
.mistake-card__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin: 0; color: var(--ink-700); font-size: 0.92rem; }
.mistake-card__scope { color: var(--ink-500); font-size: 0.86rem; }
.mistake-card__stem summary { cursor: pointer; font-weight: 700; }
.mistake-card__stem p { margin: 0.5rem 0 0; line-height: 1.7; }
.mistake-card .mistake-thumb { max-height: 40vh; margin-top: 0.6rem; object-fit: contain; }
.button--full { width: 100%; }

@media (max-width: 820px) {
    /* 版面高度扣掉頂端列與底部導覽，避免上方留白、下方被蓋住 */
    .auth-shell { min-height: calc(100dvh - var(--app-chrome)); align-content: start; padding: 1.2rem 0 1.5rem; }
    .library-shell, .review-shell { min-height: calc(100dvh - var(--app-chrome)); padding: 0.9rem 0 1.5rem; }
    .app-shell .workspace { padding: 1rem 0.9rem 1.5rem; }
    .library-header h1 { font-size: clamp(1.5rem, 6.6vw, 2rem); }
    .library-header > div > p:last-child { font-size: 0.92rem; }
}
.filter-panel--collapsible > summary { cursor: pointer; font-weight: 700; }
.filter-panel--collapsible[open] > summary { margin-bottom: 0.8rem; }
.mistake-card__select span { white-space: nowrap; }

/* 數學公式圖片（與文字同一行） */
.math-formula { display: inline-block; max-width: 100%; height: auto; vertical-align: -0.35em; }
.practice-stem-line .math-formula { max-height: 3.2em; }
