/* Player profile: the statistics scorebook blocks around one shareable identity card. */
#view-profile { --chart-score: #edba5c; }
.profile-back { margin-bottom: 20px; }
.profile-hero { display: grid; gap: 22px; padding: 24px; margin-bottom: 24px; border: 1px solid #445047; border-top: 3px solid var(--sand); border-radius: 7px; background: var(--paper); }
.profile-identity { display: flex; align-items: center; gap: 16px; min-width: 0; }
.profile-identity .steam-avatar { flex-shrink: 0; }
.profile-identity > div { min-width: 0; }
.profile-identity h2 { margin: 0; font: 700 38px/1.1 var(--display); color: var(--text); overflow-wrap: anywhere; }
/* The name takes focus only to announce the new page; it is not a control. */
.profile-identity h2:focus { outline: none; }
.profile-subtitle { margin: 6px 0 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.profile-trophies { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 0; padding: 0; list-style: none; }
.profile-trophies li { display: inline-flex; align-items: center; gap: 6px; padding: 4px 9px; border: 1px solid #6b6038; border-radius: 4px; background: #2b2a1f; color: #e8c870; font-size: 12px; overflow-wrap: anywhere; }
.profile-trophies svg { width: 14px; height: 14px; flex-shrink: 0; }
.profile-stats { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 16px; margin: 0; }
.profile-stats > div { display: grid; gap: 6px; min-width: 0; padding-left: 16px; border-left: 2px solid var(--line); }
.profile-stats > div:first-child { border-color: var(--chart-score); }
.profile-stats dt { order: 2; color: var(--muted); font-size: 12px; }
.profile-stats dd { order: 1; margin: 0; font: 700 30px/1.1 var(--display); color: var(--text); overflow-wrap: anywhere; }
.profile-stats > div:first-child dd { color: var(--chart-score); }
.profile-actions { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; }
.profile-actions .button { min-height: 48px; }
.profile-compare-field { position: relative; display: grid; gap: 7px; min-width: min(260px, 100%); color: var(--muted); font-size: 13px; }
.profile-compare-field::after { content: ''; position: absolute; right: 16px; bottom: 21px; width: 6px; height: 6px; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: rotate(45deg); pointer-events: none; }
.profile-compare-field select { appearance: none; -webkit-appearance: none; box-sizing: border-box; width: 100%; min-height: 48px; padding: 10px 34px 10px 14px; border: 1px solid #56635b; border-radius: 4px; background: var(--bg); color: var(--text); font-size: 16px; }
.profile-compare-field select:focus-visible, .profile-body a:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 3px; }
.profile-missing { margin: 0 0 20px; }
.profile-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; align-items: start; }
.profile-compare, .profile-form, .profile-matches, .profile-records, .profile-badges { grid-column: 1 / -1; }
.profile-subheading { margin: 24px 0 12px !important; color: var(--insight-accent); }
.profile-lead { color: var(--insight-accent); font-weight: 600; }
/* Player names head the comparison columns; let long ones wrap instead of pushing a column off screen. */
.profile-compare .insights-table th { white-space: normal; overflow-wrap: anywhere; vertical-align: bottom; }
.profile-compare .insights-table th:not(:first-child), .profile-compare .insights-table td:not(:first-child) { width: 34%; }
.profile-duel { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.profile-match-cell { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
/* Map names stay on one line; the table already scrolls sideways on narrow screens. */
.profile-match { display: inline-flex; align-items: center; min-height: 44px; color: var(--text); text-decoration: none; white-space: nowrap; }
.profile-matches, .profile-matches .insights-table-wrap { overflow-anchor: none; }
.profile-matches .insights-table-wrap { position: relative; isolation: isolate; overscroll-behavior-x: none; }
.profile-matches .insights-table-wrap.scroll-capped { overscroll-behavior-y: none; }
.profile-matches .insights-table { border-collapse: separate; border-spacing: 0; }
.profile-matches .insights-table thead th { position: sticky; top: 0; z-index: 3; }
.profile-matches .insights-table tbody td:first-child,
.profile-matches .insights-table thead th:first-child { position: sticky; left: 0; border-right: 1px solid var(--line); }
.profile-matches .insights-table tbody td:first-child { z-index: 2; background: var(--paper); }
.profile-matches .insights-table thead th:first-child { z-index: 4; }
.profile-matches .profile-match { display: block; max-width: clamp(105px, 28vw, 220px); overflow: hidden; text-overflow: ellipsis; line-height: 44px; }
.profile-match:hover { color: var(--insight-accent); }
.profile-mvp { margin: 0; }
.profile-team { font-weight: 600; }
.profile-team-ct { color: #b8dfff; }
.profile-team-t { color: #ffc0b6; }
.profile-weapons { display: grid; gap: 4px; }
.profile-rivals > .insight-records { margin-bottom: 16px; }
.profile-body .insight-coverage { margin-top: 24px; }
@media (max-width: 1100px) {
  .profile-grid { grid-template-columns: minmax(0, 1fr); }
  .profile-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
  .profile-hero { padding: 18px 14px; gap: 18px; }
  .profile-identity h2 { font-size: 30px; }
  .profile-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 12px; }
  .profile-stats > div { padding-left: 12px; }
  .profile-stats dd { font-size: 26px; }
  .profile-actions { display: grid; grid-template-columns: minmax(0, 1fr); }
  .profile-compare-field { min-width: 0; }
  .profile-grid { gap: 20px; }
  .profile-duel { grid-template-columns: minmax(0, 1fr); }
}
.profile-periods { width: fit-content; max-width: 100%; margin: 0 0 24px; }
@media (max-width: 680px) { .profile-periods { width: 100%; } }

.profile-record-column { display: grid; align-content: start; gap: 18px; min-width: 0; }
.profile-clutch-column { grid-column: span 2; }
.profile-record-column > .insight-record { padding-left: 0; border-left: 0; }
.profile-rivals .profile-subheading { margin: 0 0 12px !important; padding-top: 16px; border-top: 1px solid var(--line); }
.profile-matches-footer { text-align: left !important; white-space: normal !important; }
.profile-matches-footer .button { min-height: 44px; }
.profile-matches-footer p:empty { display: none; }
.profile-matches-footer-content { position: sticky; left: 0; width: fit-content; max-width: 240px; }
@media (max-width: 620px) {
  .profile-clutch-column { grid-column: auto; }
  .profile-clutch-column > .insight-record { border-bottom: 0; padding-bottom: 0; }
  .profile-record-column:not(.profile-clutch-column) > .insight-record:last-child { padding-bottom: 16px; border-bottom: 1px solid var(--line); }
}
/* Desktop only: side, rival, map and weapon cards stack in one aligned column at a readable width;
   records read as two rows of three values, clutch first in the second row with its table beneath. */
@media (min-width: 1101px) {
  .profile-grid { grid-template-columns: minmax(0, 1fr); }
  .profile-grid > :is(.profile-sides, .profile-rivals, .profile-maps, .profile-weapons) { width: min(100%, 760px); }
  .profile-records .insight-records { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; }
  .profile-records .profile-record-column { display: contents; }
  .profile-records .insight-records > .insight-record { padding: 0 18px 18px; border-left: 1px solid var(--line); }
  .profile-records .profile-record-column > .insight-record { grid-row: 2; padding: 18px 18px 0; border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
  .profile-records .profile-clutch-column > .insight-record { grid-column: 1; }
  .profile-records .profile-record-column:not(.profile-clutch-column) > .insight-record:first-child { grid-column: 2; }
  .profile-records .profile-record-column:not(.profile-clutch-column) > .insight-record:last-child { grid-column: 3; padding-right: 0; }
  .profile-records .insight-records > .insight-record:first-child, .profile-records .profile-clutch-column > .insight-record { padding-left: 0; border-left: 0; }
  .profile-records .insight-records > .insight-record:nth-child(3) { padding-right: 0; }
  .profile-records .profile-clutch-table { grid-row: 3; grid-column: 1; margin-top: 18px; padding-right: 18px; }
}
