/* ==========================================================================
   CS 1.6 platform — visual system
   --------------------------------------------------------------------------
   Layout: a sticky left sidebar plus a scrolling content column, with an
   optional right rail on dashboard-style pages.

   Every colour and the corner radius are CSS custom properties, so a player's
   saved theme overrides the whole site by setting six variables on <html>.
   Only system fonts are used: no webfont request blocks the first paint.
   ========================================================================== */

:root {
  /* ---- themable: overridden per user from UserSettings.as_css_variables() */
  --bg: #0d0e11;
  --surface: #17191d;
  --accent: #4ade80;
  --primary: #f2f4f7;
  --secondary: #8b919c;
  --text: #e9ebef;
  --radius: 14px;

  /* ---- derived, so the whole palette stays coherent from those six */
  --surface-2: color-mix(in srgb, var(--surface) 88%, white 5%);
  --surface-3: color-mix(in srgb, var(--surface) 74%, white 9%);
  --elevated: color-mix(in srgb, var(--surface) 60%, var(--bg) 40%);
  --line: color-mix(in srgb, var(--text) 10%, transparent);
  --line-strong: color-mix(in srgb, var(--text) 18%, transparent);
  --muted: color-mix(in srgb, var(--text) 62%, transparent);
  --muted-2: color-mix(in srgb, var(--text) 42%, transparent);

  --accent-soft: color-mix(in srgb, var(--accent) 14%, transparent);
  --accent-glow: color-mix(in srgb, var(--accent) 34%, transparent);
  --accent-line: color-mix(in srgb, var(--accent) 42%, transparent);
  /* Readable text on top of a solid --accent fill. */
  --on-accent: #08130c;

  --ok: #4ade80;
  --warn: #f5a524;
  --danger: #f4536a;
  --gold: #f2c14e;
  --silver: #c7cbd1;
  --bronze: #cd8b52;

  --radius-sm: max(4px, calc(var(--radius) * 0.45));
  --radius-lg: calc(var(--radius) * 1.3);
  --radius-pill: 999px;

  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Mono",
    Consolas, "Liberation Mono", monospace;
  --font-emoji: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji",
    "Segoe UI Symbol";

  --sidebar-width: 262px;
  --topbar-height: 64px;
  --gap: 18px;
  --content-max: 1500px;

  --shadow-card: 0 1px 0 color-mix(in srgb, white 4%, transparent) inset,
    0 16px 34px -26px rgba(0, 0, 0, 0.85);
  --shadow-pop: 0 20px 50px -18px rgba(0, 0, 0, 0.75);
}

/* Fallback for engines without color-mix(): flat, still readable values. */
@supports not (color: color-mix(in srgb, red 50%, blue)) {
  :root {
    --surface-2: #1e2126;
    --surface-3: #262a30;
    --elevated: #131519;
    --line: rgba(233, 235, 239, 0.1);
    --line-strong: rgba(233, 235, 239, 0.18);
    --muted: rgba(233, 235, 239, 0.62);
    --muted-2: rgba(233, 235, 239, 0.42);
    --accent-soft: rgba(74, 222, 128, 0.14);
    --accent-glow: rgba(74, 222, 128, 0.34);
    --accent-line: rgba(74, 222, 128, 0.42);
  }
}

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

body {
  margin: 0;
  min-height: calc(100vh * var(--vz));
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* ----- background layers ------------------------------------------------ */

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
}

body[data-pattern="glow"]::before {
  background-image: radial-gradient(
      780px 420px at 8% -6%,
      var(--accent-soft),
      transparent 68%
    ),
    radial-gradient(
      680px 400px at 96% 2%,
      color-mix(in srgb, var(--secondary) 12%, transparent),
      transparent 70%
    );
}

body[data-pattern="grid"]::before {
  background-image: linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 54px 54px;
  opacity: 0.55;
  mask-image: radial-gradient(circle at 50% 0%, black, transparent 76%);
}

body[data-pattern="noise"]::before {
  opacity: 0.05;
  /* Inline SVG turbulence: no extra request, no binary asset to ship. */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Shipped photographs, offered next to the drawn patterns. Fixed and dimmed
   for the same reason a player's own upload is: the page is read on top of
   it, and a background at full strength is a background nobody can read
   over. `cover` on a fixed layer keeps the framing identical whether the
   page is one screen long or twenty. */
body[data-pattern="photo"]::before,
body[data-pattern="maps"]::before {
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  opacity: 0.18;
}

body[data-pattern="photo"]::before {
  background-image: url("../img/bg/collage.7d12f28fe40d.jpg");
}

body[data-pattern="maps"]::before {
  background-image: url("../img/bg/maps.97099df602ba.jpg");
}

/* A picture the player uploaded themselves wins over any of the above: it is
   the more specific rule and the later one. */
body.has-bg-image::before {
  background-image: var(--user-bg-image);
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  opacity: 0.2;
}

/* ----- app shell -------------------------------------------------------- */

.shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: calc(100vh * var(--vz));
}

.content {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* Drawer backdrop. Fixed and hidden at every width so it never claims a grid
   cell on desktop — the mobile query only switches it on. */
.scrim {
  position: fixed;
  inset: 0;
  z-index: 75;
  display: none;
  background: rgba(0, 0, 0, 0.55);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.content-inner {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 24px 28px 96px;
}

body[data-layout="boxed"] {
  --content-max: 1200px;
}
body[data-layout="compact"] {
  --content-max: 1040px;
  --gap: 13px;
  font-size: 13.5px;
}

/* ----- sidebar ---------------------------------------------------------- */

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: calc(100vh * var(--vz));
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px 14px;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: color-mix(in srgb, var(--surface) 55%, var(--bg));
  border-right: 1px solid var(--line);
  scrollbar-width: thin;
}

.sidebar::-webkit-scrollbar {
  width: 6px;
}
.sidebar::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: 99px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 6px 8px 16px;
  color: var(--text);
  font-weight: 800;
  font-size: 16px;
  letter-spacing: 0.01em;
}

.brand:hover {
  color: var(--text);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  color: var(--on-accent);
  background: var(--accent);
  border-radius: var(--radius-sm);
  box-shadow: 0 0 20px -6px var(--accent-glow);
}

.brand-mark svg {
  width: 21px;
  height: 21px;
}

.brand-text {
  display: grid;
  line-height: 1.15;
}

.brand-text b {
  font-weight: 800;
}

/* Tagline under the wordmark: present for search engines and orientation,
   quiet enough that the name still reads as the logo. */
.brand-text i {
  font-style: normal;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted-2);
}

.nav-group {
  display: grid;
  gap: 2px;
}

.nav-label {
  padding: 14px 10px 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted-2);
}

.nav-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--muted);
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-link:hover {
  color: var(--text);
  background: var(--surface-2);
}

/* Per-server entries under Статистика. Indented and quieter than a nav-link:
 * they belong to the item above rather than competing with it. */
.nav-sub {
  display: grid;
  gap: 1px;
  margin: 1px 0 3px 20px;
  padding-left: 10px;
  border-left: 1px solid var(--line);
}

.nav-sub-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 9px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-sub-link:hover {
  color: var(--text);
  background: var(--surface-2);
}

.nav-sub-link.is-active {
  color: var(--text);
  background: var(--accent-soft);
}

.nav-sub-link .dot {
  flex: none;
}

.nav-link.is-active {
  color: var(--text);
  background: var(--accent-soft);
}

.nav-link.is-active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
}

.nav-link.is-active .icon {
  color: var(--accent);
}

.nav-link .icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--muted-2);
}

.nav-link .count {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted-2);
}

.nav-link.is-danger:hover {
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 12%, transparent);
}
.nav-link.is-danger:hover .icon {
  color: var(--danger);
}

.sidebar-foot {
  margin-top: auto;
  padding-top: 14px;
  display: grid;
  gap: 10px;
}

.social-row {
  display: flex;
  gap: 8px;
}

.social-btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.social-btn:hover {
  color: var(--accent);
  border-color: var(--accent-line);
}

/* Кнопка без адреси. Пунктир і приглушений колір кажуть, що це не
   зламане посилання, а місце, яке ще не заповнили; курсор лишається
   звичайним, щоб рука не тягнулася натискати. */
.social-btn.is-soon {
  color: var(--muted-2);
  background: transparent;
  border-style: dashed;
  cursor: default;
}
.social-btn.is-soon:hover {
  color: var(--muted-2);
  border-color: var(--line);
}

.social-btn svg {
  width: 17px;
  height: 17px;
}

/* ----- topbar ----------------------------------------------------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  min-height: var(--topbar-height);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 28px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}

.topbar h1 {
  font-size: 17px;
  font-weight: 700;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-spacer {
  margin-left: auto;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  font-size: 12.5px;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  white-space: nowrap;
}

.pill b {
  color: var(--text);
  font-family: var(--font-mono);
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted-2);
  flex-shrink: 0;
}

.dot.is-on {
  background: var(--ok);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 20%, transparent);
}

.dot.is-off {
  background: var(--danger);
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.icon-btn:hover {
  color: var(--accent);
  border-color: var(--accent-line);
}

.icon-btn svg {
  width: 17px;
  height: 17px;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 4px 13px 4px 4px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.user-chip:hover {
  color: var(--text);
  border-color: var(--accent-line);
}

.sidebar-toggle {
  display: none;
}

/* ----- typography ------------------------------------------------------- */

h1,
h2,
h3,
h4 {
  margin: 0;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -0.01em;
}

h1 {
  font-size: clamp(24px, calc(3vw * var(--vz)), 32px);
}
h2 {
  font-size: 21px;
}
h3 {
  font-size: 15px;
}

p {
  margin: 0 0 1em;
}
p:last-child {
  margin-bottom: 0;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s ease, opacity 0.15s ease;
}
a:hover {
  opacity: 0.82;
}

.eyebrow {
  display: block;
  margin-bottom: 8px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
}

.muted {
  color: var(--muted);
}
.small {
  font-size: 12.5px;
}
.mono {
  font-family: var(--font-mono);
}
.text-right {
  text-align: right;
}
.text-center {
  text-align: center;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 22px;
  font-weight: 700;
}

.section-title .count-sup {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted-2);
  align-self: flex-start;
  margin-top: 3px;
}

.section-title .icon {
  width: 20px;
  height: 20px;
  color: var(--accent);
}

/* ----- layout helpers --------------------------------------------------- */

.stack {
  display: grid;
  gap: var(--gap);
}
.stack-lg {
  display: grid;
  gap: 30px;
}

.grid {
  display: grid;
  gap: var(--gap);
}
.grid-2 {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}
.grid-3 {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}
.grid-4 {
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

/* Dashboard: main column + right rail. */
.dash {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 22px;
  align-items: start;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
  gap: 22px;
  align-items: start;
}

.rail {
  display: grid;
  gap: 14px;
  position: sticky;
  top: calc(var(--topbar-height) + 18px);
}

/* ----- cards ------------------------------------------------------------ */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}

.card-pad {
  padding: 20px;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
}

.card-head h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14.5px;
}

.card-head h3 .icon {
  width: 17px;
  height: 17px;
  color: var(--accent);
}

.card-head .sup {
  font-size: 11px;
  color: var(--muted-2);
}

.card-body {
  padding: 18px;
}

.card-accent {
  position: relative;
  overflow: hidden;
}

.card-accent::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), transparent);
}

/* ----- server rows ------------------------------------------------------ */

.server-list {
  display: grid;
  /* Рядки заливаються при наведенні прямокутником, а кути в картки
     заокруглені — без обрізання заливка вилазила за них квадратним
     ріжком, і що більший радіус у темі, то помітніше. Радіус береться
     з тієї самої змінної, тож вони не розійдуться. */
  overflow: hidden;
  border-radius: var(--radius);
}

.server-row {
  display: grid;
  grid-template-columns: minmax(150px, 1.4fr) minmax(120px, 1fr) 96px 92px auto;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  transition: background 0.15s ease;
}

.server-row:last-child {
  border-bottom: none;
}

.server-row:hover {
  background: var(--surface-2);
}

.server-id .name {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.server-id .name:hover {
  color: var(--accent);
}

.server-id .addr {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--muted-2);
}

.map-chip {
  display: inline-block;
  max-width: 100%;
  padding: 7px 13px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  background: var(--elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Player count with a fill bar underneath, coloured by how full it is. */
.frac {
  display: grid;
  gap: 6px;
  justify-items: center;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--muted-2);
}

.frac b {
  color: var(--text);
}

.frac-bar {
  width: 100%;
  height: 3px;
  border-radius: 99px;
  background: var(--line-strong);
  overflow: hidden;
}

.frac-bar i {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: var(--accent);
}

.frac-bar i.is-warm {
  background: var(--warn);
}
.frac-bar i.is-full {
  background: var(--danger);
}

.status-cell {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
}

.status-cell.is-online {
  color: var(--ok);
}

.row-actions {
  display: flex;
  gap: 7px;
  justify-content: flex-end;
}

/* ----- ranked lists (top killers / top players) -------------------------- */

.rank-list {
  display: grid;
}

.rank-row {
  display: grid;
  grid-template-columns: 26px 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  transition: background 0.15s ease;
}

.rank-row:last-child {
  border-bottom: none;
}

.rank-row:hover {
  background: var(--surface-2);
}

/* The podium rows get a warm wash that fades out to the right. */
.rank-row.is-first {
  background: linear-gradient(
    90deg,
    color-mix(in srgb, var(--gold) 16%, transparent),
    transparent 78%
  );
}
.rank-row.is-second {
  background: linear-gradient(
    90deg,
    color-mix(in srgb, var(--silver) 12%, transparent),
    transparent 78%
  );
}
.rank-row.is-third {
  background: linear-gradient(
    90deg,
    color-mix(in srgb, var(--bronze) 14%, transparent),
    transparent 78%
  );
}

.rank-badge {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 700;
  color: var(--muted-2);
  background: var(--elevated);
  border-radius: 50%;
}

.rank-row.is-first .rank-badge {
  color: #241a00;
  background: var(--gold);
}
.rank-row.is-second .rank-badge {
  color: #1a1c1f;
  background: var(--silver);
}
.rank-row.is-third .rank-badge {
  color: #1d0f04;
  background: var(--bronze);
}

.rank-who {
  min-width: 0;
}

.rank-who .name {
  display: block;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rank-row.is-first .rank-who .name {
  color: var(--gold);
}

.rank-who .name:hover {
  color: var(--accent);
}

.rank-who .sub {
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--muted-2);
}

.rank-who .sub svg {
  width: 12px;
  height: 12px;
}

.rank-values {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 13px;
}

.value-chip {
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  background: var(--elevated);
  border: 1px solid var(--line);
  color: var(--text);
  white-space: nowrap;
}

.value-chip.is-accent {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: var(--accent-line);
}

.value-muted {
  color: var(--muted-2);
  font-style: italic;
}

/* ----- stat tiles ------------------------------------------------------- */

.tile {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 17px 19px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}

.tile-label {
  display: block;
  font-size: 12px;
  color: var(--muted-2);
  margin-bottom: 4px;
}

.tile-value {
  font-family: var(--font-mono);
  font-size: 25px;
  font-weight: 700;
  line-height: 1.05;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.tile-value.is-plain {
  color: var(--text);
}

.tile .icon {
  width: 24px;
  height: 24px;
  color: var(--muted-2);
  flex-shrink: 0;
}

/* ----- profile / highlight cards in the rail ---------------------------- */

.profile-card {
  position: relative;
  padding: 18px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.profile-card::before {
  content: "";
  position: absolute;
  inset: -40% 40% 55% -10%;
  background: radial-gradient(circle, var(--accent-soft), transparent 70%);
  pointer-events: none;
}

.profile-card-head {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
}

.profile-card-head .who {
  min-width: 0;
}

.profile-card-head .who b {
  display: block;
  font-size: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.role-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 9px;
}

.highlight-card {
  position: relative;
  padding: 18px;
  border-radius: var(--radius);
  color: var(--on-accent);
  background: linear-gradient(
    135deg,
    var(--accent),
    color-mix(in srgb, var(--accent) 55%, var(--secondary))
  );
  overflow: hidden;
}

.highlight-card .label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  opacity: 0.72;
}

.highlight-card .amount {
  display: block;
  font-family: var(--font-mono);
  font-size: 30px;
  font-weight: 700;
  line-height: 1.1;
  margin: 4px 0 12px;
  font-variant-numeric: tabular-nums;
}

.highlight-card .btn {
  background: color-mix(in srgb, var(--on-accent) 82%, transparent);
  color: var(--accent);
  border-color: transparent;
}

.highlight-card .btn:hover {
  background: var(--on-accent);
  color: var(--accent);
}

.rail-list {
  display: grid;
  gap: 8px;
}

.rail-list a {
  color: var(--text);
  font-size: 13px;
}

/* ----- buttons ---------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 17px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  color: var(--on-accent);
  background: var(--accent);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.12s ease, box-shadow 0.15s ease, background 0.15s ease,
    border-color 0.15s ease, color 0.15s ease, opacity 0.15s ease;
}

.btn:hover {
  color: var(--on-accent);
  opacity: 1;
  transform: translateY(-1px);
  box-shadow: 0 10px 24px -14px var(--accent-glow);
}

.btn:active {
  transform: translateY(0);
}

.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn svg {
  width: 15px;
  height: 15px;
}

.btn-ghost {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--line);
}

.btn-ghost:hover {
  color: var(--text);
  background: var(--surface-3);
  border-color: var(--line-strong);
  box-shadow: none;
}

.btn-light {
  background: var(--primary);
  color: var(--bg);
}
.btn-light:hover {
  color: var(--bg);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover {
  color: #fff;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

.btn-lg {
  padding: 13px 24px;
  font-size: 14px;
}

.btn-block {
  width: 100%;
}

.btn-icon {
  padding: 8px;
  width: 34px;
  height: 34px;
}

.btn[disabled],
.btn.is-disabled {
  opacity: 0.45;
  pointer-events: none;
}

body[data-buttons="pill"] .btn {
  border-radius: var(--radius-pill);
}
body[data-buttons="sharp"] .btn {
  border-radius: 2px;
}
body[data-buttons="outline"] .btn {
  background: transparent;
  color: var(--accent);
  border-color: var(--accent-line);
}
body[data-buttons="outline"] .btn:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.btn-steam {
  background: #1b2838;
  color: #fff;
  border-color: #2a475e;
}
.btn-steam:hover {
  color: #fff;
  background: #22384f;
}

.btn-google {
  background: #fff;
  color: #1f1f1f;
  border-color: #dadce0;
}
.btn-google:hover {
  color: #1f1f1f;
  background: #f4f5f7;
}

/* ----- badges ----------------------------------------------------------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  font-size: 11px;
  font-weight: 700;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line-strong);
  color: var(--muted);
  background: var(--elevated);
  white-space: nowrap;
}

.badge-on {
  color: var(--ok);
  border-color: color-mix(in srgb, var(--ok) 38%, transparent);
  background: color-mix(in srgb, var(--ok) 12%, transparent);
}

.badge-off {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 38%, transparent);
  background: color-mix(in srgb, var(--danger) 12%, transparent);
}

.badge-warn {
  color: var(--warn);
  border-color: color-mix(in srgb, var(--warn) 38%, transparent);
  background: color-mix(in srgb, var(--warn) 12%, transparent);
}

.badge-accent {
  color: var(--accent);
  border-color: var(--accent-line);
  background: var(--accent-soft);
}

.badge-vip {
  color: var(--gold);
  border-color: color-mix(in srgb, var(--gold) 42%, transparent);
  background: color-mix(in srgb, var(--gold) 12%, transparent);
}

/* ----- avatars ---------------------------------------------------------- */

.avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface-3);
  flex-shrink: 0;
}

/* Shown when a player has no avatar: their initial instead of an empty disc. */
.avatar-fallback {
  display: inline-grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  color: var(--muted);
  background: var(--surface-3);
  border: 1px solid var(--line);
  user-select: none;
}

.avatar-md {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
}

.avatar-lg {
  width: 92px;
  height: 92px;
  border-radius: var(--radius);
  border: 2px solid var(--line-strong);
}

.avatar-fallback.avatar-md {
  font-size: 17px;
}
.avatar-fallback.avatar-lg {
  font-size: 34px;
  color: var(--accent);
}

/* ----- home: "play now" hero ------------------------------------------- */

.hero-play {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 18px 28px;
  padding: 26px 28px;
  border: 1px solid var(--accent-line, var(--line-strong));
  border-radius: var(--radius);
  background:
    radial-gradient(120% 140% at 0% 0%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 60%),
    var(--surface);
  box-shadow: var(--shadow-card);
}
.hero-play h1 {
  margin: 4px 0 6px;
  font-size: clamp(22px, calc(2.2vw * var(--vz)), 30px);
  line-height: 1.15;
}
.hero-play p {
  margin: 0;
  font-size: 14px;
}
.hero-online {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 18px;
}
.hero-play-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* Counters in one row of four, not a wall of 2x2 boxes. */
.tiles-compact {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}
.tiles-compact .tile {
  padding: 13px 16px;
}
.tiles-compact .tile-value {
  font-size: 21px;
}

/* Three offers in one row down to ~800px of content, instead of 2 + 1. */
.services-row {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

/* ----- home rail: player of the day, recent games ----------------------- */

.potd {
  display: grid;
  gap: 6px;
  color: var(--text);
  text-decoration: none;
  border-color: var(--accent-line, var(--line-strong));
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 14%, transparent), transparent 70%),
    var(--surface);
}
.potd:hover {
  border-color: var(--accent);
}
.potd-name {
  font-size: 18px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.potd-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  font-size: 12px;
  color: var(--muted);
}
.potd-stats b {
  color: var(--accent);
  font-size: 15px;
}

.game-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2px 10px;
  color: var(--text);
  text-decoration: none;
}
.game-row:hover .game-who {
  color: var(--accent);
}
.game-who {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 600;
}
.game-row .muted {
  grid-column: 1 / -1;
}

/* Bots are shown next to the people, never counted as them. */
.bots-note {
  margin-left: 6px;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
}

/* The avatar on the profile page is its own upload button. */
.avatar-upload label {
  position: relative;
  display: inline-block;
  cursor: pointer;
}
.avatar-upload-hint {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  background: color-mix(in srgb, #000 55%, transparent);
  opacity: 0;
  transition: opacity 0.15s;
}
.avatar-upload label:hover .avatar-upload-hint,
.avatar-upload label:focus-within .avatar-upload-hint {
  opacity: 1;
}

/* ----- tables ----------------------------------------------------------- */

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  min-width: 620px;
}

table.data th {
  padding: 11px 14px;
  text-align: left;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted-2);
  background: var(--elevated);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

table.data th a {
  color: inherit;
}
table.data th a:hover,
table.data th a.is-active {
  color: var(--accent);
}

table.data td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

table.data tbody tr {
  transition: background 0.12s ease;
}

table.data tbody tr:hover {
  background: var(--surface-2);
}

table.data tbody tr:last-child td {
  border-bottom: none;
}

table.data .num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.rank {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 700;
  border-radius: 50%;
  background: var(--elevated);
  color: var(--muted);
}

.rank-1 {
  color: #241a00;
  background: var(--gold);
}
.rank-2 {
  color: #1a1c1f;
  background: var(--silver);
}
.rank-3 {
  color: #1d0f04;
  background: var(--bronze);
}

.player-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.player-cell .name {
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 220px;
}

.player-cell a.name:hover {
  color: var(--accent);
}

/* ----- shop ------------------------------------------------------------- */

.shop-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 15px;
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  transition: border-color 0.18s ease, transform 0.18s ease;
}

.shop-card:hover {
  border-color: var(--accent-line);
  transform: translateY(-2px);
}

.shop-card.is-featured {
  border-color: var(--accent-line);
}

.ribbon {
  position: absolute;
  top: 16px;
  right: 0;
  padding: 4px 12px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--on-accent);
  background: var(--accent);
  border-radius: var(--radius-pill) 0 0 var(--radius-pill);
}

.shop-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  font-size: 22px;
  line-height: 1;
  font-family: var(--font-emoji), var(--font-body);
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.price {
  display: flex;
  align-items: baseline;
  gap: 7px;
  font-family: var(--font-mono);
}

.price b {
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
  color: var(--accent);
}

.price span {
  font-size: 12px;
  color: var(--muted);
}

.feature-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
  font-size: 13px;
}

.feature-list li {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  color: var(--muted);
}

.feature-list li::before {
  content: "→";
  color: var(--accent);
  flex-shrink: 0;
}

.flag-chips {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

.flag-chip {
  display: grid;
  place-items: center;
  width: 23px;
  height: 23px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  border-radius: var(--radius-sm);
  cursor: help;
}

/* ----- forms ------------------------------------------------------------ */

.field {
  display: grid;
  gap: 7px;
  margin-bottom: 17px;
}

.field label,
.form-label {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="search"],
input[type="url"],
select,
textarea {
  width: 100%;
  padding: 10px 13px;
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--elevated);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

input[type="file"] {
  font-size: 13px;
  color: var(--muted);
}

textarea {
  resize: vertical;
  min-height: 92px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 14px;
}

.checkbox-row input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.help {
  font-size: 12px;
  color: var(--muted-2);
}

.errorlist {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 12px;
  color: var(--danger);
}

.color-input {
  width: 100%;
  height: 40px;
  padding: 3px;
  cursor: pointer;
  background: var(--elevated);
}

.range-input {
  width: 100%;
  accent-color: var(--accent);
}

.color-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 14px;
}

.filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.filters select,
.filters input {
  width: auto;
  min-width: 150px;
}

.chip-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chip {
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
}

.chip:hover {
  color: var(--text);
  opacity: 1;
}

.chip.is-active {
  color: var(--on-accent);
  background: var(--accent);
  border-color: var(--accent);
}

/* ----- messages --------------------------------------------------------- */

.messages {
  display: grid;
  gap: 10px;
  margin-bottom: 20px;
}

.alert {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 13px 16px;
  font-size: 13.5px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-left: 3px solid var(--muted);
  border-radius: var(--radius-sm);
}

.alert-success {
  border-left-color: var(--ok);
}
.alert-error {
  border-left-color: var(--danger);
}
.alert-warning {
  border-left-color: var(--warn);
}
.alert-info {
  border-left-color: var(--accent);
}

/* ----- chat ------------------------------------------------------------- */

.chat-log {
  display: grid;
  gap: 12px;
  max-height: 520px;
  overflow-y: auto;
  padding: 18px;
}

.chat-msg {
  display: flex;
  gap: 11px;
  align-items: flex-start;
}

.chat-msg .body {
  flex: 1;
  min-width: 0;
}

.chat-msg .who {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
}

.chat-msg .when {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted-2);
  margin-left: 7px;
}

.chat-msg .text {
  font-size: 13.5px;
  overflow-wrap: anywhere;
}

.chat-form {
  display: flex;
  gap: 10px;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
}

/* ----- theme editor bar ------------------------------------------------- */

.theme-fab {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 60;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 17px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  background: var(--surface-3);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-pop);
  cursor: pointer;
  font-family: inherit;
}

.theme-fab:hover {
  color: var(--accent);
  border-color: var(--accent-line);
}

.theme-fab svg {
  width: 16px;
  height: 16px;
}

/* Only the icon until hovered: the full pill sat on top of the rail
   cards at common laptop widths. */
.theme-fab {
  padding: 11px;
}
.theme-fab-label {
  display: none;
}
.theme-fab:hover,
.theme-fab:focus-visible {
  padding: 11px 17px;
}
.theme-fab:hover .theme-fab-label,
.theme-fab:focus-visible .theme-fab-label {
  display: inline;
}

.theme-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 70;
  padding: 18px 24px 22px;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--line-strong);
  box-shadow: var(--shadow-pop);
  transform: translateY(110%);
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

.theme-bar.is-open {
  transform: translateY(0);
}

.theme-bar-inner {
  max-width: 1000px;
  margin: 0 auto;
  display: grid;
  gap: 16px;
  justify-items: center;
}

.preset-dots {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.preset-dot {
  width: 26px;
  height: 26px;
  padding: 0;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  background-clip: padding-box;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.preset-dot:hover {
  transform: scale(1.12);
}

.preset-dot.is-active {
  border-color: var(--text);
}

.swatch-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.swatch {
  display: grid;
  gap: 6px;
  justify-items: center;
}

.swatch-button {
  position: relative;
  min-width: 104px;
  padding: 12px 14px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--bg);
  background: var(--surface-3);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
  overflow: hidden;
}

.swatch-button input[type="color"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  border: none;
  padding: 0;
}

.contrast-badge {
  font-family: var(--font-mono);
  font-size: 10.5px;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  color: var(--ok);
  background: color-mix(in srgb, var(--ok) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--ok) 30%, transparent);
  white-space: nowrap;
}

.contrast-badge.is-aa {
  color: var(--warn);
  background: color-mix(in srgb, var(--warn) 14%, transparent);
  border-color: color-mix(in srgb, var(--warn) 30%, transparent);
}

.contrast-badge.is-fail {
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 14%, transparent);
  border-color: color-mix(in srgb, var(--danger) 30%, transparent);
}

.radius-control {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 220px;
  padding: 10px 16px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  color: var(--muted);
}

.radius-control input {
  flex: 1;
}

.radius-control output {
  font-family: var(--font-mono);
  color: var(--text);
  min-width: 42px;
  text-align: right;
}

.theme-bar-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
}

.theme-bar .locked-note {
  font-size: 12.5px;
  color: var(--muted);
  text-align: center;
}

/* ----- misc ------------------------------------------------------------- */

.empty {
  padding: 42px 20px;
  text-align: center;
  color: var(--muted);
}

.empty-icon {
  font-size: 32px;
  opacity: 0.5;
  margin-bottom: 10px;
  font-family: var(--font-emoji), var(--font-body);
}

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 20px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--muted);
}

.kv {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 18px;
  font-size: 13.5px;
}

.kv dt {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted-2);
  align-self: center;
}

.kv dd {
  margin: 0;
}

.divider {
  height: 1px;
  background: var(--line);
  margin: 20px 0;
  border: none;
}

.bar {
  position: relative;
  height: 6px;
  background: var(--elevated);
  border-radius: 99px;
  overflow: hidden;
  border: 1px solid var(--line);
}

.bar-fill {
  position: absolute;
  inset: 0 auto 0 0;
  background: var(--accent);
  border-radius: 99px;
  transition: width 0.4s ease;
}

.bar-fill.is-full {
  background: var(--danger);
}

.sparkline {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 54px;
}

.sparkline i {
  flex: 1;
  min-width: 2px;
  background: linear-gradient(180deg, var(--accent), var(--accent-soft));
  border-radius: 2px 2px 0 0;
}

.server-addr {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 11px;
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--elevated);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  color: var(--accent);
}

.copy-btn {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 0 2px;
  font-size: 12px;
  font-family: var(--font-mono);
}

.copy-btn:hover {
  color: var(--accent);
}

.server-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: var(--muted);
}

.profile-banner {
  height: 160px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: linear-gradient(
    120deg,
    var(--accent-soft),
    color-mix(in srgb, var(--secondary) 14%, transparent)
  );
  background-size: cover;
  background-position: center;
}

.profile-head {
  display: flex;
  align-items: flex-end;
  gap: 20px;
  margin-top: -44px;
  padding: 0 22px;
  position: relative;
}

.preview {
  display: grid;
  gap: 13px;
  padding: 18px;
}

.preview-swatches {
  display: flex;
  gap: 8px;
}

.preview-swatch {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
}

.preset-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(126px, 1fr));
  gap: 10px;
}

.preset {
  display: grid;
  gap: 8px;
  padding: 11px;
  text-align: left;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
}

.preset:hover {
  border-color: var(--accent-line);
}

.preset-dots-inline {
  display: flex;
  gap: 4px;
}

.preset-dots-inline i {
  width: 14px;
  height: 14px;
  border-radius: 3px;
}

.skip-link {
  position: absolute;
  left: -9999px;
}

.skip-link:focus {
  left: 8px;
  top: 8px;
  z-index: 100;
  padding: 10px 14px;
  background: var(--accent);
  color: var(--on-accent);
  border-radius: var(--radius-sm);
}

/* ----- responsive ------------------------------------------------------- */

@media (max-width: 1280px) {
  .dash {
    grid-template-columns: minmax(0, 1fr);
  }
  .rail {
    position: static;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  }
}

@media (max-width: 1000px) {
  .split {
    grid-template-columns: minmax(0, 1fr);
  }
  .server-row {
    grid-template-columns: minmax(140px, 1fr) 90px auto;
    row-gap: 10px;
  }
  .server-row .map-cell {
    grid-column: 1 / -1;
    order: 3;
  }
}

@media (max-width: 900px) {
  :root {
    --sidebar-width: 0px;
  }
  .shell {
    grid-template-columns: minmax(0, 1fr);
  }
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 80;
    width: 262px;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    background: var(--bg);
  }
  .sidebar.is-open {
    transform: translateX(0);
  }
  .sidebar-toggle {
    display: grid;
  }
  .scrim {
    display: block;
  }
  .scrim.is-open {
    opacity: 1;
    pointer-events: auto;
  }
  .content-inner {
    padding: 18px 16px 96px;
  }
  .topbar {
    padding: 10px 16px;
  }
}

@media (max-width: 620px) {
  .topbar .pill,
  .topbar .hide-sm {
    display: none;
  }
  .profile-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .swatch-button {
    min-width: 84px;
    font-size: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

/* ==========================================================================
   Content components reused across the inner pages
   ========================================================================== */

/* Compact metric block: label above value. Distinct from .tile, which is the
   dashboard tile with a trailing icon. */
.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
  gap: 12px;
}

.stat {
  display: grid;
  gap: 3px;
  padding: 15px 17px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.stat-label {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted-2);
}

.stat-value {
  font-family: var(--font-mono);
  font-size: 23px;
  font-weight: 700;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.stat.is-secondary .stat-value {
  color: var(--accent);
}

.stat-sub {
  font-size: 12px;
  color: var(--muted);
}

/* Metric tiles.
 *
 * A denser relative of .stat: an icon, a label and a number, sized so a dozen
 * of them read as one block rather than a dozen separate cards. Used on the
 * profile and on both player pages, which show the same figures. */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(158px, 1fr));
  gap: 10px;
}

.metric {
  display: flex;
  gap: 11px;
  align-items: center;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.metric-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--muted-2);
}

.metric-icon svg {
  width: 18px;
  height: 18px;
}

/* Анімована емодзі замість намальованої іконки. Той самий бокс 18x18, що й
   у svg, — плитка не має зрушити ні на піксель. Файл 36 px показується у
   18, щоб не милився на щільних екранах. */
.metric-emoji {
  display: block;
  width: 22px;
  height: 22px;
}

.metric-body {
  min-width: 0;
}

/* Другий рядок під значенням плитки: точна дата під «скільки минуло».
   Дрібний і тихий — його читають, коли виникло питання, а не щоразу. */
.metric-sub {
  margin-top: 1px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted-2);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.metric-label {
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.metric-value {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.25;
  font-variant-numeric: tabular-nums;
}

.metric.is-primary .metric-icon {
  color: var(--primary);
  border-color: color-mix(in srgb, var(--primary) 35%, var(--line));
}

.metric.is-primary .metric-value {
  color: var(--primary);
}

/* Skill grade: the letter, the score, and how far the next grade is. */
.skill-card {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.skill-bar {
  height: 6px;
  margin-top: 8px;
  border-radius: 99px;
  background: var(--bg);
  border: 1px solid var(--line);
  overflow: hidden;
}

.skill-bar > i {
  display: block;
  height: 100%;
  background: var(--primary);
}

/* The grade badge: the letter, followed by the score it was read from.
 *
 * Drawn here rather than served as the AES picture it used to be. That set
 * is 37x16 pixels blown up to double size - a letter with colour fringing
 * around it, glued to a white field that lit up like a slab on a dark page.
 * The letter is plain text now, so it stays sharp at any size and can be
 * read out loud by a screen reader.
 *
 * The five colours are the ones the in-game /top table already uses for
 * grades, so a player who learns them in the MOTD window knows them here.
 * They are fixed rather than themed on purpose: the chip has to keep its
 * meaning under whichever six variables a player saved. */
.skill-badge {
  display: inline-flex;
  align-items: stretch;
  flex: none;
  vertical-align: middle;
  border-radius: var(--radius-sm);
  overflow: hidden;
  line-height: 1;
}

.skill-badge-letter,
.skill-badge-score {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  padding: 8px 7px;
  background: var(--grade-bg);
  color: var(--grade-fg);
}

.skill-badge-letter {
  font-size: 14px;
  font-weight: 800;
}

/* The score rides on the same colour, one shade back: the letter is the
 * headline and the number is its footnote, not a second heading. */
.skill-badge-score {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  opacity: 0.74;
  border-left: 1px solid rgb(0 0 0 / 0.35);
}

.skill-badge.s-low {
  --grade-bg: #2b2f39;
  --grade-fg: #cbd5e1;
}

.skill-badge.s-mid {
  --grade-bg: #14532d;
  --grade-fg: #4ade80;
}

.skill-badge.s-high {
  --grade-bg: #14304a;
  --grade-fg: #60a5fa;
}

.skill-badge.s-pro {
  --grade-bg: #452208;
  --grade-fg: #fb923c;
}

.skill-badge.s-god {
  --grade-bg: #4c1220;
  --grade-fg: #fb7185;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Efficiency reads as a verdict, not a number, so it carries a colour.
 * The same three bands the in-game table uses. */
.eff {
  font-variant-numeric: tabular-nums;
}

.eff.is-good {
  color: var(--ok, #4ade80);
}

.eff.is-ok {
  color: var(--primary);
}

.eff.is-low {
  color: var(--muted);
}

/* Medal in place of a rank number for the first three places. */
.mdl-img {
  width: 26px;
  height: 26px;
  vertical-align: middle;
}

/* Country flag beside a nickname. Fixed box so a wide flag and a tall one
 * still line the column up. */
.flag {
  width: 20px;
  height: 14px;
  flex: none;
  border-radius: 2px;
  object-fit: cover;
  vertical-align: -2px;
  box-shadow: 0 0 0 1px rgb(0 0 0 / 0.35);
}

/* Server card, used on the dedicated servers page (the dashboard uses rows). */
.server-card {
  display: grid;
  gap: 14px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  transition: border-color 0.18s ease, transform 0.18s ease;
}

.server-card:hover {
  border-color: var(--accent-line);
  transform: translateY(-2px);
}

.server-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.server-name {
  display: block;
  margin-bottom: 4px;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.server-name:hover {
  color: var(--accent);
}


/* Полиск на значку рівня. На сайті значок намальований стилями, а не
   картинкою, тому анімація тут не коштує жодного байта трафіку — на
   відміну від гри, де довелося пекти кадри в GIF.
   Пробігає раз на шість секунд: у таблиці з п'ятнадцяти рядків
   безперервне мерехтіння читати заважає. */
.skill-badge {
  position: relative;
  overflow: hidden;
}
.skill-badge::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 45%;
  background: linear-gradient(
    100deg,
    transparent,
    rgba(255, 255, 255, 0.38),
    transparent
  );
  animation: skill-badge-shine 6s ease-in-out infinite;
  pointer-events: none;
}
@keyframes skill-badge-shine {
  0%, 82% { left: -50%; }
  92%, 100% { left: 110%; }
}
@media (prefers-reduced-motion: reduce) {
  .skill-badge::after { animation: none; opacity: 0; }
}


/* Сторони своїми кольорами. Навмисно не через --accent: синій тут означає
   КТ, а не «колір теми», і мусить лишитися синім, хоч би яку тему гравець
   собі поставив. */
.side-ct { color: #38bdf8; font-weight: 700; }
.side-t { color: #f4536a; font-weight: 700; }


/* Живий індикатор замість кольорової крапки. Розмір трохи більший за
   .dot (7px): анімацію на семи пікселях не видно, а на шістнадцяти вона
   читається, не перетягуючи на себе увагу з числа поруч. */
.dot-anim {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  display: block;
}

/* Значок біля заголовка розділу. Той самий бокс, що й у svg-іконок
   поруч, щоб заголовки не стрибали між сторінками. */
.head-emoji {
  width: 22px;
  height: 22px;
  vertical-align: -4px;
  margin-right: 4px;
}


/* ---- банер картки сервера ---------------------------------------------- */

/* Картка стає системою координат для банера й обрізає його по своєму
   радіусу. Без overflow зображення вилізло б квадратом за заокруглені
   кути — тією самою хибою, що була в заливці рядка при наведенні. */
.has-video {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

.card-banner {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  /* fill, а не cover. Cover зберігає пропорції й зрізає зайве — а
     зайвим для нього була зброя: банер 6:1 у картці 8:1 він обтинав
     згори й знизу, і калаша ставало не видно. Тепер банер зроблено
     одразу 8:1, а fill гарантує, що браузер не відріже нічого й на
     інших ширинах: він розтягне, а не обріже.

     Розтягування помітне лише там, де картка стає значно вищою за
     8:1 — на вузьких екранах. Обрізати головний предмет гірше, ніж
     трохи розтягнути тло. */
  object-fit: fill;
  z-index: -1;
  /* Майже на повну: зображення саме по собі притемнене там, де треба, а
     читабельність тексту тримає серпанок нижче. Гасити ще й прозорістю
     означало б робити з банера сірий шум — саме це й вийшло з першого
     разу, коли він стояв на 0.5. */
  opacity: 0.95;
  pointer-events: none;
  user-select: none;
}

/* Серпанок поверх банера. Ліворуч щільніший — там назва сервера й адреса;
   праворуч рідший, щоб зображення було видно. Рівна заливка гасила б
   картинку цілком і робила з неї сірий шум. */
.card-banner-veil {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(
    90deg,
    color-mix(in srgb, var(--surface) 90%, transparent) 0%,
    color-mix(in srgb, var(--surface) 62%, transparent) 42%,
    color-mix(in srgb, var(--surface) 55%, transparent) 100%
  );
}

@supports not (color: color-mix(in srgb, red 50%, blue)) {
  .card-banner-veil {
    background: linear-gradient(
      90deg,
      rgba(23, 25, 29, 0.88) 0%,
      rgba(23, 25, 29, 0.52) 42%,
      rgba(23, 25, 29, 0.18) 100%
    );
  }
}


/* ---- перемикач сервера в статистиці ------------------------------------ */

/* Прокрутка вбік, а не перенос: серверів може стати багато, і ряд, що
   розповзається на три рядки, зсунув би вниз усі плитки під ним. */
.srv-switch {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 14px;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.srv-switch::-webkit-scrollbar {
  height: 5px;
}
.srv-switch::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: 99px;
}

.srv-chip {
  flex: none;
  padding: 7px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.srv-chip:hover {
  color: var(--text);
  border-color: var(--line-strong);
}

.srv-chip.is-on {
  color: var(--on-accent);
  background: var(--accent);
  border-color: var(--accent);
}


/* ---- вікно статистики -------------------------------------------------- */

.stats-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.stats-panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--elevated);
}

.stats-panel-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted-2);
}

/* Назва сервера, з якого числа. Праворуч і тихішим кольором: це підпис
   до панелі, а не заголовок — його читають, коли виникло питання
   «звідки це», а не щоразу. */
.stats-panel-srv {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--accent);
  text-align: right;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stats-panel-body {
  padding: 16px 18px 18px;
  display: grid;
  gap: 14px;
}

/* Всередині панелі рівень і плитки вже мають свою рамку — вкладена
   рамка в рамці читається як помилка верстки. */
.stats-panel-body .skill-card {
  background: none;
  border: 0;
  box-shadow: none;
  padding: 0;
}

.stats-panel-body .srv-switch {
  margin-bottom: 0;
}

@media (max-width: 620px) {
  .stats-panel-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
  }
  .stats-panel-srv {
    text-align: left;
  }
  .stats-panel-body {
    padding: 13px 13px 15px;
  }
}


/* ---- сайдбар на низькому вікні ----------------------------------------- */

/* Причина скролу, який видно при більшому масштабі: сайдбар має власну
   прокрутку (`overflow-y: auto`) і висоту 100vh. Масштаб не змінює
   висоту вікна в пікселях CSS, але збільшує все всередині — і пункти
   меню перестають уміщатися. З'являється смуга, якої за звичайного
   масштабу немає, і виглядає вона чужорідно.

   Замість ховати смугу — робимо так, щоб вона була не потрібна: на
   низькому вікні сайдбар підбирається. Спершу відступи й проміжки,
   далі підписи розділів. Ховати самі пункти меню не можна: тоді
   зникне навігація.  */

@media (max-height: 820px) {
  .sidebar {
    padding: 12px 12px;
    gap: 4px;
  }
  .nav-label {
    padding: 9px 10px 4px;
  }
  .brand {
    padding: 4px 8px 11px;
  }
}

@media (max-height: 680px) {
  .sidebar {
    padding: 9px 11px;
    gap: 2px;
  }
  .nav-item {
    padding-top: 7px;
    padding-bottom: 7px;
  }
  .nav-label {
    padding: 6px 10px 3px;
    font-size: 9px;
  }
  /* Підвал сайдбара — лічильник онлайну, кнопки спільнот і копірайт —
     тримається знизу й на низькому вікні з'їдає ту висоту, якої бракує
     пунктам. Копірайт із них найменш потрібний. */
  .sidebar-foot .small {
    display: none;
  }
}

/* Смуга прокрутки, коли вона все-таки з'явилася: тонка й у кольорі рамок,
   а не типова системна впоперек темної панелі. */
.sidebar::-webkit-scrollbar-track {
  background: transparent;
}
