/* SportGlance — Design System */
/* All colours and typography from LiveHUD_PRD.md */

/* ── Custom properties ────────────────────────────────────────────────────── */
:root {
  --bg:            #08080f;
  --card-bg:       rgba(255,255,255,0.04);
  --card-bg-hover: rgba(255,255,255,0.07);
  --border:        rgba(255,255,255,0.06);
  --border-active: rgba(255,255,255,0.12);
  --text:          #ffffff;
  --text-secondary:rgba(255,255,255,0.5);
  --text-muted:    rgba(255,255,255,0.25);
  --gold:          #fac775;
  --green:         #5dcaa5;
  --live-red:      #e24b4a;
  --blue:          #85b7eb;
  --amber:         #ef9f27;

  /* Ball colours */
  --ball-dot:  #1e1e2e;  --ball-dot-fg: #666;
  --ball-1-bg: #0d3328;  --ball-1-fg:   #5dcaa5;
  --ball-2-bg: #0a2540;  --ball-2-fg:   #85b7eb;
  --ball-3-bg: #332610;  --ball-3-fg:   #ef9f27;
  --ball-4-bg: #163308;  --ball-4-fg:   #97c459;
  --ball-6-bg: #331508;  --ball-6-fg:   #f0997b;
  --ball-w-bg: #330808;  --ball-w-fg:   #f09595;
  --ball-nb-bg:#2e2510;  --ball-nb-fg:  #ef9f27;
}

/* ── Reset ────────────────────────────────────────────────────────────────── */
*,*::before,*::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

#app {
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: none;
}

/* ── Screen wrapper ───────────────────────────────────────────────────────── */
.screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

/* ── Header ───────────────────────────────────────────────────────────────── */
.header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.header-back {
  background: none;
  border: none;
  color: var(--gold);
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  padding: 4px 12px 4px 0;
  display: flex;
  align-items: center;
  -webkit-tap-highlight-color: transparent;
}

.header-title   { font-size: 17px; font-weight: 600; }
.header-sub     { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }

/* ── Sport Selector ───────────────────────────────────────────────────────── */
.selector-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 28px 20px 20px;
}

.selector-heading h1 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text);
}

.selector-heading p {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 5px;
}

.sport-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 28px;
}

.sport-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 28px 16px 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.sport-card:not(.disabled):hover  { background: var(--card-bg-hover); border-color: var(--border-active); }
.sport-card:not(.disabled):active { transform: scale(0.96); }

.sport-card.disabled {
  opacity: 0.38;
  cursor: default;
  pointer-events: none;
}

.sport-card-icon { width: 60px; height: 60px; }
.sport-card-name { font-size: 15px; font-weight: 600; color: var(--text); }

/* ── Badges ───────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 11px;
  border-radius: 100px;
  letter-spacing: 0.3px;
}

.badge-live     { background: rgba(226,75,74,0.15); color: var(--live-red); }
.badge-dim      { background: rgba(255,255,255,0.06); color: var(--text-muted); }
.badge-upcoming { background: rgba(250,199,117,0.12); color: var(--gold); }

/* ── Live pulse dot ───────────────────────────────────────────────────────── */
.pulse-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse 1.4s ease-in-out infinite;
  flex-shrink: 0;
}

@keyframes pulse {
  0%,100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.45; transform: scale(0.75); }
}

/* ── Match cards (Session 3) ──────────────────────────────────────────────── */
.match-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}

.match-card:hover  { background: var(--card-bg-hover); border-color: var(--border-active); }
.match-card:active { transform: scale(0.98); }

/* ── Skeleton loader ──────────────────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg,
    var(--card-bg) 25%,
    rgba(255,255,255,0.07) 50%,
    var(--card-bg) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 8px;
}

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Spinner ──────────────────────────────────────────────────────────────── */
.spinner {
  width: 28px; height: 28px;
  border: 2.5px solid var(--border);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.center-fill {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
  color: var(--text-secondary);
  font-size: 13px;
}

/* ── Error box ────────────────────────────────────────────────────────────── */
.error-box {
  margin: 20px;
  background: rgba(226,75,74,0.08);
  border: 1px solid rgba(226,75,74,0.2);
  border-radius: 12px;
  padding: 16px;
  font-size: 13px;
  color: var(--live-red);
  text-align: center;
  line-height: 1.5;
}

/* ── HUD typography (Session 3) ───────────────────────────────────────────── */
.hud-score-runs  { font-size: 58px; font-weight: 700; line-height: 1; }
.hud-score-wkts  { font-size: 26px; font-weight: 400; color: var(--text-secondary); }
.hud-overs-crr   { font-size: 20px; font-weight: 600; color: var(--text-secondary); }
.hud-player-name { font-size: 13px; font-weight: 500; }
.hud-player-runs { font-size: 22px; font-weight: 700; }
.hud-player-balls{ font-size: 12px; font-weight: 400; color: var(--text-secondary); }
.hud-bowler-figs { font-size: 20px; font-weight: 700; }
.hud-ball-symbol { font-size: 12px; font-weight: 700; }
.hud-commentary  { font-size: 12px; font-weight: 400; color: var(--text-secondary); }

/* SR colour coding */
.sr-hot  { color: var(--green); }
.sr-ok   { color: var(--amber); }
.sr-slow { color: #f09595; }

/* ── Countdown bar (Session 3) ───────────────────────────────────────────── */
.countdown-bar {
  height: 2px;
  background: var(--border);
  border-radius: 1px;
  overflow: hidden;
}

.countdown-fill {
  height: 100%;
  background: var(--gold);
  transition: width 1s linear;
}

/* ── Glasses mode (Session 4) ────────────────────────────────────────────── */
@media (orientation: landscape) and (max-height: 420px) {
  .glasses-hidden { display: none !important; }
  .hud-score-runs { font-size: 48px; }
}
