:root {
  --pve-bg: #f5f7f8;
  --pve-surface: #ffffff;
  --pve-border: #dde2e5;
  --pve-text: #24282b;
  --pve-muted: #717980;
  --pve-accent: #c84873;
  --pve-accent-soft: #f9e9ef;
  --pve-positive: #14805e;
}

body[data-page="udpsPveStats"] {
  background: var(--pve-bg);
  color: var(--pve-text);
  font-family: "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
}

.pve-site-app { display: block !important; min-height: 100vh; }
.pve-main { min-width: 0; }
.pve-content { width: min(100%, 1320px); margin: 0 auto; padding: 26px 28px 56px; }
.pve-toolbar { border-bottom: 1px solid var(--pve-border); background: rgba(255, 255, 255, .96); }
.pve-toolbar .toolbar-actions { display: flex; align-items: center; gap: 10px; }

.pve-site-nav { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 22px; min-height: 58px; padding: 0 max(24px, calc((100vw - 1320px) / 2)); border-bottom: 1px solid var(--pve-border); background: rgba(255, 255, 255, .97); }
.pve-site-brand { flex: 0 0 auto; color: var(--pve-text); font-size: 16px; text-decoration: none; }
.pve-site-brand strong { font-weight: 800; }

.pve-nav { display: flex; align-items: center; gap: 3px; overflow-x: auto; scrollbar-width: none; }
.pve-nav::-webkit-scrollbar { display: none; }
.pve-nav a { flex: 0 0 auto; padding: 9px 12px; border-radius: 5px; color: #5f666c; font-size: 14px; text-decoration: none; }
.pve-nav a:hover { background: #f3f4f5; color: var(--pve-text); }
.pve-nav a.active { background: var(--pve-accent-soft); color: var(--pve-accent); font-weight: 700; }

.pve-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; padding: 12px 0 22px; }
.pve-heading h1 { margin: 5px 0 0; font-size: 28px; line-height: 1.25; letter-spacing: 0; }
.pve-kicker { color: var(--pve-accent); font-size: 12px; font-weight: 700; }
.pve-live { display: inline-flex; align-items: center; gap: 7px; color: var(--pve-positive); font-size: 13px; }
.pve-live i { width: 7px; height: 7px; border-radius: 50%; background: var(--pve-positive); box-shadow: 0 0 0 4px rgba(20, 128, 94, .1); }
.pve-sync-state { color: var(--pve-muted); font-size: 12px; }

.pve-summary { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); border: 1px solid var(--pve-border); border-radius: 6px; background: var(--pve-surface); }
.pve-summary > div { min-width: 0; padding: 18px 20px; border-right: 1px solid var(--pve-border); }
.pve-summary > div:last-child { border-right: 0; }
.pve-summary span { display: block; color: var(--pve-muted); font-size: 12px; }
.pve-summary strong { display: block; margin-top: 7px; overflow: hidden; color: var(--pve-text); font-size: 21px; line-height: 1.2; text-overflow: ellipsis; white-space: nowrap; }

.pve-filters { display: grid; grid-template-columns: minmax(210px, 1fr) 190px 170px auto auto; align-items: end; gap: 10px; padding: 20px 0 24px; }
.pve-filters label span { display: block; margin-bottom: 6px; color: var(--pve-muted); font-size: 12px; }
.pve-filters input, .pve-filters select { width: 100%; height: 38px; border: 1px solid var(--pve-border); border-radius: 5px; background: var(--pve-surface); color: var(--pve-text); padding: 0 11px; font: inherit; font-size: 13px; outline: none; }
.pve-filters input:focus, .pve-filters select:focus { border-color: var(--pve-accent); box-shadow: 0 0 0 3px rgba(200, 72, 115, .1); }
.pve-button { height: 36px; border: 1px solid var(--pve-border); border-radius: 5px; background: var(--pve-surface); color: var(--pve-text); padding: 0 14px; font: inherit; font-size: 13px; cursor: pointer; }
.pve-button:hover { border-color: #bfc5c9; background: #fafbfb; }
.pve-button.primary { height: 38px; border-color: var(--pve-accent); background: var(--pve-accent); color: #fff; }
.pve-button.quiet { height: 38px; color: var(--pve-muted); }
.pve-button:disabled { cursor: wait; opacity: .6; }

.pve-ranking-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.pve-section { min-width: 0; border-top: 2px solid var(--pve-text); background: var(--pve-surface); }
.pve-section > header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; min-height: 68px; padding: 13px 16px 12px; border-bottom: 1px solid var(--pve-border); }
.pve-section > header span { color: var(--pve-muted); font-size: 11px; }
.pve-section > header h2 { margin: 3px 0 0; font-size: 17px; letter-spacing: 0; }
.pve-section > header small { color: var(--pve-muted); font-size: 11px; }
.pve-ranking-list { min-height: 190px; }
.pve-rank-row { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto auto; align-items: center; gap: 12px; min-height: 48px; padding: 8px 16px; border-bottom: 1px solid #edf0f1; }
.pve-rank-row:last-child { border-bottom: 0; }
.pve-rank-row .rank { color: #9aa0a5; font-size: 12px; font-weight: 700; }
.pve-rank-row .name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 700; }
.pve-rank-row .meta, .pve-rank-row .value { text-align: right; }
.pve-rank-row .meta { color: var(--pve-muted); font-size: 11px; }
.pve-rank-row .value { min-width: 94px; color: var(--pve-accent); font-size: 12px; font-weight: 700; }

.pve-reports-section { margin-top: 22px; }
.pve-table-wrap { position: relative; min-height: 220px; overflow-x: auto; }
.pve-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.pve-table th, .pve-table td { height: 45px; padding: 0 14px; border-bottom: 1px solid #edf0f1; overflow: hidden; text-align: left; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.pve-table th { height: 38px; background: #fafbfb; color: var(--pve-muted); font-weight: 500; }
.pve-table td { color: #444a4f; }
.pve-table td.player { color: var(--pve-text); font-weight: 700; }
.pve-table td.number { color: var(--pve-accent); font-weight: 700; font-variant-numeric: tabular-nums; }
.pve-empty { display: grid; min-height: 220px; place-items: center; color: var(--pve-muted); font-size: 13px; }
.pve-empty[hidden] { display: none; }
.pve-ranking-list .pve-empty { min-height: 190px; }

html[data-theme="dark"] body[data-page="udpsPveStats"] {
  --pve-bg: #16191b;
  --pve-surface: #1f2326;
  --pve-border: #353b3f;
  --pve-text: #f1f3f4;
  --pve-muted: #a1a9ae;
  --pve-accent-soft: #35232b;
}
html[data-theme="dark"] .pve-site-nav,
html[data-theme="dark"] .pve-toolbar { background: rgba(31, 35, 38, .96); }
html[data-theme="dark"] .pve-filters input,
html[data-theme="dark"] .pve-filters select,
html[data-theme="dark"] .pve-button { background: #24292c; }
html[data-theme="dark"] .pve-table th { background: #24292c; }
html[data-theme="dark"] .pve-rank-row,
html[data-theme="dark"] .pve-table th,
html[data-theme="dark"] .pve-table td { border-bottom-color: #30363a; }

@media (max-width: 1050px) {
  .pve-summary { grid-template-columns: repeat(3, 1fr); }
  .pve-summary > div:nth-child(3) { border-right: 0; }
  .pve-summary > div:nth-child(-n+3) { border-bottom: 1px solid var(--pve-border); }
  .pve-filters { grid-template-columns: minmax(180px, 1fr) 170px 150px auto auto; }
}

@media (max-width: 760px) {
  html body[data-page="udpsPveStats"] .pve-site-app > .pve-site-nav { display: none !important; }
  html body[data-page="udpsPveStats"] .pve-toolbar {
    top: 0 !important;
    min-height: 52px;
    padding: 8px 14px;
    justify-content: space-between !important;
  }
  html body[data-page="udpsPveStats"] .pve-toolbar .toolbar-title {
    display: block !important;
    font-size: 14px;
    font-weight: 700;
  }
  .pve-content { padding: 18px 14px 40px; }
  .pve-heading { align-items: center; }
  .pve-heading h1 { font-size: 23px; }
  .pve-summary { grid-template-columns: repeat(2, 1fr); }
  .pve-summary > div { padding: 15px; border-bottom: 1px solid var(--pve-border); }
  .pve-summary > div:nth-child(2n) { border-right: 0; }
  .pve-summary > div:nth-child(n+5) { border-bottom: 0; }
  .pve-summary > div:nth-child(3) { border-right: 1px solid var(--pve-border); }
  .pve-summary strong { font-size: 18px; }
  .pve-filters { grid-template-columns: 1fr 1fr; }
  .pve-filters label:first-child { grid-column: 1 / -1; }
  .pve-ranking-layout { grid-template-columns: 1fr; }
  .pve-table { min-width: 820px; }
  .pve-sync-state { display: none; }
}
