:root {
    --bg: #fbf7f0;
    --surface: #ffffff;
    --text: #23302a;
    --muted: #5f6b64;
    --border: #e4dccd;
    --red: #b3202a;
    --red-dark: #8d1820;
    --green: #1f5b3a;
    --gold: #c99a2e;
    --ok-bg: #e5f2e9;
    --ok-text: #1d4d31;
    --err-bg: #fbe7e7;
    --err-text: #8d1820;
    --shadow: 0 1px 2px rgba(40, 30, 10, .06), 0 6px 18px rgba(40, 30, 10, .07);
    --radius: 14px;
    --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
    --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #111814;
        --surface: #18221c;
        --text: #ece6da;
        --muted: #a8b1aa;
        --border: #2c3a31;
        --red: #e0505a;
        --red-dark: #c63c46;
        --green: #7cc59a;
        --gold: #e2b850;
        --ok-bg: #1d3426;
        --ok-text: #b8e3c7;
        --err-bg: #3a1c1f;
        --err-text: #f3b8bc;
        --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 18px rgba(0, 0, 0, .3);
    }
}

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

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    color: var(--text);
    font: 16px/1.5 var(--sans);
}

main { flex: 1; width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 16px 32px; }

a { color: var(--red); }

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}
.brand {
    display: inline-flex; align-items: center; gap: 8px;
    color: var(--green); font: 600 1.1rem var(--serif); text-decoration: none;
}
.usernav { display: flex; align-items: center; gap: 12px; }
.usernav form { margin: 0; }
.who { color: var(--muted); font-size: .9rem; text-decoration: none; }
.who:hover { color: var(--text); text-decoration: underline; }

/* Hero */
.hero {
    position: relative;
    display: grid;
    grid-template-columns: 1fr minmax(0, 2fr) 1fr;
    align-items: center;
    margin: 16px 0 8px;
    min-height: 220px;
}
.hero-title {
    grid-column: 2;
    text-align: center;
    padding: 72px 12px 20px;
    background: url("/images/header.png") top center / contain no-repeat;
}
.hero-side { width: 100%; max-width: 170px; height: auto; justify-self: center; }
.hero-left { grid-column: 1; }
.hero-right { grid-column: 3; }
.eyebrow { margin: 0; color: var(--muted); font: italic 1.25rem var(--serif); }
.hero h1 { margin: 0; color: var(--red); font: 700 clamp(1.9rem, 5vw, 3rem)/1.1 var(--serif); }
.year { margin: 4px 0 0; color: var(--gold); font: 700 1.4rem var(--serif); letter-spacing: .2em; }

@media (max-width: 720px) {
    .hero { grid-template-columns: 1fr; min-height: 0; }
    .hero-side { display: none; }
    .hero-title { grid-column: 1; padding-top: 56px; }
}

/* Notices */
.notice {
    margin: 12px auto;
    max-width: 720px;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    text-align: center;
}
.notice-ok { background: var(--ok-bg); color: var(--ok-text); border-color: transparent; }

/* Cards */
.cards {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin-top: 16px;
}
@media (min-width: 760px) {
    .cards { grid-template-columns: 1fr 1fr; }
}
.card {
    min-width: 0;
    margin: 0;
    padding: 18px 18px 14px;
    border: 1px solid var(--border);
    border-top: 4px solid var(--green);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}
.card:nth-child(even) { border-top-color: var(--red); }
.card-love { grid-column: 1 / -1; border-top-color: var(--gold); }
.card legend {
    float: left; width: 100%; padding: 0;
    font: 700 1.3rem var(--serif); color: var(--text);
}
.hint { clear: both; margin: 2px 0 12px; color: var(--muted); font-size: .9rem; }
.limit { margin: 8px 0 0; color: var(--muted); font-size: .8rem; text-align: right; }

.items { margin: 0; padding-left: 1.6em; display: grid; gap: 8px; }
.items li::marker { color: var(--muted); font-size: .85rem; }

input[type="text"], input[type="email"], input[type="password"], textarea {
    width: 100%;
    padding: 9px 11px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    color: var(--text);
    font: inherit;
}
textarea { resize: vertical; min-height: 4.5em; }
input:focus, textarea:focus {
    outline: 2px solid var(--green);
    outline-offset: 1px;
    border-color: transparent;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 9px 18px;
    border: 1px solid transparent;
    border-radius: 999px;
    font: 600 .95rem var(--sans);
    text-decoration: none;
    cursor: pointer;
}
.btn-primary { background: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-dark); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); padding: 6px 14px; }
.btn-ghost:hover { border-color: var(--muted); }
.btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.actions {
    position: sticky;
    bottom: 0;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 14px;
    margin-top: 20px;
    padding: 12px 0;
    background: linear-gradient(to top, var(--bg) 70%, transparent);
}
.dirty { color: var(--gold); font-size: .9rem; font-weight: 600; }

.panel {
    max-width: 520px;
    margin: 48px auto;
    padding: 28px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
    text-align: center;
}
.panel h1 { margin-top: 0; color: var(--red); font-family: var(--serif); }

.footer { padding: 18px 16px; color: var(--muted); font-size: .85rem; text-align: center; }

.notice-error { background: var(--err-bg); color: var(--err-text); border-color: transparent; }

/* Auth & account forms */
.auth { text-align: left; }
.auth h1 { text-align: center; }
.auth.wide { max-width: 640px; }
.auth h2 { margin: 8px 0 0; font: 700 1.15rem var(--serif); }
.lede { color: var(--muted); }
.auth .lede { text-align: center; }
.stack { display: grid; gap: 14px; margin: 16px 0; }
.auth.wide .stack + .stack { border-top: 1px solid var(--border); padding-top: 16px; }
.stack label { display: grid; gap: 6px; font-weight: 600; font-size: .95rem; }
.stack label.check { display: flex; align-items: center; gap: 8px; font-weight: 400; }
.stack .btn-ghost { justify-self: start; }
.small { font-size: .9rem; color: var(--muted); }
.code-input { font: 600 1.6rem/1.2 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .35em; text-align: center; }
.btn-block { display: block; text-align: center; }
.linklike { padding: 0; border: 0; background: none; color: var(--red); font: inherit; text-decoration: underline; cursor: pointer; }
.divider { display: flex; align-items: center; gap: 10px; margin: 18px 0; color: var(--muted); font-size: .85rem; }
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px solid var(--border); }
