/* =============================================================
   Profile page — full-width layout
   ============================================================= */

.profile-shell {
  max-width: 920px;
  margin: 0 auto;
  padding: 0 24px 60px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

/* ----- Header ------------------------------------------------- */
.profile-head {
  display: flex;
  align-items: center;
  gap: 18px;
  background: var(--paper);
  border: 1px solid var(--hair-2);
  border-radius: var(--r-card);
  padding: 22px 24px;
  /* `.reveal` adds `transform`, which makes every reveal-tagged section
     a separate stacking context. The visibility popover lives inside
     `.profile-head` (absolute, z-index:10) and would otherwise paint
     under `.profile-stats` because document-order wins between
     siblings of equal stacking. Lift the header so its popover can
     overlap the stats card below. */
  position: relative;
  z-index: 5;
}
.profile-avatar {
  flex-shrink: 0;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--pink);
  color: #fff;
  display: grid;
  place-items: center;
  font-family: var(--display);
  font-size: 34px;
  font-weight: 800;
  font-variation-settings: 'wdth' 80;
  text-transform: uppercase;
}
.profile-id { flex: 1; min-width: 0; }
.profile-name {
  font-family: var(--display);
  font-size: 32px;
  font-weight: 800;
  font-variation-settings: 'wdth' 82;
  letter-spacing: -1px;
  margin: 0 0 4px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.profile-admin-badge {
  display: inline-flex;
  align-items: center;
  font-family: var(--body);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.6px;
  color: #fff;
  background: var(--pink);
  padding: 3px 8px;
  border-radius: 4px;
  position: relative;
  top: -2px;
  text-decoration: none;
}
.profile-meta {
  margin: 0;
  font-size: 13px;
  color: var(--ink-3);
}
.profile-meta .sub-flag { color: var(--green); font-weight: 700; }

.profile-visibility {
  position: relative;
  list-style: none;
}
.profile-visibility > summary {
  list-style: none;
  cursor: pointer;
}
.profile-visibility > summary::-webkit-details-marker { display: none; }
.profile-visibility-btn {
  display: inline-block;
  background: var(--paper-2);
  color: var(--ink);
  border: 1px solid var(--hair-2);
  border-radius: var(--r-pill);
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  font-family: var(--body);
  user-select: none;
  transition: all .15s;
}
.profile-visibility-btn:hover { border-color: var(--ink-3); color: var(--ink); }
.profile-visibility[open] > .profile-visibility-btn { background: var(--ink); color: #fff; border-color: var(--ink); }

.profile-visibility-form {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: min(360px, calc(100vw - 32px));
  background: var(--paper);
  border: 1px solid var(--hair-2);
  border-radius: var(--r-md);
  padding: 14px 16px;
  box-shadow: 0 20px 40px -10px rgba(10,10,10,0.18);
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.profile-visibility-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  line-height: 1.4;
  color: var(--ink);
}
.profile-visibility-row input[type=checkbox] {
  width: 16px; height: 16px;
  margin-top: 2px;
  accent-color: var(--pink);
}
.profile-visibility-hint {
  margin: 4px 0 0;
  font-size: 11px;
  color: var(--ink-3);
}
.profile-visibility-save {
  background: var(--pink);
  color: #fff;
  border: 0;
  padding: 9px 14px;
  border-radius: var(--r-md);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  font-family: var(--body);
}
.profile-visibility-save:hover { background: var(--pink-2); }

.profile-hidden-tag {
  display: inline-block;
  margin-left: 8px;
  background: var(--paper-3);
  color: var(--ink-3);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 4px;
  vertical-align: middle;
}

/* ----- Stats row --------------------------------------------- */
.profile-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.profile-stat {
  background: var(--paper);
  border: 1px solid var(--hair-2);
  border-radius: var(--r-card);
  padding: 18px 20px;
}
.profile-stat .lbl {
  display: block;
  font-size: 11px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 700;
  margin-bottom: 6px;
}
.profile-stat .val {
  font-family: var(--mono);
  font-size: 24px;
  font-weight: 800;
  color: var(--ink);
}
.profile-stat .val small {
  font-size: 12px;
  color: var(--ink-3);
  letter-spacing: 1px;
  margin-left: 4px;
}

/* ----- Generic section --------------------------------------- */
.profile-section {
  background: var(--paper);
  border: 1px solid var(--hair-2);
  border-radius: var(--r-card);
  padding: 18px 22px;
}
.profile-section-h {
  font-family: var(--display);
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 14px;
  font-variation-settings: 'wdth' 90;
}
.profile-section-h .count {
  font-family: var(--body);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-3);
  letter-spacing: 0.5px;
  margin-left: 6px;
}
.profile-empty {
  margin: 0;
  font-size: 13px;
  color: var(--ink-3);
  font-style: italic;
}

/* ----- Badges grid (looser layout than the sidebar) ----------- */
.profile-badges {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 12px;
}

/* Reuse `.badge`, `.badge.earned`, `.badge.locked` from the sidebar
   stylesheet — same visuals. */

/* ----- Open bets list (sidebar-style) ------------------------ */
.profile-bets {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}
.profile-bets li {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px dashed var(--hair);
}
.profile-bets li:last-child { border-bottom: 0; padding-bottom: 0; }

/* ----- Settled bets table ------------------------------------ */
.profile-history {
  list-style: none;
  margin: 0;
  padding: 0;
}
.profile-history-row {
  display: grid;
  grid-template-columns: 64px 1fr auto auto;
  gap: 14px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--hair);
}
.profile-history-row:last-child { border-bottom: 0; }
.h-status {
  font-family: var(--body);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 4px 8px;
  border-radius: 4px;
  text-align: center;
  white-space: nowrap;
}
.history-won  .h-status { background: var(--green-veil); color: var(--green); }
.history-lost .h-status { background: var(--paper-3); color: var(--ink-3); }
.history-void .h-status { background: var(--pink-veil); color: var(--pink-2); }

.h-info { min-width: 0; }
.h-pick {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.h-pick .h-game {
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-right: 4px;
}
.h-meta {
  font-size: 12px;
  color: var(--ink-3);
}
.h-stake {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-3);
  font-weight: 600;
  white-space: nowrap;
}
.h-net {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
}
.history-won  .h-net { color: var(--green); }
.history-lost .h-net { color: var(--ink-2); }
.history-void .h-net { color: var(--ink-3); }

.profile-back {
  margin: 4px 4px 0;
}
.profile-back a {
  font-size: 13px;
  color: var(--ink-3);
  text-decoration: none;
  font-weight: 700;
}
.profile-back a:hover { color: var(--ink); }

@media (max-width: 720px) {
  .profile-stats { grid-template-columns: 1fr; }
  .profile-stat .val { font-size: 20px; }
  .profile-history-row {
    grid-template-columns: 64px 1fr;
    grid-template-areas:
      "status info"
      "stake  net";
    gap: 6px 14px;
  }
  .h-status { grid-area: status; }
  .h-info   { grid-area: info; }
  .h-stake  { grid-area: stake; }
  .h-net    { grid-area: net; text-align: right; }
}

@media (max-width: 540px) {
  .profile-shell { padding: 0 14px 40px; }
  .profile-head { flex-wrap: wrap; padding: 18px; }
  .profile-name { font-size: 24px; }
  .profile-avatar { width: 56px; height: 56px; font-size: 26px; }
}
