/* ============================================
   KRAPAHUT PWA — Design System
   Identité : Carte au trésor vintage
   Parchemin + encre brun-noir + or brûlé
   ============================================ */

/* Note: Les Google Fonts sont chargées dans index.html avec preconnect pour optimiser */

/* --- CSS Custom Properties — aligned with front office --- */
:root {
  /* Core palette — parchemin, encre, or brûlé */
  --bg: hsl(40 30% 95%);
  --bg-card: hsl(40 28% 93%);
  --bg-input: hsl(40 18% 88%);
  --border: hsl(30 20% 75%);
  --text: hsl(30 15% 12%);
  --text-muted: hsl(30 10% 38%);
  --text-dim: hsl(30 15% 55%);

  /* Accent — Or brûlé */
  --primary: hsl(35 65% 38%);
  --primary-light: hsl(38 55% 48%);
  --primary-foreground: hsl(40 30% 96%);

  /* Secondary — Brun profond */
  --secondary: hsl(30 40% 32%);

  /* Functional colors */
  --destructive: hsl(20 60% 40%);
  --green: hsl(145 50% 36%);
  --gold: hsl(38 55% 48%);
  --gold-light: hsl(38 55% 75%);
  --red: hsl(20 60% 40%);

  /* Gradients — terreux, vintage */
  --gradient-cta: linear-gradient(135deg, hsl(25 65% 45%), hsl(20 60% 40%));
  --gradient-gold: linear-gradient(135deg, hsl(38 55% 48%), hsl(42 60% 52%));
  --gradient-accent: linear-gradient(135deg, hsl(38 55% 48%), hsl(28 60% 42%));
  --gradient-card: linear-gradient(180deg, hsl(40 22% 91%), hsl(40 20% 89%));
  --gradient-warm-fade: linear-gradient(180deg, transparent, hsl(40 25% 92% / 0.95));

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 40px;

  /* Radius */
  --radius-sm: 0.5rem;
  --radius-md: 0.75rem;
  --radius-lg: 1rem;

  /* Shadows — papier, pas de glow */
  --shadow-card: 0 2px 8px hsl(30 20% 15% / 0.08);
  --shadow-elevated: 0 8px 24px hsl(30 20% 15% / 0.12);
  --shadow-glow-gold: 0 4px 16px hsl(38 55% 48% / 0.1);

  /* Transitions */
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Source Sans 3', system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Libre Baskerville', Georgia, serif;
}

::selection {
  background: hsl(38 55% 48% / 0.25);
  color: hsl(30 15% 12%);
}

a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--secondary); text-decoration: underline; }

img { max-width: 100%; height: auto; display: block; }

/* --- App Layout --- */
#app-root {
  max-width: 640px;
  margin: 0 auto;
  padding: var(--space-md);
  padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px));
  min-height: 100vh;
  min-height: 100dvh;
}

/* --- Bottom Navigation --- */
#bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: hsl(40 22% 90% / 0.97);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: var(--space-sm) 0;
  padding-bottom: calc(var(--space-sm) + env(safe-area-inset-bottom, 0px));
  z-index: 1000;
}

#bottom-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  transition: color var(--transition);
  min-width: 56px;
  font-family: 'Source Sans 3', system-ui, sans-serif;
}

#bottom-nav a .nav-icon { font-size: 22px; line-height: 1; }
#bottom-nav a.active { color: var(--primary); }
#bottom-nav a:hover { color: var(--text); text-decoration: none; }

/* --- Card (glass-card style) --- */
.card {
  background: hsl(40 22% 90%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  box-shadow: var(--shadow-card);
  transition: transform var(--transition), box-shadow var(--transition);
}
.card:hover { transform: translateY(-1px); box-shadow: var(--shadow-elevated); }
.card-clickable { cursor: pointer; }

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: 'Libre Baskerville', Georgia, serif;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  line-height: 1;
}
.btn:hover { text-decoration: none; }

.btn-primary {
  background: var(--gradient-cta);
  color: var(--primary-foreground);
  box-shadow: var(--shadow-card);
}
.btn-primary:hover { box-shadow: var(--shadow-elevated); transform: scale(1.02); }
.btn-primary:active { transform: scale(0.98); }

.btn-gold {
  background: var(--gradient-gold);
  color: var(--primary-foreground);
  box-shadow: var(--shadow-card);
}
.btn-gold:hover { box-shadow: var(--shadow-glow-gold); transform: scale(1.02); }

.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--bg-input); border-color: var(--primary); }

.btn-glass {
  background: hsl(40 22% 90%);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-glass:hover { background: hsl(40 22% 88%); }

.btn-danger { background: var(--destructive); color: #fff; }
.btn-sm { padding: 8px 16px; font-size: 13px; }
.btn-lg { padding: 14px 32px; font-size: 16px; border-radius: var(--radius-md); }
.btn-block { width: 100%; }
.btn-equal { flex: 1; min-width: 0; }

/* Telegram CTA — special prominent button */
.btn-telegram {
  background: #2AABEE;
  color: #fff;
  font-family: 'Source Sans 3', system-ui, sans-serif;
  font-weight: 700;
  font-size: 15px;
  padding: 14px 28px;
  border-radius: var(--radius-md);
  box-shadow: 0 4px 16px rgba(42, 171, 238, 0.25);
}
.btn-telegram:hover { background: #229ED9; transform: translateY(-1px); box-shadow: 0 6px 20px rgba(42, 171, 238, 0.3); }

/* --- Badge --- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 50px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  font-family: 'Source Sans 3', system-ui, sans-serif;
}
.badge-gold { background: hsl(38 55% 48% / 0.15); color: var(--gold); }
.badge-green { background: hsl(145 50% 36% / 0.12); color: var(--green); }
.badge-red { background: hsl(20 60% 40% / 0.12); color: var(--red); }
.badge-primary { background: hsl(35 65% 38% / 0.12); color: var(--primary); }
.badge-dim { background: hsl(30 15% 12% / 0.06); color: var(--text-muted); }
.badge-purple { background: hsl(35 65% 38% / 0.12); color: var(--primary); }
.badge-teal { background: hsl(145 50% 36% / 0.12); color: var(--green); }

/* --- Progress Bar --- */
.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--bg-input);
  border-radius: 50px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: var(--gradient-gold);
  border-radius: 50px;
  transition: width 0.6s ease;
}

/* --- Avatar --- */
.avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
  font-family: 'Libre Baskerville', Georgia, serif;
  color: var(--primary-foreground);
  background: var(--gradient-accent);
  overflow: hidden;
  flex-shrink: 0;
  border: 2px solid hsl(38 55% 48% / 0.3);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-lg { width: 72px; height: 72px; font-size: 28px; }

/* --- Stat Item --- */
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-sm); }
.stat-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--space-md);
  text-align: center;
}
.stat-value { font-size: 24px; font-weight: 700; color: var(--primary); font-family: 'Libre Baskerville', Georgia, serif; }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* --- Game Card --- */
.game-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
}
.game-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-elevated); }

.game-card-cover {
  position: relative;
  width: 100%;
  height: 160px;
  background: var(--gradient-card);
  overflow: hidden;
}
.game-card-cover img { width: 100%; height: 100%; object-fit: cover; }
.game-card-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60%;
  background: linear-gradient(to top, var(--bg-card), transparent);
}
.game-card-status {
  position: absolute;
  top: var(--space-sm);
  right: var(--space-sm);
}
.game-card-body { padding: var(--space-md); }
.game-card-title { font-size: 16px; font-weight: 700; margin-bottom: 4px; font-family: 'Libre Baskerville', Georgia, serif; color: var(--text); }
.game-card-city { font-size: 13px; color: var(--text-muted); margin-bottom: var(--space-sm); }
.game-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin-bottom: var(--space-sm);
}
.game-card-prize {
  font-size: 13px;
  color: var(--gold);
  font-weight: 600;
  margin-top: var(--space-xs);
}

/* --- Step Item (timeline) --- */
.step-timeline { display: flex; flex-direction: column; gap: 0; }
.step-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  padding: var(--space-sm) 0;
  position: relative;
}
.step-item:not(:last-child)::after {
  content: '';
  position: absolute;
  left: 15px;
  top: 38px;
  bottom: -4px;
  width: 2px;
  background: var(--border);
}
.step-item.validated:not(:last-child)::after { background: var(--green); }

.step-marker {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
  border: 2px solid var(--border);
  background: var(--bg);
  z-index: 1;
  font-family: 'Source Sans 3', system-ui, sans-serif;
  font-weight: 600;
}
.step-item.validated .step-marker { background: var(--green); border-color: var(--green); color: #fff; }
.step-item.current .step-marker {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--primary-foreground);
  animation: pulse-gold 2s infinite;
}
.step-item.pending .step-marker { background: var(--bg-input); border-color: var(--text-dim); color: var(--text-dim); }

.step-content { flex: 1; min-width: 0; }
.step-title { font-size: 14px; font-weight: 600; }
.step-detail { font-size: 12px; color: var(--text-muted); }
.step-clue {
  margin-top: var(--space-xs);
  padding: var(--space-sm);
  background: hsl(35 65% 38% / 0.08);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--primary);
  font-style: italic;
}

@keyframes pulse-gold {
  0%, 100% { box-shadow: 0 0 0 0 hsl(38 55% 48% / 0.3); }
  50% { box-shadow: 0 0 0 8px hsl(38 55% 48% / 0); }
}

/* --- Medal --- */
.medal { font-size: 20px; line-height: 1; }

/* --- Podium --- */
.podium {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-lg) 0;
}
.podium-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
  text-align: center;
}
.podium-bar {
  width: 80px;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding: var(--space-sm);
}
.podium-1st .podium-bar { height: 120px; background: linear-gradient(to top, hsl(38 55% 48%), hsl(38 55% 48% / 0.3)); }
.podium-2nd .podium-bar { height: 90px; background: linear-gradient(to top, hsl(30 10% 55%), hsl(30 10% 55% / 0.3)); }
.podium-3rd .podium-bar { height: 70px; background: linear-gradient(to top, hsl(25 45% 42%), hsl(25 45% 42% / 0.3)); }
.podium-name { font-size: 13px; font-weight: 600; max-width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.podium-time { font-size: 11px; color: var(--text-muted); }

/* --- Filter Chips --- */
.filter-chips {
  display: flex;
  gap: var(--space-sm);
  overflow-x: auto;
  padding: var(--space-sm) 0;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.filter-chips::-webkit-scrollbar { display: none; }

.chip {
  padding: 8px 16px;
  border-radius: 50px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-muted);
  transition: var(--transition);
  font-family: 'Source Sans 3', system-ui, sans-serif;
}
.chip.active, .chip:hover {
  background: hsl(35 65% 38% / 0.12);
  border-color: var(--primary);
  color: var(--primary);
}

/* --- Tabs --- */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  gap: 0;
  margin-bottom: var(--space-md);
}
.tab {
  flex: 1;
  padding: 12px;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  font-family: 'Libre Baskerville', Georgia, serif;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: var(--transition);
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
}
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab:hover { color: var(--text); }

/* --- Toast Notifications --- */
#toast-container {
  position: fixed;
  top: var(--space-lg);
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  pointer-events: none;
  width: calc(100% - 32px);
  max-width: 400px;
}

.toast {
  background: hsl(40 22% 90%);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  box-shadow: var(--shadow-elevated);
  pointer-events: all;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  animation: toast-in 0.3s ease;
  font-size: 14px;
  color: var(--text);
}
.toast-action {
  margin-left: auto;
  color: var(--primary);
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  font-family: 'Libre Baskerville', Georgia, serif;
}
.toast.toast-out { animation: toast-out 0.3s ease forwards; }

@keyframes toast-in { from { opacity: 0; transform: translateY(-12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toast-out { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(-12px); } }

/* --- Skeleton Loading --- */
.skeleton {
  background: linear-gradient(90deg, var(--bg-input) 25%, var(--bg-card) 50%, var(--bg-input) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}
.skeleton-text { height: 14px; margin-bottom: var(--space-sm); }
.skeleton-title { height: 22px; width: 60%; margin-bottom: var(--space-sm); }
.skeleton-card { height: 200px; border-radius: var(--radius-md); margin-bottom: var(--space-md); }
.skeleton-avatar { width: 44px; height: 44px; border-radius: 50%; }

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

/* --- Onboarding Steps (profile_complete) --- */
.onboarding-container { max-width: 400px; margin: 0 auto; }
.onboarding-step { animation: slide-in 0.3s ease; }
.onboarding-question { font-size: 20px; font-weight: 700; margin-bottom: var(--space-sm); font-family: 'Libre Baskerville', Georgia, serif; }
.onboarding-benefit { font-size: 14px; color: var(--text-muted); margin-bottom: var(--space-lg); }
.onboarding-progress {
  display: flex;
  gap: var(--space-xs);
  margin-bottom: var(--space-xl);
}
.onboarding-dot { flex: 1; height: 4px; border-radius: 2px; background: var(--bg-input); }
.onboarding-dot.done { background: var(--green); }
.onboarding-dot.active { background: var(--primary); }

.onboarding-actions { display: flex; gap: var(--space-sm); }
.onboarding-actions .btn { flex: 1; }

@keyframes slide-in { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }

/* --- RGPD Notice --- */
.rgpd-notice {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: var(--space-lg);
}
.rgpd-notice p { margin-bottom: var(--space-xs); }

/* --- Referral Card --- */
.referral-card {
  background: linear-gradient(135deg, hsl(38 55% 48% / 0.08), hsl(35 65% 38% / 0.05));
  border: 1px solid hsl(38 55% 48% / 0.2);
  border-radius: var(--radius-md);
  padding: var(--space-md);
}
.referral-code {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--space-sm) var(--space-md);
  font-family: 'Source Code Pro', monospace;
  font-size: 16px;
  font-weight: 700;
  color: var(--primary);
  text-align: center;
  margin: var(--space-sm) 0;
  user-select: all;
}
.referral-table-wrap {
  margin-top: var(--space-md);
  max-height: 200px;
  overflow-y: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.referral-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.referral-table thead {
  position: sticky;
  top: 0;
  background: var(--bg-card);
}
.referral-table th {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  padding: var(--space-xs) var(--space-sm);
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.referral-table th:last-child {
  text-align: right;
}
.referral-table td {
  padding: var(--space-xs) var(--space-sm);
  border-bottom: 1px solid hsl(38 55% 48% / 0.08);
  color: var(--text);
}
.referral-table td:last-child {
  text-align: right;
  font-weight: 600;
  color: var(--primary);
}

/* --- Hero Cover --- */
.hero-cover {
  position: relative;
  width: calc(100% + 2 * var(--space-md));
  margin: calc(-1 * var(--space-md)) calc(-1 * var(--space-md)) 0;
  height: 220px;
  overflow: hidden;
}
.hero-cover img { width: 100%; height: 100%; object-fit: cover; }
.hero-cover-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 70%;
  background: linear-gradient(to top, var(--bg), transparent);
}
.hero-cover-content {
  position: absolute;
  bottom: var(--space-md);
  left: var(--space-md);
  right: var(--space-md);
}

/* --- Info Badges Row --- */
.info-badges {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin: var(--space-md) 0;
}

/* --- Section Headers --- */
.section-title {
  font-size: 18px;
  font-weight: 700;
  margin: var(--space-lg) 0 var(--space-md);
  font-family: 'Libre Baskerville', Georgia, serif;
  color: var(--text);
}
.section-subtitle { font-size: 14px; color: var(--text-muted); margin-bottom: var(--space-md); }

/* --- Player List (leaderboard / in-progress) --- */
.player-list { display: flex; flex-direction: column; gap: var(--space-sm); }
.player-row {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border);
}
.player-row.is-me { border-color: var(--primary); background: hsl(35 65% 38% / 0.05); }
.player-rank { font-size: 16px; font-weight: 700; min-width: 32px; text-align: center; font-family: 'Libre Baskerville', Georgia, serif; }
.player-name { flex: 1; font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-stats { font-size: 13px; color: var(--text-muted); white-space: nowrap; }

/* --- Sort Selector --- */
.sort-selector {
  display: flex;
  gap: var(--space-xs);
  margin-bottom: var(--space-md);
  overflow-x: auto;
  padding-bottom: var(--space-xs);
}

/* --- Empty State --- */
.empty-state {
  text-align: center;
  padding: var(--space-xl);
  color: var(--text-muted);
}
.empty-state-icon { font-size: 48px; margin-bottom: var(--space-md); }
.empty-state-text { font-size: 16px; margin-bottom: var(--space-md); font-family: 'Libre Baskerville', Georgia, serif; }

/* --- Offline Banner --- */
.offline-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: var(--gold);
  color: hsl(30 15% 12%);
  text-align: center;
  padding: var(--space-sm);
  font-size: 13px;
  font-weight: 600;
  z-index: 9998;
}

/* --- Footer --- */
.page-footer {
  margin-top: var(--space-xl);
  padding: var(--space-lg) 0;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 12px;
  color: var(--text-dim);
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}
.page-footer a { color: var(--text-muted); font-size: 11px; }

/* --- Games Grid --- */
.games-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-md);
}

/* --- How it works --- */
.how-it-works {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
  text-align: center;
}
.how-step-icon { font-size: 36px; margin-bottom: var(--space-sm); }
.how-step-title { font-size: 14px; font-weight: 700; font-family: 'Libre Baskerville', Georgia, serif; }
.how-step-desc { font-size: 12px; color: var(--text-muted); }

/* --- Prize table --- */
.prize-table { width: 100%; border-collapse: collapse; }
.prize-table th, .prize-table td {
  padding: var(--space-sm) var(--space-md);
  text-align: left;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
}
.prize-table th { color: var(--text-muted); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; }

/* --- Win Card --- */
.win-card {
  background: var(--bg-card);
  border: 1px solid hsl(38 55% 48% / 0.2);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  margin-bottom: var(--space-sm);
}

/* --- Data item (profile) --- */
.data-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.data-item:last-child { border-bottom: none; }
.data-label { color: var(--text-muted); }
.data-value { font-weight: 500; }

/* --- Notification info --- */
.notification-info {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.8;
  margin-bottom: var(--space-md);
  border: 1px solid var(--border);
}

/* --- Select dropdown --- */
.select-wrap select {
  width: 100%;
  padding: 10px var(--space-md);
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  appearance: none;
  cursor: pointer;
}

/* --- Form Inputs --- */
.form-input {
  width: 100%;
  padding: 12px var(--space-md);
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: 'Source Sans 3', system-ui, sans-serif;
  font-size: 15px;
  transition: border-color var(--transition);
}
.form-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px hsl(35 65% 38% / 0.1); }
.form-input::placeholder { color: var(--text-dim); }

/* --- Install Banner --- */
.install-banner {
  position: fixed;
  bottom: 70px;
  left: var(--space-md);
  right: var(--space-md);
  max-width: 600px;
  margin: 0 auto;
  background: hsl(40 22% 90% / 0.98);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  box-shadow: var(--shadow-elevated);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  z-index: 1001;
  transform: translateY(120%);
  opacity: 0;
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.35s ease;
}
.install-banner.visible { transform: translateY(0); opacity: 1; }
.install-banner-content { display: flex; align-items: center; gap: var(--space-sm); flex: 1; min-width: 0; }
.install-banner-icon { font-size: 28px; flex-shrink: 0; }
.install-banner-text { display: flex; flex-direction: column; min-width: 0; }
.install-banner-text strong { font-size: 14px; font-family: 'Libre Baskerville', Georgia, serif; color: var(--text); }
.install-banner-text span { font-size: 12px; color: var(--text-muted); }
.install-banner-actions { display: flex; align-items: center; gap: var(--space-xs); flex-shrink: 0; }
.install-btn-dismiss { padding: 6px !important; min-width: 32px; font-size: 16px !important; }

/* --- Loading screen --- */
.loading-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  gap: var(--space-md);
}
.loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- Page transition --- */
.page-enter {
  animation: page-fade-in 0.25s ease;
}
@keyframes page-fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* --- Back button --- */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-sm) 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  background: none;
  border: none;
  font-family: 'Source Sans 3', system-ui, sans-serif;
  transition: color var(--transition);
  margin-bottom: var(--space-sm);
}
.back-btn:hover { color: var(--primary); text-decoration: none; }

/* --- Pull to refresh --- */
.ptr-indicator {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  z-index: 9997;
  transform: translateY(-100%);
  transition: transform 0.2s ease;
}
.ptr-indicator.visible { transform: translateY(0); }
.ptr-indicator.spinner::after {
  content: '';
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* --- KPI Row --- */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-sm);
  margin: var(--space-md) 0;
}
.kpi-item { text-align: center; }
.kpi-value { font-size: 22px; font-weight: 700; color: var(--primary); font-family: 'Libre Baskerville', Georgia, serif; }
.kpi-label { font-size: 11px; color: var(--text-muted); }

/* --- My position (leaderboard) --- */
.my-position {
  background: hsl(35 65% 38% / 0.06);
  border: 1px solid hsl(35 65% 38% / 0.15);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}

/* --- Auth banner (always visible) --- */
.auth-banner {
  background: hsl(40 22% 90%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  text-align: center;
  margin-bottom: var(--space-lg);
}
.auth-banner-title {
  font-family: 'Libre Baskerville', Georgia, serif;
  font-size: 18px;
  font-weight: 700;
  margin-bottom: var(--space-sm);
  color: var(--text);
}
.auth-banner-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: var(--space-md);
  line-height: 1.5;
}

/* --- Profile quick actions --- */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-sm);
  margin: var(--space-md) 0;
}
.quick-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-md);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  color: var(--text);
}
.quick-action:hover { border-color: var(--primary); transform: translateY(-1px); text-decoration: none; }
.quick-action-icon { font-size: 24px; }
.quick-action-label { font-size: 12px; font-weight: 600; text-align: center; }

/* --- Navigation buttons (itinéraire) --- */
.nav-buttons {
  display: flex;
  gap: var(--space-sm);
  margin-top: var(--space-md);
  flex-wrap: wrap;
}
.nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  font-family: 'Source Sans 3', system-ui, sans-serif;
  text-decoration: none;
  color: #fff;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}
.nav-btn:hover { transform: translateY(-1px); text-decoration: none; color: #fff; }
.nav-btn-icon { width: 18px; height: 18px; flex-shrink: 0; }
.nav-btn-google { background: #4285F4; }
.nav-btn-google:hover { background: #3367D6; }
.nav-btn-apple { background: #333; }
.nav-btn-apple:hover { background: #555; }
.nav-btn-waze { background: #05C8F7; color: #1a1a2e; }
.nav-btn-waze:hover { background: #04b4d9; }

/* --- Share FAB (mobile/tablet only) --- */
.share-fab {
  display: none; /* caché par défaut (desktop) */
  position: fixed;
  bottom: calc(80px + var(--space-md) + env(safe-area-inset-bottom, 0px));
  right: var(--space-md);
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--gradient-gold);
  color: var(--primary-foreground);
  border: none;
  cursor: pointer;
  box-shadow: var(--shadow-elevated);
  align-items: center;
  justify-content: center;
  z-index: 999;
  transition: var(--transition);
}
.share-fab:hover { transform: scale(1.08); box-shadow: var(--shadow-glow-gold); }
.share-fab:active { transform: scale(0.95); }

@media (max-width: 1023px) {
  .share-fab { display: flex; }
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (min-width: 640px) {
  .games-grid { grid-template-columns: repeat(2, 1fr); }
  .stat-grid { grid-template-columns: repeat(4, 1fr); }
  #app-root { max-width: 768px; padding: var(--space-lg); }
}

@media (min-width: 1024px) {
  .games-grid { grid-template-columns: repeat(3, 1fr); }
  #app-root { max-width: 960px; }
  #bottom-nav {
    top: 0;
    bottom: auto;
    left: 0;
    right: auto;
    width: 220px;
    height: 100vh;
    flex-direction: column;
    justify-content: flex-start;
    padding: var(--space-xl) var(--space-md);
    border-top: none;
    border-right: 1px solid var(--border);
  }
  #bottom-nav a { flex-direction: row; gap: var(--space-sm); font-size: 14px; justify-content: flex-start; width: 100%; padding: var(--space-sm) var(--space-md); }
  #app-root { margin-left: 220px; padding-bottom: var(--space-lg); }
}
