:root {
  /* PBA / Philippine flag palette */
  --pba-blue: #0038a8;
  --pba-blue-deep: #001a52;
  --pba-red: #ce1126;
  --pba-red-deep: #8f0b1a;
  --pba-gold: #fcd116;
  --ball: #e8722a;
  --ball-seam: #8a3f10;

  --bg: #060b1e;
  --bg-card: #0d1735;
  --bg-card-soft: #12204a;
  --line: rgba(255, 255, 255, 0.09);
  --text: #f2f5ff;
  --text-dim: #93a1c8;
  --danger: #ff6b6b;

  --font-head: "Oswald", "Arial Narrow", sans-serif;
  --font-body: "Barlow", "Segoe UI", "Helvetica Neue", Arial, "PingFang TC", sans-serif;

  --seams: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath d='M16 0v32M0 16h32M5.5 4c7 7 7 17 0 24M26.5 4c-7 7-7 17 0 24' fill='none' stroke='%238a3f10' stroke-width='1.6'/%3E%3C/svg%3E");
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* PBA tri-color brand stripe */
.tricolor-stripe {
  height: 5px;
  background: linear-gradient(90deg,
    var(--pba-blue) 0 34%,
    var(--pba-red) 34% 67%,
    var(--pba-gold) 67% 100%);
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(ellipse 70% 130% at 18% -25%, rgba(0, 56, 168, 0.55), transparent 62%),
    radial-gradient(ellipse 70% 130% at 82% -25%, rgba(206, 17, 38, 0.42), transparent 62%),
    linear-gradient(180deg, #0a1234 0%, var(--bg) 100%);
  border-bottom: 1px solid var(--line);
  padding: 46px 16px 34px;
  text-align: center;
}

.brand-logo {
  position: absolute;
  top: 20px;
  left: 22px;
  height: 30px;
  width: auto;
  z-index: 2;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.5));
}

.hero-court {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 170px;
  color: rgba(255, 255, 255, 0.07);
  pointer-events: none;
}

.hero-ball {
  position: absolute;
  width: 170px;
  height: 170px;
  right: -40px;
  top: -46px;
  opacity: 0.5;
  transform: rotate(-18deg);
  pointer-events: none;
}

.hero-inner { position: relative; }

.hero-kicker {
  color: var(--pba-gold);
  font-family: var(--font-head);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 4px;
}

.hero-kicker .star { font-size: 11px; vertical-align: 2px; }

.hero-title {
  font-family: var(--font-head);
  font-size: clamp(40px, 8vw, 64px);
  font-weight: 700;
  letter-spacing: 3px;
  margin: 4px 0 8px;
  background: linear-gradient(180deg, #ffffff 35%, var(--pba-gold) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-transform: uppercase;
}

.hero-period { color: var(--text-dim); font-size: 14px; }

.detail-btn {
  display: inline-block;
  margin-left: 10px;
  padding: 3px 14px;
  border: 1px solid rgba(252, 209, 22, 0.55);
  border-radius: 999px;
  color: var(--pba-gold);
  font-family: var(--font-head);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.detail-btn:hover {
  background: var(--pba-gold);
  color: #1a1503;
}

.prize-strip {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.prize {
  background: linear-gradient(180deg, var(--bg-card-soft), var(--bg-card));
  border: 1px solid var(--line);
  border-top: 3px solid var(--pba-blue);
  border-radius: 10px;
  padding: 8px 16px;
  display: flex;
  flex-direction: column;
  min-width: 86px;
}

.prize-rank {
  color: var(--text-dim);
  font-family: var(--font-head);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.prize-amt {
  color: var(--pba-gold);
  font-family: var(--font-head);
  font-size: 18px;
  font-weight: 700;
}

.prize-first {
  border-color: rgba(252, 209, 22, 0.55);
  border-top-color: var(--pba-gold);
  box-shadow: 0 0 18px rgba(252, 209, 22, 0.12);
}

/* ---------- Layout ---------- */
.container {
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
  padding: 26px 16px 40px;
  flex: 1;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px;
  margin-bottom: 22px;
}

.section-title {
  font-family: var(--font-head);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Little basketball bullet */
.ball-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  flex-shrink: 0;
  background:
    var(--seams) center / 100% 100% no-repeat,
    radial-gradient(circle at 35% 30%, #f79b56, var(--ball) 60%, #c85a1b);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

/* ---------- Search ---------- */
.search-form {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.search-form input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  color: var(--text);
  font-size: 16px;
  outline: none;
}

.search-form input:focus { border-color: var(--pba-gold); }

.search-form button {
  background: linear-gradient(180deg, #e6293f, var(--pba-red) 55%, var(--pba-red-deep));
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 12px 26px;
  font-family: var(--font-head);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  cursor: pointer;
  transition: filter 0.15s;
}

.search-form button:hover { filter: brightness(1.15); }
.search-form button:disabled { opacity: 0.6; cursor: wait; }

.search-result { margin-top: 16px; }
.hidden { display: none; }

.result-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--bg-card-soft);
  border: 1px solid var(--line);
  border-left: 4px solid var(--pba-blue);
  border-radius: 12px;
  padding: 16px;
  flex-wrap: wrap;
}

.result-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 800;
  overflow: hidden;
  flex-shrink: 0;
  background:
    var(--seams) center / 100% 100% no-repeat,
    radial-gradient(circle at 35% 30%, #f79b56, var(--ball) 60%, #c85a1b);
}

.result-avatar img { width: 100%; height: 100%; object-fit: cover; }

.result-who { min-width: 140px; }
.result-nick { font-size: 17px; font-weight: 700; }
.result-uid { color: var(--text-dim); font-size: 13px; }

.result-stats {
  display: flex;
  gap: 24px;
  margin-left: auto;
  flex-wrap: wrap;
}

.stat { text-align: center; }

.stat-label {
  color: var(--text-dim);
  font-family: var(--font-head);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 1.5px;
}

.stat-value {
  font-family: var(--font-head);
  font-size: 24px;
  font-weight: 700;
  color: var(--pba-gold);
}

.stat-value.muted { color: var(--text-dim); }

.result-error {
  background: rgba(206, 17, 38, 0.12);
  border: 1px solid rgba(206, 17, 38, 0.45);
  color: var(--danger);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 14px;
}

/* ---------- Leaderboard ---------- */
.board-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.refresh-btn {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text-dim);
  border-radius: 8px;
  padding: 7px 14px;
  font-size: 13px;
  cursor: pointer;
}

.refresh-btn:hover { color: var(--text); border-color: var(--pba-gold); }

.table-wrap { overflow-x: auto; margin-top: 14px; }

.board-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}

.board-table th {
  color: var(--text-dim);
  font-family: var(--font-head);
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  text-align: left;
  padding: 10px 12px;
  border-bottom: 2px solid var(--pba-blue);
}

.board-table td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.board-table tbody tr:last-child td { border-bottom: none; }
.board-table tbody tr:hover { background: rgba(255, 255, 255, 0.03); }

.col-rank { width: 70px; }
.col-score, .col-fullhit { width: 110px; text-align: right; }

.board-table td.col-score {
  font-family: var(--font-head);
  font-size: 17px;
  font-weight: 700;
  color: var(--pba-gold);
  text-align: right;
}

.board-table td.col-fullhit { color: var(--text-dim); text-align: right; }

.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  border-radius: 50%;
  font-family: var(--font-head);
  font-weight: 700;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-dim);
}

/* Top 3: basketball badges with medal rings */
tr.rank-1 .rank-badge,
tr.rank-2 .rank-badge,
tr.rank-3 .rank-badge {
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
  background:
    var(--seams) center / 100% 100% no-repeat,
    radial-gradient(circle at 35% 30%, #f79b56, var(--ball) 60%, #c85a1b);
}

tr.rank-1 .rank-badge { box-shadow: 0 0 0 2.5px var(--pba-gold), 0 0 12px rgba(252, 209, 22, 0.45); }
tr.rank-2 .rank-badge { box-shadow: 0 0 0 2.5px #cdd7e5; }
tr.rank-3 .rank-badge { box-shadow: 0 0 0 2.5px #b0713d; }

tr.prize-row td.col-player .player-name::after {
  content: "PRIZE";
  margin-left: 8px;
  font-family: var(--font-head);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1px;
  color: var(--pba-gold);
  border: 1px solid rgba(252, 209, 22, 0.5);
  border-radius: 5px;
  padding: 1px 6px;
  vertical-align: 2px;
}

.player-cell { display: flex; align-items: center; gap: 10px; }

.player-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 800;
  overflow: hidden;
  flex-shrink: 0;
  background:
    var(--seams) center / 100% 100% no-repeat,
    radial-gradient(circle at 35% 30%, #f79b56, var(--ball) 60%, #c85a1b);
}

.player-avatar img { width: 100%; height: 100%; object-fit: cover; }
.player-name { font-weight: 700; }

.board-msg {
  text-align: center;
  color: var(--text-dim);
  padding: 28px 12px !important;
}

.board-msg.error { color: var(--danger); }

.board-note {
  margin-top: 14px;
  color: var(--text-dim);
  font-size: 12.5px;
  line-height: 1.6;
}

/* ---------- Footer ---------- */
.footer {
  border-top: 1px solid var(--line);
  color: var(--text-dim);
  font-size: 12px;
  text-align: center;
}

.footer p { padding: 16px; }

@media (max-width: 560px) {
  .search-form { flex-direction: column; }
  .result-stats { margin-left: 0; width: 100%; justify-content: space-between; }
  .hero-ball { width: 120px; height: 120px; right: -34px; top: -30px; }
  .hero { padding-top: 24px; }
  .brand-logo {
    position: static;
    display: block;
    margin: 0 auto 18px;
    height: 26px;
  }
}
