/* ============================================================================
   CIRCUIT FLOW — INTERFACE "Aéroclub Jouet" (voir DEVLOG.md > Bible visuelle)
   Panneaux crème, encre marine, "marche" d'ombre sous chaque élément cliquable
   qui s'écrase à l'appui, chiffres toujours en 800, couleurs de rôle fixes :
   orange = action principale, bleu = boutique, violet = rebirth / boost,
   soleil = argent, magenta = gemmes, menthe = fusion/succès, cerise = erreur.
   Couches (z-index) : HUD 5 · toasts 15 · panneaux 20 · tutoriel 40 ·
   popups 50 · transition 60 · envol des récompenses 70 · pub simulée 90 · chargement 100
   ============================================================================ */
:root {
  --ink: #22304F;
  --slate: #5E6A85;
  --cream: #FFF8EC;
  --sand: #F3E6CF;
  --paper: #FFFDF7;
  --sky: #8ED3FF;
  --grass: #8FD26B;
  --sun: #FFC53D;
  --sun-deep: #E8A21C;
  --orange: #FF7A3D;
  --orange-deep: #D9582A;
  --blue: #3FA7F5;
  --blue-deep: #2A82CC;
  --purple: #8B63E8;
  --purple-deep: #6A45C4;
  --gem: #E0529C;
  --gem-deep: #B83679;
  --mint: #2DC98E;
  --mint-deep: #1FA372;
  --cherry: #F0484E;
  --font: 'Fredoka', 'Baloo 2', 'Arial Rounded MT Bold', 'Nunito', 'Trebuchet MS', 'Segoe UI', system-ui, sans-serif;
  --r-panel: 26px;
  --r-btn: 18px;
  --press: 5px;
  --outline-text: 0 2px 0 var(--ink), 2px 0 0 var(--ink), -2px 0 0 var(--ink), 0 -2px 0 var(--ink),
    1.5px 1.5px 0 var(--ink), -1.5px 1.5px 0 var(--ink), 1.5px -1.5px 0 var(--ink), -1.5px -1.5px 0 var(--ink), 0 3.5px 0 var(--ink);
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; width: 100%; height: 100%;
  overflow: hidden;
  font-family: var(--font);
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
  user-select: none; -webkit-user-select: none;
  -webkit-touch-callout: none;
  overscroll-behavior: none;
  touch-action: manipulation;
}
body {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  background:
    radial-gradient(ellipse 30% 60% at 12% 0%, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0) 70%),
    radial-gradient(ellipse 25% 50% at 78% 10%, rgba(255, 255, 255, 0.45), rgba(255, 255, 255, 0) 70%),
    linear-gradient(180deg, #7CCBFF 0%, var(--sky) 100%);
}
button { font-family: var(--font); color: var(--ink); }
.hidden { display: none !important; }

.ic { display: inline-block; width: 1.35em; height: 1.35em; flex: 0 0 auto; vertical-align: middle; }
[data-ic] { display: inline-block; flex: 0 0 auto; }
[data-ic] > .ic, .icon-btn > .ic, .shop-upgrade-icon > .ic, .popup-icon > .ic { display: block; width: 100%; height: 100%; }

/* ============================================================================
   HUD
   ============================================================================ */
#hud {
  flex: 0 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: calc(8px + env(safe-area-inset-top)) 14px 8px;
  position: relative;
  z-index: 5;
}
.hud-group { display: flex; align-items: center; gap: 10px; min-width: 0; }
.hud-group-right { gap: 8px; }

.chip {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 42px;
  padding: 0 14px 0 34px;
  margin-left: 12px;
  background: var(--cream);
  border: 3px solid var(--ink);
  border-radius: 999px;
  box-shadow: 0 3px 0 var(--ink);
  white-space: nowrap;
  font-family: var(--font);
}
.chip-icon {
  position: absolute; left: -14px; top: 50%;
  width: 40px; height: 40px;
  transform: translateY(-50%);
  filter: drop-shadow(0 2px 0 rgba(34, 48, 79, 0.25));
}
.chip-stack { display: flex; flex-direction: column; line-height: 1; }
.chip-value { font-size: 19px; font-weight: 800; letter-spacing: 0.01em; font-variant-numeric: tabular-nums; }
.chip-sub { font-size: 11px; font-weight: 700; color: var(--mint-deep); margin-top: 2px; }
.chip-sub::before { content: '+'; }
.chip-cash { min-width: 128px; }
.chip-gems .chip-value { color: var(--gem-deep); }
.chip-mini { height: 34px; padding: 0 11px 0 26px; margin-left: 10px; border-width: 2.5px; box-shadow: 0 2.5px 0 var(--ink); }
.chip-mini .chip-icon { width: 32px; height: 32px; left: -11px; }
.chip-mini .chip-value { font-size: 14px; }
.chip-trophy { cursor: pointer; }
.chip-trophy .chip-value { color: var(--purple-deep); }
.chip-turbo { background: #FFE3CF; animation: turbo-pulse 0.8s ease-in-out infinite; }
.chip-turbo .chip-value { color: var(--orange-deep); }
.chip-boost { background: #EDE5FD; }
.chip-boost .chip-value { color: var(--purple-deep); }
@keyframes turbo-pulse { 50% { transform: scale(1.06); } }

@keyframes chip-bump { 0% { transform: scale(1); } 35% { transform: scale(1.1); } 100% { transform: scale(1); } }
.bump { animation: chip-bump 0.3s cubic-bezier(0.3, 1.6, 0.5, 1); }

.icon-btn {
  position: relative;
  width: 42px; height: 42px;
  padding: 5px;
  flex: 0 0 auto;
  border: 3px solid var(--ink);
  border-radius: 14px;
  background: var(--cream);
  box-shadow: 0 3px 0 var(--ink);
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.icon-btn:active { transform: translateY(3px); box-shadow: 0 0 0 var(--ink); }
.icon-btn [data-ic] { display: block; width: 100%; height: 100%; }
#reset-btn { background: #FFE3DF; }

.level-wrap {
  position: relative; flex: 0 0 auto;
  width: 50px; height: 50px;
  border-radius: 50%;
  background: var(--cream);
  border: 3px solid var(--ink);
  box-shadow: 0 3px 0 var(--ink);
  display: flex; align-items: center; justify-content: center;
}
.level-ring { position: absolute; inset: 1px; width: calc(100% - 2px); height: calc(100% - 2px); }
.level-ring .bg { stroke: rgba(34, 48, 79, 0.12); }
.level-ring .fg { stroke: var(--sun); transform: rotate(-90deg); transform-origin: 50% 50%; transition: stroke-dashoffset 0.35s ease; }
.level-text {
  position: relative;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--sun);
  border: 2.5px solid var(--ink);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 800;
}

/* Pastille rouge « quelque chose t'attend » */
.dot { display: none; position: absolute; top: -7px; right: -7px; width: 16px; height: 16px; border-radius: 50%; background: var(--cherry); border: 2.5px solid var(--ink); animation: badge-bounce 1.4s ease-in-out infinite; }
.has-dot > .dot { display: block; }

/* ============================================================================
   ZONE DE JEU
   ============================================================================ */
#stage {
  position: relative;
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  border-top: 3px solid var(--ink);
  border-bottom: 3px solid var(--ink);
  background: var(--grass);
}
#game-canvas { display: block; width: 100%; height: 100%; touch-action: none; }

/* ============================================================================
   BARRE D'ACTIONS (zone du pouce)
   ============================================================================ */
#toolbar {
  flex: 0 0 auto;
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: var(--sand);
  z-index: 5;
}
#toolbar::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 4px; background: rgba(255, 255, 255, 0.5); }

.btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 10px 18px;
  border: 3px solid var(--ink);
  border-radius: var(--r-btn);
  font-size: 17px; font-weight: 800;
  color: var(--cream);
  text-shadow: var(--outline-text);
  cursor: pointer;
  --btn-top: var(--cream); --btn-bottom: var(--sand); --btn-edge: #CDBB9C;
  background: linear-gradient(180deg, var(--btn-top) 0%, var(--btn-bottom) 100%);
  box-shadow: inset 0 3px 0 rgba(255, 255, 255, 0.4), 0 var(--press) 0 var(--btn-edge), 0 var(--press) 0 3px var(--ink);
  transition: transform 0.08s ease, box-shadow 0.08s ease, filter 0.15s ease;
  margin-bottom: calc(var(--press) + 3px);
  touch-action: manipulation;
}
.btn [data-ic], .btn > .ic { width: 30px; height: 30px; filter: drop-shadow(0 2px 0 rgba(34, 48, 79, 0.3)); }
.btn:hover:not(.is-disabled):not(:disabled) { filter: brightness(1.05); }
.btn:active:not(.is-disabled):not(:disabled) {
  transform: translateY(var(--press));
  box-shadow: inset 0 3px 0 rgba(255, 255, 255, 0.4), 0 0 0 var(--btn-edge), 0 0 0 3px var(--ink);
}
/* Désactivé : aplat sable, texte ardoise — mais TOUJOURS cliquable (.is-disabled)
   pour pouvoir expliquer pourquoi (« il manque 20$ »). */
.btn.is-disabled, .btn:disabled {
  cursor: not-allowed;
  --btn-top: #F1E9DA; --btn-bottom: #E4D8C3; --btn-edge: #C9BCA4;
  color: #8B8698;
  text-shadow: none;
}
.btn.is-disabled .ic, .btn.is-disabled [data-ic], .btn:disabled .ic { filter: grayscale(1) opacity(0.6); }
.btn.is-loading { pointer-events: none; opacity: 0.7; }
.btn.is-loading::after { content: ''; position: absolute; right: 8px; top: 50%; width: 14px; height: 14px; margin-top: -7px; border: 3px solid var(--cream); border-top-color: transparent; border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.btn-small { min-height: 36px; padding: 5px 10px; font-size: 15px; --press: 3px; margin-bottom: 6px; }

.btn-primary { --btn-top: #FF9B5E; --btn-bottom: var(--orange); --btn-edge: var(--orange-deep); }
.btn-blue { --btn-top: #6CC0FF; --btn-bottom: var(--blue); --btn-edge: var(--blue-deep); }
.btn-purple { --btn-top: #A988F5; --btn-bottom: var(--purple); --btn-edge: var(--purple-deep); }
.btn-mint { --btn-top: #54DCA8; --btn-bottom: var(--mint); --btn-edge: var(--mint-deep); }
.btn-gem { --btn-top: #F07BB9; --btn-bottom: var(--gem); --btn-edge: var(--gem-deep); }
.btn-sun { --btn-top: #FFD978; --btn-bottom: var(--sun); --btn-edge: var(--sun-deep); }
.btn-ghost { --btn-top: var(--paper); --btn-bottom: var(--cream); --btn-edge: #D8CBB3; color: var(--ink); text-shadow: none; }

/* Bouton d'achat : la vedette */
#buy-btn { min-width: 220px; padding: 8px 20px 8px 10px; justify-content: flex-start; gap: 10px; overflow: hidden; }
#buy-btn > * { position: relative; z-index: 1; }
.btn-plane { width: 70px; height: 51px; flex: 0 0 auto; margin: -8px 0 -6px; }
.btn-stack { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.05; }
#buy-btn .btn-label { font-size: 21px; white-space: nowrap; }
#buy-btn .btn-label small { font-size: 13px; opacity: 0.95; }
.btn-price {
  display: inline-flex; align-items: center; gap: 4px;
  margin-top: 3px; padding: 1px 9px 1px 3px;
  border-radius: 999px;
  background: rgba(34, 48, 79, 0.28);
  font-size: 15px;
  text-shadow: 0 1.5px 0 var(--ink);
}
.btn-price [data-ic] { width: 20px; height: 20px; filter: none; }
/* Pas assez d'argent : le bouton devient une JAUGE qui se remplit (« presque ! ») */
#buy-btn.is-disabled { --btn-top: #F3E6CF; --btn-bottom: #E6D5B8; --btn-edge: #C9B593; }
#buy-btn.is-disabled::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0;
  width: var(--afford, 0%);
  background: linear-gradient(180deg, #FFC9A6, #FFA46E);
  transition: width 0.25s ease;
  z-index: 0;
}
#buy-btn.is-full::before { display: none; }
#buy-btn.is-disabled .btn-plane { opacity: 0.75; }
#buy-btn.is-disabled .btn-price { background: rgba(34, 48, 79, 0.12); color: var(--ink); text-shadow: none; }

.btn-side { font-size: 16px; padding: 10px 14px; }
#shop-btn { justify-self: end; }
#rebirth-btn { justify-self: start; }
.btn-lock { position: absolute; top: -12px; right: -10px; width: 26px; height: 26px; }
.btn-lock [data-ic] { width: 26px; height: 26px; }
#rebirth-btn.ready { animation: prestige-glow 2.2s ease-in-out infinite; }
@keyframes prestige-glow { 50% { filter: brightness(1.15) drop-shadow(0 0 10px rgba(255, 197, 61, 0.8)); } }

#buy-feedback {
  position: fixed; z-index: 72;
  transform: translate(-50%, -100%);
  max-width: 90vw;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--cherry);
  border: 2.5px solid var(--ink);
  color: var(--cream);
  font-size: 13.5px; font-weight: 800;
  text-shadow: 0 1.5px 0 var(--ink);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}
@keyframes feedback-shake {
  0%, 100% { transform: translate(-50%, -100%); }
  20% { transform: translate(calc(-50% - 7px), -100%); }
  40% { transform: translate(calc(-50% + 6px), -100%); }
  60% { transform: translate(calc(-50% - 4px), -100%); }
  80% { transform: translate(calc(-50% + 2px), -100%); }
}
#buy-feedback.show { opacity: 1; animation: feedback-shake 0.4s ease; }

/* ============================================================================
   PANNEAUX — même grammaire partout
   ============================================================================ */
.panel {
  position: relative;
  background: var(--cream);
  border: 3px solid var(--ink);
  border-radius: var(--r-panel);
  box-shadow: 0 6px 0 var(--ink), 0 24px 60px rgba(34, 48, 79, 0.35);
}
.panel-ribbon {
  position: absolute; top: -22px; left: 50%;
  transform: translateX(-50%);
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 26px;
  border: 3px solid var(--ink);
  border-radius: 14px;
  background: linear-gradient(180deg, #FF9B5E, var(--orange));
  box-shadow: 0 4px 0 var(--ink);
  color: var(--cream);
  font-size: 22px; font-weight: 800;
  text-shadow: var(--outline-text);
  white-space: nowrap;
  max-width: 92%;
  z-index: 3;
}
.panel-ribbon [data-ic] { width: 30px; height: 30px; }
.ribbon-gold { background: linear-gradient(180deg, #FFD978, var(--sun)); }
.ribbon-purple { background: linear-gradient(180deg, #A988F5, var(--purple)); }
.ribbon-mint { background: linear-gradient(180deg, #54DCA8, var(--mint)); }

.close-btn {
  position: absolute; top: -14px; right: -14px;
  width: 48px; height: 48px;
  padding: 0; border: none; background: none;
  cursor: pointer; z-index: 4;
  filter: drop-shadow(0 3px 0 var(--ink));
  transition: transform 0.1s ease;
}
.close-btn::before { content: ''; position: absolute; inset: -8px; } /* zone de toucher élargie */
.close-btn:active { transform: scale(0.9); }
.close-btn [data-ic] { width: 100%; height: 100%; display: block; }

.overlay {
  position: fixed; inset: 0; z-index: 20;
  display: flex; align-items: center; justify-content: center;
  padding: calc(36px + env(safe-area-inset-top)) 14px calc(18px + env(safe-area-inset-bottom));
}
.overlay-backdrop { position: absolute; inset: 0; background: rgba(34, 48, 79, 0.55); animation: fade-in 0.2s ease both; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes panel-pop { 0% { transform: scale(0.85) translateY(14px); opacity: 0; } 100% { transform: none; opacity: 1; } }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 14px 4px 5px;
  border: 2.5px solid var(--ink);
  border-radius: 999px;
  background: var(--paper);
  font-size: 16px; font-weight: 800;
  white-space: nowrap;
}
.pill [data-ic], .pill > .ic { width: 26px; height: 26px; }
.pill-gems { color: var(--gem-deep); }
.pill-purple { background: #EDE5FD; color: var(--purple-deep); }

/* ============================================================================
   BOUTIQUE
   ============================================================================ */
.shop-shell, .quest-shell {
  display: flex; flex-direction: column;
  width: min(94vw, 600px);
  max-height: 100%;
  padding-top: 26px;
  animation: panel-pop 0.3s cubic-bezier(0.22, 1.4, 0.36, 1) both;
}
.shop-header { display: flex; justify-content: center; gap: 12px; padding: 8px 18px 10px; }
.segmented { display: flex; gap: 4px; margin: 0 18px 4px; padding: 4px; background: var(--sand); border: 3px solid var(--ink); border-radius: 16px; }
.seg {
  position: relative; flex: 1 1 0;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 42px; padding: 8px 10px;
  border: none; border-radius: 11px;
  background: transparent; color: var(--slate);
  font-size: 15px; font-weight: 800;
  cursor: pointer;
}
.seg [data-ic] { width: 24px; height: 24px; opacity: 0.6; }
.seg.selected { background: var(--paper); color: var(--ink); box-shadow: 0 0 0 2.5px var(--ink), 0 3px 0 2.5px var(--ink); }
.seg.selected [data-ic] { opacity: 1; }
.shop-panel, .quest-panel {
  flex: 1 1 auto;
  display: grid; align-content: start; gap: 10px;
  padding: 12px 18px 20px;
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}
.shop-panel { animation: shop-panel-in 0.22s ease both; }
@keyframes shop-panel-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.shop-row {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 10px 8px 8px;
  background: var(--paper);
  border: 2.5px solid var(--ink);
  border-radius: 18px;
  box-shadow: 0 3px 0 var(--ink);
}
.shop-tile { position: relative; flex: 0 0 auto; width: 86px; height: 64px; border-radius: 13px; border: 2.5px solid var(--ink); background: var(--tile, #FFE7A6); }
.shop-tile::before { content: ''; position: absolute; inset: 0; border-radius: 10px; background: radial-gradient(ellipse 70% 60% at 50% 35%, rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0) 70%); }
.shop-row-icon { position: absolute; left: -6px; top: -6px; width: 98px; height: 72px; }
.shop-lvl { position: absolute; left: -8px; bottom: -8px; width: 26px; height: 26px; border-radius: 50%; border: 2.5px solid var(--ink); font-size: 13px; font-weight: 800; display: flex; align-items: center; justify-content: center; z-index: 2; color: var(--cream); text-shadow: 0 1.5px 0 var(--ink); }
.shop-row.locked .shop-row-icon { filter: brightness(0) opacity(0.35); }
.shop-row.locked .shop-tile { background: #E3DDD0; }
.shop-upgrade-icon { flex: 0 0 auto; width: 64px; height: 64px; padding: 8px; border-radius: 13px; border: 2.5px solid var(--ink); background: var(--tile, #D8F3E6); }
.shop-row-text { display: flex; flex-direction: column; gap: 3px; flex: 1 1 auto; min-width: 0; }
.shop-row-title { font-size: 17px; font-weight: 800; }
.shop-row-title small { font-size: 12px; font-weight: 700; color: var(--slate); margin-left: 4px; }
.shop-row-subtitle { display: flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 700; color: var(--slate); line-height: 1.25; flex-wrap: wrap; }
.shop-row-subtitle .ic { width: 18px; height: 18px; }
.shop-pips { display: flex; gap: 3px; margin-top: 2px; }
.shop-pips span { width: 9px; height: 9px; border-radius: 3px; border: 2px solid var(--ink); background: var(--cream); }
.shop-pips span.on { background: var(--mint); }
.shop-buy { flex: 0 0 auto; min-width: 100px; padding: 7px 12px; font-size: 15px; --press: 4px; margin-bottom: 7px; }
.shop-buy .ic { width: 22px; height: 22px; }
.shop-hint {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; gap: 6px;
  min-width: 100px; padding: 5px 10px;
  border: 2.5px dashed var(--mint-deep);
  border-radius: 14px;
  background: #E3F7EE;
  font-size: 12.5px; font-weight: 800; line-height: 1.15;
}
.shop-hint small { font-weight: 700; color: var(--slate); }
.shop-hint .ic { width: 26px; height: 26px; }
.shop-note { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border: 2.5px dashed var(--orange-deep); border-radius: 14px; background: #FFE9DB; font-size: 14px; font-weight: 700; line-height: 1.3; }
.shop-note.info { border-color: var(--blue-deep); background: #E4F3FF; font-size: 13px; }
.shop-note .ic { width: 30px; height: 30px; }
.boost-row { background: #F4EFFE; }
.boost-row.active { box-shadow: 0 3px 0 var(--ink), 0 0 0 4px rgba(139, 99, 232, 0.35); }
.ad-btn { gap: 4px; }

/* ============================================================================
   QUÊTES
   ============================================================================ */
.quest-badge {
  position: absolute; top: -9px; right: -9px;
  min-width: 22px; height: 22px; padding: 0 5px;
  border: 2.5px solid var(--ink); border-radius: 999px;
  background: var(--cherry); color: var(--cream);
  font-size: 12px; font-weight: 800; line-height: 17px; text-align: center;
  animation: badge-bounce 1.4s ease-in-out infinite;
}
@keyframes badge-bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }

.quest-tracker {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 10px;
  margin: 0 14px 6px;
  min-height: 40px;
  padding: 5px 8px 5px 6px;
  border: 3px solid var(--ink); border-radius: 999px;
  background: var(--cream);
  box-shadow: 0 3px 0 var(--ink);
  text-align: left;
  cursor: pointer;
  position: relative; z-index: 4;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.quest-tracker:active { transform: translateY(3px); box-shadow: 0 0 0 var(--ink); }
.quest-tracker.ready { background: #E3F7EE; animation: tracker-glow 1.3s ease-in-out infinite; }
@keyframes tracker-glow { 50% { box-shadow: 0 3px 0 var(--ink), 0 0 0 5px rgba(45, 201, 142, 0.35); } }
.qt-icon { width: 28px; height: 28px; flex: 0 0 auto; }
.qt-icon .ic { width: 100%; height: 100%; }
.qt-text { flex: 1 1 auto; min-width: 0; font-size: 14px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qt-bar { position: relative; flex: 0 0 auto; width: 132px; height: 22px; border: 2.5px solid var(--ink); border-radius: 999px; background: var(--sand); overflow: hidden; }
.qt-bar i { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(180deg, #54DCA8, var(--mint)); transition: width 0.3s ease; }
.qt-bar b { position: relative; display: block; text-align: center; font-size: 12px; line-height: 17px; font-weight: 800; }

.quest-section-title { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 10px; margin-top: 6px; font-size: 18px; font-weight: 800; }
.quest-timer { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; font-weight: 700; color: var(--slate); }
.quest-timer .ic { width: 18px; height: 18px; }
.quest-card, .quest-chest {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 10px 9px 9px;
  background: var(--paper);
  border: 2.5px solid var(--ink); border-radius: 18px;
  box-shadow: 0 3px 0 var(--ink);
}
.quest-card.done:not(.claimed) { background: #E3F7EE; }
.quest-card.claimed, .quest-chest.claimed { opacity: 0.6; }
.quest-icon { flex: 0 0 auto; width: 50px; height: 50px; padding: 6px; border: 2.5px solid var(--ink); border-radius: 13px; background: #FFF0D6; }
.quest-icon .ic { width: 100%; height: 100%; }
.quest-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.quest-text { font-size: 15px; font-weight: 800; line-height: 1.2; }
.quest-bar { position: relative; height: 20px; border: 2.5px solid var(--ink); border-radius: 999px; background: var(--sand); overflow: hidden; }
.quest-bar i { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(180deg, #54DCA8, var(--mint)); }
.quest-bar span { position: relative; display: block; text-align: center; font-size: 12px; line-height: 15px; font-weight: 800; }
.quest-rewards { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: 0 0 auto; }
.quest-rewards .pill { font-size: 13px; padding: 2px 10px 2px 3px; }
.quest-rewards .pill .ic { width: 20px; height: 20px; }
.quest-claim { flex: 0 0 auto; font-size: 15px; padding: 8px 12px; --press: 4px; margin-bottom: 7px; animation: claim-pulse 1.1s ease-in-out infinite; }
@keyframes claim-pulse { 50% { transform: scale(1.05); } }
.quest-claimed { display: inline-flex; align-items: center; gap: 4px; flex: 0 0 auto; font-size: 14px; font-weight: 800; color: var(--mint-deep); }
.quest-claimed .ic { width: 24px; height: 24px; }
.quest-chest { background: #FFF6DA; border-style: dashed; }
.quest-chest.ready { border-style: solid; background: #FFEFC2; animation: chest-ready 1s ease-in-out infinite; }
.quest-chest.ready .chest-icon { animation: chest-wiggle 1s ease-in-out infinite; }
@keyframes chest-ready { 50% { box-shadow: 0 3px 0 var(--ink), 0 0 0 5px rgba(255, 197, 61, 0.5); } }
@keyframes chest-wiggle { 0%, 60%, 100% { transform: rotate(0); } 70% { transform: rotate(-8deg); } 80% { transform: rotate(8deg); } 90% { transform: rotate(-4deg); } }
.quest-chest .quest-icon { background: #FFE3E0; }
.quest-steps { display: flex; align-items: center; gap: 5px; }
.quest-steps span { width: 22px; height: 12px; border: 2px solid var(--ink); border-radius: 999px; background: var(--cream); transition: background 0.3s; }
.quest-steps span.on { background: var(--sun); }
.quest-steps small { margin-left: 4px; font-size: 12px; font-weight: 700; color: var(--slate); }

/* ============================================================================
   NOTIFICATIONS (non bloquantes)
   ============================================================================ */
#toasts { position: fixed; top: calc(70px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); z-index: 45; display: flex; flex-direction: column; align-items: center; gap: 6px; width: min(94%, 460px); pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 10px;
  max-width: 100%;
  padding: 7px 16px 7px 9px;
  border: 3px solid var(--ink); border-radius: 18px;
  background: var(--cream);
  box-shadow: 0 4px 0 var(--ink), 0 12px 24px rgba(34, 48, 79, 0.25);
  font-size: 14px; font-weight: 700; line-height: 1.25;
  opacity: 0;
  transform: translateY(-16px) scale(0.92);
  transition: opacity 0.25s ease, transform 0.35s cubic-bezier(0.22, 1.4, 0.36, 1);
}
.toast.show { opacity: 1; transform: none; }
.toast > .ic { width: 32px; height: 32px; }
.toast b { display: block; font-size: 15px; font-weight: 800; }
.toast .sep { display: inline-block; width: 10px; }
.toast span > .ic { width: 20px; height: 20px; margin: 0 2px 0 4px; }
.toast-quest, .toast-mint { background: #E3F7EE; }
.toast-quest b { color: var(--mint-deep); }
.toast-level { background: #FFF3CF; }
.toast-level b { color: var(--sun-deep); }
.toast-purple { background: #EDE5FD; }
.toast-gem { background: #FDE3F0; }
.toast-warn { background: #FFE3DF; }

/* ============================================================================
   POPUPS (récompense, hors-ligne, rebirth, confirmation)
   ============================================================================ */
#popup, #chest-overlay {
  position: fixed; inset: 0; z-index: 50; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  padding: 24px 16px;
}
.popup-backdrop { position: absolute; inset: 0; background: rgba(34, 48, 79, 0.6); animation: fade-in 0.25s ease both; }
.popup-card {
  width: min(92vw, 420px);
  padding: 34px 20px 16px;
  text-align: center;
  animation: popup-pop 0.45s cubic-bezier(0.22, 1.4, 0.36, 1) both;
}
@keyframes popup-pop { 0% { transform: scale(0.4); opacity: 0; } 60% { transform: scale(1.05); opacity: 1; } 100% { transform: scale(1); } }
.popup-card .panel-ribbon { top: 8px; position: relative; transform: none; left: auto; display: inline-flex; margin: -6px auto 4px; font-size: 20px; }
.popup-rays {
  position: absolute; left: 50%; top: 32%;
  width: 520px; height: 520px; margin: -260px 0 0 -260px;
  border-radius: 50%;
  background: repeating-conic-gradient(from 0deg, rgba(255, 213, 110, 0.5) 0deg 10deg, rgba(255, 213, 110, 0) 10deg 22.5deg);
  -webkit-mask: radial-gradient(circle, #000 0%, #000 30%, transparent 68%);
  mask: radial-gradient(circle, #000 0%, #000 30%, transparent 68%);
  animation: rays-spin 14s linear infinite;
  pointer-events: none;
  z-index: -1;
}
@keyframes rays-spin { to { transform: rotate(360deg); } }
.popup-showcase { position: relative; height: 170px; margin: 6px 0 4px; display: flex; align-items: center; justify-content: center; }
.popup-sprite { width: 100%; height: 100%; animation: showcase-float 2.4s ease-in-out infinite; }
.popup-icon { width: 120px; height: 120px; animation: showcase-float 2.4s ease-in-out infinite; }
@keyframes showcase-float { 0%, 100% { transform: translateY(0) rotate(-1deg); } 50% { transform: translateY(-7px) rotate(1deg); } }
.popup-badge { position: absolute; bottom: 2px; right: 14px; padding: 4px 12px; border: 3px solid var(--ink); border-radius: 999px; background: var(--sun); box-shadow: 0 3px 0 var(--ink); font-size: 16px; font-weight: 800; }
.popup-title { font-size: 28px; font-weight: 800; line-height: 1.1; margin: 4px 0 8px; }
.popup-stats { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-bottom: 8px; }
.popup-stats .pill { font-size: 15px; }
.popup-text { font-size: 15px; font-weight: 600; line-height: 1.45; margin: 4px 2px 6px; }
.popup-text small { color: var(--slate); font-weight: 700; }
.popup-text .ic { width: 20px; height: 20px; }
.popup-actions { display: flex; justify-content: center; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.popup-actions:empty { display: none; }
.popup-tap { margin-top: 10px; font-size: 12px; font-weight: 700; color: var(--slate); opacity: 0.85; }
.boost-upsell {
  display: flex; align-items: center; gap: 8px;
  margin-top: 8px; padding: 6px 8px 6px 10px;
  border: 2.5px dashed var(--purple); border-radius: 14px;
  background: #F4EFFE;
  text-align: left; font-size: 13.5px;
}
.boost-upsell > .ic { width: 28px; height: 28px; }
.boost-upsell span { flex: 1 1 auto; }
.boost-upsell .btn { margin-bottom: 4px; }
.trophy-progress { text-align: left; font-size: 13px; font-weight: 800; margin: 2px 0 10px; }
.trophy-progress .quest-bar { margin-top: 4px; }
.rebirth-new { display: flex; align-items: center; gap: 10px; text-align: left; padding: 8px 10px; margin: 6px 0 10px; border: 2.5px solid var(--ink); border-radius: 14px; background: #FFF3CF; font-size: 13.5px; }
.rebirth-new > .ic { width: 44px; height: 44px; }
.rebirth-lists { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; font-size: 12.5px; line-height: 1.35; text-align: left; }
.rebirth-lists > div { padding: 7px 9px; border-radius: 12px; background: var(--paper); border: 2px solid rgba(34, 48, 79, 0.2); }

/* Coffre : secousse -> ouverture -> récompenses */
.chest-stage { position: relative; display: flex; flex-direction: column; align-items: center; gap: 14px; cursor: pointer; }
.chest-stage .popup-rays { top: 36%; opacity: 0; transition: opacity 0.3s; }
#chest-overlay.opened .popup-rays { opacity: 1; }
.chest-box { width: 170px; height: 170px; animation: chest-shake 0.65s ease-in-out both; filter: drop-shadow(0 8px 0 rgba(34, 48, 79, 0.35)); }
.chest-box .ic { width: 100%; height: 100%; }
#chest-overlay.opened .chest-box { animation: chest-open 0.45s cubic-bezier(0.22, 1.6, 0.36, 1) both; }
@keyframes chest-shake {
  0% { transform: scale(0.4); } 25% { transform: scale(1.05) rotate(0); }
  40% { transform: rotate(-9deg); } 55% { transform: rotate(9deg); } 70% { transform: rotate(-6deg); } 85% { transform: rotate(5deg); } 100% { transform: rotate(0); }
}
@keyframes chest-open { 0% { transform: scale(0.85); } 60% { transform: scale(1.18); } 100% { transform: scale(1.05); } }
.chest-rewards { display: flex; gap: 10px; opacity: 0; transform: translateY(14px) scale(0.8); transition: all 0.35s cubic-bezier(0.22, 1.6, 0.36, 1) 0.1s; }
#chest-overlay.opened .chest-rewards { opacity: 1; transform: none; }
.chest-rewards .pill { font-size: 22px; padding: 6px 18px 6px 7px; box-shadow: 0 3px 0 var(--ink); }
.chest-rewards .pill .ic { width: 34px; height: 34px; }
.chest-stage .popup-tap { color: var(--cream); opacity: 0.9; }

/* Transition du rebirth */
#transition { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; background: radial-gradient(circle, #A988F5, #6A45C4); }
.transition-card { display: flex; flex-direction: column; align-items: center; gap: 16px; color: var(--cream); font-size: 18px; font-weight: 800; text-shadow: 0 2px 0 var(--ink); text-align: center; padding: 16px; }
.transition-card [data-ic] { width: 96px; height: 96px; animation: showcase-float 1.6s ease-in-out infinite; }

/* Récompenses qui volent jusqu'au HUD */
#fly-layer { position: fixed; inset: 0; z-index: 70; pointer-events: none; }
.fly-icon { position: absolute; left: 0; top: 0; width: 32px; height: 32px; }
.fly-icon .ic { width: 100%; height: 100%; }

/* Pub simulée (développement uniquement, voir ads.js) */

/* ============================================================================
   TUTORIEL (masque troué, anneau, bulle, main)
   ============================================================================ */
.coach-mask { position: fixed; z-index: 40; background: rgba(34, 48, 79, 0.55); touch-action: none; }
#coach.passive .coach-mask { display: none; }
.coach-ring {
  position: fixed; z-index: 41;
  border: 4px solid var(--sun);
  border-radius: 18px;
  box-shadow: 0 0 0 3px var(--ink), 0 0 24px rgba(255, 197, 61, 0.8);
  pointer-events: none;
  animation: ring-breathe 1.2s ease-in-out infinite;
}
@keyframes ring-breathe { 50% { box-shadow: 0 0 0 3px var(--ink), 0 0 36px rgba(255, 197, 61, 1); transform: scale(1.02); } }
.coach-bubble {
  position: fixed; z-index: 42;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px 10px 10px;
  background: var(--cream);
  border: 3px solid var(--ink);
  border-radius: 20px;
  box-shadow: 0 5px 0 var(--ink), 0 14px 30px rgba(34, 48, 79, 0.3);
  pointer-events: none;
  transition: top 0.25s ease;
}
.coach-bubble.pop { animation: panel-pop 0.3s cubic-bezier(0.22, 1.4, 0.36, 1) both; }
.coach-bubble.shake { animation: bubble-shake 0.4s ease; }
@keyframes bubble-shake { 20% { transform: translateX(-8px); } 40% { transform: translateX(7px); } 60% { transform: translateX(-5px); } 80% { transform: translateX(3px); } }
.coach-face { flex: 0 0 auto; width: 58px; height: 58px; border-radius: 50%; border: 3px solid var(--ink); background: radial-gradient(circle at 50% 35%, #D8F2FF, var(--sky) 75%); }
.coach-text { font-size: 16px; font-weight: 700; line-height: 1.3; }
.coach-text b { display: inline-block; margin-right: 6px; padding: 1px 8px; border-radius: 999px; border: 2px solid var(--ink); background: var(--orange); color: var(--cream); font-size: 12px; text-shadow: 0 1px 0 var(--ink); vertical-align: 2px; }
.coach-hand { position: fixed; z-index: 43; width: 64px; margin-top: -17px; pointer-events: none; transform-origin: 0 50%; filter: drop-shadow(0 4px 0 rgba(34, 48, 79, 0.35)); }
.coach-hand img { display: block; width: 100%; height: auto; }
/* Le bout de l'index est le bord gauche de l'image : c'est lui qui est posé sur (left, top) */
.coach-hand.from-right { animation: hand-tap-r 0.9s ease-in-out infinite; }
.coach-hand.from-left { animation: hand-tap-l 0.9s ease-in-out infinite; }
@keyframes hand-tap-r { 0%, 100% { transform: translateX(10px); } 50% { transform: translateX(0) scale(0.92); } }
@keyframes hand-tap-l { 0%, 100% { transform: scaleX(-1) translateX(10px); } 50% { transform: scaleX(-1) translateX(0) scale(0.92); } }
#coach.paused .coach-bubble, #coach.paused .coach-hand, #coach.paused .coach-ring { visibility: hidden; }

/* ============================================================================
   ÉCRAN DE CHARGEMENT + LOGO
   ============================================================================ */
#loader {
  position: fixed; inset: 0; z-index: 100;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 26px;
  background:
    radial-gradient(ellipse 40% 25% at 20% 20%, rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0) 70%),
    radial-gradient(ellipse 35% 22% at 82% 30%, rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0) 70%),
    linear-gradient(180deg, #6EC4FF 0%, var(--sky) 55%, #B8E6FF 100%);
  transition: opacity 0.45s ease, visibility 0.45s;
}
#loader::after { content: ''; position: absolute; left: -10%; right: -10%; bottom: -60px; height: 180px; border-radius: 50% 50% 0 0; background: var(--grass); border-top: 3px solid var(--ink); }
#loader.done { opacity: 0; visibility: hidden; }
.logo { position: relative; text-align: center; line-height: 0.9; z-index: 2; }
.logo-top, .logo-bottom { font-weight: 800; color: var(--cream); letter-spacing: 0.04em; }
.logo-top { font-size: clamp(30px, 7vw, 46px); text-shadow: var(--outline-text); }
.logo-bottom {
  font-size: clamp(66px, 16vw, 112px);
  color: var(--sun);
  letter-spacing: 0.02em;
  text-shadow: 0 3px 0 var(--ink), 3px 0 0 var(--ink), -3px 0 0 var(--ink), 0 -3px 0 var(--ink),
    2.5px 2.5px 0 var(--ink), -2.5px 2.5px 0 var(--ink), 2.5px -2.5px 0 var(--ink), -2.5px -2.5px 0 var(--ink),
    0 7px 0 var(--orange-deep), 3px 7px 0 var(--ink), -3px 7px 0 var(--ink), 0 10px 0 var(--ink);
}
.logo-tag { display: inline-block; margin-top: 12px; padding: 5px 16px; border: 3px solid var(--ink); border-radius: 999px; background: var(--orange); box-shadow: 0 3px 0 var(--ink); color: var(--cream); font-size: 15px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; text-shadow: 0 1.5px 0 var(--ink); line-height: 1.2; }
.logo-loop { position: absolute; left: 50%; top: 46%; width: 124%; height: 150%; transform: translate(-50%, -50%); border: 3px dashed rgba(34, 48, 79, 0.35); border-radius: 50%; animation: loop-spin 4s linear infinite; pointer-events: none; z-index: -1; }
.logo-loop [data-ic] { position: absolute; top: -21px; left: 50%; width: 42px; height: 42px; margin-left: -21px; transform: rotate(90deg); filter: drop-shadow(0 3px 0 rgba(34, 48, 79, 0.3)); }
@keyframes loop-spin { to { transform: translate(-50%, -50%) rotate(360deg); } }
.loader-bar { position: relative; z-index: 2; width: min(70vw, 320px); height: 22px; padding: 3px; border: 3px solid var(--ink); border-radius: 999px; background: var(--cream); box-shadow: 0 3px 0 var(--ink); }
.loader-fill { height: 100%; width: 0%; border-radius: 999px; background: linear-gradient(180deg, #FF9B5E, var(--orange)); transition: width 0.15s ease; }
.loader-text { position: relative; z-index: 2; font-size: 15px; font-weight: 800; }

/* ============================================================================
   PETITS ÉCRANS
   ============================================================================ */
@media (max-width: 720px) {
  #hud { padding: calc(6px + env(safe-area-inset-top)) 10px 6px; gap: 6px; }
  .hud-group { gap: 6px; }
  .hud-group-right { gap: 6px; }
  .chip { height: 36px; padding: 0 10px 0 28px; margin-left: 10px; }
  .chip-icon { width: 34px; height: 34px; left: -12px; }
  .chip-value { font-size: 16px; }
  .chip-cash { min-width: 0; }
  .chip-garage { display: none; }
  .chip-mini { height: 30px; padding: 0 8px 0 22px; margin-left: 8px; }
  .chip-mini .chip-icon { width: 28px; height: 28px; left: -10px; }
  .chip-mini .chip-value { font-size: 12.5px; }
  .level-wrap { width: 44px; height: 44px; }
  .icon-btn { width: 40px; height: 40px; border-radius: 12px; }
  .quest-tracker { margin: 0 10px 6px; gap: 8px; }
  .qt-text { font-size: 12.5px; }
  .qt-bar { width: 96px; }
  #toolbar { gap: 8px; padding: 10px 10px calc(10px + env(safe-area-inset-bottom)); }
  #buy-btn { min-width: 0; padding: 6px 12px 6px 6px; }
  #buy-btn .btn-label { font-size: 18px; }
  .btn-plane { width: 56px; height: 41px; }
  .btn-side { padding: 9px 10px; min-width: 52px; }
  .btn-side .btn-label { display: none; }
  #rebirth-btn.ready .btn-label { display: inline; font-size: 14px; }
  .btn-side [data-ic] { width: 32px; height: 32px; }
  .shop-tile { width: 70px; height: 54px; }
  .shop-row-icon { width: 82px; height: 60px; }
  .shop-row-title { font-size: 15px; }
  .shop-row { gap: 9px; }
  .shop-buy { min-width: 84px; padding: 7px 8px; font-size: 14px; }
  .quest-card, .quest-chest { gap: 9px; }
  .quest-icon { width: 42px; height: 42px; }
  .quest-text { font-size: 13.5px; }
  .coach-text { font-size: 14.5px; }
  .coach-face { width: 48px; height: 48px; }
  .popup-showcase { height: 140px; }
  .popup-title { font-size: 24px; }
}
@media (max-width: 480px) {
  #hud { padding-left: 8px; padding-right: 8px; }
  .hud-group { gap: 4px; }
  .hud-group-right { gap: 5px; }
  .chip { height: 34px; padding: 0 8px 0 23px; margin-left: 13px; }
  .chip-icon { width: 30px; height: 30px; left: -10px; }
  .chip-value { font-size: 15px; }
  .chip-sub { font-size: 10px; }
  .chip-boost { display: none; }
  .level-wrap { width: 40px; height: 40px; }
  .level-text { width: 24px; height: 24px; font-size: 12px; }
  .icon-btn { width: 38px; height: 38px; padding: 4px; }
}
@media (max-width: 400px) {
  .chip-gems { padding-right: 8px; }
  .chip-trophy { display: none; }
  #buy-btn .btn-label small { display: none; }
  .shop-panel, .quest-panel { padding: 10px 10px 16px; }
  .shop-upgrade-icon { width: 52px; height: 52px; }
  .rebirth-lists { grid-template-columns: 1fr; }
}
/* Téléphone en paysage : peu de hauteur, on compacte le haut et le bas */
@media (max-height: 480px) and (orientation: landscape) {
  #hud { padding-top: 4px; padding-bottom: 4px; }
  .chip { height: 32px; }
  .level-wrap { width: 38px; height: 38px; }
  .level-text { width: 24px; height: 24px; font-size: 12px; }
  .icon-btn { width: 36px; height: 36px; }
  .quest-tracker { display: none; } /* le bouton Quêtes garde sa pastille */
  #toolbar { padding-top: 5px; padding-bottom: calc(2px + env(safe-area-inset-bottom)); }
  .btn { min-height: 40px; padding-top: 4px; padding-bottom: 4px; --press: 4px; }
  .btn-plane { width: 50px; height: 36px; }
  #buy-btn .btn-label { font-size: 17px; }
  .popup-showcase { height: 100px; }
  .popup-card { padding-top: 26px; }
}

/* ============================================================================
   RÉGLAGES (musique, effets sonores, langue)
   ============================================================================ */
.ribbon-blue { background: linear-gradient(180deg, #6CC0FF, var(--blue)); }
.settings-shell { display: flex; flex-direction: column; width: min(94vw, 460px); max-height: 100%; padding-top: 26px; animation: panel-pop 0.3s cubic-bezier(0.22, 1.4, 0.36, 1) both; }
.settings-panel { display: grid; gap: 12px; padding: 14px 20px 18px; overflow: auto; overscroll-behavior: contain; touch-action: pan-y; }
.set-row {
  display: grid; grid-template-columns: minmax(118px, auto) 1fr 48px; align-items: center; gap: 12px;
  padding: 10px 12px; background: var(--paper); border: 2.5px solid var(--ink); border-radius: 16px; box-shadow: 0 3px 0 var(--ink);
}
.set-label { display: inline-flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 800; }
.set-label .ic { width: 30px; height: 30px; }
.set-val { font-size: 15px; font-weight: 800; text-align: right; font-variant-numeric: tabular-nums; }
.set-title { display: flex; align-items: center; gap: 8px; margin-top: 4px; font-size: 17px; font-weight: 800; }
.set-title .ic { width: 28px; height: 28px; }
.set-note { font-size: 12.5px; font-weight: 700; color: var(--slate); text-align: center; }
/* Curseur de volume maison : grosse poignée ronde (facile au doigt), piste remplie */
.set-row input[type=range] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 16px; margin: 0;
  border: 2.5px solid var(--ink); border-radius: 999px;
  background: linear-gradient(90deg, var(--mint) 0 var(--v, 50%), var(--sand) var(--v, 50%) 100%);
  cursor: pointer; touch-action: none;
}
.set-row input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--cream); border: 3px solid var(--ink); box-shadow: 0 3px 0 var(--ink);
}
.set-row input[type=range]::-moz-range-thumb {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--cream); border: 3px solid var(--ink); box-shadow: 0 3px 0 var(--ink);
}
.lang-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.lang-btn {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  min-height: 56px; padding: 6px 4px;
  border: 2.5px solid var(--ink); border-radius: 14px;
  background: var(--paper); box-shadow: 0 3px 0 var(--ink);
  font-size: 13px; font-weight: 700; cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.lang-btn b { font-size: 17px; font-weight: 800; }
.lang-btn:active { transform: translateY(3px); box-shadow: 0 0 0 var(--ink); }
.lang-btn.selected { background: #E4F3FF; box-shadow: 0 3px 0 var(--ink), 0 0 0 3px var(--blue); }
@media (max-width: 400px) {
  .set-row { grid-template-columns: 1fr 42px; }
  .set-row input[type=range] { grid-column: 1 / -1; grid-row: 2; }
}

/* Effets des événements (OVNI / hélico, bidon / nitro) */
.chip-event { background: #E4F3FF; animation: turbo-pulse 1s ease-in-out infinite; }
.chip-event .chip-value { color: var(--blue-deep); }
.chip-event-speed { background: #FFE3CF; }
.chip-event-speed .chip-value { color: var(--orange-deep); }
.chip-event .chip-icon .ic { width: 100%; height: 100%; }
@media (max-width: 720px) { .chip-event .ev-label { display: none; } }

/* Chaîne d'assemblage : aperçu du véhicule que livrera le bouton Acheter */
.tier-row { background: #FFF8E1; }
.tier-icon { position: relative; padding: 0; overflow: visible; }
.tier-preview { position: absolute; left: -6px; top: -4px; width: 76px; height: 70px; }
/* Téléphone : les effets d'événements flottent en haut à droite du terrain
   (le HUD n'a pas la place pour eux sur 360-480 px de large). */
@media (max-width: 480px) {
  .chip-event { position: fixed; right: 8px; top: calc(var(--stage-top, 110px) + 8px); z-index: 12; margin: 0; }
  .chip-event-speed { top: calc(var(--stage-top, 110px) + 46px); }
}

