@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=Inter:wght@300;400;500;600&display=swap');

:root {
  --primary: #8D6E63;
  --primary-light: #A1887F;
  --bg: #BCAAA4;
  --accent: #D7CCC8;
  --dark: #3E2723;
  --card: #ffffff;
  --card-border: #d1d5db;
  --text: #2D3436;
  --text-muted: #636e72;
  --danger: #e17055;
  --success: #00b894;
  --live-red: #ff6b6b;
  --shadow-sm: 0 1px 3px rgba(45, 52, 54, 0.06);
  --shadow-md: 0 4px 12px rgba(45, 52, 54, 0.1);
  --shadow-lg: 0 8px 24px rgba(45, 52, 54, 0.14);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
}

::selection {
  background: var(--primary);
  color: white;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', sans-serif;
  font-weight: 400;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

h1, h2, h3, h4 {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
}

/* ============ Loading ============ */
.loading-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
  gap: 1rem;
}

.loading-pulse {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--primary);
  animation: pulse 1.2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(0.8); opacity: 0.5; }
  50% { transform: scale(1.2); opacity: 1; }
}

/* ============ App Shell ============ */
.app-shell {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 1rem 2rem;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 0;
  border-bottom: 2px solid var(--primary-light);
  margin-bottom: 1rem;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.logo-icon {
  font-size: 1.75rem;
}

.app-title {
  font-size: 1.5rem;
  color: var(--primary);
  letter-spacing: -0.5px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-badge {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

.role-toggle {
  padding: 0.4rem 0.85rem;
  border: 2px solid var(--primary-light);
  border-radius: 99px;
  background: var(--card);
  color: var(--primary);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.role-toggle:hover {
  background: var(--primary);
  color: white;
}

.role-toggle.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* ============ Tab Nav ============ */
.tab-nav {
  display: flex;
  gap: 0.25rem;
  background: var(--card);
  border-radius: var(--radius-md);
  padding: 0.25rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.25rem;
}

.tab-btn {
  flex: 1;
  padding: 0.6rem 1rem;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab-btn:hover {
  color: var(--primary);
  background: rgba(108, 92, 231, 0.06);
}

.tab-btn.active {
  background: var(--primary);
  color: white;
  box-shadow: var(--shadow-sm);
}

/* ============ Cards ============ */
.card {
  background: var(--card);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--card-border);
  animation: fadeInUp 0.35s ease both;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============ Inputs & Buttons ============ */
.input {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1.5px solid var(--card-border);
  border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  color: var(--text);
  background: var(--card);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.15);
}

.textarea {
  resize: vertical;
  min-height: 80px;
}

select.input {
  cursor: pointer;
}

.btn-primary {
  padding: 0.65rem 1.25rem;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-primary:hover {
  background: #5a4bd4;
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-live {
  background: var(--success);
  color: white;
}

.btn-live:hover {
  background: #00a884;
}

.btn-finish {
  background: var(--primary-light);
  color: white;
}

.btn-finish:hover {
  background: var(--primary);
}

.btn-danger {
  background: rgba(225, 112, 85, 0.1);
  color: var(--danger);
}

.btn-danger:hover {
  background: var(--danger);
  color: white;
}

.btn-period {
  background: var(--accent);
  color: var(--dark);
}

.btn-period:hover {
  background: #ffd93d;
}

.btn-score {
  width: 48px;
  height: 40px;
  border: 2px solid var(--primary-light);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--primary);
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-score:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.btn-score.minus {
  border-color: var(--danger);
  color: var(--danger);
}

.btn-score.minus:hover {
  background: var(--danger);
  color: white;
}

/* ============ Admin Panel ============ */
.admin-panel {
  margin-top: 0.5rem;
}

.admin-tabs {
  display: flex;
  gap: 0.25rem;
  background: var(--card);
  border-radius: var(--radius-md);
  padding: 0.25rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.25rem;
}

.admin-tab-btn {
  flex: 1;
  padding: 0.6rem 0.75rem;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.admin-tab-btn:hover {
  color: var(--primary);
}

.admin-tab-btn.active {
  background: var(--primary);
  color: white;
}

.admin-section h2 {
  font-size: 1.2rem;
  margin-bottom: 1rem;
  color: var(--dark);
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.admin-loading {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1rem 0;
}

/* ============ New Game Form ============ */
.new-game-form {
  margin-bottom: 1.25rem;
  border-left: 4px solid var(--primary);
}

.form-row {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 0.75rem;
}

.form-row:last-child {
  margin-bottom: 0;
}

.vs-badge {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  color: var(--primary);
  font-size: 0.85rem;
  flex-shrink: 0;
}

/* ============ Game Groups ============ */
.game-group {
  margin-bottom: 1.5rem;
}

.group-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.live-label {
  color: var(--live-red);
}

.upcoming-label {
  color: var(--primary);
}

.finished-label {
  color: var(--success);
}

.game-card {
  margin-bottom: 0.75rem;
}

.game-card-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.sport-emoji {
  font-size: 1.2rem;
}

.game-matchup {
  font-weight: 600;
  font-family: 'Space Grotesk', sans-serif;
  flex: 1;
}

.status-chip {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 0.2rem 0.6rem;
  border-radius: 99px;
  font-weight: 600;
}

.status-chip.live {
  background: rgba(255, 107, 107, 0.15);
  color: var(--live-red);
}

.status-chip.upcoming {
  background: rgba(108, 92, 231, 0.1);
  color: var(--primary);
}

.status-chip.finished {
  background: rgba(0, 184, 148, 0.1);
  color: var(--success);
}

.game-score-mini {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 0.5rem;
}

.game-card-actions {
  display: flex;
  gap: 0.5rem;
}

/* ============ Scoring Card ============ */
.scoring-card {
  margin-bottom: 1.25rem;
  border-top: 3px solid var(--primary);
}

.scoring-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.period-badge {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 0.9rem;
  background: var(--accent);
  color: var(--dark);
  padding: 0.3rem 0.85rem;
  border-radius: 99px;
}

.scoring-teams {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.scoring-team {
  flex: 1;
  text-align: center;
}

.scoring-team h3 {
  font-size: 1rem;
  margin-bottom: 0.5rem;
  color: var(--dark);
}

.score-display {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 3rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1;
  margin-bottom: 0.75rem;
}

.score-btns {
  display: flex;
  gap: 0.35rem;
  justify-content: center;
  flex-wrap: wrap;
}

.scoring-divider {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ============ Commentary Form ============ */
.commentary-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* ============ Scoreboard (public) ============ */
.scoreboard {
  padding: 0.5rem 0;
}

.scoreboard-section {
  margin-bottom: 1.5rem;
}

.section-label {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  padding: 0.5rem 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--live-red);
  margin-bottom: 0.75rem;
}

.section-label.upcoming {
  color: var(--primary);
}

.section-label.finished {
  color: var(--success);
}

.score-grid {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* Live Game Card */
.live-game-card {
  border-top: 3px solid var(--live-red);
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.live-game-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.live-game-card.flash {
  animation: scoreFlash 1.5s ease;
}

@keyframes scoreFlash {
  0% { box-shadow: 0 0 0 0 rgba(108, 92, 231, 0.5); }
  30% { box-shadow: 0 0 0 8px rgba(108, 92, 231, 0.2); }
  100% { box-shadow: var(--shadow-sm); }
}

.live-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--live-red);
  animation: livePulse 1.5s ease-in-out infinite;
}

@keyframes livePulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.live-text {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--live-red);
  letter-spacing: 1.5px;
}

.period-info {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-left: auto;
}

.matchup-display {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.team-block {
  flex: 1;
  text-align: center;
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  background: rgba(223, 230, 233, 0.4);
  transition: background 0.2s ease;
}

.team-block.winning {
  background: rgba(108, 92, 231, 0.08);
}

.team-block .team-name {
  display: block;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--dark);
  margin-bottom: 0.35rem;
}

.team-block .team-score {
  display: block;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 2.5rem;
  line-height: 1;
  color: var(--primary);
}

.team-block.winning .team-score {
  color: var(--primary);
}

.matchup-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  flex-shrink: 0;
}

.sport-icon-large {
  font-size: 1.5rem;
}

.vs-text {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 0.7rem;
  color: var(--text-muted);
  letter-spacing: 2px;
}

/* Upcoming & Finished */
.upcoming-game-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
}

.sport-icon-small {
  font-size: 1.25rem;
}

.upcoming-matchup {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.upcoming-matchup .team-name {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
}

.vs-mini {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.upcoming-status {
  font-size: 0.75rem;
  color: var(--primary-light);
  font-weight: 600;
}

.finished-game-card {
  padding: 1rem 1.25rem;
}

.finished-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.final-badge {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--success);
  background: rgba(0, 184, 148, 0.1);
  padding: 0.15rem 0.5rem;
  border-radius: 99px;
}

.finished-matchup {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.finished-team {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.35rem 0.5rem;
  border-radius: var(--radius-sm);
}

.finished-team.winner {
  background: rgba(108, 92, 231, 0.06);
}

.finished-team .team-name {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 0.9rem;
}

.finished-team.winner .team-name {
  color: var(--primary);
}

.finished-team .team-score {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--dark);
}

.finished-team.winner .team-score {
  color: var(--primary);
}

/* ============ Play-by-Play ============ */
.play-by-play {
  padding: 0.5rem 0;
}

.play-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.play-header h2 {
  font-size: 1.2rem;
}

.filter-select {
  width: auto;
  min-width: 180px;
  font-size: 0.85rem;
}

.play-feed {
  display: flex;
  flex-direction: column;
}

.play-item {
  display: flex;
  gap: 1rem;
  animation: fadeInUp 0.3s ease both;
}

.play-item:nth-child(1) { animation-delay: 0s; }
.play-item:nth-child(2) { animation-delay: 0.04s; }
.play-item:nth-child(3) { animation-delay: 0.08s; }
.play-item:nth-child(4) { animation-delay: 0.12s; }
.play-item:nth-child(5) { animation-delay: 0.16s; }
.play-item:nth-child(6) { animation-delay: 0.2s; }
.play-item:nth-child(7) { animation-delay: 0.24s; }
.play-item:nth-child(8) { animation-delay: 0.28s; }

.play-timeline {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
  padding-top: 0.25rem;
}

.timeline-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid var(--primary-light);
  flex-shrink: 0;
}

.timeline-line {
  width: 2px;
  flex: 1;
  background: var(--card-border);
  min-height: 24px;
}

.play-content {
  flex: 1;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid rgba(209, 213, 219, 0.4);
  margin-bottom: 0.25rem;
}

.play-item:last-child .play-content {
  border-bottom: none;
}

.play-game-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--primary-light);
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.play-text {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--dark);
  line-height: 1.4;
  margin-bottom: 0.35rem;
}

.play-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.play-score {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--primary);
  background: rgba(108, 92, 231, 0.08);
  padding: 0.1rem 0.5rem;
  border-radius: 99px;
}

.play-time {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ============ Empty States ============ */
.empty-state {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--text-muted);
}

.empty-state.large {
  padding: 4rem 1rem;
}

.empty-state h2 {
  color: var(--dark);
  margin-bottom: 0.5rem;
}

.empty-icon {
  font-size: 2.5rem;
  display: block;
  margin-bottom: 0.75rem;
}

.empty-state p {
  font-size: 0.9rem;
  max-width: 300px;
  margin: 0 auto;
}

/* ============ Skeleton ============ */
.skeleton-block, .skeleton-card, .skeleton-play {
  background: linear-gradient(90deg, #e0e0e0 25%, #f0f0f0 50%, #e0e0e0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-md);
}

.skeleton-block {
  height: 80px;
  margin-bottom: 0.75rem;
}

.skeleton-card {
  height: 140px;
  margin-bottom: 0.75rem;
}

.skeleton-play {
  height: 48px;
  margin-bottom: 0.5rem;
}

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

.scoreboard-loading, .play-loading {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1rem 0;
}

/* ============ Mobile ============ */
@media (max-width: 640px) {
  .app-header {
    flex-direction: column;
    gap: 0.75rem;
    text-align: center;
  }

  .header-right {
    width: 100%;
    justify-content: center;
  }

  .form-row {
    flex-direction: column;
  }

  .vs-badge {
    align-self: center;
  }

  .scoring-teams {
    flex-direction: column;
    gap: 0.75rem;
  }

  .scoring-divider {
    display: none;
  }

  .matchup-display {
    flex-direction: column;
    gap: 0.75rem;
  }

  .matchup-center {
    flex-direction: row;
    gap: 0.5rem;
  }

  .team-block .team-score {
    font-size: 2rem;
  }

  .score-display {
    font-size: 2.5rem;
  }

  .admin-tabs {
    flex-wrap: wrap;
  }

  .admin-tab-btn {
    font-size: 0.75rem;
    padding: 0.5rem;
  }

  .filter-select {
    width: 100%;
    min-width: unset;
  }

  .play-header {
    flex-direction: column;
    align-items: flex-start;
  }
}
```

<!-- WALKTHROUGH_SCRIPT:
[
  {"step": 1, "narration": "Welcome to League Live! This is a real-time sports scoreboard for your local league. You can view scores as a viewer or manage games as an admin.", "view": "viewer", "highlight_selector": ".app-header", "wait_for": "tap_to_continue"},
  {"step": 2, "narration": "Switch to Admin mode by tapping this toggle to manage games and update scores in real-time.", "view": "viewer", "highlight_selector": ".role-toggle", "wait_for": "user_interaction"},
  {"step": 3, "narration": "As an admin, create new games by tapping '+ New Game'. Enter the home and away teams, select a sport, then hit Create.", "view": "admin", "highlight_selector": ".btn-primary", "wait_for": "user_interaction"},
  {"step": 4, "narration": "Start a game by tapping the green Start button. This moves it to 'Live' status and sends a broadcast to all viewers.", "view": "admin", "highlight_selector": ".btn-live", "wait_for": "user_interaction"},
  {"step": 5, "narration": "Switch to Live Scoring to update scores in real-time. Tap +1, +2, or +3 to add points. Every score change is broadcast instantly to all viewers.", "view": "admin", "highlight_selector": ".admin-tab-btn", "wait_for": "user_interaction"},
  {"step": 6, "narration": "Add play-by-play commentary from the Commentary tab. These updates appear in the viewer's Play-by-Play feed.", "view": "admin", "highlight_selector": ".commentary-form", "wait_for": "user_interaction"},
  {"step": 7, "narration": "Switch back to Viewer mode to see the public scoreboard. Live games show with a pulsing red indicator and flash when scores update.", "view": "viewer", "highlight_selector": ".live-game-card", "wait_for": "tap_to_continue"},
  {"step": 8, "narration": "Check the Play-by-Play tab for a timeline of all game events, scoring updates, and commentary. Filter by game if multiple are running.", "view": "viewer", "highlight_selector": ".tab-btn", "wait_for": "tap_to_continue"}
]
-->

/* Presence / identity bar */
.viewer-presence-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.presence-identity {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.identity-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  background: rgba(108, 92, 231, 0.08);
  color: var(--primary);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.presence-count {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
}

.presence-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 0 rgba(0, 184, 148, 0.35);
  animation: presencePulse 1.6s ease-in-out infinite;
}

.presence-number {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  color: var(--dark);
}

.presence-text {
  white-space: nowrap;
}

@keyframes presencePulse {
  0%, 100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(0, 184, 148, 0.25); }
  50% { transform: scale(1.08); box-shadow: 0 0 0 7px rgba(0, 184, 148, 0); }
}

/* Presence / identity bar */
.viewer-presence-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.presence-identity {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.identity-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  background: rgba(108, 92, 231, 0.08);
  color: var(--primary);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.presence-count {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
}

.presence-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 0 rgba(0, 184, 148, 0.35);
  animation: presencePulse 1.6s ease-in-out infinite;
}

.presence-number {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  color: var(--dark);
}

.presence-text {
  white-space: nowrap;
}

@keyframes presencePulse {
  0%, 100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(0, 184, 148, 0.25); }
  50% { transform: scale(1.08); box-shadow: 0 0 0 7px rgba(0, 184, 148, 0); }
}

.play-header-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.identity-badge-public {
  background: rgba(108, 92, 231, 0.08);
}

.identity-role {
  font-weight: 700;
}

.identity-name {
  color: inherit;
  font-weight: 600;
}

.presence-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 0.7rem;
  border-radius: 999px;
  background: rgba(0, 184, 148, 0.08);
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
}

.presence-label {
  white-space: nowrap;
}

.reaction-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.7rem;
}

.reaction-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--card-border);
  border-radius: 999px;
  background: var(--card);
  color: var(--text);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.18s ease;
}

.reaction-btn:hover {
  border-color: var(--primary-light);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.reaction-btn.active {
  background: rgba(108, 92, 231, 0.1);
  border-color: var(--primary);
  color: var(--primary);
}

.reaction-emoji {
  font-size: 0.95rem;
}

.reaction-count {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 0.78rem;
  min-width: 0.9rem;
  text-align: center;
}

@media (max-width: 640px) {
  .play-header-title {
    width: 100%;
    justify-content: flex-start;
  }

  .presence-badge {
    width: 100%;
    justify-content: center;
  }

  .reaction-bar {
    gap: 0.35rem;
  }

  .reaction-btn {
    padding: 0.3rem 0.55rem;
    font-size: 0.8rem;
  }
}

.data-panel {
  margin-top: 16px;
}

.data-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.data-row,
.standings-header,
.standings-row {
  display: grid;
  gap: 12px;
  align-items: center;
}

.data-row {
  grid-template-columns: 1fr auto;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
}

.data-row-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.data-row-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  text-align: right;
  font-size: 0.9rem;
}

.muted-text {
  opacity: 0.75;
}

.standings-table {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.standings-header,
.standings-row {
  grid-template-columns: 2fr repeat(7, minmax(0, 1fr));
}

.standings-header {
  font-weight: 700;
  opacity: 0.8;
  padding: 0 8px;
}

.standings-row {
  padding: 12px 8px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
}

.standings-team {
  font-weight: 700;
}

.standings-points {
  font-weight: 800;
}

.charts-panel {
  margin-top: 16px;
}

.charts-header {
  margin-bottom: 1rem;
}

.charts-subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.charts-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.chart-card {
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.5);
}

.chart-card h3 {
  font-size: 1rem;
  margin-bottom: 12px;
}

.chart-empty {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.chart-vertical {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  min-height: 220px;
  padding-top: 8px;
  overflow-x: auto;
}

.chart-bar-group {
  min-width: 72px;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.chart-bar-track {
  width: 100%;
  height: 150px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  border-radius: 14px;
  background: rgba(223, 230, 233, 0.55);
  overflow: hidden;
}

.chart-bar-fill {
  width: 100%;
  border-radius: 14px 14px 0 0;
  background: linear-gradient(180deg, var(--primary-light), var(--primary));
  transition: height 0.25s ease;
}

.chart-bar-primary {
  background: linear-gradient(180deg, var(--accent), var(--primary));
}

.chart-bar-value {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--dark);
}

.chart-bar-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-align: center;
}

.chart-record-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.chart-record-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chart-record-topline,
.chart-record-legend {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.chart-record-team {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
}

.chart-record-meta {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.chart-record-bar {
  display: flex;
  width: 100%;
  height: 16px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(223, 230, 233, 0.75);
}

.chart-record-win {
  background: linear-gradient(90deg, var(--success), #44c4a1);
}

.chart-record-loss {
  background: linear-gradient(90deg, var(--danger), #ff9f86);
}

.chart-legend-win,
.chart-legend-loss {
  font-size: 0.78rem;
  color: var(--text-muted);
}

@media (max-width: 640px) {
  .charts-grid {
    grid-template-columns: 1fr;
  }

  .chart-vertical {
    min-height: 200px;
  }

  .chart-bar-group {
    min-width: 64px;
  }
}

.presence-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
}

.share-scoreboard-btn {
  padding: 0.45rem 0.8rem;
  border: 1px solid var(--primary-light);
  border-radius: 999px;
  background: var(--card);
  color: var(--primary);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.18s ease;
}

.share-scoreboard-btn:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.share-status {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
}

@media (max-width: 640px) {
  .viewer-presence-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .presence-actions {
    margin-left: 0;
    justify-content: space-between;
    width: 100%;
  }

  .share-scoreboard-btn {
    width: 100%;
    justify-content: center;
  }
}
