:root {
    --bg: #f7f4ee;
    --surface: rgba(255, 255, 255, 0.96);
    --surface-solid: #ffffff;
    --text: #102033;
    --muted: #687586;
    --line: #ded6c8;
    --line-soft: #eee7dc;
    --brand: #163a5f;
    --brand-dark: #0b2540;
    --brand-soft: #eef4f8;
    --gold: #c59b3b;
    --gold-soft: #fbf4df;
    --success: #0f766e;
    --success-soft: #ecfdfa;
    --warning-soft: #fff7e6;
    --warning-line: #e9c46a;
    --danger: #b42318;
    --danger-soft: #fef2f2;
    --purple: #6d4c8d;
    --purple-soft: #f7f1fb;
    --shadow-soft: 0 22px 70px rgba(16, 32, 51, 0.11);
    --radius-lg: 24px;
    --radius-xl: 30px;
}

* {
    box-sizing: border-box;
}

body {
    position: relative;
    min-height: 100vh;
    margin: 0;
    background:
        linear-gradient(rgba(22, 58, 95, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(22, 58, 95, 0.035) 1px, transparent 1px),
        radial-gradient(circle at top left, rgba(197, 155, 59, 0.2) 0, transparent 28rem),
        radial-gradient(circle at top right, rgba(22, 58, 95, 0.12) 0, transparent 32rem),
        var(--bg);
    background-size: 34px 34px, 34px 34px, auto, auto, auto;
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

body::after {
    content: "";
    position: fixed;
    right: -10rem;
    bottom: -12rem;
    z-index: 0;
    width: 34rem;
    height: 34rem;
    pointer-events: none;
    background: radial-gradient(circle, rgba(197, 155, 59, 0.18), transparent 68%);
    filter: blur(6px);
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background-image: url("assets/Cartoon_icon.png?v=20260707-cartoon");
    background-repeat: repeat;
    background-size: 18rem auto;
    opacity: 0.055;
}

body > * {
    position: relative;
    z-index: 1;
}

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

button {
    cursor: pointer;
}

.hidden {
    display: none !important;
}

.app-header {
    position: sticky;
    top: 0;
    z-index: 20;
    overflow: hidden;
    border-bottom: 1px solid rgba(222, 214, 200, 0.8);
    background: rgba(255, 252, 246, 0.9);
    box-shadow: 0 1px 12px rgba(16, 32, 51, 0.05);
    backdrop-filter: blur(16px);
    transition: min-height 0.24s ease;
}

.app-header::after {
    content: "";
    display: block;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(197, 155, 59, 0.75), transparent);
}

.header-inner,
.page-container,
.admin-container {
    width: min(100% - 32px, 72rem);
    margin: 0 auto;
}

.student-container {
    width: min(100% - 32px, 56rem);
    margin: 0 auto;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 0;
    transition: max-height 0.24s ease, opacity 0.2s ease, padding 0.24s ease;
}

.student-header-toggle {
    position: absolute;
    right: max(1rem, calc((100vw - 56rem) / 2));
    bottom: 0.28rem;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 1.55rem;
    border: 1px solid rgba(197, 155, 59, 0.38);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.86);
    color: var(--brand-dark);
    font-size: 0.85rem;
    font-weight: 900;
    line-height: 1;
    box-shadow: 0 6px 18px rgba(16, 32, 51, 0.08);
}

.admin-header-toggle {
    right: max(1rem, calc((100vw - 72rem) / 2));
}

.student-header-toggle:hover,
.student-header-toggle:focus-visible {
    background: var(--gold-soft);
    border-color: rgba(197, 155, 59, 0.62);
}

.app-header.is-collapsed {
    min-height: 2.35rem;
}

.app-header.is-collapsed .header-inner {
    max-height: 0;
    opacity: 0;
    padding-top: 0;
    padding-bottom: 0;
    pointer-events: none;
}

.brand-kicker {
    margin: 0;
    color: var(--gold);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.22em;
    text-transform: uppercase;
}

.app-title {
    margin: 0.15rem 0 0;
    color: var(--text);
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.app-subtitle {
    margin: 0.2rem 0 0;
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 700;
}

.app-credential-lines {
    display: grid;
    gap: 0.22rem;
    max-width: 52rem;
    margin-top: 0.55rem;
}

.app-credential-lines::before {
    content: "";
    display: block;
    width: 4rem;
    height: 2px;
    margin-bottom: 0.25rem;
    background: linear-gradient(90deg, var(--gold), rgba(197, 155, 59, 0));
}

.credential-line {
    margin: 0;
    font-size: clamp(0.86rem, 2vw, 1.02rem);
    font-weight: 900;
    letter-spacing: 0.02em;
    line-height: 1.45;
}

.credential-line.primary {
    color: var(--brand-dark);
}

.credential-line.accent {
    color: #9a6a05;
}

.page-container,
.admin-container,
.student-container {
    padding: 2rem 0 2.75rem;
}

.header-inner.student-container {
    padding: 1rem 0;
}

.page-card,
.login-card,
.success-card {
    border: 1px solid rgba(255, 255, 255, 0.95);
    border-radius: var(--radius-xl);
    background: var(--surface);
    box-shadow: var(--shadow-soft);
    position: relative;
    overflow: hidden;
}

.page-card::after,
.login-card::after,
.success-card::after {
    content: "";
    position: absolute;
    top: -5.5rem;
    right: -5.5rem;
    width: 13rem;
    height: 13rem;
    border-radius: 999px;
    background: radial-gradient(circle, rgba(197, 155, 59, 0.13), transparent 68%);
    pointer-events: none;
}

.page-card::before,
.login-card::before,
.success-card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 5px;
    background: linear-gradient(90deg, var(--brand), var(--gold));
}

.login-card {
    max-width: 28rem;
    margin: 3rem auto 0;
    padding: 2rem;
}

.page-card {
    padding: 2rem;
}

.success-card {
    max-width: 28rem;
    margin: 0 auto;
    padding: 2rem;
    text-align: center;
}

.card-heading {
    margin-bottom: 1.5rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--line-soft);
    position: relative;
    z-index: 1;
}

.card-heading h2,
.login-intro h2,
.success-card h2 {
    margin: 0.2rem 0 0;
    font-size: 1.6rem;
    line-height: 1.2;
    letter-spacing: -0.025em;
}

.card-heading p,
.login-intro p {
    margin: 0.5rem 0 0;
    color: var(--muted);
    font-size: 0.95rem;
}

.login-intro {
    margin-bottom: 1.5rem;
    text-align: center;
}

.logo-mark {
    display: inline-flex;
    width: 3.5rem;
    height: 3.5rem;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    border-radius: 1rem;
    background: linear-gradient(135deg, var(--brand-dark), var(--brand));
    color: #fff8e7;
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    box-shadow: inset 0 -3px 0 rgba(197, 155, 59, 0.4), 0 14px 30px rgba(16, 32, 51, 0.18);
}

.logo-image {
    display: block;
    width: min(12rem, 70%);
    max-width: 100%;
    height: auto;
    margin: 0 auto 1rem;
    filter: drop-shadow(0 16px 26px rgba(16, 32, 51, 0.16));
}

.login-intro,
.form-stack,
.success-card > * {
    position: relative;
    z-index: 1;
}

.form-stack {
    display: grid;
    gap: 1rem;
}

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

.form-row {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    border-radius: var(--radius-xl);
    background: #f8fafc;
}

.field-narrow {
    width: 12rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    color: #26384d;
    font-size: 0.9rem;
    font-weight: 700;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.65rem;
    color: var(--muted);
    font-size: 0.85rem;
    font-weight: 700;
}

.checkbox-row input {
    accent-color: var(--brand);
}

.field,
.textarea-field {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 1rem;
    background: #fbfaf7;
    color: var(--text);
    outline: none;
    padding: 0.85rem 1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.field:hover,
.textarea-field:hover {
    border-color: #c9bfae;
    background: #fffdf8;
}

.textarea-field {
    resize: vertical;
}

div.textarea-field[contenteditable] {
    min-height: 80px;
    overflow-y: auto;
}

div.textarea-field[contenteditable]:empty:before {
    content: attr(placeholder);
    color: #999;
    pointer-events: none;
    display: block;
}

.field:focus,
.textarea-field:focus {
    border-color: var(--brand);
    background: white;
    box-shadow: 0 0 0 4px rgba(22, 58, 95, 0.12);
}

.field:disabled,
.textarea-field:disabled {
    background: #e2e8f0;
    color: var(--muted);
    cursor: not-allowed;
}

.field-warning {
    border-color: var(--warning-line);
    background: var(--warning-soft);
}

.field-purple {
    border-color: #e9d5ff;
    background: var(--purple-soft);
}

.optional-field {
    border-color: #d7dce2;
    background: #f3f4f6;
}

.optional-field:hover {
    border-color: #cbd5e1;
    background: #eef1f5;
}

.primary-button,
.secondary-button,
.success-button,
.danger-button,
.edit-button,
.ghost-button,
.language-button,
.course-info-button {
    border: 0;
    border-radius: 999px;
    font-weight: 800;
    transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.primary-button:hover,
.success-button:hover,
.secondary-button:hover,
.ghost-button:hover,
.language-button:hover,
.edit-button:hover,
.danger-button:hover,
.course-info-button:hover {
    transform: translateY(-1px);
}

.primary-button,
.success-button,
.course-info-button {
    color: white;
    box-shadow: 0 12px 28px rgba(16, 32, 51, 0.18);
}

.primary-button {
    background: linear-gradient(135deg, var(--brand-dark), var(--brand));
}

.primary-button:hover,
.course-info-button:hover {
    background: linear-gradient(135deg, #071b31, var(--brand-dark));
}

.course-info-button {
    display: inline-flex;
    justify-content: center;
    margin-top: 1rem;
    background: linear-gradient(135deg, var(--brand-dark), var(--brand));
    padding: 0.8rem 1.1rem;
    text-decoration: none;
}

.success-button {
    background: linear-gradient(135deg, #0f766e, #11998e);
}

.success-button:hover {
    background: linear-gradient(135deg, #0b5f59, #0f766e);
}

.secondary-button,
.ghost-button,
.language-button {
    border: 1px solid var(--line);
    background: white;
    color: #26384d;
}

.secondary-button:hover,
.ghost-button:hover,
.language-button:hover {
    border-color: #e6c678;
    background: var(--gold-soft);
    color: var(--brand-dark);
}

.danger-button {
    background: var(--danger-soft);
    color: var(--danger);
    padding: 0.55rem 1rem;
}

.danger-button:hover {
    background: #fee2e2;
}

.edit-button {
    background: var(--brand-soft);
    color: var(--brand-dark);
    padding: 0.55rem 1rem;
}

.edit-button:hover {
    background: #dbeafe;
}

.button-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.button-full {
    width: 100%;
    padding: 0.9rem 1rem;
    border-radius: 1rem;
}

.action-button,
.ghost-button,
.language-button {
    padding: 0.8rem 1.1rem;
}

.button-large {
    width: 100%;
    padding: 1rem;
    border-radius: var(--radius-lg);
    font-size: 1.05rem;
}

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

.menu-card {
    min-height: 7.5rem;
    padding: 1.25rem 1.5rem;
    border-radius: var(--radius-xl);
    text-align: left;
    box-shadow: 0 12px 30px rgba(16, 32, 51, 0.06);
}

.menu-card.primary {
    background:
        linear-gradient(135deg, rgba(11, 37, 64, 0.96), rgba(22, 58, 95, 0.94)),
        repeating-linear-gradient(0deg, transparent 0 24px, rgba(255, 255, 255, 0.08) 24px 25px);
    color: white;
    border: 1px solid rgba(197, 155, 59, 0.25);
}

.menu-card.secondary {
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.92);
    color: var(--text);
}

.menu-card.secondary:hover {
    border-color: rgba(197, 155, 59, 0.45);
}

.menu-card:hover {
    transform: translateY(-2px);
}

.menu-title {
    display: block;
    font-size: 1.1rem;
}

.menu-subtitle {
    display: block;
    margin-top: 0.35rem;
    color: currentColor;
    font-size: 0.9rem;
    font-weight: 600;
    opacity: 0.72;
}

.questions-list,
.test-form,
.review-list,
.results-section {
    display: grid;
    gap: 1.5rem;
}

.question-block,
.question-card {
    border: 1px solid rgba(222, 214, 200, 0.9);
    border-radius: var(--radius-xl);
    background: linear-gradient(180deg, #ffffff, #fffdf9);
    box-shadow: 0 12px 34px rgba(16, 32, 51, 0.065);
    position: relative;
    overflow: hidden;
}

.question-block {
    padding: 1.5rem;
}

.question-card {
    padding: 1.5rem;
    border-top: 4px solid rgba(197, 155, 59, 0.75);
}

.question-card::after,
.review-card::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 3;
    pointer-events: none;
    background-image: url("assets/Cartoon_icon.png?v=20260707-cartoon");
    background-position: right -1.5rem bottom -1.5rem;
    background-repeat: no-repeat;
    background-size: 13rem auto;
    opacity: 0.08;
    mix-blend-mode: multiply;
}

.question-card::after {
    background-image:
        url("assets/Cartoon_icon.png?v=20260707-cartoon"),
        url("assets/Cartoon_icon.png?v=20260707-cartoon");
    background-position:
        left -3rem top -2rem,
        right -3rem bottom -2rem;
    background-repeat: no-repeat;
    background-size:
        clamp(18rem, 72vw, 30rem) auto,
        clamp(18rem, 72vw, 30rem) auto;
    opacity: 0.11;
}

.question-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--line-soft);
}

.question-header h3 {
    margin: 0.2rem 0 0;
}

.correct-select {
    border: 1px solid rgba(15, 118, 110, 0.25);
    border-radius: 1rem;
    background: var(--success-soft);
    color: #065f46;
    font-weight: 800;
    outline: none;
    padding: 0.85rem 1rem;
}

.question-settings {
    display: grid;
    grid-template-columns: repeat(2, minmax(9rem, 1fr));
    gap: 0.75rem;
    width: min(100%, 26rem);
}

.settings-panel {
    margin: 1.5rem 0;
    border: 1px solid var(--line-soft);
    border-radius: var(--radius-xl);
    background: #fbfaf7;
    padding: 1.25rem;
}

.settings-panel-heading,
.grade-comment-heading,
.option-editor-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.settings-panel-heading h3 {
    margin: 0.2rem 0 0;
}

.grade-comments-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.grade-comment-card {
    display: grid;
    gap: 0.5rem;
    border: 1px solid var(--line-soft);
    border-radius: var(--radius-lg);
    background: white;
    padding: 1rem;
}

.grade-comment-heading span {
    border-radius: 999px;
    background: var(--gold-soft);
    color: #6f5213;
    font-size: 0.8rem;
    font-weight: 800;
    padding: 0.2rem 0.65rem;
}

.answer-row {
    margin-bottom: 1rem;
}

.image-preview-row {
    margin-top: 0.45rem;
    font-size: 0.85rem;
    font-weight: 700;
}

.image-preview-row a,
.site-footer a {
    color: var(--brand-dark);
    text-decoration: none;
}

.image-preview-row a:hover,
.site-footer a:hover {
    text-decoration: underline;
}

.short-answer-area {
    margin-bottom: 1.5rem;
}

.two-column-grid,
.options-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem 1.5rem;
    margin-bottom: 1rem;
}

.options-grid {
    margin-bottom: 1.5rem;
    padding: 1.25rem;
    border-radius: var(--radius-lg);
    background:
        linear-gradient(rgba(22, 58, 95, 0.035) 1px, transparent 1px),
        #fbfaf7;
    background-size: 28px 28px;
}

.option-editor {
    display: grid;
    gap: 0.85rem;
    border: 1px solid var(--line-soft);
    border-radius: var(--radius-lg);
    background: white;
    padding: 1rem;
}

.option-editor-heading .field {
    max-width: 11rem;
}

.option-text-fields,
.option-image-fields {
    display: grid;
    gap: 0.45rem;
}

.option-zh-image-field {
    display: grid;
    gap: 0.45rem;
}

.rich-text-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin: 0 0 0.45rem;
}

.rich-text-button {
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 999px;
    background: rgba(248, 250, 252, 0.82);
    color: #475569;
    font-size: 0.78rem;
    font-weight: 800;
    padding: 0.28rem 0.58rem;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.rich-text-button:hover,
.rich-text-button:focus-visible {
    border-color: rgba(22, 58, 95, 0.28);
    background: var(--brand-soft);
    color: var(--brand-dark);
}

.compact-label {
    color: var(--muted);
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.password-field-wrap {
    position: relative;
}

.password-field-wrap .field {
    padding-right: 3.1rem;
    width: 100%;
}

.password-toggle {
    position: absolute;
    top: 50%;
    right: 0.55rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--muted);
    transform: translateY(-50%);
}

.password-toggle:hover,
.password-toggle[aria-pressed="true"] {
    background: var(--brand-soft);
    color: var(--brand-dark);
}

.password-toggle svg {
    width: 1.2rem;
    height: 1.2rem;
    fill: currentColor;
}

.form-actions {
    display: grid;
    gap: 0.75rem;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--line-soft);
}

.table-shell {
    overflow: hidden;
    border: 1px solid var(--line-soft);
    border-radius: var(--radius-xl);
}

.table-scroll {
    overflow-x: auto;
}

.test-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.test-table th {
    padding: 1rem;
    border-bottom: 1px solid var(--line-soft);
    background: #fbfaf7;
    color: var(--muted);
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.test-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--line-soft);
}

.test-table tr:hover {
    background: #fbfaf7;
}

.muted-text {
    color: var(--muted);
    font-size: 0.92rem;
}

.badge,
.status-pill {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 0.25rem 0.75rem;
    font-size: 0.85rem;
    font-weight: 800;
}

.badge.code {
    background: var(--brand-soft);
    color: var(--brand-dark);
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}

.badge.passcode {
    background: var(--gold-soft);
    color: #6f5213;
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}

.status-line {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
}

.toggle {
    position: relative;
    display: inline-flex;
    width: 2.75rem;
    height: 1.5rem;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: #cbd5e1;
    transition: 0.2s ease;
}

.toggle-slider::after {
    content: "";
    position: absolute;
    top: 0.15rem;
    left: 0.15rem;
    width: 1.2rem;
    height: 1.2rem;
    border-radius: 999px;
    background: white;
    transition: 0.2s ease;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.2);
}

.toggle input:checked + .toggle-slider {
    background: var(--success);
}

.toggle input:checked + .toggle-slider::after {
    transform: translateX(1.25rem);
}

.student-header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.student-info {
    border-radius: 1rem;
    background: #fbfaf7;
    color: var(--muted);
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.55rem 0.75rem;
}

.student-info strong {
    color: var(--text);
}

.sticky-submit {
    position: sticky;
    bottom: 1rem;
    margin-top: 1.5rem;
    padding: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.9);
    border-radius: var(--radius-xl);
    background: var(--surface);
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(16px);
}

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

.nav-button {
    padding: 1rem;
    border-radius: var(--radius-lg);
    font-size: 1.05rem;
}

.nav-button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.test-navigation .success-button {
    grid-column: span 1;
}

.reminder-box {
    margin-bottom: 1.25rem;
    border: 1px solid var(--warning-line);
    border-radius: 1rem;
    background: var(--warning-soft);
    color: #92400e;
    font-size: 0.92rem;
    font-weight: 600;
    padding: 0.85rem 1rem;
}

.question-text {
    margin: 0 0 1.25rem;
    color: var(--text);
    font-size: 1.08rem;
    line-height: 1.65;
    white-space: pre-wrap;
}

.question-image {
    display: block;
    max-width: 100%;
    max-height: 28rem;
    margin: 0;
    border: 1px solid var(--line-soft);
    border-radius: var(--radius-lg);
    object-fit: contain;
}

.question-image-wrap {
    display: grid;
    gap: 0.5rem;
    margin: 0 0 1.25rem;
}

.question-image-wrap a {
    color: var(--brand-dark);
    font-size: 0.9rem;
    font-weight: 800;
    text-decoration: none;
}

.question-image-wrap a:hover {
    text-decoration: underline;
}

.question-progress {
    border-radius: 999px;
    background: var(--gold-soft);
    color: #6f5213;
    font-size: 0.8rem;
    font-weight: 800;
    padding: 0.25rem 0.75rem;
}

.question-wizard-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1rem;
    border: 1px solid var(--line-soft);
    border-radius: var(--radius-xl);
    background: rgba(251, 250, 247, 0.92);
    padding: 1rem;
}

.draft-save-status {
    margin: 0.45rem 0 0;
    color: var(--muted);
    font-size: 0.85rem;
    font-weight: 700;
}

.wizard-button-row {
    display: flex;
    gap: 0.75rem;
}

.option-list {
    display: grid;
    gap: 0.75rem;
}

.option-card {
    display: flex;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 1rem;
    background: rgba(255, 255, 255, 0.88);
    cursor: pointer;
    padding: 1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.option-card:hover,
.option-card.selected {
    border-color: var(--brand);
    background: var(--brand-soft);
    box-shadow: 0 0 0 4px rgba(22, 58, 95, 0.1);
    font-weight: 800;
}

.option-card input {
    accent-color: var(--brand);
}

.option-card > .option-choice-body {
    display: grid;
    gap: 0.5rem;
    margin-left: 0.75rem;
    font-weight: 600;
    width: 100%;
}

.option-card > .option-choice-body strong {
    color: var(--brand-dark);
}

.option-image,
.answer-option-image {
    display: block;
    max-width: 100%;
    border: 1px solid var(--line-soft);
    border-radius: 1rem;
    background: white;
    object-fit: contain;
}

.option-image {
    max-height: 18rem;
}

.answer-option-image {
    max-height: 10rem;
    margin-top: 0.35rem;
}

.option-image-caption {
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 700;
}

.answer-option-preview {
    display: inline-grid;
    gap: 0.35rem;
    max-width: min(100%, 24rem);
    vertical-align: top;
}

.short-answer-box {
    display: grid;
    gap: 0.5rem;
}

.score-panel {
    margin: 1rem 0 1.5rem;
    border: 1px solid rgba(197, 155, 59, 0.35);
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, var(--brand-soft), var(--gold-soft));
    color: var(--brand-dark);
    padding: 1.25rem;
}

.score-panel p {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 800;
}

.score-panel strong {
    font-size: 2rem;
}

.grade-result-box {
    position: relative;
    margin-top: 1rem;
    overflow: hidden;
    border: 1px solid rgba(197, 155, 59, 0.26);
    border-radius: 1.25rem;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(251, 244, 223, 0.72)),
        white;
    box-shadow: 0 12px 28px rgba(16, 32, 51, 0.08);
    padding: 1.1rem 1.2rem 1.1rem 3.3rem;
    text-align: left;
}

.grade-result-box::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 5px;
    background: linear-gradient(180deg, var(--gold), var(--brand));
}

.feedback-mark {
    position: absolute;
    top: 0.55rem;
    left: 1rem;
    color: rgba(197, 155, 59, 0.9);
    font-family: Georgia, "Times New Roman", serif;
    font-size: 2.4rem;
    font-weight: 900;
    line-height: 1;
}

.grade-result-box .rich-text-content {
    margin: 0;
    color: var(--brand-dark);
    font-size: clamp(0.98rem, 2.2vw, 1.08rem);
    font-weight: 800;
    line-height: 1.65;
}

.rich-text-content {
    color: inherit;
    display: flow-root;
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.rich-text-content * {
    max-width: 100%;
}

.rich-text-content p,
.rich-text-content div {
    margin: 0.35rem 0;
}

.rich-text-content p:first-child,
.rich-text-content div:first-child {
    margin-top: 0;
}

.rich-text-content p:last-child,
.rich-text-content div:last-child {
    margin-bottom: 0;
}

.rich-text-content ul,
.rich-text-content ol {
    margin: 0.5rem 0 0.5rem 1.25rem;
    padding: 0;
}

.rich-text-content li {
    margin: 0.25rem 0;
}

.difficulty-report {
    margin: 0 0 1.5rem;
    text-align: left;
}

.difficulty-report h3 {
    margin: 0 0 0.75rem;
    font-size: 1rem;
}

.difficulty-report-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 0.5rem;
    border: 1px solid var(--line-soft);
    border-radius: 1rem;
    background: white;
    padding: 0.75rem 1rem;
}

.difficulty-report-row span {
    color: var(--muted);
    font-weight: 700;
}

.test-reason-box {
    margin: -0.35rem 0 1.5rem;
    border: 1px solid rgba(197, 155, 59, 0.28);
    border-radius: 1.15rem;
    background:
        linear-gradient(135deg, rgba(251, 244, 223, 0.9), rgba(255, 255, 255, 0.96)),
        white;
    padding: 1rem 1.1rem;
    text-align: left;
    box-shadow: 0 14px 34px rgba(16, 32, 51, 0.07);
    overflow: hidden;
    contain: layout paint;
}

.test-reason-box h3 {
    margin: 0 0 0.55rem;
    color: var(--brand-dark);
    font-size: 1rem;
}

.test-reason-box .rich-text-content {
    line-height: 1.65;
}

.success-icon {
    color: var(--success);
    margin-bottom: 1rem;
}

.success-icon svg {
    display: block;
    width: 4rem;
    height: 4rem;
    margin: 0 auto;
}

.review-card {
    border: 1px solid;
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    position: relative;
    overflow: hidden;
    text-align: left;
}

.review-card.correct {
    border-color: #a7f3d0;
    background: var(--success-soft);
}

.review-card.incorrect {
    border-color: #fecaca;
    background: var(--danger-soft);
}

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

.review-header h4 {
    margin: 0;
}

.review-question-image {
    display: block;
    max-width: 100%;
    max-height: 18rem;
    margin: 0.75rem 0;
    border: 1px solid var(--line-soft);
    border-radius: 1rem;
    object-fit: contain;
}

.status-pill.correct {
    background: #d1fae5;
    color: #047857;
}

.status-pill.incorrect {
    background: #fee2e2;
    color: var(--danger);
}

.answer-line {
    margin: 0.35rem 0;
    color: #334155;
    font-size: 0.95rem;
}

.answer-line .correct-answer {
    color: #047857;
}

.answer-line .wrong-answer {
    color: var(--danger);
}

.explanation-box {
    margin-top: 1rem;
    border: 1px solid #f3e8ff;
    border-radius: 1rem;
    background: white;
    color: #334155;
    font-size: 0.95rem;
    padding: 1rem;
}

.explanation-box strong {
    display: block;
    margin-bottom: 0.45rem;
    color: var(--purple);
}

.aim-high-box {
    margin-top: 1rem;
    border: 1px solid rgba(197, 155, 59, 0.42);
    border-radius: 1rem;
    background: #fffaf0;
    color: #334155;
    padding: 0.85rem 1rem;
}

.aim-high-box summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    color: #6f5213;
    cursor: pointer;
    font-weight: 900;
    list-style: none;
}

.aim-high-box summary::-webkit-details-marker {
    display: none;
}

.aim-high-box summary::after {
    content: "Open";
    border-radius: 999px;
    background: rgba(197, 155, 59, 0.14);
    color: #6f5213;
    font-size: 0.78rem;
    padding: 0.22rem 0.65rem;
}

.aim-high-box[open] summary::after {
    content: "Close";
}

.aim-high-box div {
    margin-top: 0.75rem;
    white-space: pre-wrap;
}

.error-message {
    border-radius: 1rem;
    background: var(--danger-soft);
    color: var(--danger);
    font-size: 0.9rem;
    font-weight: 700;
    padding: 0.85rem;
    text-align: center;
}

.loading-row,
.empty-row,
.error-row {
    padding: 1.5rem;
    text-align: center;
}

.empty-row {
    color: var(--muted);
}

.error-row {
    color: var(--danger);
}

.site-footer {
    width: min(100% - 32px, 72rem);
    margin: 0 auto;
    padding: 0 0 2.25rem;
    color: var(--muted);
    font-size: 0.9rem;
    text-align: center;
}

.site-footer::before {
    content: "";
    display: block;
    width: min(18rem, 70%);
    height: 1px;
    margin: 0 auto 1rem;
    background: linear-gradient(90deg, transparent, rgba(197, 155, 59, 0.65), transparent);
}

.site-footer p {
    margin: 0.25rem 0;
}

.instagram-line {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.instagram-icon {
    width: 1.1rem;
    height: 1.1rem;
    flex: 0 0 auto;
}

.site-footer strong {
    color: var(--brand-dark);
}

@media (max-width: 800px) {
    .page-container,
    .admin-container,
    .student-container {
        width: min(100% - 20px, 72rem);
        padding: 1rem 0 2rem;
    }

    .form-grid,
    .two-column-grid,
    .options-grid,
    .grade-comments-grid,
    .question-settings,
    .menu-grid {
        grid-template-columns: 1fr;
    }

    .settings-panel-heading,
    .question-wizard-controls,
    .option-editor-heading {
        align-items: stretch;
        flex-direction: column;
    }

    .wizard-button-row {
        display: grid;
        grid-template-columns: 1fr;
    }

    .field-narrow {
        width: 100%;
    }

    .page-card,
    .success-card,
    .login-card {
        padding: 1.25rem;
    }

    .success-card {
        max-width: none;
        width: 100%;
    }

    .score-panel,
    .grade-result-box,
    .test-reason-box,
    .difficulty-report {
        margin-bottom: 1rem;
    }

    .grade-result-box {
        padding: 1rem 1rem 1rem 2.35rem;
    }

    .feedback-mark {
        left: 0.75rem;
        font-size: 1.8rem;
    }

    .test-reason-box {
        padding: 0.95rem;
    }

    .rich-text-content ul,
    .rich-text-content ol {
        margin-left: 1.05rem;
    }

    .button-full,
    .primary-button,
    .success-button,
    .secondary-button {
        width: 100%;
        min-height: 3.15rem;
    }

    .header-inner {
        align-items: flex-start;
    }

    .student-header-actions {
        align-items: flex-end;
        flex-direction: column;
    }

    .question-header,
    .review-header {
        flex-direction: column;
        align-items: flex-start;
    }
}
