/* Player statistics modal — loaded globally (leaderboard, arena, chat, …) */

.player-stats-overlay {
    position: fixed; inset: 0; z-index: 10050;
    background: rgba(0, 0, 0, 0.88);
    display: flex; align-items: flex-start; justify-content: center;
    padding: max(8px, env(safe-area-inset-top)) 8px 24px;
    overflow-x: hidden;
    overflow-y: auto;
    backdrop-filter: blur(6px);
}
.player-stats-dialog {
    width: min(720px, 100%);
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
    max-height: none;
    margin: 20px auto 40px;
    padding: 20px 16px 24px;
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}
.ps-header {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 12px; margin-bottom: 16px; padding-right: 28px;
}
.ps-header h3 { margin: 0; font-size: 1.35rem; }
.ps-subtitle { margin: 4px 0 0; font-size: 12px; color: var(--text-muted); }
.ps-stat-grid { display: grid; gap: 10px; margin-bottom: 14px; }
.ps-stat-grid-3 { grid-template-columns: repeat(3, 1fr); }
.ps-stat-grid-1 { grid-template-columns: 1fr; max-width: 220px; }
.ps-stat-grid-4 { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 560px) {
    .player-stats-dialog { padding: 20px 22px 24px; }
    .ps-stat-grid-4 { grid-template-columns: repeat(4, 1fr); }
}
.ps-stat-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 10px 12px;
    text-align: center;
    min-width: 0;
    overflow: hidden;
}
.ps-stat-card span {
    display: block; font-size: 10px; text-transform: uppercase;
    color: var(--text-muted); font-weight: 600; letter-spacing: 0.04em;
}
.ps-stat-card strong { display: block; font-size: 1.15rem; margin-top: 4px; color: var(--text-main); word-break: break-word; }
.ps-stat-card .ps-compare {
    display: block;
    margin-top: 6px;
    font-size: 10px;
    font-style: normal;
    font-weight: 600;
    line-height: 1.3;
}
.ps-compare-good { color: #4ade80; }
.ps-compare-bad { color: #f87171; }
.ps-stat-accent strong { color: var(--accent-neon); }
.ps-header .ps-share-btn,
.ps-pdf-share {
    background: rgba(0, 240, 255, 0.12);
    border: 1px solid rgba(0, 240, 255, 0.35);
    color: var(--accent-cyan);
}
.player-stats-pdf-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.ps-charts-row,
.ps-charts-stack {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 16px;
    min-width: 0;
    width: 100%;
}
.ps-chart-block-full {
    width: 100%;
}
.ps-chart-block-full .ps-sparkline-lg {
    height: 90px;
}
.ps-chart-block-full .ps-match-pts-chart {
    width: 100%;
}
.ps-chart-block {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px; padding: 12px;
    min-width: 0;
    overflow: hidden;
}
.ps-chart-block h4 { margin: 0 0 10px; font-size: 12px; color: var(--text-muted); text-transform: uppercase; }
.ps-sparkline {
    display: block;
    width: 100%;
    height: 56px;
    max-width: 100%;
}
.ps-sparkline-lg {
    height: 90px;
}
.ps-section { margin-bottom: 18px; }
.ps-section h4 { margin: 0 0 10px; font-size: 13px; font-weight: 700; color: var(--text-main); }
.ps-section h5 { margin: 10px 0 6px; font-size: 12px; color: var(--text-muted); }
.ps-meter-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; font-size: 12px; color: var(--text-muted); flex-wrap: wrap; }
.ps-meter { flex: 1; height: 8px; background: rgba(255,255,255,0.08); border-radius: 999px; overflow: hidden; }
.ps-meter-fill { height: 100%; background: linear-gradient(90deg, var(--accent-cyan), var(--accent-neon)); border-radius: 999px; }
.ps-wdl-bars { display: flex; gap: 16px; align-items: flex-end; justify-content: center; height: 80px; margin-bottom: 10px; }
.ps-wdl-col { display: flex; flex-direction: column; align-items: center; gap: 6px; flex: 1; max-width: 56px; height: 100%; justify-content: flex-end; }
.ps-wdl-bar { width: 100%; min-height: 4px; border-radius: 6px 6px 2px 2px; transition: height 0.4s ease; }
.ps-wdl-w { background: #22c55e; }
.ps-wdl-d { background: #eab308; }
.ps-wdl-l { background: #ef4444; }
.ps-wdl-col em { font-size: 11px; color: var(--text-muted); font-style: normal; }
.ps-form-badges { margin-top: 8px; }
.ps-bar-row { display: flex; align-items: center; gap: 8px; margin: 5px 0; font-size: 12px; }
.ps-bar-label { width: 72px; flex-shrink: 0; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ps-bar-track { flex: 1; height: 10px; background: rgba(255,255,255,0.06); border-radius: 999px; overflow: hidden; }
.ps-bar-fill { height: 100%; border-radius: 999px; background: var(--accent-neon); min-width: 2px; }
.ps-bar-fill.ps-bar-cyan { background: var(--accent-cyan); }
.ps-bar-fill.ps-bar-purple { background: #a78bfa; }
.ps-bar-fill.ps-bar-neon { background: var(--accent-neon); }
.ps-bar-val { width: 36px; text-align: right; font-weight: 600; font-size: 11px; }
.ps-table { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 8px; }
.ps-table th, .ps-table td { padding: 6px 8px; border-bottom: 1px solid rgba(255,255,255,0.06); text-align: left; }
.ps-table th { color: var(--text-muted); font-weight: 600; }
.ps-highlight { margin: 6px 0; font-size: 13px; color: var(--text-muted); line-height: 1.45; word-break: break-word; }
.ps-highlight strong { color: var(--text-main); }
.ps-highlight-good strong { color: #86efac; }
.ps-highlight-bad strong { color: #fca5a5; }
.ps-export-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 14px !important; font-size: 12px !important;
    background: rgba(0, 240, 255, 0.12) !important;
    color: var(--accent-cyan) !important;
    border: 1px solid rgba(0, 240, 255, 0.35) !important;
    text-decoration: none; white-space: nowrap;
}
.ps-footer { margin-top: 16px; padding-top: 14px; border-top: 1px solid rgba(255, 255, 255, 0.08); text-align: center; }
.ps-chart-empty { margin: 0; font-size: 12px; color: var(--text-muted); text-align: center; padding: 12px 0; }
.ps-match-pts-chart {
    display: flex; align-items: flex-end; gap: 4px;
    height: 88px; padding: 4px 2px 0; overflow-x: auto;
}
.ps-match-pt-col {
    flex: 1 0 18px; max-width: 28px; height: 100%;
    display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px;
}
.ps-match-pt-bar {
    width: 100%; min-height: 4px; border-radius: 4px 4px 2px 2px;
    transition: height 0.35s ease;
}
.ps-match-pt-col span { font-size: 9px; color: var(--text-muted); white-space: nowrap; }
.ps-pt-exact { background: #22c55e; }
.ps-pt-partial { background: #eab308; }
.ps-pt-zero { background: rgba(148, 163, 184, 0.35); }

.ps-rank-chart-wrap { width: 100%; }
.ps-chart-block:has(.ps-rank-chart-wrap) { overflow: visible; }
.ps-rank-sparkline { overflow: visible; }
.ps-rank-pt-label {
    fill: #00f0ff;
    font-size: 11px;
    font-weight: 700;
    font-family: system-ui, -apple-system, Segoe UI, sans-serif;
}
.ps-rank-cols {
    display: flex;
    align-items: flex-start;
    gap: 4px;
    margin-top: 10px;
    overflow-x: auto;
    padding-bottom: 2px;
}
.ps-rank-col {
    flex: 1 0 40px;
    min-width: 36px;
    text-align: center;
}
.ps-rank-col strong {
    display: block;
    color: var(--accent-cyan);
    font-size: 12px;
    line-height: 1.2;
}
.ps-rank-col span {
    display: block;
    margin-top: 2px;
    color: var(--text-muted);
    font-size: 9px;
    white-space: nowrap;
}
@media (max-width: 480px) {
    .ps-rank-pt-label { font-size: 10px; }
    .ps-rank-col span { font-size: 8px; }
}

body.player-stats-pdf-open { overflow: hidden; }
.player-stats-pdf-overlay {
    position: fixed; inset: 0; z-index: 10060;
    background: rgba(0, 0, 0, 0.92);
    display: flex; flex-direction: column;
    padding: max(8px, env(safe-area-inset-top)) 8px max(12px, env(safe-area-inset-bottom));
    backdrop-filter: blur(6px);
}
.player-stats-pdf-shell {
    display: flex; flex-direction: column;
    flex: 1; min-height: 0; width: 100%; max-width: 720px;
    margin: 0 auto;
}
.player-stats-pdf-toolbar {
    display: flex; align-items: center; justify-content: space-between;
    gap: 10px; flex-shrink: 0; margin-bottom: 10px;
}
.player-stats-pdf-toolbar .btn {
    background: rgba(0, 240, 255, 0.12) !important;
    color: var(--accent-cyan) !important;
    border: 1px solid rgba(0, 240, 255, 0.35) !important;
}
.player-stats-pdf-loading {
    margin: 0 0 8px; font-size: 13px; color: var(--text-muted); text-align: center;
}
.player-stats-pdf-frame {
    flex: 1; width: 100%; min-height: 0;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px; background: #0b0f19;
}
.ps-pdf-standalone-nav {
    display: flex; align-items: center; justify-content: space-between;
    gap: 10px; max-width: 720px; margin: 0 auto 12px;
    padding: 0 4px;
}
.ps-pdf-standalone-nav .btn {
    background: rgba(0, 240, 255, 0.12) !important;
    color: #00f0ff !important;
    border: 1px solid rgba(0, 240, 255, 0.35) !important;
}
