:root {
    --brand: #b91c1c;
    --brand-dark: #8f1616;
    --brand-soft: #fef2f2;
    --ink: #172033;
    --muted: #5c6678;
    --line: #dce2ea;
    --surface: #ffffff;
    --page: #f4f6f8;
    --success: #087f5b;
    --shadow: 0 10px 28px rgba(23, 32, 51, .08);
    --radius: 16px;
}

* { box-sizing: border-box; }
html { min-width: 320px; }
body {
    margin: 0;
    min-height: 100vh;
    background: var(--page);
    color: var(--ink);
    font: 17px/1.55 Arial, Helvetica, sans-serif;
}
a { color: var(--brand-dark); }
a:hover { color: var(--brand); }

.site-header { background: #fff; border-bottom: 1px solid var(--line); }
.header-inner, .page-shell { width: min(1180px, calc(100% - 40px)); margin: 0 auto; }
.header-inner { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; font-weight: 700; font-size: 1.12rem; }
.brand:hover { color: var(--ink); }
.brand-mark { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 11px; background: var(--brand); color: #fff; font-size: 1.25rem; box-shadow: 0 4px 10px rgba(185, 28, 28, .22); }
.site-nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.site-nav a { padding: 10px 13px; border-radius: 8px; color: var(--muted); text-decoration: none; font-weight: 700; font-size: .94rem; }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--brand-dark); background: var(--brand-soft); }

.page-shell { padding: 42px 0 30px; }
.hero { padding: 32px; margin-bottom: 28px; border-radius: var(--radius); background: linear-gradient(120deg, #8f1616, #cf2f2f); color: #fff; box-shadow: var(--shadow); }
.eyebrow { margin: 0 0 7px; color: inherit; opacity: .8; font-size: .88rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
h1, h2, h3 { line-height: 1.18; }
h1 { margin: 0; font-size: clamp(1.8rem, 4vw, 2.55rem); }
h2 { margin: 0; font-size: 1.4rem; }
h3 { margin: 0; font-size: 1.12rem; }
.hero p:last-child { max-width: 780px; margin: 12px 0 0; font-size: 1.05rem; }

.course-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(245px, 1fr)); gap: 18px; }
.course-card, .panel, .question-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 3px 12px rgba(23, 32, 51, .04); }
.course-card { display: flex; flex-direction: column; padding: 22px; }
.panel-narrow { max-width: 760px; padding: 32px; }
.eyebrow-accent { color: var(--brand); opacity: 1; }
.course-icon { display: grid; place-items: center; width: 44px; height: 44px; margin-bottom: 18px; border-radius: 12px; background: var(--brand-soft); color: var(--brand); font-size: 1.35rem; }
.course-card h2 { color: var(--ink); }
.course-card p { margin: 8px 0 20px; color: var(--muted); font-size: .95rem; }
.card-actions { display: grid; gap: 10px; margin-top: auto; }

.button, button, input[type="submit"] { display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: 11px 16px; border: 1px solid transparent; border-radius: 9px; background: var(--brand); color: #fff; cursor: pointer; font: inherit; font-weight: 700; line-height: 1.2; text-align: center; text-decoration: none; transition: background .15s ease, transform .15s ease, box-shadow .15s ease; }
.button:hover, button:hover, input[type="submit"]:hover { background: var(--brand-dark); color: #fff; transform: translateY(-1px); box-shadow: 0 5px 12px rgba(143, 22, 22, .18); }
.button-secondary { border-color: #c8d0da; background: #fff; color: #263142; }
.button-secondary:hover { border-color: #aeb8c4; background: #f7f8fa; color: #172033; box-shadow: none; }
.button-danger { background: #941b1b; }
.button-danger:hover { background: #741515; }

.notice { display: flex; align-items: flex-start; gap: 12px; padding: 18px 20px; margin: 28px 0; border: 1px solid #f2d68b; border-radius: 12px; background: #fffaf0; color: #5d490f; }
.notice strong { display: block; }
.portal-footer { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 22px 0 30px; border-top: 1px solid var(--line); color: var(--muted); font-size: .94rem; text-align: center; }
.portal-footer p { margin: 3px; }

.auth-layout { display: grid; place-items: center; min-height: 100vh; padding: 28px 20px; background: radial-gradient(circle at 15% 15%, #fee2e2, transparent 28%), var(--page); }
.auth-card { width: min(100%, 590px); padding: clamp(26px, 7vw, 46px); background: #fff; border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); }
.auth-card .brand { justify-content: center; margin-bottom: 30px; }
.auth-card h1 { text-align: center; font-size: 2rem; }
.auth-intro { margin: 15px auto 28px; color: var(--muted); text-align: center; }
.form-field { margin-bottom: 18px; }
label { display: block; margin-bottom: 7px; font-weight: 700; color: #303b4d; }
input[type="text"], input[type="password"] { width: 100%; min-height: 48px; padding: 11px 13px; border: 1px solid #b8c1cd; border-radius: 9px; background: #fff; color: var(--ink); font: inherit; }
input[type="text"]:focus, input[type="password"]:focus { outline: 3px solid rgba(185, 28, 28, .18); border-color: var(--brand); }
.auth-card input[type="submit"] { width: 100%; margin-top: 8px; }
.auth-meta { margin-top: 27px; color: var(--muted); font-size: .94rem; text-align: center; }

.content-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.content-header p { margin: 7px 0 0; color: var(--muted); }
.question-list { display: grid; gap: 16px; }
.question-card { padding: 21px; }
.question-number { display: inline-block; padding: 4px 9px; margin-bottom: 11px; border-radius: 99px; background: var(--brand-soft); color: var(--brand-dark); font-size: .82rem; font-weight: 700; }
.question-card h2 { margin-bottom: 16px; font-size: 1.15rem; }
.answers { display: grid; gap: 8px; padding: 0; margin: 0; list-style: none; color: #3b4656; }
.answers li { padding: 9px 11px; border-radius: 8px; background: #f7f8fa; }
.answer-key { margin: 16px 0 0; padding-top: 14px; border-top: 1px solid var(--line); color: var(--success); font-weight: 700; }
.empty-state { padding: 32px; text-align: center; color: var(--muted); }
.legacy-question-page { width: min(980px, calc(100% - 40px)); margin: 0 auto; padding: 38px 0; }
.legacy-question-page > h1 { margin-bottom: 25px; }
.legacy-question-page > div { padding: 21px; margin-bottom: 16px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 3px 12px rgba(23, 32, 51, .04); }

@media (max-width: 620px) {
    body { font-size: 16px; }
    .header-inner, .page-shell, .portal-footer { width: min(100% - 28px, 1180px); }
    .header-inner { padding: 12px 0; align-items: flex-start; flex-direction: column; }
    .site-nav { width: 100%; }
    .site-nav a { flex: 1; padding: 9px 7px; text-align: center; }
    .page-shell { padding-top: 24px; }
    .hero { padding: 24px 20px; }
    .content-header { flex-direction: column; }
    .content-header .button { width: 100%; }
}
