/* ═══════════════════════════════════════════════════════
   Pickle Pulse Cloud v51 — Glassmorphism Design System
   ═══════════════════════════════════════════════════════ */

/* ──── Design tokens ──── */
:root {
  /* Backgrounds — unified dark palette matching onboarding */
  --bg-1: #0b1120;
  --bg-2: #101829;
  --bg-3: #0d1424;
  --bg-app: #0e1525;
  --bg-app-2: #131d30;

  /* Glass — dark glass for all surfaces */
  --glass: rgba(255, 255, 255, 0.06);
  --glass-border: rgba(255, 255, 255, 0.09);
  --glass-strong: rgba(255, 255, 255, 0.12);
  --glass-light: rgba(255, 255, 255, 0.06);
  --glass-light-border: rgba(255, 255, 255, 0.09);

  /* Surfaces — dark elevated panels */
  --panel: rgba(255, 255, 255, 0.055);
  --panel-solid: rgba(20, 30, 50, 0.95);
  --panel-soft: rgba(255, 255, 255, 0.04);

  /* Text — light for dark theme */
  --ink: #e8ecf2;
  --ink-2: #c8d0dc;
  --ink-light: #ffffff;
  --muted: rgba(255, 255, 255, 0.45);
  --muted-light: rgba(255, 255, 255, 0.55);

  /* Brand — luminous green on dark */
  --brand: #5ec892;
  --brand-2: #4ab87e;
  --brand-dark: #3ca86c;
  --brand-glow: rgba(78, 184, 126, 0.2);
  --brand-soft: rgba(78, 184, 126, 0.08);
  --accent: #38bdf8;
  --accent-2: #818cf8;

  /* Utility */
  --danger: #f87171;
  --warning: #fbbf24;
  --success: #4ade80;
  --line: rgba(255, 255, 255, 0.07);
  --line-dark: rgba(255, 255, 255, 0.07);

  /* Shadows — glows for dark theme */
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.3), 0 8px 32px rgba(0, 0, 0, 0.15);
  --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.4), 0 16px 48px rgba(0, 0, 0, 0.25);
  --shadow-glow: 0 0 40px rgba(78, 184, 126, 0.1);

  /* Radii */
  --r-xl: 24px;
  --r-lg: 18px;
  --r-md: 14px;
  --r-sm: 10px;
  --r-pill: 999px;

  /* Layout */
  --shell-w: 520px;
  --bar-h: 60px;
  --nav-h: 72px;

  /* Transitions */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ──── Reset ──── */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }

body {
  margin: 0;
  font-family: "Inter", "SF Pro Display", "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: linear-gradient(165deg, #0b1120 0%, #0f1b2d 40%, #0a1218 100%);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  position: relative;
}

/* Ambient glow — same as onboarding */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 20% 10%, rgba(78, 184, 126, 0.06), transparent 50%),
    radial-gradient(ellipse at 80% 85%, rgba(56, 189, 248, 0.04), transparent 50%),
    radial-gradient(ellipse at 50% 50%, rgba(129, 140, 248, 0.025), transparent 55%);
}
body::after { display: none; }

/* ═══════════════════════════════════════
   SPLASH SCREEN
   ═══════════════════════════════════════ */
.splash-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: linear-gradient(165deg, #0b1120 0%, #0f1b2d 50%, #0a1218 100%);
  transition: opacity 500ms var(--ease-out), visibility 500ms var(--ease-out);
}

.splash-screen.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.splash-glow {
  position: absolute;
  width: min(80vw, 500px);
  height: min(80vw, 500px);
  background: radial-gradient(circle, rgba(56, 158, 110, 0.15), rgba(56, 189, 248, 0.08) 40%, transparent 70%);
  filter: blur(40px);
  animation: splashPulse 3s ease-in-out infinite alternate;
}

@keyframes splashPulse {
  from { transform: scale(0.9); opacity: 0.7; }
  to { transform: scale(1.1); opacity: 1; }
}

.splash-content {
  position: relative;
  width: min(88vw, 360px);
  padding: 2.5rem 1.5rem;
  text-align: center;
  border-radius: var(--r-xl);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.3);
}

.splash-logo {
  width: 88px;
  height: 88px;
  border-radius: 22px;
  object-fit: cover;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4), var(--shadow-glow);
  margin-bottom: 1rem;
  animation: splashFloat 3s ease-in-out infinite alternate;
}

@keyframes splashFloat {
  from { transform: translateY(0) scale(1); }
  to { transform: translateY(-8px) scale(1.04); }
}

.splash-wordmark {
  display: block;
  width: min(100%, 280px);
  height: auto;
  margin: 0 auto 0.75rem;
  object-fit: contain;
  filter: drop-shadow(0 2px 8px rgba(78, 184, 126, 0.15));
}

.splash-kicker {
  margin: 0;
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.45);
  font-weight: 500;
}

.version-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.6rem;
  border-radius: var(--r-pill);
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: rgba(61, 163, 99, 0.12);
  border: 1px solid rgba(61, 163, 99, 0.25);
  color: var(--brand);
}

/* ═══════════════════════════════════════
   AUTH GATE — Dark glassmorphism
   ═══════════════════════════════════════ */
.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 1rem;
  background: linear-gradient(165deg, #0b1120 0%, #0f1b2d 40%, #0a1218 100%);
  overflow-y: auto;
}

/* Ambient glow behind auth */
.auth-gate::before {
  content: "";
  position: fixed;
  top: -20%;
  left: -20%;
  width: 140%;
  height: 140%;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(61, 163, 99, 0.08), transparent 50%),
    radial-gradient(ellipse at 70% 80%, rgba(56, 189, 248, 0.06), transparent 50%),
    radial-gradient(ellipse at 50% 50%, rgba(129, 140, 248, 0.04), transparent 60%);
  animation: ambientShift 8s ease-in-out infinite alternate;
}

@keyframes ambientShift {
  from { transform: rotate(0deg) scale(1); }
  to { transform: rotate(3deg) scale(1.05); }
}

/* Progress rail */
.auth-progress-rail {
  position: fixed;
  top: 2rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  z-index: 52;
}

.auth-dot {
  width: 32px;
  height: 4px;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.12);
  transition: all 400ms var(--ease-out);
}

.auth-dot.active {
  background: var(--brand);
  box-shadow: 0 0 12px rgba(61, 163, 99, 0.4);
  width: 48px;
}

.auth-dot.done {
  background: rgba(61, 163, 99, 0.5);
}

/* Status chip in auth */
#auth-cloud-status {
  position: fixed;
  top: 2.8rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 52;
}

/* Auth steps */
.auth-step {
  position: relative;
  z-index: 51;
  width: 100%;
  max-width: 400px;
  animation: authStepIn 500ms var(--ease-out);
}

@keyframes authStepIn {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Glass card for auth */
.auth-glass-card {
  padding: 2rem 1.5rem;
  border-radius: var(--r-xl);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.25);
  text-align: center;
  color: var(--ink-light);
}

.auth-glass-card.auth-details-card {
  text-align: left;
  padding: 1.75rem 1.25rem;
}

.auth-glass-card h1 {
  margin: 0 0 0.25rem;
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.brand-text {
  background: linear-gradient(135deg, var(--brand), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.auth-logo {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  object-fit: cover;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3), 0 0 24px rgba(61, 163, 99, 0.15);
  margin-bottom: 1.25rem;
}

.auth-sub {
  margin: 0.25rem 0 1.5rem;
  font-size: 0.9rem;
  color: var(--muted-light);
  line-height: 1.5;
}

/* Auth forms */
.auth-form {
  display: grid;
  gap: 0.85rem;
}

.auth-field {
  text-align: left;
}

.auth-field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.auth-field input,
.auth-field select {
  width: 100%;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--r-md);
  padding: 0.75rem 1rem;
  color: #fff;
  font-size: 0.95rem;
  transition: border-color 200ms ease, box-shadow 200ms ease;
}

.auth-field input::placeholder {
  color: rgba(255, 255, 255, 0.25);
}

.auth-field input:focus,
.auth-field select:focus {
  outline: none;
  border-color: rgba(61, 163, 99, 0.5);
  box-shadow: 0 0 0 3px rgba(61, 163, 99, 0.1);
}

/* Custom city search dropdown */
.city-search-wrap {
  position: relative;
}

.city-dropdown {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  z-index: 9999;
  max-height: 200px;
  overflow-y: auto;
  border-radius: 0 0 var(--r-md) var(--r-md);
  scrollbar-width: thin;
}

.city-dropdown.open {
  display: block;
}

/* Auth screen (dark) city dropdown */
.auth-step .city-dropdown {
  background: rgba(30, 40, 45, 0.97);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-top: none;
  backdrop-filter: blur(12px);
}

.auth-step .city-dropdown .city-option {
  padding: 0.6rem 1rem;
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 150ms ease;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.auth-step .city-dropdown .city-option:hover,
.auth-step .city-dropdown .city-option.highlighted {
  background: rgba(61, 163, 99, 0.2);
  color: #fff;
}

.auth-step .city-dropdown .city-option:last-child {
  border-bottom: none;
}

/* App screen (dark) city dropdown */
.card .city-dropdown,
.sheet-body .city-dropdown,
.settings-sheet .city-dropdown {
  background: rgba(20, 30, 50, 0.97);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-top: none;
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.card .city-dropdown .city-option,
.sheet-body .city-dropdown .city-option,
.settings-sheet .city-dropdown .city-option {
  padding: 0.55rem 0.8rem;
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.88rem;
  cursor: pointer;
  transition: background 150ms ease;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.card .city-dropdown .city-option:hover,
.card .city-dropdown .city-option.highlighted,
.sheet-body .city-dropdown .city-option:hover,
.sheet-body .city-dropdown .city-option.highlighted,
.settings-sheet .city-dropdown .city-option:hover,
.settings-sheet .city-dropdown .city-option.highlighted {
  background: rgba(61, 163, 99, 0.2);
  color: #fff;
}

.city-dropdown .city-no-match {
  padding: 0.6rem 1rem;
  color: rgba(255, 255, 255, 0.35);
  font-size: 0.85rem;
  font-style: italic;
}

.card .city-dropdown .city-no-match,
.sheet-body .city-dropdown .city-no-match {
  color: rgba(255, 255, 255, 0.35);
}

/* Phone input wrapper */
.phone-input-wrap {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--r-md);
  overflow: hidden;
  transition: border-color 200ms ease, box-shadow 200ms ease;
}

.phone-input-wrap:focus-within {
  border-color: rgba(61, 163, 99, 0.5);
  box-shadow: 0 0 0 3px rgba(61, 163, 99, 0.1);
}

.phone-prefix {
  padding: 0 0.75rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.95rem;
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  line-height: 3rem;
  flex-shrink: 0;
}

.phone-input-wrap input {
  border: none;
  background: transparent;
  flex: 1;
  padding: 0.85rem 1rem;
  color: #fff;
  font-size: 1.1rem;
  letter-spacing: 0.08em;
  min-height: auto;
}

.phone-input-wrap input:focus {
  outline: none;
  box-shadow: none;
}

/* OTP styles */
.otp-icon {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

.otp-input {
  text-align: center;
  font-size: 1.5rem;
  letter-spacing: 0.5em;
  background: rgba(255, 255, 255, 0.07) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  border-radius: var(--r-md) !important;
  padding: 0.85rem 1rem !important;
  color: #fff !important;
  width: 100%;
}

.otp-input:focus {
  outline: none;
  border-color: rgba(61, 163, 99, 0.5) !important;
  box-shadow: 0 0 0 3px rgba(61, 163, 99, 0.1) !important;
}

.otp-preview-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 0.6rem 1rem;
  border-radius: var(--r-md);
  background: rgba(61, 163, 99, 0.08);
  border: 1px solid rgba(61, 163, 99, 0.2);
  margin-bottom: 0.5rem;
}

.otp-preview-badge span {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.5);
}

.otp-preview-badge strong {
  font-size: 1.25rem;
  letter-spacing: 0.25em;
  color: var(--brand);
}

/* Auth CTA button */
.auth-cta {
  width: 100%;
  padding: 0.85rem;
  border: none;
  border-radius: var(--r-md);
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 200ms var(--ease-out);
  box-shadow: 0 4px 16px rgba(42, 125, 85, 0.25), 0 8px 32px rgba(42, 125, 85, 0.12);
  min-height: 3rem;
  letter-spacing: 0.01em;
}

.auth-cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(42, 125, 85, 0.3), 0 12px 40px rgba(42, 125, 85, 0.18);
}

.auth-cta:active {
  transform: translateY(0);
}

/* Auth link button */
.auth-link {
  background: none !important;
  border: none !important;
  color: rgba(255, 255, 255, 0.5) !important;
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0.5rem;
  width: auto;
  min-height: auto;
  box-shadow: none !important;
}

.auth-link:hover {
  color: rgba(255, 255, 255, 0.8) !important;
  transform: none;
  box-shadow: none !important;
}

/* Auth message */
.auth-message {
  text-align: center;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.6);
  margin-top: 0.5rem;
}

.auth-message.error {
  color: var(--danger);
}

/* Pill toggles (auth details) */
.pill-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.pill {
  flex: 1;
  min-width: 70px;
  padding: 0.55rem 0.75rem;
  border-radius: var(--r-pill);
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 200ms var(--ease-out);
  min-height: 2.5rem;
  box-shadow: none;
}

.pill:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.25);
  transform: none;
  box-shadow: none;
}

.pill.active {
  background: rgba(61, 163, 99, 0.15);
  border-color: var(--brand);
  color: var(--brand);
  box-shadow: 0 0 16px rgba(61, 163, 99, 0.15);
}

/* ═══════════════════════════════════════
   WELCOME SCREEN (Step 4)
   ═══════════════════════════════════════ */
.welcome-screen {
  position: relative;
  text-align: center;
  color: var(--ink-light);
  z-index: 51;
  width: 100%;
  max-width: 400px;
}

.welcome-content {
  position: relative;
  z-index: 2;
}

.welcome-check {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-2), var(--brand));
  display: grid;
  place-items: center;
  margin: 0 auto 1.5rem;
  font-size: 2.5rem;
  color: #fff;
  box-shadow: 0 16px 40px rgba(45, 138, 80, 0.3), 0 0 60px rgba(61, 163, 99, 0.15);
  animation: welcomePop 600ms var(--ease-spring);
}

@keyframes welcomePop {
  from { transform: scale(0); opacity: 0; }
  60% { transform: scale(1.15); }
  to { transform: scale(1); opacity: 1; }
}

.welcome-screen h1 {
  font-size: 2rem;
  margin: 0 0 0.5rem;
  font-weight: 700;
  line-height: 1.2;
}

.welcome-greeting {
  font-size: 1.1rem;
  color: var(--muted-light);
  margin: 0 0 2rem;
}

.welcome-features {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.welcome-feat {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  text-align: left;
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.8);
  animation: featSlide 500ms var(--ease-out) both;
}

.welcome-feat:nth-child(1) { animation-delay: 200ms; }
.welcome-feat:nth-child(2) { animation-delay: 350ms; }
.welcome-feat:nth-child(3) { animation-delay: 500ms; }

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

.welcome-feat span:first-child {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.welcome-cta {
  font-size: 1.1rem;
  padding: 1rem;
  border-radius: var(--r-md);
  animation: ctaPulse 2s ease-in-out infinite;
}

@keyframes ctaPulse {
  0%, 100% { box-shadow: 0 8px 24px rgba(45, 138, 80, 0.25); }
  50% { box-shadow: 0 8px 40px rgba(45, 138, 80, 0.45); }
}

/* Confetti */
.confetti-wrap {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
}

.confetti-piece {
  position: absolute;
  width: 8px;
  height: 8px;
  top: -10px;
  border-radius: 2px;
  animation: confettiFall linear forwards;
}

@keyframes confettiFall {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  80% { opacity: 1; }
  100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

/* ═══════════════════════════════════════
   APP SHELL — Light glassmorphism
   ═══════════════════════════════════════ */
.app-shell {
  position: relative;
  z-index: 1;
  max-width: var(--shell-w);
  margin: 0 auto;
  min-height: 100dvh;
  width: 100%;
  overflow-x: hidden;
}

.app-shell.app-shell-locked {
  visibility: hidden;
  pointer-events: none;
}

/* ──── App bar ──── */
.app-bar {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(100vw, var(--shell-w));
  height: var(--bar-h);
  z-index: 15;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  background: rgba(15, 22, 40, 0.8);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(20px) saturate(1.2);
  -webkit-backdrop-filter: blur(20px) saturate(1.2);
  box-shadow: 0 1px 12px rgba(0, 0, 0, 0.2);
}

.app-bar-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.app-bar-logo {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  object-fit: cover;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.app-bar-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.avatar-btn {
  width: 36px;
  height: 36px;
  min-height: 36px;
  border-radius: 50%;
  padding: 0;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, rgba(61, 163, 99, 0.2), rgba(61, 163, 99, 0.12));
  border: 2px solid rgba(61, 163, 99, 0.3);
  color: var(--brand);
  cursor: pointer;
  transition: all 200ms ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.avatar-btn:hover {
  box-shadow: 0 4px 12px rgba(56, 158, 110, 0.2);
  transform: none;
}

.avatar-btn svg {
  width: 20px;
  height: 20px;
}

/* ──── Main content area ──── */
.app-main {
  padding: calc(var(--bar-h) + 0.75rem) 0.75rem calc(var(--nav-h) + 1rem);
}

/* ──── Views ──── */
.app-view {
  display: none;
  animation: viewIn 300ms var(--ease-out);
}

.app-view.active {
  display: grid;
  gap: 0.75rem;
}

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

/* ──── Glass card (main component) ──── */
.glass-card {
  background: var(--panel);
  border: 1px solid var(--glass-light-border);
  border-radius: var(--r-lg);
  padding: 1.1rem;
  backdrop-filter: blur(16px) saturate(1.1);
  -webkit-backdrop-filter: blur(16px) saturate(1.1);
  box-shadow: var(--shadow);
  overflow: hidden;
}

/* Legacy .card class compat */
.card {
  background: var(--panel);
  border: 1px solid var(--glass-light-border);
  border-radius: var(--r-lg);
  padding: 1.1rem;
  backdrop-filter: blur(16px) saturate(1.1);
  -webkit-backdrop-filter: blur(16px) saturate(1.1);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card-eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 700;
  margin: 0 0 0.5rem;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.squad-head h3 {
  margin: 0;
  font-size: 1rem;
}

.squad-head .muted {
  font-size: 0.8rem;
  margin: 0;
}

.chip-btn {
  width: auto;
  padding: 0.35rem 0.9rem;
  min-height: 2rem;
  border-radius: var(--r-pill);
  font-size: 0.78rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: #fff;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  letter-spacing: 0.01em;
}

.chip-btn:hover {
  transform: none;
  box-shadow: 0 4px 12px rgba(42, 125, 85, 0.25);
}

/* ──── Home KPIs ──── */
/* ── Home hero / logo ── */
.home-hero {
  text-align: center;
  padding: 0.25rem 0;
}

.home-logo {
  display: block;
  width: min(80%, 280px);
  height: auto;
  margin: 0 auto;
  object-fit: contain;
  filter: drop-shadow(0 2px 12px rgba(78, 184, 126, 0.15));
}

.home-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.5rem;
}

.home-kpi {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.06);
  padding: 0.65rem 0.5rem;
  text-align: center;
  transition: all 250ms var(--ease-out);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  position: relative;
  overflow: hidden;
}

.home-kpi::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2.5px;
  background: linear-gradient(90deg, var(--brand), var(--accent));
  opacity: 0.5;
  border-radius: var(--r-md) var(--r-md) 0 0;
}

.home-kpi:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.home-kpi span {
  display: block;
  font-size: 0.7rem;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.home-kpi strong {
  font-size: 1.35rem;
  color: var(--ink);
  letter-spacing: -0.03em;
  font-weight: 800;
}

/* ──── Home tournament cards ──── */
.tournament-mini-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem;
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  cursor: pointer;
  transition: all 200ms ease;
}

.tournament-mini-card:hover {
  background: rgba(255, 255, 255, 0.09);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.tournament-mini-card .t-name {
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--ink);
}

.tournament-mini-card .t-meta {
  font-size: 0.78rem;
  color: var(--muted);
}

/* ═══════════════════════════════════════
   TYPOGRAPHY & UTILITIES
   ═══════════════════════════════════════ */
h2, h3, h4, h5 { margin: 0 0 0.45rem; color: var(--ink); }
h2 { font-size: 1.25rem; font-weight: 700; letter-spacing: -0.02em; }
h3 { font-size: 1.05rem; font-weight: 700; }
h4 { font-size: 0.95rem; font-weight: 700; }

label, .label {
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
  display: block;
  color: var(--muted);
}

.muted { color: var(--muted); font-size: 0.85rem; }
.eyebrow { text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.72rem; color: var(--brand); font-weight: 700; margin: 0; }

.stack { display: grid; gap: 0.65rem; }
.stack > * { min-width: 0; }
.row { display: flex; align-items: center; gap: 0.55rem; flex-wrap: wrap; }
.two-col { display: grid; gap: 0.65rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* ═══════════════════════════════════════
   FORM ELEMENTS
   ═══════════════════════════════════════ */
input, select, button, .button-like {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--r-sm);
  min-height: 2.6rem;
  padding: 0.6rem 0.85rem;
  font: inherit;
  font-size: 0.92rem;
  transition: all 200ms var(--ease-out);
}

input, select {
  background: rgba(255, 255, 255, 0.07);
  color: var(--ink);
}

input:focus, select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(56, 158, 110, 0.1), 0 2px 8px rgba(56, 158, 110, 0.06);
}

input::placeholder {
  color: var(--muted);
  opacity: 0.5;
}

button, .button-like {
  background: linear-gradient(135deg, var(--brand-2), var(--brand-dark));
  color: #fff;
  border: none;
  cursor: pointer;
  font-weight: 700;
  transition: all 200ms var(--ease-out);
  box-shadow: 0 2px 8px rgba(42, 125, 85, 0.15), 0 4px 16px rgba(42, 125, 85, 0.1);
}

button:hover, .button-like:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(42, 125, 85, 0.2), 0 8px 24px rgba(42, 125, 85, 0.15);
  filter: brightness(1.04);
}

button:active, .button-like:active {
  transform: translateY(0);
}

button.ghost {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--muted);
  box-shadow: none;
}

button.ghost:hover {
  background: rgba(255, 255, 255, 0.12);
  box-shadow: none;
}

.secondary-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--ink);
  box-shadow: none;
}

.secondary-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.icon-btn {
  width: 2.2rem;
  min-height: 2.2rem;
  border-radius: 50%;
  padding: 0;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--ink);
  font-weight: 700;
  box-shadow: none;
}

.icon-btn:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.logout-btn {
  background: rgba(248, 113, 113, 0.08);
  border: 1px solid rgba(248, 113, 113, 0.2);
  color: var(--danger);
  box-shadow: none;
  font-weight: 600;
}

.logout-btn:hover {
  background: rgba(248, 113, 113, 0.14);
  box-shadow: none;
  transform: none;
}

.warn-btn {
  background: linear-gradient(135deg, #7a2e2e, #922b2b);
  color: #fff;
}

.tiny.warn {
  background: #7a2e2e;
  color: #fff;
}

select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 16px) calc(50% - 3px),
    calc(100% - 10px) calc(50% - 3px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 2rem;
}

/* ═══════════════════════════════════════
   SCORE STEPPER
   ═══════════════════════════════════════ */
.score-stepper-card {
  text-align: center;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--r-md);
  padding: 0.75rem;
}

.score-stepper-card h3 {
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 600;
}

.score-stepper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  overflow: hidden;
}

.stepper-btn {
  width: 52px;
  height: 52px;
  min-width: 36px;
  min-height: 36px;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  padding: 0;
  display: grid;
  place-items: center;
  font-size: 1.5rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 180ms var(--ease-out);
  flex-shrink: 0;
}

#score-a-add, #score-b-add {
  background: linear-gradient(135deg, var(--brand-2), var(--brand-dark));
  color: #fff;
  box-shadow: 0 6px 20px rgba(45, 138, 80, 0.25);
}

#score-a-undo, #score-b-undo {
  background: rgba(255, 255, 255, 0.08);
  border: 2px solid rgba(255, 255, 255, 0.12);
  color: var(--muted);
  box-shadow: none;
}

#score-a-undo:hover, #score-b-undo:hover {
  background: rgba(255, 255, 255, 0.15);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.stepper-val {
  font-size: 2.5rem;
  font-weight: 800;
  min-width: 56px;
  color: var(--ink);
  letter-spacing: -0.03em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

/* ═══════════════════════════════════════
   TILE GRIDS
   ═══════════════════════════════════════ */
.tile-grid, .score-grid {
  display: grid;
  gap: 0.4rem;
}

.tile-grid {
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
}

/* Stage format tiles — always 2×2 grid */
#stage-mode-tiles {
  grid-template-columns: repeat(2, 1fr);
}

.score-grid {
  grid-template-columns: repeat(6, minmax(40px, 1fr));
}

.tile, .score-tile {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--r-sm);
  padding: 0.5rem;
  background: rgba(255, 255, 255, 0.06);
  cursor: pointer;
  text-align: center;
  user-select: none;
  color: var(--ink);
  transition: all 180ms var(--ease-out);
  font-size: 0.88rem;
  font-weight: 600;
}

.tile:hover, .score-tile:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  background: rgba(255, 255, 255, 0.1);
}

.tile:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.tile.active, .score-tile.active {
  border-color: var(--brand-2);
  background: rgba(61, 163, 99, 0.12);
  color: var(--brand);
  font-weight: 700;
  box-shadow: 0 0 0 2px rgba(61, 163, 99, 0.2);
  animation: tilePopIn 180ms var(--ease-spring);
}

@keyframes tilePopIn {
  from { transform: scale(0.95); }
  to { transform: scale(1); }
}

.player-tile {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.4rem;
  border-radius: var(--r-pill);
  padding: 0.35rem 0.65rem;
}

.player-tile-ranked {
  justify-content: space-between;
}

.rank-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.8rem;
  height: 1.8rem;
  border-radius: 50%;
  border: 1px solid rgba(61, 163, 99, 0.3);
  background: rgba(61, 163, 99, 0.1);
  color: var(--brand);
  font-size: 0.75rem;
  font-weight: 800;
}

.player-icon, .player-avatar {
  width: 1.8rem;
  height: 1.8rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, rgba(61, 163, 99, 0.2), rgba(61, 163, 99, 0.1));
  border: 1.5px solid rgba(61, 163, 99, 0.25);
  font-weight: 700;
  font-size: 0.75rem;
  color: var(--brand);
}

.player-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--r-md);
  padding: 0.5rem 0.65rem;
  background: rgba(255, 255, 255, 0.05);
}

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

.side-card {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--r-md);
  padding: 0.65rem;
  background: rgba(255, 255, 255, 0.05);
}

.score-value {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0 0 0.34rem;
}

/* ═══════════════════════════════════════
   LISTS & BADGES
   ═══════════════════════════════════════ */
.list {
  margin: 0.6rem 0 0;
  padding-left: 0;
  list-style: none;
  display: grid;
  gap: 0.5rem;
}

.list li { margin: 0; }

.inline-actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.tiny {
  width: auto;
  min-height: 2rem;
  padding: 0.35rem 0.7rem;
  border-radius: var(--r-pill);
  font-size: 0.76rem;
}

.tiny.warn {
  background: var(--danger);
  color: #fff;
}

.badge {
  display: inline-block;
  background: rgba(56, 189, 248, 0.12);
  color: var(--accent);
  border-radius: var(--r-pill);
  padding: 0.18rem 0.55rem;
  margin: 0.1rem 0.2rem 0.1rem 0;
  font-size: 0.78rem;
  font-weight: 600;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  border-radius: var(--r-pill);
  padding: 0.15rem 0.6rem;
  font-size: 0.74rem;
  font-weight: 600;
  background: rgba(61, 163, 99, 0.1);
  color: var(--brand);
  border: 1px solid rgba(61, 163, 99, 0.25);
}

.status-chip.pending {
  background: rgba(251, 191, 36, 0.1);
  color: var(--warning);
  border-color: rgba(251, 191, 36, 0.25);
}

.status-chip.ready {
  background: rgba(61, 163, 99, 0.1);
  color: var(--brand);
  border-color: rgba(61, 163, 99, 0.25);
}

.status-chip.error {
  background: rgba(248, 113, 113, 0.1);
  color: var(--danger);
  border-color: rgba(248, 113, 113, 0.25);
}

.status-chip.done {
  background: rgba(107, 116, 134, 0.08);
  color: var(--muted);
  border-color: rgba(107, 116, 134, 0.2);
}

/* Tournament list items */
#tournaments-list > li,
#tournaments-history-list > li {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--r-md);
  padding: 0.65rem;
  background: rgba(255, 255, 255, 0.05);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  transition: all 200ms ease;
}

#tournaments-list > li:hover,
#tournaments-history-list > li:hover {
  background: rgba(255, 255, 255, 0.09);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

.tournament-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.45rem;
  margin-bottom: 0.35rem;
}

/* Traffic light status indicator for tournaments */
.status-light {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 0.35rem;
}

.status-light.live {
  background: var(--brand-2);
  box-shadow: 0 0 6px rgba(61, 163, 99, 0.4);
  animation: statusPulse 2s ease-in-out infinite;
}

.status-light.ended {
  background: #9b2d2d;
  opacity: 0.7;
}

@keyframes statusPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ═══════════════════════════════════════
   WIZARD
   ═══════════════════════════════════════ */
.wizard-rail {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}

.wizard-rail-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.45rem 0.2rem;
  border-radius: var(--r-sm);
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  cursor: default;
  transition: all 200ms ease;
  text-align: center;
  font-size: 0.72rem;
}

.wizard-rail-tile strong {
  font-size: 0.9rem;
  display: block;
  margin-bottom: 0.1rem;
}

.wizard-rail-tile.active {
  background: rgba(61, 163, 99, 0.1);
  border-color: var(--brand-2);
  color: var(--brand);
  font-weight: 600;
}

.wizard-step { /* handled by hidden attr */ }

.wizard-actions {
  margin-top: 0.5rem;
}

.wizard-actions button {
  width: auto;
  flex: 1 1 120px;
}

/* ═══════════════════════════════════════
   BOTTOM NAV
   ═══════════════════════════════════════ */
.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(100vw, var(--shell-w));
  height: var(--nav-h);
  z-index: 16;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.35rem;
  padding: 0.4rem 0.5rem calc(env(safe-area-inset-bottom) + 0.35rem);
  background: rgba(15, 22, 40, 0.85);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(20px) saturate(1.2);
  -webkit-backdrop-filter: blur(20px) saturate(1.2);
  box-shadow: 0 -1px 12px rgba(0, 0, 0, 0.2);
}

.bottom-nav button {
  border: none;
  border-radius: var(--r-sm);
  min-height: 2.6rem;
  padding: 0.25rem 0;
  background: transparent;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  box-shadow: none;
}

.bottom-nav button:hover {
  background: rgba(255, 255, 255, 0.06);
  transform: none;
  box-shadow: none;
}

.nav-svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-icon { font-size: 1.1rem; line-height: 1; }
.nav-label { font-size: 0.65rem; font-weight: 600; line-height: 1; }

.bottom-nav button.active {
  background: rgba(61, 163, 99, 0.12);
  color: var(--brand);
}

.bottom-nav button.active .nav-svg {
  stroke-width: 2.2;
}

/* Center "Log" button — raised FAB style */
.bottom-nav .nav-center {
  position: relative;
  background: linear-gradient(135deg, var(--brand-2), var(--brand-dark));
  color: #fff;
  border-radius: var(--r-md);
  margin-top: -8px;
  box-shadow: 0 4px 16px rgba(45, 138, 80, 0.3);
}

.bottom-nav .nav-center:hover {
  box-shadow: 0 6px 20px rgba(45, 138, 80, 0.4);
  transform: translateY(-2px);
}

.bottom-nav .nav-center.active {
  background: linear-gradient(135deg, var(--brand-2), var(--brand-dark));
  color: #fff;
}

.bottom-nav .nav-center .nav-svg {
  stroke: #fff;
  stroke-width: 2.5;
}

.bottom-nav button:focus-visible {
  outline: 2px solid var(--brand-2);
  outline-offset: 2px;
}

/* ═══════════════════════════════════════
   SETTINGS / PROFILE SHEET
   ═══════════════════════════════════════ */
.settings-backdrop {
  position: fixed;
  inset: 0;
  z-index: 17;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.settings-sheet {
  position: fixed;
  left: 50%;
  top: calc(var(--bar-h) + 0.5rem);
  bottom: calc(var(--nav-h) + 0.5rem);
  transform: translateX(-50%);
  width: min(calc(100vw - 1rem), calc(var(--shell-w) - 1rem));
  z-index: 18;
  border-radius: var(--r-lg);
  background: rgba(20, 30, 50, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--shadow-lg);
  overflow-y: auto;
}

.settings-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.settings-head h2 { margin: 0; }
.settings-head .muted { margin: 0; font-size: 0.8rem; }

.settings-head .icon-btn {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.1);
  color: var(--muted);
}

.settings-grid {
  display: grid;
  gap: 0.5rem;
}

.profile-form { margin-top: 0.75rem; }

.profile-utility {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.message {
  min-height: 1.2rem;
  font-weight: 600;
  color: var(--brand);
  font-size: 0.85rem;
}

/* ═══════════════════════════════════════
   TABLES
   ═══════════════════════════════════════ */
.table-scroll {
  display: block;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y;
  overscroll-behavior-x: contain;
}

.h-scroll-frame {
  display: block;
  width: 100%;
  min-width: 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.standings-table {
  width: 100%;
  min-width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 0.84rem;
}

.standings-table th, .standings-table td,
th, td {
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  text-align: left;
  vertical-align: top;
  padding: 0.45rem 0.5rem;
}

.standings-table th, th {
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Compact numeric columns for standings */
.col-num {
  text-align: center;
  width: 3rem;
  min-width: 2.2rem;
  max-width: 3.5rem;
}

.compact-stats { min-width: auto !important; width: 100%; table-layout: fixed; }

/* Zebra row banding */
.standings-table tbody tr:nth-child(even) td,
table tbody tr:nth-child(even) td {
  background: rgba(255, 255, 255, 0.02);
}

.standings-table tbody tr:hover td,
table tbody tr:hover td {
  background: rgba(255, 255, 255, 0.04);
}

#summary-output .table-scroll {
  display: block;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y;
  overscroll-behavior-x: contain;
}

#summary-output .standings-table { width: 100%; min-width: 100%; table-layout: fixed; }
#summary-output .playoff-board { width: max-content; min-width: 980px; }
#tournament-summary.card,
#tournament-summary.glass-card { overflow: visible; }
#summary-output { overflow: visible; }
#summary-output > * { min-width: 0; }

.rank-pill {
  display: inline-block;
  background: rgba(56, 189, 248, 0.12);
  color: var(--accent);
  border-radius: var(--r-pill);
  padding: 0.1rem 0.45rem;
  min-width: 2rem;
  text-align: center;
  font-weight: 700;
  font-size: 0.8rem;
}

.champion-row td {
  background: linear-gradient(135deg, rgba(250, 204, 21, 0.08), rgba(245, 158, 11, 0.05));
}

.summary-snapshot {
  display: grid;
  grid-template-columns: repeat(2, minmax(120px, 1fr));
  gap: 0.45rem;
}

.snapshot-item {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--r-sm);
  padding: 0.5rem;
}

.snapshot-item span {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 500;
}

.snapshot-item strong {
  font-size: 0.95rem;
  color: var(--ink);
}

.summary-actions { margin: 0.42rem 0 0.8rem; }

.summary-section {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--r-md);
  padding: 0.65rem;
  background: rgba(255, 255, 255, 0.04);
  min-width: 0;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
  margin-bottom: 0.4rem;
}

.section-head h4 { margin: 0; }

.section-head-actions {
  display: inline-flex;
  gap: 0.3rem;
}

.section-icon-btn {
  width: 2rem;
  min-height: 2rem;
  border-radius: 50%;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
  font-weight: 700;
  white-space: nowrap;
  box-shadow: none;
}

.share-btn { color: var(--brand); }
.export-btn { color: var(--brand); }

/* ═══════════════════════════════════════
   PODIUM / BRACKETS
   ═══════════════════════════════════════ */
.podium-wrap {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 0.3rem;
  touch-action: pan-x pan-y;
  overscroll-behavior-x: contain;
}

.podium-card {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.35rem;
  border-radius: var(--r-md);
  padding: 0.55rem;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.05);
  flex: 1 1 140px;
  min-width: 120px;
}

.podium-card.gold {
  background: linear-gradient(145deg, rgba(250, 204, 21, 0.1), rgba(255, 255, 255, 0.04));
  border-color: rgba(250, 204, 21, 0.25);
}

.podium-card.silver {
  background: linear-gradient(145deg, rgba(148, 163, 184, 0.1), rgba(255, 255, 255, 0.04));
  border-color: rgba(148, 163, 184, 0.2);
}

.podium-card.bronze {
  background: linear-gradient(145deg, rgba(194, 120, 62, 0.08), rgba(255, 255, 255, 0.04));
  border-color: rgba(194, 120, 62, 0.2);
}

.podium-avatar {
  width: 2.6rem;
  height: 2.6rem;
  margin: 0 auto 0.3rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 1.1rem;
  font-weight: 800;
}

.podium-name { font-weight: 700; font-size: 0.88rem; }
.podium-stat { font-size: 0.72rem; color: var(--muted); }

/* ── Playoff Board (inverted staircase table) ── */
.playoff-board {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 5px;
  font-size: 0.82rem;
  min-width: 760px;
}

.playoff-board th {
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  color: var(--muted);
  padding: 0.3rem 0.4rem;
  border: none;
  background: transparent;
}

.playoff-board td {
  padding: 0.18rem 0.32rem;
  border: none;
}

.board-chip {
  display: inline-block;
  border-radius: 8px;
  padding: 0.16rem 0.42rem;
  font-size: 0.78rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink-2);
  white-space: nowrap;
}

.board-chip.seed {
  background: rgba(56, 189, 248, 0.1);
  border-color: rgba(56, 189, 248, 0.25);
  color: var(--accent);
}

.board-chip.win {
  background: rgba(74, 222, 128, 0.1);
  border-color: rgba(74, 222, 128, 0.25);
  color: var(--success);
}

.board-chip.drop {
  background: rgba(251, 191, 36, 0.1);
  border-color: rgba(251, 191, 36, 0.25);
  color: var(--warning);
}

.board-chip.loss {
  background: rgba(248, 113, 113, 0.08);
  border-color: rgba(248, 113, 113, 0.2);
  color: rgba(248, 113, 113, 0.7);
  opacity: 0.88;
  text-decoration: line-through;
}

.board-chip.runner {
  background: rgba(129, 140, 248, 0.1);
  border-color: rgba(129, 140, 248, 0.25);
  color: var(--accent-2);
}

.board-chip.bye {
  background: rgba(56, 189, 248, 0.06);
  border-color: rgba(56, 189, 248, 0.15);
  color: rgba(56, 189, 248, 0.6);
}

.board-chip.champ {
  background: linear-gradient(135deg, rgba(250, 204, 21, 0.15), rgba(245, 158, 11, 0.1));
  border-color: rgba(250, 204, 21, 0.35);
  color: #fbbf24;
  font-weight: 700;
}

/* ── Ladder stages (knockout / non-table playoff) ── */
.ladder-wrap {
  display: flex;
  gap: 0.42rem;
  align-items: stretch;
  flex-wrap: wrap;
}

.ladder-stage {
  flex: 1 1 210px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--r-sm);
  background: rgba(255, 255, 255, 0.04);
  padding: 0.52rem;
}

.ladder-stage.done {
  background: rgba(61, 163, 99, 0.08);
  border-color: rgba(61, 163, 99, 0.2);
}

.ladder-stage h5 {
  margin: 0 0 0.32rem;
  font-size: 0.88rem;
}

.ladder-stage p {
  margin: 0.22rem 0;
  font-size: 0.83rem;
}

.ladder-arrow {
  align-self: center;
  color: var(--muted);
  font-size: 1.26rem;
}

/* ── Bracket (generic) ── */
.playoff-round {
  display: grid;
  gap: 0.55rem;
  min-width: 180px;
}

.playoff-round h5 { font-size: 0.76rem; color: var(--muted); }

.bracket-match {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--r-sm);
  padding: 0.4rem;
  background: rgba(255, 255, 255, 0.05);
  font-size: 0.82rem;
}

.bracket-player {
  display: flex;
  justify-content: space-between;
  padding: 0.2rem 0;
}

.bracket-player.winner { font-weight: 700; color: var(--brand); }

/* ═══════════════════════════════════════
   TOAST
   ═══════════════════════════════════════ */
.app-toast {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  top: calc(var(--bar-h) + 0.5rem);
  width: min(calc(100vw - 1.2rem), calc(var(--shell-w) - 1.2rem));
  z-index: 20;
  background: rgba(20, 30, 50, 0.94);
  color: var(--ink);
  border: 1px solid rgba(61, 163, 99, 0.2);
  border-left: 3px solid var(--brand);
  border-radius: var(--r-md);
  padding: 0.75rem 1rem;
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  box-shadow: var(--shadow-lg);
  font-size: 0.88rem;
  font-weight: 600;
  animation: toastSlide 300ms var(--ease-out);
}

.app-toast.error {
  background: rgba(30, 15, 15, 0.95);
  color: var(--danger);
  border-color: rgba(248, 113, 113, 0.25);
}

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

/* ═══════════════════════════════════════
   KNOCKOUT SUMMARY CARDS
   ═══════════════════════════════════════ */
.ko-bracket {
  display: grid;
  gap: 0.5rem;
}

.ko-match-card {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.04);
  padding: 0.65rem 0.75rem;
  transition: all 200ms ease;
}

.ko-match-card.final {
  border-color: rgba(250, 204, 21, 0.25);
  background: linear-gradient(135deg, rgba(250, 204, 21, 0.06), rgba(255, 255, 255, 0.03));
}

.ko-match-card.bronze {
  border-color: rgba(194, 120, 62, 0.25);
  background: linear-gradient(135deg, rgba(194, 120, 62, 0.06), rgba(255, 255, 255, 0.03));
}

.ko-match-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.45rem;
}

.ko-stage-icon {
  font-size: 0.9rem;
}

.ko-stage-name {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.ko-match-players {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
}

.ko-player {
  flex: 1;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink-2);
}

.ko-player.winner {
  color: var(--brand);
  font-weight: 800;
}

.ko-player:last-child {
  text-align: right;
}

.ko-score {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
  padding: 0.15rem 0.5rem;
  border-radius: var(--r-sm);
  background: rgba(255, 255, 255, 0.06);
}

.ko-match-result {
  margin-top: 0.3rem;
  font-size: 0.72rem;
  color: var(--brand);
  font-weight: 600;
}

.ko-seeding {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-bottom: 0.5rem;
}

.ko-seed-chip {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: var(--r-pill);
  font-size: 0.72rem;
  font-weight: 600;
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.15);
  color: var(--accent);
}

.ko-bronze-prompt {
  margin-top: 0.75rem;
  padding: 0.85rem;
  border-radius: var(--r-md);
  background: rgba(194, 120, 62, 0.06);
  border: 1px solid rgba(194, 120, 62, 0.2);
  text-align: center;
}

.ko-bronze-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
}

/* ═══════════════════════════════════════
   HEAD-TO-HEAD WIDGET
   ═══════════════════════════════════════ */
.h2h-widget {
  display: grid;
  gap: 1rem;
}

/* Face-off header */
.h2h-faceoff {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.h2h-player-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  flex: 1;
}

.h2h-avatar {
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, rgba(61, 163, 99, 0.2), rgba(61, 163, 99, 0.1));
  border: 2px solid rgba(61, 163, 99, 0.3);
  color: var(--brand);
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: -0.02em;
}

.h2h-name {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--ink);
  text-align: center;
}

.h2h-vs {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
}

.h2h-vs-badge {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--r-pill);
  padding: 0.2rem 0.6rem;
}

.h2h-matches-count {
  font-size: 0.7rem;
  color: var(--muted);
}

/* Win comparison bar */
.h2h-bar-section {
  display: grid;
  gap: 0.35rem;
}

.h2h-bar-labels {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  font-weight: 600;
}

.h2h-win-count {
  color: var(--muted);
}

.h2h-win-count.leading {
  color: var(--brand);
}

.h2h-draw-count {
  font-size: 0.72rem;
  color: var(--muted);
}

.h2h-bar {
  display: flex;
  height: 8px;
  border-radius: var(--r-pill);
  overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
  gap: 2px;
}

.h2h-bar-p1 {
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
  border-radius: var(--r-pill);
  min-width: 4px;
  transition: width 400ms var(--ease-out);
}

.h2h-bar-p2 {
  background: linear-gradient(90deg, var(--accent), #60a5fa);
  border-radius: var(--r-pill);
  min-width: 4px;
  transition: width 400ms var(--ease-out);
}

.h2h-dominance {
  text-align: center;
  font-size: 0.78rem;
  color: var(--muted);
  font-style: italic;
}

/* Stats row */
.h2h-stats-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.5rem;
  padding: 0.65rem;
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.h2h-stat {
  text-align: left;
}

.h2h-stat.center {
  text-align: center;
}

.h2h-stat.right {
  text-align: right;
}

.h2h-stat strong {
  display: block;
  font-size: 1.05rem;
  color: var(--ink);
  font-weight: 800;
}

.h2h-stat span {
  font-size: 0.68rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}

/* Match history */
.h2h-history {
  display: grid;
  gap: 0.35rem;
}

.h2h-history-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 0.15rem;
}

.h2h-match-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.45rem 0.6rem;
  border-radius: var(--r-sm);
  background: rgba(255, 255, 255, 0.03);
  border-left: 3px solid rgba(255, 255, 255, 0.08);
  font-size: 0.82rem;
}

.h2h-match-row.p1-win {
  border-left-color: var(--brand);
  background: rgba(61, 163, 99, 0.04);
}

.h2h-match-row.p2-win {
  border-left-color: var(--accent);
  background: rgba(56, 189, 248, 0.04);
}

.h2h-match-row.draw {
  border-left-color: var(--warning);
}

.h2h-match-date {
  color: var(--muted);
  font-size: 0.75rem;
  flex-shrink: 0;
}

.h2h-match-score {
  font-weight: 800;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.h2h-match-result {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  text-align: right;
  flex-shrink: 0;
}

.h2h-match-row.p1-win .h2h-match-result { color: var(--brand); }
.h2h-match-row.p2-win .h2h-match-result { color: var(--accent); }

/* ═══════════════════════════════════════
   MISC / COMPAT
   ═══════════════════════════════════════ */
.info-tip {
  display: inline-grid;
  place-items: center;
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  font-size: 0.65rem;
  background: rgba(61, 163, 99, 0.1);
  color: var(--brand);
  border: 1px solid rgba(61, 163, 99, 0.25);
  cursor: help;
  vertical-align: middle;
}

.flow-list {
  margin: 0.5rem 0 0;
  padding-left: 1rem;
  color: var(--muted);
  display: grid;
  gap: 0.25rem;
}

/* v22 compat classes */
.banner-card { /* absorbed into glass-card */ }
.premium-home { position: relative; overflow: hidden; padding: 0.65rem 0.75rem; }
.premium-home::after { display: none; }
.home-brand-logo { display: block; width: min(100%, 520px); max-width: 100%; max-height: 142px; height: auto; margin: -0.3rem auto 0.15rem; object-fit: contain; filter: drop-shadow(0 2px 12px rgba(78, 184, 126, 0.15)); }
.home-cta { margin-top: 0.3rem; display: flex; justify-content: center; }
.home-play-btn { width: auto; min-width: min(72vw, 252px); border-radius: var(--r-pill); min-height: 2.75rem; padding: 0.7rem 1.35rem; }
.tips-card h3 { margin: 0; }
.auth-card { /* absorbed into auth-glass-card */ }
.persona-shell { display: grid; gap: 0.35rem; margin-bottom: 0.75rem; }

.roller-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}

.group-roller-row div { display: flex; flex-direction: column; gap: 0.2rem; }

/* Persona toggle (hidden but functional) */
#persona-toggle { }
#persona-note { }

/* Auth card compat (v22 classes that may be referenced) */
.auth-progress {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.45rem;
  margin-bottom: 0.9rem;
}

.auth-progress-dot {
  min-height: 8px;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.12);
}

.auth-progress-dot.active {
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
}

.auth-step-pane { display: grid; gap: 0.6rem; }
.auth-kicker { margin: 0; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted-light); }
.auth-inline-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }
.otp-preview { display: flex; align-items: center; justify-content: space-between; gap: 0.8rem; padding: 0.75rem 0.85rem; border-radius: var(--r-md); border: 1px solid rgba(61, 163, 99, 0.2); background: rgba(61, 163, 99, 0.06); }
.otp-preview strong { font-size: 1.15rem; letter-spacing: 0.18em; color: var(--brand); }

#auth-message.error { color: var(--danger); }

/* Home stats card compat */
.home-stats-card { }

/* ═══════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════ */
@media (max-width: 380px) {
  .auth-glass-card { padding: 1.5rem 1rem; }
  .auth-glass-card h1 { font-size: 1.45rem; }
  .welcome-screen h1 { font-size: 1.65rem; }
  .two-col { grid-template-columns: 1fr; }
  .pill-row { gap: 0.35rem; }
  .pill { min-width: 60px; font-size: 0.8rem; }
  .stepper-btn { width: 36px; height: 36px; min-width: 36px; min-height: 36px; font-size: 1.1rem; }
  .stepper-val { font-size: 1.6rem; min-width: 32px; }
  .score-stepper { gap: 0.4rem; }
  .score-stepper-card { padding: 0.5rem 0.25rem; }
}

@media (min-width: 600px) {
  .auth-glass-card { padding: 2.5rem 2rem; }
}

/* Smooth scrollbar */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.12); border-radius: var(--r-pill); }

/* Focus visible for accessibility */
*:focus-visible {
  outline: 2px solid var(--brand-2);
  outline-offset: 2px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* Print */
@media print {
  .app-bar, .bottom-nav, .settings-backdrop, .settings-sheet,
  .splash-screen, .auth-gate { display: none !important; }
  .app-main { padding: 0; }
  .glass-card, .card { box-shadow: none; border: 1px solid #ddd; }
}

/* ════════════════════════════════════════════════════════════
   CHALLENGES
   ════════════════════════════════════════════════════════════ */

/* Stats banner */
.challenge-stats-banner { padding: 1rem; }
.challenge-stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  text-align: center;
}
.cstat { display: flex; flex-direction: column; gap: 0.15rem; }
.cstat-val {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--brand);
}
.cstat-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

/* Filter bar */
.challenge-filter-bar {
  display: flex;
  gap: 0.4rem;
  padding: 0.25rem 0 0.75rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.challenge-pill {
  padding: 0.4rem 0.9rem;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.04);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}
.challenge-pill.active {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}

/* Challenge card */
.challenge-card {
  padding: 1rem;
  border-left: 3px solid rgba(255,255,255,0.1);
  transition: border-color 0.2s;
}
.challenge-card.status-open { border-left-color: var(--brand); }
.challenge-card.status-accepted { border-left-color: #3b82f6; }
.challenge-card.status-pending { border-left-color: #f59e0b; }
.challenge-card.status-won { border-left-color: #22c55e; }
.challenge-card.status-lost { border-left-color: #ef4444; }
.challenge-card.status-declined,
.challenge-card.status-expired { border-left-color: rgba(255,255,255,0.06); opacity: 0.7; }

.challenge-card-top {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.challenge-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(111, 141, 69, 0.25);
  color: var(--brand);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}
.challenge-card-info { flex: 1; min-width: 0; }
.challenge-card-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--ink);
}
.challenge-vs { color: #f59e0b; }
.challenge-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  margin-top: 0.2rem;
}
.challenge-username {
  color: var(--muted);
  font-size: 0.78rem;
}
.challenge-format-chip {
  font-size: 0.72rem;
  padding: 0.1rem 0.5rem;
  border-radius: 10px;
  background: rgba(255,255,255,0.06);
  color: var(--muted);
}
.challenge-time {
  font-size: 0.72rem;
  color: var(--muted);
}
.challenge-status-pill {
  font-size: 0.72rem;
  padding: 0.2rem 0.6rem;
  border-radius: 12px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}
.challenge-status-pill.status-open { background: rgba(111,141,69,0.2); color: var(--brand); }
.challenge-status-pill.status-accepted { background: rgba(59,130,246,0.2); color: #60a5fa; }
.challenge-status-pill.status-pending { background: rgba(245,158,11,0.2); color: #fbbf24; }
.challenge-status-pill.status-won { background: rgba(34,197,94,0.2); color: #4ade80; }
.challenge-status-pill.status-lost { background: rgba(239,68,68,0.2); color: #f87171; }
.challenge-status-pill.status-declined,
.challenge-status-pill.status-expired { background: rgba(255,255,255,0.06); color: var(--muted); }

.challenge-message {
  margin: 0.5rem 0 0;
  font-style: italic;
  color: var(--muted);
  font-size: 0.85rem;
  padding-left: 3.25rem;
}
.challenge-result {
  text-align: center;
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0.5rem 0 0;
  color: var(--ink);
}
.challenge-score-preview {
  width: 100%;
  text-align: center;
  font-size: 1.25rem;
  font-weight: 700;
  color: #fbbf24;
  margin-bottom: 0.25rem;
}
.challenge-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
  padding-left: 3.25rem;
  flex-wrap: wrap;
  align-items: center;
}
.btn-accept {
  flex: 1;
  padding: 0.5rem;
  border-radius: 10px;
  background: var(--brand);
  color: #fff;
  font-weight: 600;
  border: none;
  cursor: pointer;
}
.btn-decline {
  padding: 0.5rem 1rem;
  border-radius: 10px;
  background: rgba(255,255,255,0.06);
  color: var(--muted);
  font-weight: 500;
  border: 1px solid rgba(255,255,255,0.1);
  cursor: pointer;
}
.btn-muted {
  padding: 0.5rem 1rem;
  border-radius: 10px;
  background: rgba(255,255,255,0.04);
  color: var(--muted);
  font-size: 0.82rem;
  border: 1px solid rgba(255,255,255,0.08);
  cursor: pointer;
}
.btn-brand {
  padding: 0.6rem 1.2rem;
  border-radius: 12px;
  background: var(--brand);
  color: #fff;
  font-weight: 600;
  border: none;
  cursor: pointer;
  width: 100%;
  font-size: 0.95rem;
}

/* Empty state */
.challenge-empty-state {
  text-align: center;
  padding: 2.5rem 1.5rem;
}
.challenge-empty-icon {
  font-size: 3rem;
  margin-bottom: 0.75rem;
}
.challenge-empty-state h3 {
  margin: 0 0 0.25rem;
  color: var(--ink);
}
.challenge-empty-state .btn-brand {
  margin-top: 1rem;
  width: auto;
  display: inline-block;
}

/* FAB */
.challenge-fab {
  position: fixed;
  bottom: calc(var(--nav-h) + 20px);
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  border: none;
  box-shadow: 0 4px 20px rgba(111, 141, 69, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 90;
  transition: transform 0.2s, box-shadow 0.2s;
}
.challenge-fab:active { transform: scale(0.92); }

/* Challenge create sheet */
.challenge-create-sheet { z-index: 210; }

/* Notification bell */
.notif-bell {
  position: relative;
  background: none;
  border: none;
  color: rgba(255,255,255,0.7);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 50%;
  transition: background 0.2s;
}
.notif-bell:hover { background: rgba(255,255,255,0.06); }
.notif-bell svg { width: 22px; height: 22px; }
.notif-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  background: #ef4444;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

/* Notification drawer */
.notif-drawer { z-index: 210; }
.notif-card {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 0.75rem;
  cursor: pointer;
  transition: background 0.2s;
}
.notif-card:hover { background: rgba(255,255,255,0.04); }
.notif-card.notif-read { opacity: 0.55; }
.notif-icon { font-size: 1.5rem; flex-shrink: 0; }
.notif-body { flex: 1; }
.notif-body strong { color: var(--ink); font-size: 0.9rem; }
.notif-body p { margin: 0.15rem 0 0; font-size: 0.82rem; }

/* Player search */
.player-search-sheet { z-index: 210; }
.search-result-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem;
  gap: 0.75rem;
}
.search-result-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
  min-width: 0;
}

/* Player profile */
.player-profile-sheet { z-index: 220; }
.profile-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  text-align: center;
  padding: 0.5rem 0;
}
.profile-detail-rows { display: flex; flex-direction: column; gap: 0.5rem; }
.profile-detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

/* Username input */
.username-input-wrap {
  display: flex;
  align-items: center;
  background: rgba(255,255,255,0.07);
  border-radius: var(--r-md);
  border: 1px solid rgba(255,255,255,0.1);
  overflow: hidden;
}
.username-prefix {
  padding: 0.5rem 0 0.5rem 0.75rem;
  color: var(--brand);
  font-weight: 700;
  font-size: 1rem;
  flex-shrink: 0;
}
.username-input-wrap input {
  border: none;
  background: transparent;
  flex: 1;
  padding: 0.5rem 0.75rem 0.5rem 0.25rem;
  color: var(--ink);
  font-size: 0.95rem;
}
.username-input-wrap input:focus { outline: none; }
.auth-hint {
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 0.25rem;
  transition: color 0.2s;
}
.auth-hint-ok {
  color: #4ade80;
}
.auth-hint-error {
  color: #f87171;
}

/* App bar adjustments for notification bell */
.app-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.app-bar-brand { flex: 1; }

/* ──── v52: Challenge tier badge ──── */
.challenge-tier-badge {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  border-radius: var(--r-pill);
  background: rgba(129, 140, 248, 0.2);
  color: #a78bfa;
  vertical-align: middle;
}

/* ──── v52: Games progress in challenge card ──── */
.challenge-games-progress {
  font-size: 0.78rem;
  color: var(--muted-light);
  margin-bottom: 0.25rem;
}
.challenge-games-list {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  margin-bottom: 0.4rem;
}
.game-chip {
  padding: 0.15rem 0.5rem;
  font-size: 0.7rem;
  border-radius: var(--r-pill);
  background: var(--glass);
  border: 1px solid var(--glass-border);
  color: var(--ink-2);
}

/* ──── v52: Derived age display ──── */
.derived-age-display {
  display: inline-block;
  padding: 0.5rem 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
}

/* ──── v52: Player card improvements ──── */
.player-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.player-actions {
  display: flex;
  gap: 0.25rem;
  align-items: center;
  flex-shrink: 0;
}
.player-actions .tiny {
  padding: 0.25rem 0.5rem;
  font-size: 0.72rem;
}
.avatar-linked {
  box-shadow: 0 0 0 2px var(--brand);
}

/* ──── v52: Admin dashboard ──── */
.admin-section {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}
.admin-head h3 {
  margin: 0 0 0.15rem;
  font-size: 1rem;
}
.admin-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-top: 0.5rem;
}
.admin-stat-card {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-sm);
  padding: 0.6rem 0.5rem;
  text-align: center;
}
.admin-stat-val {
  display: block;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--brand);
}
.admin-stat-label {
  display: block;
  font-size: 0.7rem;
  color: var(--muted);
  margin-top: 0.1rem;
}

/* ──── v52: notif-read styling ──── */
.notif-read {
  opacity: 0.55;
}

/* ──── v52: Challenge score preview ──── */
.challenge-score-preview {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent);
  padding: 0.25rem 0;
}
