/* ============================================================
   FIFA Cards 2026 — Complete Design System
   Dark mode, gold accents, mobile-first
   ============================================================ */

/* ── Google Fonts Fallback ──────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800;900&family=Inter:wght@400;500;600&display=swap');

/* ── Design Tokens ──────────────────────────────────────────── */
:root {
  /* Backgrounds */
  --bg-primary:     #080c14;
  --bg-secondary:   #0f1624;
  --bg-elevated:    #1a2234;
  --bg-glass:       rgba(255, 255, 255, 0.04);
  --bg-glass-hover: rgba(255, 255, 255, 0.07);

  /* Gold */
  --gold:           #dbb04a;
  --gold-bright:    #f5c842;
  --gold-dim:       rgba(219, 176, 74, 0.15);
  --gold-glow:      rgba(219, 176, 74, 0.35);

  /* Status Colors */
  --green:          #22c55e;
  --green-dim:      rgba(34, 197, 94, 0.15);
  --blue:           #3b82f6;
  --blue-dim:       rgba(59, 130, 246, 0.12);
  --red:            #ef4444;
  --fifa-red:       #ef4444;
  --red-dim:        rgba(239, 68, 68, 0.12);
  --purple:         #a855f7;

  /* Typography */
  --text-primary:   #f0f6fc;
  --text-secondary: #8b9ab0;
  --text-muted:     #4a5568;

  /* Borders */
  --border:         rgba(255, 255, 255, 0.06);
  --border-gold:    rgba(219, 176, 74, 0.4);

  /* Spacing */
  --nav-height:     64px;
  --page-pad:       16px;
  --radius-sm:      8px;
  --radius-md:      12px;
  --radius-lg:      18px;
  --radius-xl:      24px;
  --radius-full:    9999px;

  /* Typography Scale */
  --font-display:   'Outfit', system-ui, sans-serif;
  --font-body:      'Inter', system-ui, sans-serif;

  /* 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; margin: 0; padding: 0; }

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; }
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; border: none; outline: none; background: none; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }

/* ── Utilities ──────────────────────────────────────────────── */
.app-hidden   { display: none !important; }
.gold         { color: var(--gold); }
.text-muted   { color: var(--text-secondary); }
.sr-only      { position: absolute; width: 1px; height: 1px; clip: rect(0,0,0,0); overflow: hidden; }

/* ── Loading Screen ─────────────────────────────────────────── */
#loading-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

#loading-screen.fade-out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loading-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.loading-ball {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  animation: ballBounce 1.2s var(--ease-spring) infinite alternate;
  filter: drop-shadow(0 8px 20px rgba(219,176,74,0.4));
}

.loading-title {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--text-primary), var(--gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.loading-year {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  color: var(--gold);
  letter-spacing: 4px;
  text-transform: uppercase;
  opacity: 0.8;
}

.loading-bar {
  width: 160px;
  height: 3px;
  background: var(--border);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-top: 8px;
}

.loading-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold), var(--gold-bright));
  border-radius: var(--radius-full);
  animation: loadBar 1.4s ease-in-out infinite;
}

@keyframes ballBounce {
  from { transform: translateY(0) rotate(-10deg); }
  to   { transform: translateY(-16px) rotate(10deg); }
}

@keyframes loadBar {
  0%   { width: 0%; margin-left: 0%; }
  50%  { width: 70%; margin-left: 15%; }
  100% { width: 0%; margin-left: 100%; }
}

/* ── Page Shell ─────────────────────────────────────────────── */
#app {
  min-height: 100dvh;
  padding-bottom: calc(var(--nav-height) + env(safe-area-inset-bottom, 0px));
}

/* ── Page Transitions ───────────────────────────────────────── */
.page-exit  { animation: pageExit  0.18s ease forwards; }
.page-enter { animation: pageEnter 0.28s var(--ease-out) forwards; }

@keyframes pageExit  { to { opacity: 0; transform: translateY(8px); } }
@keyframes pageEnter { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* ── Bottom Navigation ──────────────────────────────────────── */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: var(--nav-height);
  background: rgba(10, 14, 26, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0 8px;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  flex: 1;
  padding: 8px 4px;
  color: var(--text-muted);
  transition: color 0.2s ease;
  min-height: 44px;
  justify-content: center;
}

.nav-item .nav-icon { width: 22px; height: 22px; transition: transform 0.2s var(--ease-spring); }
.nav-item img.nav-icon { border-radius: 50%; object-fit: cover; }
.nav-label { font-size: 10px; font-weight: 500; letter-spacing: 0.3px; }

.nav-item.active { color: var(--gold); }
.nav-item.active .nav-icon { transform: scale(1.15); }

.nav-item--scan { position: relative; }

.scan-fab {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--gold), var(--gold-bright));
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: -20px;
  box-shadow: 0 4px 20px rgba(219,176,74,0.45);
  transition: transform 0.2s var(--ease-spring), box-shadow 0.2s ease;
}

.scan-fab .nav-icon { width: 24px; height: 24px; color: #080c14; }
.nav-item--scan:active .scan-fab { transform: scale(0.92); }
.nav-item--scan.active .nav-label { color: var(--gold); }

/* ── Auth Pages ─────────────────────────────────────────────── */
.auth-wrapper {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px var(--page-pad);
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(219,176,74,0.12) 0%, transparent 70%),
    var(--bg-primary);
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 36px 28px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.5);
}

.auth-logo {
  text-align: center;
  margin-bottom: 32px;
}

.auth-ball {
  font-size: 48px;
  margin-bottom: 12px;
  filter: drop-shadow(0 4px 16px rgba(219,176,74,0.4));
  animation: ballBounce 2s var(--ease-spring) infinite alternate;
}

.auth-title {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.auth-title .gold { background: linear-gradient(135deg, var(--gold), var(--gold-bright)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.auth-subtitle { color: var(--text-secondary); font-size: 0.875rem; margin-top: 4px; }

/* ── Forms ──────────────────────────────────────────────────── */
.auth-form { display: flex; flex-direction: column; gap: 16px; }

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-group input {
  height: 48px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0 16px;
  color: var(--text-primary);
  font-size: 1rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-group input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-dim);
}

.form-group input::placeholder { color: var(--text-muted); }

.form-error {
  font-size: 0.8rem;
  color: var(--red);
  margin-top: 2px;
}

/* ── Buttons ─────────────────────────────────────────────────── */
.btn-primary {
  height: 52px;
  background: linear-gradient(135deg, var(--gold), var(--gold-bright));
  color: #080c14;
  font-weight: 700;
  font-size: 1rem;
  border-radius: var(--radius-md);
  transition: transform 0.15s var(--ease-spring), box-shadow 0.15s ease, opacity 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 44px;
  min-height: 44px;
  white-space: nowrap;
}

.btn-primary:hover  { transform: translateY(-1px); box-shadow: 0 6px 20px var(--gold-glow); }
.btn-primary:active { transform: scale(0.97); }
.btn-primary:disabled { opacity: 0.55; transform: none; box-shadow: none; cursor: not-allowed; }
.btn-full { width: 100%; }

.btn-ghost {
  height: 44px;
  padding: 0 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.9rem;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
}

.btn-ghost:hover { border-color: var(--gold); color: var(--gold); background: var(--gold-dim); }

.btn-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--bg-glass);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, border-color 0.2s;
  flex-shrink: 0;
}
.btn-icon:hover  { background: var(--bg-glass-hover); border-color: var(--gold); }
.btn-icon svg    { width: 20px; height: 20px; }
.btn-icon:active { transform: scale(0.93); }

.auth-switch {
  text-align: center;
  margin-top: 20px;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.auth-switch a {
  color: var(--gold);
  font-weight: 600;
  transition: opacity 0.2s;
}
.auth-switch a:hover { opacity: 0.8; }

/* ── Page Header ─────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px var(--page-pad) 12px;
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(8, 12, 20, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.page-header h1 {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  flex: 1;
}

.page-header .page-badge {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  background: var(--gold-dim);
  color: var(--gold);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-gold);
}

/* ── Dashboard ───────────────────────────────────────────────── */
.dashboard-hero {
  padding: 36px var(--page-pad) 16px;
  background: linear-gradient(180deg, rgba(219,176,74,0.06) 0%, transparent 100%);
}

.dashboard-greeting {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.dashboard-name {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.3px;
  color: var(--text-primary);
}

/* Progress Bar */
.progress-wrap {
  margin-top: 20px;
  padding: 16px;
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
}

.progress-wrap:hover {
  transform: translateY(-2px);
  border-color: var(--gold);
  box-shadow: 0 4px 12px rgba(219, 176, 74, 0.15);
}

.progress-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
}

.progress-label span:first-child { font-size: 0.8rem; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; }
.progress-pct { font-family: var(--font-display); font-size: 1.4rem; font-weight: 800; color: var(--gold); }

.progress-track {
  height: 8px;
  background: var(--bg-secondary);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold), var(--gold-bright));
  border-radius: var(--radius-full);
  transition: width 1.2s var(--ease-out);
  box-shadow: 0 0 8px rgba(219,176,74,0.4);
}

/* Stat Pills */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 0 var(--page-pad) 20px;
}

.stat-pill {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: border-color 0.2s, transform 0.2s;
  cursor: pointer;
  text-decoration: none;
}

.stat-pill:hover { border-color: var(--border-gold); transform: translateY(-2px); }

.stat-icon  { font-size: 1.4rem; margin-bottom: 2px; }
.stat-value {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--gold);
  line-height: 1;
}
.stat-label { font-size: 0.68rem; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.4px; text-align: center; }

.stat-pill--green .stat-value { color: var(--green); }
.stat-pill--purple .stat-value { color: var(--purple); }
.stat-pill--orange .stat-value { color: #f97316; }
.stat-pill--gold .stat-value { color: var(--gold-bright); }
.stat-pill--yellow .stat-value { color: #eab308; }

/* Dashboard Section */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px var(--page-pad) 12px;
}

.section-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
}

.section-link {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--gold);
  opacity: 0.8;
  transition: opacity 0.2s;
}
.section-link:hover { opacity: 1; }

/* Quick Team Cards (vertical scroll grid) */
.quick-teams {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 0 var(--page-pad) 24px;
}

.quick-team-card {
  flex-shrink: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  color: var(--text-primary);
  transition: border-color 0.2s, transform 0.2s;
  cursor: pointer;
  min-height: 44px;
}
.quick-team-card:hover   { border-color: var(--border-gold); transform: translateY(-2px); }
.quick-team-card:active  { transform: scale(0.95); }

.quick-team-flag  { font-size: 1.8rem; }
.quick-team-code  { font-family: var(--font-display); font-size: 0.7rem; font-weight: 700; letter-spacing: 0.5px; color: var(--gold); }
.quick-team-name  { font-size: 0.65rem; color: var(--text-secondary); text-align: center; line-height: 1.3; }
.quick-team-prog  { font-size: 0.6rem; font-weight: 600; color: var(--text-muted); }

/* ── Teams Page ──────────────────────────────────────────────── */
.teams-page { padding-bottom: 24px; }

/* Combobox */
.combobox-wrap {
  padding: 12px var(--page-pad);
  position: sticky;
  top: 65px;
  z-index: 40;
  background: rgba(8,12,20,0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.combobox {
  position: relative;
}

.combobox-input-wrap {
  display: flex;
  align-items: center;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0 16px;
  transition: border-color 0.2s, box-shadow 0.2s;
  gap: 10px;
}
.combobox-input-wrap:focus-within { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-dim); }

.combobox-icon { width: 18px; height: 18px; color: var(--text-muted); flex-shrink: 0; }

.combobox-input {
  flex: 1;
  height: 48px;
  background: none;
  color: var(--text-primary);
  font-size: 1rem;
}
.combobox-input::placeholder { color: var(--text-muted); }

.combobox-clear {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  background: var(--bg-glass);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  line-height: 1;
  flex-shrink: 0;
  transition: color 0.2s, background 0.2s;
}
.combobox-clear:hover { color: var(--text-primary); background: var(--bg-glass-hover); }

/* Teams List */
.teams-list { display: flex; flex-direction: column; gap: 0; }

.team-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px var(--page-pad);
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: var(--text-primary);
  transition: background 0.15s;
  min-height: 64px;
  cursor: pointer;
}
.team-row:hover  { background: var(--bg-glass); }
.team-row:active { background: var(--bg-glass-hover); }

.team-row-flag { font-size: 2rem; width: 40px; text-align: center; flex-shrink: 0; }
.team-row-info { flex: 1; min-width: 0; }
.team-row-name { font-weight: 600; font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.team-row-code { font-size: 0.75rem; color: var(--text-secondary); font-weight: 500; margin-top: 2px; }

.team-row-progress {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}
.team-row-count { font-family: var(--font-display); font-size: 0.85rem; font-weight: 700; color: var(--gold); }

.mini-progress {
  width: 48px;
  height: 4px;
  background: var(--border);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.mini-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold), var(--gold-bright));
  border-radius: var(--radius-full);
  transition: width 0.6s var(--ease-out);
}

.team-row-chevron { color: var(--text-muted); width: 18px; height: 18px; flex-shrink: 0; }

.teams-empty {
  padding: 60px var(--page-pad);
  text-align: center;
  color: var(--text-secondary);
}
.teams-empty p:first-child { font-size: 2rem; margin-bottom: 8px; }

/* ── Team Detail Page ────────────────────────────────────────── */
.team-detail { padding-bottom: 24px; }

/* Navigation Header */
.team-nav-header {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0 var(--page-pad);
  height: 64px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(8,12,20,0.9);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.team-nav-arrow {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  transition: color 0.2s, background 0.2s;
  flex-shrink: 0;
  cursor: pointer;
}
.team-nav-arrow:hover  { color: var(--gold); background: var(--gold-dim); }
.team-nav-arrow:active { transform: scale(0.92); }
.team-nav-arrow.disabled { opacity: 0.25; pointer-events: none; }
.team-nav-arrow svg { width: 22px; height: 22px; }

.team-nav-center {
  flex: 1;
  text-align: center;
  padding: 0 8px;
  min-width: 0;
}

.team-nav-flag  { font-size: 1.6rem; }
.team-nav-name  { font-family: var(--font-display); font-size: 1rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.team-nav-code  { font-size: 0.7rem; font-weight: 600; color: var(--gold); letter-spacing: 1px; }

/* Filter Bar */
.filter-bar {
  display: flex;
  gap: 8px;
  padding: 12px var(--page-pad);
  overflow-x: auto;
  scrollbar-width: none;
}
.filter-bar::-webkit-scrollbar { display: none; }

.filter-pill {
  flex-shrink: 0;
  height: 36px;
  padding: 0 16px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  background: var(--bg-glass);
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  white-space: nowrap;
  min-height: 44px;
}
.filter-pill:hover { border-color: var(--gold); color: var(--gold); }
.filter-pill.active { background: var(--gold-dim); border-color: var(--border-gold); color: var(--gold); }

/* Team Info Strip */
.team-info-strip {
  padding: 0 var(--page-pad) 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.team-completion { font-size: 0.8rem; color: var(--text-secondary); }
.team-completion strong { color: var(--gold); }

/* Card Grid */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(75px, 1fr));
  gap: 10px;
  padding: 8px var(--page-pad) 16px;
}

.card-grid.in-modal {
  grid-template-columns: repeat(auto-fill, minmax(68px, 1fr));
  gap: 8px;
  padding: 8px 4px 16px;
}

.card-grid.in-modal .card-slot {
  border-radius: var(--radius-sm);
  padding: 4px 2px;
}

.card-grid.in-modal .card-slot-number {
  top: 4px;
  left: 6px;
  font-size: 0.65rem;
}

.card-grid.in-modal .card-slot-type-icon {
  font-size: 1rem;
}

.card-grid.in-modal .card-slot-code {
  font-size: 0.75rem;
}

.card-grid.in-modal .copy-badge {
  font-size: 0.6rem;
  padding: 1px 4px;
}


/* Card Slot — base */
.card-slot {
  aspect-ratio: 3 / 4;
  border-radius: var(--radius-md);
  position: relative;
  cursor: pointer;
  transition: transform 0.18s var(--ease-spring), box-shadow 0.18s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6px 4px;
  gap: 3px;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  overflow: hidden;
}

.card-slot:active { transform: scale(0.91) !important; }

/* Missing */
.card-slot.missing {
  background: rgba(255,255,255,0.015);
  border: 2px dashed rgba(255,255,255,0.1);
  opacity: 0.55;
}

/* Owned — base */
.card-slot.owned {
  background: linear-gradient(135deg, rgba(219,176,74,0.12), rgba(34,197,94,0.06));
  border: 2px solid rgba(219,176,74,0.55);
  box-shadow: 0 0 14px rgba(219,176,74,0.12);
  opacity: 1;
}
.card-slot.owned:hover { transform: translateY(-3px); box-shadow: 0 6px 22px rgba(219,176,74,0.22); }

/* Foil */
.card-slot.foil {
  background: linear-gradient(135deg, rgba(168,85,247,0.15), rgba(59,130,246,0.12), rgba(219,176,74,0.12));
  border: 2px solid rgba(168,85,247,0.5);
  animation: foilShimmer 4s linear infinite;
}

/* Special */
.card-slot.special {
  background: linear-gradient(135deg, rgba(219,176,74,0.22), rgba(245,200,66,0.08));
  border: 2px solid var(--gold);
  animation: goldPulse 2.5s ease-in-out infinite;
}

/* Friend badge */
.friend-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  background: var(--gold);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 800;
  color: #080c14;
  box-shadow: 0 2px 8px rgba(219,176,74,0.5);
  z-index: 2;
}

.card-slot-number {
  position: absolute;
  top: 5px;
  left: 6px;
  font-size: 0.55rem;
  font-weight: 700;
  color: var(--text-muted);
  font-family: var(--font-display);
}

.card-slot-page {
  position: absolute;
  bottom: 5px;
  left: 5px;
  font-size: 0.5rem;
  font-weight: 700;
  color: var(--text-muted);
  font-family: var(--font-display);
  letter-spacing: 0.3px;
  opacity: 0.75;
}

.card-slot-type-icon { font-size: 1.2rem; }

.card-slot-code {
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.card-slot.owned .card-slot-code { color: var(--gold); }

/* Rarity badge */
.rarity-badge {
  position: absolute;
  bottom: 4px;
  right: 4px;
  font-size: 8px;
  font-weight: 800;
  padding: 1px 4px;
  border-radius: 3px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}
.rarity-badge.foil    { background: rgba(168,85,247,0.25); color: #a855f7; }
.rarity-badge.special { background: rgba(219,176,74,0.25); color: var(--gold); }

/* New card flash animation */
.card-slot.newly-scanned {
  animation: cardFlash 0.6s var(--ease-spring);
}

@keyframes cardFlash {
  0%   { transform: scale(1); box-shadow: 0 0 0 rgba(219,176,74,0); }
  40%  { transform: scale(1.12); box-shadow: 0 0 28px rgba(219,176,74,0.55); }
  100% { transform: scale(1); }
}

@keyframes foilShimmer {
  0%   { filter: hue-rotate(0deg); }
  100% { filter: hue-rotate(360deg); }
}

@keyframes goldPulse {
  0%, 100% { box-shadow: 0 0 8px rgba(219,176,74,0.2); }
  50%       { box-shadow: 0 0 20px rgba(219,176,74,0.45); }
}

/* ── Scan Page ───────────────────────────────────────────────── */
.scan-page { padding: var(--page-pad); display: flex; flex-direction: column; gap: 12px; }

.scan-hero {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 16px 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.scan-icon { font-size: 2.2rem; }
.scan-title { font-family: var(--font-display); font-size: 1.15rem; font-weight: 700; }
.scan-desc  { font-size: 0.8rem; color: var(--text-secondary); line-height: 1.4; max-width: 280px; }

.scan-upload-btn {
  width: 100%;
  height: 48px;
  margin-top: 4px;
  background: linear-gradient(135deg, var(--gold), var(--gold-bright));
  color: #080c14;
  font-weight: 700;
  font-size: 0.95rem;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  transition: transform 0.2s var(--ease-spring), box-shadow 0.2s;
}
.scan-upload-btn:hover  { transform: translateY(-2px); box-shadow: 0 8px 24px var(--gold-glow); }
.scan-upload-btn:active { transform: scale(0.97); }
.scan-upload-btn svg    { width: 20px; height: 20px; }

/* Preview */
.scan-preview-wrap { display: none; }
.scan-preview-wrap.visible { display: block; }
.scan-preview-img {
  width: 100%;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  object-fit: cover;
  max-height: 260px;
}

/* Results */
.scan-results {
  background: var(--bg-elevated);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-xl);
  padding: 20px;
  display: none;
}
.scan-results.visible { display: block; }
.scan-results-title { font-family: var(--font-display); font-size: 1rem; font-weight: 700; margin-bottom: 12px; color: var(--gold); }
.scan-result-chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 2px; }
.scan-result-chip {
  padding: 6px 14px;
  background: var(--green-dim);
  border: 1px solid var(--green);
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--green);
  animation: chipIn 0.3s var(--ease-spring) both;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s;
}
.scan-result-chip:hover {
  transform: scale(1.05);
}
.scan-result-chip:active {
  transform: scale(0.95);
}
.scan-result-chip.chip-missing {
  background: rgba(239, 68, 68, 0.08) !important;
  border: 1px dashed rgba(239, 68, 68, 0.4) !important;
  color: #f87171 !important;
}
.scan-result-chip.chip-owned {
  background: var(--green-dim) !important;
  border: 1px solid var(--green) !important;
  color: var(--green) !important;
}
@keyframes chipIn { from { opacity: 0; transform: scale(0.7); } to { opacity: 1; transform: scale(1); } }

/* ── Friends Page (MVP placeholder) ─────────────────────────── */
.friends-placeholder {
  min-height: 60vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px var(--page-pad);
  text-align: center;
  gap: 12px;
}
.friends-placeholder .big-emoji { font-size: 4rem; }
.friends-placeholder h2 { font-family: var(--font-display); font-size: 1.3rem; font-weight: 700; }
.friends-placeholder p  { font-size: 0.875rem; color: var(--text-secondary); max-width: 280px; line-height: 1.6; }

/* ── Profile Page ────────────────────────────────────────────── */
.profile-page { padding: var(--page-pad); }

.profile-card {
  position: relative;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  text-align: center;
}

.profile-avatar {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--gold), var(--gold-bright));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: #080c14;
  font-weight: 800;
  font-family: var(--font-display);
}

.profile-username { font-family: var(--font-display); font-size: 1.3rem; font-weight: 700; }
.profile-email    { font-size: 0.85rem; color: var(--text-secondary); }

.profile-menu { display: flex; flex-direction: column; gap: 0; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-xl); overflow: hidden; }

.profile-menu-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
  min-height: 56px;
}
.profile-menu-item:last-child { border-bottom: none; }
.profile-menu-item:hover { background: var(--bg-glass); }
.profile-menu-item svg { width: 20px; height: 20px; color: var(--text-secondary); }
.profile-menu-item span { flex: 1; font-size: 0.95rem; font-weight: 500; }
.profile-menu-item .menu-arrow { color: var(--text-muted); width: 16px; height: 16px; }

.profile-menu-item--danger { color: var(--red); }
.profile-menu-item--danger svg { color: var(--red); }

/* ── Quantity Modal ──────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: overlayIn 0.2s ease;
}

@keyframes overlayIn { from { opacity: 0; } to { opacity: 1; } }

.modal-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  animation: modalSlideUp 0.3s var(--ease-out);
}

@keyframes modalSlideUp { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }

.modal-title    { font-family: var(--font-display); font-size: 1.2rem; font-weight: 700; }
.modal-subtitle { font-size: 0.85rem; color: var(--text-secondary); margin-top: -12px; }

.qty-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
}

.qty-btn {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-full);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  font-size: 1.6rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
}
.qty-btn:hover  { background: var(--gold-dim); border-color: var(--border-gold); }
.qty-btn:active { transform: scale(0.9); }

.qty-value {
  font-family: var(--font-display);
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--gold);
  min-width: 60px;
  text-align: center;
  line-height: 1;
}

.modal-actions {
  display: flex;
  gap: 10px;
}
.modal-actions .btn-ghost   { flex: 1; }
.modal-actions .btn-primary { flex: 2; }

.modal-list-item:hover {
  background: rgba(255,255,255,0.03) !important;
}
.modal-list-item input[type="radio"]:checked + span {
  color: var(--fifa-gold);
  font-weight: 600;
}

/* ── Toast Notifications ─────────────────────────────────────── */
#toast-container {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  width: calc(100% - 32px);
  max-width: 380px;
}

.toast {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  opacity: 0;
  transform: translateY(-8px) scale(0.96);
  transition: opacity 0.3s ease, transform 0.3s var(--ease-out);
  pointer-events: auto;
}

.toast.toast-visible { opacity: 1; transform: none; }
.toast-success { border-color: #059669; background: #10b981; color: #ffffff; }
.toast-error   { border-color: #dc2626; background: #ef4444; color: #ffffff; }
.toast-info    { border-color: #2563eb; background: #3b82f6; color: #ffffff; }
.toast-success::before { content: '✓  '; color: #ffffff; font-weight: 700; }
.toast-error::before   { content: '✕  '; color: #ffffff; font-weight: 700; }

/* ── Loading Skeleton ────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--bg-elevated) 25%, var(--bg-glass-hover) 50%, var(--bg-elevated) 75%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
  border-radius: var(--radius-sm);
}

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

.skeleton-card   { aspect-ratio: 3/4; border-radius: var(--radius-md); }
.skeleton-text   { height: 14px; margin-bottom: 8px; }
.skeleton-text--lg { height: 22px; }
.skeleton-text--sm { height: 10px; width: 60%; }

/* ── Responsive tweaks ───────────────────────────────────────── */
@media (min-width: 480px) {
  .stat-value { font-size: 2rem; }
  .card-grid  { grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); }
}

@media (min-width: 768px) {
  .card-grid    { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
  #app          { max-width: 600px; margin: 0 auto; }
  .bottom-nav   { max-width: 600px; left: 50%; transform: translateX(-50%); border-left: 1px solid var(--border); border-right: 1px solid var(--border); }
  #toast-container { top: 24px; }
}

/* ── Scroll lock when modal open ─────────────────────────────── */
body.modal-open { overflow: hidden; }

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Card Grid Custom Badges & Checks ────────────────────────── */
.card-slot.owned::after {
  content: none !important;
  display: none !important;
}

.copy-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  background: var(--bg-elevated);
  border: 1px solid var(--gold);
  color: var(--gold);
  border-radius: var(--radius-sm);
  padding: 2px 4px;
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 1;
  display: flex;
  align-items: center;
  gap: 2px;
  z-index: 2;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}

.remove-x {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 18px;
  height: 18px;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: var(--red);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  line-height: 1;
  font-weight: 700;
  cursor: pointer;
  z-index: 3;
  transition: background 0.2s, transform 0.2s;
  padding: 0;
}

.remove-x:hover {
  background: var(--red);
  color: white;
  transform: scale(1.1);
}

/* ── Header Dropdown Menu ───────────────────────────────────── */
.header-menu-container {
  position: relative;
  z-index: 105;
}

.header-menu-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  transition: background-color 0.2s, color 0.2s;
}

.header-menu-btn:hover {
  background-color: var(--bg-glass-hover);
  color: var(--text-primary);
}

.header-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 25px rgba(0,0,0,0.5);
  padding: 6px;
  min-width: 150px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  animation: pageEnter 0.2s var(--ease-out) forwards;
}

.dropdown-item {
  padding: 10px 14px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  text-align: left;
  transition: background-color 0.2s, color 0.2s;
  border: none;
  background: none;
  width: 100%;
  box-sizing: border-box;
}

.dropdown-item:hover {
  background-color: var(--bg-glass-hover);
  color: var(--gold);
}

/* ── Live World Cup matches modal elements ──────────────────── */
.wc-game-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 10px;
}

.wc-game-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.wc-game-teams {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
}

.wc-team-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95rem;
}

.wc-score-box {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 800;
}

.wc-score-live {
  color: var(--gold);
}

.live-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--red);
  font-weight: 700;
}

.live-dot {
  width: 6px;
  height: 6px;
  background-color: var(--red);
  border-radius: var(--radius-full);
  animation: pulse 1.5s infinite alternate;
}

@keyframes pulse {
  0% { transform: scale(0.9); opacity: 0.5; }
  100% { transform: scale(1.3); opacity: 1; }
}

.friends-suggestion-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
}

.friends-suggestion-card-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.friends-suggestion-friend-info {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

/* Scan Page mobile height optimizations to prevent vertical scroll */
@media (max-width: 480px) {
  .scan-page {
    padding: 8px;
    gap: 8px;
  }
  .scan-hero {
    padding: 12px 16px;
    gap: 6px;
  }
  .scan-icon { font-size: 1.8rem; }
  .scan-title { font-size: 1.05rem; }
  .scan-desc  { font-size: 0.75rem; line-height: 1.3; }
  .scan-upload-btn { height: 44px; margin-top: 2px; }
  .scan-results {
    padding: 12px;
  }
  .scan-results-grid {
    margin: 8px 0 !important;
    gap: 8px !important;
  }

  #scan-detected-row {
    margin-bottom: 8px !important;
    padding: 8px 10px !important;
    font-size: 0.74rem !important;
  }
  .scan-results-title {
    font-size: 0.95rem !important;
    margin-bottom: 8px !important;
  }
  .page-header {
    padding: 12px var(--page-pad) 8px !important;
  }
  .card-grid.in-modal {
    grid-template-columns: repeat(3, 1fr) !important;
  }
  #friend-trade-modal .modal-card {
    max-height: 94vh !important;
    height: 94vh !important;
  }
}

@keyframes bell-flash {
  0%, 100% {
    color: #ff4d4d;
    filter: drop-shadow(0 0 5px rgba(255, 77, 77, 0.6));
  }
  50% {
    color: #ffffff;
    filter: drop-shadow(0 0 2px rgba(255, 255, 255, 0.4));
  }
}

.bell-flashing {
  animation: bell-flash 1s infinite alternate;
}
