:root {
  --ink: #1F3A4D;
  --cream: #F3FAFF;
  --paper: #ffffff;
  --orange: #1CB0F6;
  --orange-dark: #1899D6;
  --teal: #26c6c4;
  --green: #58CC02;
  --green-bg: #E5F8D4;
  --red: #E5484D;
  --red-bg: #FDE6E6;
  --gold: #FFC800;
  --gold-dark: #CE9E00;
  --sand: #DDF4FF;
  --muted: #6B8294;
  --line: #CFE6F3;
  --radius: 16px;
  --radius-sm: 10px;
  --font-display: "Baloo 2", "Nunito", "Segoe UI", system-ui, sans-serif;
  font-size: 16px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: "Nunito", "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.app-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: stretch;
  justify-content: center;
}

.app-frame {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}

.offline-banner {
  background: #854F0B;
  color: #FAEEDA;
  font-size: 0.72rem;
  text-align: center;
  padding: 6px 10px;
  font-weight: 600;
}

#app {
  flex: 1;
  width: 100%;
  display: flex;
  flex-direction: column;
  background: var(--cream);
  min-height: 100vh;
  min-height: 100dvh;
}

/* On wide screens, present the app as a tall centred card so the
   experience still feels designed for the space instead of a lone
   narrow strip floating in a sea of grey. The frame clips to its
   rounded corners; #app becomes the internal scroller so the bottom
   tab bar stays correctly pinned inside the card instead of leaking
   out below it. */
@media (min-width: 860px) {
  html, body {
    background:
      linear-gradient(rgba(26,20,10,0.42), rgba(26,20,10,0.5)),
      url("assets/hero-signs.jpeg?v=2") center / cover fixed;
  }
  .app-shell {
    align-items: center;
    padding: 3rem 1.5rem;
  }
  .app-frame {
    height: min(880px, 92vh);
    border-radius: 28px;
    box-shadow: 0 30px 70px rgba(0,0,0,0.35);
    overflow: hidden;
  }
  #app {
    min-height: 0;
    height: 100%;
    overflow-y: auto;
  }
}

.home-screen { padding-top: 0; }
.home-hero {
  margin: -1.25rem -1.25rem 1rem;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-radius: 0 0 20px 20px;
}
.home-hero-small { aspect-ratio: 16 / 7; }
.home-hero img { width: 100%; height: 100%; object-fit: cover; display: block; }
.home-title { font-size: 1.4rem; line-height: 1.25; margin-top: 1.25rem; }
.home-lang-picker { margin: 1.25rem 0; padding: 1rem 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.home-lang-buttons { display: flex; gap: 10px; justify-content: center; }
.home-lang-btn {
  flex: 1; max-width: 160px; padding: 12px; border-radius: var(--radius-sm);
  border: 2px solid var(--line); background: var(--paper); color: var(--ink);
  font-weight: 700; font-size: 0.95rem;
}
.home-lang-btn.active { border-color: var(--orange); background: var(--sand); color: var(--orange-dark); }
.btn-big {
  position: relative;
  font-size: 1.25rem;
  padding: 22px;
  margin-bottom: 0.5rem;
  animation: heartbeat 1.6s ease-in-out infinite;
}
@keyframes heartbeat {
  0%, 100% { transform: scale(1); box-shadow: 0 3px 0 var(--orange-dark), 0 0 0 0 rgba(28,176,246,0.45); }
  15% { transform: scale(1.055); box-shadow: 0 3px 0 var(--orange-dark), 0 0 0 10px rgba(28,176,246,0.22); }
  30% { transform: scale(1); box-shadow: 0 3px 0 var(--orange-dark), 0 0 0 16px rgba(28,176,246,0); }
  45% { transform: scale(1.035); box-shadow: 0 3px 0 var(--orange-dark), 0 0 0 6px rgba(28,176,246,0.28); }
  60% { transform: scale(1); box-shadow: 0 3px 0 var(--orange-dark), 0 0 0 14px rgba(28,176,246,0); }
}
@media (prefers-reduced-motion: reduce) {
  .btn-big { animation: none; }
}


.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 0.85rem 1.25rem 1rem;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 1rem 1.25rem 0;
}

.topbar button.icon-btn {
  background: none;
  border: none;
  padding: 6px;
  cursor: pointer;
  color: var(--muted);
}

.progress-track {
  flex: 1;
  height: 10px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--orange);
  border-radius: 999px;
  transition: width 0.3s ease;
}

h1 { font-family: var(--font-display); font-size: 1.6rem; margin: 0 0 0.25rem; font-weight: 700; letter-spacing: 0.2px; }
h2 { font-family: var(--font-display); font-size: 1.2rem; margin: 0 0 0.25rem; font-weight: 700; }
p { line-height: 1.45; }
.muted { color: var(--muted); }
.center { text-align: center; }

button {
  font-family: inherit;
  font-size: 1rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.btn-primary {
  background: var(--orange);
  color: #fff;
  border: none;
  padding: 14px;
  font-weight: 700;
  width: 100%;
  box-shadow: 0 3px 0 var(--orange-dark);
}
.btn-primary:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--orange-dark); }
.btn-primary:disabled { background: #B7E4FB; box-shadow: none; cursor: not-allowed; }

.btn-secondary {
  background: transparent;
  border: 2px solid var(--line);
  color: var(--ink);
  padding: 12px;
  font-weight: 700;
  width: 100%;
}

.card {
  background: var(--paper);
  border-radius: var(--radius);
  padding: 1rem;
  border: 1px solid var(--line);
}

.char-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin: 0.75rem 0;
}
.char-pick {
  background: var(--paper);
  border: 2px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 8px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}
.char-pick svg { width: 42px; height: 42px; }
.char-pick.selected { border-color: var(--orange); background: var(--sand); box-shadow: 0 3px 0 var(--orange-dark); }
.char-pick.locked { opacity: 0.45; cursor: not-allowed; }
.char-pick span { font-size: 0.65rem; font-weight: 600; text-align: center; line-height: 1.15; }

input[type="text"] {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--line);
  font-size: 1rem;
  background: var(--paper);
}
input[type="text"]:focus { outline: 2px solid var(--orange); border-color: var(--orange); }

.country-list { display: flex; flex-direction: column; gap: 6px; margin: 1rem 0; }
.country-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
}
.country-row.selected { background: var(--sand); }
.flag-swatch { display: flex; width: 38px; height: 24px; border: 1px solid var(--line); border-radius: 3px; overflow: hidden; flex-shrink: 0; }
.flag-swatch span { flex: 1; }
.country-row .name-block { flex: 1; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.country-row .name { font-weight: 600; }
.country-pct-row { display: flex; align-items: center; gap: 6px; }
.country-pct-track { flex: 1; max-width: 90px; height: 5px; background: var(--line); border-radius: 999px; overflow: hidden; }
.country-pct-fill { height: 100%; background: var(--green); border-radius: 999px; transition: width 0.3s ease; }
.country-pct-label { font-size: 0.68rem; font-weight: 700; color: var(--green); flex-shrink: 0; }
.radio-dot { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line); flex-shrink: 0; }
.country-row.selected .radio-dot { border-color: var(--orange); background: var(--orange); }
.row-continue-btn {
  flex-shrink: 0;
  display: flex; align-items: center; gap: 6px;
  background: var(--orange); color: #fff; border: none;
  padding: 8px 14px; border-radius: 999px; font-weight: 700; font-size: 0.82rem;
}
.row-continue-btn:active { opacity: 0.85; }

.theme-tabs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 1.25rem; }
.theme-tab { flex-shrink: 0; padding: 8px 14px; border-radius: 999px; border: 2px solid var(--line); background: var(--paper); font-weight: 600; font-size: 0.85rem; white-space: nowrap; }
.theme-tab.active { background: var(--ink); color: #fff; border-color: var(--ink); }

.country-switch-bar { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 0.6rem; }
.country-chip { flex-shrink: 0; display: flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; border: 2px solid var(--line); background: var(--paper); font-weight: 600; font-size: 0.78rem; white-space: nowrap; }
.country-chip.active { background: var(--orange); color: #fff; border-color: var(--orange-dark); }
.country-chip-pct { font-size: 0.72rem; font-weight: 800; color: var(--green); }
.country-chip.active .country-chip-pct { color: #fff; }

.path { display: flex; flex-direction: column; align-items: center; gap: 26px; padding: 1rem 0 2rem; position: relative; }
.path::before {
  content: '';
  position: absolute; top: 0; bottom: 0; left: 50%;
  width: 0; border-left: 3px dashed var(--line);
  transform: translateX(-50%);
  z-index: 0;
}
.path-node-wrap { display: flex; flex-direction: column; align-items: center; gap: 6px; position: relative; z-index: 1; transition: transform 0.2s ease; }
.path-node {
  width: 64px; height: 64px; border-radius: 50%;
  border: none; display: flex; align-items: center; justify-content: center;
  position: relative;
}
.path-node.done { background: var(--green-bg); border: 2px solid var(--green); box-shadow: 0 3px 0 #B8E58A; }
.path-node.active { background: var(--sand); border: 3px solid var(--orange); width: 72px; height: 72px; box-shadow: 0 4px 0 var(--orange-dark); }
.path-node.locked { background: var(--line); border: 2px solid var(--line); }
.path-node.bonus { border-style: dashed; border-color: var(--gold); background: #FBF0D9; }
.path-node.bonus.locked { border-color: var(--line); background: var(--line); }
.path-node.done.bonus { border-style: solid; background: var(--green-bg); border-color: var(--green); box-shadow: 0 3px 0 #B8E58A; }
.bonus-badge {
  position: absolute; top: -6px; right: -10px; background: var(--gold);
  color: #fff; font-size: 0.6rem; font-weight: 700; padding: 2px 6px; border-radius: 999px;
}
.node-label { font-size: 0.75rem; font-weight: 600; color: var(--muted); }

.stats-row { display: flex; justify-content: space-between; margin: 1.1rem 0; }
.stat { text-align: center; flex: 1; padding: 0 0.5rem; border-left: 1px solid var(--line); }
.stat:first-child { border-left: none; }
.stat .num { font-family: var(--font-display); font-size: 1.25rem; font-weight: 700; display: block; }
.stat .lbl { font-size: 0.72rem; color: var(--muted); }

.question-layout { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.question-layout .char-panel { flex-shrink: 0; width: 132px; margin: 0 auto; transition: width 0.35s ease, max-height 0.35s ease, opacity 0.35s ease; max-height: 210px; overflow: hidden; }
.question-layout .char-panel.answered { width: 40px; max-height: 48px; opacity: 0.75; }
.question-layout .quiz-panel { width: 100%; }

.q-place { font-size: 0.76rem; color: var(--muted); margin: 0; }
.q-lieu { font-size: 0.92rem; font-weight: 700; color: var(--orange-dark); margin: 0 0 6px; }
.q-text { font-size: 0.92rem; font-weight: 700; margin: 0 0 0.7rem; }
.options { display: flex; flex-direction: column; gap: 6px; }
.opt {
  display: flex; align-items: center; gap: 10px;
  text-align: left; padding: 8px 12px; border-radius: var(--radius-sm);
  border: 2px solid var(--line); background: var(--paper); font-size: 0.86rem; font-weight: 600;
}
.opt-letter {
  flex-shrink: 0; width: 24px; height: 24px; border-radius: 50%;
  background: var(--sand); color: var(--orange-dark); font-family: var(--font-display);
  font-weight: 700; font-size: 0.78rem; display: flex; align-items: center; justify-content: center;
}
.opt.correct .opt-letter { background: var(--green); color: #fff; }
.opt.incorrect .opt-letter { background: var(--red); color: #fff; }
.opt.correct { background: var(--green-bg); border-color: var(--green); }
.opt.incorrect { background: var(--red-bg); border-color: var(--red); }
.opt:disabled { cursor: default; }

.feedback-box { margin-top: 0.5rem; }
.feedback-box.feedback-ok, .feedback-box.feedback-ko {
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.85rem;
  border: 1.5px solid;
}
.feedback-box.feedback-ok { border-color: color-mix(in srgb, var(--green) 55%, transparent); background: color-mix(in srgb, var(--green) 8%, transparent); }
.feedback-box.feedback-ko { border-color: color-mix(in srgb, var(--red) 55%, transparent); background: color-mix(in srgb, var(--red) 7%, transparent); }
.feedback-title { font-weight: 800; margin: 0 0 4px; }
.feedback-title.ok { color: var(--green); }
.feedback-title.ko { color: var(--red); }
#feedback-explain { font-weight: 700; color: inherit; }

.stars-row { display: flex; justify-content: center; gap: 8px; margin: 0.65rem 0 1.15rem; }
.stars-row span { display: inline-flex; transform: scale(1.5); }

.unlock-banner { display: flex; align-items: center; gap: 8px; background: var(--green-bg); color: var(--green); border-radius: var(--radius-sm); padding: 10px 12px; margin: 1rem 0; font-size: 0.85rem; font-weight: 600; }
.retry-banner { display: flex; align-items: center; gap: 8px; background: var(--red-bg); color: var(--red); border-radius: var(--radius-sm); padding: 10px 12px; margin: 1rem 0; font-size: 0.85rem; font-weight: 600; }

nav.tabbar {
  z-index: 30;
  display: flex; border-top: 1px solid var(--line); background: var(--paper);
  position: sticky; bottom: 0;
}
nav.tabbar button {
  flex: 1; background: none; border: none; padding: 10px 4px 8px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  color: var(--muted); font-size: 0.68rem; font-weight: 600;
}
nav.tabbar button.active { color: var(--orange); }
.tab-lang { position: relative; }
.tab-lang-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--orange); color: #fff; font-size: 0.68rem; font-weight: 800;
  animation: langWiggle 2.4s ease-in-out infinite;
}
@keyframes langWiggle {
  0%, 100% { transform: scale(1) rotate(0deg); }
  8% { transform: scale(1.12) rotate(-6deg); }
  16% { transform: scale(1.12) rotate(6deg); }
  24% { transform: scale(1) rotate(0deg); }
}
@media (prefers-reduced-motion: reduce) {
  .tab-lang-badge { animation: none; }
}

.empty-hint { text-align: center; padding: 2rem 1rem; color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  .btn-primary:active { transform: none; }
}

/* Level announcement overlay — a boxing-ring-style reveal shown
   right before the first question of a new level. */
.level-announce {
  position: fixed;
  inset: 0;
  background: rgba(20, 16, 10, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 60;
  opacity: 0;
  animation: overlayFadeIn 0.4s ease forwards;
}
.level-sign {
  position: relative;
  overflow: hidden;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  border: none;
  border-radius: 0;
  background: url('assets/level-signs.jpeg') center / cover;
  animation: signPop 0.55s cubic-bezier(.34, 1.56, .64, 1) both;
}
.level-sign .shine {
  position: absolute;
  top: 0;
  left: 0;
  width: 45%;
  height: 100%;
  background: linear-gradient(120deg, transparent, rgba(255,255,255,0.9), transparent);
  animation: shineSweep 1s ease-in-out 0.35s both;
}
.level-sign-card {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(255,255,255,0.96);
  border-radius: 16px;
  padding: 1.5rem 1.75rem;
  text-align: center;
  box-shadow: 0 8px 26px rgba(0,0,0,0.22);
  width: min(84vw, 340px);
}
.level-sign-theme { font-size: 1.15rem; color: var(--ink); margin: 0 0 6px; font-weight: 700; line-height: 1.25; }
.level-sign-num { font-family: var(--font-display); font-size: 2.4rem; font-weight: 700; margin: 0; color: var(--orange-dark); }
.level-sign-country { font-size: 0.85rem; color: var(--muted); margin: 0 0 4px; font-weight: 700; letter-spacing: 0.02em; }

@keyframes signPop {
  0% { transform: scale(0.55); opacity: 0; }
  65% { transform: scale(1.08); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes shineSweep {
  0% { transform: translateX(-160%) skewX(-20deg); }
  100% { transform: translateX(280%) skewX(-20deg); }
}
@keyframes overlayFadeIn {
  0% { opacity: 0; }
  100% { opacity: 1; }
}

.question-screen {
  background:
    linear-gradient(rgba(243,250,255,0.97), rgba(243,250,255,0.97)),
    url('assets/level-signs.jpeg') center / cover;
  background-attachment: local, local;
}
.quiz-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  box-shadow: 0 4px 14px rgba(26,20,10,0.06);
}

.voice-toggle { display: flex; gap: 4px; }
.voice-toggle button {
  background: var(--paper); border: 2px solid var(--line); border-radius: 999px;
  width: 30px; height: 30px; padding: 0; display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 0.8rem; font-weight: 700;
}
.voice-toggle button.active { border-color: var(--orange); color: var(--orange); background: var(--sand); }
.listen-btn {
  display: inline-flex; align-items: center; gap: 6px; background: var(--surface-2, var(--sand));
  border: none; border-radius: 999px; padding: 6px 12px; font-size: 0.78rem; font-weight: 700;
  color: var(--ink); margin-bottom: 0.6rem;
}

@media (prefers-reduced-motion: reduce) {
  .level-sign, .level-sign .shine, .level-announce { animation: none; }
  .level-announce { opacity: 1; }
}

.big-heading { font-family: var(--font-display); font-size: 1.65rem; line-height: 1.25; font-weight: 700; }
.big-label { font-size: 1.05rem; font-weight: 700; color: var(--ink); }

.home-features { display: flex; gap: 10px; margin: 1.5rem 0; flex-wrap: wrap; }
.home-disclaimer {
  font-size: 0.72rem;
  line-height: 1.5;
  font-weight: 600;
  text-align: center;
  color: #FAEEDA;
  background: #854F0B;
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.9rem;
  margin: 1.5rem 0 0.5rem;
}
.home-feature {
  flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 0.85rem 0.5rem; color: var(--muted); font-size: 0.78rem; font-weight: 600; text-align: center;
  cursor: pointer; font-family: inherit;
}
.home-feature:active { background: var(--sand); border-color: var(--orange); }
.home-feature svg { color: var(--orange); }

.theme-complete-banner {
  margin-top: 1.25rem;
  padding: 1.25rem 1rem;
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--sand), var(--paper));
  border: 1px solid var(--line);
  text-align: center;
  position: relative;
  overflow: hidden;
}
.theme-complete-banner .star-particle {
  position: absolute;
  color: #FFC53D;
  animation: starPop 1.6s ease-in-out infinite;
}
@keyframes starPop {
  0%, 100% { opacity: 0.3; transform: scale(0.8) rotate(0deg); }
  50% { opacity: 1; transform: scale(1.15) rotate(25deg); }
}
@media (prefers-reduced-motion: reduce) {
  .theme-complete-banner .star-particle { animation: none; }
}

@keyframes fadeInOut {
  0% { opacity: 0; }
  10% { opacity: 1; }
  85% { opacity: 1; }
  100% { opacity: 0; }
}

.splash-screen { padding: 0; display: flex; align-items: center; justify-content: center; background: #C7CDD3; }
.splash-screen img { width: 100%; height: 100%; object-fit: contain; display: block; animation: fadeInOut 2s ease forwards; }

.flag-grow-overlay {
  position: fixed;
  inset: 0;
  background: var(--cream);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 65;
  overflow: hidden;
}
.flag-grow-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  opacity: 0;
  transform: scale(0.9);
  animation: flagNamePop 1.2s ease forwards;
}
.flag-grow-name {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--ink);
  text-align: center;
  padding: 0 1.5rem;
}
.flag-grow-pct-row { display: flex; align-items: center; gap: 10px; }
.flag-grow-pct-track { width: 140px; height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; }
.flag-grow-pct-fill { height: 100%; background: var(--green); border-radius: 999px; }
.flag-grow-pct-label { font-size: 1rem; font-weight: 700; color: var(--green); }
@keyframes flagNamePop {
  0% { opacity: 0; transform: scale(0.9); }
  20% { opacity: 1; transform: scale(1); }
  80% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .flag-grow-block { animation: none; opacity: 1; transform: none; }
}

.btn-install-dark {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; background: var(--ink); color: #fff; border: none;
  padding: 16px; font-weight: 700; font-size: 1rem; border-radius: var(--radius-sm);
  margin-top: 0.75rem;
}
.btn-install-dark:active { opacity: 0.85; }

.install-hint {
  margin-top: 0.75rem;
  background: var(--surface-2, rgba(255,255,255,0.05));
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
}
.install-steps { margin: 0; padding-left: 1.1rem; font-size: 0.85rem; line-height: 1.6; color: var(--text-secondary, inherit); }
.install-steps li { margin-bottom: 4px; }
.install-steps li:last-child { margin-bottom: 0; }
.install-steps strong { color: inherit; font-weight: 700; }

.qr-card { text-align: center; margin-top: 0.75rem; }
.qr-card img { width: 130px; height: 130px; border: 1px solid var(--line); border-radius: 10px; padding: 6px; background: #fff; }

.q-sign-badge { display: inline-flex; }

.home-social { text-align: center; margin: 1rem 0; }

/* Signature move animations shown on the "ready" screen, per character
   family (football juggling, martial arts, dance, jump rope). */
.char-action-stage { max-width: 220px; margin: 0 auto; }
.action-wrap { position: relative; display: inline-block; width: 100%; }

.anim-bob { animation: actionBob 1.1s ease-in-out infinite; transform-origin: bottom center; }
@keyframes actionBob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
.action-ball {
  position: absolute; left: 50%; bottom: 18%;
  font-size: 1.6rem; line-height: 1;
  animation: ballJuggle 1.1s ease-in-out infinite;
  transform-origin: center;
}
@keyframes ballJuggle {
  0%   { transform: translate(-50%, 0) rotate(0deg); }
  35%  { transform: translate(-65%, -90px) rotate(-140deg); }
  50%  { transform: translate(-50%, -130px) rotate(-200deg); }
  65%  { transform: translate(-35%, -90px) rotate(-260deg); }
  100% { transform: translate(-50%, 0) rotate(-360deg); }
}

.anim-dance { animation: actionDance 0.9s ease-in-out infinite; transform-origin: bottom center; }
@keyframes actionDance {
  0%, 100% { transform: rotate(-6deg) translateX(-4px); }
  50% { transform: rotate(6deg) translateX(4px); }
}

.anim-jump { animation: actionJump 0.55s ease-in-out infinite; transform-origin: bottom center; }
@keyframes actionJump {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-16px); }
}
.action-rope {
  position: absolute; left: 50%; bottom: 8%; width: 130%; height: 90%;
  transform: translateX(-50%);
  border: 3px solid var(--orange-dark, #1899D6);
  border-radius: 50%;
  clip-path: inset(50% 0 0 0);
  animation: ropeSwing 0.55s linear infinite;
  transform-origin: center;
}
@keyframes ropeSwing {
  0% { transform: translateX(-50%) rotate(0deg) scaleY(0.5); }
  50% { transform: translateX(-50%) rotate(180deg) scaleY(1); }
  100% { transform: translateX(-50%) rotate(360deg) scaleY(0.5); }
}

.anim-martial { animation: actionMartial 0.7s ease-in-out infinite; transform-origin: bottom center; }
@keyframes actionMartial {
  0%, 100% { transform: rotate(0deg) translateX(0); }
  25% { transform: rotate(-9deg) translateX(-6px); }
  75% { transform: rotate(9deg) translateX(6px); }
}
.action-impact {
  position: absolute; top: 30%; right: 6%;
  font-size: 1.5rem; color: var(--orange);
  animation: impactFlash 0.7s ease-in-out infinite;
}
@keyframes impactFlash {
  0%, 100% { opacity: 0; transform: scale(0.6) translate(0,0); }
  25% { opacity: 1; transform: scale(1.1) translate(-10px, 10px); }
  50% { opacity: 0; transform: scale(0.6) translate(0,0); }
  75% { opacity: 1; transform: scale(1.1) translate(10px, 40px); }
}

input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 6px; border-radius: 999px;
  background: var(--line); outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--orange); border: 3px solid #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3); cursor: pointer;
}
input[type="range"]::-moz-range-thumb {
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--orange); border: 3px solid #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3); cursor: pointer;
}

/* Next-level guide: bouncing arrow + blue trail */
.path::after {
  content: ''; position: absolute; top: 0; left: 50%;
  width: 4px; height: var(--prog, 0px); border-radius: 4px;
  background: var(--orange); transform: translateX(-50%); z-index: 0;
}
.next-arrow {
  position: absolute; top: -50px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; pointer-events: none;
  animation: nextBounce 1.1s ease-in-out infinite; z-index: 3;
}
.next-arrow b {
  background: var(--orange); color: #fff; font-size: 0.72rem; font-weight: 800;
  padding: 4px 10px; border-radius: 999px; white-space: nowrap; box-shadow: 0 2px 0 var(--orange-dark);
}
.next-arrow i { font-style: normal; color: var(--orange); font-size: 1rem; line-height: 1; margin-top: -2px; }
@keyframes nextBounce { 0%,100% { transform: translate(-50%, 0); } 50% { transform: translate(-50%, 7px); } }
.path-node.active { animation: nodePulse 1.8s ease-in-out infinite; }
@keyframes nodePulse {
  0%,100% { box-shadow: 0 4px 0 var(--orange-dark), 0 0 0 0 rgba(28,176,246,0.45); }
  50% { box-shadow: 0 4px 0 var(--orange-dark), 0 0 0 12px rgba(28,176,246,0); }
}

/* Accueil : tuiles pays avec pourcentage d'avancée */
.home-tiles-title { font-weight: 800; font-family: var(--font-display); text-align: center; margin: 0.9rem 0 0.5rem; color: var(--ink); }
.home-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 0.5rem; }
.home-tile { display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 8px 6px 9px; background: var(--paper); border: 2px solid var(--line); border-radius: 14px; font: inherit; color: var(--ink); cursor: pointer; }
.home-tile.current { border-color: var(--tile); box-shadow: 0 3px 0 var(--tile); }
.home-tile:active { transform: translateY(1px); }
.home-tile-flag { display: flex; width: 34px; height: 22px; border-radius: 4px; overflow: hidden; border: 1px solid rgba(0,0,0,0.12); }
.home-tile-flag i { flex: 1; }
.home-tile-name { font-size: 0.74rem; font-weight: 700; text-align: center; line-height: 1.1; min-height: 1.6em; display: flex; align-items: center; }
.home-tile-bar { width: 100%; height: 6px; border-radius: 3px; background: var(--sand); overflow: hidden; }
.home-tile-bar b { display: block; height: 100%; background: var(--tile); border-radius: 3px; }
.home-tile-pct { font-size: 0.72rem; font-weight: 800; color: var(--tile); }

/* Accueil compact : tout tient sur un seul écran */
.home-compact { padding-bottom: 0.5rem; }
.home-compact .home-hero-small { aspect-ratio: 16 / 6.2; }
.home-compact .home-tiles-title { margin: 0.45rem 0 0.35rem; font-size: 0.95rem; }
.home-compact .home-tiles { grid-template-columns: repeat(4, 1fr); gap: 5px; margin-bottom: 0.4rem; }
.home-compact .home-tile { padding: 5px 3px 6px; gap: 3px; border-radius: 11px; border-width: 1.5px; }
.home-compact .home-tile-flag { width: 26px; height: 17px; }
.home-compact .home-tile-name { font-size: 0.62rem; min-height: 1.5em; }
.home-compact .home-tile-pct { font-size: 0.64rem; }
.home-compact .home-tile-bar { height: 5px; }
.home-controls { display: flex; gap: 6px; align-items: stretch; margin: 0.2rem 0 0.3rem; }
.home-controls .home-lang-btn { flex: 1; padding: 9px 4px; font-size: 0.85rem; }
.home-controls .home-share-mini { flex: 1.15; margin: 0; padding: 9px 6px; font-size: 0.85rem; white-space: nowrap; }
.home-compact .home-disclaimer { font-size: 0.6rem; line-height: 1.25; margin: 0.2rem 0 0; }
.home-compact .home-social { font-size: 0.66rem !important; margin: 0.25rem 0 0 !important; }
.home-compact .home-social + p { margin: 0.15rem 0 0 !important; }

.home-features-row { gap: 6px; margin: 0.3rem 0 0.2rem; flex-wrap: nowrap; }
.home-features-row .home-feature { flex: 1; padding: 8px 4px; font-size: 0.78rem; flex-direction: column; gap: 3px; align-items: center; justify-content: center; }
.home-features-row .home-feature svg { width: 18px; height: 18px; }

/* Accessoires */
.wardrobe-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.wardrobe-item { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px; background: var(--paper); border: 2px solid var(--line); border-radius: 12px; font: inherit; color: var(--ink); cursor: pointer; }
.wardrobe-item.on { border-color: var(--orange); background: var(--sand); }
.wardrobe-item.locked { opacity: 0.55; cursor: default; }
.wardrobe-icon { font-size: 1.5rem; line-height: 1.2; }
.wardrobe-name { font-size: 0.66rem; font-weight: 700; text-align: center; line-height: 1.1; min-height: 2.2em; display: flex; align-items: center; }
.wardrobe-status { font-size: 0.68rem; font-weight: 800; color: var(--orange-dark); }
.acc-banner { display: flex; align-items: center; gap: 10px; background: var(--sand); border: 2px solid var(--orange); border-radius: 14px; padding: 10px 14px; margin: 0.7rem 0 0; text-align: left; }
.acc-banner-icon { font-size: 2rem; }
.acc-banner-title { margin: 0; font-weight: 800; font-family: var(--font-display); color: var(--orange-dark); }
.acc-banner-name { margin: 0; font-size: 0.9rem; }

/* icônes africaines des étapes */
.path-node .node-art { position:absolute; inset:0; border-radius:50%; overflow:hidden; display:block; }
.path-node.locked .node-art { filter: grayscale(1) opacity(0.55); }
.path-node.active { width: 78px; height: 78px; }
.path-node .node-badge { position:absolute; right:-4px; bottom:-4px; width:24px; height:24px; border-radius:50%; display:flex; align-items:center; justify-content:center; background:#fff; border:2px solid var(--green); color:var(--green); z-index:2; }
.path-node .node-badge svg { width:14px; height:14px; }
.path-node .node-badge.lock { border-color:#9aa5b1; color:#6b7785; }
.path-node.done .node-art { filter:none; }

.theme-art { display:inline-block; border-radius:50%; overflow:hidden; border:3px solid var(--orange); background:#fff; box-sizing:border-box; flex-shrink:0; }
.level-sign-card > .theme-art { display:block; margin:0 auto 8px; }

.skip-hint { font-size:0.72rem; color:var(--muted); margin:10px 0 0; opacity:0.8; text-align:center; }
.level-announce { cursor:pointer; }

/* ---- Défis, séries, compteur ---- */
.tab-emoji { font-size: 1.25rem; line-height: 1; }
.streak-chip { display:inline-flex; align-items:center; gap:4px; padding:4px 10px; border-radius:999px; background:var(--sand); font-weight:800; color:#B45309; }
.streak-chip.on { background:#FFE8B8; }
.streak-bar { display:flex; align-items:center; justify-content:space-between; gap:8px; margin-bottom:8px; }
.duel-pill { border:1.5px solid var(--line); background:#fff; border-radius:999px; padding:6px 12px; font-weight:700; font-size:0.82rem; cursor:pointer; color:var(--orange-dark); }
.streak-card { display:flex; gap:12px; align-items:center; margin-bottom:10px; }
.streak-flame { font-size:2.2rem; }
.duel-card { border:2px solid var(--orange); margin-bottom:10px; }
.challenge-card { display:flex; gap:12px; align-items:center; width:100%; text-align:left; margin-bottom:10px; cursor:pointer; font:inherit; color:inherit; }
.challenge-card:active { background:var(--sand); }
.ch-ico { font-size:1.8rem; }
.lb-row { display:grid; grid-template-columns:34px 1fr auto; gap:6px; padding:5px 0; border-bottom:1px solid var(--line); }
.player-card { text-align:center; margin-bottom:80px; }
.home-players { text-align:center; margin:10px 0 4px; color:var(--muted); font-size:0.9rem; }
.run-top { display:flex; align-items:center; gap:10px; }
.run-quit { padding:6px 12px; width:auto; flex:none; }
.run-bar { flex:1; height:10px; background:var(--sand); border-radius:6px; overflow:hidden; }
.run-bar-fill { height:100%; background:var(--orange); transition:width .3s; }
.run-q { font-size:1.15rem; margin:4px 0 12px; }
.run-fb { margin:10px 0; }
.run-fb.good { border-color:var(--green); background:var(--green-bg); }
.run-fb.bad { border-color:var(--red); background:var(--red-bg); }
.run-score { font-size:3.5rem; font-weight:800; color:var(--orange); }
.run-score small { font-size:1.4rem; color:var(--muted); }
.home-players-top { margin: 10px 0 2px; font-size: 0.95rem; background: var(--sand); border-radius: 999px; padding: 6px 12px; width: fit-content; margin-left: auto; margin-right: auto; color: var(--text, #243B53); }
.splash-video { background: #FEFEFE; position: relative; }
.splash-video video { width: 100%; height: 100%; object-fit: contain; display: block; background: #FEFEFE; }
.intro-sound { white-space: nowrap; position: absolute; bottom: 7%; left: 50%; transform: translateX(-50%); border: 1.5px solid #cfd6dc; background: #fff; border-radius: 999px; padding: 10px 18px; font: inherit; font-weight: 700; color: #243B53; box-shadow: 0 2px 8px rgba(0,0,0,.12); }
.intro-sound[hidden] { display: none; }

.home-back-row { display: flex; justify-content: flex-start; margin: 0 0 8px; }
.home-back { border: 1.5px solid var(--line); background: var(--paper); color: var(--ink); border-radius: 999px; padding: 7px 14px; font: inherit; font-weight: 800; font-size: 0.85rem; cursor: pointer; box-shadow: 0 2px 0 var(--line); }
.home-back:active { transform: translateY(1px); box-shadow: none; }

/* Accueil 18 pays : 6 colonnes pour tout voir sans défiler */
.home-compact .home-tiles { grid-template-columns: repeat(6, 1fr); gap: 4px; }
.home-compact .home-tile { padding: 4px 2px 4px; gap: 2px; border-radius: 9px; }
.home-compact .home-tile-flag { width: 22px; height: 14px; }
.home-compact .home-tile-name { font-size: 0.54rem; min-height: 2.1em; line-height: 1.05; }
.home-compact .home-tile-pct { font-size: 0.56rem; }
.home-compact .home-tile-bar { height: 4px; }

/* ---- Coffres de déblocage d'accessoires ---- */
.chest-wrap { text-align:center; margin:.6rem 0; }
.chest-btn { background:none; border:0; padding:0; cursor:pointer; animation: chestShake 1.4s ease-in-out infinite; }
.chest-hint { font-weight:800; margin:.2rem 0 0; color:var(--orange-dark); }
.chest-lid { transform-origin: 15px 45px; transition: transform .45s cubic-bezier(.3,1.6,.5,1); }
.chest-glow, .chest-stars { opacity:0; transition: opacity .4s; }
.chest-wrap.open .chest-btn { animation: none; }
.chest-wrap.open .chest-lid { transform: rotate(-68deg); }
.chest-wrap.open .chest-glow { opacity:.9; animation: chestPulse 1s ease-in-out infinite; }
.chest-wrap.open .chest-stars { opacity:1; animation: chestPop .8s ease-out; }
.chest-wrap.open .chest-hint { display:none; }
.chest-wrap:not(.open) ~ .acc-banner { display:none !important; }
.chest-wrap.open ~ .acc-banner { animation: chestPop .6s ease-out; }
@keyframes chestShake { 0%,100% { transform: rotate(0) scale(1); } 20% { transform: rotate(-5deg) scale(1.05); } 40% { transform: rotate(5deg) scale(1.05); } 60% { transform: rotate(-3deg); } }
@keyframes chestPulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.18); } }
@keyframes chestPop { 0% { transform: scale(.4); opacity:0; } 70% { transform: scale(1.15); opacity:1; } 100% { transform: scale(1); } }

/* ---- Personnages plus fun : petit rebond permanent ---- */
.screen.center > div[style*="max-width"] > svg { animation: charFun 1.8s ease-in-out infinite; transform-origin: 50% 100%; }
@keyframes charFun { 0%,100% { transform: translateY(0) scale(1,1); } 30% { transform: translateY(-8px) scale(.97,1.04) rotate(-1.5deg); } 55% { transform: translateY(0) scale(1.04,.96); } 75% { transform: translateY(-3px) rotate(1.5deg); } }
@media (prefers-reduced-motion: reduce) { .screen.center > div[style*="max-width"] > svg, .chest-btn { animation:none !important; } }

/* ---- Logo RouteAfrica flashy ---- */
.home-hero { position:relative; }
.home-hero img { filter: saturate(1.35) contrast(1.06) brightness(1.04); }
.home-hero::after { content:""; position:absolute; top:0; bottom:0; width:40%; left:-60%; background: linear-gradient(100deg,transparent,rgba(255,255,255,.55),transparent); transform: skewX(-18deg); animation: heroShine 4.5s ease-in-out infinite; pointer-events:none; }
@keyframes heroShine { 0%,60% { left:-60%; } 100% { left:130%; } }
.btn-primary { box-shadow: 0 5px 0 var(--orange-dark), 0 8px 18px rgba(28,176,246,.35); }
@media (prefers-reduced-motion: reduce) { .home-hero::after { animation:none; display:none; } }
