.legacy-profile-wrap {
  max-width: none;
  width: 100%;
  margin: 0;
  padding: 0 1.25rem 1.25rem 1.25rem;
}


.legacy-profile-header {
  display: block;
  gap: 1rem;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  border-bottom: 2px solid rgba(0,0,0,.12);
  padding-bottom: 1rem;
  margin-bottom: .4rem;
}

/* Row 1: name + avatar */
.legacy-profile-header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

/* Row 3: stats */
.legacy-profile-header-stats {
  border-top: 2px solid rgba(0,0,0,0.12);
  padding-top: .75rem;
  margin-top: .75rem;
}


.legacy-profile-stats {
  display: flex;
  gap: .75rem;
  flex-wrap: wrap;
}

.legacy-profile-meta {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.95rem;
  opacity: .85;
}

.legacy-profile-stats {
  display: flex;
  gap: .75rem;
  flex-wrap: wrap;
}

.lp-stat {
  background: rgba(255, 255, 255, 0.06);
  min-width: 90px;
  padding: .75rem .9rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  text-align: center;
}

.lp-stat-num { font-size: 1.2rem; font-weight: 700; line-height: 1.1; }
.lp-stat-label { font-size: .85rem; opacity: .8; }

.legacy-profile-section {
  margin: 1.25rem 0;
}

.legacy-profile-table-wrap {
  overflow: auto;
  border: 1px solid rgba(0,0,0,.12);
  border-radius: 10px;
}

.legacy-profile-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 820px;
}

.legacy-profile-table th,
.legacy-profile-table td {
  padding: .6rem .75rem;
  border-bottom: 1px solid rgba(0,0,0,.08);
  vertical-align: top;
}

.legacy-profile-table th {
  text-align: left;
  font-weight: 700;
  background: rgba(0,0,0,.03);
}

.lp-muted {
  opacity: .75;
}

.legacy-profile-error {
  padding: .75rem 1rem;
  background: rgba(255,0,0,.06);
  border: 1px solid rgba(255,0,0,.15);
  border-radius: 10px;
}

.legacy-profile-header {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.legacy-profile-title {
  flex: 1 1 auto;
  min-width: 260px;
}

.legacy-profile-avatar {
  width: 250px;
  height: 250px;
  border-radius: 6px;          /* phpBB-style subtle rounding */
  overflow: hidden;
  border: 1px solid rgba(0,0,0,.12);
  background: transparent;
  padding: 0;
}


.legacy-profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.legacy-profile-username {
  color: #dd9933;
  text-shadow: 0 1px 0 rgba(0,0,0,.25);
}

.lp-meta-line {
  display: block;
}

.lp-meta-label {
  color: #007bff;
  font-weight: 600;
  margin-right: 4px;
}

.lp-meta-value {
  color: #ffffff;
}

/* Remove the "mystery" top gap on the Player Profile template only */
.page-template-page-legacy-player-profile .legacy-profile-wrap {
  padding-top: 0;
}

/* Kill default H1 top margin that creates extra space */
.page-template-page-legacy-player-profile .legacy-page-title {
  margin-top: 0;
}

.lp-stat-label {
  color: #007bff;
  font-weight: 700;
}

.lp-stat-num {
  font-size: 1.4rem;
  font-weight: 700;
}

/* Matches */
.lp-stat-matches .lp-stat-num {
  color: #ffffff;
}

/* Wins */
.lp-stat-wins .lp-stat-num {
  color: #dd9933; /* soft gold */
}

/* Losses */
.lp-stat-losses .lp-stat-num {
  color: #ff3b3b; /* red */
}

/* Ties */
.lp-stat-ties .lp-stat-num {
  color: #ffffff;
}

/* Win % */
.lp-stat-winpct-good .lp-stat-num {
  color: #dd9933; /* soft gold */
}

.lp-stat-winpct-bad .lp-stat-num {
  color: #00ff66; /* bright green */
}

/* Career Summary layout */
.legacy-profile-summary {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

/* Row */
.lp-summary-row {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
}

/* Labels */
.lp-summary-label {
  color: #007bff;
  font-weight: 600;
}

/* Default values */
.lp-summary-value {
  color: #ffffff;
}

/* Soft gold value (best rank) */
.lp-summary-gold {
  color: #dd9933;
}

/* Muted side text */
.lp-muted {
  color: rgba(255,255,255,.6);
  margin-left: .25rem;
  font-size: .85em;
}

/* Best-rank "where it happened" hierarchy */
.lp-best-rank-context {
  margin-top: .35rem;
  margin-left: 1.25rem; /* indented under the best rank row */
  display: flex;
  flex-direction: column;
  gap: .25rem;
}

.lp-best-rank-game {
  color: #ffffff;
  font-weight: 600;
  margin-top: .35rem;
  margin-left: .25rem; /* slight extra indent */
}

.lp-best-rank-ladder {
  color: rgba(255,255,255,.85);
  margin-left: 1.25rem; /* ladder indented under game */
}

/* Rank badge colors */
.lp-rank-1 { color: #dd9933; }  /* soft gold */
.lp-rank-2 { color: #c0c0c0; }  /* silver */
.lp-rank-3 { color: #cd7f32; }  /* bronze */
.lp-rank-default { color: #ffffff; } /* white for 4+ */

.legacy-profile-section h2 {
  color: #ffffff;
}

/* Ladders Played + Teams Played table headers */
.legacy-profile-section table thead th {
  color: #007bff;
}

.legacy-game-link {
  color: #98cb00;
  text-decoration: none;
}

.legacy-game-link:hover,
.legacy-game-link:focus {
  color: #5de000;
  text-decoration: underline;
}

.legacy-ladder-link {
  color: #98cb00;
  text-decoration: none;
}

.legacy-ladder-link:hover,
.legacy-ladder-link:focus {
  color: #5de000;
  text-decoration: underline;
}

.legacy-profile-table,
.legacy-profile-table * {
  box-sizing: border-box;
}

/* Force ladder link text to wrap and break long tokens */
.legacy-ladder-link {
  display: inline-block;   /* allows wrapping rules to apply reliably */
  max-width: 100%;
  white-space: normal !important;
  overflow-wrap: anywhere;
  word-break: break-word;
}


@media (max-width: 860px) {

  /* Kill horizontal scrolling at the page/container level */
  body,
  #page,
  #container,
  #main,
  .site-content,
  .content-area,
  main {
    overflow-x: hidden;
  }

  .legacy-profile-table-wrap {
    width: 100%;
    max-width: 100%;
    overflow: hidden; /* not auto */
  }

  .legacy-profile-table {
    width: 100%;
    max-width: 100%;
    table-layout: fixed;
  }

  .legacy-profile-table thead {
    display: none;
  }

  /* Card */
  .legacy-profile-table tbody tr {
    display: block;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    border: 1px solid rgba(255,255,255,.15);
    border-radius: 10px;
    padding: .75rem;
    margin: .75rem 0;
    background: rgba(0,0,0,.15);

    overflow: hidden; /* fixes "open-ended on the right" look */
  }

  /* Each cell becomes a two-column row: label | value */
  .legacy-profile-table tbody td {
    display: grid;
    grid-template-columns: 90px 1fr; /* ✅ tighter label column */
    gap: .75rem;

    padding: .35rem 0;
    border: 0 !important;

    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;

    /* wrapping */
    align-items: start;
    white-space: normal !important;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  /* If your theme forces nowrap on table cells, this beats it */
  .legacy-profile-table tbody td * {
    white-space: normal !important;
  }

    /* IMPORTANT: in card mode, force ladder links to wrap */
  .legacy-profile-table tbody td a.legacy-ladder-link {
    display: block !important;
    width: 100%;
    max-width: 100%;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
    word-break: break-word !important;
  }

  /* Label */
  .legacy-profile-table tbody td::before {
    content: attr(data-label);
    color: #007bff;
    font-weight: 600;

    min-width: 0;
    overflow-wrap: anywhere;
  }

  /* Value side MUST be allowed to shrink/wrap */
  .legacy-profile-table tbody td > * {
    min-width: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  /* Aggressive wrap specifically for ladder names/links */
  .legacy-profile-table td a.legacy-ladder-link {
    display: block;                /* ← THIS is the key */
    max-width: 100%;
    white-space: normal !important;
    overflow-wrap: anywhere;
    word-break: break-word;
    line-height: 1.3;
  }
}

@media (max-width: 1200px) {
  #secondary,
  #sidebar,
  .sidebar,
  .widget-area {
    display: none !important;
  }

  /* Ensure main content takes the full width */
  #primary,
  #content,
  .content-area,
  .site-content,
  main {
    width: 100% !important;
    max-width: 100% !important;
  }
}

/* =========================================================
   Legacy Player Profile - Career Stats Table Styling
   ========================================================= */

/* Matches - White & Bold */
.legacy-profile-table td[data-label="Matches"] {
    color: #ffffff !important;
    font-weight: 700;
}

/* Wins - Soft Gold */
.legacy-profile-table td[data-label="Wins"] {
    color: #dd9933 !important;
    font-weight: 700;
}

/* Losses - Red */
.legacy-profile-table td[data-label="Losses"] {
    color: #ff4444 !important;
    font-weight: 700;
}

/* Ties - White */
.legacy-profile-table td[data-label="Ties"] {
    color: #ffffff !important;
    font-weight: 700;
}

/* Win % - Logic is handled by the span classes, 
   but we ensure the table cell allows the span to shine */
.legacy-profile-table td[data-label="Win %"] {
    font-weight: 700;
}

/* Ensure the conditional classes (from legacy-esports) apply here too */
.gwl-rate-high {
    color: #dd9933 !important; /* Soft Gold for >= 50% */
}

.gwl-rate-low {
    color: #5de000 !important; /* Brand Green for < 50% */
}

/* Ensure the Player Name looks solid when pinned */
.legacy-profile-username.is-pinned {
    background-color: #333; /* Match your site background */
    padding: 10px;          /* Add a little padding if it feels cramped */
    /* box-shadow: 0 0px 5px rgba(0,0,0,0.4); */
    /* border-bottom: 2px solid #dd9933; Signature gold line */
    margin: 0;              /* Remove default margins to prevent jumping */
}

/* =========================================================
   Legacy Player Profile - Sticky & Table Styles
   ========================================================= */

/* 1. STICKY H4 (Ladders/Teams Headers) - Background & Style */
.legacy-profile-section h4.is-pinned {
    background-color: #333;       /* Solid background */
    color: #dd9933;               /* Soft Gold text */
    padding: 12px 15px;           /* Comfortable padding */
    margin: 0;                    
    /* border-bottom: 2px solid #dd9933;  */
    /* box-shadow: 0 0px 6px rgba(0,0,0,0.3); */
    text-align: left;
    font-size: 1.1rem;
    width: 100%;                  /* Ensure it spans full width */
    box-sizing: border-box;       /* Keeps padding inside width */
}

/* 2. PLAYER NAME STICKY (Specific overrides) */
.legacy-profile-username.is-pinned {
    background-color: #333;
    padding: 10px;
    /* box-shadow: 0 0px 5px rgba(0,0,0,0.4); */
    /* border-bottom: 2px solid #dd9933; */
    margin: 0;
    box-sizing: border-box;
}

/* 4. DATA COLORING (Win/Loss/Tie/Matches) */
.legacy-profile-table td[data-label="Matches"] { color: #ffffff !important; font-weight: 700; }
.legacy-profile-table td[data-label="Wins"] { color: #dd9933 !important; font-weight: 700; }
.legacy-profile-table td[data-label="Losses"] { color: #ff4444 !important; font-weight: 700; }
.legacy-profile-table td[data-label="Ties"] { color: #ffffff !important; font-weight: 700; }
.legacy-profile-table td[data-label="Win %"] { font-weight: 700; }

.gwl-rate-high { color: #dd9933 !important; }
.gwl-rate-low { color: #5de000 !important; }

/* Force all standard table data to be visible */
.legacy-profile-table td {
    color: #ffffff; 
}

/* Ensure Links inside tables are visible */
.legacy-profile-table a {
    color: #98cb00;
}

/* Ghost div to hold space for H4 */
.gwl-h4-ghost {
    display: none;
    width: 100%;
    margin: 0;
    padding: 0;
}

/* Ensure sticky H4s look solid when they pin over the main title */
.legacy-profile-section h4.is-pinned {
    background-color: #333; /* Match your site background */
    padding: 10px 0;        /* Add padding if needed */
    margin-top: 0;
    /* box-shadow: 0 0px 5px rgba(0,0,0,0.3); Shadow to separate from content */
    /* border-bottom: 2px solid #dd9933;      Signature Gold line */
    text-align: left;
    /* Ensure text doesn't wrap awkwardly when "User:" is added */
    white-space: nowrap; 
    overflow: hidden;
    text-overflow: ellipsis;
}

/* The Clone Table (Sticky Header) */
.gwl-sticky-clone-table {
    background-color: #333; /* Ensures header isn't transparent */
    border-collapse: collapse;
    /* Remove borders that might double up */
    border: none; 
}

.gwl-sticky-clone-table thead th {
    /* Ensure the clone headers look exactly like originals */
    /* border-bottom: 2px solid #dd9933; /*Optional: Gold line under sticky header */
}

/* 2. PLAYER NAME STICKY (Transform to H4 style) */
.legacy-profile-username.is-pinned {
    /* VISUAL TRANSFORM: Match the H4 Section Headers exactly */
    background-color: #333;       /* Solid background (prevents bleed-through) */
    color: #dd9933;               /* Soft Gold text */
    padding: 12px 15px;           /* Match H4 padding */
    margin: 0;
    /* border-bottom: 2px solid #dd9933;  */
    /* box-shadow: 0 0px 6px rgba(0,0,0,0.3); */
    text-align: left;
    
    /* Shrink text to match H4 */
    font-size: 1.1rem;            
    font-weight: 700;
    
    /* Layout safety */
    width: 100%;
    box-sizing: border-box;
    z-index: 1000;
}

/* Fix Sticky Table Header Text Color */
.gwl-sticky-clone-table th,
.gwl-sticky-clone-table td {
    color: #007bff !important; /* Force Blue on Desktop Sticky */
}

/* =========================================================
   Sticky table header (clone): match original TH weight + alignment
   ========================================================= */

/* Make sticky clone headers bold like the normal table headers */
.gwl-sticky-clone-table thead th {
  font-weight: 700 !important;
}

/* Center all sticky clone header cells by default */
.gwl-sticky-clone-table th,
.gwl-sticky-clone-table td {
  text-align: center !important;
}

/* First column in the sticky clone stays left-aligned */
.gwl-sticky-clone-table th:first-child,
.gwl-sticky-clone-table td:first-child {
  text-align: left !important;
}

/* =========================================================
   Desktop table alignment: center all columns except first
   (applies to BOTH Player + Team tables)
   ========================================================= */

/* Player Profile tables */
.legacy-player-profile-wrap .legacy-profile-table th,
.legacy-player-profile-wrap .legacy-profile-table td {
  text-align: center;
}
.legacy-player-profile-wrap .legacy-profile-table th:first-child,
.legacy-player-profile-wrap .legacy-profile-table td:first-child {
  text-align: left;
}

/* Team Profile tables */
.legacy-team-profile-wrap .legacy-profile-table th,
.legacy-team-profile-wrap .legacy-profile-table td {
  text-align: center;
}
.legacy-team-profile-wrap .legacy-profile-table th:first-child,
.legacy-team-profile-wrap .legacy-profile-table td:first-child {
  text-align: left;
}

/* =========================================================
   Player Profile: Sticky cloned table headers should stay bold
   (Team profile already looks correct)
   ========================================================= */

.legacy-player-profile-wrap .gwl-sticky-clone-table thead th,
.legacy-player-profile-wrap .gwl-sticky-clone-table th {
  font-weight: 700 !important;
}

.legacy-player-profile-wrap .gwl-sticky-table-container .gwl-sticky-clone-table th {
  font-weight: 700 !important;
}

/* Player Profile: pinned section H4 must be bold (match Team Profile) */
.legacy-profile-wrap .legacy-profile-section h4.is-pinned {
  font-weight: 700 !important;
}

/* =========================================================
   Center text inside sticky title bars (Player + Team)
   ========================================================= */

/* Main sticky title (player/team name) */
.legacy-profile-username.is-pinned {
  text-align: center !important;
}

/* Sticky section headings (ex: "Name: Ladders Played") */
.legacy-profile-section h4.is-pinned {
  text-align: center !important;
}

/* Player Profile: "GWL Overall Record" title inside the stats block */

.lp-overall-record-title{
  margin: 0 0 8px 0;
  text-align: left;
  color: #dd9933;
  font-weight: 400;
  font-size: 1.05rem;
  line-height: 1.2;
}


