@font-face {
    font-family: "Barlow Condensed";
    src: url("barlow-condensed-800.woff2") format("woff2");
    font-style: normal;
    font-weight: 800;
    font-display: swap;
}

@font-face {
    font-family: "DM Sans";
    src: url("dm-sans.woff2") format("woff2");
    font-style: normal;
    font-weight: 100 1000;
    font-display: swap;
}

:root {
    color-scheme: light;
    --text: #23211e;
    --muted: #625e56;
    --dark: #191919;
    --paper: #f7f5f0;
    --surface: #fff;
    --line: #e8e3d9;
    --line-strong: #d7d0c3;
    --warm: #fff7e2;
    --yellow: #ffc441;
    --yellow-hover: #f2b230;
    --red: #992421;
    --green: #265838;
    --radius: 18px;
    --body: "DM Sans", system-ui, sans-serif;
    --headline: "Barlow Condensed", "Arial Narrow", Impact, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
body {
    margin: 0;
    min-width: 280px;
    min-height: 100vh;
    background: var(--paper);
    color: var(--text);
    font: 400 1rem/1.53 var(--body);
}
img { display: block; max-width: 100%; }
a { color: inherit; text-underline-offset: .21em; }
a:hover { text-decoration-thickness: 2px; }
p { margin: 0; }
h1, h2 {
    margin: 0;
    font: 800 2.45rem/.99 var(--headline);
    letter-spacing: -.012em;
    overflow-wrap: anywhere;
}
h1 { font-size: clamp(2.6rem, 5vw, 4rem); }
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible,
summary:focus-visible, .table-wrap:focus-visible {
    outline: 3px solid #146194;
    outline-offset: 3px;
}
.wrap { width: min(100% - 3.5rem, 72.5rem); margin-inline: auto; }
.sr-only, .skip:not(:focus) {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}
.skip:focus { position: absolute; z-index: 3; top: .6rem; left: .6rem; background: var(--surface); padding: .6rem; }
.muted, .optional { color: var(--muted); }
.optional { font-weight: 400; }

.site-header { color: #fff; background: var(--dark); border-bottom: 1px solid #2d2b28; }
.header-inner { min-height: 4.65rem; display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.brand { display: inline-flex; gap: .72rem; align-items: center; text-decoration: none; }
.brand > span { display: grid; font-size: .99rem; font-weight: 800; line-height: 1.15; letter-spacing: .005em; }
.brand-sub { color: #d0c6b5; font-size: .69rem; font-weight: 650; letter-spacing: .13em; margin-top: .2rem; text-transform: uppercase; }
.header-link {
    color: #f6f1e7;
    border: 1px solid #55504a;
    border-radius: .55rem;
    padding: .52rem .88rem;
    font-size: .875rem;
    font-weight: 650;
    text-decoration: none;
    white-space: nowrap;
}
.header-link:hover { border-color: var(--yellow); color: var(--yellow); }

.welcome { padding-block: clamp(2rem, 6vw, 5.3rem); }
.hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.06fr);
    overflow: hidden;
    min-height: 35rem;
    border: 1px solid var(--line);
    border-radius: 1.25rem;
    box-shadow: 0 18px 55px #3d251511;
    background: var(--surface);
}
.hero-content { padding: clamp(2rem, 5vw, 4.25rem); align-self: center; }
.eyebrow {
    color: #77531b;
    font-size: .82rem;
    font-weight: 800;
    line-height: 1.4;
    letter-spacing: .13em;
    text-transform: uppercase;
}
.hero-label { display: flex; align-items: center; gap: .6rem; color: #664718; }
.hero-label span { width: 1.45rem; height: .19rem; border-radius: 1rem; background: #e89a14; }
.hero h1 { margin-block: .72rem 1.2rem; font-size: clamp(4.5rem, 8.3vw, 7.25rem); line-height: .83; letter-spacing: -.022em; }
.hero-description { max-width: 25rem; color: #504c45; font-size: clamp(1.02rem, 1.6vw, 1.18rem); line-height: 1.5; }
.hero-facts {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem .68rem;
    margin-top: 1.15rem;
    color: var(--muted);
    font-size: .875rem;
}
.hero-facts strong { color: var(--text); font-weight: 800; }
.hero-facts span { width: .3rem; height: .3rem; border-radius: 50%; background: #ad7c38; }
.hero-media { position: relative; min-width: 0; min-height: 18rem; background: #2c231e; }
.hero-media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 55% center; }
.hero-media::after {
    position: absolute;
    inset: auto 0 0;
    height: .35rem;
    content: "";
    background: linear-gradient(90deg, #a73427 0 74%, #ffbf3d 74% 100%);
}
.start-form { margin-top: 1.7rem; }
.start-controls { display: flex; align-items: stretch; gap: .6rem; margin-top: .4rem; }
.start-controls input { flex: 1 1 9rem; min-width: 0; }
.start-controls .button { white-space: nowrap; }
.form-help { color: var(--muted); font-size: .875rem; line-height: 1.4; font-weight: 400; }
.start-form .form-help { margin-top: .62rem; }

.button {
    display: inline-flex;
    min-height: 3.05rem;
    padding: .66rem 1.05rem;
    gap: .45rem;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    border-radius: .55rem;
    font: 750 .95rem/1.28 var(--body);
    text-align: center;
    text-decoration: none;
    cursor: pointer;
}
.button-primary { color: #20190d; background: var(--yellow); border-color: var(--yellow); }
.button-primary:hover { background: var(--yellow-hover); border-color: var(--yellow-hover); }
.button-muted { color: var(--text); background: var(--surface); border-color: var(--line-strong); }
.button-muted:hover { background: #f4f1ea; }
.button-danger { color: #fff; background: var(--red); }
.button-danger:hover { background: #7c1d1b; }
.fit { justify-self: start; }

label, legend { font-weight: 700; font-size: .94rem; }
input, textarea, select {
    display: block;
    margin: 0;
    width: 100%;
    padding: .72rem .82rem;
    color: var(--text);
    border: 1px solid var(--line-strong);
    border-radius: .5rem;
    background: #fff;
    font: 400 1rem/1.38 var(--body);
}
input::placeholder { color: #746e62; }
textarea { min-height: 6rem; resize: vertical; }
select {
    appearance: none;
    padding-right: 2.6rem;
    background-image:
        linear-gradient(45deg, transparent 53%, #544d41 53%),
        linear-gradient(135deg, #544d41 53%, transparent 53%);
    background-size: 6px 6px;
    background-position: calc(100% - 1.12rem) 53%, calc(100% - .77rem) 53%;
    background-repeat: no-repeat;
}
input[type="file"] { padding: .6rem; }
input::file-selector-button {
    margin-right: .55rem;
    padding: .45rem .6rem;
    border: 1px solid var(--line-strong);
    border-radius: .35rem;
    background: var(--paper);
    color: var(--text);
    cursor: pointer;
}
fieldset { min-width: 0; padding: 0; margin: 0; border: 0; }
legend { padding: 0; margin: 0 0 .6rem; }

.panel, .table-wrap {
    border: 1px solid var(--line);
    background: var(--surface);
    border-radius: var(--radius);
}
.notice { border: 1px solid; border-radius: .55rem; padding: .75rem .92rem; font-size: .95rem; }
.notice-error { color: #7a2825; border-color: #efc6c1; background: #fcf0ee; }
.notice-warm { color: #624414; border-color: #efdeaf; background: var(--warm); }
.notice-success { color: #235131; border-color: #cde5d1; background: #eef7ee; }
.hero .notice { margin-top: 1rem; }

.quiz-shell { width: min(100% - 3.5rem, 48rem); padding-block: clamp(1.65rem, 4vw, 3.5rem); }
.quiz-progress { margin: 0 0 1.1rem; }
.progress-label { display: flex; justify-content: space-between; gap: .75rem; color: var(--muted); margin: 0 0 .55rem; font-size: .94rem; }
.progress-label strong { color: var(--text); }
progress { display: block; width: 100%; height: .46rem; border: 0; border-radius: 1rem; background: #e9e3d6; color: #d6870d; overflow: hidden; }
progress::-webkit-progress-bar { background: #e9e3d6; }
progress::-webkit-progress-value { background: #d6870d; border-radius: 1rem; }
progress::-moz-progress-bar { background: #d6870d; border-radius: 1rem; }
.quiz-panel { padding: clamp(1.3rem, 4vw, 2.65rem); box-shadow: 0 8px 26px #5434160c; }
.question-title { font-size: clamp(2.25rem, 5vw, 3.35rem); line-height: .99; margin: .52rem 0 1.6rem; }
.quiz-panel .notice { margin-block: 0 1rem; }
.lesson-image, .image-preview { border: 1px solid var(--line); border-radius: .6rem; background: var(--paper); object-fit: contain; }
.lesson-image { max-height: min(39vh, 23rem); margin: 0 auto 1.35rem; }
.choices { display: grid; gap: .65rem; }
.choice {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: .83rem;
    padding: .7rem .88rem;
    min-height: 3.65rem;
    border: 1px solid var(--line-strong);
    border-radius: .55rem;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 590;
}
.choice:hover { border-color: #ad8444; background: #fffcf5; }
.choice:has(input:checked) { border-color: #bb7611; background: var(--warm); }
.choice:focus-within { outline: 3px solid #146194; outline-offset: 2px; }
.choice input {
    grid-column: 3;
    grid-row: 1;
    width: 1.18rem;
    height: 1.18rem;
    padding: 0;
    accent-color: #986214;
    cursor: pointer;
}
.choice input:focus-visible { outline: 0; }
.choice-key {
    grid-row: 1;
    grid-column: 1;
    display: grid;
    width: 1.95rem;
    height: 1.95rem;
    border-radius: .34rem;
    place-items: center;
    font-size: .87rem;
    font-weight: 800;
    background: #f2eee5;
    color: #584a34;
}
.choice > span:last-child { grid-column: 2; grid-row: 1; overflow-wrap: anywhere; }
.choice:has(input:checked) .choice-key { background: var(--yellow); color: #3a270a; }
.quiz-actions, .actions { display: flex; flex-wrap: wrap; gap: .65rem; align-items: center; }
.quiz-actions { justify-content: space-between; margin-top: 1.45rem; }
.quiz-actions .button-primary { margin-left: auto; min-width: 8rem; }
.small-link { display: inline-block; margin: .9rem 0 0; font-size: .88rem; }

.result-banner {
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    align-items: center;
    padding: clamp(1.25rem, 4vw, 2.35rem);
    border-radius: var(--radius);
    background: var(--dark);
    color: #fff;
}
.result-banner .eyebrow { color: var(--yellow); margin-bottom: .35rem; }
.result-banner p:last-child { margin-top: .57rem; color: #ded6c9; overflow-wrap: anywhere; }
.score { flex: 0 0 auto; color: #fff6d8; white-space: nowrap; }
.score strong { color: var(--yellow); font: 800 clamp(3rem, 7vw, 4.7rem)/.87 var(--headline); }
.score span { font-size: 1rem; font-weight: 700; }
.report-section { display: grid; gap: .6rem; margin-top: 1.65rem; }
.report-section h2 { margin-bottom: .35rem; }
.review { background: var(--surface); border: 1px solid var(--line); border-radius: .58rem; }
.review summary { list-style: none; display: grid; grid-template-columns: 1.5rem 1fr auto .7rem; gap: .52rem; align-items: center; padding: .85rem .92rem; cursor: pointer; font-weight: 650; }
.review summary::-webkit-details-marker { display: none; }
.review summary::after { content: "+"; color: #6a6153; margin-left: .1rem; }
.review[open] summary::after { content: "−"; }
.review-number { color: #6a6153; font-weight: 700; }
.review-body { display: grid; gap: .4rem; padding: 0 1rem 1rem 2.95rem; color: var(--muted); }
.review-body strong { color: var(--text); margin-right: .35rem; }
.new-round { margin-top: 1.2rem; }

.message-page { padding-block: clamp(2rem, 7vw, 5rem); display: grid; gap: 1rem; justify-items: start; }
.login-shell { width: min(100% - 3.5rem, 29rem); padding-block: clamp(2rem, 7vw, 5.25rem); }
.login-panel { padding: clamp(1.3rem, 4vw, 2.15rem); display: grid; gap: .65rem; }
.login-panel form { margin-top: .75rem; }
.stack { display: grid; gap: .95rem; }
.stack label:not(.inline-field) > :is(input, select, textarea) { margin-top: .36rem; }
.admin-shell { padding-block: 1.25rem 3.75rem; }
.admin-navigation {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .7rem;
    border-bottom: 1px solid var(--line-strong);
    margin-bottom: 1.8rem;
}
.tabs { display: flex; gap: .25rem 1.5rem; flex-wrap: wrap; }
.tabs a { padding: .74rem 0; color: var(--muted); font-weight: 700; text-decoration: none; border-bottom: 3px solid transparent; }
.tabs a:hover, .tabs a[aria-current] { color: var(--text); }
.tabs a[aria-current] { border-color: #cc8515; }
.admin-navigation button { margin: .25rem 0; min-height: 2.45rem; padding: .43rem .65rem; font-size: .875rem; }
.section-title { display: flex; gap: .65rem; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: 1rem; }
.admin-shell > .notice, .page-description, .admin-shell > p { margin-bottom: .9rem; }
.page-description { color: var(--muted); }
.metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .85rem; margin: 0 0 1rem; }
.metric { display: grid; gap: .25rem; padding: 1rem 1.2rem; color: var(--muted); }
.metric strong { color: var(--text); font: 800 2.75rem/.94 var(--headline); }
.empty { padding: 1.35rem; color: var(--muted); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th, td { padding: .78rem 1rem; vertical-align: middle; border-bottom: 1px solid var(--line); }
th { background: #f0ede5; color: #50493e; font-size: .86rem; font-weight: 750; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
td { font-size: .92rem; }
.table-actions { display: flex; gap: .8rem; font-weight: 650; }
.danger-link { color: var(--red); }
.status { display: inline-block; width: fit-content; padding: .15rem .5rem; border-radius: .34rem; font-size: .82rem; font-weight: 750; white-space: nowrap; }
.status-up { color: var(--green); background: #e8f2e7; }
.status-idle { color: #605a50; background: #eeeae2; }
.status-down { color: #8a312c; background: #f8ecea; }
.pagination { justify-content: center; margin-top: 1rem; }
.editor { width: min(100%, 48rem); }
form.editor, section.panel.editor { padding: clamp(1rem, 4vw, 1.8rem); }
.editor .actions { margin-top: .25rem; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .85rem; }
.inline-field { display: flex; align-items: center; gap: .6rem; width: fit-content; cursor: pointer; }
.inline-field input { width: 1.2rem; height: 1.2rem; padding: 0; accent-color: #996113; }
.image-editor { padding-top: .6rem; border-top: 1px solid var(--line); }
.image-preview { max-height: 10.5rem; }
.setup-shell > section > h1 { margin: .38rem 0 1rem; }
.setup-shell > section > .notice { margin-bottom: .75rem; }
.setup-shell fieldset + fieldset { border-top: 1px solid var(--line); padding-top: .4rem; }

@media (max-width: 60rem) {
    .hero-content { padding: 2.1rem; }
    .start-controls { flex-wrap: wrap; }
    .start-controls .button { flex: 1 0 auto; }
}
@media (max-width: 53rem) {
    .wrap, .quiz-shell, .login-shell { width: min(100% - 2rem, 48rem); }
    .login-shell { max-width: 29rem; }
    .header-inner { min-height: 4.05rem; }
    .hero { grid-template-columns: 1fr; min-height: 0; }
    .hero-content { padding: clamp(1.25rem, 6vw, 2.15rem); }
    .hero h1 { font-size: clamp(4.35rem, 13vw, 6.5rem); }
    .hero-media { min-height: clamp(12rem, 50vw, 20rem); }
    .hero-media img { object-position: center 42%; }
    .hero-description { max-width: 24rem; }
}
@media (max-width: 27rem) {
    .wrap, .quiz-shell, .login-shell { width: calc(100% - 1.5rem); }
    .header-link { padding-inline: .62rem; }
    .start-controls { display: grid; }
    .hero h1 { font-size: clamp(3.2rem, 14vw, 4.35rem); }
    .field-grid { grid-template-columns: 1fr; }
    .tabs { gap: .05rem .75rem; }
    .tabs a { font-size: .88rem; }
    .admin-navigation { gap: .4rem; }
    .metrics { gap: .5rem; }
    .metric { padding: .7rem; font-size: .89rem; }
    .review summary { grid-template-columns: 1.15rem 1fr auto .5rem; padding-inline: .54rem; gap: .4rem; }
    .review-body { padding-left: 2.08rem; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; }
}

:root { --signal: #b52829; --signal-hover: #931b1e; }
.site-header { border-top: 4px solid var(--signal); }
.brand-number {
    margin-left: .35rem;
    padding: .19rem .48rem .25rem;
    color: #fff;
    background: var(--signal);
    border-radius: .28rem;
    font: 800 1.35rem/.9 var(--headline);
    letter-spacing: .025em;
}
.button-primary { color: #fff; background: var(--signal); border-color: var(--signal); }
.button-primary:hover { background: var(--signal-hover); border-color: var(--signal-hover); }
.progress-label { align-items: center; min-height: 1.8rem; }
.time-chip {
    border: 1px solid #e8bbb5;
    background: #faede9;
    color: #7d2729;
    border-radius: .4rem;
    padding: .25rem .55rem;
    font-weight: 750;
    font-variant-numeric: tabular-nums;
}
.answer-instructions { color: var(--muted); font-weight: 650; }
.save-status { flex: 1 1 7rem; }
.quiz-actions .button-primary { flex: 0 0 auto; }
.choice:has(input:disabled) { cursor: default; }
.correct-editor { display: flex; flex-wrap: wrap; gap: .55rem 1.2rem; }
.topic-metrics, .breakdown { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.breakdown { display: grid; gap: .55rem; margin-top: 1.05rem; }
.breakdown .metric { padding: .7rem .85rem; }
.breakdown b { color: var(--text); font-size: .9rem; }
.review-choices { margin: .2rem 0 0; padding-inline-start: 1.2rem; }
.review-body .lesson-image { margin-inline: 0; }
.table-wrap table { min-width: 32rem; }
@media (max-width: 41rem) {
    .topic-metrics, .breakdown { grid-template-columns: 1fr; }
    .topic-metrics .metric, .breakdown .metric { grid-template-columns: 1fr auto; align-items: center; }
    .admin-navigation { flex-wrap: wrap; }
    .tabs { gap: .1rem .85rem; }
}
@media (max-width: 22rem) {
    .brand-number { margin-left: 0; padding-inline: .33rem; }
    .brand { gap: .42rem; }
    .quiz-actions .save-status { flex: 1 0 100%; }
}

.review summary > span:nth-child(2) { min-width: 0; overflow-wrap: anywhere; }

.pool-filters {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin-bottom: .85rem;
}
.pool-filters [aria-current] {
    border-color: var(--text);
    color: #fff;
    background: var(--text);
}
.pool-list {
    display: grid;
    gap: .5rem;
    margin: 0;
    padding: 0;
    list-style: none;
}
.pool-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: .75rem 1rem;
    padding: .8rem 1rem;
    border-radius: .65rem;
    scroll-margin: 1rem;
}
.pool-row:target { outline: 2px solid #ad7940; }
.pool-question { min-width: 0; overflow-wrap: anywhere; }
.pool-question span {
    display: block;
    margin-top: .16rem;
    color: var(--muted);
    font-size: .875rem;
}
.pool-state {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .45rem .65rem;
}
.pool-button { min-width: 7.15rem; min-height: 2.8rem; padding: .42rem .7rem; }
@media (max-width: 55rem) {
    .pool-row { grid-template-columns: minmax(0, 1fr) auto; }
    .pool-row .table-actions { grid-column: 1 / -1; }
}
@media (max-width: 36rem) {
    .pool-row { grid-template-columns: minmax(0, 1fr); gap: .65rem; }
    .pool-state { justify-content: space-between; }
}

.archived-round { margin-bottom: .9rem; }
.archive-section + .archive-section { margin-top: 1.65rem; }
.archive-section h2 { margin-bottom: .72rem; }
.archive-list { margin: 0; padding: 0; display: grid; gap: .55rem; list-style: none; }
.archive-item { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .55rem 1rem; padding: .8rem 1rem; }
.archive-link { font-weight: 750; }
.result-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .65rem; margin-bottom: 1rem; }
.result-action { min-height: 2.75rem; padding: .42rem .68rem; white-space: nowrap; }
.result-name { overflow-wrap: anywhere; }
@media (max-width: 40rem) {
    .result-table table { min-width: 0; }
    .result-table th, .result-table td { padding-inline: .5rem; }
    .result-table .result-date { display: none; }
    .result-table .result-action { white-space: normal; font-size: .875rem; }
    .result-table .status { white-space: normal; }
}
