:root {
    --bg-paper: #efe3cc;
    --bg-paper-deep: #e4d2b0;
    --bg-ink: #2e241d;
    --bg-shelf: #533726;
    --bg-shelf-dark: #3f291c;
    --panel: rgba(250, 243, 228, 0.94);
    --panel-strong: rgba(244, 233, 212, 0.98);
    --card: rgba(255, 249, 239, 0.96);
    --ink: #2d241c;
    --muted: #6b5d52;
    --accent: #7a4b2f;
    --accent-dark: #5a3420;
    --accent-soft: #a06a46;
    --line: rgba(82, 57, 39, 0.18);
    --line-strong: rgba(82, 57, 39, 0.32);
    --gold: #b68952;
    --green: #4f6a57;
    --green-soft: rgba(79, 106, 87, 0.16);
    --red: #8d4a40;
    --red-soft: rgba(141, 74, 64, 0.15);
    --amber-soft: rgba(182, 137, 82, 0.18);
    --shadow: 0 24px 60px rgba(39, 23, 14, 0.16);
    --shadow-soft: 0 14px 34px rgba(39, 23, 14, 0.08);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    overflow-x: hidden;
    color: var(--ink);
    font-family: "Palatino Linotype", "Book Antiqua", "Noto Serif TC", Georgia, serif;
    background:
        linear-gradient(90deg, rgba(63, 41, 28, 0.94) 0 64px, transparent 64px calc(100% - 64px), rgba(63, 41, 28, 0.94) calc(100% - 64px) 100%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.18), transparent 140px),
        repeating-linear-gradient(
            180deg,
            var(--bg-shelf-dark) 0 34px,
            var(--bg-shelf) 34px 38px,
            #6a4731 38px 220px
        );
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    opacity: 0.42;
    background:
        radial-gradient(circle at 18% 14%, rgba(255, 244, 221, 0.22), transparent 22%),
        radial-gradient(circle at 82% 10%, rgba(255, 244, 221, 0.14), transparent 18%),
        radial-gradient(circle at 50% 100%, rgba(0, 0, 0, 0.12), transparent 28%);
}

a {
    color: var(--accent-dark);
}

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

textarea {
    width: 100%;
    resize: vertical;
}

.page-shell {
    position: relative;
    max-width: 1240px;
    margin: 0 auto;
    padding: 28px 28px 44px;
}

.page-shell::before {
    content: "";
    position: absolute;
    inset: 10px 10px 0;
    border-radius: 30px;
    background:
        linear-gradient(180deg, rgba(244, 233, 212, 0.97), rgba(235, 220, 192, 0.95)),
        repeating-linear-gradient(
            180deg,
            rgba(122, 75, 47, 0.02) 0 2px,
            transparent 2px 7px
        );
    box-shadow: var(--shadow);
    border: 1px solid rgba(90, 52, 32, 0.22);
    z-index: -1;
}

.hero {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(240px, 0.85fr);
    gap: 28px;
    align-items: stretch;
    margin-bottom: 24px;
    padding: 34px;
    border: 1px solid var(--line-strong);
    border-radius: 30px;
    background:
        linear-gradient(135deg, rgba(255, 250, 240, 0.94), rgba(242, 228, 199, 0.94)),
        radial-gradient(circle at top right, rgba(182, 137, 82, 0.18), transparent 30%);
    box-shadow: var(--shadow-soft);
    overflow: hidden;
}

.hero-compact {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 18px;
    align-items: center;
    padding: 18px 22px;
}

.hero-compact::before,
.hero-compact::after {
    display: none;
}

.hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(90deg, transparent 0 74%, rgba(83, 55, 38, 0.06) 74% 75%, transparent 75% 100%),
        linear-gradient(180deg, rgba(83, 55, 38, 0.05), transparent 120px);
    pointer-events: none;
}

.hero::after {
    content: "READING ROOM";
    position: absolute;
    right: 28px;
    top: 24px;
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid rgba(122, 75, 47, 0.25);
    background: rgba(255, 248, 236, 0.8);
    color: var(--accent-dark);
    font-size: 0.76rem;
    letter-spacing: 0.18em;
}

.hero-copy {
    position: relative;
    z-index: 1;
    min-width: 0;
}

.hero-copy-compact {
    display: grid;
    gap: 4px;
}

.hero-compact-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent-dark);
}

.hero h1,
.section-heading h2,
.term-card h2,
.quiz-card h2,
.review-card h2,
.source-card h3,
.stat-card strong {
    font-family: "Baskerville Old Face", "Times New Roman", "Noto Serif TC", serif;
}

.hero h1 {
    max-width: 16ch;
    margin: 0 0 14px;
    font-size: clamp(2.1rem, 4vw, 3.7rem);
    line-height: 1.05;
    letter-spacing: 0.02em;
}

.hero-text {
    max-width: 66ch;
    margin: 0;
    line-height: 1.85;
    color: var(--muted);
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 12px;
    color: var(--accent);
    letter-spacing: 0.22em;
    text-transform: uppercase;
    font-size: 0.8rem;
}

.eyebrow::before {
    content: "";
    width: 34px;
    height: 1px;
    background: currentColor;
}

.nav-links {
    position: relative;
    z-index: 1;
    display: grid;
    gap: 14px;
    align-content: start;
}

.compact-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

.nav-action-form {
    display: contents;
}

.learner-switch {
    display: grid;
    grid-template-columns: minmax(220px, 320px) auto;
    gap: 12px;
    align-items: center;
    margin-top: 22px;
}

.nav-links a,
.compact-nav a,
.nav-action-button,
.button-link,
button,
.submit-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 18px;
    border: 1px solid rgba(90, 52, 32, 0.26);
    border-radius: 16px;
    background:
        linear-gradient(180deg, #8a5939 0%, #6d432b 100%);
    color: #fff7ec;
    text-decoration: none;
    font-weight: 700;
    letter-spacing: 0.02em;
    cursor: pointer;
    box-shadow: 0 8px 18px rgba(79, 49, 31, 0.18);
    transition: transform 140ms ease, box-shadow 140ms ease, filter 140ms ease;
}

.nav-links a {
    justify-content: flex-start;
    min-height: 62px;
    padding: 16px 18px;
    border-radius: 18px;
    white-space: normal;
    background:
        linear-gradient(180deg, #7f5235 0%, #673f29 100%);
    box-shadow:
        inset 4px 0 0 rgba(255, 240, 212, 0.18),
        0 10px 24px rgba(49, 28, 17, 0.18);
}

.compact-nav a {
    min-height: auto;
    padding: 10px 14px;
    border-radius: 14px;
}

.nav-action-button {
    justify-content: flex-start;
    width: 100%;
    min-height: 62px;
    padding: 16px 18px;
    border-radius: 18px;
}

.nav-links a.nav-active {
    background:
        linear-gradient(180deg, #9a6a44 0%, #72462c 100%);
    box-shadow:
        inset 5px 0 0 rgba(255, 244, 217, 0.42),
        0 12px 26px rgba(49, 28, 17, 0.22);
}

.nav-links a:hover,
.button-link:hover,
button:hover,
.submit-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 26px rgba(49, 28, 17, 0.22);
    filter: brightness(1.03);
}

.button-link.secondary,
button.secondary {
    background:
        linear-gradient(180deg, rgba(255, 247, 232, 0.96), rgba(240, 226, 198, 0.94));
    color: var(--accent-dark);
    border-color: rgba(122, 75, 47, 0.28);
}

.flash-stack {
    display: grid;
    gap: 12px;
    margin-bottom: 20px;
}

.flash {
    padding: 15px 18px;
    border-radius: 18px;
    border: 1px solid var(--line);
    background: rgba(255, 249, 239, 0.92);
    box-shadow: var(--shadow-soft);
}

.flash-success {
    border-color: rgba(79, 106, 87, 0.32);
    background: rgba(236, 245, 236, 0.94);
}

.flash-warning {
    border-color: rgba(182, 137, 82, 0.32);
    background: rgba(255, 245, 222, 0.96);
}

.flash-error {
    border-color: rgba(141, 74, 64, 0.3);
    background: rgba(249, 233, 229, 0.96);
}

.stats-grid,
.domain-grid,
.review-grid {
    display: grid;
    gap: 18px;
}

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

.stats-grid.compact .stat-card strong {
    font-size: 1.42rem;
}

.domain-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.stat-card,
.panel,
.domain-card {
    position: relative;
    border: 1px solid var(--line);
    border-radius: 24px;
    background:
        linear-gradient(180deg, rgba(255, 249, 238, 0.97), rgba(242, 232, 209, 0.94));
    box-shadow: var(--shadow-soft);
}

.stat-card::before,
.panel::before,
.domain-card::before {
    content: "";
    position: absolute;
    inset: 10px;
    border-radius: inherit;
    border: 1px solid rgba(182, 137, 82, 0.1);
    pointer-events: none;
}

.stat-card {
    padding: 24px 24px 22px;
}

.stat-label,
.muted,
.question-label {
    color: var(--muted);
}

.stat-label {
    font-size: 0.9rem;
    letter-spacing: 0.04em;
}

.stat-card strong {
    display: block;
    margin-top: 12px;
    font-size: clamp(1.8rem, 3vw, 2.55rem);
    color: var(--accent-dark);
}

.panel {
    padding: 24px;
    margin-bottom: 20px;
}

.panel-split {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 22px;
}

.section-heading,
.term-header,
.status-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
}

.section-heading {
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(122, 75, 47, 0.14);
    margin-bottom: 14px;
}

.section-heading h2,
.term-header h2 {
    margin: 0;
    font-size: clamp(1.2rem, 2vw, 1.7rem);
}

.domain-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 22px;
    color: inherit;
    text-decoration: none;
}

.domain-card strong {
    color: var(--accent);
}

.source-card + .source-card {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px dashed rgba(122, 75, 47, 0.22);
}

.source-card h3 {
    margin: 0 0 8px;
    font-size: 1.18rem;
}

.source-card p {
    margin: 0 0 8px;
    line-height: 1.75;
    overflow-wrap: anywhere;
}

.plain-list {
    margin: 0;
    padding-left: 20px;
    line-height: 1.9;
}

.filters,
.report-form,
.review-form {
    display: grid;
    gap: 12px;
}

.filters {
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.filter-control[hidden] {
    display: none;
}

input[type="text"],
input[type="password"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid rgba(122, 75, 47, 0.24);
    border-radius: 14px;
    background: rgba(255, 250, 241, 0.96);
    color: var(--ink);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
select:focus,
textarea:focus {
    outline: 2px solid rgba(182, 137, 82, 0.28);
    outline-offset: 1px;
    border-color: rgba(122, 75, 47, 0.4);
}

.cards-list {
    display: grid;
    gap: 18px;
}

.filter-summary,
.analytics-table-head,
.insight-grid {
    display: grid;
    gap: 12px;
}

.filter-summary {
    grid-template-columns: repeat(auto-fit, minmax(180px, max-content));
    margin: 16px 0 10px;
}

.insight-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-bottom: 20px;
}

.insight-card strong {
    display: block;
    margin-top: 10px;
    font-size: 1.45rem;
    color: var(--accent-dark);
}

.insight-card p {
    margin: 10px 0 0;
    line-height: 1.72;
}

.meta-grid {
    display: grid;
    gap: 8px;
    margin: 14px 0;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border-radius: 999px;
    border: 1px solid rgba(79, 106, 87, 0.18);
    background: var(--green-soft);
    color: #355140;
    font-size: 0.86rem;
    white-space: normal;
    overflow-wrap: anywhere;
}

.chip-warn {
    border-color: rgba(182, 137, 82, 0.24);
    background: var(--amber-soft);
    color: #7a5426;
}

.chip-danger {
    border-color: rgba(141, 74, 64, 0.24);
    background: var(--red-soft);
    color: #7a362f;
}

.options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 14px;
    margin-top: 18px;
}

.option-card {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 16px;
    border-radius: 18px;
    border: 1px solid rgba(122, 75, 47, 0.2);
    background:
        linear-gradient(180deg, rgba(255, 250, 242, 0.98), rgba(247, 239, 222, 0.94));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

.option-card > span,
.answer-review-card p,
.issue-item p,
.bilingual,
.meta-grid span {
    min-width: 0;
    overflow-wrap: anywhere;
}

.option-card:has(input:checked) {
    border-color: rgba(182, 137, 82, 0.46);
    background:
        linear-gradient(180deg, rgba(252, 245, 225, 0.98), rgba(244, 230, 193, 0.96));
    box-shadow:
        0 0 0 3px rgba(182, 137, 82, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.82);
}

.option-card input {
    margin-top: 5px;
    accent-color: var(--accent);
}

.option-lines {
    display: grid;
    gap: 5px;
}

.answer-review-list {
    display: grid;
    gap: 12px;
    margin: 20px 0;
}

.answer-review-card {
    padding: 16px;
    border-radius: 18px;
    border: 1px solid rgba(122, 75, 47, 0.2);
    background: rgba(255, 250, 242, 0.9);
}

.answer-review-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.answer-review-correct {
    border-color: rgba(79, 106, 87, 0.3);
    background: rgba(236, 245, 236, 0.9);
}

.answer-review-selected {
    border-color: rgba(182, 137, 82, 0.32);
    background: rgba(250, 241, 216, 0.9);
}

.option-explanation {
    display: grid;
    gap: 8px;
    margin-top: 14px;
    padding: 14px 16px;
    border: 1px solid rgba(122, 75, 47, 0.18);
    border-radius: 14px;
    background: rgba(255, 250, 242, 0.86);
}

.option-explanation p {
    margin: 0;
    line-height: 1.72;
}

.option-explanation-heading {
    color: var(--accent-dark);
    font-weight: 700;
}

.analytics-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 18px;
}

.action-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 16px;
}

.action-row > * {
    flex: 1 1 220px;
}

.analytics-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(120px, 1.6fr) auto;
    gap: 14px;
    align-items: center;
    padding: 14px 0;
    border-bottom: 1px dashed rgba(122, 75, 47, 0.18);
}

.analytics-row-compact {
    grid-template-columns: minmax(160px, 1fr) minmax(120px, 1fr) auto;
}

.analytics-table-head {
    grid-template-columns: minmax(160px, 1fr) minmax(120px, 1fr) auto;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(122, 75, 47, 0.14);
    color: var(--muted);
    font-size: 0.88rem;
    letter-spacing: 0.04em;
}

.analytics-row:last-child {
    border-bottom: 0;
}

.analytics-meta {
    display: grid;
    gap: 4px;
}

.analytics-bar {
    overflow: hidden;
    height: 12px;
    border-radius: 999px;
    background: rgba(82, 57, 39, 0.12);
}

.analytics-fill {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #6e4b31, #b68952);
}

.analytics-fill-warm {
    background: linear-gradient(90deg, #8f6137, #c1905e);
}

.analytics-fill-danger {
    background: linear-gradient(90deg, #7d4038, #ba7967);
}

.analytics-score {
    min-width: 64px;
    text-align: right;
    font-weight: 700;
    color: var(--accent-dark);
}

.submit-button {
    width: 100%;
    margin-bottom: 34px;
}

.action-row .submit-button,
.action-row .button-link {
    width: auto;
    margin-bottom: 0;
}

.quiz-toolbar {
    display: grid;
    gap: 18px;
}

.quiz-stage-strip {
    padding-top: 18px;
    padding-bottom: 18px;
}

.quiz-stage-strip .section-heading {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: 0;
}

.settings-drawer {
    margin-top: 12px;
}

.settings-drawer summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    cursor: pointer;
    font-weight: 700;
    color: var(--accent-dark);
    list-style: none;
}

.settings-drawer summary::-webkit-details-marker {
    display: none;
}

.settings-drawer summary::after {
    content: "展開";
    font-size: 0.9rem;
    color: var(--muted);
}

.settings-drawer[open] summary::after {
    content: "收起";
}

.settings-drawer .filters,
.settings-drawer .filter-summary,
.settings-drawer .muted {
    margin-top: 14px;
}

.panel-lead {
    margin: 0;
    line-height: 1.8;
    color: var(--muted);
}

.filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 14px;
    align-items: stretch;
}

.filter-field {
    display: grid;
    gap: 8px;
    padding: 16px;
    border-radius: 18px;
    border: 1px solid rgba(122, 75, 47, 0.18);
    background: rgba(255, 249, 239, 0.76);
}

.filter-field > span {
    font-weight: 700;
    color: var(--accent-dark);
}

.filter-field small {
    line-height: 1.6;
    color: var(--muted);
}

.filter-grid > button {
    min-height: 100%;
}

.quiz-insights,
.question-summary-grid {
    display: grid;
    gap: 14px;
}

.quiz-insights {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.helper-card,
.summary-card {
    padding: 16px 18px;
    border-radius: 18px;
    border: 1px solid rgba(122, 75, 47, 0.16);
    background: rgba(255, 250, 242, 0.82);
}

.helper-card strong,
.summary-card strong {
    display: block;
    color: var(--accent-dark);
}

.helper-card p,
.summary-card p {
    margin: 8px 0 0;
    line-height: 1.7;
}

.notice-banner {
    padding: 14px 16px;
    border-radius: 18px;
    border: 1px solid rgba(182, 137, 82, 0.3);
    background: rgba(255, 245, 222, 0.94);
    line-height: 1.7;
}

.question-meta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 14px;
}

.progress-panel {
    display: grid;
    gap: 12px;
    padding: 18px;
    border-radius: 20px;
    border: 1px solid rgba(122, 75, 47, 0.18);
    background: rgba(255, 248, 234, 0.82);
}

.progress-panel strong {
    color: var(--accent-dark);
}

.progress-panel p {
    margin: 6px 0 0;
}

.progress-track {
    overflow: hidden;
    height: 14px;
    border-radius: 999px;
    background: rgba(82, 57, 39, 0.12);
}

.progress-fill {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #7f5235, #c1905e);
}

.result-score {
    font-size: 1.08rem;
}

.result-score strong {
    font-size: 1.5rem;
    color: var(--accent-dark);
}

.empty-state {
    text-align: center;
}

.empty-state h2 {
    margin-top: 0;
}

.empty-state p {
    margin: 10px auto 0;
    max-width: 42rem;
    line-height: 1.8;
}

.result-banner {
    text-align: center;
}

.correct {
    background:
        linear-gradient(180deg, rgba(237, 246, 236, 0.95), rgba(250, 244, 231, 0.95));
}

.incorrect {
    background:
        linear-gradient(180deg, rgba(249, 233, 229, 0.94), rgba(250, 244, 231, 0.95));
}

.question-block {
    display: grid;
    gap: 6px;
}

.question-label {
    margin: 6px 0 0;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

.bilingual {
    margin: 0;
    line-height: 1.82;
}

.en-line {
    font-weight: 700;
}

.zh-line {
    color: var(--muted);
}

.report-box {
    margin-top: 18px;
    padding-top: 12px;
    border-top: 1px dashed rgba(122, 75, 47, 0.22);
}

.report-box summary {
    cursor: pointer;
    color: var(--accent-dark);
    font-weight: 700;
}

.report-form {
    margin-top: 12px;
}

.auth-panel {
    max-width: 560px;
    margin-left: auto;
    margin-right: auto;
}

.auth-alt {
    margin-bottom: 0;
}

.review-list {
    margin-top: 4px;
}

.review-card {
    display: grid;
    gap: 18px;
}

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

.compact-grid {
    grid-template-columns: minmax(160px, 220px) 1fr;
    align-items: end;
}

.review-form label {
    display: grid;
    gap: 8px;
}

.checkbox-line {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.checkbox-line input {
    width: auto;
}

.review-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.issue-log {
    display: grid;
    gap: 10px;
}

.issue-item {
    padding: 12px 14px;
    border-radius: 16px;
    background: rgba(255, 246, 225, 0.82);
    border: 1px solid rgba(182, 137, 82, 0.16);
}

.pager {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 40px;
}

@media (max-width: 1180px) {
    .page-shell {
        padding: 24px 22px 38px;
    }

    .hero {
        grid-template-columns: minmax(0, 1.3fr) minmax(220px, 0.9fr);
        padding: 30px;
    }

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

@media (max-width: 980px) {
    .hero,
    .hero-compact,
    .panel-split,
    .stats-grid,
    .insight-grid,
    .review-grid,
    .filters,
    .filter-grid,
    .learner-switch {
        grid-template-columns: 1fr;
    }

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

    .compact-nav {
        justify-content: flex-start;
    }

    .section-heading,
    .term-header,
    .status-row,
    .answer-review-head {
        align-items: flex-start;
    }

    .nav-links a,
    .nav-action-button,
    .status-row,
    .review-actions,
    .analytics-actions {
        justify-content: flex-start;
    }

    .analytics-row {
        grid-template-columns: 1fr;
    }

    .analytics-row-compact,
    .analytics-table-head {
        grid-template-columns: 1fr;
    }

    .analytics-score {
        text-align: left;
    }
}

@media (max-width: 700px) {
    body {
        background:
            linear-gradient(180deg, #503626 0%, #6a4731 100%);
    }

    .page-shell {
        padding: 16px 14px 28px;
    }

    .page-shell::before {
        inset: 6px 6px 0;
        border-radius: 24px;
    }

    .hero {
        padding: 24px 20px;
    }

    .hero-compact {
        padding: 16px 18px;
    }

    .hero::after {
        position: static;
        display: inline-flex;
        margin-top: 12px;
    }

    .hero h1 {
        max-width: none;
    }

    .nav-links {
        grid-template-columns: 1fr;
    }

    .compact-nav {
        gap: 8px;
    }

    .stat-card,
    .panel,
    .domain-card {
        border-radius: 20px;
    }

    .stat-card,
    .panel {
        padding: 20px 18px;
    }

    .section-heading,
    .term-header,
    .answer-review-head,
    .analytics-actions,
    .review-actions,
    .pager {
        flex-direction: column;
        align-items: stretch;
    }

    .filters,
    .review-grid,
    .compact-grid,
    .question-summary-grid,
    .filter-summary {
        grid-template-columns: 1fr;
    }

    .filters > button,
    .filter-grid > button,
    .review-actions > * ,
    .analytics-actions > * ,
    .pager > * {
        width: 100%;
    }

    .checkbox-line {
        align-items: flex-start;
    }

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

    input[type="text"],
    input[type="password"],
    input[type="number"],
    select,
    textarea,
    button,
    .button-link,
    .submit-button {
        font-size: 16px;
    }
}

@media (max-width: 520px) {
    .page-shell {
        padding: 12px 10px 22px;
    }

    .page-shell::before {
        inset: 4px 4px 0;
        border-radius: 20px;
    }

    .hero {
        gap: 18px;
        padding: 20px 16px;
        border-radius: 24px;
    }

    .hero-compact {
        gap: 12px;
        padding: 14px 16px;
    }

    .hero::after {
        font-size: 0.7rem;
        letter-spacing: 0.14em;
    }

    .hero h1 {
        font-size: clamp(1.8rem, 9vw, 2.4rem);
    }

    .eyebrow {
        letter-spacing: 0.16em;
        font-size: 0.72rem;
    }

    .stat-card,
    .panel,
    .domain-card,
    .option-card,
    .answer-review-card,
    .issue-item {
        padding-left: 14px;
        padding-right: 14px;
    }

    .option-card {
        gap: 10px;
    }

    .chip {
        width: 100%;
        justify-content: center;
    }

    .quiz-stage-strip .chip {
        width: auto;
        justify-content: flex-start;
    }

    .compact-nav a {
        width: auto;
        min-width: 0;
    }

    .analytics-bar {
        height: 10px;
    }

    .submit-button {
        margin-bottom: 24px;
    }
}
