﻿/**
 * BirdieLogic - Screen Styles
 * Page-specific layouts and components
 */

/* ===== HEADER ===== */
.app-header {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  background: var(--chrome-bg);
  border-bottom: 1px solid var(--border-color);
  transition: var(--theme-transition);
  height: var(--header-height);
}

.header-content {
  max-width: var(--container-max);
  margin: 0 auto;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-md);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.header-logo {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
  text-decoration: none;
}

.header-logo a {
  color: inherit;
  text-decoration: none;
}

.header-logo img {
  width: 32px;
  height: 32px;
}

.header-help-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  flex-shrink: 0;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.header-help-btn:hover {
  color: var(--teal);
  border-color: var(--teal);
  background: rgba(18, 182, 166, 0.1);
}

.footer-theme-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.85rem;
  background: transparent;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.footer-theme-btn:hover {
  color: var(--teal);
  border-color: var(--teal);
  background: rgba(18, 182, 166, 0.1);
}

.header-nav {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-shrink: 0;
}

.header-nav .btn {
  white-space: nowrap;
  font-size: 0.85rem;
  padding: 0.4rem 0.75rem;
}

.header-user {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.header-user-name {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* User Dropdown */
.user-dropdown {
  position: relative;
}

.user-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + var(--space-xs));
  right: 0;
  min-width: 200px;
  background: var(--menu-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: var(--z-dropdown);
}

.user-dropdown-menu.active {
  display: block;
}

.user-dropdown-item {
  padding: var(--space-sm) var(--space-md);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.user-dropdown-item:hover {
  background: var(--bg-hover);
}

.user-dropdown-item:first-child {
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.user-dropdown-item:last-child {
  border-radius: 0 0 var(--radius-md) var(--radius-md);
}

.user-dropdown-divider {
  height: 1px;
  background: var(--border-color);
  margin: var(--space-xs) 0;
}

/* ===== FOOTER ===== */
.page-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--chrome-bg);
  border-top: 1px solid var(--border-color);
  transition: var(--theme-transition);
  padding: var(--space-sm) var(--space-md);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--space-lg);
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  z-index: var(--z-sticky);
}

/* ===== LANDING SCREEN ===== */
.landing-screen {
  display: none;
}

.landing-screen.active {
  display: block;
}

.landing-hero {
  background: linear-gradient(160deg, #1e4a5c 0%, #0f2a38 100%);
  padding: var(--space-xl) var(--space-lg) var(--space-2xl);
  position: relative;
  overflow: hidden;
  text-align: left;
}

.landing-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.04) 1px, transparent 1px);
  background-size: 36px 36px;
  pointer-events: none;
}

.landing-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: .07em;
  color: rgba(255,255,255,0.65);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 999px;
  padding: 4px 12px;
  margin-bottom: var(--space-md);
  position: relative;
  z-index: 1;
}

.landing-hero-dot {
  width: 6px;
  height: 6px;
  flex-shrink: 0;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 6px rgba(34,197,94,0.8);
}

.landing-title {
  font-size: clamp(1.9rem, 7vw, 2.8rem);
  font-weight: 900;
  line-height: 1.1;
  margin-bottom: var(--space-sm);
  color: #fff;
  -webkit-text-fill-color: #fff;
  background: none;
  background-clip: unset;
  -webkit-background-clip: unset;
  position: relative;
  z-index: 1;
}

.landing-title-accent {
  color: var(--teal);
  -webkit-text-fill-color: var(--teal);
}

[data-theme="light"] .landing-title {
  background: none;
  -webkit-text-fill-color: #fff;
  color: #fff;
}

.landing-stat-bar {
  display: flex;
  gap: var(--space-xl);
  position: relative;
  z-index: 1;
}

.landing-stat-value {
  display: block;
  font-size: 1.4rem;
  font-weight: 800;
  color: #fff;
  line-height: 1;
  margin-bottom: 2px;
}

.landing-stat-label {
  display: block;
  font-size: 0.72rem;
  color: rgba(255,255,255,0.5);
}

.landing-btn-primary {
  background: #fff;
  color: #0f2a38;
  font-weight: 700;
  border: none;
}
.landing-btn-primary:hover { background: rgba(255,255,255,0.9); color: #0f2a38; }

.landing-btn-outline {
  background: transparent;
  color: #fff;
  border: 1.5px solid rgba(255,255,255,0.4);
  font-weight: 600;
}
.landing-btn-outline:hover { background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.7); color: #fff; }

[data-theme="light"] .landing-host-cta a {
  color: var(--navy);
}

[data-theme="light"] .landing-host-cta a:hover {
  color: var(--navy-light);
}

[data-theme="light"] .stat-value {
  color: var(--navy);
}

[data-theme="light"] .match-number {
  color: var(--navy);
  font-weight: 700;
}

[data-theme="light"] .match-card--completed .match-team-name,
[data-theme="light"] .match-card--completed .match-team-score {
  color: var(--text-muted);
}
[data-theme="light"] .match-card--completed .match-list-result-summary {
  color: var(--navy);
  font-weight: 700;
}

.landing-subtitle {
  font-size: var(--font-size-md);
  color: rgba(255,255,255,0.65);
  margin-bottom: var(--space-lg);
  line-height: var(--line-height-relaxed);
  max-width: 420px;
  position: relative;
  z-index: 1;
}

.landing-actions {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin: 0 0 var(--space-lg);
  position: relative;
  z-index: 1;
}

.landing-features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-lg);
  padding: var(--space-2xl) var(--space-md);
  max-width: var(--container-max);
  margin: 0 auto;
}

.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  text-align: center;
  transition: all var(--transition-fast);
}

.feature-card:hover {
  border-color: var(--primary);
  transform: translateY(-4px);
}

.feature-icon {
  font-size: var(--font-size-4xl);
  margin-bottom: var(--space-md);
}

.feature-title {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
  margin-bottom: var(--space-sm);
}

.feature-desc {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  margin: 0;
}

.landing-footer {
  margin-top: auto;
  padding: var(--space-xl);
  text-align: center;
}

.landing-footer a {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  color: var(--text-muted);
}

.footer-logo {
  width: 24px;
  height: 24px;
}

/* ===== PUBLIC TOURNAMENT DIRECTORY ===== */
.pub-tournaments-section {
  padding: var(--space-md) var(--space-lg) var(--space-xl);
  max-width: 560px;
  margin: 0 auto;
}

.pub-tournaments-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  margin: 0 0 var(--space-sm);
}

.pub-tournaments-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pub-t-card {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-card);
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  border: 1px solid var(--border-color);
}

.pub-t-card__icon {
  font-size: 1.4rem;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-hover);
  border-radius: var(--radius-sm);
}

.pub-t-card__body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pub-t-card:hover,
.pub-t-card:focus {
  background: var(--bg-card-hover);
  border-color: var(--primary);
  outline: none;
}

.pub-t-card__name {
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.3;
}

.pub-t-card__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
}

.pub-t-card__meta {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.pub-t-card .badge {
  font-size: 0.65rem;
  padding: 2px 6px;
  flex-shrink: 0;
}

.pub-empty {
  text-align: center;
  padding: var(--space-lg) 0;
  font-size: 0.9rem;
}

.pub-tournaments-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-sm);
}

.pub-tournaments-header .pub-tournaments-title { margin: 0; }

.landing-host-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  margin-top: var(--space-md);
}

.landing-host-card__title {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-primary);
  margin-bottom: var(--space-xs);
}

.landing-host-card__desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-md);
  line-height: 1.55;
}

.landing-host-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.landing-reviews-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-sm);
}

.landing-player-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
  margin: 0;
  line-height: 1.5;
}

/* Pulsing dot for live tournaments */
@keyframes pub-live-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.badge-live-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  margin-right: 4px;
  animation: pub-live-pulse 1.4s ease-in-out infinite;
  vertical-align: middle;
  position: relative;
  top: -1px;
}

/* ===== SCREENS ===== */
.screen {
  display: none;
  min-height: calc(100vh - var(--header-height));
}

.screen.active {
  display: block;
}

/* ===== DASHBOARD ===== */
.dashboard-screen .container {
  padding: var(--space-lg) var(--space-md);
}

.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

.dashboard-title {
  font-size: var(--font-size-3xl);
  font-weight: var(--font-weight-bold);
}

.dashboard-actions {
  display: flex;
  gap: var(--space-sm);
}

.dashboard-actions .btn {
  white-space: nowrap;
}

.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-xs);
  margin-bottom: var(--space-lg);
}

@media (max-width: 380px) {
  .dashboard-stats {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-sm);
  }
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-sm) var(--space-xs);
  text-align: center;
}

.stat-value {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
  color: var(--primary);
}

.stat-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-top: 2px;
  line-height: 1.2;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--space-md);
}

/* ===== PROFILE PREFERENCES ===== */
.profile-pref-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: var(--space-md);
}
.profile-pref-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.profile-pref-label {
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
  font-size: var(--font-size-sm);
}
.profile-pref-desc {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
}
.theme-toggle-btn {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  flex-shrink: 0;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  padding: 6px 14px;
  font-size: var(--font-size-sm);
  transition: var(--theme-transition);
}
.theme-toggle-icon {
  font-size: 0.9rem;
  line-height: 1;
}

/* ===== MATCH LISTS ===== */
.match-list,
.tournament-list {
  display: grid;
  gap: var(--space-xs);
}

/* Quick match rows — aligned with CricLogic dashboard cards */
.tournament-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-sm) var(--space-md);
  display: block;
  max-width: 100%;
  min-width: 0;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
/* Dashboard tournament card structure */
.tournament-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-xs);
  margin-bottom: 4px;
}
.tournament-card__name {
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  margin: 0;
  line-height: 1.3;
  flex: 1;
  min-width: 0;
}
.tournament-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  align-items: center;
}
.tournament-card__code {
  font-family: monospace;
  font-size: 0.7rem;
  letter-spacing: .05em;
  opacity: .6;
}

.tournament-card--quick-match {
  flex-wrap: wrap;
  align-items: flex-start;
}

.tournament-card:hover {
  border-color: var(--border-focus);
  background: var(--bg-card-hover);
}

.tournament-info {
  flex: 1;
  min-width: 0;
}

.tournament-name {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
  margin-bottom: var(--space-xs);
}

.tournament-name--quick {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-sm);
  min-width: 0;
}

.tournament-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  align-items: center;
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  margin-top: var(--space-xs);
}

.tournament-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  align-items: center;
  justify-content: flex-end;
  flex-shrink: 0;
}

.sb-qm-abandon {
  color: var(--warning) !important;
}

@media (max-width: 640px) {
  .tournament-card--quick-match .tournament-card__actions {
    width: 100%;
    justify-content: flex-end;
    flex-wrap: wrap;
    margin-top: var(--space-xs);
  }

  .tournament-card--quick-match .tournament-card__actions .btn:not(.btn-ghost) {
    flex: 1 1 auto;
    min-width: min(100%, 12rem);
  }
}

/* Tournament winner banner */
.tournament-winner-banner {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 15%, var(--bg)) 0%, var(--bg-secondary) 100%);
  border: 1px solid color-mix(in srgb, var(--primary) 40%, transparent);
  border-radius: var(--radius-md);
  padding: var(--space-md) var(--space-lg);
  margin-bottom: var(--space-lg);
}
.tournament-winner-banner__trophy { font-size: 2.5rem; line-height: 1; flex-shrink: 0; }
.tournament-winner-banner__label {
  font-size: var(--font-size-xs);
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: var(--font-weight-semibold);
}
.tournament-winner-banner__name {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
  margin-top: 2px;
}

.matches-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.match-card {
  display: block;
  text-decoration: none;
  color: inherit;
  padding: var(--space-sm) var(--space-sm) var(--space-sm) calc(var(--space-sm) - 3px);
}

.match-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 6px;
  margin-bottom: 6px;
  gap: var(--space-xs);
}

.match-number-slot { flex-shrink: 0; }
.match-number {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.match-stage-col { flex: 1; min-width: 0; }
.match-stage {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: capitalize;
}
.match-status-slot {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.match-umpire {
  font-size: 0.7rem;
  color: var(--text-muted);
}
.matches-log-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0 2px;
  font-size: 0.8rem;
  opacity: 0.6;
}
.match-type {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
}

.match-teams {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.match-team-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.match-team-name {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-weight: var(--font-weight-medium);
  font-size: var(--font-size-sm);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.match-team-players {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: normal;
}

.team-color-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.match-team-score {
  font-family: var(--font-mono);
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
  flex-shrink: 0;
  margin-left: var(--space-xs);
}

.match-status {
  display: flex;
  justify-content: space-between;
  margin-top: var(--space-sm);
  padding-top: var(--space-sm);
  border-top: 1px solid var(--border-color);
  font-size: var(--font-size-sm);
}

/* Scorecard modal: compact per-game lines */
.scorecard-games {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: var(--space-sm);
}
.scorecard-game-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: var(--font-size-sm);
}
.scorecard-game-label {
  color: var(--text-muted);
  min-width: 4rem;
}
.scorecard-game-score {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-family: var(--font-mono);
  font-size: 1rem;
}
.scorecard-game-dash {
  color: var(--text-muted);
}

/* Match result summary line (completed matches) */
.match-list-result-summary {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  font-weight: 500;
}
.match-card--completed .match-team-name,
.match-card--completed .match-team-score {
  color: var(--text-muted);
}
.match-card--completed .match-list-result-summary {
  color: var(--text-primary);
  font-weight: 600;
}

/* Match action buttons row */
.match-actions {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: var(--space-xs);
  margin-top: var(--space-sm);
  padding-top: var(--space-sm);
  border-top: 1px solid var(--border-color);
}
.match-actions-reorder {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
}
.reorder-btn, .reorder-placeholder {
  width: 1.75rem;
  height: 1.75rem;
  flex-shrink: 0;
  padding: 0;
}
.reorder-placeholder {
  display: inline-block;
}
.match-actions-right {
  display: flex;
  flex-wrap: nowrap;
  gap: var(--space-xs);
  margin-left: auto;
}
.match-actions-right .btn {
  white-space: nowrap;
  padding-left: var(--space-sm);
  padding-right: var(--space-sm);
}
.match-actions-secondary {
  display: flex;
  gap: var(--space-xs);
}
.match-kebab-wrap {
  position: relative;
}
.match-kebab-btn {
  font-size: 1.1rem;
  letter-spacing: .05em;
  line-height: 1;
  padding-left: var(--space-sm);
  padding-right: var(--space-sm);
}
.match-kebab-menu {
  display: none;
  position: absolute;
  right: 0;
  bottom: calc(100% + 4px);
  flex-direction: column;
  min-width: 130px;
  background: var(--menu-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: var(--space-xs);
  box-shadow: 0 4px 16px rgba(0,0,0,0.35);
  z-index: 200;
}
[data-theme="light"] .match-kebab-menu {
  background: #ffffff;
}
.match-kebab-menu.open {
  display: flex;
}
.match-kebab-menu .btn {
  justify-content: flex-start;
  width: 100%;
  text-align: left;
}
.match-games-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  min-height: 1.4rem;
  padding-left: calc(8px + var(--space-xs));
}
.match-meta-inline,
.match-fixture-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.match-edit-icon {
  font-size: 0.8rem;
  padding: 0 2px;
  line-height: 1;
  opacity: 0.6;
}
.match-edit-icon:hover {
  opacity: 1;
}

/* Co-admin row in settings */
.co-admin-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-xs) 0;
  border-bottom: 1px solid var(--border-color);
}
.co-admin-row:last-child { border-bottom: none; }

/* Player pool table */
.reg-player-table td, .reg-player-table th { vertical-align: middle; }

/* ===== SCORING SCREEN ===== */
.scoring-screen {
  padding: 0;
}

.scoring-container {
  max-width: 600px;
  margin: 0 auto;
  padding: var(--space-xs) var(--space-md) var(--space-md);
}

.scoring-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  margin-bottom: var(--space-xs);
  margin-left: calc(-1 * var(--space-md));
  margin-right: calc(-1 * var(--space-md));
  padding: 0 var(--space-xs);
  gap: var(--space-xs);
}

.scoring-umpire-bar {
  text-align: center;
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  padding: var(--space-xs) 0;
  margin-bottom: var(--space-xs);
  border-bottom: 1px solid var(--border-color);
}

/* Back: bold arrow only, no box (CricLogic match-header-exit parity) */
.scoring-back-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  justify-self: start;
  min-width: 40px;
  min-height: 40px;
  padding: 0 !important;
  border: none !important;
  border-radius: 0;
  background: transparent !important;
  box-shadow: none !important;
  color: var(--text-primary);
  line-height: 1;
  transition: opacity 0.15s ease, color 0.15s ease;
  white-space: nowrap;
}

.scoring-back-btn:hover:not(:disabled) {
  background: transparent !important;
  color: var(--teal, #2dd4bf);
  opacity: 0.95;
}

.scoring-back-btn__glyph {
  font-size: 1.85rem;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.02em;
  -webkit-text-stroke: 0.35px currentColor;
}

.match-info {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  justify-content: center;
}

/* Offline bar + sync retry (parity with CricLogic scoring) */
.sb-offline-bar {
  background: #f0a500;
  color: #1c2a33;
  text-align: center;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 6px var(--space-md);
  position: sticky;
  top: 0;
  z-index: 600;
  letter-spacing: 0.01em;
}
.sb-sync-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #dc2626;
  border: none;
  cursor: pointer;
  padding: 0;
  margin-left: 2px;
  flex-shrink: 0;
  animation: sbSyncPulse 1.2s ease-in-out infinite;
}
.sb-sync-dot::after {
  content: '!';
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}
@keyframes sbSyncPulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.5; }
}

.scoring-header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  flex-shrink: 0;
  justify-content: flex-end;
}

.match-type-badge {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-bold);
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
[data-theme="light"] .match-type-badge {
  color: var(--navy);
}

/* Games Won */
.games-won {
  margin-bottom: var(--space-sm);
}

/* Compact live/spectator badges when in the scoring header action bar */
.scoring-header-actions .live-indicator {
  padding: 2px 8px;
  font-size: var(--font-size-xs);
}
.scoring-header-actions .spectator-indicator {
  padding: 2px 6px;
  font-size: var(--font-size-xs);
}

/* Score Display */
.score-display {
  padding: var(--space-md) 0;
}

.score-teams {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--space-lg);
}

.score-team {
  text-align: center;
  min-width: 100px;
}

.score-team .team-name {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  margin-bottom: var(--space-xs);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
}

.score-team .team-points {
  font-size: var(--font-size-5xl);
  font-weight: var(--font-weight-extrabold);
  font-family: var(--font-mono);
  line-height: 1;
}

.score-team.team-1 .team-points {
  color: var(--team-1);
}

.score-team.team-2 .team-points {
  color: var(--team-2);
}

.score-separator {
  font-size: var(--font-size-3xl);
  color: var(--text-muted);
}

/* Service Indicator */
.service-indicator {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--warning-subtle);
  border-radius: var(--radius-full);
  margin: var(--space-md) auto;
  width: fit-content;
  font-size: var(--font-size-sm);
  color: var(--warning);
}

.service-indicator .shuttlecock {
  font-size: var(--font-size-lg);
}

.service-indicator .court-side {
  text-transform: uppercase;
  font-weight: var(--font-weight-bold);
}

/* Score Buttons */
.score-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
  margin: var(--space-md) 0;
}

.btn-score-team {
  min-height: 120px;
  flex-direction: column;
  gap: var(--space-sm);
  font-size: var(--font-size-lg);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.btn-score-team .btn-label {
  font-size: var(--font-size-sm);
  opacity: 0.9;
}

.btn-score-team .btn-action {
  font-size: var(--font-size-3xl);
  font-weight: var(--font-weight-extrabold);
}

/* Action Buttons */
.action-buttons {
  display: flex;
  flex-direction: row;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
}
.action-buttons .btn-warning { flex: 2; }
.action-buttons .let-btn { flex: 1; }

/* Status Actions */
.status-actions {
  display: flex;
  justify-content: center;
  gap: var(--space-md);
  margin: var(--space-md) 0;
}

/* Rally History Section */
.rally-history-section {
  margin-top: var(--space-md);
}

.rally-history-section h4 {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  margin-bottom: var(--space-sm);
}

/* Court View Section */
.court-view-section {
  margin-top: var(--space-md);
}

.court-view-section h4 {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
}

.court-net {
  text-align: center;
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  padding: var(--space-xs) 0;
  border-top: 2px dashed var(--border-color);
  border-bottom: 2px dashed var(--border-color);
  margin: var(--space-xs) 0;
}

/* ===== PLAY LOG ===== */
.play-log-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 60vh;
  overflow-y: auto;
}

.play-log-game-header {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: var(--space-sm) var(--space-xs) var(--space-xs);
  margin-top: var(--space-sm);
  border-top: 1px solid var(--border-subtle);
}

.play-log-game-header:first-child {
  margin-top: 0;
  border-top: none;
}

.play-log-entry {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-sm);
}

.play-log-entry.play-log-team1 {
  border-left: 3px solid var(--team-1);
  background: rgba(59, 130, 246, 0.07);
}

.play-log-entry.play-log-team2 {
  border-left: 3px solid var(--team-2);
  background: rgba(244, 114, 182, 0.07);
}

.play-log-entry.play-log-let {
  border-left: 3px solid var(--border-color);
  color: var(--text-muted);
}

.play-log-entry.play-log-empty {
  color: var(--text-muted);
  font-style: italic;
  border-left: none;
  background: none;
}

.play-log-icon {
  flex-shrink: 0;
  font-size: var(--font-size-sm);
  width: 1.5em;
  text-align: center;
}

.play-log-text {
  flex: 1;
  color: var(--text-secondary);
}

.play-log-score {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 1px 6px;
}

.play-log-serve-indicator {
  font-size: 0.65em;
  opacity: 0.7;
}

.play-log-serve-indicator.team1 {
  color: var(--team-1);
}

.play-log-serve-indicator.team2 {
  color: var(--team-2);
}

/* Live audience counter in scoring header */
.scoring-audience-wrap {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  background: var(--bg-secondary);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  margin-left: var(--space-sm);
}

/* Spectator view count badge on completed match cards */
.match-viewer-badge {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  white-space: nowrap;
  margin-left: auto;
}

/* Spectator Mode */
.spectator-indicator {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  background: var(--bg-secondary);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  margin-left: var(--space-sm);
}

.share-code-badge {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--primary) 30%, transparent);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  margin-left: var(--space-sm);
  cursor: pointer;
  letter-spacing: 0.05em;
}

.spectator-badge {
  text-align: center;
  padding: var(--space-lg);
  color: var(--text-muted);
  font-size: var(--font-size-sm);
}

.spectator-badge span {
  background: var(--bg-secondary);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  border: 1px dashed var(--border-color);
}

/* ===== SCORING LAYOUT (Desktop: main + sidebar) ===== */
.scoring-layout {
  display: flex;
  gap: var(--space-lg);
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-md);
  min-height: 100%;
}

.scoring-main {
  flex: 1;
  min-width: 0;
}

/* Right Sidebar - Play Log */
.scoring-sidebar {
  width: 280px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 100px);
}

.scoring-sidebar .sidebar-title {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-sm);
  padding: 0 var(--space-xs);
}

.play-log-panel {
  flex: 1;
  overflow-y: auto;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: var(--space-sm);
}

/* Mobile Play Log Drawer Tab */
.playlog-drawer-tab {
  display: none;
  position: fixed;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 48px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-right: none;
  border-radius: var(--radius-md) 0 0 var(--radius-md);
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 100;
  box-shadow: -2px 0 8px rgba(0, 0, 0, 0.15);
  transition: background var(--transition-fast);
}

.playlog-drawer-tab:hover {
  background: var(--bg-secondary);
}

.playlog-drawer-tab.hidden {
  transform: translateX(100%) translateY(-50%);
  opacity: 0;
  pointer-events: none;
}

.playlog-drawer-tab .drawer-tab-icon {
  font-size: var(--font-size-lg);
}

/* Mobile Play Log Drawer */
.playlog-drawer {
  display: none;
  position: fixed;
  right: 0;
  top: 0;
  bottom: 0;
  width: 80%;
  max-width: 280px;
  background: var(--bg-secondary);
  z-index: 200;
  transform: translateX(100%);
  transition: transform 0.25s ease;
  flex-direction: column;
}

.playlog-drawer.open {
  transform: translateX(0);
  border-left: 1px solid var(--border-color);
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.3);
}

.playlog-drawer-close {
  position: absolute;
  left: var(--space-sm);
  top: var(--space-sm);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: var(--font-size-xl);
  color: var(--text-muted);
  transition: all var(--transition-fast);
}

.playlog-drawer-close:hover {
  background: var(--bg-card);
  color: var(--text-primary);
}

.playlog-drawer-header {
  padding: var(--space-md) var(--space-lg);
  padding-left: 52px;
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
}

.playlog-drawer-content {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-sm);
}

/* Responsive: Hide sidebar on mobile, show drawer */
@media (max-width: 900px) {
  .scoring-layout {
    flex-direction: column;
    padding: var(--space-sm);
  }
  
  .scoring-sidebar {
    display: none;
  }
  
  .playlog-drawer {
    display: flex;
  }
}

/* Result / Status Banner */
.celebration-banner {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--primary);
  color: var(--text-primary);
  text-align: center;
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-lg);
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-semibold);
}

/* ===== BADMINTON PLAYER PROFILE CARD ===== */
.profile-badminton-section h3 {
  margin-bottom: var(--space-sm);
}

.sb-player-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
}

.sb-player-card__header {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}

.sb-player-card__header > button {
  margin-left: auto;
}

.sb-player-card__photo {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.sb-player-card__initials {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--teal-subtle);
  color: var(--teal);
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sb-player-card__name {
  font-weight: var(--font-weight-semibold);
  margin: 0 0 2px;
}

.sb-player-card__id {
  font-size: var(--font-size-sm);
  margin: 0;
}

.sb-player-card__attrs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-xs) var(--space-md);
  margin-bottom: var(--space-md);
}

.sb-player-card__attr {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sb-player-card__attr-label {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.sb-player-card__attr-value {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
}

/* Claim search list */
.sb-claim-list {
  max-height: 320px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sb-claim-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
}

.sb-claim-row:hover {
  background: var(--bg-hover);
}

.sb-claim-row__name {
  flex: 1;
  font-weight: var(--font-weight-medium);
}

.sb-claim-row__id {
  font-size: var(--font-size-sm);
  font-family: var(--font-mono);
}

/* ===== TOURNAMENT SCREEN ===== */
.tournament-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  margin-bottom: var(--space-xs);
  margin-left: calc(-1 * var(--space-md));
  margin-right: calc(-1 * var(--space-md));
  padding: 0 var(--space-md);
  min-height: 44px;
}

.tournament-header > .btn:first-child {
  flex-shrink: 0;
  padding-left: var(--space-xs);
  padding-right: var(--space-sm);
  z-index: 1;
  font-weight: 700;
}

.tournament-header h1 {
  position: absolute;
  left: 0;
  right: 0;
  text-align: center;
  font-size: var(--font-size-lg);
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 90px;
  pointer-events: none;
}

.tournament-header .badge {
  flex-shrink: 0;
  z-index: 1;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .landing-title {
    font-size: var(--font-size-3xl);
  }

  .landing-subtitle {
    font-size: var(--font-size-md);
  }

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

  .dashboard-actions {
    width: 100%;
  }

  .dashboard-actions .btn {
    flex: 1;
    padding-left: var(--space-sm);
    padding-right: var(--space-sm);
    font-size: var(--font-size-sm);
  }

  .score-team .team-points {
    font-size: var(--font-size-4xl);
  }

  /* Compact horizontal score buttons on mobile */
  .btn-score-team {
    min-height: 56px;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-sm) var(--space-md);
    gap: var(--space-sm);
  }

  .btn-score-team .btn-label {
    font-size: var(--font-size-sm);
    text-align: left;
  }

  .btn-score-team .btn-action {
    font-size: var(--font-size-2xl);
    flex-shrink: 0;
  }
}

@media (max-width: 480px) {
  .header-user-name {
    display: none;
  }


  .landing-actions {
    max-width: 100%;
  }

  .action-buttons .btn {
    min-width: 0;
  }
}

@media (max-width: 640px) {
  /* Compact header saves 8px of vertical space on every phone */
  .app-header {
    height: 56px;
  }

  /* Stacked with scoring sub-header: keep the top bar slimmer on phones */
  body:has(#screen-scoring.active) .app-header {
    height: 48px;
  }
}

/* Scoring: two stacked bars (app + back row) — slim both; :has() = modern browsers */
@media (max-width: 768px) {
  body:has(#screen-scoring.active) .app-header {
    height: 48px;
  }

  body:has(#screen-scoring.active) .header-content {
    padding: 0 var(--space-sm);
  }

  body:has(#screen-scoring.active) .header-logo {
    font-size: var(--font-size-md);
  }

  body:has(#screen-scoring.active) .header-logo img {
    width: 28px;
    height: 28px;
  }

  body:has(#screen-scoring.active) .header-nav {
    gap: var(--space-sm);
  }

  body:has(#screen-scoring.active) .scoring-container {
    padding-top: 2px;
  }

  body:has(#screen-scoring.active) .scoring-header {
    margin-bottom: 2px;
  }

  body:has(#screen-scoring.active) .scoring-back-btn {
    min-width: 36px;
    min-height: 36px;
  }

  body:has(#screen-scoring.active) .scoring-back-btn__glyph {
    font-size: 1.3rem;
  }
}

/* ===== QUICK MATCH PLAYER SEARCH ===== */
.qm-step {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.qm-players-step {
  min-height: 400px;
}

.qm-team-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
}

.qm-team-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.qm-team-title {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
}

.qm-team-count {
  margin-left: auto;
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  background: var(--bg-tertiary);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
}

.qm-search-row {
  position: relative;
  display: flex;
  gap: var(--space-sm);
}

.qm-search-row .form-input {
  flex: 1;
}

.qm-search-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 44px;
  margin-top: 4px;
  background: var(--menu-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: var(--z-dropdown);
  max-height: 280px;
  overflow-y: auto;
}

.qm-search-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.qm-search-item:hover,
.qm-search-item--active {
  background: var(--bg-hover);
}

.qm-search-item-name {
  font-weight: var(--font-weight-medium);
}

.qm-search-item-id {
  font-size: var(--font-size-sm);
  font-family: var(--font-mono);
}

.qm-search-item--new {
  border-top: 1px solid var(--border-color);
  color: var(--teal);
}

.qm-search-item--new:first-child {
  border-top: none;
}

.qm-search-item-icon {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
}

.qm-players-grid {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  min-height: 200px;
  max-height: 300px;
  overflow-y: auto;
  padding: var(--space-sm) 0;
}

.qm-player-card {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  animation: qmSlideIn 0.2s ease;
}

@keyframes qmSlideIn {
  from {
    opacity: 0;
    transform: translateX(-8px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.qm-player-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--teal-subtle);
  color: var(--teal);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: var(--font-weight-bold);
  flex-shrink: 0;
}

.qm-player-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.qm-player-name {
  font-weight: var(--font-weight-medium);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.qm-player-id {
  font-size: var(--font-size-xs);
  font-family: var(--font-mono);
}

.qm-player-remove {
  font-size: var(--font-size-xl);
  color: var(--text-muted);
  padding: var(--space-xs);
  line-height: 1;
}

.qm-player-remove:hover {
  color: var(--danger);
}

/* Match Summary in First Server step */
.qm-summary {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  text-align: center;
  margin-bottom: var(--space-md);
}

.qm-summary h4 {
  margin: 0 0 var(--space-md);
  font-size: var(--font-size-sm);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.qm-summary-teams {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  flex-wrap: wrap;
}

.qm-summary-team {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-weight: var(--font-weight-semibold);
}

.qm-vs {
  color: var(--text-muted);
  font-size: var(--font-size-sm);
}

/* ===== COMPACT / SHORT-SCREEN SCORING ===== */
/* On small-height devices (phones in landscape or short phones),
   hide the Let button and tighten vertical gaps so court positions
   are visible without scrolling. */
@media (max-height: 680px) {
  .let-btn {
    display: none;
  }

  .scoring-header {
    margin-bottom: var(--space-sm);
  }


  .games-won {
    margin-bottom: var(--space-xs);
  }

  .score-display {
    padding: var(--space-sm) 0;
  }

  .service-indicator {
    margin: var(--space-xs) auto;
  }

  .score-buttons {
    gap: var(--space-xs);
    margin-bottom: var(--space-xs);
  }

  .btn-score-team {
    min-height: 72px;
  }

  .action-buttons {
    margin-top: var(--space-xs);
    gap: var(--space-xs);
  }

  .rally-history-section {
    margin-top: var(--space-xs);
  }

  .court-view-section {
    margin-top: var(--space-sm);
  }
}

/* ── Player Groups ────────────────────────────────────────────────────────── */

.groups-empty {
  padding: var(--space-xl);
  text-align: center;
  color: var(--text-muted);
}
.groups-empty-actions {
  display: flex;
  gap: var(--space-sm);
  justify-content: center;
  margin-top: var(--space-md);
}
.groups-header-actions {
  display: flex;
  gap: var(--space-sm);
  justify-content: flex-end;
  margin-bottom: var(--space-md);
}
.groups-cards {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}
.group-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.group-card:hover {
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
}
.group-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  margin-bottom: var(--space-xs);
}
.group-card-name {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text);
}
.group-badge {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 99px;
  letter-spacing: 0.05em;
}
.group-badge--admin { background: var(--primary-light, #e8f4ff); color: var(--primary); }
.group-badge--member { background: var(--surface-alt, #f5f5f5); color: var(--text-muted); }
.group-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
  color: var(--text-muted);
}
.group-code { font-size: 0.82rem; }

/* Group Home Screen */

.group-home-meta {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
  flex-wrap: wrap;
}
.group-code-display { font-size: 0.9rem; color: var(--text-muted); }
.group-sport-badge {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  background: var(--success-light, #e8f8f0);
  color: var(--success, #2e7d32);
  padding: 2px 10px;
  border-radius: 99px;
  letter-spacing: 0.04em;
}
.group-members-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-sm);
}
.group-members-list {
  list-style: none;
  padding: 0;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.group-member-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.group-member-row:last-child { border-bottom: none; }
.group-member-info {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  flex-wrap: wrap;
}
.group-member-badge {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  padding: 1px 6px;
  border-radius: 99px;
  letter-spacing: 0.04em;
}
.group-member-badge--host { background: #fff3e0; color: #e65100; }
.group-member-badge--admin { background: var(--primary-light, #e8f4ff); color: var(--primary); }
.group-member-badge--id { background: var(--success-light, #e8f8f0); color: var(--success, #2e7d32); }
.group-member-actions { display: flex; gap: var(--space-xs); flex-shrink: 0; }
.group-member-name-btn {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}
.group-member-name-btn:hover { color: var(--primary); text-decoration: underline; }
.group-home-actions { margin-top: var(--space-md); display: flex; gap: var(--space-sm); }

.btn-xs { font-size: 0.72rem; padding: 2px 8px; border-radius: var(--radius-sm); }

/* Player search */
.player-search-results { max-height: 240px; overflow-y: auto; }
.player-search-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  margin-bottom: 4px;
}
.player-search-row--added { opacity: 0.6; }
.player-search-row--highlight { outline: 2px solid var(--primary); outline-offset: -2px; }
.player-search-name { font-size: 0.88rem; font-weight: 500; color: var(--text-primary); }
.player-search-badge { font-size: 0.72rem; color: var(--success, #2e7d32); font-weight: 600; }
.form-error { color: var(--danger, #c62828); font-size: 0.85rem; margin-top: var(--space-xs); }
.form-error.hidden { display: none; }

/* Group home tabs */
.group-home-tabs { display: flex; gap: 0; border-bottom: 2px solid var(--border); margin-bottom: var(--space-md); }
.group-home-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  padding: var(--space-sm) var(--space-md);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.group-home-tab:hover { color: var(--text); }
.group-home-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.group-home-tab-panel { display: none; }
.group-home-tab-panel.active { display: block; }

/* Group match history */
.group-match-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: var(--space-sm); }
.group-match-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-sm) var(--space-md);
}
.group-match-header { display: flex; justify-content: space-between; align-items: center; gap: var(--space-sm); margin-bottom: 2px; }
.group-match-teams { font-weight: 600; font-size: 0.92rem; }
.group-match-status {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 99px;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}
.group-match-status--done { background: var(--success-light, #e8f8f0); color: var(--success, #2e7d32); }
.group-match-status--live { background: #fff3e0; color: #e65100; }
.group-match-result { font-size: 0.85rem; color: var(--text); margin: 2px 0; }
.group-match-meta { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; }

/* Leaderboard */
.lb-note { font-size: 0.78rem; color: var(--text-muted); margin-bottom: var(--space-md); font-style: italic; }
.lb-rank { color: var(--text-muted); font-size: 0.78rem; width: 28px; }
.lb-name { font-weight: 600; }
.lb-num { text-align: right; }
.lb-highlight { font-weight: 700; color: var(--primary); }
.lb-name-link { cursor: pointer; }
.lb-name-link:hover { text-decoration: underline; color: var(--primary); }
.lb-season-filter { display: flex; gap: 4px; margin-bottom: var(--space-sm); }
.lb-season-btn {
  background: var(--surface-alt, #f5f5f5);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 3px 14px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-muted);
  transition: background 0.12s, color 0.12s;
}
.lb-season-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* Group Settings button */
.group-settings-btn { margin-left: auto; color: var(--text-muted); font-size: 0.8rem; }

/* Member Profile Modal */
.member-profile-header { margin-bottom: var(--space-md); }
.member-profile-name { font-size: 1.1rem; font-weight: 700; }
.member-profile-id { font-size: 0.8rem; color: var(--text-muted); margin-top: 2px; }
.member-profile-id code { font-family: monospace; background: var(--surface-alt, #f5f5f5); padding: 1px 5px; border-radius: 3px; }
.mp-section-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin: 0 0 var(--space-xs);
}
.mp-stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(60px, 1fr)); gap: var(--space-xs); margin-bottom: var(--space-sm); }
.mp-stat { background: var(--surface-alt, #f9f9f9); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px 8px; text-align: center; }
.mp-stat-val { display: block; font-size: 1rem; font-weight: 700; line-height: 1.2; }
.mp-stat-label { display: block; font-size: 0.65rem; color: var(--text-muted); margin-top: 2px; }
.mp-match-list { list-style: none; padding: 0; margin: var(--space-xs) 0 0; }
.mp-match-row { display: flex; justify-content: space-between; align-items: center; padding: 4px 0; border-bottom: 1px solid var(--border); font-size: 0.82rem; }
.mp-match-row:last-child { border-bottom: none; }
.mp-match-teams { font-weight: 500; }
.mp-match-meta { color: var(--text-muted); }

/* Quick match group pool chips */
.qm-pool-section { margin-bottom: var(--space-sm); }
.qm-pool-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.qm-pool-label--search { margin-top: var(--space-sm); }
.qm-pool-chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* ── Squad header for tournament team editor / add-player modal ─────────── */
.qm-team-squad-header--tournament-editor {
  padding: 0 0 var(--space-xs);
  border-bottom: 1px solid var(--border-color);
}
.qm-team-squad-title {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--text-muted);
}

/* ── Player item rows (tournament editor & add-player modal) ────────────── */
.qm-player-item--tournament {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 6px var(--space-sm);
  border-radius: var(--radius-sm);
  background: var(--surface-2, var(--bg-card));
  border: 1px solid var(--border-color);
}
.qm-player-item__identity { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.qm-player-item__identity .player-name { font-weight: var(--font-weight-medium); font-size: var(--font-size-sm); }
.qm-player-item__identity .player-username { font-size: 0.75rem; color: var(--text-muted); font-family: var(--font-mono); }
.qm-player-item__actions { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.qm-player-item__remove {
  background: none; border: none; cursor: pointer; padding: 2px 6px;
  color: var(--text-muted); font-size: 1rem; line-height: 1; border-radius: var(--radius-sm);
}
.qm-player-item__remove:hover { color: var(--danger); background: var(--danger-subtle, rgba(239,68,68,.1)); }

/* ── Section header (label + action button row) ─────────────────────────── */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-md);
}
.section-header h2 { margin: 0; }

/* ── Players tab — sortable column headers ──────────────────────────────── */
.tournament-regplayers-sort-btn {
  font: inherit;
  font-weight: var(--font-weight-semibold);
  color: inherit;
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  text-align: left;
  width: 100%;
}

/* ── Players tab — table number column ─────────────────────────────────── */
.tournament-regplayers-td--num {
  text-align: right;
  color: var(--text-muted, var(--text-secondary));
  font-variant-numeric: tabular-nums;
  width: 1%;
  white-space: nowrap;
}

/* ── Players tab — narrow actions column ────────────────────────────────── */
.table-actions-col {
  width: 1%;
  white-space: nowrap;
}

/* ── Players tab — clickable player name button ─────────────────────────── */
.players-tab-name-btn {
  background: none;
  border: none;
  padding: 0;
  color: inherit;
  cursor: pointer;
  font: inherit;
  text-align: left;
}
.players-tab-name-btn:hover { text-decoration: underline; }

/* ── Table cell size variants ────────────────────────────────────────────── */
.table-cell-sm { font-size: 0.8rem; color: var(--text-muted); }
.table-cell-meta { font-size: 0.85rem; color: var(--text-muted); }

.tournament-regplayers-td--num {
  text-align: right;
  color: var(--text-muted, var(--text-secondary));
  font-variant-numeric: tabular-nums;
}

/* ── Players tab — registration link section ────────────────────────────── */
.tournament-players-section-title {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
  margin: 0 0 var(--space-xs);
}
.tournament-players-section-subtitle {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 0 0 var(--space-xs);
}
.tournament-reg-link-row {
  display: flex;
  gap: var(--space-sm);
  align-items: center;
  margin-bottom: var(--space-sm);
}
.tournament-reg-link-input {
  flex: 1;
  min-width: 0;
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  background: var(--surface-2, var(--bg-card));
}
.tournament-players-registered-title {
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  margin: var(--space-lg) 0 var(--space-xs);
}

/* ── Add-player search row ──────────────────────────────────────────────── */
.qm-add-player-row { display: flex; gap: var(--space-sm); align-items: center; }
.qm-add-player-row .form-input { flex: 1; }
.qm-pool-chip {
  background: var(--surface-alt, #f5f5f5);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 4px 12px;
  font-size: 0.82rem;
  cursor: pointer;
  transition: background 0.1s, border-color 0.1s;
  white-space: nowrap;
}
.qm-pool-chip--available:hover { background: var(--primary-light, #e8f4ff); border-color: var(--primary); }
.qm-pool-chip--in-squad {
  background: var(--success-light, #e8f8f0);
  border-color: var(--success, #2e7d32);
  color: var(--success, #2e7d32);
  font-weight: 600;
}
.qm-pool-chip--in-squad:hover { background: #d0eed8; }
.qm-pool-chip--other-team,
.qm-pool-chip--no-id { opacity: 0.45; cursor: not-allowed; }
.form-hint-inline { font-size: 0.75rem; color: var(--text-muted); font-weight: 400; }

/* ── Squad editor modal ─────────────────────────────────────────────────── */
.tournament-team-editor .qm-single-team-panel {
  padding: var(--space-sm);
  background: rgba(0, 0, 0, 0.16);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
}
.tournament-team-editor__footer {
  flex-shrink: 0;
  margin-top: var(--space-xs);
  padding-top: var(--space-xs);
  border-top: 1px solid var(--border-color);
}
.tournament-team-editor__meta-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--space-sm) var(--space-md);
  align-items: end;
}
@media (max-width: 420px) {
  .tournament-team-editor__meta-row {
    grid-template-columns: 1fr;
  }
}
.tournament-team-editor__short {
  margin-bottom: 0;
}
.tournament-team-editor__color {
  margin-bottom: 0;
}
.tournament-team-editor__color .form-label {
  margin-bottom: var(--space-xs);
}
.tournament-team-editor__color-input {
  display: block;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--border-color);
  border-radius: 50%;
  background: var(--bg-card);
  cursor: pointer;
  box-sizing: border-box;
}
.tournament-team-editor__color-input::-webkit-color-swatch-wrapper {
  padding: 3px;
}
.tournament-team-editor__color-input::-webkit-color-swatch {
  border: none;
  border-radius: 50%;
}
.tournament-team-editor__color-input::-moz-color-swatch {
  border: none;
  border-radius: 50%;
}
.tournament-team-editor__divider {
  border: 0;
  border-top: 1px solid var(--border-color);
  margin: var(--space-xs) 0 var(--space-sm);
  flex-shrink: 0;
}
.tournament-team-editor > .form-group,
.tournament-team-editor > .tournament-team-editor__meta-row,
.tournament-team-editor > .tournament-team-editor__divider {
  flex-shrink: 0;
}
.qm-players-grid {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}
.tournament-team-editor .qm-players-grid {
  max-height: none;
  overflow: visible;
  margin-bottom: 0;
  gap: 4px;
}
.qm-player-item.qm-player-item--tournament {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px 10px;
  padding: 5px 10px 5px 8px;
  border-left: 2px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--surface-2, var(--bg-card));
}
.qm-player-item--tournament.is-captain {
  border-left-color: var(--gold, #ffd700);
  background: rgba(255, 215, 0, 0.07);
}
.qm-player-item--tournament .qm-player-item__lead {
  display: inline-flex;
  align-items: center;
}
.qm-player-item--tournament .captain-badge {
  font-size: 0.72rem;
  opacity: 0.42;
  padding: 2px;
  cursor: pointer;
  user-select: none;
  transition: opacity 0.12s;
}
.qm-player-item--tournament .captain-badge:hover { opacity: 0.85; }
.qm-player-item--tournament .captain-badge.active { opacity: 1; }
.qm-pool-section { margin-bottom: var(--space-md); }
.qm-pool-label {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: var(--space-xs);
}
.qm-pool-label--search { margin-top: var(--space-sm); }
.qm-pool-chips { display: flex; flex-wrap: wrap; gap: var(--space-xs); }
.modal-body-footer-row { display: flex; gap: var(--space-sm); }
.modal-body-footer-row--end { justify-content: flex-end; }
details[open] .details-arrow { display: inline-block; transform: rotate(90deg); }

/* ── Shared table styles ────────────────────────────────────────────────── */
.admin-table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  margin-bottom: var(--space-md);
}
.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface-elevated);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.table th,
.table td {
  padding: var(--space-sm) var(--space-md);
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}
.table--compact th,
.table--compact td {
  padding: var(--space-xs) var(--space-sm);
  font-size: 0.82rem;
}
.table th {
  background: var(--surface);
  font-weight: var(--font-weight-semibold);
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
}
.table tr:last-child td {
  border-bottom: none;
}
.table tr:hover td {
  background: var(--surface);
}
.standings-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
  margin-top: 0.6rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  padding: 0 0.25rem;
}

/* ── Tournament Phase 2 styles ────────────────────────────────────────────── */

/* Standings */
.standings-gd--pos { color: var(--success, #2e7d32); font-weight: 600; }
.standings-gd--neg { color: var(--danger, #c62828); }
.standings-sn { color: var(--text-muted); font-size: 0.85em; }
@media (max-width: 600px) {
  .standings-sn { display: none; }
}

/* Teams */
.teams-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--space-md); }
.team-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-md);
}
.team-card-header {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  margin-bottom: var(--space-sm);
}
.team-name { font-weight: 600; flex: 1; }
.team-players { display: flex; flex-direction: column; gap: 4px; }
.player-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.88rem;
  padding: 2px 0;
}
.team-roster {
  border-top: 1px solid var(--border-subtle);
  padding-top: var(--space-xs);
  margin-bottom: var(--space-sm);
}
.team-roster-row {
  display: grid;
  grid-template-columns: 1.25rem 1fr;
  column-gap: var(--space-xs);
  padding: var(--space-xs) 0;
  border-bottom: 1px solid var(--border-subtle);
}
.team-roster-row:last-child { border-bottom: none; }
.team-roster-num {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: right;
  padding-top: 2px;
  line-height: 1.4;
}
.team-roster-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
}
.team-roster-name--link {
  background: none;
  border: none;
  padding: 0;
  color: var(--primary);
  text-decoration: underline;
  cursor: pointer;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  text-align: left;
  line-height: 1.4;
}
.team-roster-name--link:hover { opacity: 0.8; }
[data-theme="light"] .team-roster-name,
[data-theme="light"] .team-roster-name--link {
  color: #475569;
  text-decoration: none;
}
[data-theme="light"] .team-roster-name--captain {
  color: var(--navy);
}
.team-roster-name--captain {
  font-weight: 700;
}
.captain-mark {
  font-size: .7rem;
  color: var(--gold, #f59e0b);
}
[data-theme="light"] .captain-mark {
  color: var(--navy);
}
.roster-badge {
  font-weight: 600;
  color: var(--teal);
  font-size: 0.85em;
  margin-left: 3px;
}
.team-actions {
  border-top: 1px solid var(--border-subtle);
  padding-top: var(--space-sm);
  margin-top: var(--space-sm);
}
.btn-inline-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0 2px;
  border-radius: 3px;
}
.btn-inline-remove:hover { color: var(--danger, #c62828); }

/* Registration pool */
.reg-header { margin-bottom: var(--space-md); }
.reg-player-list { list-style: none; padding: 0; margin: 0; border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; }
.reg-player-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
}
.reg-player-row:last-child { border-bottom: none; }
.reg-player-name { font-weight: 500; }

/* Squad editor modal */
.squad-editor-cols { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-md); }
@media (max-width: 500px) { .squad-editor-cols { grid-template-columns: 1fr; } }
.squad-editor-col-title { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); margin-bottom: var(--space-xs); }
.squad-pool-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 0.88rem;
  border-bottom: 1px solid var(--border);
}
.squad-pool-row:last-child { border-bottom: none; }

/* Co-admin */
.coadmin-row { display: flex; align-items: center; justify-content: space-between; padding: 4px 0; border-bottom: 1px solid var(--border); font-size: 0.88rem; }
.coadmin-row:last-child { border-bottom: none; }
.coadmin-uid { font-family: monospace; font-size: 0.8rem; color: var(--text-muted); }

/* Settings sections */
.settings-section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: var(--space-md); margin-bottom: var(--space-md); }
.settings-section h3 { margin: 0 0 var(--space-md); font-size: 1rem; font-weight: 600; }
.mt-xl { margin-top: var(--space-xl); }

.change-server-list { display: flex; flex-direction: column; gap: var(--space-sm); }
.change-server-option { display: flex; align-items: center; gap: var(--space-sm); padding: var(--space-sm) var(--space-md); border: 1px solid var(--border-color); border-radius: var(--radius-md); cursor: pointer; }
.change-server-option:has(input:checked) { border-color: var(--primary); background: var(--primary-subtle, rgba(99,102,241,0.08)); }
.change-server-option input[type="radio"] { accent-color: var(--primary); }

/* ==========================================================================
   Team Formation Wizard
   ========================================================================== */

#modal-form-teams .modal { max-width: 860px; }

.wiz-method-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--space-md);
  margin-top: var(--space-xs);
}

.wiz-method-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-lg) var(--space-md);
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s, background 0.15s;
}
.wiz-method-card:hover,
.wiz-method-card:focus-visible { border-color: var(--primary); outline: none; }
.wiz-method-icon { font-size: 2rem; line-height: 1; }
.wiz-method-name { font-weight: 600; font-size: 1rem; color: var(--text-primary); }
.wiz-method-desc { font-size: 0.85rem; color: var(--text-muted); }

.wiz-nav { display: flex; align-items: center; gap: var(--space-sm); margin-bottom: var(--space-md); }
.wiz-step-label { font-weight: 600; color: var(--text-primary); }
.wiz-actions { display: flex; gap: var(--space-sm); flex-wrap: wrap; margin-top: var(--space-lg); }

.wiz-assign-row { display: flex; align-items: center; gap: var(--space-sm); padding: var(--space-sm) 0; border-bottom: 1px solid var(--border); }
.wiz-assign-name { flex: 1; font-size: 0.9rem; color: var(--text-primary); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wiz-assign-select { flex: 0 0 auto; width: 160px; font-size: 0.9rem; }

.wiz-captain-row { display: flex; align-items: center; gap: var(--space-sm); padding: var(--space-sm) 0; border-bottom: 1px solid var(--border); }
.wiz-captain-team { flex: 1; font-weight: 600; color: var(--text-primary); }
.wiz-captain-select { flex: 0 0 200px; font-size: 0.9rem; }

.wiz-draft-status { margin-bottom: var(--space-md); }
.wiz-draft-current { display: flex; align-items: center; gap: var(--space-sm); font-size: 1.05rem; font-weight: 600; background: linear-gradient(90deg, color-mix(in srgb, var(--primary) 22%, transparent) 0%, color-mix(in srgb, var(--primary) 6%, transparent) 100%); border: 1px solid color-mix(in srgb, var(--primary) 35%, transparent); border-left: 4px solid var(--primary); color: var(--text-primary); padding: var(--space-sm) var(--space-md); border-radius: var(--radius-md); }
.wiz-draft-arrow { color: var(--primary); font-size: 1.2rem; animation: wiz-blink .9s step-start infinite; }
@keyframes wiz-blink { 0%,100%{opacity:1} 50%{opacity:0} }
.wiz-draft-done { color: var(--success, #16a34a); font-size: 1rem; padding: var(--space-sm) 0; }

.wiz-draft-teams {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
  max-height: 260px;
  overflow-y: auto;
}

.wiz-draft-pool-label { font-size: 0.85rem; font-weight: 600; color: var(--text-muted); margin-bottom: var(--space-sm); }
.wiz-draft-roster-label { margin-top: var(--space-lg); padding-top: var(--space-md); border-top: 1px solid var(--border-subtle); }
.wiz-draft-pool { display: flex; flex-wrap: wrap; gap: var(--space-xs); margin-bottom: var(--space-md); max-height: 180px; overflow-y: auto; }

.wiz-draft-pick-btn {
  padding: var(--space-xs) var(--space-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text-primary);
  transition: background 0.1s, border-color 0.1s, color 0.1s;
}
.wiz-draft-pick-btn:hover { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ===== Tournament setup wizard ===== */
.modal--tournament-setup {
  max-width: 720px;
}

.modal-body--wizard {
  padding-top: var(--space-md);
}

.modal-footer--wizard {
  flex-wrap: wrap;
  gap: var(--space-md);
}

.modal-footer--wizard .setup-wizard-next {
  flex: 1;
  min-width: 12rem;
}

@media (max-width: 480px) {
  .modal-footer--wizard {
    gap: var(--space-sm);
  }

  .modal-footer--wizard .setup-wizard-next {
    order: -1;
    flex: 1 0 100%;
    min-width: unset;
  }

  .modal-footer--wizard .btn-ghost {
    flex: 1;
    font-size: 0.8rem;
    padding: var(--space-xs) var(--space-sm);
  }

  .modal-footer--wizard .btn-secondary {
    display: none;
  }
}

.setup-wizard-head {
  margin-bottom: var(--space-lg);
}

.setup-progress {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-sm);
}

.setup-progress__step {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  background: var(--bg-card);
  border: 2px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--text-muted);
}

.setup-progress__step--active {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--white);
}

.setup-progress__step--done {
  background: var(--success);
  border-color: var(--success);
  color: var(--white);
}

.setup-wizard-section-title {
  font-size: var(--font-size-lg);
  margin: 0 0 var(--space-lg);
  color: var(--text-primary);
}

.setup-wizard-subtitle {
  font-size: var(--font-size-md);
  margin: var(--space-lg) 0 var(--space-md);
  color: var(--text-secondary);
  font-weight: var(--font-weight-medium);
}

.stages-preview-wizard {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  background: var(--bg-input);
  border-radius: var(--radius-md);
  padding: var(--space-md);
}

.stage-item-wizard {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--primary);
}

.stage-item-wizard__num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-bold);
  flex-shrink: 0;
}

.stage-item-wizard__name {
  font-weight: var(--font-weight-semibold);
}

.stage-item-wizard__meta {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
}

.teams-list-wizard {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}

.team-entry-wizard {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.team-entry-wizard__color {
  position: relative;
  flex-shrink: 0;
}

.team-entry-wizard__swatch {
  width: 12px;
  height: 40px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.team-entry-wizard__color-input {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
  pointer-events: none;
}

.team-entry-wizard__inputs {
  flex: 1;
  min-width: 0;
}

.team-entry-wizard__remove {
  color: var(--danger);
  flex-shrink: 0;
}

.setup-step3-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

.setup-step3-title {
  margin-bottom: 0 !important;
}

.player-count-inline {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
}

.wizard-team-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-lg);
  overflow: hidden;
}

.wizard-team-card__header {
  padding: var(--space-sm) var(--space-md) 0;
}

.wizard-player-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-xs) 0;
  border-bottom: 1px solid var(--border-color);
}

.wizard-player-row:last-child {
  border-bottom: none;
}

.wizard-player-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wizard-player-remove {
  color: var(--danger);
  flex-shrink: 0;
}

.setup-wizard-summary {
  margin-top: var(--space-lg);
}

.setup-wizard-hint {
  margin-top: var(--space-md);
}

.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: var(--space-lg);
}

.teams-add-btn {
  margin-top: var(--space-sm);
}

/* ── Column header tooltips ─────────────────────────────────── */
[data-tip] {
  position: relative;
  cursor: help;
  text-decoration: underline dotted rgba(255,255,255,0.3);
  text-underline-offset: 3px;
}
[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--menu-surface);
  color: var(--text-primary);
  font-size: 0.72rem;
  font-weight: 500;
  white-space: nowrap;
  padding: 4px 8px;
  border-radius: 5px;
  border: 1px solid var(--border-color);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 10;
}
[data-tip]:hover::after { opacity: 1; }

/* ===== Scoring header dropdown ===== */
.scoring-header-undo { min-width: 44px; padding: var(--space-sm) var(--space-md); font-size: var(--font-size-lg); line-height: 1; }
.scoring-header-undo:disabled { opacity: 0.35; cursor: not-allowed; }
.scoring-more-dropdown { position: relative; flex-shrink: 0; }
.scoring-more-trigger { font-size: 1.35rem !important; line-height: 1; min-width: 44px; min-height: 44px; padding: var(--space-sm) !important; }
.scoring-more-panel { position: absolute; top: calc(100% + 4px); right: 0; min-width: min(280px, calc(100vw - 2rem)); z-index: 1000; background: var(--menu-surface); border: 1px solid var(--border-color); border-radius: var(--radius-md); box-shadow: 0 8px 24px rgba(0,0,0,0.35); padding: var(--space-xs); display: flex; flex-direction: column; gap: 2px; }
.scoring-more-panel[hidden] { display: none !important; }
.scoring-more-menu-item { display: block; width: 100%; text-align: left; padding: var(--space-sm) var(--space-md); min-height: 44px; font-size: var(--font-size-sm); color: var(--text-primary); background: transparent; border: none; border-radius: var(--radius-sm); cursor: pointer; }
.scoring-more-menu-item:hover, .scoring-more-menu-item:focus-visible { background: var(--bg-hover); outline: none; }
.scoring-more-menu-divider { height: 1px; background: var(--border-color); margin: var(--space-xs) 0; }

@media (max-width: 400px) {
  .scoring-audience-label { display: none; }
}

/* ===== Start Match modal — compact on mobile ===== */
@media (max-width: 600px) {
  .modal-body { padding: var(--space-md); }
  .modal-header { padding: var(--space-sm) var(--space-md); }
  .form-group { margin-bottom: var(--space-sm); }
}

/* ===== Player registration invite banner (landing screen) ===== */
.landing-join-banner {
  margin-top: var(--space-xl);
  max-width: 36rem;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
}

.landing-join-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  text-align: left;
}

.landing-join-card__eyebrow {
  font-size: var(--font-size-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--teal, #2dd4bf);
  font-weight: 600;
  margin: 0 0 var(--space-xs);
}

.landing-join-card__title {
  margin: 0 0 var(--space-sm);
  font-size: var(--font-size-xl);
}

.landing-join-card__loading {
  color: var(--text-muted);
  font-size: var(--font-size-sm);
  margin: 0 0 var(--space-md);
}

.landing-join-card__actions {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
  margin: var(--space-md) 0;
}

/* ===== Dashboard pending registration banner ===== */
.dashboard-pending-registration {
  margin: var(--space-md) 0;
}

.dashboard-pending-reg {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  flex-wrap: wrap;
  padding: var(--space-md);
  background: rgba(45, 212, 191, 0.12);
  border: 1px solid rgba(45, 212, 191, 0.35);
  border-radius: var(--radius-md);
}

.dashboard-pending-reg__text {
  flex: 1;
  min-width: 200px;
}

.dashboard-pending-reg__sub {
  display: block;
  font-size: var(--font-size-sm);
  margin-top: 2px;
}


/* ===== Formation Wizard ===== */
#modal-form-teams .modal { max-width: 860px; }

.wiz-method-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--space-md);
  margin: var(--space-lg) 0;
}

.wiz-method-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-lg) var(--space-md);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  text-align: center;
}
.wiz-method-card:hover {
  border-color: var(--teal, #2dd4bf);
  background: rgba(45, 212, 191, 0.06);
}
.wiz-method-icon { font-size: 2rem; }
.wiz-method-name { font-weight: 600; font-size: var(--font-size-sm); }
.wiz-method-desc { font-size: var(--font-size-xs); color: var(--text-muted); line-height: 1.4; }

.wiz-nav {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}
.wiz-step-label {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-left: auto;
}

.wiz-actions {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
  margin-top: var(--space-lg);
  justify-content: flex-end;
}

/* Manual assign */
.wiz-assign-row {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-xs) 0;
  border-bottom: 1px solid var(--border-color-subtle, rgba(255,255,255,0.06));
}
.wiz-assign-name { flex: 1; font-size: var(--font-size-sm); }
.wiz-assign-select { width: 180px; }

/* Captain select */
.wiz-captain-row {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-xs) 0;
  border-bottom: 1px solid var(--border-color-subtle, rgba(255,255,255,0.06));
}
.wiz-captain-team { flex: 1; font-size: var(--font-size-sm); font-weight: 500; }
.wiz-captain-select { width: 200px; }

/* Draft pick screen */
.wiz-draft-status { margin-bottom: var(--space-md); min-height: 2rem; }
.wiz-draft-current { font-size: var(--font-size-md); }
.wiz-draft-done { color: var(--teal, #2dd4bf); font-weight: 600; }
@keyframes wizBlink { 0%,100% { opacity:1; } 50% { opacity:0.3; } }
.wiz-draft-arrow { display: inline-block; color: var(--teal, #2dd4bf); animation: wizBlink 1s ease-in-out infinite; margin-right: 0.25rem; }

.wiz-draft-teams { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: var(--space-sm); margin-bottom: var(--space-md); max-height: 220px; overflow-y: auto; }
.draft-roster-row { display: flex; align-items: center; gap: var(--space-xs); }
.draft-roster-remove { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 1rem; padding: 0 2px; line-height: 1; }
.draft-roster-remove:hover { color: var(--danger, #f87171); }

.wiz-draft-pool-label, .wiz-draft-roster-label { font-size: var(--font-size-xs); text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); margin-bottom: var(--space-xs); }
.wiz-draft-pool { display: flex; flex-wrap: wrap; gap: var(--space-xs); max-height: 160px; overflow-y: auto; margin-bottom: var(--space-md); }
.wiz-draft-pick-btn {
  padding: var(--space-xs) var(--space-sm);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: var(--font-size-xs);
  transition: background 0.12s, border-color 0.12s;
}
.wiz-draft-pick-btn:hover { background: rgba(45, 212, 191, 0.15); border-color: var(--teal, #2dd4bf); }

.roster-badge { font-size: var(--font-size-xs); color: var(--teal, #2dd4bf); }

@media (max-width: 600px) {
  #screen-tournament .container {
    padding-left: var(--space-xs);
    padding-right: var(--space-xs);
  }
}
