/* Geared and Feared — public site.
 *
 * Palette is lifted verbatim from the panel's globals.css so the two read as one product. The
 * typography deliberately is not: the panel is a dashboard and uses system-ui for density, while
 * this is the front door and gets a condensed display face for the headlines. Same identity,
 * different job.
 *
 * Single stylesheet, no build step, no framework. The whole site is four pages.
 */

:root {
  --bg: #0a0a0b;
  --surface: #141416;
  --raised: #1c1c1f;
  --hairline: #232326;
  --edge: #33333a;
  --ink: #f4f4f3;
  --ink-2: #a5a4a0;
  --ink-3: #8a8984;
  --brand: #e5484d;
  --brand-hi: #f2686c;
  --brand-deep: #b32f34;
  --good: #0ca30c;
  --good-hi: #4ebf85;
  --warn: #e5a83a;

  --display: 'Barlow Condensed', 'Arial Narrow', system-ui, sans-serif;
  --body: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --gutter: clamp(1.15rem, 4vw, 2.5rem);
  --max: 1120px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: var(--brand-hi); }
img { max-width: 100%; display: block; }

.wrap { max-width: var(--max); margin: 0 auto; padding-inline: var(--gutter); }
.tabular { font-variant-numeric: tabular-nums; }

/* ---------- header ---------- */

.top {
  position: sticky; top: 0; z-index: 40;
  background: rgba(10, 10, 11, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--hairline);
}
.top-in { display: flex; align-items: center; gap: 1rem; min-height: 60px; }

.mark { display: flex; align-items: center; gap: 0.6rem; text-decoration: none; color: var(--ink); }
.mark svg { width: 26px; height: 26px; flex-shrink: 0; }
.mark b {
  font-family: var(--display); font-weight: 700; font-size: 1.05rem;
  letter-spacing: 0.06em; text-transform: uppercase; white-space: nowrap;
}
.mark b i { color: var(--brand); font-style: normal; }

.nav { margin-left: auto; display: flex; align-items: center; gap: 0.15rem; }
.nav a {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 0.85rem;
  border-radius: 8px; text-decoration: none; color: var(--ink-2);
  font-size: 0.9rem; font-weight: 500;
}
.nav a:hover { color: var(--ink); background: var(--raised); }
.nav a[aria-current='page'] { color: var(--brand); }

/* Four links, one of them the word "Leaderboard", do not fit beside the wordmark on a phone. The
 * shield alone still reads as the logo and still goes home, so the text is what gives way.
 *
 * This has to sit AFTER the rules it overrides: a media query adds no specificity, so placed above
 * `.nav a` it would lose on source order and the padding would silently stay at 0.85rem. */
@media (max-width: 620px) {
  .top-in { gap: 0.5rem; }
  .mark b { display: none; }
  .nav a { padding: 0 0.5rem; font-size: 0.82rem; }
}
@media (max-width: 400px) {
  .nav a { padding: 0 0.36rem; font-size: 0.78rem; }
}

/* ---------- hero ---------- */

.hero { position: relative; overflow: hidden; border-bottom: 1px solid var(--hairline); }
.hero::before {
  content: ''; position: absolute; inset: 0;
  background:
    radial-gradient(90% 120% at 82% 8%, rgba(229, 72, 77, 0.16), transparent 60%),
    linear-gradient(180deg, #121214 0%, var(--bg) 100%);
}
/* Faint contour texture so the hero is not a flat colour field. Pure CSS, no image request. */
.hero::after {
  content: ''; position: absolute; inset: 0; opacity: 0.32;
  background-image:
    repeating-linear-gradient(115deg, transparent 0 38px, rgba(255,255,255,0.028) 38px 39px),
    repeating-linear-gradient(-25deg, transparent 0 64px, rgba(255,255,255,0.02) 64px 65px);
  mask-image: linear-gradient(180deg, #000 0%, transparent 85%);
}
.hero-in { position: relative; padding-block: clamp(2.75rem, 8vw, 5.5rem) clamp(2.25rem, 6vw, 4rem); }

.eyebrow {
  font-family: var(--display); text-transform: uppercase; letter-spacing: 0.2em;
  font-size: 0.78rem; font-weight: 600; color: var(--ink-3); margin: 0 0 0.5rem;
}
h1 {
  font-family: var(--display); font-weight: 800;
  font-size: clamp(2.9rem, 12vw, 6.5rem); line-height: 0.92; letter-spacing: 0.005em;
  text-transform: uppercase; margin: 0; text-wrap: balance;
}
h1 i { color: var(--brand); font-style: normal; }

.tagline {
  margin: 1.1rem 0 0; max-width: 34ch;
  font-size: clamp(1rem, 2.4vw, 1.2rem); color: var(--ink-2);
}

.traits { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 1.4rem; padding: 0; list-style: none; }
.traits li {
  font-family: var(--display); text-transform: uppercase; letter-spacing: 0.09em;
  font-size: 0.82rem; font-weight: 600; color: var(--ink-2);
  border: 1px solid var(--edge); border-radius: 999px; padding: 0.3rem 0.8rem;
}

.cta-row { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 1.9rem; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  min-height: 50px; padding: 0 1.5rem; border-radius: 10px;
  font-family: var(--display); font-weight: 700; font-size: 1.05rem;
  letter-spacing: 0.06em; text-transform: uppercase; text-decoration: none;
  border: 1px solid transparent; transition: background 0.15s ease, border-color 0.15s ease;
}
.btn-primary { background: var(--brand-deep); color: #fff; }
.btn-primary:hover { background: var(--brand); }
.btn-ghost { border-color: var(--edge); color: var(--ink); background: var(--surface); }
.btn-ghost:hover { border-color: var(--ink-3); }

/* ---------- live status ---------- */

.live {
  display: inline-flex; align-items: center; gap: 0.65rem; margin-top: 1.9rem;
  border: 1px solid var(--hairline); background: var(--surface);
  border-radius: 999px; padding: 0.5rem 1.1rem 0.5rem 0.9rem;
}
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ink-3); flex-shrink: 0; }
.live[data-state='up'] .dot { background: var(--good-hi); animation: pulse 2.4s ease-in-out infinite; }
.live[data-state='down'] .dot { background: var(--brand); }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

.live-count { font-family: var(--display); font-weight: 700; font-size: 1.3rem; line-height: 1; }
.live-label { font-size: 0.85rem; color: var(--ink-2); }

/* ---------- sections ---------- */

section { padding-block: clamp(2.5rem, 7vw, 4.5rem); }
section + section { border-top: 1px solid var(--hairline); }

h2 {
  font-family: var(--display); font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.05em; font-size: clamp(1.6rem, 4.5vw, 2.3rem);
  margin: 0 0 0.5rem; text-wrap: balance;
}
.lede { color: var(--ink-2); max-width: 62ch; margin: 0 0 2rem; }

.stat-row {
  display: grid; gap: 0.75rem;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}
.stat {
  border: 1px solid var(--hairline); background: var(--surface);
  border-radius: 10px; padding: 1.1rem 1.2rem;
}
.stat b {
  display: block; font-family: var(--display); font-weight: 700;
  font-size: clamp(1.9rem, 5vw, 2.6rem); line-height: 1; color: var(--ink);
}
.stat span {
  display: block; margin-top: 0.35rem; font-size: 0.76rem; color: var(--ink-3);
  text-transform: uppercase; letter-spacing: 0.09em;
}

.cards { display: grid; gap: 0.85rem; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.card {
  border: 1px solid var(--hairline); background: var(--surface);
  border-radius: 10px; padding: 1.3rem;
}
.card h3 {
  font-family: var(--display); font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.05em; font-size: 1.15rem; margin: 0 0 0.4rem; color: var(--ink);
}
.card p { margin: 0; color: var(--ink-2); font-size: 0.94rem; }

/* ---------- numbered steps ---------- */

.steps { list-style: none; counter-reset: step; padding: 0; margin: 0; display: grid; gap: 0.75rem; }
.steps li {
  counter-increment: step; position: relative;
  border: 1px solid var(--hairline); background: var(--surface);
  border-radius: 10px; padding: 1.1rem 1.2rem 1.1rem 3.6rem;
}
.steps li::before {
  content: counter(step); position: absolute; left: 1.1rem; top: 1rem;
  font-family: var(--display); font-weight: 700; font-size: 1.25rem;
  color: var(--brand); line-height: 1;
}
/* Direct children only. A bare `.steps b` also matched the bold words inside the sentences below,
 * which turned "size is 32 slots, and there is no password" into three stacked lines. */
.steps > li > b { display: block; color: var(--ink); font-size: 1rem; margin-bottom: 0.15rem; }
.steps p b { color: var(--ink); font-weight: 600; }
.steps p { margin: 0; color: var(--ink-2); font-size: 0.93rem; }
.steps code {
  font-family: var(--mono); font-size: 0.86em; background: var(--raised);
  border: 1px solid var(--hairline); border-radius: 5px; padding: 0.1em 0.4em;
  overflow-wrap: anywhere;
}

/* ---------- rules ---------- */

.rules { display: grid; gap: 0.7rem; padding: 0; margin: 0; list-style: none; counter-reset: rule; }
.rules li {
  counter-increment: rule;
  border-left: 2px solid var(--brand-deep); background: var(--surface);
  border-radius: 0 10px 10px 0; padding: 0.95rem 1.2rem;
}
.rules > li > b { display: block; color: var(--ink); margin-bottom: 0.1rem; }
.rules p b { color: var(--ink); font-weight: 600; }
.rules > li > b::before { content: counter(rule) ". "; color: var(--brand); }
.rules p { margin: 0; color: var(--ink-2); font-size: 0.93rem; }

/* ---------- leaderboard ---------- */

/* Two rows of pills pick what the table shows: the first the stat, the second the period. */

/* The site header is position:sticky at 60px and drawPager scrolls this element to the top of the
 * viewport, so without this the header lands on top of row 1 after every page change. */
#standings { scroll-margin-top: 72px; }

.pick { margin-bottom: 0.9rem; }
.pick-label {
  margin: 0 0 0.4rem;
  font-family: var(--display); text-transform: uppercase; letter-spacing: 0.14em;
  font-size: 0.7rem; font-weight: 600; color: var(--ink-3);
}
.pills { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.pill {
  display: inline-flex; align-items: center; min-height: 40px; padding: 0 0.85rem;
  border: 1px solid var(--hairline); border-radius: 999px;
  background: var(--surface); color: var(--ink-2);
  font-size: 0.86rem; font-weight: 500; white-space: nowrap;
  cursor: pointer; user-select: none;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.pill:hover { color: var(--ink); border-color: var(--edge); }
.pill.on {
  background: rgba(229, 72, 77, 0.16);
  border-color: var(--brand); color: var(--ink); font-weight: 600; cursor: default;
}

.board-search { margin: 1.1rem 0 0.9rem; }
.board-search input {
  width: min(320px, 100%);
  background: var(--bg); border: 1px solid var(--hairline); border-radius: 10px;
  color: var(--ink); font-family: var(--body); font-size: 0.94rem;
  padding: 0.6rem 0.9rem; min-height: 46px;
  transition: border-color 0.15s ease;
}
.board-search input:focus { outline: none; border-color: var(--brand); }
.board-search input::placeholder { color: var(--ink-3); }

/* The board is ONE framed panel: a bordered surface with a filled header strip and hairline-separated
 * rows, not a stack of floating cards. That frame is the page's visual anchor and it works the same
 * at 390px and at 1440px. */
.board-table {
  width: 100%;
  /* Fixed layout is the whole fix for the desktop void. With auto layout the name column was the
   * only flexible track, so it absorbed every spare pixel and threw the numbers at the far edge. */
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 12px;
  overflow: hidden;
}

.board-table thead th {
  background: var(--raised);
  border-bottom: 1px solid var(--hairline);
  font-family: var(--display); text-transform: uppercase; letter-spacing: 0.1em;
  font-size: 0.72rem; font-weight: 600; color: var(--ink-3);
  text-align: left; padding: 0.6rem 0.9rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.board-table th.num, .board-table td.num { text-align: right; }

.board-table td {
  padding: 0.7rem 0.9rem;
  font-size: 0.94rem; color: var(--ink-2);
  border-top: 1px solid var(--hairline);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.board-table tbody tr:first-child td { border-top: 0; }
.board-table tbody tr:hover td { background: var(--raised); }

.c-rank {
  width: 3.25rem; color: var(--ink-3);
  font-family: var(--display); font-weight: 700; font-size: 1.1rem;
}
.c-who { width: 14rem; color: var(--ink); font-weight: 600; }
.c-main {
  color: var(--ink) !important;
  font-family: var(--display); font-weight: 700; font-size: 1.3rem;
}
/* A hairline dropped through the whole table where the numbers begin, so the number block has a
 * left edge to sit against instead of floating in the gap after the name. */
.board-table th.c-main, .board-table td.c-main { border-left: 1px solid var(--hairline); }

/* The compact supporting-stat line under a name. Phone only. */
.who-meta { display: none; }

/* Top three by colour only, no medals. */
.board-table tr[data-top] .c-rank { color: var(--ink); }
.board-table tr[data-top='1'] .c-rank { color: #f0c14b; }
.board-table tr[data-top='2'] .c-rank { color: #c8cdd4; }
.board-table tr[data-top='3'] .c-rank { color: #d98341; }
.board-table tr[data-top='1'] td:first-child { box-shadow: inset 2px 0 0 var(--brand); }

.board-count { margin: 0.9rem 0 0; font-size: 0.84rem; color: var(--ink-3); }
.board-note { margin: 0.5rem 0 0; font-size: 0.84rem; color: var(--ink-3); }

.pg { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem; margin-top: 1rem; }
.pgb {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 42px; min-width: 42px; padding: 0 0.7rem;
  border: 1px solid var(--hairline); border-radius: 9px;
  color: var(--ink-2); font-size: 0.86rem; font-weight: 600;
  cursor: pointer; user-select: none;
}
.pgb:hover { color: var(--ink); border-color: var(--edge); }
.pgb.on { background: rgba(229, 72, 77, 0.16); border-color: var(--brand); color: var(--ink); cursor: default; }
.pgb.off { opacity: 0.3; pointer-events: none; }
.pge { display: inline-flex; align-items: center; padding: 0 0.2rem; color: var(--ink-3); }
.pg-at { display: none; }

.empty {
  border: 1px dashed var(--edge); border-radius: 12px;
  padding: 1.6rem 1.2rem; margin: 0; text-align: center; color: var(--ink-3);
}

/* Tablet: five columns and a 14rem name track get tight before the phone layout takes over. */
@media (max-width: 900px) {
  .c-who { width: 10rem; }
  .board-table th, .board-table td { padding-inline: 0.7rem; }
  .c-main { font-size: 1.2rem; }
}

/* ---------- the phone board ---------- */

@media (max-width: 720px) {

  /* Nine categories wrapped to three rows and cost 150px above the fold. One sideways strip
   * instead, bled to the screen edges and faded on the right so it is obvious there is more. */
  #cats {
    flex-wrap: nowrap; overflow-x: auto;
    margin-inline: calc(var(--gutter) * -1);
    padding-inline: var(--gutter); padding-block: 2px;
    scroll-snap-type: x proximity; scroll-padding-inline: var(--gutter);
    scrollbar-width: none; -webkit-overflow-scrolling: touch;
    -webkit-mask-image: linear-gradient(90deg, #000 0 calc(100% - 2.25rem), transparent 100%);
    mask-image: linear-gradient(90deg, #000 0 calc(100% - 2.25rem), transparent 100%);
  }
  #cats::-webkit-scrollbar { display: none; }
  #cats .pill { flex: 0 0 auto; scroll-snap-align: start; min-height: 44px; }

  #periods { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.35rem; }
  #periods .pill { min-height: 44px; justify-content: center; }

  .board-table, .board-table thead, .board-table tbody,
  .board-table tr, .board-table th, .board-table td { display: block; width: auto; }

  /* One header strip for the whole list, not a label row per stat per player. */
  .board-table thead tr {
    display: flex; align-items: center; justify-content: space-between;
    background: var(--raised); border-bottom: 1px solid var(--hairline);
  }
  .board-table thead th { background: none; border: 0; padding: 0.5rem 0.85rem; }
  .board-table thead th.c-who { padding-left: 3.4rem; }
  .board-table thead th.c-main { border-left: 0; }
  .board-table thead th.c-rank,
  .board-table thead th.num:not(.c-main) { display: none; }

  .board-table tbody tr {
    display: grid;
    grid-template-columns: 1.85rem minmax(0, 1fr) auto;
    align-items: center; column-gap: 0.7rem;
    padding: 0.6rem 0.85rem;
    border-top: 1px solid var(--hairline);
  }
  .board-table tbody tr:first-child { border-top: 0; }
  .board-table tbody td { border: 0 !important; border-radius: 0 !important; padding: 0; background: none !important; }
  .board-table tbody tr:hover td { background: none !important; }

  .board-table td.c-rank { grid-column: 1; text-align: center; font-size: 1.05rem; }
  .board-table td.c-who  { grid-column: 2; line-height: 1.25; white-space: normal; overflow: hidden; }
  .board-table td.c-main { grid-column: 3; font-size: 1.45rem; line-height: 1.1; }
  /* The supporting numbers are not dropped, they move into .who-meta under the name. */
  .board-table tbody td.num:not(.c-main) { display: none; }

  .who-meta {
    display: block; margin-top: 0.1rem; line-height: 1.35;
    font-family: var(--body); font-size: 0.76rem; font-weight: 400;
    color: var(--ink-3); font-variant-numeric: tabular-nums;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .board-table td.c-who > :first-child { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  .board-table tr[data-top='1'] { box-shadow: inset 2px 0 0 var(--brand); }
  .board-table tr[data-top='1'] td:first-child { box-shadow: none; }

  /* Prev and Next are the whole pager on a phone; the numbers are a desktop affordance. */
  .pg { display: grid; grid-template-columns: 1fr auto 1fr; gap: 0.5rem; }
  .pgb.n, .pge { display: none; }
  .pgb.prev, .pgb.next { width: 100%; min-height: 48px; }
  .pgb.prev { justify-self: start; }
  .pgb.next { justify-self: end; }
  .pg-at {
    display: block; text-align: center;
    font-family: var(--display); text-transform: uppercase; letter-spacing: 0.1em;
    font-size: 0.8rem; font-weight: 600; color: var(--ink-3);
  }
}

@media (max-width: 380px) {
  .who-meta { font-size: 0.74rem; }
  .board-table td.c-main { font-size: 1.35rem; }
}

/* ---------- notice ---------- */

.notice {
  border: 1px solid rgba(229, 168, 58, 0.4); background: rgba(229, 168, 58, 0.09);
  border-radius: 10px; padding: 0.9rem 1.1rem; margin-bottom: 1.6rem;
}
.notice b { color: var(--ink); display: block; margin-bottom: 0.15rem; }
.notice p { margin: 0; color: var(--ink-2); font-size: 0.92rem; }

/* ---------- footer ---------- */

footer { border-top: 1px solid var(--hairline); padding-block: 2rem 2.6rem; }
.foot-in { display: flex; flex-wrap: wrap; gap: 0.9rem 1.6rem; align-items: center; }
.foot-in p { margin: 0; color: var(--ink-3); font-size: 0.85rem; }
.foot-nav { margin-left: auto; display: flex; flex-wrap: wrap; gap: 1.1rem; }
.foot-nav a { color: var(--ink-3); text-decoration: none; font-size: 0.85rem; }
.foot-nav a:hover { color: var(--ink-2); }

:focus-visible { outline: 2px solid var(--brand-hi); outline-offset: 2px; border-radius: 4px; }

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