:root {
    --green: #ccff00;
    --black: #000000;
    --blue: #004659;
    --blue-10: #e5ecee;
    --gray-10: #e6e6e6;
    --white: #ffffff;
    --muted: #333333;
    --font: "Source Sans 3", "Source Sans Pro", Arial, sans-serif;
    --max: 1180px;
}

*, *::before, *::after { box-sizing: border-box; }

[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    background: var(--white);
    color: var(--black);
    font-family: var(--font);
    font-size: 1.05rem;
    line-height: 1.5;
}

img { max-width: 100%; display: block; }

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

:focus-visible { outline: 3px solid var(--black); outline-offset: 2px; }

.skip {
    position: absolute;
    left: 0.75rem;
    top: -4rem;
    background: var(--green);
    color: var(--black);
    padding: 0.5rem 0.8rem;
    z-index: 20;
}

.skip:focus { top: 0.75rem; }

.site-header {
    --pad: 0.7rem;
    --logo-h: 68px;
    position: relative;
    background: var(--white);
}

.site-header::before {
    content: "";
    position: absolute;
    z-index: 1;
    left: 0;
    right: 0;
    top: calc(var(--pad) + var(--logo-h) * 0.66591493);
    height: calc(var(--logo-h) * 0.05557345);
    background: #c9da43;
    pointer-events: none;
}

.site-nav {
    max-width: var(--max);
    margin: 0 auto;
    position: relative;
    z-index: 2;
    padding: var(--pad) 1.25rem 0.8rem;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: start;
    column-gap: 1.15rem;
}

.brand {
    color: inherit;
    text-decoration: none;
    display: block;
}

.brand img {
    height: var(--logo-h);
    width: auto;
    max-width: none;
    position: relative;
    z-index: 2;
}

.dept {
    display: flex;
    align-items: flex-end;
    min-width: 0;
    margin: 0;
    height: calc(var(--logo-h) * 0.66591493);
    padding-bottom: 0.18rem;
}

.dept-name {
    color: var(--blue);
    font-weight: 400;
    font-size: 1.05rem;
    line-height: 1;
}

.dept-sub {
    color: var(--black);
    font-weight: 600;
    font-size: 0.78rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    line-height: 1.25;
}

.nav-links {
    display: flex;
    align-items: stretch;
    align-self: start;
    height: calc(var(--logo-h) * 0.5);
    margin-top: calc(var(--logo-h) * 0.07);
    border: 2px solid var(--black);
}

.nav-links a,
.nav-links button {
    display: flex;
    align-items: center;
    background: var(--white);
    border: none;
    border-left: 2px solid var(--black);
    padding: 0 0.95rem;
    text-decoration: none;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    font-size: 0.84rem;
    line-height: 1;
    cursor: pointer;
}

.nav-links > :first-child { border-left: none; }

.nav-links a:hover,
.nav-links button:hover { background: var(--blue-10); }

.nav-links [aria-current="page"],
.nav-links [aria-current="page"]:hover { background: var(--green); }

.wrap {
    max-width: var(--max);
    margin: 0 auto;
    padding: 1.75rem 1.25rem 3rem;
}

.eyebrow {
    margin: 0 0 0.4rem;
    color: var(--blue);
    font-weight: 700;
    font-size: 0.82rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

h1 {
    margin: 0;
    font-size: clamp(2.3rem, 6vw, 3.6rem);
    line-height: 1.05;
    font-weight: 700;
    letter-spacing: -0.03em;
}

h1::after {
    content: "";
    display: block;
    width: 4.5rem;
    height: 8px;
    margin-top: 0.8rem;
    background: var(--green);
}

h2 { margin: 0 0 0.6rem; font-size: 1.45rem; line-height: 1.2; }

.lead { max-width: 42rem; font-size: 1.15rem; }

.flash {
    background: var(--blue-10);
    border: 2px solid var(--blue);
    padding: 0.75rem 0.9rem;
    margin-bottom: 1rem;
}

.modes {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.55rem;
    margin: 1.25rem 0 1rem;
}

.mode {
    text-align: left;
    background: var(--white);
    border: 2px solid var(--black);
    padding: 0.85rem 1rem;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.15s ease;
}

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

.mode strong { display: block; }

.mode span { display: block; margin-top: 0.2rem; color: var(--muted); }

.mode[aria-pressed="true"] { background: var(--green); }

.mode[aria-pressed="true"] span { color: var(--black); }

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

.launch {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.8rem 1rem;
    margin-top: 0.4rem;
}

.seg { display: inline-flex; border: 2px solid var(--black); }

.seg button {
    background: var(--white);
    border: none;
    border-right: 2px solid var(--black);
    padding: 0.55rem 0.85rem;
    cursor: pointer;
}

.seg button:last-child { border-right: none; }

.seg button[aria-pressed="true"] { background: var(--green); font-weight: 700; }

.btn, .btn-dark, .btn-ghost {
    border: 2px solid var(--black);
    padding: 0.65rem 1rem;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
}

.btn { background: var(--green); color: var(--black); }

.btn-dark { background: var(--black); color: var(--white); }

.btn-ghost { background: var(--white); color: var(--black); }

.btn:hover, .btn-dark:hover, .btn-ghost:hover {
    background: var(--blue);
    border-color: var(--blue);
    color: var(--white);
}

.pool { margin: 0; color: var(--muted); }

details { margin-top: 1.4rem; max-width: 42rem; }

summary { cursor: pointer; font-weight: 700; }

.play-top, .result-actions, .row-actions, .form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    align-items: center;
}

.play-top { justify-content: space-between; margin-bottom: 0.8rem; }

.progress {
    height: 8px;
    background: var(--gray-10);
    margin-bottom: 0.8rem;
}

.progress div { height: 100%; width: 0; background: var(--blue); }

.timer {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    margin-bottom: 0.7rem;
}

.timer-track { flex: 1; height: 8px; background: var(--gray-10); }

.timer-track div { height: 100%; width: 100%; background: var(--blue); }

.timer-track div.urgent { background: #e57050; }

.shot {
    display: block;
    width: 100%;
    padding: 0;
    border: 2px solid var(--black);
    background: var(--blue-10);
    cursor: zoom-in;
}

.shot img, .result-row img, #light-img {
    width: 100%;
    max-height: 62vh;
    object-fit: contain;
    background: var(--blue-10);
}

.hint { color: var(--blue); margin-top: 0.2rem; }

.options { display: grid; gap: 0.5rem; margin-top: 0.8rem; }

.option {
    display: flex;
    gap: 0.7rem;
    align-items: baseline;
    text-align: left;
    background: var(--white);
    border: 2px solid var(--black);
    padding: 0.75rem 0.85rem;
    cursor: pointer;
}

.option .key {
    font-weight: 700;
    color: var(--blue);
    min-width: 1.1rem;
}

.option[aria-pressed="true"] { background: var(--green); }

.option.is-correct { background: var(--green); }

.option.is-wrong { background: var(--blue-10); }

.option:disabled { cursor: default; }

.answer-form { margin-top: 0.9rem; display: grid; gap: 0.55rem; }

input[type="text"], input[type="password"], select, textarea {
    width: 100%;
    border: 2px solid var(--black);
    background: var(--white);
    padding: 0.7rem 0.75rem;
}

textarea { min-height: 5.5rem; resize: vertical; }

.feedback {
    margin-top: 1rem;
    border: 2px solid var(--black);
    padding: 0.9rem 1rem;
}

.feedback.good { background: var(--green); }

.feedback.partial { background: var(--blue-10); }

.feedback.bad { background: var(--white); }

.feedback .kicker {
    margin: 0;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    font-size: 0.82rem;
}

.feedback .latin { font-size: 1.45rem; margin: 0.25rem 0; }

.feedback p { margin: 0.3rem 0; }

.score {
    font-size: clamp(2.4rem, 7vw, 4rem);
    font-weight: 700;
    letter-spacing: -0.04em;
    line-height: 1;
    margin: 0.3rem 0;
}

.result-list { display: grid; gap: 0.8rem; margin-top: 1.2rem; }

.result-row {
    display: grid;
    grid-template-columns: 104px 1fr;
    gap: 0.8rem;
    border-top: 1px solid var(--gray-10);
    padding-top: 0.8rem;
}

.result-row img { width: 104px; height: 78px; object-fit: cover; border: 1px solid var(--black); max-height: none; }

.tag {
    display: inline-block;
    padding: 0.05rem 0.4rem;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border: 1px solid var(--black);
}

.tag.good { background: var(--green); }

.tag.partial { background: var(--blue-10); }

.table-wrap { overflow-x: auto; border-top: 2px solid var(--black); }

table { width: 100%; border-collapse: collapse; min-width: 920px; }

th, td {
    text-align: left;
    vertical-align: top;
    padding: 0.55rem 0.45rem;
    border-bottom: 1px solid var(--gray-10);
}

thead th {
    font-size: 0.78rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--blue);
}

tr.group th {
    background: var(--black);
    color: var(--green);
    font-size: 1.05rem;
    letter-spacing: 0;
    text-transform: none;
    padding: 0.55rem 0.6rem;
}

.filters { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.8rem 0 1rem; }

.filters button[aria-pressed="true"] { background: var(--green); color: var(--black); border-color: var(--black); }

.examples { display: grid; gap: 1.2rem; margin-top: 1.4rem; }

.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 0.7rem; }

.thumbs button {
    padding: 0;
    border: 2px solid var(--black);
    background: var(--blue-10);
    cursor: zoom-in;
    text-align: left;
}

.thumbs img { width: 100%; height: 140px; object-fit: cover; }

.thumbs figcaption { padding: 0.4rem 0.5rem 0.55rem; font-size: 0.95rem; }

.footnote { color: var(--muted); font-size: 0.95rem; max-width: 46rem; }

.site-footer {
    border-top: 1px solid var(--black);
    padding: 1.2rem 1.25rem 2rem;
}

.site-footer .wrap { padding: 0; }

.site-footer p { margin: 0.3rem 0; color: var(--muted); font-size: 0.95rem; }

.site-footer a { color: var(--blue); }

.legal { max-width: 46rem; }
.legal h2 { margin: 1.6rem 0 0.4rem; font-size: 1.35rem; }
.legal p { max-width: 40rem; }
.legal code { font-family: Consolas, "Courier New", monospace; font-size: 0.95em; }

dialog {
    border: 2px solid var(--black);
    padding: 0;
    max-width: min(96vw, 1100px);
    width: 100%;
}

dialog::backdrop { background: rgba(0, 0, 0, 0.72); }

#light-close {
    position: absolute;
    top: 0.4rem;
    right: 0.4rem;
    background: var(--green);
    border: 2px solid var(--black);
    font-weight: 700;
    padding: 0.35rem 0.6rem;
    cursor: pointer;
}

#light-caption { margin: 0; padding: 0.7rem 0.9rem 0.9rem; }

.login-card, #editor-form, #password-form {
    border: 2px solid var(--black);
    padding: 1rem;
    display: grid;
    gap: 0.55rem;
}

.login-card { max-width: 28rem; }

.login-card h1 { font-size: 2.2rem; }

.admin-grid { display: grid; gap: 1.4rem; }

.editor { display: grid; gap: 0.8rem; align-content: start; }

.editor label { font-weight: 700; }

.check { display: flex; gap: 0.5rem; align-items: center; font-weight: 700; }

.also-box { margin: 0.8rem 0; padding: 0.7rem 0.8rem 0.85rem; border: 2px solid var(--black); }
.also-box legend { font-weight: 700; padding: 0 0.3rem; }
.also-list { display: flex; flex-direction: column; gap: 0.35rem; }
.also-list label { display: flex; gap: 0.45rem; align-items: flex-start; font-weight: 400; }

.cloud-row {
    display: grid;
    grid-template-columns: 112px 1fr;
    gap: 0.75rem;
    padding: 0.85rem 0;
    border-bottom: 1px solid var(--gray-10);
}

.cloud-row img {
    width: 112px;
    height: 84px;
    object-fit: cover;
    border: 1px solid var(--black);
}

.review { color: var(--blue); margin: 0.3rem 0; }

.file-name { color: var(--muted); font-size: 0.85rem; }

@media (min-width: 720px) {
    .modes { grid-template-columns: 1fr 1fr; }
    .options { grid-template-columns: 1fr 1fr; }
}

@media (min-width: 900px) {
    .admin-grid { grid-template-columns: 320px 1fr; align-items: start; }
    .editor { position: sticky; top: 0.8rem; }
    .cloud-row { grid-template-columns: 120px 1fr auto; }
}

.stage {
    position: relative;
    height: clamp(440px, 72vh, 760px);
    margin: 0 0 1.4rem;
    background: var(--blue-10);
    border: 2px solid var(--black);
    overflow: hidden;
}

.stage-zoom {
    position: absolute;
    inset: 0;
    transform-origin: center center;
}

.stage-photo {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    object-fit: cover;
    opacity: 0;
    z-index: 0;
}

.stage-photo.is-in {
    opacity: 1;
    z-index: 1;
}

.stage-progress {
    position: absolute;
    z-index: 3;
    bottom: 0;
    left: 0;
    height: 6px;
    width: 0;
    background: var(--green);
}

.stage-progress.is-run { animation: stage-run 11.2s linear forwards; }

.stage-copy {
    position: absolute;
    z-index: 2;
    left: 1rem;
    bottom: 6.2rem;
    max-width: min(28rem, calc(100% - 2rem));
    background: var(--white);
    border: 2px solid var(--black);
    padding: 0.95rem 1.05rem 1.1rem;
}

.stage-copy .lead { margin: 0.55rem 0 0; font-size: 1.05rem; }

.film {
    position: absolute;
    z-index: 2;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    gap: 0.45rem;
    padding: 0.7rem;
    overflow-x: auto;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.62));
}

.film button {
    flex: 0 0 92px;
    height: 64px;
    padding: 0;
    border: 2px solid #fff;
    background: transparent;
    opacity: 0.72;
    cursor: pointer;
}

.film button[aria-current="true"] {
    opacity: 1;
    border-color: var(--green);
}

.film img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.film::-webkit-scrollbar { height: 8px; }
.film::-webkit-scrollbar-thumb { background: #fff; }

@keyframes stage-run { from { width: 0; } to { width: 100%; } }

@media (max-width: 720px) {
    .site-header { --logo-h: 52px; }
    .site-nav {
        grid-template-columns: 1fr;
        row-gap: 0.45rem;
    }
    .dept { height: auto; margin-top: 0; }
    .dept-name { font-size: 0.95rem; }
    .nav-links {
        justify-self: start;
        height: auto;
        margin-top: 0;
    }
    .nav-links a,
    .nav-links button { padding: 0.45rem 0.7rem; font-size: 0.78rem; }
    .stage { height: auto; min-height: 0; }
    .stage-zoom {
        position: relative;
        height: 62vw;
        min-height: 220px;
    }
    .stage-copy {
        position: static;
        max-width: none;
        border-width: 0 0 2px;
    }
    .stage-copy h1 { font-size: 2rem; }
    .film { position: relative; background: var(--blue-10); }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .mode:hover { transform: none; }
    .stage-progress { display: none; }
}
