:root {
    --bg: #0f1115;
    --bg-2: #161a21;
    --panel: #1a1f27;
    --line: #2a313c;
    --text: #e8e4dc;
    --muted: #9aa3ae;
    --accent: #d4a24c;
    --accent-2: #f0c46a;
    --accent-ink: #1a1306;
    --up: #5fcf86;
    --down: #e0675e;
    --code: #232a34;
    --radius: 12px;
    --shadow: 0 1px 0 rgb(255 255 255 / 0.03) inset, 0 8px 24px rgb(0 0 0 / 0.25);
    --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
    --mono: ui-monospace, "Cascadia Mono", "JetBrains Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: light) {
    :root {
        --bg: #f6f3ec;
        --bg-2: #efe9dd;
        --panel: #ffffff;
        --line: #e2dacb;
        --text: #1f1c17;
        --muted: #6b655b;
        --accent: #a8721c;
        --accent-2: #8a5c12;
        --accent-ink: #ffffff;
        --up: #1f8a4c;
        --down: #b93a30;
        --code: #f1ece2;
        --shadow: 0 1px 2px rgb(0 0 0 / 0.04), 0 6px 18px rgb(60 40 10 / 0.06);
    }
}

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

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background:
        radial-gradient(1200px 500px at 50% -200px, color-mix(in srgb, var(--accent) 14%, transparent), transparent 70%),
        var(--bg);
    color: var(--text);
    font: 16px/1.6 var(--font);
}

a { color: var(--accent-2); text-underline-offset: 3px; }
a:hover { color: var(--accent); }
code { font-family: var(--mono); font-size: 0.9em; background: var(--code); padding: 0.1em 0.4em; border-radius: 6px; overflow-wrap: anywhere; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 0.5em; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.9rem, 4.5vw, 3rem); }
h2 { font-size: 1.25rem; }

.wrap { width: 100%; max-width: 1040px; margin: 0 auto; padding: 0 16px; }
main.wrap { flex: 1; padding-top: 32px; padding-bottom: 56px; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }

/* header */
.top { border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 10; }
.top-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 60px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 700; font-size: 1.15rem; letter-spacing: 0.02em; }
.brand-mark { width: 26px; height: 26px; color: var(--accent); }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a { color: var(--muted); text-decoration: none; padding: 6px 12px; border-radius: 8px; font-weight: 500; }
.nav a:hover { color: var(--text); background: var(--bg-2); }
.nav a[aria-current="page"] { color: var(--text); background: var(--panel); box-shadow: inset 0 -2px 0 var(--accent); }

/* hero */
.hero { padding: 40px 0 28px; max-width: 720px; }
.eyebrow { color: var(--accent); font-weight: 600; text-transform: uppercase; letter-spacing: 0.12em; font-size: 0.8rem; margin: 0 0 12px; }
.lead { color: var(--muted); font-size: 1.1rem; margin: 0 0 24px; max-width: 62ch; }
.actions { display: flex; gap: 12px; flex-wrap: wrap; }

.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 18px; border-radius: 10px; font-weight: 600; text-decoration: none; background: var(--accent); color: var(--accent-ink); border: 1px solid transparent; white-space: nowrap; }
.button:hover { background: var(--accent-2); color: var(--accent-ink); }
.button.ghost { background: transparent; color: var(--text); border-color: var(--line); }
.button.ghost:hover { border-color: var(--accent); color: var(--text); }

/* status strip */
.status { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 8px 0 28px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.stat .label { color: var(--muted); font-size: 0.85rem; }
.stat .value { font-size: 1.3rem; font-weight: 700; display: inline-flex; align-items: center; gap: 10px; }
.stat .value.num { font-variant-numeric: tabular-nums; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 4px color-mix(in srgb, currentColor 18%, transparent); }
.up { color: var(--up); }
.down { color: var(--down); }

/* panels */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); margin-bottom: 16px; min-width: 0; }
.grid .panel { margin-bottom: 0; }
.panel.narrow { max-width: 560px; }
.panel.empty { text-align: center; padding: 40px 22px; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.more { font-size: 0.9rem; text-decoration: none; }

.steps { margin: 0 0 12px; padding-left: 1.3em; display: grid; gap: 10px; }
.steps li::marker { color: var(--accent); font-weight: 700; }

.mini-log { list-style: none; margin: 0; padding: 0; }
.mini-log li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.mini-log li:first-child { border-top: 0; padding-top: 0; }
.mini-log a { color: var(--text); text-decoration: none; font-weight: 500; min-width: 0; }
.mini-log a:hover { color: var(--accent-2); }
.mini-log time { color: var(--muted); font-size: 0.85rem; white-space: nowrap; }

/* page head */
.page-head { padding: 16px 0 12px; }
.page-head .lead { margin-bottom: 16px; }

/* downloads */
.files { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 12px; }
.file { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.file-main { min-width: 0; }
.file-name { font-family: var(--mono); font-size: 1.05rem; margin-bottom: 6px; overflow-wrap: anywhere; }
.file-meta { display: flex; flex-wrap: wrap; gap: 6px 20px; margin: 8px 0 0; font-size: 0.875rem; }
.file-meta div { display: flex; gap: 6px; min-width: 0; }
.file-meta dt { color: var(--muted); }
.file-meta dd { margin: 0; min-width: 0; }
.file-meta .hash { flex-basis: 100%; }
.file-meta .hash code { font-size: 0.8rem; }

/* changelog */
.log { display: grid; gap: 16px; }
.entry { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px; box-shadow: var(--shadow); scroll-margin-top: 80px; }
.entry-head { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 0.875rem; margin-bottom: 6px; }
.entry h2 a { color: var(--text); text-decoration: none; }
.entry h2 a:hover { color: var(--accent-2); }
.tag { color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); border-radius: 999px; padding: 0 8px; font-size: 0.78rem; font-weight: 600; }
.prose { color: var(--text); }
.prose > :first-child { margin-top: 0; }
.prose > :last-child { margin-bottom: 0; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li { margin: 4px 0; }
.prose li::marker { color: var(--accent); }
.prose h3 { font-size: 1rem; margin-top: 1.2em; }
.prose table { border-collapse: collapse; width: 100%; display: block; overflow-x: auto; }
.prose th, .prose td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; }

/* footer */
.foot { border-top: 1px solid var(--line); color: var(--muted); font-size: 0.85rem; padding: 18px 0; }

@media (max-width: 720px) {
    .status { grid-template-columns: 1fr; }
    .grid { grid-template-columns: 1fr; }
    .file { flex-direction: column; align-items: stretch; }
    .hero { padding-top: 16px; }
    .entry { padding: 18px; }
}

/* lists and tables */
.crumb { margin: 0 0 8px; font-size: 0.9rem; }
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 18px; }
.filters .gap { margin-left: 14px; }
.chip { color: var(--muted); text-decoration: none; padding: 4px 12px; border: 1px solid var(--line); border-radius: 999px; font-size: 0.9rem; background: var(--panel); }
.chip:hover { color: var(--text); border-color: var(--accent); }
.chip[aria-current="page"] { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); font-weight: 600; }
.table-wrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 12px; }
table.data { width: 100%; border-collapse: collapse; }
table.data th, table.data td { padding: 9px 14px; text-align: left; border-top: 1px solid var(--line); white-space: nowrap; }
table.data thead th { border-top: 0; color: var(--muted); font-size: 0.82rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; background: var(--bg-2); }
table.data tbody tr:hover { background: color-mix(in srgb, var(--accent) 6%, transparent); }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; }
.nation { font-weight: 600; }
.nation.n1 { color: #e0675e; }
.nation.n2 { color: #6aa7e0; }
.pager { display: flex; align-items: center; justify-content: center; gap: 20px; margin: 16px 0 0; }
.pager .off { color: var(--muted); opacity: 0.5; }
.search { display: flex; gap: 10px; max-width: 520px; }
.search input { flex: 1; min-width: 0; padding: 10px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--text); font: inherit; }
.search input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.props { margin: 0; display: grid; gap: 0; }
.props div { display: flex; justify-content: space-between; gap: 16px; padding: 7px 0; border-top: 1px solid var(--line); }
.props div:first-child { border-top: 0; }
.props dt { color: var(--muted); }
.props dd { margin: 0; font-variant-numeric: tabular-nums; text-align: right; }
.grid + .panel { margin-top: 16px; }

/* account forms */
.form { display: grid; gap: 6px; }
.form label { font-weight: 600; margin-top: 8px; }
.form input { padding: 10px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg-2); color: var(--text); font: inherit; min-width: 0; width: 100%; }
.form input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.form .hint { margin: 0; color: var(--muted); font-size: 0.85rem; }
.form .actions { margin-top: 14px; }
.problem { margin: 0 0 6px; color: var(--down); font-weight: 600; }
.ok { margin: 0 0 6px; color: var(--up); font-weight: 600; }
form.inline { display: inline; margin: 0; }
.linklike { background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; }
.linklike:hover { color: var(--accent-2); }
.nav .linklike { color: var(--muted); padding: 6px 12px; border-radius: 8px; font-weight: 500; }
.nav .linklike:hover { color: var(--text); background: var(--bg-2); }

/* GM panel */
.gm-block { margin-top: 16px; }
.gm-chars { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.gm-chars li { border-top: 1px solid var(--line); padding-top: 12px; }
.gm-chars li:first-child { border-top: 0; padding-top: 0; }
.gm-char-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; }
.gm-chars .actions, .panel > form.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.gm-quote { padding: 10px 14px; border-left: 3px solid var(--accent); background: var(--bg-2); border-radius: 6px; overflow-wrap: anywhere; }
.confirm { max-width: 560px; }
.button.danger { border-color: var(--down); }
td.wrap-ok { white-space: normal; min-width: 14ch; overflow-wrap: anywhere; }
