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

:root {
  /* ── Stadium dark theme ── */
  /* Backgrounds */
  --bg:          #05080f;
  --bg-base:     #0a0e17;
  --surface:     #131a26;
  --surface-2:   #1a2230;
  --surface-hi:  #232c3d;

  /* Borders */
  --border:        #2a3445;
  --border-strong: #3a4459;

  /* Text */
  --text:       #e6edf3;
  --text-muted: #8b95a7;
  --text-faint: #5b6478;

  /* Pitch-green accent */
  --accent:      #00d977;
  --accent-dim:  #06b264;
  --accent-soft: rgba(0, 217, 119, 0.14);
  --accent-glow: 0 0 0 3px rgba(0, 217, 119, 0.22);

  /* Electric yellow highlight */
  --highlight:      #ffd60a;
  --highlight-soft: rgba(255, 214, 10, 0.14);

  /* Status */
  --error: #ff5a4f;
  --warn:  #ffb84d;

  /* Legacy aliases — kept so existing rules pick up the new theme */
  --green-dark:  #0a3b1f;
  --green-mid:   #00d977;
  --green-light: #4ade80;
  --green-pale:  rgba(0, 217, 119, 0.14);
  --white:       #131a26;
  --gray-100:    #0a0e17;
  --gray-200:    #2a3445;
  --gray-300:    #3a4459;
  --gray-600:    #8b95a7;
  --gray-800:    #e6edf3;

  --radius:       10px;
  --shadow:       0 4px 18px rgba(0, 0, 0, 0.5);
  --shadow-lift:  0 10px 28px rgba(0, 0, 0, 0.55);
}

html { color-scheme: dark; }

/* Generic hide utility — overrides any element-specific display value */
.hidden { display: none !important; }

/* ── Current-league bar (under header) ── */
.current-league-bar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0.55rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  max-width: 1000px;
  margin: 0 auto;
  width: 100%;
  flex-wrap: wrap;
}
.league-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 1;
  min-width: 0;
}
.header-stats {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-left: auto;
  flex-shrink: 0;
}
.current-league-label {
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 700;
  font-size: 0.68rem;
}
.current-league-badge {
  color: var(--accent);
  font-weight: 700;
  padding: 0.15rem 0.55rem;
  background: var(--accent-soft);
  border-radius: 999px;
  border: 1px solid rgba(0, 217, 119, 0.3);
}

.header-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.player-rank-pill {
  display: inline-flex;
  align-items: center;
  margin-left: 0.6rem;
  padding: 0.15rem 0.55rem;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid rgba(0, 217, 119, 0.3);
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.countdown-pill[data-kind="pending"] {
  background: var(--highlight-soft);
  color: var(--highlight);
  border: 1px solid rgba(255, 214, 10, 0.3);
}
.countdown-pill[data-kind="live"] {
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid rgba(0, 217, 119, 0.35);
  animation: livePulse 2s ease-in-out infinite;
}
.countdown-pill[data-kind="unlocked"] {
  background: rgba(255, 90, 79, 0.12);
  color: var(--error);
  border: 1px solid rgba(255, 90, 79, 0.3);
}
@keyframes livePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(0, 217, 119, 0.4); }
  50%      { box-shadow: 0 0 0 4px rgba(0, 217, 119, 0); }
}

@media (max-width: 500px) {
  .header-stats { width: 100%; justify-content: flex-end; margin-left: 0; }
  .header-pill { font-size: 0.62rem; padding: 0.18rem 0.5rem; }
}

/* ── Leagues view ── */
.leagues-hero {
  text-align: center;
  margin-bottom: 1.5rem;
}
.leagues-hero h2 {
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text);
  margin-bottom: 0.5rem;
}
.leagues-hero p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.leagues-section { margin-bottom: 2rem; }
.leagues-section > h3 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  font-weight: 800;
}

.leagues-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.85rem;
}

.league-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.1rem;
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.18s;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}
.league-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}
.league-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}
.league-card h4 {
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.league-lock {
  display: inline-flex;
  align-items: center;
  color: var(--text-muted);
}
.league-lock svg { width: 14px; height: 14px; display: block; }
.league-badge {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  white-space: nowrap;
}
.league-badge-public  { background: var(--accent-soft); color: var(--accent); }
.league-badge-private { background: var(--highlight-soft); color: var(--highlight); }
.league-card-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}
.league-owner-note { color: var(--highlight); font-weight: 600; }
.league-card-actions {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.league-card-actions .btn { padding: 0.45rem 0.75rem; font-size: 0.85rem; }
.league-card-passform {
  display: flex;
  gap: 0.35rem;
  align-items: stretch;
}
.league-card-passform.hidden { display: none; }
.league-card-passinput {
  flex: 1;
  min-width: 0;
  padding: 0.4rem 0.6rem;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.85rem;
}
.league-card-passinput:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface-hi);
  box-shadow: var(--accent-glow);
}
.league-card-passform .btn { padding: 0.4rem 0.7rem; font-size: 0.82rem; flex: 0 0 auto; }
.league-card-passform .btn-secondary { padding: 0.4rem 0.55rem; }
.league-card-error {
  font-size: 0.78rem;
  min-height: 0.9em;
}
.league-card-error:empty { display: none; }

.leagues-forms {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}
.leagues-form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.leagues-form-card h3 {
  font-size: 1rem;
  color: var(--accent);
  margin: 0;
  font-weight: 700;
}
.form-row { display: flex; flex-direction: column; gap: 0.4rem; }
.form-row input[type="text"],
.form-row input[type="password"] {
  padding: 0.6rem 0.8rem;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.92rem;
}
.form-row input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface-hi);
  box-shadow: var(--accent-glow);
}
.visibility-row {
  flex-direction: column;
  gap: 0.5rem;
}
.visibility-option {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  padding: 0.55rem 0.7rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text-muted);
  transition: border-color 0.15s, background 0.15s;
}
.visibility-option:hover { border-color: var(--border-strong); }
.visibility-option input { margin-top: 0.18rem; accent-color: var(--accent); }
.visibility-option strong { color: var(--text); font-weight: 700; }
.form-status {
  font-size: 0.82rem;
  min-height: 1.1em;
  color: var(--text-muted);
}
.form-status.status-ok    { color: var(--accent); }
.form-status.status-error { color: var(--error); }

/* ── League owner tools (leaderboard) ── */
.league-owner-tools {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-bottom: 1rem;
}
.owner-tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  justify-content: space-between;
}
.owner-tool-text { min-width: 0; flex: 1; }
.owner-tool-title {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.15rem;
}
.owner-tool-hint {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.35;
}
.export-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
  padding: 0.5rem 0.85rem;
  font-size: 0.85rem;
}
.export-btn svg { width: 16px; height: 16px; }
.lock-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.3px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.08s;
  flex-shrink: 0;
}
.lock-toggle-btn:hover { background: var(--surface-hi); }
.lock-toggle-btn:active { transform: scale(0.97); }
.lock-toggle-btn.is-unlocked {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: rgba(0, 217, 119, 0.35);
}
.lock-toggle-icon { font-size: 1rem; line-height: 1; }
.lock-toggle-btn:disabled { opacity: 0.5; cursor: not-allowed; }

@media (max-width: 600px) {
  .owner-tool-card { flex-direction: column; align-items: stretch; gap: 0.6rem; }
  .lock-toggle-btn { align-self: flex-end; }
}

/* ── Remove player button (leaderboard owner action) ── */
.btn-remove-player {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-faint);
  padding: 0.3rem;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, background 0.15s, border-color 0.15s, transform 0.08s;
}
.btn-remove-player svg { width: 16px; height: 16px; display: block; }
.btn-remove-player:hover {
  color: var(--error);
  background: rgba(255, 90, 79, 0.1);
  border-color: rgba(255, 90, 79, 0.3);
}
.btn-remove-player:active { transform: scale(0.94); }

@media (max-width: 600px) {
  .current-league-bar { padding: 0.45rem 0.8rem; font-size: 0.72rem; }
  .leagues-hero h2 { font-size: 1.4rem; }
  .leagues-grid { grid-template-columns: 1fr; }
  .leagues-forms { grid-template-columns: 1fr; }
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', sans-serif;
  background:
    radial-gradient(900px 500px at 90% -10%, rgba(0, 217, 119, 0.04), transparent 60%),
    radial-gradient(700px 400px at 0% 100%, rgba(255, 214, 10, 0.03), transparent 60%),
    var(--bg-base);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Header banner ── */
.app-header {
  background:
    radial-gradient(1200px 260px at 18% -60%, rgba(0, 217, 119, 0.12), transparent 65%),
    radial-gradient(800px 240px at 100% 120%, rgba(255, 214, 10, 0.06), transparent 65%),
    linear-gradient(135deg, #050810 0%, #0c121d 50%, #131e2e 100%);
  color: var(--text);
  padding: 0 1.25rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  border-bottom: 2px solid var(--accent);
}

.header-content {
  max-width: 1000px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 0.6rem 0;
  min-height: 0;
}
.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-width: 0;
}
.header-utilities {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
}
.brand-ball {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.25));
  animation: ballSpin 12s linear infinite;
}
@keyframes ballSpin {
  from { transform: rotate(-8deg); }
  50%  { transform: rotate(8deg); }
  to   { transform: rotate(-8deg); }
}
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-title {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.4px;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brand-tagline {
  font-size: 0.72rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: rgba(255,255,255,0.65);
  margin-top: 2px;
}
.brand-hosts {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 0.5rem;
  padding-left: 0.75rem;
  border-left: 1px solid rgba(255,255,255,0.18);
}
.host-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.15);
}

.main-nav {
  display: flex;
  gap: 0.25rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  width: 100%;
}
.main-nav::-webkit-scrollbar { display: none; }
.main-nav .nav-btn { flex-shrink: 0; white-space: nowrap; }

.nav-btn {
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.65);
  padding: 0.45rem 1rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.15s;
}
.nav-btn:hover { background: rgba(255,255,255,0.08); color: var(--text); }
.nav-btn.active {
  background: var(--accent-soft);
  color: var(--accent);
  box-shadow: inset 0 -2px 0 var(--accent);
  border-radius: var(--radius) var(--radius) 0 0;
}

/* ── Layout ── */
.app-main { max-width: 900px; margin: 0 auto; padding: 1.5rem 1rem 5rem; }
.view.hidden { display: none; }

/* ── Player bar ── */
.player-bar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.player-input-group { display: flex; gap: 0.5rem; flex: 1; min-width: 200px; }

.player-input-group input {
  flex: 1;
  padding: 0.55rem 0.75rem;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s, background 0.2s;
}
.player-input-group input:focus { border-color: var(--accent); background: var(--surface-hi); }

.player-status { color: var(--accent); font-size: 0.9rem; }
.player-status.hidden { display: none; }

/* ── Buttons ── */
.btn {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 600;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary {
  background: var(--accent);
  color: var(--bg);
  box-shadow: 0 2px 10px rgba(0, 217, 119, 0.25);
}
.btn-primary:hover:not(:disabled) {
  background: var(--accent-dim);
  box-shadow: 0 4px 16px rgba(0, 217, 119, 0.35);
}
.btn-success {
  background: var(--accent);
  color: var(--bg);
}
.btn-success:hover:not(:disabled) { background: var(--accent-dim); }

/* ── Group sections ── */
.matches-container { display: flex; flex-direction: column; gap: 1rem; }

.group-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.group-header {
  background: var(--green-dark);
  color: white;
  padding: 0.65rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.group-header h2 { font-size: 0.95rem; font-weight: 700; }
.group-teams { font-size: 0.75rem; color: rgba(255,255,255,0.65); }

/* ── Settings panel ── */
.settings-panel {
  background: var(--green-dark);
  border-bottom: 1px solid rgba(255,255,255,0.1);
  padding: 0.85rem 1rem;
}
.settings-panel.hidden { display: none; }

.settings-inner {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  align-items: flex-start;
  gap: 2rem;
  flex-wrap: wrap;
}

.settings-left { display: flex; flex-direction: column; gap: 0.4rem; flex: 1; min-width: 260px; }
.settings-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
  padding-top: 1.5rem;
}

.settings-label { font-size: 0.78rem; color: rgba(255,255,255,0.65); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }

.api-key-row { display: flex; gap: 0.4rem; align-items: center; }

.api-key-row input {
  flex: 1;
  padding: 0.45rem 0.65rem;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: var(--radius);
  background: rgba(255,255,255,0.08);
  color: white;
  font-size: 0.875rem;
  font-family: monospace;
  outline: none;
  transition: border-color 0.15s;
}
.api-key-row input::placeholder { color: rgba(255,255,255,0.35); font-family: inherit; }
.api-key-row input:focus { border-color: var(--green-light); background: rgba(255,255,255,0.12); }

.btn-icon {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 6px;
  color: white;
  cursor: pointer;
  padding: 0.4rem 0.55rem;
  font-size: 0.85rem;
  line-height: 1;
  transition: background 0.15s;
}
.btn-icon:hover { background: rgba(255,255,255,0.2); }

.api-link { font-size: 0.78rem; color: var(--green-light); text-decoration: none; }
.api-link:hover { text-decoration: underline; }

/* API status */
.api-status { font-size: 0.82rem; white-space: nowrap; }
.status-ok   { color: var(--green-light); }
.status-warn { color: #f4a261; }
.status-error{ color: #e63946; }
.status-info { color: rgba(255,255,255,0.6); }

/* Match status badge */
.match-status {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.15rem 0.35rem;
  border-radius: 3px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}
.status-finished  { background: var(--accent-soft);    color: var(--accent); }
.status-in_play   { background: rgba(255,90,79,0.15);  color: var(--error); animation: pulse 1.5s infinite; }
.status-paused    { background: var(--highlight-soft); color: var(--highlight); }

@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.6; } }

/* ── Match row (predictions + admin) ── */
.match-row {
  display: grid;
  grid-template-columns: 1fr 56px 18px 56px 1fr minmax(80px, auto);
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--border);
  transition: background 0.12s;
}
.match-row:last-child { border-bottom: none; }
.match-row:hover { background: var(--surface-2); }

.match-row-meta {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.actual-score {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.45rem;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid rgba(0, 217, 119, 0.25);
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.3px;
}

/* ── Prediction group container (admin-style minimal, collapsible) ── */
.prediction-group {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.75rem;
  overflow: hidden;
}
.prediction-group > summary.prediction-group-title {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0.7rem 1rem;
  background: var(--surface-2);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  transition: background 0.15s;
}
.prediction-group > summary::-webkit-details-marker { display: none; }
.prediction-group > summary:hover { background: var(--surface-hi); }
.prediction-group[open] > summary { border-bottom: 1px solid var(--border); }
.prediction-group-rows { display: flex; flex-direction: column; }

.group-chevron {
  width: 12px;
  height: 12px;
  color: var(--text-muted);
  transition: transform 0.2s;
  flex-shrink: 0;
}
details[open] > summary .group-chevron { transform: rotate(180deg); }

/* Everyone view group sections are also collapsible */
.group-section > summary.group-header {
  cursor: pointer;
  list-style: none;
  transition: filter 0.15s;
}
.group-section > summary::-webkit-details-marker { display: none; }
.group-section > summary:hover { filter: brightness(1.1); }

/* ── Column header (above predictions / everyone lists) ── */
.predict-column-header {
  display: grid;
  grid-template-columns: minmax(96px, max-content) 1fr minmax(150px, max-content);
  align-items: center;
  gap: 1rem;
  padding: 0.4rem 1rem 0.6rem;
}
.everyone-column-header {
  display: flex;
  justify-content: flex-end;
  padding: 0.4rem 1rem 0.6rem;
}
.column-header-label {
  text-align: right;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
}

@media (max-width: 720px) {
  .predict-column-header {
    grid-template-columns: 1fr minmax(120px, auto);
    padding: 0.3rem 0.8rem 0.5rem;
  }
  .predict-column-header span:first-child { display: none; }
  .everyone-column-header { padding: 0.3rem 0.8rem 0.5rem; }
}

/* ── Predict row (three zones: date | fixture | actual) ── */
.predict-row {
  display: grid;
  grid-template-columns: minmax(96px, max-content) 1fr minmax(150px, max-content);
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  transition: background 0.12s;
}
.predict-row:last-child { border-bottom: none; }
.predict-row:hover { background: var(--surface-2); }

.match-date {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.match-date-day {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text);
}
.match-date-time {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
}

.match-fixture {
  display: grid;
  grid-template-columns: 1fr 56px 18px 56px 1fr;
  align-items: center;
  gap: 0.55rem;
}
.match-fixture .team {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
  min-width: 0;
}
.match-fixture .team.home { justify-content: flex-end; text-align: right; }
.match-fixture .team.away { justify-content: flex-start; text-align: left; }
.match-fixture .team .team-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.match-fixture .team-flag {
  width: 24px;
  height: 17px;
  margin: 0;
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.1);
}

.match-actual {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.actual-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.55rem;
  background: var(--accent-soft);
  border: 1px solid rgba(0, 217, 119, 0.3);
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.actual-pill .team-flag {
  width: 16px;
  height: 12px;
  margin: 0;
  border-radius: 2px;
}
.actual-num { padding: 0 1px; }
.actual-dash { color: var(--accent); padding: 0 1px; opacity: 0.7; }
.actual-placeholder {
  color: var(--text-faint);
  font-size: 1rem;
  font-weight: 700;
}

@media (max-width: 720px) {
  .predict-row {
    grid-template-columns: 1fr minmax(120px, auto);
    grid-template-rows: auto auto;
    gap: 0.4rem 0.75rem;
    padding: 0.65rem 0.8rem;
  }
  .match-date {
    grid-column: 1 / -1;
    grid-row: 1;
    flex-direction: row;
    gap: 0.4rem;
    align-items: baseline;
  }
  .match-date-day, .match-date-time { font-size: 0.68rem; }
  .match-fixture {
    grid-column: 1;
    grid-row: 2;
    grid-template-columns: 1fr 44px 14px 44px 1fr;
    gap: 0.35rem;
  }
  .match-fixture .team .team-name { font-size: 0.82rem; }
  .match-fixture .team-flag { width: 20px; height: 14px; }
  .match-fixture .score-input { height: 32px; font-size: 0.9rem; }
  .match-actual {
    grid-column: 2;
    grid-row: 2;
    justify-content: flex-end;
  }
  .actual-pill { font-size: 0.78rem; padding: 0.18rem 0.45rem; }
  .actual-pill .team-flag { width: 14px; height: 10px; }
}

/* ── Profile view ── */
.profile-card {
  max-width: 480px;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem 1.85rem;
  box-shadow: var(--shadow);
}
.profile-title {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--accent);
  margin-bottom: 1.4rem;
}
.profile-field { margin-bottom: 1.4rem; }
.profile-label {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}
.profile-value {
  font-size: 0.95rem;
  color: var(--text);
  padding: 0.5rem 0.75rem;
  background: var(--surface-2);
  border-radius: var(--radius);
  font-variant-numeric: tabular-nums;
}
.profile-name-row {
  display: flex;
  gap: 0.5rem;
}
.profile-name-row input {
  flex: 1;
  padding: 0.6rem 0.8rem;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
}
.profile-name-row input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface-hi);
  box-shadow: var(--accent-glow);
}
.profile-status {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
  min-height: 1.2em;
}
.profile-status.status-ok    { color: var(--accent); }
.profile-status.status-error { color: var(--error); }
.profile-divider {
  border-top: 1px solid var(--border);
  margin: 1.5rem 0;
}
.profile-signout {
  width: 100%;
  padding: 0.7rem;
  font-size: 0.95rem;
}

.team { font-size: 0.875rem; font-weight: 500; }
.team.home { text-align: right; }
.team.away { text-align: left; }

.score-input {
  width: 100%;
  height: 34px;
  text-align: center;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 1rem;
  font-weight: 700;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
  -moz-appearance: textfield;
}
.score-input::-webkit-outer-spin-button,
.score-input::-webkit-inner-spin-button { -webkit-appearance: none; }
.score-input:focus {
  border-color: var(--accent);
  background: var(--surface-hi);
  box-shadow: var(--accent-glow);
}
.score-input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.vs { color: var(--gray-600); font-weight: 700; text-align: center; }

.match-points {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.35rem;
  border-radius: 4px;
  text-align: center;
  min-width: 36px;
}
.points-3    { background: var(--accent-soft);    color: var(--accent); }
.points-1    { background: var(--highlight-soft); color: var(--highlight); }
.points-0    { background: rgba(255,90,79,0.15);  color: var(--error); }
.points-none { min-width: 36px; }

/* ── Save bar ── */
.save-bar {
  position: fixed;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  width: min(900px, calc(100vw - 2rem));
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 4px 20px rgba(0,0,0,0.18);
}
#save-status { font-size: 0.82rem; color: var(--green-mid); }

/* ── Admin panel ── */
.admin-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 1.25rem;
  overflow: hidden;
}

.admin-toggle {
  padding: 0.85rem 1rem;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--gray-100);
  user-select: none;
}
.admin-toggle::-webkit-details-marker { display: none; }
.admin-toggle::before { content: '▶'; font-size: 0.7rem; transition: transform 0.2s; }
details[open] .admin-toggle::before { transform: rotate(90deg); }

.admin-content { padding: 1rem; border-top: 1px solid var(--gray-200); }

.admin-group { margin-bottom: 1rem; }
.admin-group:last-child { margin-bottom: 0; }
.admin-group h3 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--gray-600);
  margin-bottom: 0.4rem;
}

.admin-note { font-size: 0.8rem; color: var(--gray-600); margin-bottom: 0.75rem; }
.admin-actions { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--gray-200); text-align: right; }

/* ── Leaderboard ── */
.leaderboard-container {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.leaderboard-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }

.leaderboard-table th {
  padding: 0.7rem 1rem;
  background: var(--green-dark);
  color: white;
  text-align: left;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.leaderboard-table td { padding: 0.7rem 1rem; border-bottom: 1px solid var(--border); color: var(--text); }
.leaderboard-table tr:last-child td { border-bottom: none; }
.leaderboard-table tr:hover td { background: var(--surface-hi); }
.leaderboard-table tr.current-player td { background: var(--accent-soft); font-weight: 600; }

.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  font-weight: 700;
  font-size: 0.8rem;
}
.rank-1 { background: #FFD700; color: #7B6200; }
.rank-2 { background: #C0C0C0; color: #555;    }
.rank-3 { background: #CD7F32; color: #5a2d00; }
.rank-other { background: var(--gray-200); color: var(--gray-600); }

.points-display { font-size: 1.05rem; font-weight: 700; color: var(--accent); }

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 5rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface-hi);
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 0.6rem 1.25rem;
  border-radius: 999px;
  font-size: 0.875rem;
  z-index: 200;
  animation: slideUp 0.25s ease;
  pointer-events: none;
}
.toast.hidden { display: none; }

@keyframes slideUp {
  from { transform: translateX(-50%) translateY(12px); opacity: 0; }
  to   { transform: translateX(-50%) translateY(0);    opacity: 1; }
}

.empty-state { padding: 3rem; text-align: center; color: var(--gray-600); font-size: 0.9rem; }

.lock-banner {
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  background: var(--highlight-soft);
  border: 1px solid rgba(255, 214, 10, 0.3);
  border-radius: var(--radius);
  color: var(--highlight);
  font-size: 0.9rem;
  font-weight: 500;
  text-align: center;
}

/* ── Auth screen ── */
.auth-screen {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(800px 500px at 50% -10%, rgba(0, 217, 119, 0.08), transparent 60%),
    var(--bg-base);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}
.auth-screen.hidden { display: none; }

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 2rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.auth-card h1 {
  margin: 0 0 0.4rem;
  font-size: 1.4rem;
  text-align: center;
  color: var(--accent);
}
.auth-subtitle {
  margin: 0 0 1.5rem;
  text-align: center;
  color: var(--gray-600);
  font-size: 0.9rem;
}

.auth-tabs {
  display: flex;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--gray-200);
}
.auth-tab {
  flex: 1;
  padding: 0.6rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--gray-600);
  transition: all 0.15s;
}
.auth-tab.active {
  color: var(--accent);
  border-bottom-color: var(--green-mid);
}

#auth-form { display: flex; flex-direction: column; gap: 0.6rem; }
#auth-form input {
  padding: 0.7rem 0.85rem;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  width: 100%;
}
#auth-form input::placeholder { color: var(--text-faint); }
#auth-form input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface-hi);
  box-shadow: var(--accent-glow);
}
#auth-form .btn { margin-top: 0.5rem; padding: 0.65rem; font-size: 0.95rem; }
#auth-displayname-wrap.hidden { display: none; }

.password-row {
  position: relative;
  display: block;
}
.password-row input { padding-right: 2.6rem !important; width: 100%; }
.password-eye {
  position: absolute;
  top: 50%;
  right: 0.45rem;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  padding: 0.35rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.35rem;
}
.password-eye:hover { color: var(--text); background: rgba(255,255,255,0.06); }
.password-eye.active { color: var(--accent); }
.password-eye svg { width: 18px; height: 18px; }

.auth-link-btn {
  background: transparent;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 0.85rem;
  text-decoration: underline;
  padding: 0.25rem;
  align-self: center;
}
.auth-link-btn:hover { color: var(--text); }
.auth-link-btn:disabled { opacity: 0.5; cursor: wait; }

.auth-info {
  background: rgba(80, 200, 120, 0.12) !important;
  border-color: rgba(80, 200, 120, 0.45) !important;
  color: var(--text) !important;
}

.profile-password-grid {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.profile-password-grid input {
  padding: 0.6rem 0.75rem;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.92rem;
}
.profile-password-grid input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface-hi);
  box-shadow: var(--accent-glow);
}
.profile-password-grid .btn { margin-top: 0.25rem; }

.auth-error {
  margin-top: 0.5rem;
  padding: 0.55rem 0.75rem;
  background: rgba(255, 90, 79, 0.12);
  border: 1px solid rgba(255, 90, 79, 0.4);
  border-radius: var(--radius);
  color: var(--error);
  font-size: 0.85rem;
}
.auth-error.hidden { display: none; }

/* ── User info row in settings ── */
.user-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  background: var(--green-pale);
  border-radius: var(--radius);
  margin-right: auto;
  font-size: 0.85rem;
}
.user-info.hidden { display: none; }
.user-info .user-label { color: var(--gray-600); }
.user-info strong { color: var(--accent); }
.btn-secondary {
  background: transparent;
  border: 1px solid var(--gray-300);
  color: var(--gray-800);
  padding: 0.3rem 0.7rem;
  border-radius: var(--radius);
  font-size: 0.8rem;
  cursor: pointer;
}
.btn-secondary:hover { background: var(--gray-200); }

/* ── Sub-tabs (within Predictions view) ── */
.sub-tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--gray-300);
}
.sub-tab {
  padding: 0.55rem 1.1rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--gray-600);
  transition: all 0.15s;
}
.sub-tab:hover { color: var(--accent); }
.sub-tab.active {
  color: var(--accent);
  border-bottom-color: var(--green-mid);
}
.subview.hidden { display: none; }

/* ── Everyone subview ── */
.other-match-block {
  padding: 0.75rem 0.9rem;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  margin-bottom: 0.5rem;
}
.other-match-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.6rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px dashed var(--gray-200);
  color: var(--gray-800);
}
.other-match-result {
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.other-prediction-row {
  display: grid;
  grid-template-columns: 1fr 60px 40px;
  gap: 0.5rem;
  align-items: center;
  padding: 0.3rem 0.4rem;
  font-size: 0.85rem;
  border-radius: 4px;
}
.other-prediction-row:nth-child(odd) { background: var(--surface-2); }
.other-prediction-row.is-self {
  background: var(--accent-soft);
  border-left: 2px solid var(--accent);
  padding-left: 0.5rem;
}
.self-tag {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--accent);
  background: rgba(0, 217, 119, 0.18);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  margin-left: 0.35rem;
}
.other-name  { color: var(--gray-800); }
.other-score {
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  text-align: center;
}
.empty-state-small {
  color: var(--gray-600);
  font-size: 0.8rem;
  padding: 0.4rem;
  text-align: center;
}

/* ── Match card (predictions view) ── */
.match-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  padding: 0.95rem 1.1rem;
  margin-bottom: 0.65rem;
  transition: border-color 0.15s, box-shadow 0.18s, transform 0.18s;
}

/* Top row: date + status/points */
.match-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--gray-600);
}
.match-card-date { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.match-card-meta {
  display: inline-flex;
  gap: 0.4rem;
  align-items: center;
  flex-shrink: 0;
}

/* Fixture row: home flag · home name · VS · away name · away flag */
.match-card-fixture {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 0 0.8rem;
  margin-top: 0.5rem;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.team-side {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
}
.team-side.home { justify-content: flex-end; text-align: right; }
.team-side.away { justify-content: flex-start; text-align: left; }
.team-side .team-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--gray-800);
  letter-spacing: -0.1px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.team-side .team-flag {
  width: 30px;
  height: 22px;
  margin: 0;
  border-radius: 3px;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.08), 0 1px 3px rgba(0,0,0,0.05);
}
.team-flag-empty { background: var(--gray-200); }
.fixture-vs {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 0.25rem 0.55rem;
  border-radius: 99px;
  flex-shrink: 0;
}

/* Pick + Actual rows (stacked, column-aligned) */
.match-card-body {
  display: grid;
  grid-template-columns: max-content 60px 20px 60px 1fr;
  column-gap: 0.7rem;
  row-gap: 0.45rem;
  align-items: center;
  padding-top: 0.85rem;
}
.score-row { display: contents; }
.score-label {
  font-size: 0.72rem;
  color: var(--gray-600);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  text-align: left;
  white-space: nowrap;
}
.actual-row .score-label { color: var(--green-mid); }
.score-row .vs {
  color: var(--gray-600);
  font-weight: 600;
  text-align: center;
}
.actual-row .vs { color: var(--green-mid); }
.score-static {
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  background: var(--green-pale);
  border: 1px solid var(--green-light);
  border-radius: 7px;
}
.match-card .score-input {
  height: 38px;
  font-size: 1.05rem;
  border-radius: 7px;
}

@media (max-width: 600px) {
  .match-card { padding: 0.8rem 0.9rem; }
  .match-card-top { font-size: 0.65rem; letter-spacing: 0.5px; }
  .match-card-fixture {
    gap: 0.5rem;
    padding: 0.7rem 0;
  }
  .team-side .team-name { font-size: 0.95rem; }
  .team-side .team-flag { width: 26px; height: 18px; }
  .fixture-vs { font-size: 0.65rem; padding: 0.2rem 0.45rem; }
  .match-card-body {
    grid-template-columns: max-content 52px 18px 52px 1fr;
    column-gap: 0.5rem;
  }
  .score-label { font-size: 0.65rem; letter-spacing: 0.4px; }
  .match-card .score-input,
  .score-static { height: 34px; font-size: 0.95rem; }
}

/* ── Header sign-out icon ── */
.nav-signout {
  background: transparent;
  border: 1px solid transparent;
  color: rgba(255, 255, 255, 0.55);
  padding: 0.4rem 0.5rem;
  margin-left: 0.4rem;
  border-radius: var(--radius);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
  transition: color 0.15s, background 0.15s, border-color 0.15s, transform 0.08s;
}
.nav-signout svg { width: 18px; height: 18px; display: block; }
.nav-signout:hover {
  color: var(--error);
  background: rgba(255, 90, 79, 0.1);
  border-color: rgba(255, 90, 79, 0.3);
}
.nav-signout:active { transform: scale(0.94); }

@media (max-width: 600px) {
  .nav-signout { margin-left: 0.2rem; padding: 0.3rem 0.4rem; }
  .nav-signout svg { width: 16px; height: 16px; }
}

/* ── Language toggle (header) ── */
.lang-toggle {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: rgba(255,255,255,0.1);
  border-radius: var(--radius);
  padding: 3px;
  margin-left: 0.4rem;
}
.lang-flag {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: calc(var(--radius) - 2px);
  line-height: 0;
  opacity: 0.55;
  transition: all 0.15s;
  filter: saturate(0.5);
}
.lang-flag svg {
  display: block;
  width: 24px;
  height: 16px;
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.1);
}
.lang-flag:hover { opacity: 0.85; filter: saturate(0.85); }
.lang-flag.active {
  background: rgba(255,255,255,0.2);
  opacity: 1;
  filter: saturate(1);
}

@media (max-width: 600px) {
  .lang-toggle { padding: 2px; margin-left: 0.2rem; }
  .lang-flag { padding: 3px 4px; }
  .lang-flag svg { width: 20px; height: 14px; }
}

/* ── Team flags (next to names) ── */
.team-flag {
  display: inline-block;
  width: 22px;
  height: 16px;
  object-fit: cover;
  border-radius: 2px;
  margin-right: 0.4rem;
  vertical-align: middle;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.08);
  background: var(--gray-200);
}
.team-name { vertical-align: middle; }
.match-card-teams .team { display: inline-flex; align-items: center; }
.match-card-teams .team-flag { margin-right: 0.35rem; }

.other-teams { display: inline-flex; align-items: center; gap: 0.35rem; flex-wrap: wrap; }
.other-teams .team-flag { margin-right: 0.15rem; }

.match-row .team-flag { width: 18px; height: 13px; margin-right: 0.3rem; }

@media (max-width: 600px) {
  .team-flag { width: 18px; height: 13px; margin-right: 0.3rem; }
}

/* ── Rules view ── */
.rules-card {
  max-width: 720px;
  margin: 0 auto;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 1.5rem 1.75rem;
  box-shadow: var(--shadow);
}
.rules-section-title {
  font-size: 1.1rem;
  color: var(--accent);
  margin-bottom: 0.4rem;
  margin-top: 1.5rem;
}
.rules-section-title:first-child { margin-top: 0; }
.rules-intro {
  color: var(--gray-600);
  margin-bottom: 1.2rem;
  font-size: 0.92rem;
}
.rules-list {
  margin: 0.4rem 0 0;
  padding-left: 1.2rem;
  color: var(--text);
  font-size: 0.92rem;
  line-height: 1.55;
}
.rules-list li {
  margin-bottom: 0.55rem;
}
.rules-list li::marker { color: var(--accent); }
.rules-paragraph {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.5;
  margin-top: 1rem;
}
.rules-paragraph:first-of-type { margin-top: 1.5rem; }

.prizes-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin: 0.5rem 0 0;
}
.prize-row {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.9rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.prize-label {
  color: var(--text);
  font-weight: 500;
  font-size: 0.95rem;
}
.prize-amount {
  color: var(--accent);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-size: 0.95rem;
  letter-spacing: -0.2px;
}
.rule-item {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 1rem;
  align-items: start;
  padding: 0.85rem 0;
  border-top: 1px solid var(--gray-200);
}
.rule-item:first-of-type { border-top: none; padding-top: 0.4rem; }
.rule-badge {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 800;
  border-radius: 50%;
  font-variant-numeric: tabular-nums;
}
.rule-content h3 {
  font-size: 1rem;
  margin: 0 0 0.25rem;
  color: var(--gray-800);
}
.rule-content p {
  margin: 0;
  color: var(--gray-600);
  font-size: 0.9rem;
  line-height: 1.45;
}

@media (max-width: 600px) {
  .rules-card { padding: 1.1rem 1rem; }
  .rule-item { grid-template-columns: 44px 1fr; gap: 0.75rem; }
  .rule-badge { width: 40px; height: 40px; font-size: 1.25rem; }
}

/* ── View enter animation ── */
.view-enter, .subview.view-enter {
  animation: viewEnter 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes viewEnter {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

/* ── Micro-interactions ── */
.match-card {
  transition: border-color 0.15s, box-shadow 0.18s, transform 0.18s;
}
.match-card:hover:not(.skeleton) {
  border-color: var(--border-strong);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(0, 217, 119, 0.08);
  transform: translateY(-1px);
}
.btn, .nav-btn, .auth-tab, .sub-tab, .btn-icon, .lang-flag {
  transition: background 0.15s, color 0.15s, transform 0.08s, opacity 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.btn:active,
.btn-icon:active,
.lang-flag:active { transform: scale(0.96); }
.nav-btn:active,
.sub-tab:active,
.auth-tab:active { transform: translateY(0.5px); }
.score-input { transition: border-color 0.15s, box-shadow 0.15s, background 0.15s; }

/* ── Autosave indicator ── */
.autosave-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  color: var(--gray-600);
  font-weight: 500;
  min-height: 1.4em;
  transition: opacity 0.2s, color 0.2s;
}
.autosave-indicator.status-editing { color: var(--gray-600); }
.autosave-indicator.status-saving  { color: var(--gray-800); }
.autosave-indicator.status-saved   { color: var(--green-mid); }
.autosave-indicator.status-error   { color: #b91c1c; }
.autosave-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--gray-600);
  animation: pulseDot 1.4s ease-in-out infinite;
}
@keyframes pulseDot {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}
.autosave-spinner {
  width: 12px; height: 12px;
  border: 2px solid var(--gray-300);
  border-top-color: var(--green-mid);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.autosave-check {
  display: inline-flex;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--green-mid);
  color: var(--white);
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 800;
  animation: popIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes popIn {
  from { transform: scale(0); }
  to   { transform: scale(1); }
}

/* ── Skeleton shimmer ── */
.match-card.skeleton {
  pointer-events: none;
  border-color: var(--border);
  background: var(--surface);
}
.skel-bar {
  display: inline-block;
  background: linear-gradient(
    90deg,
    var(--surface-2) 0%,
    var(--surface-hi) 50%,
    var(--surface-2) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  border-radius: 4px;
  height: 14px;
  vertical-align: middle;
}
.skel-team   { width: 90px; height: 16px; }
.skel-badge  { width: 38px; height: 18px; border-radius: 9px; }
.skel-label  { width: 70px; height: 11px; }
.skel-score  { height: 36px; border-radius: 6px; }
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Save bar polish ── */
.save-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0;
  gap: 1rem;
}

/* ── Responsive ── */
@media (max-width: 720px) {
  .app-header { padding: 0.5rem 0.85rem; }
  .brand { gap: 0.55rem; min-width: 0; flex: 1; }
  .brand-ball { width: 30px; height: 30px; flex-shrink: 0; }
  .brand-text { min-width: 0; flex: 1; }
  .brand-title { font-size: 1rem; }
  .brand-tagline { font-size: 0.62rem; letter-spacing: 0.8px; }
  .brand-hosts { display: none; }
  .nav-btn {
    padding: 0.4rem 0.65rem;
    font-size: 0.82rem;
  }
}

@media (max-width: 600px) {
  .match-row { grid-template-columns: 1fr 44px 14px 44px 1fr minmax(60px, auto); gap: 0.3rem; padding: 0.5rem 0.7rem; }
  .team { font-size: 0.78rem; }
  .match-row .team-name { font-size: 0.78rem; }
  .match-row .score-input { height: 32px; font-size: 0.9rem; }
  .match-row-meta { gap: 0.25rem; }
  .actual-score { padding: 0.1rem 0.35rem; font-size: 0.68rem; }
  .group-teams { display: none; }
  .leaderboard-table th:nth-child(4),
  .leaderboard-table td:nth-child(4) { display: none; }
}

@media (max-width: 480px) {
  .brand-tagline { display: none; }
  .auth-card { padding: 1.4rem 1.2rem; }
  .nav-btn { padding: 0.35rem 0.55rem; font-size: 0.78rem; }
  .leagues-hero h2 { font-size: 1.25rem; }
  .leagues-form-card { padding: 1rem 1.1rem; }
}
