:root {
    --bg: #f6f5f2;
    --surface: #ffffff;
    --text: #1d1d1f;
    --muted: #6b6b70;
    --border: #e2e0da;
    --accent: #1f5f8b;
    --accent-text: #ffffff;
    --danger: #b3261e;
    --notice: #e7f2ea;
    --notice-text: #1e5b30;
    --highlight: #fff6db;
    color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #161618;
        --surface: #202023;
        --text: #ececee;
        --muted: #9a9aa2;
        --border: #34343a;
        --accent: #6fb0e0;
        --accent-text: #0e1a24;
        --danger: #f2877f;
        --notice: #1c3324;
        --notice-text: #a6dcb4;
        --highlight: #3a3216;
    }
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.topbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 1.5rem;
    padding: 0.75rem 1rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.brand { font-weight: 700; color: var(--text); text-decoration: none; }

nav { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 1rem; }
nav a { color: var(--muted); text-decoration: none; }
nav a:hover { color: var(--text); }

main { max-width: 56rem; margin: 0 auto; padding: 1.5rem 1rem 4rem; }

h1 { font-size: 1.6rem; margin: 0 0 1rem; overflow-wrap: anywhere; }
h2 { font-size: 1.1rem; margin: 0 0 0.75rem; }

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

.heading { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.5rem 1rem; }

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.25rem;
    margin-bottom: 1.25rem;
}
.card.narrow { max-width: 24rem; margin: 3rem auto; }
.card.highlight { background: var(--highlight); }
.card.danger { border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); }

label { display: block; font-weight: 600; margin: 1rem 0 0.35rem; }
label:first-child { margin-top: 0; }

input[type=text], input[type=password], input[type=datetime-local], textarea {
    width: 100%;
    padding: 0.55rem 0.65rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg);
    color: var(--text);
    font: inherit;
}
textarea { font-family: ui-monospace, "Cascadia Code", Menlo, monospace; font-size: 0.9rem; }
input[type=file] { max-width: 100%; }

button, .button {
    display: inline-block;
    margin-top: 1rem;
    padding: 0.55rem 1.1rem;
    border: 0;
    border-radius: 6px;
    background: var(--accent);
    color: var(--accent-text);
    font: inherit;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}
button.secondary { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
button.danger { background: var(--danger); color: #fff; }
button.link { margin: 0; padding: 0; background: none; color: var(--muted); font-weight: 400; }
button.link.danger { color: var(--danger); }
button:disabled { opacity: 0.6; cursor: progress; }
.heading .button { margin-top: 0; }

form.inline { display: inline; }

.copy-row { display: flex; gap: 0.5rem; align-items: center; }
.copy-row input { flex: 1; min-width: 0; font-family: ui-monospace, Menlo, monospace; font-size: 0.85rem; }
.copy-row button { margin-top: 0; white-space: nowrap; }

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
}
th, td { text-align: left; padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
tr.revoked td { color: var(--muted); text-decoration: line-through; }
tr.revoked td:last-child { text-decoration: none; }

.facts { display: grid; grid-template-columns: max-content 1fr; gap: 0.25rem 1rem; margin: 1rem 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }

audio { width: 100%; }
img.cover { width: 10rem; height: 10rem; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }
progress { width: 100%; margin-top: 1rem; }

.hint { color: var(--muted); font-size: 0.9rem; margin: 0.35rem 0 0.75rem; }
.error { color: var(--danger); }
.error ul { margin: 0 0 1rem; padding-left: 1.2rem; }
.notice { background: var(--notice); color: var(--notice-text); padding: 0.6rem 0.9rem; border-radius: 6px; }
.empty { color: var(--muted); }
code { font-family: ui-monospace, Menlo, monospace; font-size: 0.85em; }

@media (max-width: 40rem) {
    table, thead, tbody, tr, th, td { display: block; }
    thead { display: none; }
    tr { border-bottom: 1px solid var(--border); padding: 0.5rem 0; }
    td { border: 0; padding: 0.15rem 0.75rem; }
    td.num { text-align: left; }
}
