/* Desktop layout: navigation, friends, search and filters live in a fixed left column. */
:root { --side: 248px; }
[data-friend=qferus] { --friend: #5b9cff; }
[data-friend=psychoenergy] { --friend: #f0883e; }
[data-friend=berkud13] { --friend: #4fcf70; }
[data-friend=gillerj] { --friend: #f5d547; }

.side-label { display: none; }
.filter-group { position: relative; }
.segmented-source { position: absolute; top: 0; left: 0; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); opacity: 0; pointer-events: none; }
.side-segmented button { flex: 1 1 0; }

.favorite { display: inline-flex; align-items: center; gap: 8px; }
.favorite-avatar { position: relative; display: grid; place-items: center; flex: none; width: 26px; height: 26px; border: 2px solid var(--friend, var(--line)); border-radius: 50%; overflow: hidden; background: var(--soft); font-size: 9px; }
.favorite-avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

.player-initial[data-friend] { border: 2px solid var(--friend, var(--line)); border-radius: 50%; }
.cell-bar { display: block; width: 72px; height: 4px; margin: 6px 0 0 auto; }
.portal-page .comparison-table .best-value { color: var(--accent); font-weight: 700; }

.compare-chart-section { margin-top: 28px; }
.compare-chart-section .chart-controls { flex-wrap: wrap; gap: 10px 16px; }
.compare-legend { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.legend-chip { display: inline-flex; align-items: center; gap: 8px; min-height: 34px; padding: 0 12px; border: 1px solid var(--line); border-radius: 17px; background: var(--surface); color: var(--text); font-size: 14px; }
.legend-chip[aria-pressed=false] { opacity: .4; }
.chart-container.compare-chart { min-height: 300px; }
.chart-container.compare-chart svg { height: 280px; }

.replay-empty { position: relative; overflow: hidden; }
.replay-empty > *:not(.replay-preview) { position: relative; }
.replay-preview { position: absolute; top: 50%; left: 50%; width: auto; height: calc(100% - 24px); max-width: calc(100% - 24px); aspect-ratio: 1; object-fit: cover; transform: translate(-50%, -50%); opacity: .3; border-radius: 5px; pointer-events: none; }
.replay-empty p, .replay-empty small { color: #d2dae4; text-shadow: 0 1px 3px #000c; }

@media (min-width: 1000px) {
  body { padding-left: var(--side); }
  .site-header { position: fixed; top: 0; bottom: 0; left: 0; z-index: 20; width: var(--side); overflow-y: auto; border-right: 1px solid var(--line); }
  .site-header .container.header-inner { display: flex; flex-direction: column; align-items: stretch; gap: 0; min-height: 0; max-width: none; margin: 0; padding: 18px 16px 24px; }
  .site-header .brand { font-size: 19px; }
  .site-header nav { flex-direction: column; align-self: stretch; gap: 2px; margin-top: 18px; }
  .site-header nav a, .header-inner .site-header nav a { padding: 7px 10px; border-bottom: 0; border-radius: 6px; font-size: 15px; }
  .site-header nav a[aria-current=page] { background: var(--accent-bg); color: var(--accent); }
  .site-header nav a:hover { color: #fff; }
  .header-right { order: 99; margin: 22px 0 0; }
  .side-label { display: block; margin: 22px 0 8px; color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }

  .site-header .favorites { display: block; margin: 0; }
  .site-header .favorites-label { display: none; }
  .site-header #favorites { display: flex; flex-direction: column; gap: 2px; }
  .portal-page .site-header .favorites .favorite { display: flex; padding: 6px 8px; border: 1px solid transparent; background: transparent; color: var(--text); font-size: 14px; }
  .portal-page .site-header .favorites .favorite.active { background: #1c2a33; border-color: var(--line); color: var(--text); }
  .portal-page .site-header .favorites .favorite:hover { border-color: var(--line); color: var(--text); }

  .site-header .search-form { flex-wrap: wrap; flex: none; max-width: none; gap: 6px; margin-top: 8px; }
  .site-header .search-form > div { flex: 1 1 100%; }
  .site-header .search-form input { width: 100%; min-height: 36px; font-size: 14px; }
  .site-header .search-form select { flex: 1 1 0; width: auto; min-height: 34px; }
  .site-header .search-form button { flex: 1 1 0; min-height: 34px; }

  .portal-page .site-header .filters { flex-direction: column; align-items: stretch; gap: 10px; margin: 0; padding: 0; border: 0; }
  .site-header .filter-group label { margin-bottom: 4px; font-size: 12px; }
  .site-header .filter-group select, .site-header .filter-group:first-child select { width: 100%; min-width: 0; max-width: none; min-height: 34px; }
  .site-header .side-segmented { width: 100%; }
  .site-header .legacy-filter { margin: 0; }
  .site-header .legacy-filter select { width: 100%; }
  .portal-page .site-header .refresh-button, .portal-page .site-header #profile-refresh { width: 100%; margin: 4px 0 0; font-size: 13px; }
  .site-header .profile-refresh-status { margin: 8px 0 0; font-size: 12px; }

  .container { max-width: 1680px; padding: 0 28px; }
  .portal-page .page-heading { flex-wrap: nowrap; align-items: flex-end; gap: 28px; margin: 0 0 14px; padding: 14px 0 0; border-bottom: 1px solid var(--line); }
  .portal-page .page-heading > div:not(#player-banner) { padding-bottom: 10px; }
  .portal-page .page-heading h1 { font-size: 24px; }
  .portal-page #player-banner { padding-bottom: 10px; }
  .portal-page .page-heading .portal-tabs { margin: 0; border: 0; flex-wrap: nowrap; }
  .portal-page .replay-workspace { --replay-map-size: clamp(420px, calc(100dvh - 330px), 900px); grid-template-columns: 240px minmax(0, 1fr) 280px; }
  .portal-page .replay-empty { min-height: calc(var(--replay-map-size) + 60px); }
  /* Last 20 matches: totals and placements share one row. */
  .portal-page #matches-view .profile-recent { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin: 0 0 12px; }
  .portal-page #matches-view .profile-recent > .section-heading, .portal-page #matches-view #profile-recent-status { display: none; }
  .portal-page #matches-view .recent-summary { flex: 0 0 auto; margin: 0; }
  .portal-page #matches-view .recent-metrics { display: flex; gap: 22px; margin: 0; padding: 8px 16px; }
  .portal-page #matches-view .recent-metrics > div { display: flex; align-items: baseline; gap: 6px; }
  .portal-page #matches-view .recent-metrics dt { font-size: 13px; }
  .portal-page #matches-view .recent-metrics dd { margin: 0; font-size: 18px; white-space: nowrap; }
  .portal-page #matches-view .recent-placements { flex: 1 1 560px; min-width: 560px; padding: 0; gap: 3px; flex-wrap: nowrap; }
  .portal-page #matches-view .recent-placement { flex: 1 1 0; min-width: 0; padding: 4px 2px; }
}

/* Encounters: battles open under the player's row. */
.combat-row { cursor: pointer; }
.combat-toggle[aria-expanded=true] { border-color: var(--accent); color: var(--accent); }
.combat-detail-row > td { padding: 4px 14px 18px; background: var(--soft); text-align: left; white-space: normal; }
.combat-detail-row:hover { background: var(--soft); }
.combat-detail .table-container { margin-top: 8px; }
.combat-detail td, .combat-detail th { white-space: nowrap; }

/* Seasons chart tooltip: value plus whole-squad matches of that season. */
.chart-container.compare-chart { position: relative; }
.compare-tooltip { top: 8px; right: auto; max-width: 340px; white-space: pre-line; line-height: 1.45; z-index: 2; }
.compare-chart .chart-hit { cursor: pointer; }

/* PUBG rank insignias next to the rank name. */
.rank-badge { display: inline-flex; align-items: center; gap: 6px; vertical-align: middle; }
.rank-icon { flex: none; object-fit: contain; }
.portal-page .mode-card-rank { display: flex; align-items: center; gap: 10px; }
.portal-page .mode-card-rank .rank-icon { width: 40px; height: 40px; }
.comparison-table .rank-badge { justify-content: flex-end; }
