@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&family=Rubik:wght@400;500;600;700;800&display=swap');

:root {
  --teal: #59d9ca;
  --teal-dark: #16a99d;
  --cream: #f5f0df;
  --cream-deep: #ebe2c9;
  --ink: #29233b;
  --muted: #817a8a;
  --purple: #332b4b;
  --purple-soft: #473c62;
  --yellow: #ffd85e;
  --line: rgba(41, 35, 59, .13);
  --shadow: 0 12px 30px rgba(48, 39, 67, .10);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--cream); }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 23%, rgba(89, 217, 202, .10) 0 2px, transparent 3px),
    radial-gradient(circle at 90% 64%, rgba(255, 216, 94, .13) 0 2px, transparent 3px),
    var(--cream);
  font-family: 'Rubik', system-ui, sans-serif;
}
button, input { font: inherit; }
button:focus-visible, input:focus-visible, a:focus-visible { outline: 3px solid #167f7a; outline-offset: 3px; }

.site-header { background: var(--teal); border-bottom: 5px solid var(--ink); box-shadow: 0 5px 0 rgba(41, 35, 59, .08); }
.header-inner { width: min(1120px, calc(100% - 32px)); min-height: 84px; margin: auto; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.brand { color: var(--ink); text-decoration: none; display: flex; align-items: center; gap: 13px; min-width: 0; }
.brand-mark { width: 48px; height: 48px; flex: 0 0 48px; display: grid; place-items: center; background: var(--yellow); border: 3px solid var(--ink); box-shadow: 4px 4px 0 var(--ink); font-family: 'Press Start 2P', monospace; font-size: 13px; image-rendering: pixelated; overflow: hidden; }
.brand-mark img { width: 100%; height: 100%; object-fit: contain; }
.brand-name { font-family: 'Press Start 2P', monospace; font-size: clamp(11px, 2vw, 16px); line-height: 1.7; overflow-wrap: anywhere; }
.main-tabs { display: flex; align-self: stretch; align-items: stretch; gap: 5px; }
.tab-button { position: relative; border: 0; padding: 0 17px; color: #204c4d; background: transparent; font-size: 12px; font-weight: 800; letter-spacing: .12em; cursor: pointer; }
.tab-button::after { content: ''; position: absolute; bottom: -5px; left: 12px; right: 12px; height: 5px; background: transparent; }
.tab-button:hover { color: var(--ink); }
.tab-button.active { color: var(--ink); }
.tab-button.active::after { background: var(--ink); }

.page-shell { width: min(1120px, calc(100% - 32px)); min-height: calc(100vh - 160px); margin: 0 auto; padding: 43px 0 64px; }
.intro-row { display: flex; justify-content: space-between; align-items: end; gap: 25px; margin-bottom: 34px; }
.eyebrow { margin: 0 0 10px; color: var(--teal-dark); font-size: 10px; font-weight: 800; letter-spacing: .2em; }
h1, h2, h3, p { margin-top: 0; }
h1, h2 { margin-bottom: 0; font-family: 'Press Start 2P', monospace; line-height: 1.65; }
h1 { max-width: 740px; font-size: clamp(19px, 3.2vw, 31px); text-shadow: 3px 3px 0 rgba(89, 217, 202, .45); }
h2 { font-size: clamp(16px, 2vw, 21px); }
.intro-copy { margin: 10px 0 0; color: var(--muted); font-size: 14px; }
.sync-pill { display: inline-flex; align-items: center; gap: 9px; max-width: 320px; padding: 10px 13px; border: 2px solid var(--line); border-radius: 999px; background: rgba(255,255,255,.52); color: var(--muted); font-size: 11px; font-weight: 600; }
.sync-dot { width: 8px; height: 8px; flex: 0 0 8px; border-radius: 50%; background: #d7aa41; box-shadow: 0 0 0 4px rgba(215,170,65,.14); }
.sync-pill.online .sync-dot { background: #32b58a; box-shadow: 0 0 0 4px rgba(50,181,138,.14); }
.sync-pill.offline .sync-dot { background: #d96f5c; box-shadow: 0 0 0 4px rgba(217,111,92,.14); }

.panel { display: none; animation: appear .22s ease-out; }
.panel.active { display: block; }
@keyframes appear { from { opacity: .4; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin: 0 0 20px; }
.count-chip { display: inline-flex; align-items: center; min-height: 30px; padding: 0 12px; border: 2px solid var(--ink); border-radius: 5px; background: var(--yellow); font-family: 'Press Start 2P', monospace; font-size: 8px; white-space: nowrap; }
.search-box { min-height: 56px; padding: 0 16px; display: flex; align-items: center; gap: 12px; background: #fffdf6; border: 2px solid var(--ink); box-shadow: 5px 5px 0 var(--ink); }
.search-icon { color: var(--teal-dark); font-size: 29px; line-height: 1; transform: rotate(-15deg); }
.search-box input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 15px; }
.search-box input::placeholder { color: #aaa3ad; }
.search-hint { color: #a49ba8; font-size: 9px; font-weight: 800; letter-spacing: .12em; white-space: nowrap; }
.participant-list { margin-top: 20px; border: 2px solid var(--ink); background: #fffdf6; box-shadow: var(--shadow); }
.participant-row { display: flex; align-items: center; min-height: 72px; padding: 11px 18px; gap: 15px; border-bottom: 1px solid var(--line); }
.participant-row:last-child { border-bottom: 0; }
.participant-row:hover { background: rgba(89,217,202,.10); }
.player-head { width: 46px; height: 46px; flex: 0 0 46px; border: 2px solid var(--ink); background: var(--cream-deep); image-rendering: pixelated; object-fit: cover; }
.player-name { min-width: 0; overflow-wrap: anywhere; font-weight: 700; font-size: 14px; }
.player-uuid { margin-top: 4px; color: #a19aa4; font-family: ui-monospace, monospace; font-size: 9px; }
.platform-tag { margin-left: auto; padding: 6px 9px; border: 1px solid var(--line); border-radius: 3px; color: #726a7d; background: #f8f3e8; font-size: 9px; font-weight: 800; letter-spacing: .08em; }
.empty-state, .loading-state { padding: 34px 18px; color: var(--muted); text-align: center; font-size: 13px; }

.stats-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.stat-card { min-width: 0; color: #fffdf6; background: var(--purple); border: 3px solid var(--ink); box-shadow: 6px 6px 0 var(--ink); overflow: hidden; }
.stat-card-head { min-height: 110px; padding: 19px 20px 17px; display: flex; align-items: center; gap: 14px; background: var(--purple-soft); border-bottom: 2px solid rgba(255,255,255,.13); }
.stat-icon { width: 47px; height: 47px; flex: 0 0 47px; display: grid; place-items: center; border: 2px solid rgba(255,255,255,.42); background: rgba(255,255,255,.09); border-radius: 4px; font-size: 23px; }
.stat-card h3 { margin: 0 0 7px; color: var(--yellow); font-family: 'Press Start 2P', monospace; font-size: 11px; line-height: 1.7; }
.stat-card-head p { margin: 0; color: rgba(255,255,255,.7); font-size: 11px; line-height: 1.4; }
.rank-list { padding: 4px 17px 9px; }
.rank-row { min-height: 51px; display: grid; grid-template-columns: 28px 34px minmax(0, 1fr) auto; align-items: center; gap: 10px; border-bottom: 1px solid rgba(255,255,255,.10); }
.rank-row:last-child { border-bottom: 0; }
.rank-number { color: rgba(255,255,255,.46); font-family: 'Press Start 2P', monospace; font-size: 9px; text-align: center; }
.rank-head { width: 31px; height: 31px; border: 1px solid rgba(255,255,255,.33); image-rendering: pixelated; object-fit: cover; background: #eee2c9; }
.rank-name { min-width: 0; overflow: hidden; color: rgba(255,255,255,.94); font-size: 12px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.rank-value { color: rgba(255,255,255,.82); font-variant-numeric: tabular-nums; font-size: 10px; font-weight: 700; text-align: right; white-space: nowrap; }
.rank-row.podium { margin: 0 -7px; padding: 0 7px; color: var(--ink); background: var(--yellow); border-bottom-color: rgba(41,35,59,.14); }
.rank-row.podium .rank-number, .rank-row.podium .rank-name, .rank-row.podium .rank-value { color: var(--ink); }
.rank-row.podium .rank-head { border-color: var(--ink); }
.card-empty { padding: 20px 8px; color: rgba(255,255,255,.63); font-size: 12px; text-align: center; }
.error-banner { margin-top: 20px; padding: 13px 15px; color: #7d332c; background: #ffe3d9; border: 2px solid #c56555; font-size: 12px; }
.site-footer { min-height: 60px; padding: 15px max(16px, calc((100% - 1120px)/2)); display: flex; align-items: center; justify-content: space-between; gap: 15px; border-top: 2px solid var(--line); color: #99919b; font-size: 9px; font-weight: 700; letter-spacing: .1em; }

@media (max-width: 720px) {
  .header-inner { min-height: 74px; gap: 8px; }
  .brand { gap: 9px; }
  .brand-mark { width: 40px; height: 40px; flex-basis: 40px; font-size: 10px; }
  .brand-name { max-width: 150px; font-size: 10px; }
  .tab-button { padding: 0 9px; font-size: 10px; letter-spacing: .07em; }
  .page-shell { padding-top: 30px; }
  .intro-row { align-items: start; flex-direction: column; margin-bottom: 28px; gap: 16px; }
  .sync-pill { max-width: 100%; }
  .stats-grid { grid-template-columns: 1fr; gap: 17px; }
  .stat-card-head { min-height: 92px; }
  .site-footer { align-items: flex-start; flex-direction: column; justify-content: center; gap: 7px; }
}
@media (max-width: 420px) {
  .header-inner { width: calc(100% - 20px); }
  .brand-name { max-width: 104px; font-size: 8px; }
  .tab-button { padding: 0 6px; font-size: 9px; }
  .page-shell { width: calc(100% - 24px); }
  .search-box { padding: 0 11px; }
  .search-hint { display: none; }
  .participant-row { padding: 10px; gap: 10px; }
  .player-head { width: 40px; height: 40px; flex-basis: 40px; }
  .platform-tag { font-size: 8px; }
  .rank-list { padding-right: 10px; padding-left: 10px; }
  .rank-row { grid-template-columns: 22px 30px minmax(0,1fr) auto; gap: 7px; }
  .rank-head { width: 28px; height: 28px; }
  .rank-value { font-size: 9px; }
}
