/* Naija Penalty Shootout — Premium Matchday Glassmorphic Styling */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;600;700;800;900&display=swap');

:root {
  --primary: #008751;       /* Nigerian Green */
  --primary-glow: rgba(0, 135, 81, 0.4);
  --accent: #fcd116;        /* Gold */
  --bg-dark: #09130d;
  --glass-bg: rgba(10, 20, 15, 0.88);
  --glass-border: rgba(255, 255, 255, 0.12);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --font-main: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

html, body {
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  background-color: var(--bg-dark);
  font-family: var(--font-main);
  color: var(--text-main);
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}

#app {
  position: relative;
  width: 100%;
  height: 100%;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* --- Canvas Container --- */
#canvas-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

#game-canvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: crosshair;
}

/* --- Unified Sports Broadcast Bar (Top Pinned) --- */
.broadcast-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 44px;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px;
  background: rgba(8, 16, 12, 0.92);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  box-sizing: border-box;
}

/* Left Profile */
.bar-left {
  display: flex;
  align-items: center;
  flex: 0 1 auto;
  min-width: 0;
}

.startng-profile {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.startng-profile img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1.5px solid var(--accent);
  background: var(--primary);
  object-fit: cover;
  flex-shrink: 0;
}

.profile-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.player-name-txt {
  font-size: 11px;
  font-weight: 800;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 58px;
}

.signin-pill {
  border: 0;
  border-radius: 999px;
  padding: 1px 5px;
  background: var(--accent);
  color: #0f172a;
  font-size: 8px;
  font-weight: 800;
  cursor: pointer;
}

/* Center Ticker */
.bar-center {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1 1 auto;
  min-width: 0;
}

.ticker-match {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(15, 23, 42, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 3px 10px;
  border-radius: 999px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

.team-side {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 30px;
}

.team-abbr {
  font-size: 10.5px;
  font-weight: 900;
  color: #ffffff;
  letter-spacing: 0.5px;
  line-height: 1;
}

.kicks-row {
  display: flex;
  gap: 2.5px;
  align-items: center;
  height: 6px;
}

.pill-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.12);
  display: inline-block;
  box-sizing: border-box;
}

.pill-dot.goal {
  background: #22c55e;
  border-color: #22c55e;
  box-shadow: 0 0 5px rgba(34, 197, 94, 0.9);
}

.pill-dot.miss {
  background: #ef4444;
  border-color: #ef4444;
  box-shadow: 0 0 4px rgba(239, 68, 68, 0.8);
}

.score-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 3px;
  min-width: 36px;
}

.score-num {
  font-size: 14px;
  font-weight: 900;
  color: var(--accent);
  letter-spacing: 1px;
  line-height: 1;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.round-tag {
  font-size: 7.5px;
  font-weight: 800;
  color: #94a3b8;
  letter-spacing: 0.5px;
  line-height: 1;
  margin-top: 2px;
  white-space: nowrap;
  text-transform: uppercase;
}

.round-tag.sudden-death {
  color: #ef4444;
  font-weight: 900;
}

/* Right Actions */
.bar-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  flex: 0 1 auto;
}

.icon-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.08);
}

/* --- Bottom Hint (Minimalist & Non-Intrusive) --- */
.controls-hint {
  position: fixed;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 40;
  background: rgba(10, 20, 15, 0.80);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  padding: 4px 14px;
  font-size: 11px;
  font-weight: 700;
  color: #cbd5e1;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  pointer-events: none;
  white-space: nowrap;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  transition: opacity 0.3s ease;
}

@media (max-width: 340px) {
  .player-name-txt {
    display: none;
  }
  .ticker-match {
    gap: 6px;
    padding: 2px 7px;
  }
}

/* --- Modals --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: #0f172a;
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 24px;
  max-width: 520px;
  width: 100%;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: 88vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-size: 18px;
  font-weight: 800;
  color: #ffffff;
}

.close-btn {
  background: transparent;
  border: 0;
  font-size: 24px;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
}

.close-btn:hover {
  color: #ffffff;
}

/* Club Grid */
.club-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}

.club-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 12px;
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  cursor: pointer;
  transition: transform 0.15s, border-color 0.2s, background 0.2s;
}

.club-card:hover {
  transform: translateY(-2px);
  background: rgba(30, 41, 59, 0.9);
  border-color: var(--primary);
}

.club-card.active {
  border-color: var(--accent);
  background: rgba(0, 135, 81, 0.2);
  box-shadow: 0 0 12px rgba(252, 209, 22, 0.3);
}

.badge-wrap {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}

.club-badge-svg {
  width: 100%;
  height: 100%;
}

.club-info h4 {
  font-size: 13px;
  font-weight: 700;
  color: #ffffff;
}

.club-tag {
  display: inline-block;
  margin-top: 2px;
  font-size: 9px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 999px;
  text-transform: uppercase;
}

.club-tag.npfl {
  background: rgba(0, 135, 81, 0.3);
  color: #4ade80;
}

.club-tag.europe {
  background: rgba(56, 189, 248, 0.25);
  color: #38bdf8;
}

/* Match Over Card */
.gameover-box {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.gameover-box h2 {
  font-size: 24px;
  font-weight: 900;
  letter-spacing: 0.5px;
}

.gameover-box p {
  font-size: 13px;
  color: var(--text-muted);
}

.final-score-badge {
  font-size: 34px;
  font-weight: 900;
  color: var(--accent);
  padding: 4px 0;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  background: rgba(30, 41, 59, 0.4);
  padding: 10px;
  border-radius: 12px;
  border: 1px solid var(--glass-border);
}

.stat-item {
  display: flex;
  flex-direction: column;
}

.stat-val {
  font-size: 17px;
  font-weight: 800;
  color: #ffffff;
}

.stat-lbl {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
}

/* Leaderboard List */
.leaderboard-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
}

.leaderboard-section h4 {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.leaderboard-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-height: 130px;
  overflow-y: auto;
}

.leaderboard-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 8px;
  border-radius: 6px;
  background: rgba(30, 41, 59, 0.5);
  font-size: 12px;
}

.leaderboard-list li.my-row {
  background: rgba(0, 135, 81, 0.35);
  border: 1px solid var(--accent);
}

.leaderboard-list .rank-num {
  font-weight: 800;
  color: var(--accent);
  width: 24px;
}

.leaderboard-list .player-name {
  flex: 1;
  font-weight: 600;
  color: #ffffff;
}

.leaderboard-list .score-badge {
  font-size: 11px;
  font-weight: 700;
  color: #38bdf8;
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}

.btn-primary {
  flex: 1;
  padding: 11px 16px;
  border-radius: 10px;
  background: var(--primary);
  border: 0;
  color: #ffffff;
  font-family: var(--font-main);
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.btn-primary:hover {
  background: #00a86b;
  transform: translateY(-2px);
}

/* Mobile responsive adjustments */
@media (max-width: 480px) {
  .broadcast-bar {
    height: 46px;
    padding: 0 6px;
  }
  .startng-profile img {
    width: 28px;
    height: 28px;
  }
  .player-name-txt {
    font-size: 11px;
    max-width: 60px;
  }
  .ticker-match {
    padding: 2px 7px;
    gap: 4px;
  }
  .team-abbr {
    font-size: 10px;
  }
  .pill-dot {
    width: 7px;
    height: 7px;
  }
  .score-num {
    font-size: 13px;
  }
  .round-tag {
    font-size: 7.5px;
  }
  .icon-btn {
    width: 28px;
    height: 28px;
    font-size: 12px;
  }
  .controls-hint {
    font-size: 10px;
    padding: 2px 10px;
  }
  .club-grid {
    grid-template-columns: 1fr;
  }
}
