@font-face { font-family: "DM Sans"; font-weight: 400; font-style: normal; font-display: swap; src: url(fonts/dmsans-400.ttf) format("truetype"); }
@font-face { font-family: "DM Sans"; font-weight: 400; font-style: italic; font-display: swap; src: url(fonts/dmsans-400-italic.ttf) format("truetype"); }
@font-face { font-family: "DM Sans"; font-weight: 500; font-style: normal; font-display: swap; src: url(fonts/dmsans-500.ttf) format("truetype"); }
@font-face { font-family: "DM Sans"; font-weight: 600; font-style: normal; font-display: swap; src: url(fonts/dmsans-600.ttf) format("truetype"); }
@font-face { font-family: "DM Sans"; font-weight: 700; font-style: normal; font-display: swap; src: url(fonts/dmsans-700.ttf) format("truetype"); }
@font-face { font-family: "DM Serif Text"; font-weight: 400; font-style: normal; font-display: swap; src: url(fonts/dmseriftext-400.ttf) format("truetype"); }
@font-face { font-family: "DM Serif Text"; font-weight: 400; font-style: italic; font-display: swap; src: url(fonts/dmseriftext-400-italic.ttf) format("truetype"); }

/* light theme (default); the dark theme below only swaps the variables */
:root {
    color-scheme: light;
    --lw-red: #e81c1e;
    --lw-red-light: #ff2300;
    --lw-red-dark: #b80523;
    --lw-gradient: linear-gradient(120deg, var(--lw-red-light) 0%, var(--lw-red) 45%, var(--lw-red-dark) 100%);
    --accent: var(--lw-red);
    --accent-hover: var(--lw-red-dark);
    --ink: #111827;
    --ink-2: #374151;
    --ink-muted: #6b7280;
    --page: #f6f6f7;
    --surface: #ffffff;
    --surface-2: #f6f6f7;
    --surface-hover: #fafafb;
    --line: #e5e7eb;
    --field-line: #d1d5db;
    --code-inline: #f1f1f3;
    --fill: var(--lw-red);
    --other: #6b7280;
    --good: #0f7a3d;
    --bad: #b80523;
    --info-bg: #eef4ff; --info-ink: #1e3a8a; --info-line: #bcd0fb;
    --error-bg: #fdecec; --error-ink: #7f1d1d; --error-line: #f4b9bd;
    --ok-bg: #ecf8f0; --ok-ink: #14532d; --ok-line: #b6e2c4;
    --warn-bg: #fff7e6; --warn-ink: #8a5a00; --warn-line: #f5d49a;
    --ice-1: #e0f2fe; --ice-2: #bae6fd; --ice-ink: #0c4a6e; --ice-fill: #38bdf8;
    --ice-gradient: linear-gradient(120deg, #7dd3fc 0%, #3b82f6 55%, #1e3a8a 100%);
    --radius: 14px;
    --shadow: 0 1px 2px rgba(17, 24, 39, .04), 0 8px 24px rgba(17, 24, 39, .06);
    --sans: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
    --serif: "DM Serif Text", Georgia, serif;
    --page-width: min(100%, 1720px);
    --gutter: clamp(.8rem, 2.5vw, 2.5rem);
}
:root[data-theme="dark"] {
    color-scheme: dark;
    --accent: #ff4d4f;
    --accent-hover: #ff7a7b;
    --ink: #e5e7eb;
    --ink-2: #cbd5e1;
    --ink-muted: #94a3b8;
    --page: #0b1020;
    --surface: #131a2b;
    --surface-2: #1b2438;
    --surface-hover: #182136;
    --line: #26314a;
    --field-line: #34405c;
    --code-inline: #1f2a40;
    --fill: #ff4d4f;
    --other: #a5b4c8;
    --good: #4ade80;
    --bad: #f87171;
    --info-bg: #13233f; --info-ink: #bfdbfe; --info-line: #1e3a8a;
    --error-bg: #3a1418; --error-ink: #fecaca; --error-line: #7f1d1d;
    --ok-bg: #0f2a1c; --ok-ink: #bbf7d0; --ok-line: #14532d;
    --warn-bg: #33250a; --warn-ink: #fde68a; --warn-line: #854d0e;
    --ice-1: #0e2a40; --ice-2: #12405f; --ice-ink: #bae6fd; --ice-fill: #38bdf8;
    --ice-gradient: linear-gradient(120deg, #0369a1 0%, #1d4ed8 55%, #172554 100%);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--sans); color: var(--ink); background: var(--page); line-height: 1.55; font-size: 16px; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }
h1, h2, h3 { font-family: var(--serif); font-weight: 400; line-height: 1.15; margin: 0 0 .5em; color: var(--ink); }
h1 { font-size: clamp(2rem, 4vw, 3rem); }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.25rem; }
h1 em, h2 em, h3 em { font-style: italic; }
code, pre { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .88em; }
pre { background: #0f172a; color: #e5e7eb; padding: 1rem 1.2rem; border-radius: 10px; overflow-x: auto; line-height: 1.45; border: 1px solid var(--line); }
p code, li code, td code { background: var(--code-inline); padding: .1em .35em; border-radius: 5px; }
.eyebrow { font-size: .8rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); margin: 0 0 .6rem; }
.eyebrow::before { content: "— "; }
.muted { color: var(--ink-muted); }
.small { font-size: .875rem; }

/* header */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.site-header::after { content: ""; display: block; height: 3px; background: var(--lw-gradient); }
.bar { width: var(--page-width); margin: 0 auto; padding: .8rem var(--gutter); display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: .9rem; color: var(--ink); }
.brand:hover { text-decoration: none; color: var(--ink); }
.brand img { height: 26px; width: auto; display: block; }
.brand span { font-family: var(--serif); font-size: 1.1rem; border-left: 1px solid var(--line); padding-left: .9rem; }
nav.main { display: flex; gap: 1.2rem; margin-left: auto; align-items: center; flex-wrap: wrap; }
nav.main a { color: var(--ink-2); font-weight: 500; font-size: .95rem; }
nav.main a.active, nav.main a:hover { color: var(--accent); text-decoration: none; }
nav.main form { margin: 0; }
.clock { display: flex; align-items: center; gap: .5rem; font-size: .9rem; font-weight: 600; color: var(--ink); background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: .3rem .85rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.clock .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.clock.ended .dot, .clock.upcoming .dot { background: var(--ink-muted); }
.clock.frozen { background: var(--ice-1); border-color: var(--ice-2); color: var(--ice-ink); }
.clock.frozen .dot { width: 14px; height: 14px; border-radius: 0; background: url(snowflake-blue.svg) center / contain no-repeat; }
.theme-toggle { margin: 0; padding: .35rem; width: 2.1rem; height: 2.1rem; justify-content: center; border-radius: 50%; background: var(--surface-2); color: var(--ink); border: 1px solid var(--line); font-size: 1rem; line-height: 1; }
.theme-toggle:hover { color: var(--accent); filter: none; }

/* layout: the content follows the width of the screen, up to a comfortable maximum */
main { width: var(--page-width); margin: 0 auto; padding: 2rem var(--gutter) 4rem; }
.hero { background: var(--lw-gradient); color: #fff; border-radius: var(--radius); padding: 2.4rem 2.4rem 2.2rem; margin-bottom: 1.8rem; position: relative; overflow: hidden; }
.hero h1, .hero h2 { color: #fff; }
.hero .eyebrow { color: rgba(255, 255, 255, .9); }
.hero p { color: rgba(255, 255, 255, .92); max-width: 52rem; margin: 0; }
.hero .countdown { font-size: clamp(2rem, 5vw, 3.2rem); font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.01em; margin-top: 1rem; }
.hero .countdown small { display: block; font-size: .9rem; font-weight: 500; opacity: .9; letter-spacing: 0; }
.grid { display: grid; gap: 1.2rem; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); }
.grid.tiles { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.5rem 1.6rem; margin-bottom: 1.2rem; border: 1px solid var(--line); }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.card.narrow { max-width: 460px; margin: 2rem auto; }

/* figures */
.hero-figure { font-size: clamp(3rem, 7vw, 4.5rem); font-weight: 600; line-height: 1; letter-spacing: -.02em; }
.tile .hero-figure { font-size: clamp(2.4rem, 4vw, 3.4rem); white-space: nowrap; }
.tile .label { color: var(--ink-muted); font-size: .9rem; font-weight: 500; }
.tile .value { font-size: 2rem; font-weight: 600; line-height: 1.2; margin-top: .2rem; }
.tile .sub { font-size: .85rem; color: var(--ink-muted); }
.delta { font-weight: 600; font-size: .9rem; white-space: nowrap; }
.delta.up { color: var(--good); }
.delta.down { color: var(--bad); }
.delta.same { color: var(--ink-muted); }

/* per-task bars: one row per task, value at the tip */
.bars { width: 100%; border-collapse: collapse; }
.bars th, .bars td { padding: .55rem .5rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.bars th { font-weight: 500; color: var(--ink-muted); font-size: .85rem; }
.bars td.num, .bars th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bars tr:last-child td { border-bottom: 0; }
.bars .task { font-weight: 500; white-space: nowrap; }
.bars .plot { width: 50%; min-width: 140px; }
.track { position: relative; height: 18px; background: var(--surface-2); border-radius: 0 4px 4px 0; }
.fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--fill); border-radius: 0 4px 4px 0; transition: width .4s ease, background .4s ease; }
.marker { position: absolute; top: -4px; bottom: -4px; width: 3px; margin-left: -1.5px; background: var(--other); border-radius: 2px; box-shadow: 0 0 0 2px var(--surface); }
.legend { display: flex; gap: 1.2rem; font-size: .85rem; color: var(--ink-2); margin: .2rem 0 .8rem; flex-wrap: wrap; }
.legend .key { display: inline-block; width: 14px; height: 10px; border-radius: 0 3px 3px 0; background: var(--fill); margin-right: .4rem; vertical-align: middle; }
.legend .key.other { width: 3px; height: 14px; border-radius: 2px; background: var(--other); }
.perfect { display: inline-block; font-size: .7rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--good); border: 1px solid currentColor; border-radius: 999px; padding: 0 .45rem; margin-left: .4rem; vertical-align: middle; }
.tick { color: var(--good); font-weight: 700; }
.ranking .task { font-weight: 600; }

/* tables */
table.data { width: 100%; border-collapse: collapse; font-size: .93rem; }
table.data th, table.data td { padding: .55rem .6rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.data th { font-weight: 600; color: var(--ink-muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data td.nowrap { white-space: nowrap; }
table.data tr:hover td { background: var(--surface-hover); }
.scroll { overflow-x: auto; }
.rank { font-family: var(--serif); font-size: 1.2rem; color: var(--accent); }

/* badges */
.badge { display: inline-block; font-size: .75rem; font-weight: 600; padding: .1rem .55rem; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); white-space: nowrap; }
.badge.queued { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn-ink); }
.badge.running { background: var(--info-bg); border-color: var(--info-line); color: var(--info-ink); }
.badge.evaluated, .badge.done { background: var(--ok-bg); border-color: var(--ok-line); color: var(--good); }
.badge.failed { background: var(--error-bg); border-color: var(--error-line); color: var(--bad); }
.badge.superseded, .badge.hidden { color: var(--ink-muted); }

/* forms */
label { display: block; font-weight: 500; font-size: .9rem; margin: .8rem 0 .3rem; color: var(--ink-2); }
input[type=text], input[type=password], input[type=email], input[type=tel], input[type=number], input[type=datetime-local], select, textarea {
    width: 100%; font: inherit; padding: .6rem .75rem; border: 1px solid var(--field-line); border-radius: 10px; background: var(--surface); color: var(--ink); }
input:focus, textarea:focus, select:focus { outline: 2px solid rgba(232, 28, 30, .25); border-color: var(--accent); }
textarea { min-height: 9rem; font-family: ui-monospace, Consolas, monospace; font-size: .85rem; }
.check { display: flex; gap: .5rem; align-items: center; font-weight: 500; }
.check input { width: auto; }
.button, button { display: inline-flex; align-items: center; gap: .4rem; font: inherit; font-weight: 600; font-size: .95rem; border: 0; border-radius: 999px; padding: .65rem 1.3rem; cursor: pointer; background: var(--lw-gradient); color: #fff; margin-top: 1rem; }
.button:hover, button:hover { filter: brightness(1.05); text-decoration: none; color: #fff; }
button.secondary, .button.secondary { background: var(--surface); color: var(--ink); border: 1px solid var(--field-line); }
button.secondary:hover, .button.secondary:hover { background: var(--surface-2); color: var(--ink); }
button.link { background: none; color: var(--ink-2); padding: 0; margin: 0; font-weight: 500; border-radius: 0; }
button.link:hover { color: var(--accent); filter: none; }
button.small, .button.small { padding: .3rem .8rem; font-size: .82rem; margin-top: 0; }
button:disabled { opacity: .5; cursor: not-allowed; }
.row { display: flex; gap: 1rem; flex-wrap: wrap; align-items: flex-end; }
.row > * { flex: 1 1 180px; }
.row-actions { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; margin: .6rem 0 1rem; }
.row-actions .button, .row-actions button { margin-top: 0; }
.inline { display: inline; margin: 0; }
.notice { border-radius: 10px; padding: .8rem 1rem; margin: 0 0 1rem; background: var(--info-bg); color: var(--info-ink); border: 1px solid var(--info-line); }
.notice.error { background: var(--error-bg); color: var(--error-ink); border-color: var(--error-line); }
.notice.ok { background: var(--ok-bg); color: var(--ok-ink); border-color: var(--ok-line); }
.drop { border: 2px dashed var(--field-line); border-radius: var(--radius); padding: 1.4rem; text-align: center; background: var(--surface-hover); }
.drop input[type=file] { display: none; }
progress { width: 100%; height: 10px; accent-color: var(--accent); }
details summary { cursor: pointer; font-weight: 600; }
.log { max-height: 26rem; overflow: auto; white-space: pre-wrap; word-break: break-word; }
.live-tail { max-height: 12rem; margin: .6rem 0 0; font-size: .8rem; }
.live-log { min-height: 8rem; max-height: 70vh; }

/* frozen: an icy look, the numbers stay readable behind a layer of frost */
.frozen-banner { display: flex; align-items: center; gap: 1.2rem; border-radius: var(--radius); padding: 1.1rem 1.4rem;
    margin: 0 0 1.2rem; background: var(--ice-1); color: var(--ice-ink); border: 1px solid var(--ice-2); }
.frozen-banner img { width: 52px; height: 52px; flex: none; }
.frozen-banner strong { display: block; font-family: var(--serif); font-weight: 400; font-size: 1.5rem; line-height: 1.2; }
body.frozen .hero { background: var(--ice-gradient); }
body.frozen .hero::after { content: ""; position: absolute; right: -40px; top: -40px; width: 300px; height: 300px;
    background: url(snowflake.svg) center / contain no-repeat; opacity: .28; animation: spin 60s linear infinite; pointer-events: none; }
body.frozen .hero::before { content: ""; position: absolute; inset: 0; pointer-events: none;
    background-image: radial-gradient(circle, rgba(255, 255, 255, .55) 1.2px, transparent 1.6px),
                      radial-gradient(circle, rgba(255, 255, 255, .35) 1px, transparent 1.4px);
    background-size: 46px 46px, 29px 29px; background-position: 0 0, 13px 17px; animation: snow 14s linear infinite; }
body.frozen .site-header::after { background: var(--ice-gradient); }
.frost { position: relative; }
body.frozen .frost > .card { background: linear-gradient(160deg, var(--surface) 0%, var(--ice-1) 100%); border-color: var(--ice-2); }
body.frozen .frost .fill, body.frozen .frost .legend .key:not(.other) { background: var(--ice-fill); }
body.frozen .frost .rank, body.frozen .frost .eyebrow { color: var(--ice-ink); }
body.frozen .frost table, body.frozen .frost .grid { filter: saturate(.55); }
body.frozen .frost > .card::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); pointer-events: none;
    background: linear-gradient(115deg, rgba(186, 230, 253, .28), rgba(255, 255, 255, .06) 40%, rgba(186, 230, 253, .22));
    box-shadow: inset 0 0 40px rgba(125, 211, 252, .35); }
body.frozen .frost > .card { position: relative; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes snow { from { background-position: 0 0, 13px 17px; } to { background-position: 0 460px, 13px 307px; } }
@media (prefers-reduced-motion: reduce) {
    body.frozen .hero::before, body.frozen .hero::after { animation: none; }
}

/* access codes: one screen per account, to be shown on a phone; swipe or tap Next. Always light: QR codes
   need a light background to scan */
body.present .site-header, body.present footer { display: none; }
body.present main { width: auto; max-width: none; padding: 0; }
.claim-cards { height: 100vh; height: 100dvh; overflow-y: auto; scroll-snap-type: y mandatory; scroll-behavior: smooth; }
.claim-card { height: 100vh; height: 100dvh; scroll-snap-align: start; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: .35rem; padding: 3rem 1rem 1.5rem; text-align: center;
    background: #fff; color: #111827; border-bottom: 1px solid #e5e7eb; position: relative; }
.claim-card .card-top { position: absolute; top: .9rem; left: 1rem; right: 1rem; display: flex; justify-content: space-between; font-size: .9rem; }
.claim-card img.logo { height: 26px; }
.claim-card .user { font-size: 2.2rem; font-weight: 700; margin: 0; line-height: 1.1; }
.claim-card .qr { width: min(86vw, 50vh, 440px); width: min(86vw, 50dvh, 440px); }
.claim-card .qr svg { display: block; width: 100%; height: auto; }
.claim-card .url { font-size: .65rem; word-break: break-all; color: #6b7280; max-width: 30rem; margin: 0; }
.claim-card .muted { color: #6b7280; }
.claim-card p { margin: .1rem 0; }
.claim-card .button { margin-top: .5rem; }
.claim-card .button.secondary { background: #fff; color: #111827; border-color: #d1d5db; }

footer { text-align: center; color: var(--ink-muted); font-size: .85rem; padding: 2rem 1rem 3rem; }

@media (max-width: 700px) {
    main { padding: 1rem .8rem 3rem; }
    .bar { padding: .6rem .8rem; gap: .6rem; }
    .brand span { display: none; }
    nav.main { gap: .8rem; font-size: .9rem; }
    .hero { padding: 1.4rem; }
    .card { padding: 1.1rem; }
    .bars .plot { min-width: 70px; }
    .ranking .plot { display: none; }
    .frozen-banner img { width: 38px; height: 38px; }
}

/* challenge materials */
.material { padding: 1.1rem 0; border-top: 1px solid var(--line); }
.card > h2 + .material { border-top: 0; padding-top: .3rem; }
.material-head { display: flex; align-items: baseline; gap: .6rem; flex-wrap: wrap; }
.material-head h3 { margin: 0; }
.material-latest { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.material-latest .button { margin-top: .8rem; word-break: break-all; }
.material-latest .muted { margin-top: .8rem; }
.material-note { margin: .7rem 0 0; padding: .6rem .9rem; border-left: 3px solid var(--accent); background: var(--surface-2); color: var(--ink-2); border-radius: 0 8px 8px 0; white-space: pre-wrap; }
.material-history { margin-top: .9rem; }
.material-history summary { color: var(--ink-2); font-size: .9rem; }
.material-history[open] summary { margin-bottom: .4rem; }
.material form.row { margin-top: .4rem; }
.hero .material-link { margin-top: 1rem; }
