/* CBON 香港網速挑戰賽 — 共用樣式
 * --------------------------------------------------------------
 * 適用於：
 *   - 首頁 Hero 下「香港網速挑戰賽」CTA 卡
 *   - speedtest.html 浮動 banner + 分享 CTA
 *   - member-center.html 獎牌區塊
 *   - leaderboard.html 冠軍榜
 */

:root {
  --cbon-arena-orange: #ff6b35;
  --cbon-arena-orange-2: #ffa726;
  --cbon-arena-gold: #f3b91f;
  --cbon-arena-silver: #b8b8b8;
  --cbon-arena-bronze: #cd7f32;
  --cbon-arena-ink: #1f2937;
  --cbon-arena-muted: #6b7280;
  --cbon-arena-paper: #fff5ec;
}

/* ============== Hero CTA 卡（首頁） ============== */

.arena-cta {
  background: linear-gradient(135deg, #1f2937 0%, #ff6b35 70%, #ffa726 100%);
  padding: 40px 20px;
  overflow: hidden;
  position: relative;
  color: #fff;
}

.arena-cta::before {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 240px; height: 240px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  pointer-events: none;
}

.arena-cta-shell {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 36px;
  align-items: center;
  position: relative;
  z-index: 2;
}

.arena-cta-eyebrow {
  display: inline-block;
  background: rgba(255,255,255,0.18);
  color: #fff;
  padding: 5px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  margin-bottom: 14px;
  border: 1px solid rgba(255,255,255,0.3);
}

.arena-cta-copy h2 {
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  color: #fff;
  margin: 0 0 14px 0;
  line-height: 1.25;
  font-weight: 800;
}

.arena-cta-copy p {
  font-size: 15px;
  color: rgba(255,255,255,0.92);
  line-height: 1.7;
  margin: 0 0 22px 0;
}

.arena-cta-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.arena-cta-actions .btn-primary,
.arena-cta .btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
  background: #fff;
  color: #ff6b35;
  border: 0;
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
  transition: transform 0.15s ease;
}

.arena-cta-actions .btn-primary:hover {
  transform: translateY(-1px);
}

.arena-cta-actions .btn-ghost,
.arena-cta .btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
  background: transparent;
  color: #fff;
  border: 2px solid #fff;
  transition: background 0.15s ease;
}

.arena-cta-actions .btn-ghost:hover {
  background: rgba(255,255,255,0.12);
}

/* 倒數計時（首頁 CTA 內 / speedtest banner） */
.arena-cta-countdown {
  margin-top: 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(0,0,0,0.28);
  color: #fff;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.3px;
  font-variant-numeric: tabular-nums;
  border: 1px solid rgba(255,255,255,0.25);
}
.arena-cta-countdown::before {
  content: '⏱';
  font-size: 15px;
}

.arena-cta-visual {
  position: relative;
  height: 220px;
  display: grid;
  place-items: center;
}

.arena-medal {
  position: absolute;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-weight: 800;
  color: #fff;
  box-shadow: 0 12px 24px rgba(0,0,0,0.25);
  animation: arena-medal-float 4s ease-in-out infinite;
  font-size: 22px;
  text-align: center;
  line-height: 1.1;
}

.arena-medal--gold   { background: linear-gradient(135deg, #f3b91f, #e5a518); width: 130px; height: 130px; top: 20px; left: 14%; }
.arena-medal--silver { background: linear-gradient(135deg, #b8b8b8, #9a9a9a); width: 96px;  height: 96px;  bottom: 12px; right: 16%; animation-delay: 1.4s; }
.arena-medal--bronze { background: linear-gradient(135deg, #cd7f32, #b06a26); width: 76px;  height: 76px;  top: 92px; right: 6%;  animation-delay: 2.6s; }

@keyframes arena-medal-float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-10px); }
}

@media (max-width: 900px) {
  .arena-cta { padding: 32px 18px; }
  .arena-cta-shell { grid-template-columns: 1fr; gap: 20px; }
  .arena-cta-visual { height: 140px; }
  .arena-medal--gold { width: 86px; height: 86px; font-size: 16px; }
  .arena-medal--silver { width: 64px; height: 64px; font-size: 14px; }
  .arena-medal--bronze { width: 52px; height: 52px; font-size: 12px; }
}

/* ============== Speedtest 浮動 banner ============== */

.arena-floating-banner {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 9999;
  background: linear-gradient(135deg, #ff6b35, #ffa726);
  color: #fff;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 6px 20px rgba(255, 107, 53, 0.4);
  display: none;
}

.arena-floating-banner.is-visible { display: block; animation: arena-banner-slide-in 0.4s ease-out; }

@keyframes arena-banner-slide-in {
  from { transform: translateX(120%); }
  to   { transform: translateX(0); }
}

/* ============== 冠軍榜（leaderboard.html） ============== */

.arena-lb-page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 16px 80px 16px;
}

.arena-lb-header {
  text-align: center;
  padding: 32px 16px 16px 16px;
}

.arena-lb-header h1 {
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  font-weight: 800;
  color: #1f2937;
  margin: 0 0 8px 0;
}

.arena-lb-header p {
  color: #6b7280;
  font-size: 15px;
  margin: 0;
}

.arena-lb-group {
  background: #fff;
  border-radius: 16px;
  border: 1px solid #f3e3d6;
  margin: 24px 0;
  padding: 20px 18px;
}

.arena-lb-group-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid #f3e3d6;
}

.arena-lb-group-head h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
  color: #1f2937;
}

.arena-lb-group-head .count {
  font-size: 13px;
  color: #6b7280;
}

.arena-lb-row {
  display: grid;
  grid-template-columns: 50px 1fr 110px 110px;
  align-items: center;
  padding: 10px 6px;
  border-radius: 10px;
  font-size: 14px;
}

.arena-lb-row + .arena-lb-row { border-top: 1px dashed #f3e3d6; }

.arena-lb-row .rank {
  font-weight: 800;
  color: #1f2937;
}

.arena-lb-row .name {
  color: #1f2937;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.arena-lb-row .speed {
  text-align: right;
  font-weight: 800;
  color: #ff6b35;
}

.arena-lb-row .share {
  text-align: right;
}

.arena-lb-row .share button {
  background: transparent;
  border: 1px solid #ff6b35;
  color: #ff6b35;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  cursor: pointer;
}

.arena-lb-row--gold   { background: linear-gradient(90deg, rgba(243,185,31,0.18), transparent); }
.arena-lb-row--silver { background: linear-gradient(90deg, rgba(184,184,184,0.18), transparent); }
.arena-lb-row--bronze { background: linear-gradient(90deg, rgba(205,127,50,0.18), transparent); }

/* Tabs */
.arena-lb-tabs {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin: 4px 0 12px 0;
  padding: 6px;
  background: #fff;
  border: 1px solid #f3e3d6;
  border-radius: 999px;
  position: sticky;
  top: 0;
  z-index: 5;
  flex-wrap: wrap;
}

.arena-lb-tab {
  appearance: none;
  border: 0;
  background: transparent;
  color: #6b7280;
  font-size: 14px;
  font-weight: 700;
  padding: 8px 18px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.arena-lb-tab:hover:not(.is-active):not([disabled]) {
  background: rgba(255,107,53,0.08);
  color: #ff6b35;
}

.arena-lb-tab.is-active {
  background: linear-gradient(135deg, #ff6b35, #ffa726);
  color: #fff;
  box-shadow: 0 4px 12px rgba(255,107,53,0.25);
}

.arena-lb-tab[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Summary */
.arena-lb-summary {
  background: rgba(255,107,53,0.08);
  border: 1px solid rgba(255,107,53,0.18);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 14px;
  color: #1f2937;
  margin: 12px 0 4px 0;
  display: flex;
  align-items: center;
  gap: 8px;
  line-height: 1.5;
}
.arena-lb-summary i { color: #ff6b35; }
.arena-lb-summary.hidden { display: none; }

/* Pending empty state (both tabs) */
.arena-lb-pending {
  background: #fff;
  border: 1px dashed #f3e3d6;
  border-radius: 16px;
  padding: 36px 18px;
  text-align: center;
  margin: 24px 0;
}
.arena-lb-pending i {
  font-size: 32px;
  color: #ff6b35;
  margin-bottom: 8px;
  display: inline-block;
}
.arena-lb-pending h3 {
  margin: 8px 0 6px 0;
  font-size: 18px;
  font-weight: 800;
  color: #1f2937;
}
.arena-lb-pending p {
  margin: 0 0 18px 0;
  font-size: 14px;
  color: #6b7280;
}
.arena-lb-actions {
  display: inline-flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}
.arena-lb-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  border: 0;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.arena-lb-action.primary {
  background: linear-gradient(135deg, #ff6b35, #ffa726);
  color: #fff;
  box-shadow: 0 6px 16px rgba(255,107,53,0.28);
}
.arena-lb-action.primary:hover { transform: translateY(-1px); }
.arena-lb-action.ghost {
  background: #fff;
  color: #ff6b35;
  border: 2px solid #ff6b35;
}

/* Live row extras */
.arena-lb-row--live {
  grid-template-columns: 50px 1fr 140px 80px;
}
.arena-lb-row .upload {
  font-size: 12px;
  color: #6b7280;
  font-weight: 600;
  margin-left: 4px;
}
.arena-lb-row .ts {
  text-align: right;
  font-size: 12px;
  color: #6b7280;
  font-variant-numeric: tabular-nums;
}
@media (max-width: 560px) {
  .arena-lb-row--live { grid-template-columns: 36px 1fr 100px; }
  .arena-lb-row--live .ts { display: none; }
}

@media (max-width: 560px) {
  .arena-lb-row { grid-template-columns: 36px 1fr 80px; }
  .arena-lb-row .share { display: none; }
}

/* ============== Member Center 獎牌區塊 ============== */

.arena-medals-block {
  background: #fff;
  border-radius: 16px;
  padding: 18px 16px;
  margin-top: 16px;
  border: 1px solid #f3e3d6;
}

.arena-medals-block h3 {
  margin: 0 0 12px 0;
  font-size: 16px;
  font-weight: 800;
  color: #1f2937;
}

.arena-medal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}

.arena-medal-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 8px;
  border-radius: 12px;
  background: #fff5ec;
  border: 1px solid #f3e3d6;
  text-align: center;
}

.arena-medal-card .medal-icon {
  font-size: 32px;
  margin-bottom: 4px;
}

.arena-medal-card .medal-title {
  font-weight: 800;
  font-size: 13px;
  color: #1f2937;
}

.arena-medal-card .medal-sub {
  font-size: 11px;
  color: #6b7280;
  margin-top: 2px;
}

/* ============== 討論區戰區面板 ============== */

.arena-community-panel {
  background: linear-gradient(135deg, #fff5ec 0%, #fff 100%);
  border: 1px solid #f3e3d6;
  border-radius: 16px;
  padding: 18px;
  margin: 16px 0;
}

.arena-community-title {
  font-size: 16px;
  font-weight: 800;
  color: #1f2937;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.arena-report-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid #ff6b35;
  color: #ff6b35;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  transition: background 0.15s;
}
.arena-report-link:hover {
  background: #fff5ec;
}

.arena-battle-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border-radius: 999px;
  background: #1f2937;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  transition: opacity 0.15s;
}
.arena-battle-chip:hover {
  opacity: 0.85;
}

.arena-reply-draft-hint {
  background: #fef3c7;
  border: 1px solid #f59e0b;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  color: #92400e;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Leaderboard 討論 CTA */
.arena-lb-discuss-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* ===== Leaderboard live-refresh countdown chip =====
   Added 2026-07-05 per docs/superpowers/specs/2026-07-05-leaderboard-live-refresh-design.md */
.arena-lb-countdown {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.06);
  color: var(--cbon-text-muted, #666);
  font-size: 12px;
  line-height: 1;
  vertical-align: middle;
}
.arena-lb-countdown[aria-busy="true"] {
  background: rgba(255, 107, 53, 0.12);
  color: #ff6b35;
}
.arena-lb-countdown[aria-busy="true"]::before {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-top-color: transparent;
  animation: arena-lb-spin 800ms linear infinite;
}
@keyframes arena-lb-spin {
  to { transform: rotate(360deg); }
}
