:root {
  color-scheme: dark;
  --bg: #0b0e14;
  --panel: #161b26;
  --border: #2a2f3a;
  --text: #e6e6e6;
  --muted: #8b93a3;
  --accent: #0ac8b9;
  --miss: #c9506a;

  /* Shared design tokens across Ladder & Clips */
  --font-display: "Space Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --numeric: "JetBrains Mono", ui-monospace, "SF Mono", "Cascadia Mono", Menlo, monospace;
  --crown-gold: #f0c250;
  --tier-gold: #d0a248;
  --gold-line: rgba(240, 194, 80, 0.45);
  --gold-dim: rgba(240, 194, 80, 0.22);
  --gold-glow: rgba(240, 194, 80, 0.15);
  --gold-soft: rgba(240, 194, 80, 0.08);

  --surface-raised: #121722;
  --surface-sunken: #0c1017;
  --surface-border: #232b3b;
  --hairline: #1e2430;

  --r-xs: 2px;
  --r-sm: 4px;
  --r-md: 6px;
  --r-lg: 8px;
  --r-pill: 999px;

  --control-h: 38px;
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 20px;
  --s-6: 24px;
  --s-7: 32px;
  --s-8: 48px;

  --surface-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);

  --ease: cubic-bezier(0.32, 0.72, 0, 1);

  /* Single site-wide page measure (~90% viewport, sensible cap for ultrawide).
     The 96px keeps a comfortable side gutter: 100vw includes the classic
     scrollbar (~10-17px on Windows), so 48px per side declared still measures
     >= 32px per side on screen. The tight value for phones lives in the
     max-width: 420px block below. */
  --page-width: min(1760px, calc(100vw - 96px));
}

* { box-sizing: border-box; }

/*
 * Reserve the scrollbar gutter on the root, always, and give the root
 * scrollbar one site-wide width. A tall page (the ladder with a real roster)
 * gets a classic vertical scrollbar and a short one does not; without a
 * reserved gutter the viewport's content width differs between the two by the
 * scrollbar's width, so every centred element -- the whole header, brand
 * first -- jumps by half of that on navigation. And the width itself is
 * chrome, not page style: scene.css used to set `thin` on the ladder alone,
 * which reserved a 10px gutter there and 15px everywhere else and left the
 * header measures still unequal. The thin dark rail is the site's look, so it
 * is stated once here. Headless browsers hide scrollbars and cannot see any
 * of this; tests hold the rule, not the pixel shift.
 */
html {
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: #232b3a transparent;
}

/*
 * One page shell for every page: a flex column at least a viewport tall, so
 * a short page (an empty profile, a bad replay id) still hangs its footer at
 * the bottom edge instead of letting it float mid-page. 100dvh, not 100vh,
 * so mobile browser chrome does not make the page taller than the visible
 * viewport; the sticky site header is in flow inside that height, so it
 * counts exactly once.
 */
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

header {
  padding: 24px 32px;
  border-bottom: 1px solid var(--border);
}

header h1 {
  margin: 0 0 4px 0;
  font-size: 1.6em;
}

#subtitle {
  margin: 0;
  color: var(--muted);
}

main {
  /* The growing region of the body shell: on a short page it absorbs the
     leftover viewport so the footer after it reaches the bottom edge. */
  flex: 1 0 auto;
  padding: 24px 32px;
  width: 100%;
  max-width: var(--page-width);
  margin: 0 auto;
}

/*
 * !important because several of the elements this is applied to set their own
 * display from an id selector, which otherwise outweighs this class and leaves
 * a "hidden" element on screen.
 */
.hidden { display: none !important; }

#controls {
  display: flex;
  gap: 20px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

#controls input[type="search"],
#controls select {
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 6px;
}

#controls input[type="search"] {
  min-width: 220px;
}

#controls label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 0.9em;
}

#leaderboard {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.leaderboard-item {
  display: flex;
  align-items: baseline;
  gap: 8px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 16px;
  font: inherit;
  color: inherit;
  cursor: pointer;
  transition: border-color 0.15s ease, filter 0.15s ease;
}

.leaderboard-item:hover {
  border-color: var(--accent);
  filter: brightness(1.15);
}

.leaderboard-item.rank-gold {
  border-color: #d4af37;
  background: linear-gradient(180deg, rgba(212, 175, 55, 0.15), var(--panel));
}

.leaderboard-item.rank-silver {
  border-color: #b0b8c1;
  background: linear-gradient(180deg, rgba(176, 184, 193, 0.15), var(--panel));
}

.leaderboard-item.rank-bronze {
  border-color: #cd7f32;
  background: linear-gradient(180deg, rgba(205, 127, 50, 0.15), var(--panel));
}

.leaderboard-crown {
  font-size: 1em;
}

.leaderboard-name {
  font-weight: 600;
}

.leaderboard-wins {
  color: var(--accent);
  font-weight: 700;
  font-size: 1.1em;
}

#summary {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.summary-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
  min-width: 140px;
}

.summary-card .value {
  font-size: 1.4em;
  font-weight: 700;
}

.summary-card .label {
  color: var(--muted);
  font-size: 0.85em;
}

.champ-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
  gap: 12px;
}

.grid-section-heading {
  margin: 24px 0 12px;
  font-size: 1em;
  color: var(--muted);
}

.grid-section-heading:first-child {
  margin-top: 0;
}

.grid-columns {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}

.grid-column {
  flex: 1;
  min-width: 0;
}

.grid-column .grid-section-heading:first-child {
  margin-top: 0;
}

@media (max-width: 900px) {
  .grid-columns {
    flex-direction: column;
  }
}

.champ-card {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  transition: filter 0.15s ease;
}

.champ-card:hover {
  filter: brightness(1.2);
}

.champ-icon {
  width: 84px;
  height: 84px;
  border-radius: 6px;
}

.champ-icon.greyed {
  filter: brightness(35%) saturate(0.4);
}

.champ-name {
  margin-top: 6px;
  font-size: 0.78em;
  line-height: 1.2;
  word-break: break-word;
}

.check-mark {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 26px;
  height: 26px;
  object-fit: contain;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.7));
  pointer-events: none;
}

.champ-card.done {
  border-color: rgba(10, 200, 185, 0.45);
  box-shadow: 0 0 10px rgba(10, 200, 185, 0.18), inset 0 0 10px rgba(10, 200, 185, 0.06);
}

.orb-wrap {
  position: relative;
}

.orb-wrap:hover {
  z-index: 5;
}

.orb {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
  background: #ffffff;
  border: 2px solid var(--panel);
  display: block;
  transition: transform 0.12s ease;
}

.orb-wrap:hover .orb {
  transform: translateY(-6px) scale(1.35);
}

.orb.rank-gold { border-color: #d4af37; }
.orb.rank-silver { border-color: #b0b8c1; }
.orb.rank-bronze { border-color: #cd7f32; }
.orb.rank-default { border-color: var(--border); }

.orb-label {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 0.62em;
  font-weight: 700;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease, transform 0.12s ease;
}

.orb-wrap:hover .orb-label {
  opacity: 1;
  transform: translateX(-50%) translateY(-4px);
}

.orb-overflow-chip {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--border);
  color: var(--text);
  font-size: 0.65em;
  font-weight: 700;
}

.overflow-panel {
  position: absolute;
  bottom: 100%;
  right: 0;
  margin-bottom: 8px;
  display: none;
  flex-wrap: wrap;
  gap: 8px;
  width: max-content;
  max-width: 220px;
  padding: 10px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  z-index: 10;
}

.orb-overflow:hover .overflow-panel {
  display: flex;
}

.overflow-panel .orb-wrap {
  margin-left: 0;
}

.fan {
  display: flex;
  justify-content: center;
  margin-top: 14px;
  height: 40px;
}

.fan-slot {
  margin-left: -12px;
  transform: rotate(var(--rotate, 0deg));
  transition: transform 0.15s ease;
}

.fan-slot:first-child {
  margin-left: 0;
}

.fan-slot:hover {
  transform: rotate(0deg) translateY(-6px) scale(1.15);
  z-index: 5;
}

.fan-overflow {
  margin-left: 4px;
}

.hide-icons .fan {
  display: none;
}

#status {
  color: var(--muted);
  padding: 20px 0;
}

#status.error {
  color: var(--miss);
}

/* Recent wins banner */
#winBanner {
  display: flex;
  gap: 10px;
  flex-wrap: nowrap;
  overflow-x: auto;
  padding-bottom: 6px;
  margin-bottom: 20px;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

#winBanner::-webkit-scrollbar {
  height: 6px;
}

#winBanner::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

#winBanner::-webkit-scrollbar-track {
  background: transparent;
}

.win-card {
  flex: 0 0 auto;
  scroll-snap-align: start;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 14px 8px 8px;
  transition: border-color 0.15s ease;
}

.win-card:hover {
  border-color: var(--accent);
}

.win-card .champ-icon {
  width: 52px;
  height: 52px;
  border-radius: 6px;
}

.win-card-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.win-card-name {
  display: flex;
  align-items: center;
  gap: 6px;
}

.win-card-name .orb {
  width: 18px;
  height: 18px;
}

.win-card-player {
  font-size: 1.15em;
  font-weight: 700;
  line-height: 1.1;
}

.win-card-sub {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72em;
  color: var(--muted);
}

.win-card-sub .kda {
  color: var(--text);
  opacity: 0.75;
  font-variant-numeric: tabular-nums;
}

.win-card-items {
  display: flex;
  align-items: center;
  gap: 3px;
  margin-top: 3px;
}

.win-card-items .item-icon {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  border: 1px solid var(--border);
  display: block;
}

.win-card-ribbon {
  position: absolute;
  top: 9px;
  right: -26px;
  transform: rotate(45deg);
  background: linear-gradient(180deg, #e8c95c, #d4af37);
  color: #0b0e14;
  font-size: 0.52em;
  font-weight: 800;
  letter-spacing: 0.2em;
  padding: 2px 30px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}

/* ----------------------------------------------------------------- shared site chrome (ladder + clips) */

.wrap,
#replayWorkspace {
  width: var(--page-width);
  margin-inline: auto;
}

/*
 * The Riot fan-content notice: one treatment for every page, defined here
 * and nowhere else. The hairline top rule is the header's own bottom edge
 * mirrored -- the page is framed by the same line top and bottom -- and the
 * centred muted type sits quiet on the ladder's glowing stage as well as on
 * a plain page, where a tinted plate would read as a dropped content box.
 */
footer.legal {
  width: var(--page-width);
  max-width: var(--page-width);
  margin-inline: auto;
  padding: clamp(24px, 4vw, 40px) 0;
  text-align: center;
  border-top: 1px solid var(--hairline);
  box-sizing: border-box;
}

footer.legal p {
  margin: 0;
  width: 100%;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.5;
  opacity: 0.8;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: 0;
  border-bottom: 1px solid var(--hairline);
  background: rgba(11, 14, 20, 0.88);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

/*
 * The replay workspace's header variant -- the same chrome, one shade colder
 * to sit over the replay stage. It lives here with the rest of the header
 * component rather than in replay.css: every class a header element carries
 * must be owned by this file, or a page stylesheet could reach the chrome
 * (the way clips.css's .wrap redefinition used to shift the brand).
 */
.site-header.replay-site-header {
  background: rgba(8, 11, 16, 0.86);
  backdrop-filter: blur(14px);
}

/*
 * The header owns its measure, and no other stylesheet can take it away.
 *
 * clips.css redefines .wrap to the wider --wall-max the five-column clip grid
 * needs, and player.css narrows .wrap again at small widths. A .wrap override
 * is harmless for page content -- that is what it is for -- so the guarantee
 * is structural, not cascade order: the header's measure-owner carries only
 * the site-header__inner class in the markup of every page (never .wrap), and
 * states its width here, in the file every page loads first. tests/
 * header-consistency.test.js holds the line: no page stylesheet may carry a
 * rule for any class that appears on a header element.
 */
/*
 * Site chrome scale, shared by every page.
 *
 * The ladder scales its own main by --ladder-zoom so the board reads at the
 * size it was designed at, and the header was scaled with it -- scoped to the
 * ladder, because clips shares this file. The result was two different
 * headers: same 1200px measure, rendered 20% apart. The owner chose to scale
 * both rather than neither, so the knob and the rule live here now and the
 * ladder no longer zooms the header a second time. Nested zoom multiplies:
 * 1.2 applied twice would be 1.44.
 */
:root {
  --header-zoom: 1.2;
}

.site-header {
  zoom: var(--header-zoom);
}

/*
 * Three columns: brand | primary nav | page actions. The 1fr auto 1fr track
 * list keeps the middle column geometrically centered no matter how uneven
 * the brand and the actions column are -- Register, Rules and the session
 * avatar live in the third column and can never push the destinations off
 * center, on any page that loads this file.
 */
.site-header__inner {
  width: calc(var(--page-width) / var(--header-zoom));
  margin-inline: auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding-block: 8px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  grid-column: 1;
  justify-self: start;
  min-width: 0;
  color: var(--text);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
}

.brand i {
  display: inline-block;
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  background: url("/assets/icons/icon-192.png") center / cover no-repeat;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  order: -1;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  grid-column: 2;
  justify-self: center;
}

/*
 * The nav ships hidden and js/site/session-nav.js reveals it for a signed-in
 * reader. This rule is what makes that work: `display: flex` above outranks the
 * user agent's own `[hidden] { display: none }`, so without it the attribute
 * would be inert and every visitor would see the nav regardless. Explicit
 * grid-column placement on all three children keeps the columns stable even
 * while the middle one is display: none.
 */
.site-nav[hidden] {
  display: none;
}

/*
 * Page actions -- Register, the Rules shortcut and the session/avatar area --
 * share a reserved third column, right-aligned. The column is reserved in the
 * markup of every page even when empty, so the destinations stay put relative
 * to the header edges and centered in the header, whatever a page puts here.
 */
.site-header__actions {
  display: flex;
  align-items: center;
  gap: 12px;
  grid-column: 3;
  justify-self: end;
  min-width: 0;
}

.site-nav a {
  display: inline-flex;
  align-items: center;
  padding: 8px 10px;
  color: var(--muted);
  text-decoration: none;
  font-family: var(--font-display);
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  white-space: nowrap;
  border-radius: var(--r-sm);
  transition: color 150ms ease, background 150ms ease;
}

.site-nav a:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

.site-nav a[aria-current="page"] {
  color: var(--crown-gold);
  background: rgba(240, 194, 80, 0.1);
  box-shadow: inset 0 0 0 1px rgba(240, 194, 80, 0.35);
}

/*
 * Phase-gated links (the ladder page's Clips link ships hidden and
 * js/ladder/page.js reveals it for the phases that allow the gallery). Same
 * story as .site-nav[hidden] above: display is declared on .site-nav a, so
 * without this the attribute would be inert.
 */
.site-nav a[hidden] {
  display: none;
}

/*
 * Action buttons live in the reserved actions column now, not inside the nav,
 * so their styles are scoped to the column instead of assuming a .site-nav
 * parent. Spacing between actions comes from the column's gap, not margins.
 * display is declared here, so -- exactly like .site-nav above -- the user
 * agent's [hidden] rule would be outranked and the attribute inert; the
 * explicit [hidden] rules below keep phase gating (js/ladder/rules.js,
 * updateClipsNavRegistration) actually hiding these.
 */
.site-header__actions .nav-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  min-width: 26px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  cursor: pointer;
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1;
  white-space: nowrap;
  transition: color 150ms ease, border-color 150ms ease, background 150ms ease;
}

.site-header__actions .nav-icon-btn:hover {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.07);
}

.site-header__actions .nav-register-btn {
  display: inline-flex;
  align-items: center;
  /* The unread-decision dot anchors here; position changes nothing else. */
  position: relative;
  padding: 5px 12px;
  min-height: 28px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: linear-gradient(180deg, #1f2737, #131924);
  color: #e6e9ee;
  cursor: pointer;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.76rem;
  letter-spacing: 0.03em;
  white-space: nowrap;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 1px 3px rgba(0, 0, 0, 0.3);
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease, transform 120ms var(--ease), box-shadow 150ms ease;
}

.site-header__actions .nav-register-btn:hover {
  border-color: rgba(255, 255, 255, 0.22);
  background: linear-gradient(180deg, #273247, #18202e);
  color: #ffffff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 2px 6px rgba(0, 0, 0, 0.4);
}

.site-header__actions .nav-register-btn:active {
  transform: translateY(1px);
}

/*
 * Unread registration decision. Absolutely positioned so its appearing
 * cannot shift the nav; the accessible name is the button's aria-label
 * ("Register — registration decision unread"), set alongside this attribute
 * by js/ladder/page.js, so the dot is never a bare unnamed mark.
 */
.site-header__actions .nav-register-btn[data-decision-badge="true"]::after {
  content: "";
  position: absolute;
  top: -3px;
  right: -3px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--crown-gold);
  box-shadow: 0 0 0 2px var(--bg), 0 0 6px var(--gold-glow);
}

.site-header__actions .nav-register-btn[hidden],
.site-header__actions .nav-icon-btn[hidden] {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .site-header__actions .nav-register-btn,
  .site-header__actions .nav-icon-btn {
    transition: none;
    transform: none;
  }
}

.session-action {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
  min-width: 0;
}

.session-action:empty {
  display: none;
}

.session-name {
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
}

.session-name small {
  display: block;
  color: var(--muted);
  font-family: var(--numeric);
  font-size: 0.62rem;
  font-weight: 400;
  letter-spacing: 0.04em;
}

.site-header .avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2b3345, #141a24);
  border: 1px solid var(--border);
  color: var(--crown-gold);
  font-family: var(--numeric);
  font-size: 0.74rem;
  font-weight: 700;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  overflow: hidden;
  text-transform: uppercase;
}

.site-header .avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/*
 * Narrow screens reflow instead of shrinking: brand and page actions share the
 * top row and the destinations take the full width of a second row, still
 * centered. The nav is never hidden to fit -- three destinations, a brand and
 * an actions column overflow long before a phone does.
 */
@media (max-width: 640px) {
  .site-header__inner {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas:
      "brand actions"
      "nav nav";
    row-gap: 0;
  }

  .brand {
    grid-area: brand;
  }

  .site-nav {
    grid-area: nav;
    padding-top: 2px;
  }

  .site-header__actions {
    grid-area: actions;
  }

  /* The actions row also carries Register and the ? shortcut; the display
     name is the one piece that can push them off it. The avatar still
     identifies the session, exactly as at 420px and below. */
  .session-name {
    display: none;
  }
}

@media (max-width: 420px) {
  :root {
    --page-width: min(1760px, calc(100vw - 20px));
  }

  .wrap {
    width: var(--page-width);
  }

  .site-header__inner {
    /* Mirrors the narrow .wrap above: the header keeps its own measure, so
       the tighter gutter has to be restated rather than inherited. */
    width: calc(var(--page-width) / var(--header-zoom));
    column-gap: 8px;
    min-height: 48px;
    padding-block: 6px;
  }

  .brand {
    font-size: 0.64rem;
    letter-spacing: 0.14em;
    gap: 8px;
  }

  .site-nav a,
  .site-header__actions .nav-register-btn,
  .site-header__actions .nav-icon-btn {
    padding: 8px 8px;
    font-size: 0.72rem;
  }

  .session-name {
    display: none;
  }

  .site-header .avatar {
    width: 28px;
    height: 28px;
    font-size: 0.66rem;
  }
}

/* --------------------------------------------------------- shared view tabs */

.view-tabs {
  display: flex;
  gap: 4px;
  margin: 0 0 24px;
  border-bottom: 1px solid var(--border);
}

.view-tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border: 0;
  background: none;
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 180ms ease;
}

.view-tab:hover {
  color: var(--text);
}

.view-tab::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: -1px;
  height: 2px;
  background: var(--crown-gold);
  opacity: 0;
  transform: scaleX(0.4);
  transition: opacity 200ms var(--ease), transform 200ms var(--ease);
}

.view-tab.is-active {
  color: var(--text);
}

.view-tab.is-active::after {
  opacity: 1;
  transform: none;
}

.view-tab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -4px;
  border-radius: 4px;
}

.view-panel[hidden] {
  display: none !important;
}

/* --------------------------------------------------------- profile menu */

.profile-menu-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.profile-trigger {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 4px 12px 4px 4px;
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  color: var(--text);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease;
}

.profile-trigger:hover,
.profile-trigger[aria-expanded="true"] {
  border-color: var(--gold-line);
  background: var(--surface-raised);
}

.profile-trigger:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.profile-name {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-chevron {
  color: var(--muted);
  transition: transform 180ms ease, color 150ms ease;
  flex: 0 0 auto;
}

.profile-trigger[aria-expanded="true"] .profile-chevron {
  transform: rotate(180deg);
  color: var(--crown-gold);
}

.profile-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 180px;
  padding: 6px 0;
  margin: 0;
  list-style: none;
  background: #0f131c;
  border: 1px solid var(--gold-line);
  border-radius: var(--r-md);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.7);
  z-index: 100;
  display: flex;
  flex-direction: column;
}

.profile-menu.hidden,
.profile-menu[hidden] {
  display: none !important;
}

.profile-menu__item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 14px;
  border: 0;
  background: none;
  color: var(--text);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  box-sizing: border-box;
  text-align: left;
  transition: background 120ms ease, color 120ms ease;
}

.profile-menu__item:hover,
.profile-menu__item:focus-visible {
  background: rgba(240, 194, 80, 0.1);
  color: var(--crown-gold);
  outline: none;
}

.profile-menu__item--danger {
  color: #f87171;
  border-top: 1px solid var(--hairline);
  margin-top: 4px;
  padding-top: 10px;
}

.profile-menu__item--danger:hover,
.profile-menu__item--danger:focus-visible {
  background: rgba(239, 68, 68, 0.12);
  color: #fca5a5;
}

/* --------------------------------------------------------- shared sign-in gate & Discord button */

.btn-discord {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2, 8px);
  min-height: var(--control-h, 38px);
  padding: 0 16px;
  border-radius: var(--r-sm);
  border: 1px solid #5865F2;
  background: #5865F2;
  color: #ffffff;
  font-family: var(--font-display);
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  box-shadow: 0 2px 6px rgba(88, 101, 242, 0.3);
  transition: background 150ms ease, border-color 150ms ease, transform 120ms var(--ease), box-shadow 150ms ease;
}

.btn-discord:hover:not(:disabled) {
  background: #4752C4;
  border-color: #4752C4;
  box-shadow: 0 4px 12px rgba(88, 101, 242, 0.45);
}

.btn-discord:active:not(:disabled) {
  transform: translateY(1px);
}

.btn-discord--sm {
  min-height: 32px;
  padding: 0 10px;
  font-size: 0.78rem;
}

.btn-discord:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  box-shadow: none;
}

.gate {
  position: relative;
  display: grid;
  justify-items: center;
  gap: var(--s-4, 16px);
  padding: clamp(32px, 6vw, 60px) clamp(20px, 5vw, 56px);
  text-align: center;
  border: 1px solid var(--gold-dim);
  border-radius: var(--r-lg);
  background:
    radial-gradient(120% 100% at 50% 0%, rgba(240, 194, 80, 0.06), transparent 62%),
    var(--surface-raised);
  -webkit-backdrop-filter: blur(16px) saturate(115%);
  backdrop-filter: blur(16px) saturate(115%);
  box-shadow: var(--surface-shadow, 0 10px 30px rgba(0, 0, 0, 0.45));
}

.gate::before,
.gate::after {
  content: "";
  position: absolute;
  pointer-events: none;
  width: 26px;
  height: 26px;
  border-color: var(--gold-line);
  border-style: solid;
  border-width: 0;
}

.gate::before {
  top: -1px;
  left: -1px;
  border-top-width: 1px;
  border-left-width: 1px;
}

.gate::after {
  right: -1px;
  bottom: -1px;
  border-right-width: 1px;
  border-bottom-width: 1px;
}

.gate-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2, 8px);
  margin: 0;
  color: var(--crown-gold);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.gate-eyebrow svg {
  flex: 0 0 auto;
}

.gate h2 {
  margin: 0;
  font-size: clamp(1.5rem, 4vw, 2.15rem);
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.gate p {
  margin: 0;
  color: var(--muted);
  font-size: clamp(0.9rem, 2.5vw, 1.05rem);
  max-width: 48ch;
}

.gate .btn-discord {
  min-height: 52px;
  padding: 0 26px;
  font-size: 0.98rem;
  box-shadow: 0 14px 34px rgba(3, 6, 10, 0.45);
}

.gate-hint {
  color: var(--muted);
  font-size: clamp(0.85rem, 2vw, 0.95rem);
  max-width: 48ch;
}

.gate--compact {
  gap: var(--s-3, 12px);
  padding: clamp(16px, 3vw, 24px) clamp(16px, 3vw, 28px);
  border-radius: var(--r-md, 8px);
}

.gate--compact::before,
.gate--compact::after {
  width: 16px;
  height: 16px;
}

.gate--compact .gate-eyebrow {
  font-size: 0.65rem;
  gap: 6px;
}

.gate--compact h2 {
  font-size: clamp(1.05rem, 2.5vw, 1.35rem);
}

.gate--compact .btn-discord {
  min-height: 38px;
  padding: 0 16px;
  font-size: 0.86rem;
  box-shadow: 0 4px 12px rgba(88, 101, 242, 0.35);
}

/* --------------------------------------------------------- info dialog */

dialog.rules-dialog {
  padding: 0;
  border: 0;
  background: transparent;
  max-width: min(680px, calc(100vw - 48px));
  max-height: calc(100dvh - 48px);
  width: 100%;
  color: var(--text);
}

dialog.rules-dialog::backdrop {
  background: rgba(3, 6, 12, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.rules-dialog__panel {
  display: grid;
  gap: var(--s-4, 16px);
  padding: 32px 36px;
  border: 1px solid var(--gold-dim);
  border-radius: var(--r-lg);
  background:
    radial-gradient(ellipse 600px 300px at 50% 0%, rgba(216, 186, 107, 0.08), transparent 70%),
    linear-gradient(180deg, #181d28 0%, #10141c 100%);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.7);
  overflow-y: auto;
  max-height: calc(100dvh - 48px);
}

.rules-dialog__title {
  margin: 0;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.rules-dialog__panel .signup-rules-item {
  font-size: 1rem;
  line-height: 1.6;
}

.rules-dialog__panel .signup-rules {
  margin: 0;
  padding: 20px 24px;
  max-height: min(62dvh, 520px);
  overflow-y: auto;
}

.rules-dialog__actions {
  display: flex;
  justify-content: flex-end;
}

.rules-dialog__ok {
  flex: 0 0 auto;
  padding: 12px 28px;
  border: 1px solid #d8ba6b;
  border-radius: 8px;
  background: rgba(216, 186, 107, 0.1);
  color: #d8ba6b;
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: background 200ms ease, color 200ms ease;
}

.rules-dialog__ok:hover {
  background: #d8ba6b;
  color: #171207;
}

.rules-dialog__ok:focus-visible {
  outline: 2px solid var(--crown-gold);
  outline-offset: 2px;
}

.rules-dialog__close {
  background: none;
  border: 0;
  color: var(--muted);
  font-size: 1.2rem;
  line-height: 1;
  padding: var(--s-1, 4px);
  cursor: pointer;
  border-radius: var(--r-sm);
  transition: color 150ms ease;
}

.rules-dialog__close:hover {
  color: var(--text);
}

@media (prefers-reduced-motion: reduce) {
  .rules-dialog__ok,
  .rules-dialog__close {
    transition: none;
  }
}

.signup-rules {
  margin: 0 0 20px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--panel);
  color: var(--muted);
  font-family: var(--font-display);
  letter-spacing: normal;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

.signup-rules-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.signup-rules-item {
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--muted);
}

.signup-rules-topic {
  color: var(--text);
  font-weight: 600;
}

.signup-rules-detail {
  color: var(--muted);
}

/* --------------------------------------------------------- League cursor */

/*
 * The League hand (assets/league/cursors/, provenance and hotspot measurements
 * in assets/league/PROVENANCE.md) replaces the system cursor for mouse users.
 * The preference lives in localStorage under "leagueCursor" and defaults to on;
 * a synchronous inline <head> script on every page sets
 * html[data-league-cursor] before first paint, so neither state can flash the
 * wrong cursor while the modules load.
 *
 * `!important` because this file is every page's FIRST stylesheet: the page
 * sheets loaded after it declare `cursor: pointer` on most controls at equal
 * or higher specificity, and the interactive hand has to win over those the
 * same way `.hidden` wins over id-styled display. Disabled controls are left
 * out of the interactive rule so their own `wait` / `not-allowed` states keep
 * meaning what they say. Every declaration keeps a native keyword fallback, so
 * a failed PNG degrades to the system cursor, never to no cursor at all.
 *
 * The whole block sits behind `@media (pointer: fine)`: touch and pen have no
 * hovering cursor to replace.
 */
@media (pointer: fine) {
  html[data-league-cursor="on"] body {
    cursor: url("/assets/league/cursors/hand1.png") 10 9, auto !important;
  }

  /*
   * Interactive controls get the hover/interactive variant, whose fingertip
   * hotspot sits one pixel higher in that image's glow halo (10 7 vs 10 9).
   */
  html[data-league-cursor="on"] a,
  html[data-league-cursor="on"] button:not(:disabled):not([disabled]),
  html[data-league-cursor="on"] select,
  html[data-league-cursor="on"] summary,
  html[data-league-cursor="on"] label[for],
  html[data-league-cursor="on"] input[type="button"]:not(:disabled):not([disabled]),
  html[data-league-cursor="on"] input[type="submit"]:not(:disabled):not([disabled]),
  html[data-league-cursor="on"] input[type="reset"]:not(:disabled):not([disabled]),
  html[data-league-cursor="on"] input[type="checkbox"],
  html[data-league-cursor="on"] input[type="radio"],
  html[data-league-cursor="on"] input[type="range"],
  html[data-league-cursor="on"] [role="button"],
  html[data-league-cursor="on"] [role="link"],
  html[data-league-cursor="on"] [role="menuitem"],
  html[data-league-cursor="on"] [role="tab"],
  html[data-league-cursor="on"] [role="option"],
  html[data-league-cursor="on"] [role="checkbox"],
  html[data-league-cursor="on"] [role="radio"],
  html[data-league-cursor="on"] [role="switch"] {
    cursor: url("/assets/league/cursors/hand1_tco.png") 10 7, pointer !important;
  }

  /* Text entry keeps the I-beam instead of a pointing hand. */
  html[data-league-cursor="on"] input:not([type]),
  html[data-league-cursor="on"] input[type="text"],
  html[data-league-cursor="on"] input[type="search"],
  html[data-league-cursor="on"] input[type="email"],
  html[data-league-cursor="on"] input[type="password"],
  html[data-league-cursor="on"] input[type="number"],
  html[data-league-cursor="on"] input[type="tel"],
  html[data-league-cursor="on"] input[type="url"],
  html[data-league-cursor="on"] textarea,
  html[data-league-cursor="on"] [contenteditable] {
    cursor: auto;
  }

  /*
   * The replay player's controls are the browser's own overlay on the <video>
   * element, so cutting inheritance there keeps system cursors over playback.
   */
  html[data-league-cursor="on"] video {
    cursor: auto;
  }

  /*
   * The clip editor's filmstrip cursors need no rule here: the crosshair
   * track, grab selection and ew-resize handles (replay-clip-maker.css) are
   * explicit declarations, which always beat an inherited one, and none of the
   * interactive selectors above match a div. replay-page verification asserts
   * the computed values stay crosshair / grab / ew-resize.
   */
}

/*
 * The header toggle (js/site/league-cursor.js) reflects the preference in
 * aria-pressed; when the League cursor is off the control reads as at rest.
 */
.site-header__actions .nav-icon-btn[aria-pressed="false"] {
  color: var(--muted);
  opacity: 0.55;
}


