/* Palette and typography follow battlepass.ru: dark blue-gray surfaces
   (#23282e / #2b323c / #334056), bright blue accent (#0396ff), green/red
   status colors (#48c432 / #eb4242) and the Jost typeface. */
:root {
  --bg: #23282e;
  --panel: #2b323c;
  --panel-deep: #1d2630;
  --border: #334056;
  --text: #ffffff;
  --muted: #cfd4da;
  --accent: #0396ff;
  --accent-hover: #0078d6;
  --good: #48c432;
  --bad: #eb4242;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  /* Jost is battlepass.ru's typeface; use it when locally installed but
     don't pull it from Google Fonts - that CDN is unreliable/blocked from
     Russia and a render-blocking font <link> was leaving the whole page
     stuck on a blank screen. System sans-serif fallback instead. */
  font-family: "Jost", -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: var(--panel-deep);
  border-bottom: 1px solid var(--border);
}

header h1 {
  font-size: 22px;
  font-weight: 600;
  margin: 0;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

#collect-status {
  color: var(--muted);
  font-size: 13px;
  max-width: 480px;
}

/* Sits inside a hint line, so it reads as a link rather than an action. */
.scope-toggle {
  background: transparent;
  color: var(--accent);
  border: none;
  padding: 0;
  margin-left: 6px;
  font: inherit;
  cursor: pointer;
  text-decoration: underline;
}

.scope-toggle:hover {
  background: transparent;
  color: var(--text);
}

/* Player notes: a shared scouting board, so it has to look like something you
   write in rather than another statistics block. */
.note-list {
  list-style: none;
  margin: 0 0 14px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.note {
  background: var(--panel-deep);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
}

.note-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}

.note-head b {
  color: var(--text);
  font-size: 13px;
}

.note-date {
  margin-right: auto;
}

.note-delete {
  background: transparent;
  color: var(--muted);
  border: none;
  padding: 0 4px;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.note-delete:hover {
  color: var(--bad);
  background: transparent;
}

/* Long words in a note must not stretch the column. */
.note-text {
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.note-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.note-form input,
.note-form textarea {
  width: 100%;
  background: var(--panel-deep);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 14px;
  resize: vertical;
}

.note-form input:focus,
.note-form textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.note-error {
  color: var(--bad);
  font-size: 12px;
  min-height: 14px;
}

/* The offer shown where the running cup's data would be, for a visitor
   without a key. Sized to read as a page of its own, not as an error. */
.lock-panel {
  max-width: 560px;
  margin: 40px auto;
  padding: 28px 32px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
}

.lock-panel h2 {
  margin: 0 0 12px;
}

.lock-panel p {
  color: var(--muted);
  line-height: 1.55;
  margin: 0 0 14px;
}

.lock-panel .lock-offer {
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.lock-panel .lock-offer b {
  color: var(--text);
}

/* Cup switcher: deliberately quieter than the action buttons next to it -
   it picks which tournament you are looking at, it isn't an action. */
#cup-switcher {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 10px;
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
}

#cup-switcher:hover {
  border-color: var(--accent);
}

button {
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 9px 18px;
  font-size: 14px;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}

button:hover:not(:disabled) {
  background: var(--accent-hover);
}

.header-link-btn {
  background: var(--accent);
  color: white;
  border-radius: 8px;
  padding: 9px 18px;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  display: inline-block;
  transition: background 0.15s;
}

.header-link-btn:hover {
  background: var(--accent-hover);
}

button:disabled {
  opacity: 0.5;
  cursor: default;
}

main {
  display: flex;
  min-height: calc(100vh - 65px);
}

aside {
  width: 280px;
  border-right: 1px solid var(--border);
  padding: 16px;
}

aside h2 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin: 0 0 12px;
  font-weight: 600;
}

.team-btn {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--panel);
  color: var(--text);
  border: 1px solid transparent;
  margin-bottom: 8px;
  padding: 10px 14px;
  border-radius: 8px;
  font-weight: 400;
}

.team-btn:hover {
  border-color: var(--accent);
  background: var(--panel);
}

.team-btn.active {
  border-color: var(--accent);
  background: #334056;
}

#team-detail {
  flex: 1;
  padding: 24px;
}

.hint {
  color: var(--muted);
}

.players-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.player-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
}

.player-card h3 {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

.profile-links {
  display: inline-flex;
  gap: 6px;
}

.profile-link {
  color: var(--muted);
  display: inline-flex;
}

.profile-link:hover {
  color: var(--accent);
}

.player-card .mmr {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--accent);
  font-weight: 600;
}

.total-mmr {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.next-opponent {
  margin: 4px 0 20px;
  color: var(--text);
  font-size: 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 14px;
  display: inline-block;
}

.next-opponent strong {
  color: var(--accent);
}

.player-link {
  background: none;
  border: none;
  padding: 0;
  color: var(--text);
  font-size: inherit;
  font-weight: inherit;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
}

.player-link:hover {
  background: none;
  color: var(--accent);
  text-decoration: underline;
}

.player-card .roles {
  margin: -6px 0 10px;
  font-size: 12px;
  color: var(--muted);
}

.player-meta {
  color: var(--muted);
  font-size: 15px;
  margin: 4px 0 12px;
}

#team-detail h2 .profile-links {
  margin-left: 10px;
  vertical-align: middle;
}

/* Match history (wide, the main thing) with the hero pools as a narrow
   column beside it. align-items:start keeps the pools their own height
   instead of stretching to the full length of the history table. */
.player-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 16px;
  align-items: start;
}

/* The pools stack vertically, one block per tournament. Sticky because the
   history is long: the pool stays in view while scrolling through it. */
.player-pools {
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: sticky;
  top: 16px;
}

/* Below this the side column is too narrow for the tags to read well, so
   the pools go back to full width above the history. */
@media (max-width: 900px) {
  .player-body {
    grid-template-columns: 1fr;
  }
  .player-pools {
    position: static;
    order: -1;
  }
}

.player-heroes-block {
  margin-top: 0;
}

.history-title {
  font-size: 15px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 24px 0 4px;
  font-weight: 600;
}

/* Inside the two-column body its usual top margin would push the history
   down and leave the pools column starting higher than it. */
.player-history .history-title {
  margin-top: 0;
}

.tournament-divider td {
  background: var(--panel-deep);
  color: var(--accent);
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}

/* Marks a team page showing a FINISHED cup's squad rather than the current
   one - reached from a past cup's match in a player's history. */
.tournament-badge {
  display: inline-block;
  margin-left: 8px;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 999px;
  background: rgba(3, 150, 255, 0.14);
  color: var(--accent);
  vertical-align: middle;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.former-team-badge {
  display: inline-block;
  margin-left: 6px;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 8px;
  border-radius: 999px;
  background: rgba(207, 212, 218, 0.12);
  color: var(--muted);
  vertical-align: middle;
}

.last-lineup {
  margin: 4px 0 20px;
  color: var(--muted);
  font-size: 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 14px;
  display: inline-block;
  max-width: 720px;
}

.last-lineup strong {
  color: var(--text);
  font-weight: 600;
}

.opponent-link {
  background: none;
  border: none;
  padding: 0;
  color: var(--accent);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
}

.opponent-link:hover {
  background: none;
  color: var(--accent-hover);
}

.player-card ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.player-card li {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 14px;
  color: var(--muted);
}

.player-card li .count {
  color: var(--text);
  font-weight: 600;
  margin-left: 8px;
}

.player-card li .winrate {
  font-weight: 600;
}

.player-card li .wr-good {
  color: var(--good);
}

.player-card li .wr-bad {
  color: var(--bad);
}

.drafts-section {
  margin-top: 28px;
}

.drafts-section h3 {
  font-size: 15px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 12px;
  font-weight: 600;
}

.draft-match {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px 16px;
  margin-bottom: 14px;
}

.match-result {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 2px 10px;
  border-radius: 999px;
  margin-bottom: 8px;
}

.match-result.result-win {
  background: rgba(72, 196, 50, 0.15);
  color: var(--good);
}

.match-result.result-loss {
  background: rgba(235, 66, 66, 0.15);
  color: var(--bad);
}

.match-result.result-unknown {
  background: rgba(207, 212, 218, 0.12);
  color: var(--muted);
}

.draft-team-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
}

.draft-team-label {
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  width: 140px;
  flex-shrink: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.draft-cells {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.draft-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 44px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--panel-deep);
  border: 1px solid var(--border);
}

.draft-cell img {
  width: 44px;
  height: 25px;
  object-fit: cover;
}

.draft-cell .cell-order {
  font-size: 10px;
  color: var(--muted);
  align-self: flex-start;
  padding: 1px 3px;
}

.draft-cell .cell-label {
  font-size: 9px;
  font-weight: 700;
  text-align: center;
  width: 100%;
  padding: 1px 0;
}

.draft-cell.cell-pick .cell-label {
  background: rgba(72, 196, 50, 0.15);
  color: var(--good);
}

.draft-cell.cell-ban .cell-label {
  background: rgba(235, 66, 66, 0.15);
  color: var(--bad);
}

.draft-cell.cell-ban img {
  opacity: 0.5;
  filter: grayscale(60%);
}

.tabs {
  display: flex;
  gap: 8px;
  margin: 12px 0 20px;
  border-bottom: 1px solid var(--border);
}

.tab-btn {
  background: transparent;
  color: var(--muted);
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  padding: 8px 4px;
  font-size: 14px;
  cursor: pointer;
}

.tab-btn:hover {
  background: transparent;
  color: var(--text);
}

.tab-btn.active {
  color: var(--text);
  border-bottom-color: var(--accent);
}

.coach-text {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  line-height: 1.6;
  font-size: 15px;
  max-width: 720px;
}

.sub-list {
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
  max-width: 560px;
}

.sub-item {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 8px;
  font-size: 14px;
}

.sub-date {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.rating-diff {
  font-weight: 600;
  margin-left: 6px;
}

.rating-diff-up {
  color: var(--good);
}

.rating-diff-down {
  color: var(--bad);
}

.sub-team-rating {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.subs-table {
  border-collapse: collapse;
  margin-top: 16px;
  font-size: 14px;
}

.subs-table th,
.subs-table td {
  text-align: left;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
}

.subs-table th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.subs-table .subs-date {
  color: var(--muted);
  white-space: nowrap;
  font-size: 13px;
}

.sub-mmr {
  color: var(--accent);
  font-weight: 600;
}

.analysis-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.analysis-block {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px 16px;
}

.analysis-block h4 {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 13px;
}

/* Hero pills carry Valve's icon. inline-flex (not inline-block) so the icon
   and label centre against each other whatever the font metrics do. */
.tag-hero {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding-left: 4px;
}

.hero-icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
  /* Valve's icons are transparent PNGs drawn for a dark background; the disc
     keeps every hero the same silhouette regardless of their artwork. */
  background: rgba(0, 0, 0, 0.35);
  flex-shrink: 0;
}

/* --- Match page ------------------------------------------------------- */

.match-row {
  cursor: pointer;
}

.match-row:hover td {
  background: rgba(255, 255, 255, 0.03);
}

.back-link {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  padding: 0;
  margin-bottom: 8px;
}

.vs {
  color: var(--muted);
  font-size: 0.7em;
  font-weight: 400;
}

.ext-link {
  color: var(--accent);
  text-decoration: none;
}

.lineups {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
  margin-top: 12px;
}

@media (max-width: 900px) {
  .lineups {
    grid-template-columns: 1fr;
  }
}

.lineup-block h4 {
  margin: 0 0 8px;
  font-size: 14px;
}

.lineup-hero {
  display: flex;
  align-items: center;
  gap: 8px;
}

.lineup-kda,
.lineup-num {
  white-space: nowrap;
  color: var(--muted);
  text-align: right;
}

.draft-match {
  margin-top: 8px;
}

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

.leaderboard-table th.sortable {
  cursor: pointer;
  user-select: none;
}

.leaderboard-table th.sortable:hover {
  color: var(--text);
}

.lb-rank {
  color: var(--muted);
  width: 32px;
}

.lb-heroes {
  white-space: nowrap;
}

.lb-heroes .hero-icon {
  margin-right: 4px;
  vertical-align: middle;
}

.wr-good { color: #48c432; }
.wr-bad { color: #eb4242; }

.tag-neutral {
  background: rgba(207, 212, 218, 0.12);
  color: var(--text);
}

.tag-pick {
  background: rgba(72, 196, 50, 0.15);
  color: var(--good);
}

.tag-ban {
  background: rgba(235, 66, 66, 0.15);
  color: var(--bad);
}
