/* ==========================================================================
   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: 100vh;
  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");
}

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: 100vh;
}

.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: 100vh;
  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);
}

.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 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, 3vw, 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;
}

.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);
}

/* ----- 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;
}

.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);
}

/* 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);
}
