/* DW4Online website: one small stylesheet, no scripts. Light and dark follow the system setting. */
:root {
  color-scheme: light dark;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #1c2330;
  --muted: #5d6778;
  --line: #dde1e8;
  --accent: #1f6feb;
  --accent-text: #ffffff;
  --ok: #1a7f37;
  --warn: #9a6700;
  --bad: #c62828;
  --bronze: #a0632e;
  --silver: #7b8794;
  --gold: #b88a00;
  --platinum: #4f7f9e;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11151c;
    --panel: #1a2029;
    --text: #e6e9ef;
    --muted: #9aa4b5;
    --line: #2c3442;
    --accent: #4d8eff;
    --accent-text: #0b1020;
    --ok: #4ac26b;
    --warn: #d4a72c;
    --bad: #ff6b6b;
  }
}

* { 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;
}

a { color: var(--accent); }

header.site {
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

header.site .bar {
  max-width: 64rem;
  margin: 0 auto;
  padding: 0.6rem 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.2rem;
  align-items: center;
}

header.site .brand { font-weight: 700; font-size: 1.15rem; color: var(--text); text-decoration: none; margin-right: auto; }
header.site nav { display: flex; flex-wrap: wrap; gap: 0.3rem 1rem; align-items: center; }
header.site nav a { text-decoration: none; }
header.site nav form { margin: 0; }
header.site nav button.link { text-decoration: none; }

main.page {
  max-width: 64rem;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

footer.site {
  max-width: 64rem;
  margin: 0 auto;
  padding: 1rem;
  color: var(--muted);
  font-size: 0.9rem;
  border-top: 1px solid var(--line);
}

h1 { margin: 0 0 0.75rem; font-size: 1.7rem; }
h2 { margin: 1.75rem 0 0.6rem; font-size: 1.25rem; }
h3 { margin: 1.2rem 0 0.4rem; font-size: 1.05rem; }

.muted { color: var(--muted); }
.small { font-size: 0.9rem; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1rem 1.2rem;
  margin: 0 0 1rem;
}

.panel > h2:first-child, .panel > h3:first-child, .panel > p:first-child { margin-top: 0; }
.panel > :last-child { margin-bottom: 0; }

.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); }

.stat { font-size: 1.6rem; font-weight: 700; }

table.fixed { table-layout: fixed; }
table { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
th, td { text-align: left; padding: 0.45rem 0.7rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); }
tr:last-child td { border-bottom: none; }
td.num, th.num { text-align: right; white-space: nowrap; }

.table-wrap { overflow-x: auto; }

form.stack { display: grid; gap: 0.7rem; max-width: 26rem; }
form.inline { display: inline; }
label { display: grid; gap: 0.2rem; font-weight: 600; font-size: 0.95rem; }
label.check { display: flex; gap: 0.5rem; align-items: center; font-weight: 400; }

input[type=text], input[type=password], input[type=email], input[type=search], select {
  font: inherit;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  width: 100%;
}

button, .button {
  font: inherit;
  padding: 0.4rem 0.9rem;
  border-radius: 6px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--accent-text);
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}

button.secondary { background: transparent; color: var(--accent); }
.button + a, button + .muted { margin-left: 0.6rem; }
button.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
button.link { background: none; border: none; color: var(--accent); padding: 0; text-decoration: underline; }

.notice { padding: 0.7rem 1rem; border-radius: 6px; border: 1px solid var(--line); margin: 0 0 1rem; background: var(--panel); }
.notice.ok { border-color: var(--ok); }
.notice.error { border-color: var(--bad); }
.notice.warn { border-color: var(--warn); }

.secret {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 1.15rem;
  letter-spacing: 0.04em;
  padding: 0.6rem 0.8rem;
  border: 1px dashed var(--warn);
  border-radius: 6px;
  display: inline-block;
  user-select: all;
}

.badge {
  display: inline-block;
  font-size: 0.75rem;
  padding: 0.05rem 0.45rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  white-space: nowrap;
}

.badge.bronze { color: var(--bronze); border-color: var(--bronze); }
.badge.silver { color: var(--silver); border-color: var(--silver); }
.badge.gold { color: var(--gold); border-color: var(--gold); }
.badge.platinum { color: var(--platinum); border-color: var(--platinum); }
.badge.ok { color: var(--ok); border-color: var(--ok); }
.badge.warn { color: var(--warn); border-color: var(--warn); }
.badge.bad { color: var(--bad); border-color: var(--bad); }

.bar-track { background: var(--line); border-radius: 999px; height: 0.45rem; min-width: 6rem; overflow: hidden; }
.bar-fill { background: var(--accent); height: 100%; }

progress { width: 8rem; height: 0.6rem; vertical-align: middle; accent-color: var(--accent); }

dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 0.25rem 1rem; margin: 0; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; }

/* The registration honeypot: real visitors never see or fill it. */
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* Column widths (classes, not inline styles: the CSP allows no inline styles). */
.w-tier { width: 7rem; }
.w-points { width: 5.5rem; }
.w-rarity { width: 6rem; }
.w-you { width: 6.5rem; }

/* The room page: where a room's players are (its instances per stage). */
ul.stages { margin: 0.25rem 0 0; padding-left: 1.2rem; }
ul.stages li { margin: 0.1rem 0; }
tr.room-row td { border-bottom: none; }

/* Friends: the profile's friend and block buttons, the friends page's row buttons. */
.panel.social { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; align-items: center; }
td form.inline + form.inline { margin-left: 0.5rem; }
