:root {
  --bg: #f6f5fb; --surface: #ffffff; --surface-2: #f0eef8; --border: #e2dfee;
  --text: #1d1a2e; --muted: #6b6784; --accent: #5b3fd1; --accent-ink: #ffffff; --accent-soft: #ece7ff;
  --gold: #b7862b; --ok: #1f8a4c; --ok-soft: #e3f5ea; --warn: #9a6400; --warn-soft: #fdf1dc;
  --bad: #c0362c; --bad-soft: #fde8e6; --radius: 10px; --shadow: 0 1px 2px rgb(20 10 60 / .06), 0 4px 16px rgb(20 10 60 / .05);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12101c; --surface: #1b1829; --surface-2: #231f35; --border: #302b47;
    --text: #ebe8f7; --muted: #9c97b8; --accent: #9d86ff; --accent-ink: #14101f; --accent-soft: #2a2350;
    --gold: #e0b35a; --ok: #53c98a; --ok-soft: #173326; --warn: #f0b54a; --warn-soft: #3a2c12;
    --bad: #ff7b70; --bad-soft: #3d1a1a; --shadow: none;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9em; }
code { background: var(--surface-2); padding: .1em .35em; border-radius: 4px; }
pre { background: var(--surface-2); padding: .75rem 1rem; border-radius: 8px; overflow-x: auto; }
pre code { background: none; padding: 0; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .75rem; }
h1 { font-size: 1.5rem; } h2 { font-size: 1.15rem; } h3 { font-size: 1rem; }

.topbar { display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; align-items: center; justify-content: space-between;
  padding: .75rem max(16px, calc((100% - 1040px) / 2)); background: var(--surface); border-bottom: 1px solid var(--border); }
.brand { font-weight: 700; font-size: 1.1rem; color: var(--text); letter-spacing: .01em; }
.brand::before { content: "✦ "; color: var(--gold); }
.topbar nav { display: flex; flex-wrap: wrap; gap: .25rem 1rem; align-items: center; }
.topbar nav a { color: var(--text); }
main { max-width: 1040px; margin: 0 auto; padding: 1.5rem 16px 3rem; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 1.25rem 1.5rem; margin-bottom: 1.25rem; }
.card.narrow { max-width: 420px; margin-inline: auto; }
.card.narrow-left form { max-width: 420px; }
.card.highlight { border-color: var(--accent); background: var(--accent-soft); }
.hero { text-align: center; padding: 1.5rem 0 1rem; }
.hero h1 { font-size: 2rem; margin-bottom: .25rem; }
.lead { color: var(--muted); font-size: 1.05rem; margin: 0; }
.crumbs { margin: 0 0 .75rem; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .count { font-weight: 400; font-size: 1rem; }
.nowrap { white-space: nowrap; }
.row-between { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; justify-content: space-between; margin-bottom: .75rem; }
.row-between h1, .row-between h2 { margin: 0; }

.flash { padding: .7rem 1rem; border-radius: 8px; margin-bottom: 1rem; border: 1px solid; }
.flash.ok { background: var(--ok-soft); border-color: var(--ok); }
.flash.error { background: var(--bad-soft); border-color: var(--bad); }

.stack { display: flex; flex-direction: column; gap: .85rem; }
.stack label, label { display: flex; flex-direction: column; gap: .3rem; font-weight: 500; }
.inline-label { flex-direction: row; align-items: center; gap: .5rem; font-weight: 400; }
.hint { font-weight: 400; font-size: .85rem; color: var(--muted); }
.toolbar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: 1rem; }
.toolbar input:not([type=hidden]):not(.short) { flex: 1 1 200px; }
form.inline { display: inline; }
input, select { font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
  padding: .5rem .7rem; min-width: 0; }
input.short { width: 5rem; }
input:focus, select:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
button, .button { font: inherit; font-weight: 500; cursor: pointer; border-radius: 8px; padding: .5rem 1rem;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text); display: inline-block; }
button:hover, .button:hover { border-color: var(--accent); text-decoration: none; }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
button.danger { background: var(--bad-soft); color: var(--bad); border-color: var(--bad); }
button.link { background: none; border: none; padding: 0; color: var(--accent); font-weight: 400; }
.topbar button.link { color: var(--text); }
.button-row { display: flex; flex-wrap: wrap; gap: .5rem; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem; }
.boxed { border: 1px solid var(--border); border-radius: 8px; padding: 1rem; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .55rem .6rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.faded td { opacity: .55; }
table.plain td, table.plain th { padding-inline: .3rem; }

.pill { display: inline-block; font-size: .78rem; font-weight: 600; padding: .15rem .55rem; border-radius: 999px; margin: .1rem .15rem .1rem 0; vertical-align: middle; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.role { background: var(--accent-soft); color: var(--accent); }
.dot { display: inline-block; width: .55rem; height: .55rem; border-radius: 50%; margin-right: .45rem; vertical-align: middle; }
.dot.ok { background: var(--ok); } .dot.bad { background: var(--bad); }

.stats { display: flex; flex-wrap: wrap; gap: 1rem 2.5rem; margin-bottom: 1rem; }
.stat { display: flex; flex-direction: column; }
.stat-value { font-size: 2rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat-label { color: var(--muted); font-size: .85rem; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .75rem 1.5rem; margin: 0; }
.facts dt { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.steps { padding-left: 1.25rem; } .steps li { margin-bottom: .6rem; }

.school { font-weight: 600; }
.school-fire { color: #d9480f; } .school-ice { color: #1c7ed6; } .school-storm { color: #7048e8; }
.school-myth { color: #b08900; } .school-life { color: #2b8a3e; } .school-death { color: #5c5f66; }
.school-balance { color: #a0522d; }
@media (prefers-color-scheme: dark) {
  .school-fire { color: #ff8a5b; } .school-ice { color: #74c0fc; } .school-storm { color: #b197fc; }
  .school-myth { color: #ffd43b; } .school-life { color: #69db7c; } .school-death { color: #adb5bd; } .school-balance { color: #e0a36f; }
}

.danger-zone { margin-top: 1rem; border: 1px solid var(--bad); border-radius: 8px; padding: .75rem 1rem; }
.danger-zone summary { cursor: pointer; color: var(--bad); font-weight: 600; }
.copyable { position: relative; padding-right: 4.5rem; }
.copy-btn { position: absolute; top: .45rem; right: .45rem; font-size: .8rem; padding: .2rem .6rem; }

/* Staff docs */
.docs-layout { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.docs-nav { display: flex; flex-direction: column; gap: .15rem; padding: 1rem; position: sticky; top: calc(env(safe-area-inset-top, 0px) + 1rem); }
.docs-nav-title { margin: 0 0 .4rem; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
.docs-nav a { color: var(--text); padding: .35rem .6rem; border-radius: 6px; }
.docs-nav a:hover { background: var(--surface-2); text-decoration: none; }
.docs-nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
@media (max-width: 760px) {
  .docs-layout { grid-template-columns: 1fr; }
  .docs-nav { position: static; flex-direction: row; flex-wrap: wrap; }
  .docs-nav-title { width: 100%; }
}
.prose { max-width: 100%; }
.prose h1 { font-size: 1.5rem; }
.prose h2 { font-size: 1.15rem; margin-top: 1.75rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.prose h3 { margin-top: 1.25rem; }
.prose p, .prose li { max-width: 72ch; }
.prose ul, .prose ol { padding-left: 1.3rem; }
.prose li { margin-bottom: .3rem; }
.prose table { margin: .75rem 0 1rem; }
.prose blockquote { margin: 1rem 0; padding: .6rem 1rem; border-left: 3px solid var(--gold); background: var(--surface-2); border-radius: 0 8px 8px 0; }
.prose blockquote p { margin: 0; }
pre.cmd { margin: 0; padding-block: .35rem; white-space: nowrap; }
