/* ============================================================
   Smash&Rush — style.css
   Design system Roland-Garros : terre battue + vert épicéa + or,
   fond sombre premium. Voir design-system-smash-rush.md.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Anton&family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@500;700&display=swap');

:root {
  --bg: #EFE6D3;
  --bg-soft: #FBF6EC;
  --card-top: #FBF6EC;
  --card-bottom: #EFE4D0;
  --ink: #241C15;
  --ink-soft: #7A6B57;
  --line: #E0D3BC;

  --clay: #F04F00;
  --clay-dark: #C43F00;

  --rg-green: #36C402;
  --rg-green-dark: #2A9A02;

  --gold: #D4AF37;
  --gold-dark: #9C7F24;

  --red: #C1392B;

  --radius-pill: 999px;
  --radius-card: 20px;
  --radius-sm: 12px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,0.55) 0 1px, transparent 1px 26px),
    repeating-linear-gradient(0deg, rgba(255,255,255,0.5) 0 1px, transparent 1px 26px),
    linear-gradient(165deg, #F3ECDE 0%, #E7DAC4 55%, #DBCBB0 100%);
  background-attachment: fixed;
  color: var(--ink);
  font-family: 'Inter', sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
#app { min-height: 100vh; position: relative; padding-bottom: 88px; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
::selection { background: var(--clay); color: #fff; }

/* Focus visibility */
a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

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

h1, h2, h3 {
  font-family: 'Anton', sans-serif;
  font-weight: 400;
  letter-spacing: 0.01em;
  margin: 0;
  transform: skewX(-2deg);
}
.muted { color: var(--ink-soft); }
.small { font-size: 0.85rem; }

/* ---------- Halos de fond ---------- */
.halo {
  position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(circle at 20% 0%, rgba(240,79,0,0.10), transparent 55%),
    radial-gradient(circle at 85% 100%, rgba(54,196,2,0.12), transparent 55%);
}
.halo-menu { background:
    radial-gradient(circle at 90% 0%, rgba(212,175,55,0.10), transparent 50%),
    radial-gradient(circle at 10% 100%, rgba(54,196,2,0.12), transparent 55%);
}

/* ---------- Layout de base ---------- */
.screen { position: relative; z-index: 1; padding: 24px 20px 32px; max-width: 480px; margin: 0 auto; }
.screen-center { position: relative; z-index: 1; min-height: 90vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center; gap: 12px; padding: 24px; }
.topbar { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.topbar h2 { font-size: 1.3rem; }

.icon-btn {
  width: 40px; height: 40px; border-radius: var(--radius-pill);
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-soft); border: 1px solid var(--line); color: var(--ink);
  flex-shrink: 0;
}

/* ---------- Boutons pill ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: var(--radius-pill); border: none; cursor: pointer;
  font-weight: 700; padding: 12px 24px; font-size: 0.95rem;
  transition: transform .15s ease, opacity .15s ease;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: linear-gradient(to bottom right, #36C402 0 50%, #F04F00 50% 100%); color: #FFFFFF; }
.btn-ghost { background: transparent; color: var(--ink); border: 1px solid color-mix(in srgb, var(--ink) 24%, transparent); }
.btn-lg { width: 100%; padding: 16px 24px; font-size: 1.05rem; }

/* ---------- Cartes dégradées ---------- */
.card, .menu-card, .game-card, .mode-card, .onb-card, .profile-card {
  background: linear-gradient(160deg, var(--card-top), var(--card-bottom));
  border: 1px solid color-mix(in srgb, var(--clay) 35%, var(--line));
  border-radius: var(--radius-card);
}

/* ---------- Accueil / splash ---------- */
.screen-splash {
  min-height: 100vh; display: flex; flex-direction: column; align-items: center;
  justify-content: center; text-align: center; gap: 14px; padding: 24px;
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,0.6) 0 1px, transparent 1px 26px),
    repeating-linear-gradient(0deg, rgba(255,255,255,0.55) 0 1px, transparent 1px 26px),
    linear-gradient(165deg, #F3ECDE 0%, #E7DAC4 55%, #DBCBB0 100%);
}
.screen-splash .brand-title { color: var(--ink); text-shadow: 0 1px 0 rgba(255,255,255,.4); }
.screen-splash .brand-sub { color: rgba(58,46,34,0.7); }
.screen-splash .brand-tag { color: var(--rg-green-dark, #06492D); }
.splash-badge { animation: floatIn .8s ease; }
@keyframes floatIn { from { opacity: 0; transform: translateY(12px);} to { opacity: 1; transform: translateY(0);} }
.brand-title { font-size: 2.6rem; letter-spacing: 0.02em; }
.brand-title .accent { color: var(--clay); }
.brand-title .brand-grad { background: linear-gradient(to bottom right, #36C402 0 50%, #F04F00 50% 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand-sub { color: var(--ink-soft); max-width: 300px; }
.brand-tag { color: var(--rg-green); font-family: 'JetBrains Mono', monospace; font-size: 0.8rem; margin-top: 8px; }
.btn-lg#btn-play { max-width: 260px; }

/* ---------- Onboarding ---------- */
.screen-onboarding { min-height: 100vh; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 24px; padding: 24px; text-align: center; }
.dots { display: flex; gap: 8px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.dot.active { background: var(--gold); }
.onb-card { padding: 32px 24px; max-width: 340px; }
.onb-card h2 { font-size: 1.5rem; margin-bottom: 12px; }
.onb-card p { color: var(--ink-soft); line-height: 1.5; }
.screen-onboarding .btn-lg { max-width: 260px; }

/* ---------- Connexion ---------- */
.screen-auth { min-height: 100vh; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 14px; padding: 24px; text-align: center; }
.screen-auth .input, .screen-auth .btn-lg { max-width: 300px; }
.input {
  width: 100%; padding: 14px 18px; border-radius: var(--radius-pill);
  background: var(--bg-soft); border: 1px solid var(--line); color: var(--ink);
  font-size: 1rem; font-family: 'JetBrains Mono', monospace;
}
.input::placeholder { color: var(--ink-soft); }
.error-msg { color: var(--red); font-size: 0.85rem; }

/* ---------- Menu ---------- */
.menu-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.menu-header h2 { font-size: 1.6rem; }
.menu-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.menu-card-lg { grid-column: 1 / -1; display: flex; align-items: center; gap: 16px; padding: 22px; color: var(--gold); }
.menu-card-lg h3 { color: var(--ink); font-size: 1.1rem; margin-bottom: 4px; }
.menu-card-lg p { margin: 0; color: var(--ink-soft); font-size: 0.85rem; }
.menu-card {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  padding: 20px 12px; color: var(--clay); font-weight: 600; font-size: 0.9rem; text-align: center;
}

/* ---------- Rank chip ---------- */
.rank-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px;
  border-radius: var(--radius-pill); font-family: 'JetBrains Mono', monospace; font-size: 0.8rem; font-weight: 700;
  background: var(--bg-soft); border: 1px solid var(--line);
}
.rank-bronze { color: #C7854B; }
.rank-argent { color: #C8CCD4; }
.rank-or { color: var(--gold); }
.rank-platine { color: #9FD8E8; }
.rank-legende { color: var(--rg-green); border-color: var(--rg-green-dark); }

/* ---------- Liste des jeux ---------- */
.game-list, .mode-list { display: flex; flex-direction: column; gap: 12px; }
.game-card, .mode-card {
  display: flex; align-items: center; gap: 14px; padding: 16px; position: relative;
  width: 100%; text-align: left; cursor: pointer;
}
.game-card.disabled { opacity: 0.45; cursor: not-allowed; }
.game-icon {
  width: 44px; height: 44px; border-radius: var(--radius-pill); flex-shrink: 0;
  background: color-mix(in srgb, #36C402 12%, var(--bg-soft)); color: var(--clay);
  display: flex; align-items: center; justify-content: center;
}
.game-info h3 { font-family: 'Inter', sans-serif; font-weight: 700; font-size: 1rem; transform: none; margin-bottom: 2px; }
.game-info p { margin: 0; color: var(--ink-soft); font-size: 0.85rem; }
.badge-soon {
  position: absolute; right: 16px; top: 50%; transform: translateY(-50%);
  background: var(--gold-dark); color: #fff; font-size: 0.7rem; font-weight: 700;
  padding: 4px 10px; border-radius: var(--radius-pill);
}

/* ---------- Quiz ---------- */
.screen-quiz { position: relative; z-index: 1; padding: 20px 20px 32px; max-width: 480px; margin: 0 auto; min-height: 100vh; }
.quiz-top { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.progress { flex: 1; height: 6px; background: var(--bg-soft); border-radius: var(--radius-pill); overflow: hidden; }
.progress-bar { height: 100%; background: linear-gradient(90deg, #36C402, #F04F00); transition: width .3s ease; }
.score-pill {
  font-family: 'JetBrains Mono', monospace; font-weight: 700; font-size: 0.85rem;
  background: var(--bg-soft); border: 1px solid var(--line); padding: 6px 12px; border-radius: var(--radius-pill);
}
.quiz-cat { color: var(--rg-green); font-family: 'JetBrains Mono', monospace; font-size: 0.8rem; margin-bottom: 8px; }
.quiz-prompt { font-family: 'Inter', sans-serif; font-weight: 700; font-size: 1.3rem; line-height: 1.35;
  transform: none; margin-bottom: 24px; }

.timer-ring {
  width: 64px; height: 64px; border-radius: 50%; border: 4px solid var(--rg-green);
  display: flex; align-items: center; justify-content: center; margin: 0 auto 20px;
  font-family: 'JetBrains Mono', monospace; font-weight: 700; font-size: 1.2rem;
  transition: border-color .3s ease;
}
.timer-ring.urgent { border-color: var(--red); color: var(--red); animation: pulse 1s infinite; }
@keyframes pulse { 0%,100% { transform: scale(1);} 50% { transform: scale(1.08);} }

.answer-zone { display: flex; flex-direction: column; gap: 12px; }
.options-grid { display: flex; flex-direction: column; gap: 12px; }
.option-btn {
  padding: 16px 18px; border-radius: var(--radius-sm); text-align: left;
  background: var(--bg-soft); border: 1px solid var(--line); color: var(--ink);
  font-size: 1rem; cursor: pointer; transition: border-color .15s ease, background .15s ease;
}
.option-btn:disabled { cursor: default; }
.option-btn.correct { border-color: var(--rg-green); background: color-mix(in srgb, var(--rg-green) 20%, var(--bg-soft)); }
.option-btn.wrong { border-color: var(--red); background: color-mix(in srgb, var(--red) 18%, var(--bg-soft)); }

/* ---------- Résultat ---------- */
.result-score { font-family: 'Anton', sans-serif; font-size: 4rem; color: var(--gold-dark); line-height: 1; transform: skewX(-3deg); }
.result-score span { font-size: 1.2rem; margin-left: 6px; color: var(--ink-soft); font-family: 'Inter', sans-serif; transform: none; display: inline-block; }
.result-actions { display: flex; flex-direction: column; gap: 10px; width: 100%; max-width: 280px; margin-top: 16px; }

/* ---------- Classement ---------- */
.leaderboard { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.lb-row {
  display: grid; grid-template-columns: 28px 1fr auto auto; align-items: center; gap: 10px;
  padding: 12px 14px; background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--radius-sm);
}
.lb-rank { font-family: 'JetBrains Mono', monospace; color: var(--gold-dark); font-weight: 700; }
.lb-name { font-weight: 600; }
.lb-game { color: var(--ink-soft); font-size: 0.78rem; }
.lb-score { font-family: 'JetBrains Mono', monospace; color: var(--clay); font-weight: 700; }

/* ---------- Profil ---------- */
.profile-card { padding: 32px 24px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.avatar {
  width: 76px; height: 76px; border-radius: 50%;
  background: linear-gradient(135deg, var(--clay), var(--rg-green));
  display: flex; align-items: center; justify-content: center;
  font-family: 'Anton', sans-serif; font-size: 1.4rem; color: var(--ink);
}
.rank-progress { width: 100%; height: 6px; background: var(--bg-soft); border-radius: var(--radius-pill); overflow: hidden; margin-top: 8px; }
.rank-progress-bar { height: 100%; background: linear-gradient(90deg, var(--rg-green), var(--gold)); }

/* ---------- État vide ---------- */
.empty-state {
  text-align: center; color: var(--ink-soft); padding: 40px 20px;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.empty-state svg { color: var(--clay); }

/* ---------- Toasts ---------- */
.toast {
  position: fixed; bottom: 100px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--bg-soft); border: 1px solid var(--gold-dark); color: var(--ink);
  padding: 10px 18px; border-radius: var(--radius-pill); font-size: 0.85rem; font-weight: 600;
  opacity: 0; transition: opacity .3s ease, transform .3s ease; z-index: 50;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Nav inférieure ---------- */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
  display: flex; justify-content: space-around;
  background: color-mix(in srgb, var(--bg-soft) 92%, transparent);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  padding: 10px 8px calc(10px + env(safe-area-inset-bottom));
}
.nav-item {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  color: var(--ink-soft); font-size: 0.7rem; font-weight: 600; padding: 4px 10px; border-radius: var(--radius-sm);
}
.nav-item.active { color: var(--clay); }

@media (max-width: 380px) {
  .brand-title { font-size: 2.1rem; }
  .result-score { font-size: 3.2rem; }
}


/* ============================================================
   Harmonisation — boutons, effets, animations, typographie
   (passe de cohérence Claude Design)
   ============================================================ */

/* — Typographie — */
h1, h2, h3 { text-wrap: balance; }
.quiz-prompt, .onb-card p, .brand-sub, .empty-state p, .muted { text-wrap: pretty; }

/* — Boutons unifiés — */
.btn { transition: transform .15s ease, filter .2s ease, box-shadow .2s ease, border-color .2s ease, color .2s ease; letter-spacing: .01em; }
.btn-primary { box-shadow: 0 8px 22px rgba(240,79,0,.24); }
.btn-primary:hover { filter: brightness(1.05); box-shadow: 0 10px 28px rgba(240,79,0,.3); }
.btn-primary:active { transform: scale(.97); box-shadow: 0 4px 14px rgba(240,79,0,.2); }
.btn-ghost:hover { border-color: var(--clay); color: var(--clay); }
.icon-btn { transition: border-color .2s ease, background .2s ease, color .2s ease, transform .15s ease; }
.icon-btn:hover { border-color: var(--clay); color: var(--clay); }
.icon-btn:active { transform: scale(.94); }

/* — Surfaces cliquables : hover / active cohérents — */
.menu-card, .game-card:not(.disabled), .mode-card, .option-btn:not(:disabled), .nav-item, .game-icon, .rank-chip {
  transition: transform .18s ease, border-color .2s ease, background .2s ease, box-shadow .2s ease, color .2s ease;
}
.menu-card:hover, .mode-card:hover { transform: translateY(-2px); border-color: var(--clay); box-shadow: 0 10px 26px rgba(120,90,50,.16); }
.game-card:not(.disabled):hover { border-color: var(--clay); box-shadow: 0 8px 22px rgba(120,90,50,.14); }
.menu-card:active, .game-card:not(.disabled):active, .mode-card:active { transform: scale(.99); }
.game-card:not(.disabled):hover .game-icon, .mode-card:hover .game-icon { transform: scale(1.08); }
.option-btn:not(:disabled):hover { border-color: var(--clay); background: color-mix(in srgb, var(--clay) 10%, var(--bg-soft)); }
.nav-item:active { transform: scale(.92); }

/* — Animations d'entrée & feedback — */
@keyframes screenIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes listIn   { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes scorePop { 0% { opacity: 0; transform: skewX(-3deg) scale(.6); } 60% { transform: skewX(-3deg) scale(1.08); } 100% { opacity: 1; transform: skewX(-3deg) scale(1); } }
@keyframes popCorrect { 0%,100% { transform: none; } 40% { transform: scale(1.03); } }
@keyframes shake { 0%,100% { transform: translateX(0); } 20% { transform: translateX(-5px); } 40% { transform: translateX(5px); } 60% { transform: translateX(-3px); } 80% { transform: translateX(3px); } }

.screen, .screen-center, .screen-quiz, .screen-auth, .screen-onboarding { animation: screenIn .38s cubic-bezier(.2,.7,.2,1) both; }

.menu-grid > *, .game-list > *, .mode-list > *, .leaderboard > *, .options-grid > * { animation: listIn .4s ease both; }
.menu-grid > *:nth-child(1), .game-list > *:nth-child(1), .mode-list > *:nth-child(1), .leaderboard > *:nth-child(1), .options-grid > *:nth-child(1) { animation-delay: .05s; }
.menu-grid > *:nth-child(2), .game-list > *:nth-child(2), .mode-list > *:nth-child(2), .leaderboard > *:nth-child(2), .options-grid > *:nth-child(2) { animation-delay: .10s; }
.menu-grid > *:nth-child(3), .game-list > *:nth-child(3), .mode-list > *:nth-child(3), .leaderboard > *:nth-child(3), .options-grid > *:nth-child(3) { animation-delay: .15s; }
.menu-grid > *:nth-child(4), .game-list > *:nth-child(4), .mode-list > *:nth-child(4), .leaderboard > *:nth-child(4), .options-grid > *:nth-child(4) { animation-delay: .20s; }
.game-list > *:nth-child(5), .leaderboard > *:nth-child(5) { animation-delay: .25s; }
.game-list > *:nth-child(6), .leaderboard > *:nth-child(6) { animation-delay: .30s; }
.game-list > *:nth-child(7), .leaderboard > *:nth-child(7) { animation-delay: .35s; }

.result-score { animation: scorePop .55s cubic-bezier(.2,.7,.2,1) both; }
.option-btn.correct { animation: popCorrect .45s ease; }
.option-btn.wrong { animation: shake .4s ease; }


/* — Logo halo animé (façon KR) — */
.sr-glow { position: absolute; inset: -16%; border-radius: 50%; z-index: 0;
  background: radial-gradient(circle, rgba(255,106,31,0.65), rgba(255,150,40,0.42) 52%, transparent 70%);
  filter: blur(12px); animation: srHalo 3.4s ease-in-out infinite; }
.sr-ring { position: relative; z-index: 1; animation: srSpin 16s linear infinite; will-change: transform; }
.splash-badge svg { z-index: 2; }
@keyframes srHalo { 0%,100% { opacity: .4; transform: scale(.96); } 50% { opacity: .85; transform: scale(1.1); } }
@keyframes srSpin { to { transform: rotate(360deg); } }

.ttl-accent { background: linear-gradient(to bottom right, #36C402 0 50%, #F04F00 50% 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
