/* Leaderboards page. Colors come from the shared theme variables set by theme-shell.js. */
/* one column that never grows past the screen: a wide table scrolls inside its panel instead of widening the page */
.lb-main { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.4rem; padding: 2rem 0 3rem; }
.lb-main > * { min-width: 0; }
.lb-heading h1 { margin: 0.5rem 0 0.6rem; font-size: clamp(2.2rem, 4.5vw, 3.4rem); }
.lb-intro { max-width: 640px; margin: 0; color: var(--ink-soft); line-height: 1.6; }

.lb-gate, .lb-board {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  color: var(--text);
  padding: 1.3rem 1.4rem;
}
.lb-gate strong { display: block; font-size: 1.1rem; }
.lb-gate p { margin: 0.5rem 0 0; color: var(--muted); }
.lb-gate a { color: var(--accent); font-weight: 700; }
.lb-account { color: var(--ink); font-size: 0.85rem; font-weight: 700; }

.lb-preview-badge {
  display: inline-block;
  margin-bottom: 1rem;
  border: 1px dashed var(--accent-2);
  border-radius: 999px;
  color: var(--accent-2);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  padding: 0.25rem 0.75rem;
  text-transform: uppercase;
}

.lb-tabs { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; }
.lb-tabs button {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-weight: 750;
  padding: 0.5rem 1rem;
}
.lb-tabs button[aria-selected="true"] { border-color: var(--accent); background: var(--accent); color: var(--on-primary); }

.lb-filters { display: flex; flex-wrap: wrap; align-items: end; gap: 0.75rem 1rem; margin-bottom: 1rem; }
.lb-filters label { display: grid; gap: 0.3rem; color: var(--muted); font-size: 0.75rem; font-weight: 750; }
.lb-filters label[hidden] { display: none; }
.lb-filters input[type="search"] {
  min-width: 9rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-2);
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  padding: 0.45rem 0.6rem;
}
/* Every dropdown on the boards (week, season, server, filters): themed like the tabs, with a themed arrow and an
   open list in the theme's own colours instead of the browser's grey box. */
.lb-filters select, .lb-interlink select, .lb-server select {
  appearance: none;
  -webkit-appearance: none;
  min-width: 9rem;
  max-width: 100%;
  min-height: 2.35rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background-color: var(--panel-2);
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 1.05rem) 52%, calc(100% - 0.72rem) 52%;
  background-size: 0.34rem 0.34rem, 0.34rem 0.34rem;
  background-repeat: no-repeat;
  color: var(--text);
  color-scheme: inherit;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 650;
  padding: 0.45rem 2.2rem 0.45rem 0.85rem;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.lb-filters select:hover, .lb-interlink select:hover, .lb-server select:hover { border-color: var(--accent); }
.lb-filters select:focus-visible, .lb-interlink select:focus-visible, .lb-server select:focus-visible {
  border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.22);
}
.lb-filters select option, .lb-interlink select option, .lb-server select option { background-color: var(--panel); color: var(--text); }
.lb-filter-wide input[type="search"] { min-width: 14rem; }
.lb-filters .lb-check { display: flex; align-items: center; gap: 0.4rem; font-size: 0.8rem; }

.lb-summary { min-height: 1.2rem; margin: 0 0 0.6rem; color: var(--muted); font-size: 0.82rem; }
.lb-table-wrap { overflow-x: auto; }
.lb-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.lb-table th, .lb-table td { border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent); padding: 0.55rem 0.6rem; text-align: left; white-space: nowrap; }
.lb-table th { color: var(--muted); font-size: 0.74rem; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; }
.lb-table tbody tr:hover { background: color-mix(in srgb, var(--accent) 7%, transparent); }
.lb-table tr.is-own td { background: color-mix(in srgb, var(--accent-2) 10%, transparent); }
.lb-table tr.is-hidden td { opacity: 0.55; }
.lb-rank { width: 3rem; color: var(--accent-2); font-weight: 900; }
.lb-sort, .lb-expand { border: 0; background: none; color: inherit; cursor: pointer; font: inherit; padding: 0; text-transform: inherit; letter-spacing: inherit; }
.lb-sort.is-active { color: var(--accent); }
.lb-expand { color: var(--text); font-weight: 750; text-decoration: underline dotted; text-underline-offset: 3px; }
.lb-you { margin-left: 0.45rem; border-radius: 999px; background: var(--accent-2); color: var(--on-highlight); font-size: 0.66rem; font-weight: 900; padding: 0.05rem 0.45rem; text-transform: uppercase; }
.lb-empty { color: var(--muted); text-align: center; }

.lb-detail td { white-space: normal; background: color-mix(in srgb, var(--panel-2) 70%, transparent); }
.lb-players { width: auto; border-collapse: collapse; margin-bottom: 0.8rem; font-size: 0.8rem; }
.lb-players th, .lb-players td { border-bottom: 1px solid color-mix(in srgb, var(--line) 50%, transparent); padding: 0.3rem 0.8rem 0.3rem 0; text-align: left; }
.lb-buffs ol { columns: 2 14rem; margin: 0.4rem 0 0.8rem; padding-left: 1.2rem; }
.lb-facts { margin: 0 0 0.6rem; color: var(--muted); font-size: 0.8rem; }
.lb-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.lb-actions button { min-height: 0; font-size: 0.8rem; padding: 0.4rem 0.9rem; }
.lb-evidence { display: block; max-width: min(100%, 900px); border: 1px solid var(--line); border-radius: 12px; }

.lb-pager { display: flex; justify-content: center; align-items: center; gap: 1rem; margin-top: 1rem; color: var(--muted); font-size: 0.85rem; }
.lb-pager button:disabled { opacity: 0.45; cursor: default; transform: none; }

.lb-character { margin-left: 0.45rem; color: var(--muted); font-size: 0.78rem; }
.lb-character::before { content: "· "; }

/* boards inside a mode (Boss runs / Weekly total / ...) - a lighter second row of tabs */
.lb-board-tabs { margin-top: -0.4rem; }
.lb-board-tabs[hidden] { display: none; }
.lb-board-tabs button { padding: 0.3rem 0.8rem; font-size: 0.82rem; }
.lb-board-tabs button[aria-selected="true"] { border-color: var(--accent); background: transparent; color: var(--accent); }

/* party: AI teammates and links to public profiles */
.lb-ai { margin-left: 6px; padding: 0 6px; border-radius: 999px; background: color-mix(in srgb, currentColor 14%, transparent); font-size: 0.75em; font-weight: 700; letter-spacing: 0.04em; opacity: 0.8; }
a.lb-character, .lb-players a { color: inherit; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }

/* Interlink: the star icon, and the "i" explanations */
.lb-stars { display: inline-flex; align-items: center; gap: 0.3rem; font-variant-numeric: tabular-nums; }
.lb-star { width: 1.1em; height: 1.1em; flex: none; }
.lb-empty { padding: 1.2rem; text-align: center; opacity: 0.7; }
.lb-th-info { display: inline-flex; align-items: center; gap: 0.4rem; }
.lb-info { display: inline-grid; width: 1.25rem; height: 1.25rem; place-items: center; padding: 0; border: 1px solid var(--line);
  border-radius: 50%; background: transparent; color: var(--ink-soft); font: italic 700 0.75rem/1 Georgia, serif; text-transform: none; cursor: pointer; }
.lb-info:hover, .lb-info:focus-visible { border-color: var(--teal); color: var(--teal); outline: none; }
.lb-info-pop { width: min(360px, calc(100vw - 2rem)); margin: auto; padding: 1rem 1.1rem; border: 1px solid var(--line); border-radius: 16px;
  background: rgb(var(--panel-rgb)); color: var(--ink); box-shadow: var(--shadow); font-size: 0.9rem; font-weight: 400;
  letter-spacing: normal; line-height: 1.55; text-align: left; text-transform: none; white-space: normal; overflow: visible; }
.lb-info-pop::backdrop { background: rgba(0, 0, 0, 0.35); }
.lb-info-pop ul { margin: 0.5rem 0; padding-left: 1.1rem; color: var(--ink-soft); }
.lb-info-pop p { margin: 0; color: var(--ink-soft); }

/* a teammate's unclaimed row, a lookalike name */
.lb-mark { margin-left: 6px; padding: 0 6px; border-radius: 999px; background: color-mix(in srgb, currentColor 12%, transparent); font-size: 0.72em; font-weight: 700; letter-spacing: 0.03em; opacity: 0.75; cursor: help; }
.lb-lookalike { background: color-mix(in srgb, var(--coral) 22%, transparent); color: var(--coral); opacity: 1; }
.lb-player [title] { cursor: help; }

/* the game-server picker above the boards */
.lb-server { display: inline-flex; align-items: center; gap: 0.5rem; margin: 0.4rem 0 0.2rem; color: var(--ink-soft); font-size: 0.9rem; }

/* the run's screenshot: a camera next to the name, and the viewer */
.lb-proof { display: inline-grid; width: 1.4rem; height: 1.4rem; place-items: center; margin-left: 4px; padding: 0; border: 0;
  background: none; color: var(--ink-soft); vertical-align: middle; cursor: pointer; }
.lb-proof:hover { color: var(--teal); }
.lb-proof:focus-visible { color: var(--teal); outline: 2px solid var(--teal); outline-offset: 1px; border-radius: 4px; }
.lb-proof svg { width: 0.95rem; height: 0.95rem; }
.lb-proof-dialog { width: min(1280px, calc(100vw - 2rem)); padding: 0; border: 1px solid var(--line); border-radius: 14px;
  background: rgb(var(--panel-rgb)); color: var(--ink); box-shadow: var(--shadow); }
.lb-proof-dialog::backdrop { background: rgba(0, 0, 0, 0.6); }
.lb-proof-dialog form { position: absolute; top: 6px; right: 6px; margin: 0; }
.lb-proof-close { width: 2rem; height: 2rem; border: 0; border-radius: 50%; background: rgba(0, 0, 0, 0.55); color: #fff; font-size: 1.3rem; line-height: 1; cursor: pointer; }
.lb-proof-body { display: grid; min-height: 120px; place-items: center; }
.lb-proof-image { display: block; width: 100%; height: auto; border-radius: 14px; }

/* hover preview: the screenshot centred, as large as the window allows (never larger than its own 1280x720) */
.lb-proof-preview { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 2vmin; pointer-events: none; }
.lb-proof-preview[hidden] { display: none; }
.lb-proof-preview img { max-width: min(640px, 70vw); max-height: 60vh; width: auto; height: auto; border-radius: 12px;
  border: 1px solid var(--line); box-shadow: 0 18px 60px rgba(0, 0, 0, 0.55); }
.lb-proof-preview .lb-empty { padding: 0.8rem 1.1rem; border-radius: 10px; background: rgb(var(--panel-rgb)); }
.lb-proof-dialog { width: auto; max-width: min(1280px, 96vw); }
.lb-proof-image { max-height: 90vh; width: auto; max-width: 100%; }

.lb-proof-tabs { display: flex; gap: 6px; padding: 8px 52px 8px 10px; }
.lb-proof-tabs button { padding: 5px 12px; border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--ink-soft); cursor: pointer; }
.lb-proof-tabs button[aria-selected="true"] { border-color: var(--accent); color: var(--accent); }


/* Egg Heist: the Ladders dropdown in place of board tabs (styled like the other board dropdowns) */
.lb-ladders { display: inline-grid; gap: 0.25rem; font-size: 0.78rem; font-weight: 700; }
.lb-ladders select { appearance: none; -webkit-appearance: none; min-width: 13rem; min-height: 2.35rem; border: 1px solid var(--line);
  border-radius: 12px; background-color: var(--panel-2); color: var(--text); font: inherit; font-size: 0.9rem; font-weight: 650;
  padding: 0.45rem 2.2rem 0.45rem 0.85rem; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 1.05rem) 52%, calc(100% - 0.72rem) 52%; background-size: 0.34rem 0.34rem, 0.34rem 0.34rem; background-repeat: no-repeat; }
.lb-ladders select:hover, .lb-ladders select:focus-visible { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.22); }
.lb-ladders select option { background-color: var(--panel); color: var(--text); }

/* Phones: slimmer panel, full-width pickers and search, a tighter table that scrolls sideways inside the panel */
@media (max-width: 640px) {
  .lb-main { gap: 1rem; padding: 1.2rem 0 2rem; }
  .lb-gate, .lb-board { padding: 1rem 0.85rem; border-radius: 16px; }
  .lb-tabs { gap: 0.4rem; }
  .lb-tabs button { padding: 0.45rem 0.8rem; font-size: 0.85rem; }
  .lb-filters { gap: 0.6rem; }
  .lb-filters label { flex: 1 1 100%; }
  .lb-filters label.lb-check { flex: 0 1 auto; }
  .lb-filters select, .lb-interlink select, .lb-server select, .lb-ladders select, .lb-filters input[type="search"], .lb-filter-wide input[type="search"] {
    width: 100%; min-width: 0;
  }
  /* Server and Ladders stack like the other pickers: label above, full width */
  .lb-server, .lb-ladders { display: grid; width: 100%; gap: 0.3rem; margin: 0 0 0.7rem; color: var(--muted); font-size: 0.75rem; font-weight: 750; }
  .lb-server[hidden], .lb-ladders[hidden] { display: none; }
  .lb-table-wrap { margin: 0 -0.85rem; padding: 0 0.85rem; }
  .lb-table { font-size: 0.8rem; }
  .lb-table th, .lb-table td { padding: 0.45rem 0.4rem; }
  .lb-table th { font-size: 0.66rem; }
  .lb-rank { width: 1.8rem; }
  .lb-pager { gap: 0.5rem; }
}

/* Interlink: Per Boss (three boards, one a phone at a time) and Season Ladder */
.lb-interlink { --lb-left: #6fa8ff; --lb-center: #f2a93b; --lb-right: #c792ff; display: grid; gap: 0.8rem; margin-bottom: 0.8rem; }
.lb-interlink[hidden] { display: none; }
.lb-interlink .is-left { --slot: var(--lb-left); }
.lb-interlink .is-center { --slot: var(--lb-center); }
.lb-interlink .is-right { --slot: var(--lb-right); }
.lb-subbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.6rem 1rem; }
.lb-week-nav { display: flex; align-items: center; gap: 0.5rem; font-weight: 800; }
.lb-week-nav small { color: var(--muted); font-weight: 700; }
.lb-week-nav button { width: 2rem; height: 2rem; flex: none; border: 1px solid var(--line); border-radius: 50%; background: transparent;
  color: var(--text); font: inherit; font-size: 1.1rem; line-height: 1; cursor: pointer; }
.lb-week-nav button:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.lb-week-nav button:disabled { opacity: 0.35; cursor: default; }
.lb-updated { display: flex; align-items: center; gap: 0.5rem; margin: 0; color: var(--muted); font-size: 0.8rem; }
.lb-updated i { width: 0.5rem; height: 0.5rem; flex: none; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px rgba(var(--accent-rgb), 0.18); }
.lb-rules { display: flex; flex-wrap: wrap; gap: 0.3rem 1rem; margin: 0; color: var(--muted); font-size: 0.8rem; }
.lb-rules b { color: var(--text); }
.lb-note { margin: 0; color: var(--muted); font-size: 0.8rem; }

.lb-bosses { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.9rem; }
.lb-boss { display: grid; align-content: start; gap: 0.6rem; min-width: 0; border: 1px solid var(--line); border-top: 4px solid var(--slot, var(--accent));
  border-radius: 14px; background: color-mix(in srgb, var(--panel-2) 55%, transparent); padding: 0.75rem; }
.lb-boss-head, .lb-full-head { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; }
.lb-boss-head > div:first-child, .lb-full-head > div:first-child { min-width: 0; }
.lb-slot { color: var(--slot, var(--accent)); font-size: 0.7rem; font-weight: 900; letter-spacing: 0.12em; text-transform: uppercase; }
.lb-boss h3, .lb-full-head h3 { margin: 0; font-size: 1.05rem; line-height: 1.2; }
.lb-boss h3 small, .lb-full-head h3 small { color: var(--muted); font-size: 0.8rem; font-weight: 700; }
.lb-cap { display: grid; justify-items: end; gap: 0.1rem; flex: none; color: var(--muted); font-size: 0.72rem; font-weight: 700; }
.lb-cap .lb-stars { color: var(--text); font-size: 1rem; font-weight: 900; }
.lb-ladder { display: flex; align-items: center; gap: 0.5rem; color: var(--muted); font-size: 0.75rem; font-weight: 750; }
.lb-interlink .lb-ladder select { flex: 1; min-width: 0; }
.lb-rows { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
.lb-row { display: grid; grid-template-columns: 1.6rem minmax(0, 1fr) auto 3.4rem; align-items: center; gap: 0.5rem;
  border-radius: 8px; padding: 0.35rem 0.45rem; font-variant-numeric: tabular-nums; }
.lb-row:nth-child(odd) { background: color-mix(in srgb, var(--panel) 70%, transparent); }
.lb-row.is-own { background: color-mix(in srgb, var(--accent-2) 14%, transparent); }
.lb-rk { color: var(--muted); font-weight: 900; text-align: center; }
.lb-row:nth-child(1) .lb-rk { color: #e8b923; }
.lb-row:nth-child(2) .lb-rk { color: #a9b6ba; }
.lb-row:nth-child(3) .lb-rk { color: #d08a5a; }
.lb-who { display: grid; min-width: 0; }
.lb-who-name { overflow: hidden; font-size: 0.9rem; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.lb-who-name a { color: inherit; }
.lb-who small { color: var(--muted); font-size: 0.75rem; }
.lb-val { font-weight: 900; text-align: right; }
.lb-row .lb-stars { justify-content: flex-end; font-size: 0.82rem; font-weight: 800; }
.lb-more { border: 1px solid rgba(var(--accent-rgb), 0.6); border-radius: 10px; background: rgba(var(--accent-rgb), 0.08); color: var(--accent);
  font: inherit; font-weight: 900; padding: 0.5rem; cursor: pointer; }
.lb-more:hover { background: rgba(var(--accent-rgb), 0.16); }

/* View all: one board, every figure */
.lb-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; font-weight: 800; }
.lb-back { border: 0; background: none; color: var(--accent); font: inherit; font-weight: 900; padding: 0; cursor: pointer; }
.lb-full-head { border: 1px solid var(--line); border-top: 4px solid var(--slot, var(--accent)); border-radius: 14px;
  background: color-mix(in srgb, var(--panel-2) 55%, transparent); padding: 0.8rem 1rem; }
.lb-full-head h3 { font-size: 1.3rem; }
.lb-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.lb-chips button { border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--muted); font: inherit;
  font-size: 0.82rem; font-weight: 800; padding: 0.35rem 0.8rem; cursor: pointer; }
.lb-chips button[aria-pressed="true"] { border-color: var(--accent); background: rgba(var(--accent-rgb), 0.12); color: var(--accent); }
.lb-table .is-ranked { color: var(--accent); font-weight: 900; }
.lb-who-name .lb-proof { margin-left: 2px; }

/* Season Ladder */
.lb-split { display: flex; align-items: center; gap: 0.5rem; color: var(--muted); font-size: 0.8rem; font-weight: 800; }
.lb-bar { display: block; height: 4px; margin-top: 4px; overflow: hidden; border-radius: 999px; background: color-mix(in srgb, var(--line) 70%, transparent); }
.lb-bar i { display: block; height: 100%; background: linear-gradient(90deg, #e8b923, #ffd98a); }

/* Phones and the Companion app: one boss at a time, picked with Left / Center / Right */
.lb-slot-switch { display: none; }
@media (max-width: 760px) {
  .lb-bosses { grid-template-columns: minmax(0, 1fr); }
  .lb-boss[data-shown="false"] { display: none; }
  .lb-slot-switch { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 12px; }
  .lb-slot-switch button { border: 0; border-radius: 8px; background: transparent; color: var(--muted); font: inherit; font-size: 0.85rem;
    font-weight: 900; padding: 0.45rem 0.25rem; cursor: pointer; }
  .lb-slot-switch button small { display: block; overflow: hidden; font-size: 0.7rem; font-weight: 700; opacity: 0.85; text-overflow: ellipsis; white-space: nowrap; }
  .lb-slot-switch button[aria-selected="true"] { background: var(--slot, var(--accent)); color: #10181b; }
  .lb-subbar { flex-direction: column; align-items: stretch; }
  .lb-week-nav { justify-content: space-between; }
  .lb-split { display: grid; }
  .lb-split select { width: 100%; min-width: 0; }
  .lb-hide-sm { display: none; }
}
