:root {
    --bg: #f3f1e6;
    --panel: #fffdf4;
    --panel2: #e5ebdc;
    --line: rgba(23, 60, 56, .28);
    --text: #173c38;
    --muted: #63746b;
    --dim: #63746b;
    --accent: #d5ef6b;
    --accent2: #5a7852;
    --ok: #315b38;
    --warn: #795011;
    --bad: #943c31;
    color-scheme: light;
}
*, *::before, *::after { box-sizing: border-box; }
html { background: var(--bg); }
body {
    margin: 0; color: var(--text); font: 16px/1.6 Arial, Helvetica, sans-serif;
    background-color: var(--bg);
    background-image: linear-gradient(rgba(23, 60, 56, .045) 1px, transparent 1px), linear-gradient(90deg, rgba(23, 60, 56, .045) 1px, transparent 1px);
    background-size: 32px 32px;
    overflow-wrap: anywhere;
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-underline-offset: .22em; }
a:hover { text-decoration-thickness: 2px; }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: rgba(237, 130, 70, .25); }
button { cursor: pointer; }
p { margin: 0 0 1.2em; }
hr { border: 0; border-top: 1px solid var(--line); margin: 28px 0; }

.wrap { width: 100%; max-width: 1100px; margin-inline: auto; padding-inline: 20px; }
main { min-height: 60vh; padding: 48px 0 64px; }
.narrow { width: 100%; max-width: 440px; margin-inline: auto; }
.row { display: flex; align-items: center; flex-wrap: wrap; gap: 16px; }
.row > *, .grid > * { min-width: 0; }
.between { justify-content: space-between; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 24px; }
header.top { background: var(--bg); border-bottom: 1px solid var(--line); }
header.top > .wrap { display: flex; align-items: center; flex-wrap: wrap; gap: 20px; padding-block: 20px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; flex-shrink: 0; }
.brand img { width: 39px; height: 39px; }
.wordmark { display: grid; font-size: 15px; font-weight: 800; line-height: 1.02; letter-spacing: -.5px; }
.wordmark small { margin-top: 6px; font: 9px/1.2 'Courier New', monospace; letter-spacing: 1px; }
nav { display: flex; align-items: center; flex-wrap: wrap; gap: 16px; min-width: 0; }
nav.main { flex: 1; }
nav.user { margin-left: auto; font-size: .875rem; }
nav a { text-decoration: none; }
nav a:not(.btn) { padding-block: 8px; }
nav a.on { color: var(--text); text-decoration: underline; text-decoration-color: var(--accent2); text-decoration-thickness: 3px; text-underline-offset: 7px; font-weight: 700; }
nav form { margin: 0; }
h1, h2, h3 { line-height: 1.12; margin: 0 0 20px; }
h1 { font-size: clamp(2.2rem, 6vw, 4rem); letter-spacing: -.055em; }
h2 { font-size: clamp(1.7rem, 4vw, 2.6rem); letter-spacing: -.04em; }
h3 { font-size: 1.25rem; letter-spacing: -.02em; }
h1 em, h2 em { font-family: Georgia, serif; font-weight: 400; color: #5a7852; }
p.lead { max-width: 680px; color: var(--muted); font-size: 1.15rem; line-height: 1.65; }
.meta { color: var(--muted); font-size: .875rem; }
.hint { display: block; color: var(--muted); font-size: .8rem; margin-top: 6px; }
.code, .bigcode, .eyebrow { font-family: 'Courier New', monospace; }
.code { letter-spacing: .07em; }
.bigcode { font-size: 2rem; font-weight: 700; letter-spacing: .08em; }
.eyebrow { font-size: .75rem; text-transform: uppercase; letter-spacing: .17em; font-weight: 700; margin-bottom: 14px; }

.panel { background: var(--panel); padding: 24px; border: 1px solid var(--line); border-radius: 8px; }
.card { display: block; min-width: 0; overflow: hidden; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; text-decoration: none; transition: border-color .15s, transform .15s; }
.card:hover { border-color: var(--text); transform: translateY(-3px); }
.card .thumb { aspect-ratio: 16 / 10; overflow: hidden; background: var(--panel2); }
.card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.card .body { padding: 18px; }
.card .title { font-size: 1.15rem; font-weight: 700; line-height: 1.3; margin-bottom: 6px; }
.pill { display: inline-block; padding: 2px 10px; border: 1px solid var(--line); border-radius: 999px; background: #e8ecdf; font-size: .75rem; font-weight: 700; }
.pill.kind { background: var(--accent); }
label { display: block; font-weight: 700; margin: 18px 0 6px; }
form > label:first-of-type, .panel > label:first-child { margin-top: 0; }
input[type='text'], input[type='email'], input[type='password'], input[type='date'], input[type='search'], select, textarea {
    display: block; width: 100%; min-width: 0; max-width: 100%; padding: 11px 12px;
    border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--text);
}
textarea { min-height: 140px; resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
input:focus, select:focus, textarea:focus { outline: 3px solid #ed8246; outline-offset: 2px; border-color: var(--text); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 20px; min-height: 44px; border: 1px solid var(--text); border-radius: 6px; background: var(--accent); color: var(--text); font-weight: 700; text-align: center; text-decoration: none; line-height: 1.4; transition: transform .15s, box-shadow .15s; }
.btn:hover { transform: translateY(-3px); box-shadow: 0 6px 0 rgba(23, 60, 56, .12); }
.btn:active { transform: translateY(0); box-shadow: none; }
.btn.ghost { background: transparent; }
.btn.small { padding: 8px 13px; font-size: .875rem; }
.btn.block { display: flex; width: 100%; margin-top: 20px; }
.linkbtn { border: 0; background: none; color: inherit; padding: 8px 0; text-decoration: underline; text-underline-offset: .22em; }
.btn:disabled, button:disabled { opacity: .55; cursor: not-allowed; transform: none; box-shadow: none; }
.errors, .flash, .notice { padding: 16px 20px; margin: 0 0 24px; border: 1px solid; border-radius: 7px; }
.errors { color: var(--bad); background: #f9e6df; border-color: #b76b5e; }
.flash { color: var(--ok); background: #e5efdb; border-color: #77956a; }
.notice { color: var(--warn); background: #faf0d4; border-color: #b59752; }
.errors > :last-child, .flash > :last-child, .notice > :last-child { margin-bottom: 0; }
table { width: 100%; border-collapse: collapse; margin: 24px 0; table-layout: fixed; }
th, td { padding: 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
th { color: var(--muted); font-size: .875rem; font-weight: 700; background: var(--panel2); }
.pager { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin: 28px 0; }
.pager a, .pager span { padding: 8px 14px; border: 1px solid var(--line); border-radius: 5px; }
.pager [aria-current] { background: var(--accent); color: var(--text); }
.stage { position: relative; isolation: isolate; background: #173c38; color: #fffdf4; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; min-height: 320px; }
.stage canvas, .stage iframe, .stage video { display: block; max-width: 100%; width: 100%; border: 0; }
.overlay { position: absolute; inset: 0; z-index: 2; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 24px; background: rgba(23, 60, 56, .94); color: #fffdf4; text-align: center; overflow: auto; }
.overlay[hidden] { display: none; }
.stage .meta, .stage .hint { color: #d7dfcb; }
.stage .btn.ghost { color: #fffdf4; border-color: #a7b7a2; }
/* .bar is the loading progress track inside the overlay */
.bar { width: min(360px, 80%); height: 8px; border-radius: 99px; background: rgba(255, 253, 244, .2); overflow: hidden; }
.bar > div { height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.playbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding: 14px 16px; background: var(--panel2); color: var(--text); border: 1px solid var(--line); }
.banner { padding: 16px 20px; background: #e8ecdf; color: var(--text); border: 1px solid var(--line); border-radius: 6px; margin-bottom: 20px; }
footer { background: #173c38; color: #f3f1e6; padding: 36px 0; border-top: 1px solid var(--line); }
footer .wrap { display: flex; flex-direction: column; align-items: flex-start; gap: 20px; }
footer .brand { color: #f3f1e6; font-size: .875rem; }
footer .brand img { width: 32px; height: 32px; }
footer p { max-width: 680px; margin: 0; color: #e5ebdc; font-size: .9rem; }
footer .row { gap: 12px 24px; font-size: .875rem; }
footer a:hover { color: #d5ef6b; }
:where(a, button, input, select, textarea):focus-visible { outline: 3px solid #ed8246; outline-offset: 4px; }
.skip { position: fixed; top: 12px; left: 16px; z-index: 1000; padding: 12px 18px; background: #fffdf4; color: #173c38; border: 2px solid #173c38; border-radius: 6px; transform: translateY(-160%); }
.skip:focus { transform: translateY(0); }
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
    .btn:hover { transform: none; }
}
@media (max-width: 640px) {
    .wrap { width: 100%; padding-inline: 16px; }
    header.top .wrap { display: flex; flex-wrap: wrap; gap: 16px; }
    header.top nav { display: flex; width: 100%; flex-wrap: wrap; gap: 12px 18px; margin: 0; }
    header.top nav a, header.top nav button { overflow-wrap: anywhere; }
    .brand { max-width: 100%; }
    main { padding-block: 28px; }
    h1 { font-size: clamp(2rem, 9vw, 3rem); }
    .grid { grid-template-columns: minmax(0, 1fr); }
    .row > *, .grid > *, .panel, .card { min-width: 0; }
    .panel { padding: 18px; }
    input, select, textarea { max-width: 100%; font-size: 16px; }
    table { display: block; max-width: 100%; overflow-x: auto; }
    .playbar, .banner { flex-wrap: wrap; overflow-wrap: anywhere; }
    .stage { width: 100%; min-width: 0; }
    footer .wrap { flex-wrap: wrap; gap: 20px; }
}
ul, ol { padding-left: 1.3em; margin: 0 0 1.2em; }
li { margin-bottom: .4em; }
.narrow h1 { font-size: clamp(2rem, 5vw, 2.8rem); }
main.bleed { padding: 0; }
