:root {
  --bg: #121110;
  --panel: #1a1816;
  --line: #2c2825;
  --text: #e6e1d8;
  --muted: #9a9286;
  --rust: #c8452a;
  --rust-hover: #db5536;
  --display: "Barlow Condensed", "Arial Narrow", sans-serif;
  --sans: "Barlow", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html {
  color-scheme: dark;
  scroll-behavior: smooth;
  -webkit-tap-highlight-color: transparent;
}
@media (pointer: fine) {
  html { overscroll-behavior: none; }
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  overflow-x: hidden;
}

h1, h2 {
  font-family: var(--display);
  font-weight: 700;
  line-height: 1;
  text-transform: uppercase;
  text-wrap: balance;
}
h2 { font-size: 2rem; margin-bottom: 20px; }

a { color: inherit; }
a, button { touch-action: manipulation; }

[id] { scroll-margin-top: 80px; }

:focus-visible {
  outline: 2px solid var(--rust);
  outline-offset: 3px;
}

.wrap {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding-left: max(20px, env(safe-area-inset-left));
  padding-right: max(20px, env(safe-area-inset-right));
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  top: -100px;
  left: 16px;
  z-index: 100;
  padding: 10px 16px;
  background: var(--rust);
  color: #fff;
}
.skip-link:focus { top: 12px; }

/* Buttons */
.btn {
  display: inline-block;
  padding: 12px 22px;
  background: var(--rust);
  border: 1px solid var(--rust);
  color: #fff;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  transition: background-color 0.15s, border-color 0.15s;
}
.btn:hover { background: var(--rust-hover); border-color: var(--rust-hover); }
.btn[hidden] { display: none; }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--text); }
.btn-ghost:hover { background: var(--panel); border-color: var(--muted); }

.text-link {
  color: var(--muted);
  font-size: 0.9rem;
  text-decoration: none;
  transition: color 0.15s;
}
.text-link:hover { color: var(--text); }

/* Top bar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 60px;
  padding: 0 max(20px, env(safe-area-inset-right)) 0 max(20px, env(safe-area-inset-left));
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.logo {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.4rem;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
}
.topbar nav { display: flex; gap: 4px; }
.topbar nav a {
  padding: 6px 12px;
  color: var(--muted);
  font-size: 0.9rem;
  text-decoration: none;
  transition: color 0.15s;
}
.topbar nav a:hover { color: var(--text); }
.topbar nav a[aria-current="page"] { color: var(--text); box-shadow: inset 0 -2px 0 var(--rust); }

/* Hero */
.hero {
  isolation: isolate;
  position: relative;
  display: flex;
  align-items: flex-end;
  min-height: min(70vh, 600px);
  padding: 80px 0 64px;
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}
.hero-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: -2;
}
.hero-overlay {
  position: absolute;
  inset: 0;
  z-index: -1;
  background: rgba(18, 17, 16, 0.55);
}
.hero h1 { font-size: clamp(3rem, 10vw, 7.5rem); line-height: 0.9; }
.hero h1 span { display: block; color: var(--rust); }
.hero-sub {
  max-width: 480px;
  margin-top: 24px;
  color: var(--muted);
  font-size: 1.05rem;
  text-wrap: pretty;
}
.hero-sub strong { color: var(--text); font-weight: 600; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 32px; }

/* Content blocks */
.block { padding-top: 72px; padding-bottom: 72px; border-bottom: 1px solid var(--line); }
.block:last-child { border-bottom: 0; }
.block-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}
.block-head h2 { margin-bottom: 0; }

/* Search */
.search {
  display: flex;
  max-width: 560px;
  border: 1px solid var(--line);
  background: var(--panel);
  transition: border-color 0.15s;
}
.search:focus-within { border-color: var(--muted); }
.search input {
  flex: 1;
  min-width: 0;
  padding: 14px 16px;
  background: transparent;
  border: 0;
  color: var(--text);
  font: inherit;
}
.search input:focus-visible { outline: none; } /* the whole bar shows focus via :focus-within */
.search input::placeholder { color: var(--muted); }
.search button {
  padding: 0 22px;
  background: var(--rust);
  border: 0;
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s;
}
.search button:hover { background: var(--rust-hover); }
.search-msg { min-height: 1.6em; margin-top: 10px; color: var(--muted); font-size: 0.9rem; }

/* About */
.about-copy p { max-width: 520px; margin-bottom: 14px; color: var(--muted); text-wrap: pretty; }

/* Top 5 */
.top-list { list-style: none; counter-reset: rank; border-top: 1px solid var(--line); }
.top-list li {
  counter-increment: rank;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.top-list li::before {
  content: counter(rank);
  width: 24px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.85rem;
}
.top-list li:first-child::before { color: var(--rust); }
.top-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-stat { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* Discord */
.discord p { margin-bottom: 24px; color: var(--muted); }

/* Footer */
.footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-top: 24px;
  padding-bottom: max(24px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.85rem;
}
.footer a { text-decoration: none; transition: color 0.15s; }
.footer a:hover { color: var(--text); }

/* ---------- Leaderboard page ---------- */
.lb { padding-top: 56px; padding-bottom: 80px; }
.lb h1 { font-size: clamp(2.6rem, 7vw, 4.5rem); margin-bottom: 32px; }

.tabs { display: flex; gap: 24px; border-bottom: 1px solid var(--line); margin-bottom: 24px; }
.tab {
  padding: 10px 0;
  margin-bottom: -1px;
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--rust); }

.tab-panel:focus-visible { outline-offset: 6px; }

.stat-filter { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 20px; }
.stat-filter button {
  padding: 6px 12px;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background-color 0.15s;
}
.stat-filter button:hover { color: var(--text); border-color: var(--muted); }
.stat-filter button[aria-pressed="true"] { background: var(--text); border-color: var(--text); color: var(--bg); }

.lb-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.lb-table th {
  padding: 10px 12px;
  text-align: left;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 500;
  border-bottom: 1px solid var(--line);
}
.lb-table td { padding: 13px 12px; border-bottom: 1px solid var(--line); }
.lb-table tbody tr:hover { background: var(--panel); }
.col-rank { width: 56px; }
.lb-table td.col-rank { color: var(--muted); font-family: var(--mono); font-size: 0.85rem; }
.col-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.col-stat { width: 140px; text-align: right !important; }
.lb-table td.col-stat { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.lb-table tr.podium td.col-rank { color: var(--rust); }
.lb-table tr.podium td.col-name { font-weight: 600; }

.note { margin-top: 16px; color: var(--muted); font-size: 0.85rem; }

.empty { padding: 72px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.empty h2 { margin-bottom: 8px; }
.empty p { color: var(--muted); }

/* Mobile */
@media (max-width: 760px) {
  .block { padding-top: 56px; padding-bottom: 56px; }
  .topbar nav a { padding: 6px 8px; }
  .col-rank { width: 40px; }
  .col-stat { width: 100px; }
  .lb-table th, .lb-table td { padding-left: 8px; padding-right: 8px; }
}
@media (max-width: 420px) {
  .logo { font-size: 1.15rem; }
  .topbar nav a { font-size: 0.85rem; padding: 6px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .hero-video { display: none; }
}

/* ---------- Update logs page ---------- */
.updates { padding-top: 56px; padding-bottom: 80px; }
.updates h1 { font-size: clamp(2.6rem, 7vw, 4.5rem); margin-bottom: 16px; }
.updates-intro { margin-bottom: 40px; color: var(--muted); }

.log { padding: 36px 0; border-top: 1px solid var(--line); }
.log-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 16px;
  margin-bottom: 20px;
}
.log h2 { margin-bottom: 0; font-size: 1.8rem; }
.log time { color: var(--muted); font-family: var(--mono); font-size: 0.85rem; }
.log h3 {
  margin: 20px 0 8px;
  color: var(--rust);
  font-size: 0.9rem;
  font-weight: 600;
}
.log h3:first-of-type { margin-top: 0; }
.log ul { padding-left: 18px; max-width: 640px; }
.log li { margin-bottom: 6px; color: var(--text); }
.log li::marker { color: var(--muted); }

/* Small phones: menu drops under the logo */
@media (max-width: 600px) {
  .topbar { flex-wrap: wrap; height: auto; padding-top: 10px; gap: 2px; }
  .topbar nav { width: 100%; margin-left: -6px; overflow-x: auto; }
  .topbar nav a { white-space: nowrap; padding: 8px 6px 10px; }
  [id] { scroll-margin-top: 110px; }
}


.btn-small { padding: 6px 14px; font: inherit; font-size: 0.9rem; cursor: pointer; }

/* ---------- Dashboard: connect screen ---------- */
.connect { padding-top: 72px; padding-bottom: 96px; }
.connect h1 { font-size: clamp(2.6rem, 7vw, 4.5rem); margin-bottom: 16px; }
.connect-sub { max-width: 440px; margin-bottom: 28px; color: var(--muted); text-wrap: pretty; }
.connect-error { margin-bottom: 16px; color: #e8765c; }
.connect-error:empty { display: none; }
.btn-roblox { display: inline-flex; align-items: center; gap: 10px; }

/* ---------- Player data (shared) ---------- */
.muted { color: var(--muted); }
.note a { color: var(--text); }

.pfp {
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  overflow: hidden;
  border-radius: 50%;
  background: var(--panel);
  border: 1px solid var(--line);
  object-fit: cover;
}
.pfp-letter { color: var(--rust); font-family: var(--display); font-weight: 700; font-size: 0.95rem; }

.list-empty, .table-msg { color: var(--muted); }
.top-list li.list-empty::before { content: none; }
.top-list .pfp { margin-right: -4px; }
.top-name { text-decoration: none; transition: color 0.15s; }
.top-name:hover { color: var(--rust); }
.lb-table td.table-msg { padding: 28px 12px; text-align: left; }
.player-cell { display: flex; align-items: center; gap: 12px; min-width: 0; text-decoration: none; }
.player-cell span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-cell:hover span { color: var(--rust); }

/* Search suggestions */
.search { position: relative; }
.search-results {
  position: absolute;
  top: calc(100% + 4px);
  left: -1px;
  right: -1px;
  z-index: 20;
  list-style: none;
  max-height: 340px;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
}
.search-results a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  text-decoration: none;
}
.search-results li + li a { border-top: 1px solid var(--line); }
.search-results a:hover, .search-results a[aria-selected="true"] { background: #23201d; }
.search-names { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.search-names strong { font-weight: 600; }
.search-names strong, .search-names span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-names span { color: var(--muted); font-size: 0.85rem; }
.search-empty { padding: 14px; color: var(--muted); }

/* Rank chips (#1, #2…) */
.rank {
  display: inline-block;
  padding: 1px 7px;
  border: 1px solid var(--line);
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.5;
}
.rank-top { border-color: var(--rust); background: rgb(200 69 42 / 0.14); color: #f0a08c; }

/* Stat board (player page + dashboard) */
.statboard { display: grid; gap: 12px; }
.stat-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.stat-tile {
  position: relative;
  padding: 18px 20px 16px;
  border: 1px solid var(--line);
  background: var(--panel);
  overflow: hidden;
}
.stat-tile::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 2px;
  background: var(--rust);
  opacity: 0;
  transition: opacity 0.2s;
}
.stat-tile:hover::before { opacity: 1; }
.stat-tile dt { color: var(--muted); font-size: 0.82rem; font-weight: 500; letter-spacing: 0.04em; text-transform: uppercase; }
.stat-tile dd:not(.stat-rank, .stat-delta) {
  margin-top: 2px;
  font-family: var(--display);
  font-size: clamp(2.2rem, 4vw, 2.9rem);
  font-weight: 700;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}
.stat-rank { display: flex; align-items: center; gap: 6px; margin-top: 10px; color: var(--muted); font-size: 0.8rem; }

.stat-details { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 12px; }
.detail { padding: 18px 20px; border: 1px solid var(--line); }
.detail-head, .detail-foot { display: flex; justify-content: space-between; gap: 12px; }
.detail-head { margin-bottom: 12px; color: var(--muted); font-size: 0.82rem; font-weight: 500; letter-spacing: 0.04em; text-transform: uppercase; }
.detail-num { color: var(--text); font-family: var(--mono); letter-spacing: 0; text-transform: none; }
.detail-foot { margin-top: 10px; color: var(--muted); font-size: 0.82rem; }
.detail-value { font-family: var(--display); font-size: 2.4rem; font-weight: 700; line-height: 1; }
.detail-big .detail-head { margin-bottom: 6px; }

.bar { height: 8px; background: var(--line); overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--rust); animation: grow 0.7s cubic-bezier(0.2, 0.8, 0.2, 1); transform-origin: left; }
.bar-split { background: #4a2a22; }
.bar-split span { background: #8a9a5b; }
@keyframes grow { from { transform: scaleX(0); } }

/* Player page */
.player-page { padding-top: 40px; padding-bottom: 88px; }
.search-compact { margin-bottom: 32px; }
.profile-card { margin-bottom: 12px; border: 1px solid var(--line); background: var(--panel); }
.profile-banner {
  height: 120px;
  background:
    radial-gradient(120% 140% at 0% 0%, rgb(200 69 42 / 0.45), transparent 60%),
    repeating-linear-gradient(135deg, transparent 0 14px, rgb(255 255 255 / 0.025) 14px 15px),
    #1d1a17;
  border-bottom: 1px solid var(--line);
}
.profile-body {
  display: flex;
  align-items: flex-end;
  gap: 20px;
  padding: 0 24px 22px;
  min-width: 0;
}
.profile-avatar { position: relative; margin-top: -56px; flex-shrink: 0; }

/* Online status */
.presence-dot {
  --dot: #3ba55c;
  position: absolute;
  right: 8px;
  bottom: 8px;
  width: 22px;
  height: 22px;
  border: 4px solid var(--panel);
  border-radius: 50%;
  background: var(--dot);
}
.presence-text.is-online { color: #5fc27e; font-weight: 500; }
.profile-avatar .pfp {
  border: 4px solid var(--panel);
  outline: 1px solid var(--line);
  background: radial-gradient(circle at 50% 35%, #3a2a24, #1d1a17 70%);
  font-size: 2.6rem;
}
.profile-names { flex: 1; min-width: 0; padding-bottom: 4px; }
.profile-names h1 { font-size: clamp(2.2rem, 6vw, 3.4rem); overflow-wrap: anywhere; }
.profile-names p { margin-top: 6px; color: var(--muted); }
.profile-side { display: flex; align-items: center; gap: 16px; flex-shrink: 0; padding-bottom: 6px; }
.profile-rank { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.1; color: var(--muted); font-size: 0.8rem; }
.profile-rank-num { color: var(--rust); font-family: var(--display); font-size: 2rem; font-weight: 800; }
.btn-small.btn-ghost { white-space: nowrap; }
.player-page .note { margin-top: 20px; }
.player-page .note a { color: var(--muted); text-decoration: none; transition: color 0.15s; }
.player-page .note a:hover { color: var(--text); }
.sep { margin: 0 6px; }
.not-found { padding: 40px 0; border-top: 1px solid var(--line); }
.not-found h1 { font-size: clamp(2.2rem, 6vw, 3.6rem); margin-bottom: 10px; }
.not-found p { color: var(--muted); }

@media (max-width: 760px) {
  .stat-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-details { grid-template-columns: 1fr 1fr; }
  .stat-details .detail:first-child { grid-column: 1 / -1; }
  .profile-body { flex-wrap: wrap; align-items: flex-start; padding: 0 16px 18px; }
  .profile-avatar .pfp { width: 96px !important; height: 96px !important; }
  .profile-avatar { margin-top: -48px; }
  .presence-dot { right: 4px; bottom: 4px; width: 20px; height: 20px; }
  .profile-names { flex-basis: 100%; }
  .profile-side { width: 100%; justify-content: space-between; padding-top: 4px; }
  .profile-rank { flex-direction: row; align-items: baseline; gap: 6px; }
  .profile-rank-num { font-size: 1.5rem; }
}

/* ---------- Dashboard ---------- */
.dash-body { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 24px 16px max(20px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  border-right: 1px solid var(--line);
  background: #151312;
}
.sidebar .logo { padding: 0 8px; }
.side-tabs { display: flex; flex-direction: column; gap: 2px; margin-top: 36px; }
.side-tab {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  background: none;
  border: 0;
  border-left: 2px solid transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.98rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: color 0.15s, background-color 0.15s, border-color 0.15s;
}
.side-tab svg { flex-shrink: 0; opacity: 0.8; }
.side-tab:hover { color: var(--text); background: var(--panel); }
.side-tab[aria-selected="true"] { color: var(--text); background: var(--panel); border-left-color: var(--rust); }
.side-tab[aria-selected="true"] svg { color: var(--rust); opacity: 1; }

.side-foot { display: flex; flex-direction: column; gap: 14px; margin-top: auto; padding: 0 8px; }
.side-link {
  padding: 0;
  background: none;
  border: 0;
  color: var(--muted);
  font: inherit;
  font-size: 0.9rem;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: color 0.15s;
}
.side-link:hover { color: var(--text); }
.side-account { display: flex; align-items: center; gap: 10px; min-width: 0; padding-top: 14px; border-top: 1px solid var(--line); }
.account-name { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.account-name strong { font-size: 0.92rem; font-weight: 600; }
.account-name strong, .account-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-name span { color: var(--muted); font-size: 0.8rem; }

.dash-main { width: 100%; max-width: 980px; padding: 40px max(40px, env(safe-area-inset-right)) 88px 48px; }
.dash-hero {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 36px;
  padding: 24px;
  border: 1px solid var(--line);
  background:
    radial-gradient(90% 160% at 0% 0%, rgb(200 69 42 / 0.22), transparent 55%),
    var(--panel);
}
.dash-hero-avatar .pfp { border: 3px solid var(--bg); outline: 1px solid var(--line); font-size: 1.8rem; }
.dash-hero[hidden] { display: none; }
.dash-hero-avatar:empty { display: none; }
.dash-hero-text { flex: 1; min-width: 0; }
.eyebrow { color: var(--muted); font-family: var(--mono); font-size: 0.75rem; letter-spacing: 0.12em; text-transform: uppercase; }
.dash-hero h1 { margin-top: 4px; font-size: clamp(2rem, 4.5vw, 3rem); overflow-wrap: anywhere; }
.dash-hero-sub { display: flex; align-items: center; gap: 8px; margin-top: 8px; color: var(--muted); font-size: 0.92rem; }
.dash-hero-link { flex-shrink: 0; }

.dash-panel:focus-visible { outline-offset: 8px; }
.dash-panel h2 { margin-bottom: 16px; font-size: 1.6rem; }
.panel-sub { margin: -6px 0 20px; color: var(--muted); }
.empty-card { padding: 28px; border: 1px dashed var(--line); }
.empty-card h3 { margin-bottom: 6px; font-family: var(--display); font-size: 1.4rem; text-transform: uppercase; }
.empty-card p { color: var(--muted); }

/* Dashboard insights */
.stat-delta { margin-top: 2px; color: var(--muted); font-size: 0.8rem; }
.stat-delta.is-up { color: #8fbf6a; }

.insights { display: grid; gap: 12px; margin-top: 12px; }
.insight-card { padding: 20px 22px; border: 1px solid var(--line); background: var(--panel); min-width: 0; }
.insight-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.insight-head h3 { font-family: var(--display); font-size: 1.3rem; font-weight: 700; text-transform: uppercase; }
.insight-head h3 span { margin-left: 6px; color: var(--muted); font-family: var(--sans); font-size: 0.82rem; font-weight: 500; text-transform: none; }

/* Segmented control */
.seg { display: inline-flex; border: 1px solid var(--line); }
.seg button {
  padding: 5px 12px;
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.15s, background-color 0.15s;
}
.seg button + button { border-left: 1px solid var(--line); }
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"] { background: var(--bg); color: var(--text); }

/* Column chart */
.chart { position: relative; height: 200px; padding-left: 36px; }
.chart-grid { position: absolute; inset: 0 0 24px 36px; }
.chart-grid span { position: absolute; left: 0; right: 0; border-top: 1px solid var(--line); }
.chart-grid i {
  position: absolute;
  right: calc(100% + 8px);
  top: -0.6em;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.72rem;
  font-style: normal;
  white-space: nowrap;
}
.chart-cols { position: relative; display: flex; height: 100%; }
.col { flex: 1; display: flex; flex-direction: column; min-width: 0; outline: none; cursor: default; }
.col-plot { flex: 1; display: flex; align-items: flex-end; justify-content: center; padding: 0 1px; }
.col-bar {
  width: min(24px, 70%);
  border-radius: 4px 4px 0 0;
  background: var(--rust);
  transform-origin: bottom;
  animation: rise 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
  transition: background-color 0.15s;
}
.col-none { width: 4px; height: 4px; margin-bottom: -2px; border-radius: 50%; background: var(--line); }
.col.is-active .col-bar { background: var(--rust-hover); }
.col.is-active .col-plot { background: rgb(255 255 255 / 0.03); }
.col:focus-visible .col-plot { outline: 2px solid var(--rust); outline-offset: -2px; }
.col-label { height: 24px; padding-top: 6px; color: var(--muted); font-family: var(--mono); font-size: 0.72rem; text-align: center; white-space: nowrap; }
@keyframes rise { from { transform: scaleY(0); } }

.chart-tip {
  position: absolute;
  top: -8px;
  z-index: 5;
  display: flex;
  flex-direction: column;
  min-width: 130px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  background: var(--bg);
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.4);
  font-size: 0.82rem;
  line-height: 1.4;
  transform: translate(-50%, -100%);
  pointer-events: none;
}
.chart-tip[hidden] { display: none; }
.chart-tip strong { font-size: 1rem; }
.chart-tip span { color: var(--muted); }
.chart-note { margin-top: 12px; color: var(--muted); font-size: 0.85rem; }
.chart-details { margin-top: 12px; font-size: 0.85rem; }
.chart-details summary { color: var(--muted); cursor: pointer; }
.chart-details summary:hover { color: var(--text); }
.chart-table { width: 100%; margin-top: 10px; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.chart-table th, .chart-table td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: right; }
.chart-table th:first-child, .chart-table td:first-child { text-align: left; }
.chart-table th { color: var(--muted); font-weight: 500; }

@media (max-width: 760px) {
  .insight-card { padding: 18px 16px; }
  .chart { height: 180px; }
}
@media (prefers-reduced-motion: reduce) {
  .col-bar { animation: none; }
}

.report-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; list-style: none; }
.report-card {
  display: flex;
  flex-direction: column;
  padding: 22px;
  border: 1px solid var(--line);
  background: var(--panel);
  transition: border-color 0.2s, transform 0.2s;
}
.report-card:hover { border-color: #4a423b; transform: translateY(-2px); }
.report-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-bottom: 16px;
  background: rgb(200 69 42 / 0.12);
  color: var(--rust);
}
.report-card h3 { display: flex; align-items: center; gap: 8px; font-size: 1.1rem; font-weight: 600; }
.report-card p { flex: 1; margin: 6px 0 20px; color: var(--muted); font-size: 0.92rem; }
.report-card .btn { width: 100%; font: inherit; font-weight: 600; cursor: pointer; }
.report-card-soon .report-icon { background: var(--line); color: var(--muted); }
.report-card.is-disabled { opacity: 0.55; }
.report-card.is-disabled:hover { border-color: var(--line); transform: none; }
.report-card.is-disabled .report-icon { background: var(--line); color: var(--muted); }
.report-card.is-disabled .btn { background: transparent; border-color: var(--line); color: var(--muted); cursor: not-allowed; transition: none; }
.report-card.is-banned { border-color: var(--rust); }
.chip {
  padding: 1px 7px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 500;
  text-transform: uppercase;
}
.report-msg { min-height: 1.6em; margin-top: 14px; color: var(--muted); }

/* Settings */
.settings-list { list-style: none; border: 1px solid var(--line); background: var(--panel); }
.setting { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 20px 22px; }
.setting + .setting { border-top: 1px solid var(--line); }
.setting h3 { font-size: 1.05rem; font-weight: 600; }
.setting p { margin-top: 2px; color: var(--muted); font-size: 0.92rem; }
.settings-msg { min-height: 1.6em; margin-top: 12px; color: var(--muted); font-size: 0.9rem; }

.switch {
  position: relative;
  flex-shrink: 0;
  width: 48px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
  cursor: pointer;
  transition: background-color 0.2s, border-color 0.2s;
}
.switch-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform 0.2s cubic-bezier(0.3, 1.4, 0.6, 1), background-color 0.2s;
}
.switch[aria-checked="true"] { background: var(--rust); border-color: var(--rust); }
.switch[aria-checked="true"] .switch-knob { transform: translateX(20px); background: #fff; }
.switch:disabled { cursor: wait; opacity: 0.7; }

@media (max-width: 900px) {
  .report-cards { grid-template-columns: 1fr; }
  .report-card { display: grid; grid-template-columns: auto 1fr; column-gap: 16px; }
  .report-icon { grid-row: span 2; margin: 0; }
  .report-card p { margin-bottom: 14px; }
  .report-card .btn { grid-column: 2; width: auto; justify-self: start; }
}

@media (max-width: 760px) {
  .dash-body { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 16px;
    padding: 14px 16px 0;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .sidebar .logo { padding: 0; }
  .side-tabs { order: 3; flex-direction: row; gap: 20px; width: 100%; margin: 0; }
  .side-tab { padding: 8px 0 10px; border-left: 0; border-bottom: 2px solid transparent; }
  .side-tab:hover, .side-tab[aria-selected="true"] { background: none; }
  .side-tab[aria-selected="true"] { border-bottom-color: var(--rust); }
  .side-foot { flex-direction: row; align-items: center; margin: 0 0 0 auto; padding: 0; }
  .side-foot > .side-link, .side-account .account-name { display: none; }
  .side-account { padding: 0; border: 0; }
  .dash-main { padding: 20px 16px 64px; }
  .dash-hero { flex-wrap: wrap; gap: 14px; padding: 18px; margin-bottom: 28px; }
  .dash-hero-avatar .pfp { width: 56px !important; height: 56px !important; }
  .dash-hero-link { width: 100%; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  .bar span { animation: none; }
  .report-card:hover { transform: none; }
}

/* ---------- Legal pages (privacy, terms) ---------- */
.legal { padding-top: 56px; padding-bottom: 80px; }
.legal h1 { font-size: clamp(2.6rem, 7vw, 4.5rem); margin-bottom: 16px; }
.legal-updated { margin-bottom: 40px; color: var(--muted); font-family: var(--mono); font-size: 0.85rem; }
.legal section { padding: 28px 0; border-top: 1px solid var(--line); max-width: 680px; }
.legal h2 { font-size: 1.8rem; margin-bottom: 12px; }
.legal p, .legal li { color: var(--text); }
.legal p + p, .legal p + ul, .legal ul + p { margin-top: 12px; }
.legal ul { padding-left: 18px; }
.legal li { margin-bottom: 6px; }
.legal li::marker { color: var(--muted); }
.legal a { color: var(--rust); }
.legal a:hover { color: var(--rust-hover); }

.footer-links { display: flex; flex-wrap: wrap; gap: 16px; }
.footer a[aria-current="page"] { color: var(--text); }
.connect-legal { margin-top: 20px; color: var(--muted); font-size: 0.85rem; }
.connect-legal a { color: var(--text); }
.updates-empty { padding: 36px 0; border-top: 1px solid var(--line); color: var(--muted); }

/* ---------- Popup (bug report) ---------- */
/* Opened with show() instead of showModal() so hCaptcha's picture puzzle can sit on top of it.
   The blurred backdrop is drawn here and the page behind is made inert from dashboard.js. */
body.modal-open { overflow: hidden; }
body.modal-open::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 900;
  background: rgb(10 9 8 / 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: fade-in 0.22s ease-out;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  width: min(560px, calc(100% - 32px));
  height: fit-content;
  max-height: calc(100dvh - 32px);
  margin: auto;
  padding: 0;
  overflow-y: auto;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 24px 80px rgb(0 0 0 / 0.5);
}
.modal[open] { animation: modal-in 0.22s ease-out; }
@keyframes modal-in { from { opacity: 0; transform: translateY(12px) scale(0.98); } }
@keyframes fade-in { from { opacity: 0; } }

.modal-card { padding: 28px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.modal-head h2 { margin: 0; font-size: 1.9rem; }
.modal-close {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  background: none;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.modal-close:hover { color: var(--text); border-color: var(--muted); }

.field { margin-bottom: 24px; }
.field > label, .field-label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
}
.field-hint { color: var(--muted); font-size: 0.82rem; }
.field > .field-hint { display: block; margin-top: 4px; text-align: right; font-family: var(--mono); }

.modal textarea, .modal input[type="url"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  transition: border-color 0.15s;
}
.modal textarea { resize: vertical; min-height: 110px; }
.modal textarea:focus-visible, .modal input[type="url"]:focus-visible { outline: none; border-color: var(--rust); }
.modal textarea::placeholder, .modal input::placeholder { color: var(--muted); }

/* Severity slider: one thin line, four stops, a dot you drag */
.severity { --pct: 0; --sev: var(--muted); }
.severity-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.severity-head label { margin: 0; font-weight: 600; }
.severity-value {
  display: inline-block;
  color: var(--muted);
  font-family: var(--display);
  font-size: 1.15rem;
  font-weight: 700;
  text-transform: uppercase;
  white-space: nowrap;
  transition: color 0.2s;
}
.severity.rated .severity-value { color: var(--sev); }
.severity-value.bump { animation: bump 0.25s ease-out; }
@keyframes bump { from { opacity: 0.2; transform: translateY(6px); } }

.severity-track { position: relative; height: 32px; }
.severity-line, .severity-dots { position: absolute; left: 9px; right: 9px; top: 50%; pointer-events: none; }
.severity-line { height: 2px; margin-top: -1px; background: var(--line); }
.severity-fill {
  display: block;
  height: 100%;
  width: calc(var(--pct) * 100%);
  background: var(--sev);
  transition: width 0.2s cubic-bezier(0.3, 1.4, 0.6, 1), background-color 0.2s;
}
.severity-dots { display: flex; justify-content: space-between; height: 0; align-items: center; }
.severity-dots i {
  width: 6px;
  height: 6px;
  margin: 0 -3px;
  border-radius: 50%;
  background: var(--line);
  transition: background-color 0.2s;
}
.severity-dots i.lit { background: var(--sev); }

.severity input[type="range"] {
  position: relative;
  width: 100%;
  height: 100%;
  margin: 0;
  background: transparent;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}
.severity input[type="range"]:focus-visible { outline: none; }
.severity input[type="range"]::-webkit-slider-runnable-track { height: 100%; background: transparent; }
.severity input[type="range"]::-moz-range-track { height: 100%; background: transparent; }
.severity input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  margin-top: 7px;
  border: 3px solid var(--panel);
  border-radius: 50%;
  background: var(--sev);
  box-shadow: 0 0 0 1px var(--sev);
  transition: transform 0.15s, background-color 0.2s, box-shadow 0.2s;
}
.severity input[type="range"]::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border: 3px solid var(--panel);
  border-radius: 50%;
  background: var(--sev);
  box-shadow: 0 0 0 1px var(--sev);
  transition: transform 0.15s, background-color 0.2s, box-shadow 0.2s;
}
.severity input[type="range"]:hover::-webkit-slider-thumb { transform: scale(1.15); }
.severity input[type="range"]:active::-webkit-slider-thumb { transform: scale(1.3); }
.severity input[type="range"]:hover::-moz-range-thumb { transform: scale(1.15); }
.severity input[type="range"]:active::-moz-range-thumb { transform: scale(1.3); }
.severity input[type="range"]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 1px var(--sev), 0 0 0 5px rgb(200 69 42 / 0.35); }
.severity input[type="range"]:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 1px var(--sev), 0 0 0 5px rgb(200 69 42 / 0.35); }
.severity:not(.rated) input[type="range"]::-webkit-slider-thumb { background: var(--panel); box-shadow: 0 0 0 1px var(--muted); }
.severity:not(.rated) input[type="range"]::-moz-range-thumb { background: var(--panel); box-shadow: 0 0 0 1px var(--muted); }
.severity-caption { min-height: 1.6em; color: var(--muted); font-size: 0.9rem; }

/* Player picker and reason dropdown */
.pick-search { max-width: none; }
.pick-search input { padding: 10px 12px; }
.pick-search .search-results { max-height: 240px; }
.pick-search[hidden], .picked[hidden] { display: none; }
.picked {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 8px 8px 10px;
  border: 1px solid var(--line);
  background: var(--bg);
  animation: fade-in 0.2s ease-out;
}
.picked .search-names { flex: 1; }
.picked .btn { flex-shrink: 0; }

.select { position: relative; }
.select::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 14px;
  width: 8px;
  height: 8px;
  margin-top: -6px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  pointer-events: none;
}
.select select {
  width: 100%;
  padding: 10px 40px 10px 12px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color 0.15s;
}
.select select:invalid { color: var(--muted); }
.select select:focus-visible { outline: none; border-color: var(--rust); }
.select option { color: var(--text); background: var(--panel); }

/* Attachments */
.drop {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 20px 16px;
  border: 1px dashed var(--line);
  color: var(--muted);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s;
}
.field > .drop { display: flex; margin-bottom: 0; font-weight: 400; } /* beats the .field > label rule */
.drop strong { color: var(--text); }
.drop:hover, .drop.over { border-color: var(--rust); background: rgb(200 69 42 / 0.06); }
.drop:has(input:focus-visible) { outline: 2px solid var(--rust); outline-offset: 3px; }
.drop input { position: absolute; opacity: 0; width: 1px; height: 1px; }

.link-row { display: flex; gap: 8px; margin-top: 10px; }
.link-row input { flex: 1; min-width: 0; }
.link-row .btn { flex-shrink: 0; }

.attach-list { list-style: none; margin-top: 12px; }
.attach-list li { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); }
.attach-list li:last-child { border-bottom: 1px solid var(--line); }
.thumb {
  position: relative;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  overflow: hidden;
  background: var(--bg);
  color: var(--muted);
}
.thumb img, .thumb video { width: 100%; height: 100%; object-fit: cover; }
.thumb-play { position: absolute; color: #fff; font-size: 0.8rem; text-shadow: 0 1px 4px rgb(0 0 0 / 0.8); }
.attach-info { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.35; }
.attach-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach-remove {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 1.3rem;
  cursor: pointer;
}
.attach-remove:hover { color: var(--rust-hover); }

.captcha { min-height: 78px; margin-bottom: 8px; }
.form-error { min-height: 1.6em; margin-bottom: 12px; color: var(--rust-hover); font-size: 0.92rem; }

.modal-actions { display: flex; justify-content: flex-end; gap: 10px; }
.modal-actions .btn, .modal-done .btn { font: inherit; font-weight: 600; cursor: pointer; }
.modal .btn:disabled { opacity: 0.6; cursor: wait; }

.modal-done { text-align: center; padding: 48px 28px; }
.modal-done h2 { margin-bottom: 10px; }
.modal-done p { margin-bottom: 24px; color: var(--muted); }
.done-mark {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin: 0 auto 20px;
  border-radius: 50%;
  background: var(--rust);
  color: #fff;
  animation: bounce-in 0.4s ease-out;
}
@keyframes bounce-in { 0% { transform: scale(0.4); opacity: 0; } 60% { transform: scale(1.1); } }

@media (max-width: 480px) {
  .modal-card { padding: 20px 16px; }
  .modal-actions .btn { flex: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .modal[open], body.modal-open::before, .done-mark, .picked, .severity-value.bump { animation: none; }
  .severity-fill { transition: none; }
}

/* Clans (coming soon) */
.soon-card { padding: 48px 28px; border: 1px dashed var(--line); text-align: center; }
.soon-card .report-icon { margin: 0 auto 16px; }
.soon-card h3 { font-family: var(--display); font-size: 1.8rem; text-transform: uppercase; }
.soon-card p { margin-top: 6px; color: var(--muted); }

/* Discord */
.btn-discord { background: #5865f2; border-color: #5865f2; color: #fff; }
.btn-discord:hover { background: #4752c4; border-color: #4752c4; }
.discord-mark {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  background: #5865f2;
  color: #fff;
}
.setting-discord .setting-text { flex: 1; min-width: 0; }
.setting-discord .btn { flex-shrink: 0; font: inherit; font-size: 0.9rem; font-weight: 600; cursor: pointer; }

.discord-prompt {
  position: fixed;
  right: max(20px, env(safe-area-inset-right));
  bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 800;
  display: flex;
  gap: 14px;
  width: min(320px, calc(100% - 32px));
  padding: 18px;
  border: 1px solid var(--line);
  border-top: 3px solid #5865f2;
  background: var(--panel);
  box-shadow: 0 16px 48px rgb(0 0 0 / 0.5);
  animation: prompt-in 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) 0.6s backwards;
}
.discord-prompt[hidden] { display: none; }
.discord-prompt h2 { margin: 0 0 8px; font-size: 1.25rem; }
.discord-prompt ul { display: grid; gap: 4px; margin-bottom: 16px; list-style: none; }
.discord-prompt li { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 0.92rem; }
.discord-prompt li::before { content: ""; width: 6px; height: 6px; background: #5865f2; }
.discord-prompt-actions { display: flex; gap: 8px; }
.discord-prompt-actions .btn { font: inherit; font-size: 0.9rem; font-weight: 600; cursor: pointer; }
@keyframes prompt-in { from { opacity: 0; transform: translateY(16px); } }

/* Ban appeal */
.ban-box { margin-bottom: 20px; padding: 14px 16px; border: 1px solid var(--line); background: var(--bg); }
.ban-box strong { display: block; margin-bottom: 6px; }
.ban-box p { color: var(--muted); font-size: 0.92rem; }
.ban-box.is-banned { border-left: 3px solid var(--rust); }
.ban-box.is-clear { border-left: 3px solid #5fc27e; }
.ban-box dl { display: grid; gap: 4px; font-size: 0.92rem; }
.ban-box dl div { display: flex; gap: 10px; }
.ban-box dt { flex-shrink: 0; width: 56px; color: var(--muted); }
.appeal-fields[hidden] { display: none; }

@media (max-width: 760px) {
  .setting-discord { flex-wrap: wrap; }
  .setting-discord .btn { margin-left: 54px; }
}
@media (prefers-reduced-motion: reduce) {
  .discord-prompt { animation: none; }
}
