/* RAWDM profile (/profile, /u/{id}) + shared sub-panels used by
   /settings and /admin. ZIGGURAT system: flat faces, hairline wells,
   bevels on pressables only. Tokens + nav + buttons: rawdm-tokens.css
   + ziggurat.css (linked before this file). */

/* ============ PROFILE HERO ============ */
.profile-hero {
  display: grid;
  grid-template-columns: 140px 1fr auto;
  gap: 22px;
  align-items: center;
  padding: 24px;
  background: var(--g3);
  border: var(--line-flat);
  border-color: var(--edge-hot);
  margin-bottom: 18px;
}
/* Square avatar in a bevel frame — portraits are pressable-adjacent furniture. */
.profile-avatar {
  width: 132px;
  height: 132px;
  object-fit: cover;
  border: var(--bv-sm) solid;
  border-color: var(--hi) var(--lo) var(--lo) var(--hi);
  background: var(--g1);
}
.profile-name {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(36px, 5vw, 64px);
  line-height: .95;
  letter-spacing: .02em;
  color: var(--signal);
}
.profile-meta { color: var(--ui); margin: 8px 0 0; line-height: 1.45; }

.rank-badge {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 28px;
  color: var(--red-hot);
  text-align: right;
}
.rank-badge small {
  display: block;
  font-family: var(--font-ui);
  color: var(--ui);
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.rank-icon {
  width: 58px;
  height: 58px;
  object-fit: contain;
  vertical-align: middle;
  margin-right: 10px;
}
.rank-line { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
/* Progress: an inset well with a flat ember fill — no gradient pill. */
.rank-progress {
  height: 12px;
  background: var(--g1);
  border: var(--line-well);
  margin-top: 10px;
  overflow: hidden;
}
.rank-progress i { display: block; height: 100%; width: 0; background: var(--red); }

/* ============ STAT GRID ============ */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 16px 0; }
.stat-card {
  padding: 14px 16px;
  background: var(--g3);
  border: var(--line-flat);
  border-color: var(--edge-hot);
}
.stat-card b {
  display: block;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 30px;
  font-variant-numeric: tabular-nums;
  color: var(--signal);
}
.stat-card span {
  color: var(--meta);
  letter-spacing: .12em;
  font-size: 10px;
  text-transform: uppercase;
  font-weight: 700;
}

/* ============ PANELS ============ */
.profile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
.profile-panel {
  padding: 18px;
  margin-top: 16px;
  background: var(--g3);
  border: var(--line-flat);
  border-color: var(--edge-hot);
}
.profile-grid .profile-panel { margin-top: 0; }
.profile-panel h2 {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--signal);
}

/* ============ RANK TIERS ============ */
.rank-tiers { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 8px; }
.tier {
  padding: 9px;
  background: var(--g1);
  border: var(--line-well);
  font-size: 12px;
  color: var(--prose);
}
.tier b { display: block; color: var(--red-hot); font-family: var(--font-display); font-size: 17px; }

/* ============ ROWS (accounts, matches) ============ */
.account-row,
.match-row {
  display: grid;
  grid-template-columns: 92px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  margin: 8px 0;
  background: var(--g2);
  border: var(--line-flat);
}
.account-row { grid-template-columns: 1fr auto; }
.account-label { display: flex; align-items: center; gap: 10px; }
.account-row img,
.match-row img {
  width: 36px;
  height: 36px;
  object-fit: cover;
  border: 1px solid var(--edge);
}
.match-opp { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.match-opp a { color: var(--signal); text-decoration: none; }
.match-opp a:hover { color: var(--red-hot); }
.match-meta { color: var(--ui); font-size: 12px; margin-top: 4px; line-height: 1.45; }
.match-meta a { color: var(--cyan); text-decoration: none; font-weight: 700; }
.replay-link { color: var(--cyan) !important; }

.result-win { color: var(--live); font-weight: 700; }
.result-loss { color: var(--red-hot); font-weight: 700; }
.result-draw { color: var(--prose); font-weight: 700; }
.rating {
  color: var(--gold-hot);
  font-weight: 700;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}
.star { font-size: 22px; line-height: 1; }
.note { margin-top: 4px; font-style: italic; }

/* ============ INLINE HIGHLIGHT EXPAND ============ */
/* Reddit-style inline expand (iframe in .profile-highlight-mount). */
.highlight-wrap {
  margin: 8px 0;
  background: var(--g2);
  border: var(--line-flat);
  overflow: hidden;
}
.highlight-wrap .match-row.highlight-row { margin: 0; border: 0; background: transparent; }
.highlight-wrap.highlight-open { outline: 1px solid var(--cyan); outline-offset: 1px; }
.highlight-watch-popout { color: var(--ui); text-decoration: none; font-size: 14px; padding: 0 4px; line-height: 1; }
.highlight-watch-popout:hover { color: var(--cyan); }
.highlight-remove-form { display: inline; margin: 0; }
.highlight-remove-btn,
.profile-highlight-toolbar .highlight-remove-btn {
  background: var(--red-face) !important;
  border-color: var(--red-hi) var(--red-lo) var(--red-lo) var(--red-hi) !important;
  color: #ffe9e6 !important;
}
.highlight-remove-btn:hover,
.profile-highlight-toolbar .highlight-remove-btn:hover {
  background: var(--red-face-hot) !important;
  color: #fff !important;
}
.profile-highlight-frame { margin: 0; border-top: var(--line-soft); background: var(--g1); }
.profile-highlight-frame[hidden] { display: none !important; }
.profile-highlight-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 9px;
  letter-spacing: .14em;
  color: var(--cyan);
  text-transform: uppercase;
}
.profile-highlight-toolbar span { margin-right: auto; }
.profile-highlight-toolbar button {
  cursor: pointer;
  background: var(--g5);
  border: var(--bv-sm) solid;
  border-color: var(--hi) var(--lo) var(--lo) var(--hi);
  color: var(--prose);
  font: inherit;
  letter-spacing: .12em;
  padding: 3px 8px;
}
.profile-highlight-toolbar button:hover { color: #fff; background: var(--g5-hot); }
.profile-highlight-toolbar button:active {
  border-color: var(--lo) var(--hi) var(--hi) var(--lo);
  transform: translate(1px, 1px);
}
.profile-highlight-mount { position: relative; width: 100%; aspect-ratio: 16/9; background: #000; }
.profile-highlight-mount iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #000; }
.profile-highlight-frame:fullscreen,
.profile-highlight-frame:-webkit-full-screen { width: 100%; height: 100%; background: #000; }
.profile-highlight-frame:fullscreen .profile-highlight-mount,
.profile-highlight-frame:-webkit-full-screen .profile-highlight-mount { aspect-ratio: auto; height: calc(100% - 36px); }

/* ============ TOOLS / FORMS ============ */
.history-tools { display: grid; grid-template-columns: 180px 1fr auto; gap: 10px; margin-bottom: 12px; }
.history-tools input,
.history-tools select,
.username-box input {
  width: 100%;
  padding: 11px 12px;
  background: var(--g1);
  color: var(--signal);
  border: var(--line-well);
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 13px;
  outline: none;
  box-sizing: border-box;
}
.username-box { display: grid; gap: 9px; margin-top: 16px; }
.username-box h3 {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--signal);
}
.username-note { color: var(--ui); font-size: 12px; line-height: 1.35; }

/* ============ NOT FOUND ============ */
.panel.not-found { padding: 40px; }
.panel.not-found h1 {
  margin: 10px 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(40px, 6vw, 72px);
  line-height: .95;
  text-transform: uppercase;
}

@media (max-width: 900px) {
  .profile-hero, .profile-grid, .stat-grid, .rank-tiers, .history-tools { grid-template-columns: 1fr; }
  .rank-badge { text-align: left; }
  .rank-line { justify-content: flex-start; }
  .profile-avatar { width: 96px; height: 96px; }
}
