/* ==========================================================================
   R6DATA — design system.

   Same visual language as the THE FINALS and Brawlhalla trackers, built on the
   finals.id form vocabulary: flat lifted surfaces, hairline borders, no drop
   shadows in the page flow, generous radii, roomy padding, tiny uppercase
   micro-labels with wide tracking, and segmented pill controls where the ACTIVE
   segment is the only saturated thing on the row.

   The palette stays R6Data's own — gold #f5a623 primary, orange #ff6b35 accent,
   near-black surfaces.

   LOADING ORDER MATTERS. This file is linked LAST on the pages it governs so
   that, at equal specificity, it wins over the legacy sheets (theme.css,
   style.css, css/styles.css, css/responsive.css, css/modern-layout.css) that
   are still in the stack for the pages left untouched. Anything here that has
   to beat a more specific legacy selector says so in a comment.

   OUT OF SCOPE — these pages never link this file and must stay exactly as they
   were: dashboard, replay-viewer (the tool), live-server-globe, status (R6
   server status), api-docs, and the whole support section.
   ========================================================================== */

:root {
  /* ---- brand ---- */
  --primary-color: #f5a623;
  --primary-light: #ffba52;
  --primary-dark: #d68c00;
  --primary-ink: #1f1400;              /* text that sits ON the primary */
  --primary-soft: rgba(245, 166, 35, 0.12);
  --primary-glow: rgba(245, 166, 35, 0.14);
  --accent-color: #ff6b35;
  --accent-soft: rgba(255, 107, 53, 0.12);
  --accent-2: #ff4d6d;

  /* ---- surfaces: bg < surface < surface-2 < surface-3, each a real step ---- */
  --background-color: #0d0d0f;
  --surface-color: #17171b;
  --surface-2: #1d1d23;
  --surface-3: #26262d;
  --card-bg: var(--surface-color);
  --input-bg: #101013;
  --bg-2: #101013;
  --secondary-color: var(--surface-3);
  --secondary-bg: var(--surface-2);

  /* ---- ink ---- */
  --text-primary: #f3f2f0;
  --text-secondary: #a9a7a2;
  --text-muted: #77757f;

  /* ---- lines: hairline by default, the strong one only for controls ---- */
  --line: #26262d;
  --line-strong: #383840;
  --border-color: var(--line);
  --border-soft: var(--line);
  --divider-color: var(--line);

  /* ---- semantic ---- */
  --success-color: #3ddc97;
  --error-color: #ff5c7a;
  --warning-color: #ffb545;
  /* Attacker/defender pairing: the SSR operator page reads --info-color for the
     defender side and nothing else ever defined it, so it resolved to nothing. */
  --info-color: #4a9bff;
  --gold: #ffcb45;
  --silver: #c7d0dc;
  --bronze: #d0894f;

  /* ---- shape ---- */
  --radius-xl: 18px;
  --radius-lg: 16px;
  --radius: 10px;
  --radius-sm: 7px;
  --border-radius: var(--radius);       /* legacy token, kept in sync */
  --maxw: 1200px;
  --nav-height: 64px;

  /* ---- type ---- */
  --font-family: 'Outfit', 'Inter', ui-sans-serif, system-ui, sans-serif;
  --font-display: var(--font-family);
  --font-mono: ui-monospace, SFMono-Regular, Menlo, monospace;

  /* Shadows survive as tokens because dialogs and popovers still need to lift
     off the page — but nothing that sits IN the page flow uses them. */
  --shadow-sm: none;
  --shadow-md: none;
  --shadow-lg: 0 18px 48px rgba(0, 0, 0, 0.55);

  /* ---- navbar/footer chrome (legacy names still read by modern-layout) ---- */
  --site-chrome-bg: var(--surface-color);
  --nav-bg: rgba(13, 13, 15, 0.82);
  --nav-border: var(--line);
  --nav-item-hover: var(--surface-2);
  --nav-item-active-bg: var(--surface-2);
  --nav-item-active-color: var(--text-primary);
  --nav-text: var(--text-secondary);
  --nav-accent: var(--primary-color);
  --nav-accent-hover: var(--primary-light);
  --nav-z-index: 1000;
  --footer-bg: transparent;
  --footer-border: var(--line);
  --footer-text: var(--text-secondary);
}

/* ==========================================================================
   Reset & base
   ========================================================================== */
* { box-sizing: border-box; }
html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-height) + 16px);
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-family);
  font-size: 1rem;
  background-color: var(--background-color);
  color: var(--text-primary);
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  scrollbar-width: thin;
  scrollbar-color: #32323a transparent;
  display: flex;
  flex-direction: column;
}
/* The SPA shell is <header id="navbar"> / <main id="app"> / <footer id="footer">,
   so the flex child that has to grow is #app, not a bare <main>. */
body > main,
body > #app { flex: 1 0 auto; width: 100%; }
body > header { flex-shrink: 0; }

/* Reserve the fixed navbar's space in every shell, including pages where the
   navbar header sits inside #app instead of directly under body. */
#navbar {
  height: var(--nav-height);
  min-height: var(--nav-height);
  flex: 0 0 var(--nav-height);
}

@keyframes pageIn { from { opacity: 0; } to { opacity: 1; } }

::selection { background: rgba(245, 166, 35, 0.28); color: #fff; }
:focus-visible { outline: 2px solid var(--primary-color); outline-offset: 2px; border-radius: 4px; }
body::-webkit-scrollbar { width: 10px; }
body::-webkit-scrollbar-track { background: var(--background-color); }
body::-webkit-scrollbar-thumb { background: #32323a; border-radius: 6px; border: 3px solid var(--background-color); }

a { color: var(--primary-color); text-decoration: none; text-underline-offset: 3px; transition: color .16s ease; }
a:hover { color: var(--primary-light); }
button { font-family: inherit; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: 0;
}
h1 { font-size: clamp(1.65rem, 3.2vw, 2.15rem); }
h2 { font-size: clamp(1.15rem, 2vw, 1.4rem); }
h3 { font-size: 1.05rem; font-weight: 600; letter-spacing: -0.01em; }

.muted { color: var(--text-secondary); }
.small { font-size: .84rem; }
.mono, .num { font-variant-numeric: tabular-nums; }
.center { text-align: center; }
.hidden { display: none !important; }
.strong { font-weight: 700; }

.material-icons, .material-icons-round, .material-symbols-outlined {
  vertical-align: middle; line-height: 1; user-select: none;
}
code {
  font-family: var(--font-mono); font-size: .86em;
  background: var(--surface-2); border: 1px solid var(--line);
  padding: 1px 6px; border-radius: 5px;
}

/* The uppercase micro-label is the single most repeated element of the
   reference layout — one rule so every occurrence stays identical. */
.eyebrow,
.stat-label, .stat-l, .st-l, .hstat-label, .rank-label, .cs-stat-label,
.msum-label, .peak-season, .ps-sub, .footer-col h4, .footer-social h4, .filter-header,
.form-label, .contact-label, .settings-row-label, .card-header-hint,
.tooltip-label, .top-endpoint-name, .filter > label, .charms-filter label,
.rank-version > label {
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-muted);
}

/* ==========================================================================
   Layout primitives
   ========================================================================== */
.container {
  width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 20px;
}
/* The SPA wraps every page in `.container.page-content`; the legacy rule gave it
   a flat 24px block padding and a fade. Keep the fade, use the reference's
   rhythm. */
/* padding-block, not the `28px 0 8px` shorthand: every SPA page is
   `class="container page-content"`, so the shorthand's implicit side `0` lands
   on the same element as .container's `padding: 0 20px` and wins on order —
   any page wider than the viewport then ran edge to edge. */
.page-content { padding-block: 22px 8px; animation: pageIn .26s ease-out; }
.app-background { background-color: var(--background-color); }

/* The standalone pages (operators, maps, weapons, …) render into a bare
   `#main-content` rather than the SPA's `.container.page-content`, so they had
   no gutters at all and ran edge to edge. Give it the same measure as the
   container — every page on the site should share one text column. */
#main-content {
  width: 100%; max-width: var(--maxw); margin: 0 auto;
  padding: 22px 20px 8px;
}
/* `.page-container` is never the outermost wrapper — discord and the widget
   builder render it inside `.container.page-content`, stats inside
   `#main-content`. Giving it padding of its own doubled both the top gap and
   the side gutter. It only has to carry the measure. */
.page-container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0; }

/* padding-block, not the `28px 0` shorthand: sections are `class="section
   container"` on some pages, and the shorthand's implicit `0` would override
   .container's side gutters. */
.section { padding-block: 28px; }
.section:first-of-type { padding-top: 24px; }

.section-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; flex-wrap: wrap; margin-bottom: 16px;
}
.section-head h2 { margin: 0; }
.section-head:not(:first-child) { margin-top: 32px; }
.section-title, .section-header h2 { margin: 0; }

/* ---- page head — replaces the legacy left-accent-bar .page-header ---------
   The old header hung a 3px gold bar down the left of the title. The reference
   has no such rule anywhere: the page title just leans, and the subtitle sits
   under it. Both class names are styled so the shared component
   (createPageHeader) needs no markup change. */
/* `display: block` and the two -webkit resets are load-bearing: public/style.css
   declares `.page-header { display: flex }` (which put the subtitle beside the
   title instead of under it) and paints the h1 with a clipped gradient
   (`-webkit-text-fill-color: transparent`), which would swallow this file's
   colour. A property this file never mentions keeps the legacy value. */
.page-head, .page-header {
  display: block;
  margin-bottom: 24px; padding-top: 6px;
  border-left: 0; padding-left: 0;
  animation: none;
}
.page-head h1, .page-header h1 {
  font-style: italic;            /* the reference's page titles lean — the signature */
  font-weight: 800;
  font-size: clamp(1.75rem, 3.6vw, 2.3rem);
  letter-spacing: -0.03em;
  margin: 0;
  background: none;
  -webkit-background-clip: border-box; background-clip: border-box;
  -webkit-text-fill-color: currentColor;
  color: var(--text-primary);
}
.page-header-title {
  display: flex; align-items: center; gap: 12px; margin-bottom: 0;
}
.page-header-icon {
  margin-right: 0; color: var(--primary-color); font-size: 26px;
  /* The icon is decoration next to an italic title; at the legacy 32px it
     out-weighed the words it was labelling. */
}

/* Discord and the widget builder build the same header out of a different pair
   of classes (an icon plate and a `.header-text` block). Same shape as everyone
   else's: the mark sits beside the title, not over it. Only that variant turns
   into a row, hence :has() rather than a blanket flex. */
.page-header:has(.header-icon) { display: flex; align-items: center; }
.page-header .header-icon {
  flex: none; width: 40px; height: 40px; border-radius: 11px; margin-right: 14px;
  display: grid; place-items: center;
  background: var(--primary-soft); color: var(--primary-color);
}
.page-header .header-icon .material-icons { font-size: 21px; color: var(--primary-color); }
.page-header .header-text { display: block; }
.page-header .header-text h1 { margin: 0; }
.page-header .header-text p { margin: 6px 0 0; color: var(--text-secondary); font-size: .94rem; max-width: 760px; }
.page-head > p, .page-header-subtitle {
  margin: 6px 0 0; margin-left: 0; color: var(--text-secondary);
  max-width: 760px; font-size: .94rem;
}

.back-link {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: .84rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 10px;
}
.back-link:hover { color: var(--text-primary); }
.back-link .material-icons { font-size: 18px; }

/* The legacy `.grid` was `repeat(auto-fill, minmax(350px, 1fr))` with a 24px
   gutter — a fixed 350px floor is why the catalog pages showed two fat columns
   on a laptop. The system's grid is opt-in per shape. */
.grid { display: grid; gap: 14px; margin-bottom: 0; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }

/* ==========================================================================
   Header / navbar

   r6data already uses the reference's `.modern-*` class names, so the markup
   needs no change — only the look does.

   The blur lives on a pseudo-element, not on .modern-navbar itself. A
   backdrop-filter makes its element a containing block for `position: fixed`
   descendants — and the mobile drawer is one. On the navbar it would stop being
   viewport-anchored and its translateX(100%) would park it past the right edge,
   widening the document.
   ========================================================================== */
.modern-navbar {
  position: fixed; inset: 0 0 auto 0; z-index: var(--nav-z-index);
  width: 100%;
  height: var(--nav-height);
  background: none; background-color: transparent;
  backdrop-filter: none; -webkit-backdrop-filter: none;
  border-bottom: 1px solid var(--line);
  box-shadow: none;
  isolation: isolate;
}
.modern-navbar::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: rgba(13, 13, 15, 0.82);
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
}
.modern-navbar-container {
  max-width: var(--maxw); margin: 0 auto; height: var(--nav-height);
  display: flex; align-items: center; gap: 20px; padding: 0 20px;
  justify-content: flex-start;
}

/* ---- brand ---- */
.modern-brand {
  display: flex; align-items: center; gap: 9px; flex-shrink: 0;
  min-width: 0; overflow: visible;
  font-family: var(--font-display); font-weight: 800; font-size: 1.16rem;
  letter-spacing: -0.02em; color: var(--text-primary);
}
.modern-brand:hover { color: var(--text-primary); }
/* r6data-logo-t.png is a 1280×1272 canvas whose "r6" mark only fills the middle
   ~40%, so a box sized to the mark's apparent size renders it tiny. The box is
   oversized on purpose and the negative margins claw back the transparent
   padding: the mark reads at roughly 42px across — the size it had before —
   while the element still occupies ~44px and the row stays 64px tall. */
.modern-brand-logo {
  height: 104px; width: 104px; max-width: none;
  margin: -30px -26px; flex: none;
  display: block; object-fit: contain;
  transform: none; transform-origin: center;
}
/* The footer mark sits beside a wordmark, so it is the smaller of the two. */
.brand .logo {
  height: 54px; width: 54px; max-width: none;
  margin: -12px -10px; flex: none;
  display: block; object-fit: contain;
}
.modern-brand-text {
  background: none; -webkit-background-clip: initial; background-clip: initial;
  -webkit-text-fill-color: currentColor; color: var(--text-primary);
}
.modern-brand-text b { color: var(--primary-color); font-weight: 800; }

/* ---- desktop menu ---- */
.modern-nav-menu {
  display: flex; gap: 2px; align-items: center; list-style: none;
  margin: 0 auto; padding: 0; min-width: 0;
}
/* Centred on the NAVBAR, not on the space left between the brand and the
   actions — with `margin: 0 auto` those two have different widths, so the row
   lands visibly off-centre. Below the breakpoint the menu is display:none and
   the rule is moot. */
/* 1100px, not the reference's 981px: this nav carries eight items where the
   reference carries five, so the centred block collides with the brand sooner. */
@media (min-width: 1100px) {
  .modern-navbar-container { position: relative; }
  .modern-nav-menu {
    position: absolute; left: 50%; transform: translateX(-50%);
    margin: 0; justify-content: center;
  }
  .modern-brand, .modern-nav-actions { position: relative; z-index: 2; }
}
.modern-nav-item { position: relative; display: flex; align-items: center; height: auto; }
.modern-nav-link {
  display: flex; align-items: center; gap: 5px; height: 36px; min-height: 36px;
  padding: 0 11px; border: 0; border-radius: var(--radius);
  color: var(--text-secondary); font-weight: 500; font-size: .88rem;
  white-space: nowrap; cursor: pointer; background: transparent;
  transition: background-color .16s ease, color .16s ease;
}
.modern-nav-link:hover { background: var(--surface-2); color: var(--text-primary); border-color: transparent; }
.modern-nav-link.active { background: var(--surface-2); color: var(--text-primary); font-weight: 600; border-color: transparent; }
.modern-nav-link .material-icons,
.modern-nav-link .material-icons-round { font-size: 18px; opacity: .8; }

/* ---- dropdown ---- */
.modern-dropdown { position: relative; cursor: pointer; }
.modern-dropdown::after { content: ""; position: absolute; top: 100%; left: 0; width: 100%; height: 14px; background: transparent; }
.modern-dropdown-content {
  position: absolute; top: calc(100% + 12px); left: 50%; right: auto; width: 264px;
  background: var(--surface-color); border: 1px solid var(--line-strong);
  border-radius: 14px; box-shadow: var(--shadow-lg); padding: 6px;
  opacity: 0; transform: translateX(-50%) translateY(-8px); pointer-events: none; visibility: hidden;
  transition: opacity .18s ease, transform .18s ease, visibility .18s;
  z-index: 1001;
}
.modern-dropdown:hover .modern-dropdown-content,
.modern-dropdown:focus-within .modern-dropdown-content {
  opacity: 1; transform: translateX(-50%) translateY(0); pointer-events: auto; visibility: visible;
}
.modern-dropdown-category {
  font-size: .64rem; text-transform: uppercase; letter-spacing: .12em;
  color: var(--text-muted); padding: 11px 12px 5px; font-weight: 700;
}
.modern-dropdown-item {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px;
  color: var(--text-secondary); border: 0; border-radius: 8px;
  font-size: .9rem; font-weight: 500;
  transition: background-color .14s ease, color .14s ease;
}
.modern-dropdown-item:hover { background: var(--surface-2); color: var(--text-primary); border-color: transparent; }
.modern-dropdown-item .material-icons { color: var(--text-muted); font-size: 18px; }
.modern-dropdown-item:hover .material-icons { color: var(--primary-color); }
.modern-dropdown-divider { height: 1px; background: var(--line); margin: 6px 8px; }

/* ---- right-hand actions ---- */
.modern-nav-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }

.modern-nav-notifications {
  position: relative; display: grid; place-items: center;
  width: 36px; height: 36px; border-radius: var(--radius);
  color: var(--text-secondary); cursor: pointer;
  transition: background-color .16s ease, color .16s ease;
}
.modern-nav-notifications:hover { background: var(--surface-2); color: var(--text-primary); }
.modern-nav-notifications .material-icons { font-size: 20px; }
.modern-nav-notifications .notification-badge {
  position: absolute; top: 3px; right: 3px; min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 999px; background: var(--accent-color); color: #fff;
  font-size: .62rem; font-weight: 800; display: grid; place-items: center; line-height: 1;
  box-shadow: 0 0 0 2px var(--background-color);
}

.modern-navbar .account-dropdown-trigger {
  display: flex; align-items: center; gap: 2px;
  min-height: 36px; padding: 0 6px 0 9px; border-radius: var(--radius);
  background: transparent; border: 1px solid var(--line);
  color: var(--text-secondary); cursor: pointer;
  transition: background-color .16s ease, border-color .16s ease, color .16s ease;
}
.modern-navbar .account-dropdown-trigger:hover,
.modern-navbar .account-dropdown-wrapper.open .account-dropdown-trigger {
  background: var(--surface-2); border-color: var(--line-strong); color: var(--text-primary);
}
.modern-navbar .account-dropdown-trigger .material-icons { font-size: 20px; }
.modern-navbar .account-dropdown-menu {
  top: calc(100% + 10px); min-width: 214px;
  background: var(--surface-color); border: 1px solid var(--line-strong);
  border-radius: 14px; box-shadow: var(--shadow-lg); padding: 6px;
}
.modern-navbar .account-dropdown-menu-item {
  border-radius: 8px; color: var(--text-secondary); font-weight: 500; font-size: .9rem;
  gap: 11px; padding: 9px 12px;
}
.modern-navbar .account-dropdown-menu-item .material-icons { color: var(--text-muted); font-size: 18px; }
.modern-navbar .account-dropdown-menu-item:hover { background: var(--surface-2); color: var(--text-primary); }
.modern-navbar .account-dropdown-menu-item:hover .material-icons { color: var(--primary-color); }
.modern-navbar .account-dropdown-menu-item.logout-item:hover .material-icons { color: var(--error-color); }
.modern-navbar .account-dropdown-divider { background: var(--line); }
.nav-avatar { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; border: 1px solid var(--line-strong); }
.nav-username { font-size: .88rem; font-weight: 600; }

.modern-mobile-toggle {
  display: none; width: 36px; height: 36px; border-radius: var(--radius);
  background: transparent; border: 1px solid var(--line);
  color: var(--text-secondary); cursor: pointer; align-items: center; justify-content: center;
}
.modern-mobile-toggle:hover { background: var(--surface-2); color: var(--text-primary); border: 1px solid var(--line-strong); }

/* ---- mobile drawer ---- */
.modern-mobile-menu {
  position: fixed; top: var(--nav-height); right: 0; width: min(340px, 100vw);
  height: calc(100dvh - var(--nav-height)); background: var(--surface-color);
  backdrop-filter: none; -webkit-backdrop-filter: none;
  border-left: 1px solid var(--line); transform: translateX(100%);
  transition: transform .28s cubic-bezier(.16, 1, .3, 1); z-index: 999; overflow-y: auto;
  padding: 12px; padding-bottom: 80px;
}
.modern-mobile-menu.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
.modern-mobile-link {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; color: var(--text-secondary);
  border: 0; border-radius: var(--radius); margin-bottom: 2px; font-weight: 500; font-size: .95rem;
}
.modern-mobile-link .material-icons { font-size: 20px; color: var(--text-muted); }
.modern-mobile-link:hover { background: var(--surface-2); color: var(--text-primary); border-color: transparent; }
.modern-mobile-link.active { background: var(--surface-2); color: var(--text-primary); font-weight: 600; }
.modern-mobile-link.active .material-icons { color: var(--primary-color); }

/* brand mark reused by the footer */
.brand {
  display: flex; align-items: center; gap: 9px; color: var(--text-primary);
  font-family: var(--font-display); font-weight: 800; font-size: 1.16rem; letter-spacing: -0.02em;
}
.brand:hover { color: var(--text-primary); }
.brand b { color: var(--primary-color); }

/* ==========================================================================
   Footer
   ========================================================================== */
/* `text-align: left` is not redundant: public/style.css already ships a
   `.site-footer { text-align: center }` (it used to style a one-line footer),
   and a property this file never mentions keeps the legacy value. */
.site-footer {
  margin-top: 48px; padding: 0;
  background: rgba(255, 255, 255, 0.012);
  border-top: 1px solid var(--line);
  color: var(--text-secondary); font-size: .9rem;
  text-align: left;
}
.footer-top {
  display: grid; grid-template-columns: 2.2fr 1fr 1fr; gap: 40px;
  padding: 44px 20px 36px; max-width: var(--maxw); margin: 0 auto;
}
.footer-brand p {
  color: var(--text-secondary); font-size: .9rem; margin-top: 12px;
  max-width: 360px; line-height: 1.6;
}
.footer-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px; }
/* Sits where the "Search players" button used to be, in the brand column: the
   label reuses the shared micro-label rule, so only the icon row is styled here. */
.footer-social { margin-top: 20px; }
.footer-social h4 { margin-bottom: 10px; }
.footer-social-links { display: flex; gap: 10px; flex-wrap: wrap; }
.social-link {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: var(--radius);
  background: var(--surface-color); border: 1px solid var(--line-strong);
  color: var(--text-secondary);
  transition: background-color .16s ease, border-color .16s ease, color .16s ease;
  -webkit-tap-highlight-color: transparent;
}
.social-link svg { width: 19px; height: 19px; display: block; }
.social-link:hover { background: var(--surface-2); border-color: var(--primary-color); color: var(--primary-color); }
.footer-col h4 { margin-bottom: 14px; }
.footer-col a {
  display: block; color: var(--text-secondary); font-size: .92rem; font-weight: 500;
  padding: 5px 0; transition: color .14s ease;
}
.footer-col a:hover { color: var(--text-primary); }
.footer-bottom { border-top: 1px solid var(--line); }
.footer-bottom > div {
  max-width: var(--maxw); margin: 0 auto; padding: 16px 20px;
  display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  color: var(--text-muted); font-size: .82rem;
}
.footer-legal { max-width: 720px; line-height: 1.6; }
.footer-legal a { color: var(--text-secondary); text-decoration: underline; text-underline-offset: 2px; }
.footer-legal a:hover { color: var(--text-primary); }

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 40px; padding: 0 16px; border-radius: var(--radius);
  font-family: inherit; font-weight: 600; font-size: .92rem; letter-spacing: -0.01em;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  background: var(--surface-color); border: 1px solid var(--line-strong); color: var(--text-primary);
  transition: background-color .16s ease, border-color .16s ease, color .16s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { background: var(--surface-2); color: var(--text-primary); border-color: var(--line-strong); }
.btn:active { transform: translateY(1px); }
/* The legacy rule was `.btn .material-icons { margin-right: 8px }`, which double-
   spaced every icon now that the button is a gap-flex. */
.btn .material-icons { font-size: 18px; margin-right: 0; }
.btn[disabled], .btn.is-disabled { opacity: .4; cursor: not-allowed; }
.btn[disabled]:active { transform: none; }

.btn-primary,
.btn-primary:hover,
.btn-primary:active,
.btn-primary:focus {
  background: var(--primary-color); color: var(--primary-ink);
  border-color: var(--primary-color); box-shadow: none;
}
.btn-primary:hover { background: var(--primary-light); border-color: var(--primary-light); }
/* An <a class="btn"> still matches the global `a:hover { color: primary-light }`,
   which on a primary fill means gold on gold — the label disappears. */
a.btn:hover, a.btn-primary:hover { color: var(--primary-ink); }
a.btn:not(.btn-primary):hover { color: var(--text-primary); }

.btn-secondary { background: var(--surface-color); color: var(--text-primary); border-color: var(--line-strong); }
.btn-secondary:hover { background: var(--surface-2); color: var(--text-primary); }

.btn-ghost { background: transparent; border-color: var(--line); color: var(--text-secondary); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--line-strong); color: var(--text-primary); }

.btn-danger { background: transparent; border-color: rgba(255, 92, 122, .34); color: var(--error-color); }
.btn-danger:hover { background: rgba(255, 92, 122, .1); border-color: var(--error-color); color: var(--error-color); }

.btn-sm { min-height: 34px; padding: 0 13px; font-size: .85rem; border-radius: var(--radius-sm); }
.btn-sm .material-icons { font-size: 17px; }
.btn-block { width: 100%; }

/* ==========================================================================
   Inputs
   ========================================================================== */
input, select, textarea, .form-control, .contact-input, .filter-input {
  background: var(--input-bg); border: 1px solid var(--line-strong);
  color: var(--text-primary); font-family: inherit; font-size: .95rem;
  padding: 11px 14px; border-radius: var(--radius); width: 100%;
  transition: border-color .16s ease, box-shadow .16s ease;
}
input[type="checkbox"], input[type="radio"] { width: auto; accent-color: var(--primary-color); }
input[type="range"] { padding: 0; border: 0; accent-color: var(--primary-color); }
input::placeholder, textarea::placeholder { color: var(--text-muted); }
input:hover, select:hover, textarea:hover,
.form-control:hover, .contact-input:hover { border-color: #454550; }
input:focus, select:focus, textarea:focus,
.form-control:focus, .contact-input:focus, .filter-input:focus {
  outline: none; border-color: var(--primary-color);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
label, .form-label { display: block; font-weight: 600; margin-bottom: 6px; }
.form-group { margin-bottom: 16px; }
.form-row { display: flex; gap: 12px; flex-wrap: wrap; }
.form-row > * { flex: 1 1 200px; min-width: 0; }

/* ==========================================================================
   Cards, panels, stat tiles
   ========================================================================== */
/* The legacy card lifted on hover (`translateY(-2px)` + a heavier shadow). The
   reference has no lift anywhere: a card answers hover by brightening its
   hairline. Both are declared here because the legacy rule is still in the
   cascade for these pages. */
.panel, .card, .stats-card, .chart-card, .contact-card, .bot-card,
.season-stats-card, .season-peaks-card, .current-season-card,
.matches-card, .platforms-card, .operators-card, .seasons-grid-card {
  background: var(--surface-color);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: none;
  overflow: hidden;
  transform: none;
  transition: border-color .18s ease, background-color .18s ease;
}
.panel:hover, .card:hover, .stats-card:hover, .chart-card:hover,
.contact-card:hover, .bot-card:hover {
  border-color: var(--line-strong); box-shadow: none; transform: none;
}
.panel { padding: 22px; }
.card-content { padding: 20px; }
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  padding: 16px 20px; border-bottom: 1px solid var(--line);
}
.card-title { font-size: 1.02rem; font-weight: 600; letter-spacing: -0.01em; margin-bottom: 0; }
.card-subtitle { color: var(--text-secondary); font-size: .86rem; display: flex; align-items: center; gap: 5px; }
.card-subtitle .material-icons { font-size: 16px; margin-right: 0; }
.card-divider { height: 1px; background: var(--line); margin: 16px 0; }

/* Stat tile — the reference's boxed metric: value first, micro label under. */
.stat-card, .stat-tile, .stat-item, .hstat, .platform-stat, .peak-stat, .cs-stat {
  background: var(--surface-color); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 16px 18px 15px;
  position: relative; overflow: hidden; box-shadow: none;
  transition: border-color .18s ease;
}
.stat-card:hover, .stat-tile:hover, .stat-item:hover { border-color: var(--line-strong); transform: none; }
.stat-value, .stat-val, .hstat-value, .st-v, .cs-stat-value, .msum-value, .rank-value {
  font-family: var(--font-display); font-weight: 700; font-size: 1.6rem;
  letter-spacing: -0.03em; line-height: 1.05; font-variant-numeric: tabular-nums;
  margin-bottom: 4px;
}
.stat-card .value { font-size: 1.75rem; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; line-height: 1.1; letter-spacing: -0.02em; }
.stat-card .sub { color: var(--text-secondary); font-size: .84rem; margin-top: 3px; }
.stat-card.accent { border-color: rgba(245, 166, 35, 0.35); }
.stat-card.accent .value { color: var(--primary-color); }
.stat-row, .stat-group { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }

/* Feature card (home + landing pages) */
.feature { padding: 22px; }
.feature .fi {
  width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center;
  background: var(--primary-soft); color: var(--primary-color); margin-bottom: 15px;
}
.feature .fi .material-icons { font-size: 21px; }
.feature h3 { font-size: 1.02rem; font-weight: 600; margin: 0 0 6px; }
.feature p { color: var(--text-secondary); font-size: .9rem; margin: 0; line-height: 1.55; }
.feature-grid { gap: 14px; }

/* ==========================================================================
   Badges, pills, chips
   ========================================================================== */
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
  font-size: .74rem; font-weight: 600; background: var(--surface-2);
  border: 1px solid var(--line); color: var(--text-secondary);
}
.badge.gold { color: var(--gold); border-color: rgba(255, 203, 69, .3); background: rgba(255, 203, 69, .08); }

/* The legacy chip was a solid gold lozenge with black text — loud enough that a
   row of them was the first thing the eye landed on. In the reference a chip is
   quiet by default and only the "primary" variant carries colour, as an outline
   rather than a fill. */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 11px; margin: 0; border-radius: 999px;
  font-size: .74rem; font-weight: 600; line-height: 1.5;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--text-secondary);
}
.chip .material-icons { font-size: 14px; }
.chip-primary { background: var(--primary-soft); border-color: rgba(245, 166, 35, .3); color: var(--primary-color); }
.chip-outlined { background: transparent; border-color: var(--line-strong); color: var(--text-secondary); }
.chip-success { background: rgba(61, 220, 151, .12); border-color: rgba(61, 220, 151, .3); color: var(--success-color); }
.chip-error { background: rgba(255, 92, 122, .12); border-color: rgba(255, 92, 122, .3); color: var(--error-color); }

.pill {
  padding: 2px 9px; border-radius: var(--radius-sm); font-size: .74rem; font-weight: 700;
  background: var(--surface-2); color: var(--text-secondary);
}
.tagline {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--primary-soft); border: 1px solid rgba(245, 166, 35, .22);
  color: var(--primary-color); padding: 5px 13px; border-radius: 999px;
  font-weight: 700; font-size: .74rem; text-transform: uppercase; letter-spacing: .1em;
  margin-bottom: 20px;
}
.tagline .material-icons { font-size: 15px; margin-left: -2px; }

/* ==========================================================================
   Tabs — segmented control (the reference's pill group)
   ========================================================================== */
/* `width: auto` is load-bearing: css/stats.css ships `.tabs { width: 100% }`,
   and since this file only changes `display`, the old width leaked through and
   stretched the pill group to the full column with a dead tail after the last
   tab. `border-bottom: 0` kills the legacy underline the group no longer uses. */
.tabs, .tabs-container, .main-tabs, .platform-tabs, .builder-tabs, .notification-tabs {
  display: inline-flex; gap: 3px; padding: 4px; margin: 0 0 20px;
  width: auto; border: 1px solid var(--line); border-bottom: 1px solid var(--line);
  border-radius: 12px; background: var(--surface-color);
  max-width: 100%; overflow-x: auto; overflow-y: hidden; scrollbar-width: none;
}
.tabs::-webkit-scrollbar, .main-tabs::-webkit-scrollbar { display: none; }
.tab, .nav-tab, .builder-tab, .notification-tab, .platform-tab-btn {
  display: inline-flex; align-items: center; gap: 7px; flex: none;
  padding: 8px 15px; border: 0; border-radius: 8px; background: transparent;
  color: var(--text-secondary); font-family: inherit; font-weight: 600; font-size: .88rem;
  white-space: nowrap; cursor: pointer; transition: background-color .14s ease, color .14s ease;
  -webkit-tap-highlight-color: transparent;
}
.tab:hover, .nav-tab:hover, .builder-tab:hover, .notification-tab:hover { color: var(--text-primary); background: var(--surface-2); }
.tab.active, .nav-tab.active, .builder-tab.active, .notification-tab.active {
  background: var(--primary-color); color: var(--primary-ink); border-color: transparent;
}
.tab.active:hover, .builder-tab.active:hover { background: var(--primary-light); color: var(--primary-ink); }
.tab .material-icons { font-size: 17px; }
/* The legacy tab was underlined by a 3px ::after bar; the pill IS the state
   now, so the bar would double it. */
.tabs .tab.active::after, .main-tabs .main-tab.active::after { display: none; }
.tab-panel, .tab-content { animation: fadeIn .22s ease-out; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ==========================================================================
   Tables
   ========================================================================== */
.table-wrap, .table-container, .leaderboard-table-container, .data-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-color);
  scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent;
}
.table-wrap::-webkit-scrollbar, .table-container::-webkit-scrollbar { height: 8px; }
.table-wrap::-webkit-scrollbar-thumb, .table-container::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 4px; }

table, .data-table, .leaderboard-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td, .data-table th, .data-table td {
  padding: 13px 16px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap;
}
th, .data-table th, .table-header {
  color: var(--text-muted); font-weight: 700;
  font-size: .66rem; text-transform: uppercase; letter-spacing: .1em;
  padding-top: 15px; padding-bottom: 11px;
  background-color: var(--surface-color);
}
thead th { position: sticky; top: 0; z-index: 1; }
tbody tr, .table-row { transition: background-color .12s ease; }
tbody tr:hover, .table-row:hover { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: none; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.clickable, tbody tr[data-href], [data-href] { cursor: pointer; }

/* ==========================================================================
   Pager
   ========================================================================== */
.pager, .pagination, .leaderboard-pagination {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  margin-top: 16px; padding: 4px; flex-wrap: wrap;
}
.pagination-info, .pager-info {
  color: var(--text-secondary); font-size: .86rem; font-weight: 600; font-variant-numeric: tabular-nums;
}
/* The legacy pager buttons were gold fills; in the reference they are quiet
   outline controls and only the disabled state differs. */
.pagination-button, .pagination-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  min-height: 34px; padding: 0 13px; border-radius: var(--radius-sm);
  background: var(--surface-color); border: 1px solid var(--line-strong); color: var(--text-primary);
  font-family: inherit; font-weight: 600; font-size: .85rem; cursor: pointer;
  transition: background-color .16s ease, border-color .16s ease, color .16s ease;
}
.pagination-button:hover:not(:disabled), .pagination-btn:hover:not(:disabled) { background: var(--surface-2); }
.pagination-button:disabled, .pagination-btn:disabled { opacity: .4; cursor: not-allowed; }
.pagination-button .material-icons, .pagination-btn .material-icons { font-size: 18px; margin: 0; }

/* ==========================================================================
   Skeleton / empty / error / loading / notice
   ========================================================================== */
.skeleton { position: relative; overflow: hidden; background: var(--surface-2); border-radius: 6px; color: transparent !important; }
.skeleton::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .05), transparent);
  transform: translateX(-100%); animation: shimmer 1.3s infinite;
}
@keyframes shimmer { 100% { transform: translateX(100%); } }

/* `font-style: normal` undoes css/styles.css, which sets the empty state in
   italics — the reference never italicises body copy. */
.empty-state, .error-state, .error-display, .rcm-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 52px 24px; color: var(--text-secondary); font-style: normal;
  border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface-color);
}
.empty-state .material-icons, .error-display .error-icon {
  display: block; margin-bottom: 12px; font-size: 2.6rem; color: var(--text-muted);
}
.empty-state h3, .error-state h3, .error-display .error-title {
  color: var(--text-primary); margin: 2px 0 6px; font-size: 1.1rem; font-weight: 700;
}
.empty-state p, .error-state p, .error-display .error-message { margin: 0 auto; max-width: 460px; font-size: .92rem; }
.empty-state .btn { margin-top: 18px; }
.error-display { border-color: rgba(255, 92, 122, .3); }
.error-display .error-icon { color: var(--error-color); }
.error-button {
  margin-top: 18px; min-height: 40px; padding: 0 16px; border-radius: var(--radius);
  background: var(--primary-color); color: var(--primary-ink); border: 1px solid var(--primary-color);
  font-family: inherit; font-weight: 600; font-size: .92rem; cursor: pointer;
}
.error-button:hover { background: var(--primary-light); border-color: var(--primary-light); }
/* Inline (non-card) error line used by the stats page. */
.error-message { color: var(--text-secondary); }

.loading-indicator, .loading-container {
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  min-height: 180px; padding: 32px 0; gap: 14px;
}
.spinner, .loading-spinner {
  width: 34px; height: 34px; border-radius: 50%;
  border: 2px solid var(--line-strong); border-top-color: var(--primary-color);
  animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { margin-top: 0; color: var(--text-muted); font-size: .9rem; }

.notice {
  display: flex; align-items: flex-start; gap: 10px;
  background: var(--primary-soft); border: 1px solid rgba(245, 166, 35, .22);
  color: var(--text-secondary); padding: 13px 15px; border-radius: 12px; font-size: .9rem;
}
.notice .material-icons { font-size: 19px; flex-shrink: 0; margin-top: 1px; color: var(--primary-color); }
.notice.info { background: var(--surface-2); border-color: var(--line); }
.notice.info .material-icons { color: var(--text-muted); }

/* ==========================================================================
   Dialogs
   ========================================================================== */
body.modal-open { overflow: hidden; }
.dialog, .modal, .deletion-confirm-modal {
  background: var(--surface-color); border: 1px solid var(--line-strong);
  border-radius: var(--radius-xl); box-shadow: var(--shadow-lg);
  padding: 20px 22px 22px;
}
.dialog-title { font-family: var(--font-display); font-weight: 700; font-size: 1.1rem; margin-bottom: 12px; }
.dialog-content { color: var(--text-secondary); font-size: .94rem; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; margin-top: 18px; }

/* Hover explainer, used by the ranks/stats tooltips. */
[data-tip] { position: relative; }
[data-tip]::after {
  content: attr(data-tip); position: absolute; left: 0; top: calc(100% + 8px); z-index: 40;
  width: max-content; max-width: 280px; white-space: normal; text-align: left; padding: 9px 11px;
  border-radius: 8px; background: var(--surface-3); border: 1px solid var(--line-strong);
  color: var(--text-secondary); font-size: .72rem; font-weight: 500; line-height: 1.5;
  box-shadow: var(--shadow-lg); opacity: 0; visibility: hidden; transition: opacity .12s ease;
}
[data-tip]:hover::after, [data-tip]:focus-visible::after { opacity: 1; visibility: visible; }

/* ==========================================================================
   Shared search bar (components/searchBar.js)
   ========================================================================== */
.search-bar {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface-color); border: 1px solid var(--line-strong);
  border-radius: var(--radius); box-shadow: none;
  padding: 0 12px; margin-bottom: 20px;
  transition: border-color .16s ease, box-shadow .16s ease;
}
.search-bar:focus-within { border-color: var(--primary-color); box-shadow: 0 0 0 3px var(--primary-soft); }
.search-bar input {
  flex: 1; min-width: 0; background: none; border: 0; border-radius: 0;
  color: var(--text-primary); padding: 12px 0; font-size: .95rem; outline: none;
}
.search-bar input:hover, .search-bar input:focus { border: 0; box-shadow: none; }
.search-bar input::placeholder { color: var(--text-muted); }
.search-bar-icon { color: var(--text-muted); font-size: 20px; flex: none; }
.search-bar:focus-within .search-bar-icon { color: var(--primary-color); }
.search-bar-clear {
  background: none; border: 0; color: var(--text-muted); cursor: pointer;
  display: grid; place-items: center; padding: 4px; border-radius: 6px; flex: none;
}
.search-bar-clear:hover { color: var(--text-primary); background: var(--surface-2); }

/* ==========================================================================
   Prose (privacy / terms / about)
   ========================================================================== */
.prose, .legal-content { max-width: 780px; color: var(--text-primary); }
.prose h1, .legal-content h1 {
  font-style: italic; font-weight: 800; margin-bottom: 16px;
  font-size: clamp(1.75rem, 3.6vw, 2.3rem); letter-spacing: -0.03em;
  color: var(--text-primary);
}
.prose h2, .legal-content h2 { margin: 30px 0 10px; font-size: 1.2rem; font-weight: 700; color: var(--text-primary); }
.prose h3, .legal-content h3 { margin: 22px 0 8px; }
.prose p, .prose li, .legal-content p, .legal-content li { color: var(--text-secondary); line-height: 1.75; }
.prose p, .legal-content p { margin: 10px 0; }
.prose ul, .legal-content ul { padding-left: 20px; margin: 10px 0; }
.prose li, .legal-content li { margin: 6px 0; }
.prose code, .legal-content code { color: var(--primary-color); }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1080px) {
  .modern-nav-menu { display: none; }
  .modern-mobile-toggle { display: flex; }
  .modern-nav-actions { margin-left: auto; }
}

@media (max-width: 900px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .footer-top { grid-template-columns: 1fr 1fr; gap: 28px; }
  .footer-brand { grid-column: 1 / -1; }
}

@media (max-width: 640px) {
  .container { padding: 0 16px; }
  /* The logo box is deliberately oversized to compensate for the PNG's
     transparent margin; at the phone gutter that overhang crossed the left
     edge of the viewport, so the box comes down a size. */
  .modern-brand-logo { height: 86px; width: 86px; margin: -24px -21px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .footer-top { grid-template-columns: 1fr; padding: 34px 16px 28px; }
  .footer-bottom > div { flex-direction: column; align-items: flex-start; }
  table { font-size: .86rem; }
  th, td { padding: 11px 10px; }
  th { white-space: normal; }
  .modern-navbar .nav-username { display: none; }
  .page-head h1, .page-header h1 { font-size: 1.6rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  html { scroll-behavior: auto; }
}
