/* Player profile tabs and compact per-map win rates (player.html only).
   Tabs: gold pill / segmented control in a site-style card (mockup A). */
.pf-tabs {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-wrap: nowrap;
  gap: 4px;
  margin: 16px 0 16px;
  padding: 5px;
  border: 1px solid var(--line, #34434d);
  border-radius: 12px 4px;
  background: linear-gradient(145deg, rgba(23, 31, 38, .96), rgba(27, 30, 38, .96));
  box-shadow: 0 8px 24px rgba(0, 0, 0, .28);
  backdrop-filter: blur(16px);
  overflow: visible;
}
.pf-tabs .pf-tab {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  min-height: 52px;
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border: 1px solid transparent;
  border-radius: 9px 3px;
  background: transparent;
  color: var(--muted, #9aa6ae);
  font: inherit;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: .02em;
  line-height: 1.1;
  cursor: pointer;
  box-sizing: border-box;
}
.pf-tabs .pf-ico { width: 22px; height: 22px; flex: none; display: block; }
.pf-tabs .pf-lab { display: block; min-width: 0; overflow-wrap: anywhere; text-align: center; }
.pf-tabs .pf-tab.active,
.pf-tabs .pf-tab[aria-selected="true"] {
  background: var(--gold, #e8b923);
  color: #17120a;
  border-color: var(--gold, #e8b923);
  box-shadow: 0 0 16px var(--accent-glow, rgba(232, 185, 35, .2)), inset 0 1px rgba(255, 255, 255, .28);
}
/* Inactive hover: gold border, slight lift and glow. Active: a little brighter. */
@media (hover: hover) and (pointer: fine) {
  .pf-tabs .pf-tab:hover:not([aria-selected="true"]):not(.active) {
    border-color: var(--gold, #e8b923);
    color: var(--text, #e6edf0);
    transform: translateY(-1px);
    box-shadow: 0 0 14px var(--accent-glow, rgba(232, 185, 35, .2));
  }
  .pf-tabs .pf-tab[aria-selected="true"]:hover,
  .pf-tabs .pf-tab.active:hover { filter: brightness(1.06); }
}
.pf-tabs .pf-tab:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
  z-index: 1;
}
.pf-tabs .pf-tab[aria-selected="true"]:focus-visible,
.pf-tabs .pf-tab.active:focus-visible { outline-color: #17120a; }
/* Desktop: tooltip under the tab on hover/focus. On touch, omit the one-liner
   (it does not fit under a 360px pill without crowding); the same text is
   exposed as aria-description / aria-describedby. */
.pf-tabs .pf-tab-tip {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 25;
  width: max-content;
  max-width: min(240px, 70vw);
  padding: 6px 9px;
  border: 1px solid var(--line, #34434d);
  border-radius: 9px;
  background: #15212a;
  color: var(--text, #e6edf0);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1.3;
  text-align: center;
  white-space: normal;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .45);
  pointer-events: none;
}
.pf-tabs .pf-tab:first-child .pf-tab-tip { left: 0; transform: none; }
.pf-tabs .pf-tab:last-child .pf-tab-tip { left: auto; right: 0; transform: none; }
@media (hover: hover) and (pointer: fine) {
  .pf-tabs .pf-tab:hover .pf-tab-tip,
  .pf-tabs .pf-tab:focus-visible .pf-tab-tip { display: block; }
}
@media (min-width: 841px) {
  .pf-tabs .pf-tab {
    flex-direction: row;
    gap: 8px;
    min-height: 48px;
    padding: 8px 16px;
    font-size: 16px;
  }
  .pf-tabs .pf-lab { overflow-wrap: normal; white-space: nowrap; }
}
@media (prefers-reduced-motion: reduce) {
  .pf-tabs .pf-tab:hover:not([aria-selected="true"]):not(.active) { transform: none; }
}
.pf-panel[hidden] { display: none !important; }
.pf-sw-count { margin: 0 0 14px; font-size: 14px; }
.pf-sw-link { font-weight: 700; }
.pm-maps { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.pm-maps[hidden] { display: none; }
.pm-maps + .pm-maps { margin-top: 10px; }
.pm-map { min-width: 0; padding: 8px 0; border-bottom: 1px solid rgba(58, 69, 77, .45); }
.pm-map:last-child { border-bottom: 0; }
.pm-map-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 6px; }
.pm-map-top b { font-size: 15px; overflow-wrap: anywhere; }
.pm-map-top small { color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.pm-win { display: grid; gap: 5px; }
.pm-side { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(64px, 1fr) auto; align-items: center; gap: 8px; font-size: 13px; }
.pm-side b { font-variant-numeric: tabular-nums; min-width: 3.2em; text-align: right; }
.pm-meter { display: block; height: 8px; border-radius: 4px; background: rgba(255, 255, 255, .07); overflow: hidden; }
.pm-meter i { display: block; height: 100%; background: #7f8c8d; }
.pm-meter i.gdi { background: var(--gold, #e0b84a); }
.pm-meter i.nod { background: var(--red, #e24b4b); }
.pm-meter i.allies { background: var(--blue, #4a90e0); }
.pm-meter i.soviet { background: #ff8a3d; }
.pf-sw { margin-top: 18px; }
.pf-sw-sum { margin: 0 0 10px; }
.pf-sw #pm-sw-toggle { min-height: 44px; }
#pm-sw-log { margin-top: 10px; }
#pm-toggle { margin-top: 10px; min-height: 44px; }
@media (max-width: 520px) {
  .pm-side { grid-template-columns: minmax(0, 1fr) auto; }
  .pm-meter { grid-column: 1 / -1; order: 3; }
}
@media (min-width: 760px) {
  .pm-maps { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 28px; }
}


/* Team split on the profile: site.css later reuses .team-split / .ts-bar / .ts-em
   for the live server-card bar (a horizontal flex row). Those rules were
   crushing this section on phones — names went one letter per line, bars
   and the explainer sat in skinny columns. Scope everything here. */
#tab-profile section.subpanel.team-split {
  display: block;
  align-items: stretch;
  gap: 0;
  margin-bottom: 14px;
  font-size: inherit;
  line-height: inherit;
  min-width: 0;
}
#tab-profile section.subpanel.team-split .subpanel-head,
#tab-profile section.subpanel.team-split .ts-rows,
#tab-profile section.subpanel.team-split .ts-note {
  display: block;
  width: 100%;
  min-width: 0;
}
#tab-profile section.subpanel.team-split .ts-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  grid-template-areas:
    "icon name num"
    "icon meta num"
    "icon bars bars";
  gap: 2px 10px;
  align-items: center;
  margin: 12px 0;
  min-width: 0;
}
#tab-profile section.subpanel.team-split .ts-em,
#tab-profile section.subpanel.team-split .ts-unknown {
  grid-area: icon;
  align-self: start;
  width: 40px;
  height: 40px;
  flex: none;
  object-fit: contain;
}
#tab-profile section.subpanel.team-split .ts-unknown { display: grid; place-items: center; }
#tab-profile section.subpanel.team-split .ts-name {
  grid-area: name;
  min-width: 0;
  overflow-wrap: anywhere;
  font-weight: 700;
}
#tab-profile section.subpanel.team-split .ts-meta {
  grid-area: meta;
  color: var(--muted);
  font-size: 13px;
  min-width: 0;
  overflow-wrap: anywhere;
}
#tab-profile section.subpanel.team-split .ts-num {
  grid-area: num;
  text-align: right;
  justify-self: end;
}
#tab-profile section.subpanel.team-split .ts-num > b {
  display: block;
  font-size: 22px;
  line-height: 1.1;
  color: var(--ts);
  font-variant-numeric: tabular-nums;
}
#tab-profile section.subpanel.team-split .ts-time {
  color: var(--muted);
  white-space: nowrap;
  font-size: 12px;
}
#tab-profile section.subpanel.team-split .ts-bars {
  grid-area: bars;
  min-width: 0;
}
#tab-profile section.subpanel.team-split .ts-bar {
  display: block;
  flex: none;
  width: 100%;
  min-width: 0;
  height: 12px;
  margin-top: 4px;
  border-radius: 6px;
  background: rgba(255, 255, 255, .07);
  overflow: hidden;
}
#tab-profile section.subpanel.team-split .ts-bar.thin {
  height: 4px;
  margin-top: 3px;
  border-radius: 2px;
}
#tab-profile section.subpanel.team-split .ts-bar i {
  display: block;
  height: 100%;
  flex: none;
  background: var(--ts);
  border: 0;
}
#tab-profile section.subpanel.team-split .ts-bar i + i { flex: none; border-left: 0; }
#tab-profile section.subpanel.team-split .ts-bar.thin i { opacity: .6; }

/* Narrow phones: one full-width row per faction.
   icon + name + big % + time share on the first line, then rounds/won, then bars. */
@media (max-width: 560px) {
  #tab-profile section.subpanel.team-split .ts-row {
    grid-template-columns: 36px minmax(0, 1fr) auto auto;
    grid-template-areas:
      "icon name pct time"
      "meta meta meta meta"
      "bars bars bars bars";
    column-gap: 8px;
    row-gap: 4px;
  }
  #tab-profile section.subpanel.team-split .ts-em,
  #tab-profile section.subpanel.team-split .ts-unknown {
    width: 36px;
    height: 36px;
    align-self: center;
  }
  #tab-profile section.subpanel.team-split .ts-num { display: contents; }
  #tab-profile section.subpanel.team-split .ts-num > b {
    grid-area: pct;
    font-size: 20px;
    text-align: right;
  }
  #tab-profile section.subpanel.team-split .ts-time {
    grid-area: time;
    align-self: center;
  }
  #tab-profile section.subpanel.team-split .ts-meta { padding-left: 0; }
  #tab-profile section.subpanel.team-split .ts-bars { margin-top: 2px; }
  .yw-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .yw-grid > span:last-child { grid-column: 1 / -1; }
  .activity-clock .ac-line small { display: block; margin-left: 0; margin-top: 2px; white-space: normal; overflow-wrap: anywhere; }
  .pf-tabs { margin-top: 10px; }
}

/* Keep the last profile sections clear of the sticky bottom nav. */
#tab-profile { padding-bottom: 8px; }
#profile-page, .pf-panel, .pm-map, .ts-row, .chart-box { min-width: 0; }

#tab-profile .outline-button,
#tab-profile .profile-full-link {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}
#tab-profile .pf-sw-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}
#tab-profile .ph-srvlink {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

/* Switch log is no longer inside .team-view, so the old overflow rule missed it
   and the wide nowrap table stretched the whole page. */
#pm-sw-log .table-scroll,
.pf-sw .table-scroll {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
@media (max-width: 560px) {
  #pm-sw-log .table-scroll { overflow: visible; }
  #pm-sw-log .tv-table thead { display: none; }
  #pm-sw-log .tv-table,
  #pm-sw-log .tv-table tbody { display: block; width: 100%; }
  #pm-sw-log .tv-table tr {
    display: grid;
    width: 100%;
    box-sizing: border-box;
    gap: 4px;
    margin: 0 0 10px;
    padding: 10px 12px;
    border: 1px solid var(--line, #3a454d);
    border-radius: 9px;
  }
  #pm-sw-log .tv-table td {
    display: block;
    width: 100%;
    border: 0;
    padding: 0;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  #pm-sw-log .tv-table td::before {
    content: attr(data-l);
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
  }
  #pm-sw-log .round-link {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
  }
}
