/* Öffentliches Spielerprofil (pages/player.html) und Rangliste (pages/leaderboard.html) */

.back-link { margin-bottom: 18px; color: var(--muted); font-size: 14px; }
.back-link:hover { color: var(--text); }
.icon.flip { transform: rotate(180deg); }
.back-link:hover .icon.flip { transform: rotate(180deg) translateX(3px); }

/* Profilkopf */
.pp-hero {
  position: relative; display: flex; align-items: center; gap: 24px; overflow: hidden; isolation: isolate;
  padding: clamp(22px, 4vw, 34px); margin-bottom: 20px; border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  background:
    radial-gradient(70% 120% at 100% 0%, rgb(255 122 0 / 20%), transparent 60%),
    var(--surface);
}
.pp-hero::before {
  content: ''; position: absolute; inset: 0; z-index: -1; opacity: .7;
  background-image: linear-gradient(var(--grid-line) 1px, transparent 1px), linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 28px 28px;
}
.pp-hero::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 4px;
  background: repeating-linear-gradient(90deg, var(--accent) 0 28px, transparent 28px 48px); opacity: .75;
}
.pp-avatar-wrap { position: relative; flex: none; }
.pp-avatar-wrap .avatar-lg { box-shadow: var(--shadow-2); border: 1px solid var(--border-strong); }
.pp-dot {
  position: absolute; right: -4px; bottom: -4px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--ok); border: 4px solid var(--surface); animation: rp-ping 2s infinite;
}
.pp-head { min-width: 0; }
.pp-head h1 { margin: 0 0 10px; font-size: clamp(28px, 5vw, 44px); overflow-wrap: anywhere; }
.pp-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; font-size: 14px; }
.pp-online { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-weight: 600; }
.pp-online::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.pp-online.on { color: var(--ok); }
.pp-online.on::before { background: var(--ok); }
.pp-links { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.pp-links:not(:has(a:not([hidden]))) { display: none; }

.pp-ranks { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.pp-rank {
  display: block; padding: 16px 18px; border-radius: var(--radius); text-decoration: none; color: var(--muted);
  background: var(--bg-2); border: 1px solid var(--border); transition: border-color .2s, transform .2s var(--ease);
}
.pp-rank:hover { border-color: var(--accent-line); transform: translateY(-2px); }
.pp-rank b { display: block; font: 400 34px/1.1 var(--font-display); color: var(--accent-text); font-variant-numeric: tabular-nums; }
.pp-rank b.pp-top { color: #E0A800; }
.pp-rank span { font-size: 14px; }

.pp-missing { text-align: center; padding: 48px 24px; }
.pp-missing h1 { font-size: 30px; }
#loading .skeleton-lines { flex: 1; max-width: 360px; }

@media (max-width: 560px) {
  .pp-hero { flex-direction: column; text-align: center; }
  .pp-meta, .pp-links { justify-content: center; }
}

/* Rangliste */
.totals { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
.total {
  position: relative; padding: 20px 22px; border-radius: var(--radius-l); background: var(--surface); border: 1px solid var(--border);
  overflow: hidden;
}
.total::before { content: ''; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--accent); }
.total .icon { width: 20px; height: 20px; color: var(--accent); display: block; margin-bottom: 8px; }
.total b { display: block; font: 400 clamp(24px, 3vw, 34px)/1.1 var(--font-display); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.total > span { color: var(--muted); font-size: 14px; }
.lb-controls { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.lb-me {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; padding: 12px 16px; border-radius: var(--radius);
  background: var(--accent-soft); border: 1px solid var(--accent-line);
}
.lb-me-rank { font: 400 20px var(--font-display); color: var(--accent-text); }
.lb-table td.lb-rank, .lb-table th.lb-rank { width: 56px; text-align: center; }
.lb-rank-n { color: var(--muted); font-weight: 650; }
.lb-user { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 650; min-width: 0; }
.lb-user:hover .lb-name { color: var(--accent-text); text-decoration: underline; }
.lb-name { overflow-wrap: anywhere; }
.lb-you { margin-left: 8px; }
.lb-table th.lb-active { color: var(--accent-text); }
.lb-table td.lb-active { font-weight: 700; color: var(--text); }
.lb-table tr.lb-own td { background: var(--accent-soft); }
.lb-table tr.lb-own td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.lb-table tr.lb-gap td { border-top: 3px dashed var(--border-strong); }
.lb-table tbody tr:nth-child(-n+3) .lb-name { font-size: 16px; }
@media (max-width: 640px) {
  .totals { grid-template-columns: 1fr; }
  .lb-table td, .lb-table th { padding: 10px 8px; }
  .lb-controls .tabs { width: 100%; }
  .lb-controls .tab { flex: 1; justify-content: center; }
}
