/* spectator.css — Beach Super 8 · Apple-style Dark Design */

/* ─── Reset & Base ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  background: #000000;
  color: #FFFFFF;
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Inter', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
  padding-bottom: 96px;
  overscroll-behavior-y: contain;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; }
a { color: inherit; text-decoration: none; }

/* ─── Design Tokens ─────────────────────────────────────────────────────── */
:root {
  --orange:        #FF6B00;
  --orange-light:  #FF8C3A;
  --gold:          #F4D35E;  /* AppColors.gold */
  --silver:        #C0C8D0;  /* AppColors.silver */
  --bronze:        #CD7F32;  /* AppColors.bronze */
  --green:         #30D158;
  --red:           #FF453A;

  /* iOS dark system colors */
  --bg:            #000000;
  --bg2:           #1C1C1E;
  --bg3:           #2C2C2E;
  --separator:     #38383A;
  --separator-light: rgba(255,255,255,0.08);

  --text1:         #FFFFFF;
  --text2:         rgba(235,235,245,0.6);   /* iOS label secondary */
  --text3:         rgba(235,235,245,0.3);   /* iOS label tertiary */
  --text4:         rgba(235,235,245,0.18);

  --radius-sm:     10px;
  --radius:        16px;    /* AppRadius.large */
  --radius-lg:     18px;
}

/* ─── Loading Screen ────────────────────────────────────────────────────── */
.loading-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  gap: 20px;
}
.loading-logo { font-size: 52px; animation: floatY 2.5s ease-in-out infinite; }
@keyframes floatY { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-9px)} }
.loading-spinner {
  width: 36px; height: 36px;
  border: 2.5px solid rgba(255,107,0,0.18);
  border-top-color: var(--orange);
  border-radius: 50%;
  animation: spin 0.85s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { color: var(--text3); font-size: 14px; font-weight: 500; letter-spacing: -0.01em; }

/* ─── Error Screen ──────────────────────────────────────────────────────── */
.error-screen {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; min-height: 100dvh; gap: 12px;
  padding: 32px; text-align: center;
}
.error-icon { font-size: 48px; }
.error-screen h2 { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; }
.error-screen p  { font-size: 15px; color: var(--text2); }

/* ─── Hero ──────────────────────────────────────────────────────────────── */
header#hero {
  position: relative;
  overflow: hidden;
  padding: 56px 20px 24px;
  padding-top: max(56px, env(safe-area-inset-top, 0px) + 24px);
  margin-bottom: 8px;
}
.hero-bg {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 100% 70% at 75% -10%, rgba(255,107,0,0.22) 0%, transparent 55%),
    linear-gradient(180deg, #0D0D0D 0%, #000000 100%);
}
.hero-content { position: relative; z-index: 1; }

.brand-row {
  display: flex; align-items: center; gap: 8px; margin-bottom: 18px;
}
.brand-icon { font-size: 17px; }
.brand-name {
  font-size: 12px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--text3); flex: 1;
}
.share-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,0.1);
  border: 0.5px solid rgba(255,255,255,0.2);
  color: var(--text1);
  padding: 7px 14px; border-radius: 99px;
  font-size: 13px; font-weight: 600;
  letter-spacing: -0.01em;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transition: opacity 0.15s;
}
.share-btn:active { opacity: 0.6; }

/* Status badges */
#hero-badge { margin-bottom: 10px; }
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 11px; border-radius: 99px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.04em;
}
.badge-live  { background: rgba(255,69,58,0.15); color: #FF6961; }
.badge-done  { background: rgba(48,209,88,0.12);  color: #34C759; }
.badge-setup { background: rgba(255,107,0,0.12);  color: var(--orange-light); }
.badge-dot   { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.badge-live .badge-dot { animation: pulse 1.8s ease-in-out infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.3} }

.hero-name {
  font-size: clamp(26px, 7.5vw, 38px);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.03em;
  margin-bottom: 10px;
  color: var(--text1);
}
.hero-meta {
  display: flex; flex-wrap: wrap; gap: 12px;
  font-size: 13px; color: var(--text2); font-weight: 500;
  letter-spacing: -0.01em;
}
.hero-meta-chip { display: flex; align-items: center; gap: 5px; }

/* Progress bar */
.hero-progress-wrap { margin-top: 20px; }
.hero-progress-bar {
  height: 3px; background: rgba(255,255,255,0.1);
  border-radius: 99px; overflow: hidden; margin-bottom: 8px;
}
.hero-progress-fill {
  height: 100%; border-radius: 99px;
  background: var(--orange);
  transition: width 1.4s cubic-bezier(0.4,0,0.2,1);
  width: 0%;
}
.hero-progress-label {
  font-size: 12px; color: var(--text3); font-weight: 500; letter-spacing: -0.01em;
}

/* ─── Champion Banner ───────────────────────────────────────────────────── */
.champion-card {
  margin: 0 16px 4px;
  padding: 28px 20px 24px;
  background: rgba(255,214,10,0.07);
  border: 0.5px solid rgba(255,214,10,0.25);
  border-radius: var(--radius-lg);
  text-align: center;
  animation: revealUp 0.6s cubic-bezier(0.16,1,0.3,1) both;
}
@keyframes revealUp {
  from { opacity:0; transform:translateY(20px) scale(0.97); }
  to   { opacity:1; transform:translateY(0) scale(1); }
}
.champion-trophy { font-size: 48px; margin-bottom: 8px; animation: floatY 3s ease-in-out infinite; }
.champion-label {
  font-size: 10px; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--gold); margin-bottom: 8px;
}
.champion-name { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; }
.champion-stars { margin-top: 8px; font-size: 16px; letter-spacing: 3px; }

/* ─── Section title ──────────────────────────────────────────────────────── */
.section-title {
  font-size: 13px; font-weight: 600;
  color: var(--text2);
  letter-spacing: -0.01em;
  padding: 0 4px;
  margin: 20px 16px 8px;
}

/* ─── Tab Bar ───────────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  margin: 0 16px 4px;
  background: var(--bg2);
  border-radius: var(--radius);
  padding: 4px;
  gap: 4px;
  position: sticky;
  top: 8px;
  z-index: 100;
}
.tab {
  flex: 1;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600;
  color: var(--text2);
  letter-spacing: -0.01em;
  transition: all 0.2s cubic-bezier(0.4,0,0.2,1);
}
.tab.active {
  background: var(--bg3);
  color: var(--text1);
}
.tab svg { flex-shrink: 0; }

/* ─── Tab Content ───────────────────────────────────────────────────────── */
.tab-content { display: none; animation: fadeIn 0.2s ease both; }
.tab-content.active { display: block; }
@keyframes fadeIn { from{opacity:0} to{opacity:1} }

/* ─── Grouped List (shared by ranking + matches) ───────────────────────── */
.list-group {
  background: var(--bg2);
  border-radius: var(--radius);
  overflow: hidden;
  margin: 0 16px;
}

/* ─── Podium ────────────────────────────────────────────────────────────── */
.podium-section { padding: 16px 16px 4px; }
.podium-label {
  font-size: 11px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--text4);
  margin-bottom: 20px; text-align: center;
}
.podium-stage {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
  align-items: end;
}
.podium-player {
  display: flex; flex-direction: column; align-items: center;
  animation: revealUp 0.5s cubic-bezier(0.16,1,0.3,1) both;
}
.podium-player:nth-child(1) { animation-delay: 0.08s; }
.podium-player:nth-child(2) { animation-delay: 0s; }
.podium-player:nth-child(3) { animation-delay: 0.16s; }

.podium-medal  { font-size: 28px; margin-bottom: 8px; }
.podium-name {
  font-size: 12px; font-weight: 700; letter-spacing: -0.01em;
  text-align: center; line-height: 1.3;
  overflow: hidden; text-overflow: ellipsis;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  max-width: 96px; margin-bottom: 6px;
}
.podium-pts {
  font-size: 12px; font-weight: 600;
  color: var(--text2); margin-bottom: 10px;
  letter-spacing: -0.01em;
}
.podium-block {
  width: 100%; border-radius: 10px 10px 0 0;
}
.podium-1st .podium-block { height: 68px; background: rgba(255,214,10,0.18); border: 0.5px solid rgba(255,214,10,0.35); }
.podium-2nd .podium-block { height: 50px; background: rgba(152,152,158,0.18); border: 0.5px solid rgba(152,152,158,0.3); }
.podium-3rd .podium-block { height: 36px; background: rgba(200,138,78,0.18); border: 0.5px solid rgba(200,138,78,0.3); }

/* ─── Ranking Rows ──────────────────────────────────────────────────────── */
.ranking-section { padding-bottom: 16px; }

.rank-row {
  display: flex; align-items: center; gap: 14px;
  padding: 13px 16px;
  animation: revealUp 0.35s cubic-bezier(0.16,1,0.3,1) both;
  transition: background 0.12s;
}
.rank-row.has-separator {
  border-bottom: 0.5px solid var(--separator);
}
.rank-row:active { background: rgba(255,255,255,0.04); }

.rank-position {
  font-size: 20px; flex-shrink: 0; width: 30px; text-align: center;
}
.rank-position-num {
  font-size: 14px; font-weight: 700; color: var(--text3);
}
.rank-info { flex: 1; min-width: 0; }
.rank-name {
  font-size: 15px; font-weight: 600; letter-spacing: -0.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.rank-sub {
  font-size: 12px; color: var(--text2); margin-top: 2px;
  font-weight: 500; letter-spacing: -0.01em;
}
.rank-pts {
  display: flex; flex-direction: column; align-items: flex-end; flex-shrink: 0;
}
.rank-pts-num {
  font-size: 20px; font-weight: 700; letter-spacing: -0.02em;
  color: var(--text1);
}
.rank-pts-label {
  font-size: 11px; color: var(--text3); font-weight: 500; letter-spacing: -0.01em;
  margin-top: -1px;
}

/* ─── Match Items ───────────────────────────────────────────────────────── */
.matches-section { padding-bottom: 16px; }

.match-item {
  padding: 12px 16px;
  animation: revealUp 0.35s cubic-bezier(0.16,1,0.3,1) both;
}
.match-item.has-separator {
  border-bottom: 0.5px solid var(--separator);
}

.match-header-row {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 10px;
}
.match-label {
  font-size: 11px; font-weight: 600;
  color: var(--text3); letter-spacing: 0.03em;
  text-transform: uppercase;
}
.live-pill {
  display: inline-flex; align-items: center; gap: 5px;
  background: rgba(255,69,58,0.15);
  color: #FF6961;
  font-size: 10px; font-weight: 700;
  letter-spacing: 0.04em; text-transform: uppercase;
  padding: 2px 8px; border-radius: 99px;
}
.live-dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: currentColor; flex-shrink: 0;
  animation: pulse 1.4s ease-in-out infinite;
}

.match-team-row {
  display: flex; align-items: center; gap: 12px;
  padding: 1px 0;
}
.match-inner-sep {
  height: 0.5px; background: var(--separator);
  margin: 8px 0;
}

.match-team-name {
  flex: 1;
  font-size: 15px; font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  color: var(--text1);
  transition: opacity 0.15s;
}
.match-score {
  font-size: 17px; font-weight: 700; letter-spacing: -0.02em;
  color: var(--text2); flex-shrink: 0; width: 24px; text-align: right;
}
.match-score-win { color: var(--orange); }
.match-score-dash { color: var(--text4); font-size: 14px; font-weight: 500; flex-shrink: 0; }

.match-team-row.is-loser .match-team-name { color: var(--text2); }
.match-team-row.is-loser .match-score { color: var(--text3); }
.match-team-row.is-winner .match-team-name { color: var(--text1); font-weight: 700; }

/* ─── Empty State ───────────────────────────────────────────────────────── */
.empty-state {
  padding: 48px 20px;
  text-align: center;
  color: var(--text3);
  font-size: 15px; font-weight: 500;
}

/* ─── Sticky CTA ────────────────────────────────────────────────────────── */
.cta {
  position: fixed; bottom: 0; left: 0; right: 0;
  padding: 12px 16px;
  padding-bottom: max(16px, env(safe-area-inset-bottom, 0px) + 8px);
  background: linear-gradient(to top, #000000 65%, transparent);
  z-index: 200;
}
.cta-link {
  display: flex; align-items: center; gap: 14px;
  background: var(--orange);
  border-radius: var(--radius);
  padding: 13px 18px;
  box-shadow: 0 4px 24px rgba(255,107,0,0.4);
  transition: transform 0.12s, opacity 0.12s;
}
.cta-link:active { transform: scale(0.97); opacity: 0.9; }
.cta-icon { font-size: 22px; }
.cta-text { flex: 1; }
.cta-title { display: block; font-size: 15px; font-weight: 700; color: #fff; letter-spacing: -0.01em; }
.cta-sub   { display: block; font-size: 12px; color: rgba(255,255,255,0.7); font-weight: 500; margin-top: 1px; }
.cta-arrow { font-size: 16px; color: rgba(255,255,255,0.7); font-weight: 700; }
.cta-dismiss {
  position: absolute; top: 14px; right: 22px;
  color: var(--text3); font-size: 20px; line-height: 1; padding: 4px;
}
