/* ------------------------------------------------------------------ tokens */
/* Palette taken from Rust's own interface: Rust red for actions, the olive green of
   craft/confirm buttons for "online" and success, hazmat yellow for warnings, muted steel
   blue for info. Dark mode uses the game's olive-charcoal panels and warm off-white text;
   light mode is sandbag / canvas beige. */
:root {
  color-scheme: light;
  --bg: #e6e0d3;
  --surface: #f3efe6;
  --surface-2: #ece6da;
  --line: #d5cdbd;
  --line-strong: #bdb3a0;
  --text: #262420;
  --muted: #635d52;
  --faint: #8e8676;
  --accent: #b83a22;
  --accent-soft: #f3dbd2;
  --accent-text: #9c2f1a;
  --good: #5a7330;
  --good-soft: #e2e8d2;
  --warn: #946405;
  --warn-soft: #f2e3c0;
  --bad: #b3261e;
  --bad-soft: #f5d9d5;
  --info: #3f6688;
  --info-soft: #dce6ee;
  --shadow: 0 1px 2px rgba(40, 32, 18, .08), 0 4px 16px rgba(40, 32, 18, .06);
  --shadow-lg: 0 10px 40px rgba(40, 32, 18, .22);
  --radius: 12px;
  --radius-sm: 8px;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Menlo, Consolas, monospace;
  --sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #161714;
    --surface: #1f201c;
    --surface-2: #282923;
    --line: #33342d;
    --line-strong: #47483e;
    --text: #e2dccf;
    --muted: #a59f90;
    --faint: #767265;
    --accent: #cd412b;
    --accent-soft: #3b1a13;
    --accent-text: #ec6b4f;
    --good: #8ba34f;
    --good-soft: #262d17;
    --warn: #d9a13a;
    --warn-soft: #34290f;
    --bad: #e5533f;
    --bad-soft: #3a1914;
    --info: #7fa6c9;
    --info-soft: #1a2633;
    --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 4px 16px rgba(0, 0, 0, .25);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, .6);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #161714;
  --surface: #1f201c;
  --surface-2: #282923;
  --line: #33342d;
  --line-strong: #47483e;
  --text: #e2dccf;
  --muted: #a59f90;
  --faint: #767265;
  --accent: #cd412b;
  --accent-soft: #3b1a13;
  --accent-text: #ec6b4f;
  --good: #8ba34f;
  --good-soft: #262d17;
  --warn: #d9a13a;
  --warn-soft: #34290f;
  --bad: #e5533f;
  --bad-soft: #3a1914;
  --info: #7fa6c9;
  --info-soft: #1a2633;
  --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 4px 16px rgba(0, 0, 0, .25);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, .6);
}

/* ------------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14.5px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
img { display: block; }
h1, h2, h3 { margin: 0; line-height: 1.25; letter-spacing: -0.01em; }
h1 { font-size: 22px; font-weight: 700; }
h2 { font-size: 15px; font-weight: 650; }
h3 { font-size: 14px; font-weight: 600; }
button, input, select, textarea { font: inherit; color: inherit; }
svg { width: 18px; height: 18px; flex: none; }
[hidden] { display: none !important; }
.mono { font-family: var(--mono); font-size: .92em; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.stack { display: grid; gap: 16px; }

/* ------------------------------------------------------------------ shell */
.shell {
  display: grid;
  grid-template-columns: 232px 1fr;
  grid-template-rows: 60px 1fr;
  grid-template-areas: "side top" "side main";
  min-height: 100vh;
  min-height: 100dvh;
}
.sidebar {
  grid-area: side;
  position: sticky; top: 0;
  height: 100vh; height: 100dvh;
  display: flex; flex-direction: column;
  padding: 16px 12px;
  border-right: 1px solid var(--line);
  background: var(--surface);
}
.brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 750; font-size: 15.5px; letter-spacing: -0.02em;
  text-decoration: none; padding: 4px 8px 18px;
}
.brand.big { font-size: 20px; padding: 0 0 8px; justify-content: center; }
.brand-logo { width: 28px; height: 28px; flex: none; display: block; }
.nav { display: grid; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 10px; border-radius: var(--radius-sm);
  color: var(--muted); text-decoration: none; font-weight: 550;
}
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.active { background: var(--accent-soft); color: var(--accent-text); }
.sidebar-foot { margin-top: auto; display: flex; align-items: center; gap: 8px; padding: 8px; font-size: 12.5px; color: var(--muted); }
.sidebar-foot .spacer { flex: 1; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.live-dot.on { background: var(--good); box-shadow: 0 0 0 3px var(--good-soft); }
.live-dot.off { background: var(--bad); }

.topbar {
  grid-area: top;
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 8px;
  padding: 0 24px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.search { flex: 1; max-width: 460px; position: relative; display: flex; align-items: center; }
.search svg { position: absolute; left: 11px; color: var(--faint); width: 16px; height: 16px; }
.search input {
  width: 100%; height: 38px; padding: 0 12px 0 34px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface);
}
.search input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.topbar .search { margin-right: auto; }
.main { grid-area: main; padding: 24px; max-width: 1280px; width: 100%; margin: 0 auto; min-width: 0; }
.mobile-only { display: none; }

/* ------------------------------------------------------------------ controls */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 14px; border-radius: 9px;
  border: 1px solid var(--line-strong); background: var(--surface);
  font-weight: 600; font-size: 13.5px; cursor: pointer; white-space: nowrap; text-decoration: none;
}
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { color: var(--bad); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; }
.btn svg { width: 16px; height: 16px; }
.btn.loading { pointer-events: none; opacity: .7; }
.btn.loading svg { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.icon-btn {
  position: relative; display: inline-grid; place-items: center;
  width: 38px; height: 38px; border-radius: 10px; border: 0; background: transparent; cursor: pointer; color: var(--muted);
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.badge-dot {
  position: absolute; top: 3px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700;
  display: grid; place-items: center; border: 2px solid var(--bg);
}
.field { display: grid; gap: 6px; }
.field > span { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.input, .field input, .field textarea, .field select {
  width: 100%; padding: 9px 11px; border-radius: 9px;
  border: 1px solid var(--line-strong); background: var(--surface);
}
.field textarea { min-height: 90px; resize: vertical; }
.input:focus, .field input:focus, .field textarea:focus, .field select:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  height: 32px; padding: 0 12px; border-radius: 16px; border: 1px solid var(--line-strong);
  background: var(--surface); cursor: pointer; font-size: 13px; font-weight: 550; color: var(--muted);
}
.chip.active { background: var(--text); color: var(--bg); border-color: var(--text); }
.switch { position: relative; display: inline-block; width: 38px; height: 22px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; border-radius: 11px; background: var(--line-strong); transition: .15s; cursor: pointer; }
.switch span::before { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; border-radius: 50%; background: #fff; transition: .15s; box-shadow: 0 1px 2px #0003; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::before { transform: translateX(16px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
input[type="range"] { accent-color: var(--accent); width: 100%; }
input[type="checkbox"] { accent-color: var(--accent); width: 16px; height: 16px; }

/* ------------------------------------------------------------------ cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.card-head .count { color: var(--faint); font-weight: 500; }
.card-body { padding: 16px; }
.card-body.flush { padding: 0; }
.empty { padding: 28px 16px; text-align: center; color: var(--muted); }
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head p { margin: 2px 0 0; color: var(--muted); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { padding: 14px 16px; text-decoration: none; display: block; }
.stat .label { font-size: 12.5px; color: var(--muted); font-weight: 550; }
.stat .value { font-size: 28px; font-weight: 750; letter-spacing: -0.03em; line-height: 1.2; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat.accent .value { color: var(--accent-text); }
.stat.good .value { color: var(--good); }
.stat.bad .value { color: var(--bad); }
a.stat:hover { border-color: var(--line-strong); }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.grid-side { display: grid; grid-template-columns: minmax(0, 340px) minmax(0, 1fr); gap: 20px; align-items: start; }

/* ------------------------------------------------------------------ avatars + badges */
.avatar { width: 40px; height: 40px; border-radius: 9px; object-fit: cover; background: var(--surface-2); flex: none; }
.avatar.sm { width: 30px; height: 30px; border-radius: 7px; }
.avatar.lg { width: 84px; height: 84px; border-radius: 14px; }
.avatar-wrap { position: relative; flex: none; }
.avatar-wrap .presence {
  position: absolute; right: -3px; bottom: -3px; width: 13px; height: 13px; border-radius: 50%;
  border: 2.5px solid var(--surface); background: var(--faint);
}
.presence.online { background: var(--good); }
.presence.rust { background: var(--accent); }
.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 6px;
  font-size: 11.5px; font-weight: 650; white-space: nowrap; background: var(--surface-2); color: var(--muted);
}
.badge.rust { background: var(--accent-soft); color: var(--accent-text); }
.badge.online { background: var(--good-soft); color: var(--good); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tag { display: inline-block; padding: 1px 7px; border-radius: 5px; font-size: 11.5px; background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); }

/* ------------------------------------------------------------------ player list */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.toolbar .input { max-width: 300px; height: 36px; }
.player-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 12px; }
.player-card { display: flex; flex-direction: column; gap: 10px; padding: 14px; text-decoration: none; transition: border-color .12s, transform .12s; }
.player-card:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.player-card .name { font-weight: 650; font-size: 15px; }
.player-card .sub { font-size: 12.5px; color: var(--muted); }
.player-card .badges { display: flex; gap: 6px; flex-wrap: wrap; }
.player-card .foot { display: flex; justify-content: space-between; font-size: 12px; color: var(--faint); border-top: 1px solid var(--line); padding-top: 9px; }

.list { display: grid; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 11px 16px; border-bottom: 1px solid var(--line); text-decoration: none; min-width: 0; }
.list-item:last-child { border-bottom: 0; }
a.list-item:hover { background: var(--surface-2); }
.list-item .body { flex: 1; min-width: 0; }
.list-item .title { font-weight: 600; }

/* ------------------------------------------------------------------ events */
.event { display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); align-items: flex-start; }
.event:last-child { border-bottom: 0; }
.event.unread { background: color-mix(in srgb, var(--accent-soft) 45%, transparent); }
.event .ico { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; flex: none; font-size: 15px; }
.event .body { flex: 1; min-width: 0; }
.event .who { font-weight: 650; text-decoration: none; }
.event .who:hover { text-decoration: underline; }
.event .what { color: var(--muted); }
.event .detail { margin-top: 3px; overflow-wrap: anywhere; }
.event .time { font-size: 12px; color: var(--faint); white-space: nowrap; }
.event s { color: var(--faint); }
.cat-profile { background: var(--info-soft); color: var(--info); }
.cat-presence { background: var(--good-soft); color: var(--good); }
.cat-rust { background: var(--accent-soft); color: var(--accent-text); }
.cat-bans { background: var(--bad-soft); color: var(--bad); }
.cat-friends { background: var(--surface-2); color: var(--muted); }
.cat-alts { background: var(--warn-soft); color: var(--warn); }
.ev-avatars { display: flex; align-items: center; gap: 8px; margin-top: 4px; }

/* ------------------------------------------------------------------ player detail */
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); text-decoration: none; font-weight: 550; margin-bottom: 14px; }
.back:hover { color: var(--text); }
.profile-head { display: flex; gap: 18px; padding: 20px; align-items: flex-start; flex-wrap: wrap; }
.profile-head .info { flex: 1; min-width: 220px; display: grid; gap: 6px; }
.profile-head h1 { overflow-wrap: anywhere; }
.profile-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.id-row { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.id-row button { border: 0; background: none; cursor: pointer; color: var(--faint); padding: 2px; display: grid; }
.id-row button:hover { color: var(--text); }
.id-row svg { width: 14px; height: 14px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; font-weight: 550; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.history-names { display: grid; }
.history-names .item { display: flex; justify-content: space-between; gap: 12px; padding: 8px 16px; border-bottom: 1px solid var(--line); }
.history-names .item:last-child { border-bottom: 0; }
.history-names .item.current .n { font-weight: 700; }
.avatar-strip { display: flex; gap: 8px; flex-wrap: wrap; }
.avatar-strip figure { margin: 0; display: grid; gap: 3px; justify-items: center; font-size: 11px; color: var(--faint); }
.avatar-strip img { width: 52px; height: 52px; border-radius: 9px; object-fit: cover; }

.alt { padding: 14px 16px; border-bottom: 1px solid var(--line); display: grid; gap: 10px; }
.alt:last-child { border-bottom: 0; }
.alt.dismissed { opacity: .55; }
.alt.confirmed { background: color-mix(in srgb, var(--bad-soft) 50%, transparent); }
.score { display: flex; align-items: center; gap: 8px; min-width: 110px; }
.score-bar { flex: 1; height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.score-bar i { display: block; height: 100%; border-radius: 3px; }
.score b { font-variant-numeric: tabular-nums; font-size: 13px; width: 34px; text-align: right; }
.reasons { margin: 0; padding: 0; list-style: none; display: grid; gap: 3px; font-size: 13px; color: var(--muted); }
.reasons li { display: flex; gap: 8px; }
.reasons li b { color: var(--text); font-variant-numeric: tabular-nums; min-width: 30px; }
.notes-form { display: grid; gap: 12px; }

/* ------------------------------------------------------------------ servers + maps */
.server-card { display: grid; grid-template-columns: 176px minmax(0, 1fr); gap: 18px; padding: 16px; margin-bottom: 20px; align-items: start; }
.server-card.big { grid-template-columns: minmax(0, 300px) minmax(0, 1fr); }
.map-link { display: block; border-radius: 10px; }
.map-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.map-thumb {
  width: 100%; max-width: 100%; aspect-ratio: 1; border-radius: 10px; object-fit: cover; display: block;
  background: var(--surface-2); border: 1px solid var(--line);
}
.map-link:hover .map-thumb { border-color: var(--line-strong); filter: brightness(1.05); }
.map-missing { display: grid; place-items: center; color: var(--faint); font-size: 12px; text-align: center; padding: 8px; line-height: 1.35; }
.map-thumb.xs { width: 38px; height: 38px; flex: none; border-radius: 7px; padding: 0; }
.server-info { display: grid; gap: 8px; min-width: 0; }
.server-info h2 { font-size: 19px; overflow-wrap: anywhere; text-wrap: balance; }
.server-info h2 a { text-decoration: none; }
.server-info h2 a:hover { text-decoration: underline; }
.server-info .hint { margin: 0; }
.eyebrow { font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--accent-text); }
.facts { display: flex; flex-wrap: wrap; gap: 8px 22px; font-size: 13px; }
.facts div { display: grid; gap: 1px; }
.facts span { color: var(--muted); font-size: 11.5px; }
.facts b { font-weight: 600; font-variant-numeric: tabular-nums; }
.server-hidden { margin-bottom: 20px; }
.server-about { overflow: hidden; }
.server-banner { width: 100%; max-height: 220px; object-fit: cover; display: block; border-bottom: 1px solid var(--line); }
.server-about summary { cursor: pointer; font-weight: 600; }
.server-desc { white-space: pre-wrap; overflow-wrap: anywhere; margin: 10px 0 0; color: var(--muted); max-width: 75ch; }
.server-hidden .hint { margin-top: 4px; }
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 4px 0 10px; }
.server-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; margin-bottom: 24px; }
.server-tile { display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 12px; padding: 12px; text-decoration: none; align-items: center; }
.server-tile:hover { border-color: var(--line-strong); }
.server-tile .body { display: grid; gap: 4px; min-width: 0; }
.server-tile .title { font-weight: 650; }
.avatars-row { display: flex; align-items: center; gap: 0; }
.avatars-row .avatar { width: 24px; height: 24px; border-radius: 6px; margin-right: -5px; border: 2px solid var(--surface); }
.avatars-row .small { margin-left: 12px; color: var(--accent-text); font-weight: 600; }
.sub-head { padding: 10px 16px 6px; font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); border-top: 1px solid var(--line); }
.session { display: flex; gap: 12px; align-items: center; padding: 9px 16px; border-bottom: 1px solid var(--line); min-width: 0; }
.session:last-child { border-bottom: 0; }
.session .body { flex: 1; min-width: 0; }
.session a { text-decoration: none; }
.session a:hover { text-decoration: underline; }
.player-card .sub svg { width: 13px; height: 13px; vertical-align: -2px; }

/* ------------------------------------------------------------------ BattleMetrics */
.bm-body { display: grid; gap: 14px; }
.bm-status { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sub-label { font-size: 12px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 6px; }
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.coplay-row { display: grid; gap: 5px; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.coplay-row:last-child { border-bottom: 0; }
.bm-link { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; font-size: 13px; }
.bm-link a { text-decoration: none; }
.bm-link a:hover { text-decoration: underline; }
.avatar.xs-av { width: 22px; height: 22px; border-radius: 5px; }
.bm-foot { padding: 8px 16px 14px; margin: 0; border-top: 1px solid var(--line); }
.bm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 1px; background: var(--line); }
.bm-player { display: grid; gap: 5px; padding: 10px 14px; background: var(--surface); min-width: 0; }
.bm-player.tracked { background: color-mix(in srgb, var(--accent-soft) 60%, var(--surface)); }

/* ------------------------------------------------------------------ settings */
.settings-table { width: 100%; border-collapse: collapse; }
.settings-table th, .settings-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); }
.settings-table th { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.settings-table td.c, .settings-table th.c { text-align: center; }
.settings-table tr:last-child td { border-bottom: 0; }
.seg { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); }
.seg button { border: 0; background: none; padding: 6px 14px; border-radius: 7px; cursor: pointer; font-weight: 600; font-size: 13px; color: var(--muted); }
.seg button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.setting-row { display: flex; align-items: center; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.setting-row:last-child { border-bottom: 0; }
.setting-row .t { flex: 1; min-width: 200px; }
.setting-row .t p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }

/* ------------------------------------------------------------------ overlays */
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 100; display: grid; gap: 8px; width: min(360px, calc(100vw - 32px)); }
.toast {
  display: flex; gap: 11px; align-items: flex-start; padding: 12px 14px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-lg);
  animation: toast-in .22s ease-out; cursor: pointer;
}
.toast.out { animation: toast-out .2s ease-in forwards; }
.toast .body { flex: 1; min-width: 0; font-size: 13.5px; }
.toast .body b { display: block; }
.toast.error { border-color: var(--bad); }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px) scale(.98); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(20px); } }

.drawer { position: fixed; inset: 0; z-index: 90; }
.drawer-backdrop { position: absolute; inset: 0; background: #0005; animation: fade .15s; }
.drawer-panel {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(420px, 100vw);
  background: var(--surface); border-left: 1px solid var(--line); box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; animation: slide .2s ease-out;
}
.drawer-panel header { display: flex; align-items: center; gap: 8px; padding: 12px 12px 12px 18px; border-bottom: 1px solid var(--line); }
.drawer-panel header h2 { flex: 1; }
.drawer-list { flex: 1; overflow-y: auto; }
.drawer-panel footer { padding: 12px 18px; border-top: 1px solid var(--line); }
.drawer-panel footer a { color: var(--accent-text); text-decoration: none; font-weight: 600; }
@keyframes fade { from { opacity: 0; } }
@keyframes slide { from { transform: translateX(30px); opacity: 0; } }

.modal { position: fixed; inset: 0; z-index: 95; display: grid; place-items: center; padding: 16px; background: #0006; animation: fade .15s; }
.modal-card { width: min(520px, 100%); max-height: calc(100dvh - 32px); overflow: auto; background: var(--surface); border-radius: 14px; border: 1px solid var(--line); box-shadow: var(--shadow-lg); }
.modal-card header { display: flex; align-items: center; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.modal-card header h2 { flex: 1; font-size: 16px; }
.modal-card .content { padding: 18px; display: grid; gap: 14px; }
.modal-card footer { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 18px; border-top: 1px solid var(--line); }
.preview { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 10px; background: var(--surface-2); min-height: 52px; }
.form-error { color: var(--bad); margin: 0; font-size: 13px; }
.hint { font-size: 12.5px; color: var(--muted); margin: 0; }

.audio-hint {
  position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 80;
  padding: 8px 14px; border-radius: 20px; background: var(--text); color: var(--bg); font-size: 13px; font-weight: 600;
  box-shadow: var(--shadow-lg); cursor: pointer;
}

.login {
  min-height: 100vh; min-height: 100dvh; padding: 40px 24px;
  background:
    radial-gradient(900px 500px at 0% 0%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 70%),
    radial-gradient(700px 500px at 100% 100%, color-mix(in srgb, var(--warn) 10%, transparent), transparent 70%),
    var(--bg);
}
.splash {
  max-width: 1120px; margin: 0 auto; display: grid; gap: 28px 48px; align-items: start;
  grid-template-columns: minmax(0, 1fr) minmax(0, 390px);
  grid-template-areas: "hero card" "features card" "foot foot";
}
.splash-hero { grid-area: hero; display: grid; gap: 20px; padding-top: 12px; }
.splash-brand { display: flex; align-items: center; gap: 16px; }
.splash-brand img { width: 72px; height: 72px; flex: none; filter: drop-shadow(0 6px 14px rgba(40, 25, 10, .25)); }
.splash-brand h1 { font-size: clamp(30px, 4vw, 42px); font-weight: 800; letter-spacing: -0.03em; }
.splash-brand .tagline { margin: 2px 0 0; color: var(--accent-text); font-weight: 650; font-size: 16px; }
.splash-lead { margin: 0; font-size: 16.5px; line-height: 1.6; color: var(--muted); max-width: 60ch; }
.splash-preview { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; max-width: 620px; }
.preview-head { display: flex; align-items: center; gap: 8px; padding: 10px 16px; font-size: 12.5px; font-weight: 650; color: var(--muted); border-bottom: 1px solid var(--line); text-transform: uppercase; letter-spacing: .05em; }
.splash-preview .event { padding: 10px 16px; }
.login-card { grid-area: card; position: sticky; top: 24px; }
.splash-features { grid-area: features; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 18px 24px; }
.feature { display: flex; gap: 12px; align-items: flex-start; }
.feature svg { width: 22px; height: 22px; color: var(--accent); margin-top: 2px; }
.feature h3 { font-size: 14.5px; margin-bottom: 3px; }
.feature p { margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.5; }
.splash-foot { grid-area: foot; display: flex; flex-wrap: wrap; gap: 6px 18px; justify-content: center; font-size: 12.5px; color: var(--faint); padding-top: 8px; border-top: 1px solid var(--line); }
.signup-note { text-align: center; margin: 2px 0 0; }
@media (max-width: 860px) {
  .login { padding: 24px 16px; }
  .splash { grid-template-columns: minmax(0, 1fr); grid-template-areas: "hero" "card" "features" "foot"; gap: 24px; }
  .login-card { position: static; width: 100%; max-width: 440px; justify-self: center; }
  .splash-preview { display: none; }
  .splash-brand img { width: 56px; height: 56px; }
}
.login-card { display: grid; gap: 14px; padding: 26px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg); }
.gate-form { display: grid; gap: 14px; }
.gate-form h2 { font-size: 16px; }
.gate-form .hint code, .hint code { font-family: var(--mono); font-size: .92em; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }
.version-tag { font-family: var(--mono); font-size: 11.5px; color: var(--faint); text-decoration: none; margin: 0; text-align: center; }
a.version-tag:hover { color: var(--muted); }
.account-btn {
  display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 12px 0 10px; margin-left: 4px;
  border: 1px solid var(--line); border-radius: 18px; background: var(--surface); cursor: pointer; font-weight: 600; font-size: 13px; max-width: 180px;
}
.account-btn:hover { border-color: var(--line-strong); }
.account-btn svg { width: 16px; height: 16px; color: var(--muted); }
.account-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.role { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 5px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.role.admin { background: var(--accent-soft); color: var(--accent-text); }
.role.member { background: var(--surface-2); color: var(--muted); }
.user-row { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.user-row:last-child { border-bottom: 0; }
.user-row .body { flex: 1; min-width: 200px; display: grid; gap: 3px; }
.user-row .name { font-weight: 650; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.user-row.disabled .name > span:first-child { color: var(--faint); text-decoration: line-through; }
.user-row .actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.user-row select { height: 30px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--surface); padding: 0 8px; font-size: 12.5px; }
.secret-box { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-radius: 10px; background: var(--surface-2); border: 1px dashed var(--line-strong); }
.secret-box code { font-family: var(--mono); font-size: 17px; font-weight: 600; letter-spacing: .03em; flex: 1; user-select: all; overflow-wrap: anywhere; }
.audit-row { display: flex; gap: 12px; padding: 9px 16px; border-bottom: 1px solid var(--line); font-size: 13px; align-items: baseline; }
.audit-row:last-child { border-bottom: 0; }
.audit-row .time { margin-left: auto; color: var(--faint); font-size: 12px; white-space: nowrap; }

.skeleton { height: 120px; border-radius: var(--radius); background: linear-gradient(90deg, var(--surface) 0%, var(--surface-2) 50%, var(--surface) 100%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border: 1px solid var(--line); }
@keyframes shimmer { to { background-position: -200% 0; } }
.banner { padding: 10px 14px; border-radius: 10px; background: var(--warn-soft); color: var(--warn); font-size: 13.5px; margin-bottom: 16px; font-weight: 550; }

/* ------------------------------------------------------------------ responsive */
@media (max-width: 1000px) {
  .grid-side, .grid-2 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; grid-template-rows: auto 1fr auto; grid-template-areas: "top" "main" "side"; }
  .sidebar {
    position: fixed; top: auto; bottom: 0; left: 0; right: 0; height: auto; z-index: 30;
    flex-direction: row; padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    border-right: 0; border-top: 1px solid var(--line);
  }
  .sidebar > .brand, .sidebar-foot { display: none; }
  .nav { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: 1fr; width: 100%; }
  .account-btn span { display: none; }
  .account-btn { padding: 0 9px; }
  .nav a { flex-direction: column; gap: 3px; font-size: 11px; padding: 6px 4px; justify-content: center; }
  .nav a svg { width: 20px; height: 20px; }
  .topbar { padding: 8px 12px; flex-wrap: wrap; row-gap: 8px; }
  .topbar .brand { padding: 0; margin-right: auto; }
  .topbar .search { order: 3; max-width: none; flex-basis: 100%; }
  .mobile-only { display: flex; }
  .main { padding: 16px 16px calc(84px + env(safe-area-inset-bottom)); }
  h1 { font-size: 20px; }
  .stats { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat .value { font-size: 24px; }
  .player-grid { grid-template-columns: 1fr; }
  .server-card, .server-card.big { grid-template-columns: minmax(0, 1fr); }
  .server-card .map-link, .server-card > .map-thumb { max-width: 280px; }
  .server-grid { grid-template-columns: minmax(0, 1fr); }
  .nav a { font-size: 10.5px; }
  .profile-head { padding: 16px; }
  .avatar.lg { width: 64px; height: 64px; }
  .toasts { bottom: calc(76px + env(safe-area-inset-bottom)); right: 12px; width: calc(100vw - 24px); }
  .settings-table th, .settings-table td { padding: 8px 6px; }
  .toolbar .input { max-width: none; flex-basis: 100%; }
}
/* ---- teams */
.bm-player[hidden] { display: none; }
.bm-filter { padding: 10px 14px; border-bottom: 1px solid var(--line); }
.bm-filter .input { width: 100%; height: 36px; }
.team-tag { display: inline-flex; align-items: center; gap: 4px; color: var(--accent-text); background: var(--accent-soft); border-color: transparent; text-decoration: none; }
.team-tag svg { width: 12px; height: 12px; }
.team-card .card-head select { width: auto; max-width: 52%; height: 32px; padding: 0 28px 0 10px; font-size: 13px; }
.mates { display: grid; }
.mate { display: flex; align-items: center; gap: 10px; padding: 9px 16px; border-bottom: 1px solid var(--line); cursor: pointer; min-width: 0; }
.mate:hover { background: var(--surface-2); }
.mate.off { cursor: default; }
.mate.off .body { opacity: .75; }
.mate input[type=checkbox] { width: 18px; height: 18px; flex: none; accent-color: var(--accent); }
.mate .body { flex: 1; min-width: 0; }
.mate .badge { margin-left: 4px; vertical-align: 1px; text-decoration: none; }
.mates-foot { display: flex; align-items: center; gap: 10px; padding: 10px 16px; flex-wrap: wrap; }
.mates-foot .btn[disabled] { opacity: .5; cursor: not-allowed; }
.team-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 12px; }
.team-tile { display: grid; gap: 10px; padding: 14px 16px; text-decoration: none; color: inherit; }
.team-tile:hover { border-color: var(--accent); }
.team-tile .title { font-weight: 700; font-size: 15.5px; }
.team-faces { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.list.bordered { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.list-item.cand .btn { flex: none; }
@media (max-width: 760px) {
  .hide-sm { display: none; }
  .team-grid { grid-template-columns: minmax(0, 1fr); }
  .team-card .card-head select { max-width: 60%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition: none !important; }
}
