:root{
  --hud-bg: rgba(0,0,0,0.28);
  --hud-border: rgba(255,255,255,0.16);
  --text: rgba(255,255,255,0.95);
}

*{ box-sizing:border-box; }
html, body{
  height: 100%;
  overscroll-behavior: none;
  z-index: 0;
}

#scene{
  touch-action: none; /* empêche le scroll/zoom pendant le drag */
}


/* Bloque la sélection de texte partout et d'image */
*{
  -webkit-user-select: none;
  user-select: none;
}

/* Bonus: évite le highlight bleu sur mobile */
html, body{
  -webkit-tap-highlight-color: transparent;
}

body{
  overflow:hidden;
  cursor: default;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--text);
  background:#001b2b;
  position: relative;
}

/* Effet de sang qui coule (overlay) */
.blood-layer{
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 9000;
}

.blood-drop{
  position: absolute;
  top: -12vh;
  left: var(--x, 50%);
  width: var(--w, 18px);
  height: var(--h, 46px);
  background: #8b0000;
  border-radius: 50% 50% 55% 55%;
  filter: drop-shadow(0 6px 8px rgba(0,0,0,0.35));
  opacity: 0.9;
  animation: bloodDrip var(--duration, 3.2s) linear infinite;
  animation-delay: var(--delay, 0s);
}

.blood-drop::after{
  content: "";
  position: absolute;
  left: 50%;
  top: 6px;
  width: 30%;
  height: 65%;
  transform: translateX(-50%);
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
}

@keyframes bloodDrip{
  0%   { transform: translateY(0) scaleY(0.95); opacity: 0; }
  10%  { opacity: 0.9; }
  100% { transform: translateY(120vh) scaleY(1.1); opacity: 0.15; }
}

/* Quand le jeu tourne, on cache le curseur normal */
body.game-running,
body.tutorial-running{
  cursor: none;
}

#scene{
  position:relative;
  width:100vw;
  height:100vh;
  overflow:hidden;
}

/* Parallax layers */
.layer{ position:absolute; inset:-60px; will-change: transform; }
.layer-back{
  background: url("assets/bg/back.png") center/cover no-repeat;
  filter: saturate(1.05) contrast(1.02);
}

.layer-mid{
  background: radial-gradient(1200px 600px at 50% 15%, rgba(255,255,255,0.12), transparent 60%);
  mix-blend-mode: screen;
  opacity: 0.55;
}

.layer-front{
  background: radial-gradient(1200px 800px at 50% 50%, transparent 55%, rgba(0,0,0,0.25) 100%);
  opacity: 0.7;
}

/* Caustics */
#caustics{
  position:absolute; inset:0;
  pointer-events:none;
  z-index: 4;
  mix-blend-mode: screen;
  opacity: 0.55;
}
.caustic{
  position:absolute; inset:-20%;
  background-repeat: repeat;
  background-size: 420px 420px;
  filter: blur(0.2px) contrast(1.15);
  will-change: transform, opacity;
}
.caustic.c1{
  background-image:
    radial-gradient(circle, rgba(255,255,255,0.22) 0 6px, transparent 7px),
    radial-gradient(circle, rgba(255,255,255,0.16) 0 10px, transparent 11px),
    radial-gradient(circle, rgba(255,255,255,0.12) 0 16px, transparent 17px);
  background-position: 0 0, 120px 70px, 220px 180px;
  animation: causticMove1 10s linear infinite;
  opacity: 0.55;
}
.caustic.c2{
  background-image:
    radial-gradient(circle, rgba(255,255,255,0.20) 0 5px, transparent 6px),
    radial-gradient(circle, rgba(255,255,255,0.14) 0 9px, transparent 10px),
    radial-gradient(circle, rgba(255,255,255,0.10) 0 15px, transparent 16px);
  background-position: 60px 40px, 190px 140px, 320px 260px;
  animation: causticMove2 14s linear infinite;
  opacity: 0.45;
}
@keyframes causticMove1{
  0%{ transform: translate3d(-2%, -1%, 0) scale(1.02) rotate(0deg); }
  50%{ transform: translate3d(2%, 1.5%, 0) scale(1.06) rotate(1deg); }
  100%{ transform: translate3d(-2%, -1%, 0) scale(1.02) rotate(0deg); }
}
@keyframes causticMove2{
  0%{ transform: translate3d(1%, -2%, 0) scale(1.01) rotate(0deg); }
  50%{ transform: translate3d(-2%, 2%, 0) scale(1.05) rotate(-1deg); }
  100%{ transform: translate3d(1%, -2%, 0) scale(1.01) rotate(0deg); }
}

/* Bulles */
#bubbles{
  position:absolute; inset:0; pointer-events:none; z-index:5;
  contain: layout paint size;
  content-visibility: auto;
}
.bubble{
  position:absolute; bottom:-40px;
  border-radius:999px;
  background: rgba(255,255,255,0.16);
  border: 1px solid rgba(255,255,255,0.22);
  box-shadow: 0 0 12px rgba(255,255,255,0.10);
  animation: bubbleUp linear forwards;
}
@keyframes bubbleUp{
  0% { transform: translate3d(0,0,0) scale(0.9); opacity: 0.0; }
  10%{ opacity: 0.7; }
  100%{ transform: translate3d(var(--drift, 30px), -120vh, 0) scale(1.25); opacity: 0; }
}

/* Poissons nageurs (décor) */
#swimmers{
  position:absolute; inset:0; pointer-events:none; z-index:6;
  contain: layout paint size;
  content-visibility: auto;
}
.swimmer{
  position: absolute;
  width: 120px;
  height: 50px;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  pointer-events: none;
  opacity: 0.8;
  filter: drop-shadow(0 8px 10px rgba(0,0,0,0.35));
}


/* Entités */
#entities{
  position:absolute; inset:0; z-index:7;
  contain: layout paint size;
  content-visibility: auto;
}
.entity{
  position: absolute;
  pointer-events: none;
  background-position: center;
  background-size: contain;
  background-repeat: no-repeat;
  will-change: transform;
  animation: floatItem 3.2s ease-in-out infinite;
}

.entity.food{
  width: 28px;
  height: 28px;
  background-image: url("assets/items/food.png");
  filter: drop-shadow(0 0 6px rgba(255,255,255,0.25));
}

.entity.bonus{
  width: 34px;
  height: 34px;
  background-image: url("assets/items/bonus.png");
  filter: drop-shadow(0 0 6px rgba(180,120,255,0.6));
}

.entity.malus{
  width: 44px;
  height: 44px;
  background-image: url("assets/items/malus.png");
  filter:
    drop-shadow(0 0 10px rgba(255,80,120,0.55))
    drop-shadow(0 0 4px rgba(0,0,0,0.25));
}

.entity.power-dash{
  width: 42px;
  height: 42px;
  background-image: url("assets/items/power_dash.png");
  filter:
    drop-shadow(0 0 10px rgba(255,110,110,0.55))
    drop-shadow(0 0 4px rgba(0,0,0,0.22));
}

.entity.power-magnet{
  width: 34px;
  height: 34px;
  background-image: url("assets/items/power_magnet.png");
  filter: drop-shadow(0 0 8px rgba(120,200,255,0.7));
}

.entity.enemy{
  width: 32px;
  height: 32px;
  background-image: url("assets/items/enemy.png"); /* Ajoute une image d'ennemi */
  filter: drop-shadow(0 0 6px rgba(255,100,100,0.6));
}

@keyframes floatItem{
  0%   { transform: translateY(0); }
  50%  { transform: translateY(-6px); }
  100% { transform: translateY(0); }
}

/* Boss */
#boss{
  position: absolute;
  z-index: 8;
  width: 520px;
  height: 292px;
  background: url("assets/fish/skins/boss.png") center/contain no-repeat;
  left: -9999px;
  top: -9999px;
  pointer-events: none;
  filter: drop-shadow(0 20px 28px rgba(0,0,0,0.45));
  transform-origin: 50% 50%;
}
#boss::before,
#boss::after{ content: none; }

/* Cursor fish */
#cursorWrap{
  position:fixed; left:0; top:0;
  width:0; height:0;
  z-index: 99999;
  pointer-events:none;
}

/* Cacher le curseur poisson quand le jeu n'est pas en cours */
body:not(.game-running):not(.tutorial-running) #cursorWrap {
  display: none !important;
}

#cursorFish{
  position: fixed;
  width: 72px;
  height: 72px;
  background: url("assets/fish/skins/cursor.png") center/contain no-repeat;
  background-color: rgba(255,255,255,0.08);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 8;
  filter: drop-shadow(0 10px 14px rgba(0,0,0,0.35));
  will-change: transform;
}
#cursorFish::before,
#cursorFish::after{ content: none; }


/* Bouton Dash mobile */
.dash-mobile{
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 25000;
  padding: 14px 16px;
  border-radius: 999px;
  font-weight: 700;
  letter-spacing: .5px;
}

/* Visible seulement sur appareils tactiles */
@media (hover: none) and (pointer: coarse){
  .dash-mobile{ display: inline-flex !important; }
  .dash-mobile.hidden{ display: inline-flex !important; } /* force l'affichage */
}


/* Règles du jeu */
.rules{
  max-width: 520px;
  text-align: left;
  margin: 16px auto 22px;
  font-size: 0.95rem;
  line-height: 1.45;
  color: #eafcff;
  max-height: 55vh;
  overflow: auto;
  padding-right: 8px;
}
.rules h3{
  margin: 14px 0 6px;
  font-size: 1.05rem;
  color: #9ee8ff;
}
.rules ul{
  padding-left: 18px;
  margin: 6px 0;
}
.rules li{ margin-bottom: 4px; }
.rules b{ color: #ffffff; }

/* Scrollbar du menu (même style que la boutique) */
.rules::-webkit-scrollbar{
  width: 8px;
}
.rules::-webkit-scrollbar-thumb{
  background: rgba(255,255,255,0.18);
  border-radius: 999px;
}
.rules::-webkit-scrollbar-track{
  background: rgba(0,0,0,0.15);
}

/* HUD */
#hud{
  position: fixed;
  left: 14px; top: 14px;
  z-index: 10000;
  background: var(--hud-bg);
  border: 1px solid var(--hud-border);
  border-radius: 16px;
  padding: 12px;
  backdrop-filter: blur(10px);
  min-width: 360px;
}

/* Top Leaderboard */
.top-leaderboard {
  background: none;
  border: none;
  border-radius: 0;
  padding: 12px 15px;
  backdrop-filter: none;
  min-width: auto;
  position: fixed;
  bottom: 14px;
  right: 14px;
  z-index: 10001;
}

.leaderboard-title {
  font-size: 13px;
  font-weight: bold;
  color: #0f0;
  margin-bottom: 8px;
  text-align: center;
}

.top-leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.top-leaderboard-item {
  font-size: 12px;
  color: #fff;
  padding: 4px 8px;
  background: rgba(0, 150, 255, 0.15);
  border-radius: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.top-leaderboard-item.rank1 {
  color: #ffd700;
  background: rgba(255, 215, 0, 0.2);
}

.top-leaderboard-item.rank2 {
  color: #c0c0c0;
  background: rgba(192, 192, 192, 0.2);
}

.top-leaderboard-item.rank3 {
  color: #cd7f32;
  background: rgba(205, 127, 50, 0.2);
}

.hud-top{
  display:flex;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 14px;
}

#healthDisplay {
  display: none;
}

.hud-bottom{
  margin-top: 10px;
  display:flex;
  gap: 8px;
  align-items:center;
  flex-wrap: wrap;
}
button{
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(0,0,0,0.25);
  color: white;
  padding: 8px 10px;
  border-radius: 12px;
  cursor: pointer;
}
button:hover{ background: rgba(0,0,0,0.35); }

@media (hover: none) and (pointer: coarse){
  .entity,
  .swimmer,
  #boss,
  #cursorFish{
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.25)) !important;
  }
}

@media (prefers-reduced-motion: reduce){
  .bubble{
    animation-duration: calc(var(--duration, 8s) * 1.5) !important;
  }
  .caustic{
    animation-duration: 20s !important;
  }
  .layer{
    transform: translate3d(0,0,0);
  }
}

/* Virtual Joystick */
.joystick-container{
  position: fixed;
  bottom: 20px;
  left: 20px;
  width: 120px;
  height: 120px;
  z-index: 24000;
  touch-action: none;
  pointer-events: auto;
}

.joystick-bg{
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  border: 2px solid rgba(255, 255, 255, 0.25);
  box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.3);
}

.joystick-stick{
  position: absolute;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.5), rgba(100, 150, 255, 0.6));
  border: 1px solid rgba(255, 255, 255, 0.4);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 12px rgba(100, 150, 255, 0.5);
  pointer-events: none;
  will-change: transform;
}

@media (hover: none) and (pointer: coarse){
  .joystick-container:not(.hidden){
    display: block;
  }
  .joystick-container.hidden{
    display: none;
  }
  
  #hud{
    max-width: 100%;
    left: auto;
    right: 4px;
    top: 4px;
    min-width: unset;
    padding: 8px;
    font-size: 0.85rem;
  }
  
  .hud-top{
    gap: 6px;
    font-size: 0.75rem;
  }
  
  .hud-bottom{
    gap: 4px;
    margin-top: 6px;
  }
  
  button{
    padding: 6px 8px;
    font-size: 0.75rem;
  }
  
  .hint{
    display: none;
  }
  
  .top-leaderboard{
    bottom: 140px;
    right: 8px;
    font-size: 0.75rem;
  }
  
  .leaderboard-title{
    font-size: 11px;
  }
  
  .top-leaderboard-item{
    font-size: 10px;
    padding: 2px 4px;
  }
}

/* Mobile sizing tweaks (driven by JS .mobile-mode) */
body.mobile-mode .dash-mobile{
  padding: 10px 12px;
  font-size: 0.85rem;
  right: 12px;
  bottom: 12px;
}

body.mobile-mode #dashCooldownUI{
  height: 8px;
  bottom: 14px;
  width: min(420px, 82vw);
}

body.mobile-mode #metaUI{
  bottom: 40px;
  width: min(440px, 86vw);
  gap: 6px;
}

body.mobile-mode #metaXPBar{
  height: 8px;
}

body.mobile-mode #metaXPText{
  font-size: 11px;
}

body.mobile-mode .joystick-container{
  width: 88px;
  height: 88px;
  bottom: 12px;
  left: 12px;
}

body.mobile-mode .joystick-stick{
  width: 32px;
  height: 32px;
}

body.mobile-mode #overlay .panel{
  width: min(92vw, 520px);
  padding: 10px;
}

body.mobile-mode #overlayTitle{ font-size: 15px; }
body.mobile-mode #overlayMsg{ font-size: 0.9rem; }
body.mobile-mode .overlay-hint{ font-size: 0.88rem; }

body.mobile-mode .rules{
  max-height: 42vh;
  font-size: 0.86rem;
}

body.mobile-mode .upgrades-grid{ gap: 8px; }
body.mobile-mode .upgrade-card{ padding: 10px; }
body.mobile-mode .u-title{ font-size: 0.95rem; }
body.mobile-mode .u-desc{ font-size: 0.85rem; }
body.mobile-mode .u-level{ font-size: 0.82rem; }
body.mobile-mode .u-footer{ font-size: 0.85rem; }

body.mobile-mode #hud{
  left: 8px;
  top: 8px;
  padding: 8px;
  min-width: 260px;
  font-size: 0.78rem;
}

body.mobile-mode .hud-top{
  gap: 8px;
  font-size: 0.72rem;
}

body.mobile-mode .hud-bottom{
  gap: 6px;
  margin-top: 6px;
}

body.mobile-mode button{
  padding: 5px 7px;
  font-size: 0.72rem;
  border-radius: 10px;
}

body.mobile-mode .stats-grid{
  gap: 6px;
}

body.mobile-mode .stat span{ font-size: 10px; }
body.mobile-mode .stat b{ font-size: 12px; }

body.mobile-mode .options-panel{
  width: min(92vw, 520px);
  padding: 12px;
}

body.mobile-mode .options-head h3{ font-size: 1rem; }
body.mobile-mode .options-content{ font-size: 0.9rem; }

body.mobile-mode #boss{
  width: 320px;
  height: 180px;
}

body.mobile-portrait .joystick-container{
  width: 90px;
  height: 90px;
  bottom: 70px;
}

body.mobile-portrait .joystick-stick{
  width: 34px;
  height: 34px;
}

body.mobile-portrait #boss{
  width: 320px;
  height: 180px;
}

body.mobile-portrait #btnAquarium.aquarium{
  bottom: 16px;
  left: 12px;
}

body.mobile-portrait #btnShop.shop{
  bottom: 16px;
  left: 72px;
}

body.mobile-landscape .dash-mobile{
  padding: 8px 10px;
  font-size: 0.8rem;
}

body.mobile-landscape #metaUI{
  bottom: 34px;
}

body.mobile-landscape #dashCooldownUI{
  bottom: 10px;
  height: 7px;
}

body.mobile-landscape .joystick-container{
  width: 78px;
  height: 78px;
  bottom: 80px;
}

body.mobile-landscape .joystick-stick{
  width: 28px;
  height: 28px;
}

body.mobile-landscape #hud{
  font-size: 0.78rem;
}

body.mobile-portrait #metaUI{
  display: none !important;
}

body.mobile-landscape #boss{
  width: 280px;
  height: 158px;
}

@media (max-height: 480px) and (orientation: landscape){
  body.mobile-mode #boss{
    width: 280px;
    height: 158px;
  }

  body.mobile-mode .joystick-container{
    width: 84px;
    height: 84px;
  }

  body.mobile-mode .joystick-stick{
    width: 32px;
    height: 32px;
  }

  body.mobile-mode #hud{ font-size: 0.78rem; }
  body.mobile-mode #metaUI{ bottom: 34px; }
  body.mobile-mode #dashCooldownUI{ bottom: 10px; }
}

@media (max-width: 600px){
  #metaUI{
    bottom: 12px;
    left: 140px;
    right: auto;
    font-size: 0.7rem;
  }
  
  #dashCooldownUI{
    height: 3px;
  }
}

/* Options Panel */
#optionsOverlay{
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 25000;
  backdrop-filter: blur(4px);
}

#optionsOverlay.hidden{
  display: none;
}

.options-panel{
  background: rgba(0, 20, 40, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 16px;
  padding: 20px;
  max-width: 450px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(10px);
}

.options-head{
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.options-head h3{
  margin: 0;
  color: #ffffff;
  font-size: 1.1rem;
}

.options-content{
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

.option-group label{
  color: rgba(255, 255, 255, 0.9);
  font-weight: 500;
  font-size: 0.95rem;
}

.option-group small{
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.8rem;
}

.slider-container{
  display: flex;
  align-items: center;
  gap: 8px;
}

.slider-container input[type="range"]{
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: rgba(100, 150, 255, 0.2);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.slider-container input[type="range"]::-webkit-slider-thumb{
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6496ff, #4080ff);
  cursor: pointer;
  box-shadow: 0 0 8px rgba(100, 150, 255, 0.5);
}

.slider-container input[type="range"]::-moz-range-thumb{
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6496ff, #4080ff);
  cursor: pointer;
  border: none;
  box-shadow: 0 0 8px rgba(100, 150, 255, 0.5);
}

.slider-container span{
  color: rgba(255, 255, 255, 0.8);
  font-weight: 600;
  min-width: 50px;
  text-align: right;
  font-size: 0.9rem;
}

.checkbox-label{
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.checkbox-label input[type="checkbox"]{
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: #6496ff;
}

.checkbox-label span{
  color: rgba(255, 255, 255, 0.9);
  font-weight: 500;
}

button.full-width{
  width: 100%;
}

#btnCloseOptions{
  padding: 6px 10px;
}
button.secondary{ opacity: 0.9; }
.toggle{
  display:flex; gap:8px; align-items:center;
  margin-left:auto; font-size: 13px; opacity: 0.95;
}
.pill{
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(0,0,0,0.18);
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
}
.hint{ margin-top: 8px; font-size: 12px; opacity: 0.85; }

/* Overlay */
#overlay{
  position:fixed; inset:0;
  z-index: 20000;
  display:flex;
  align-items:center;
  justify-content:center;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(10px);
  cursor: default;
}
#overlay.hidden{ display:none; }

#overlay.lose{
  background: rgba(5, 15, 25, 0.72);
}

.panel{
  width: min(460px, 92vw);
  background: rgba(5, 15, 25, 0.72);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 18px;
  padding: 16px;

  /* ✅ AJOUT: pour mettre les boutons en bas */
  display: flex;
  flex-direction: column;
}

#overlayTitle{ font-size: 18px; font-weight: 700; }
#overlayMsg{ margin-top: 8px; opacity: 0.9; }

/* ✅ AJOUT: le contenu prend la place, les boutons restent en bas */
.rules,
.stats{
  flex: 1;
}

.actions{
  margin-top: 18px;
  display:flex;
  justify-content: center;
  gap: 12px;
}

/* Stats */
.stats{
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,0.12);
}
.stats-grid{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.stat{
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(0,0,0,0.20);
  border: 1px solid rgba(255,255,255,0.10);
  display:flex;
  justify-content: space-between;
  align-items: baseline;
}
.stat span{ font-size: 12px; opacity: 0.85; }
.stat b{ font-size: 14px; }

/* Checkbox */
.skipRules{
  display:flex;
  align-items:center;
  gap:10px;
  margin-top:12px;
  padding-top:10px;
  border-top:1px solid rgba(255,255,255,0.12);
  font-size:.95rem;
  color: rgba(234,252,255,0.92);
}
.skipRules input{ transform: scale(1.15); }

/* ✅ AJOUT: bouton overlay plus visible */
.actions button{
  padding: 10px 14px;
  border-radius: 14px;
  font-weight: 600;
}
.actions button#btnPlay,
.actions button#btnNext{
  background: rgba(120,240,255,0.18);
  border: 1px solid rgba(120,240,255,0.35);
  box-shadow: 0 0 14px rgba(120,240,255,0.22);
}

/* Texte d'aide (Entrée / Démarrer) */
/* Pulse doux pour le texte d’aide */
.overlay-hint{
  margin-top: 10px;
  font-size: 1rem;
  opacity: 0.85;
  color: #eaffff;
  text-align: left;

  animation: overlayHintPulse 1.8s ease-in-out infinite;
}

.overlay-hint b{
  color: #7ffcff;
  text-shadow: 0 0 6px rgba(120,240,255,0.55);
}

/* Animation */
@keyframes overlayHintPulse{
  0%{
    opacity: 0.45;
    transform: translateY(0);
  }
  50%{
    opacity: 1;
    transform: translateY(-2px);
  }
  100%{
    opacity: 0.45;
    transform: translateY(0);
  }
}

/* Hint visible UNIQUEMENT sur le menu Bienvenue (overlay-rules) */
#overlay:not(.overlay-rules) .overlay-hint{
  display: none !important;
}

/* Texte d'aide (Entrée / Démarrer) + animation douce */
.overlay-hint{
  margin-top: 10px;
  opacity: 0.9;
  text-align: center;
  font-size: 1.05rem;
  letter-spacing: .4px;

  animation: hintPulse 1.6s ease-in-out infinite;
}

.overlay-hint b{
  color: #7ffcff;
  text-shadow: 0 0 6px rgba(120,240,255,0.8);
}

@keyframes hintPulse{
  0%{ opacity: 0.35; transform: translateY(0); }
  50%{ opacity: 1; transform: translateY(-2px); }
  100%{ opacity: 0.35; transform: translateY(0); }
}

/* =========================
   UPGRADES (menu après win)
========================= */
.upgrades{
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,0.12);
}

.upgrades h3{
  margin: 0 0 10px;
  font-size: 1.05rem;
  color: #9ee8ff;
}

.upgrades-grid{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.upgrade-card{
  width: 100%;
  text-align: left;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(0,0,0,0.22);
  cursor: pointer;
  transition: transform .12s ease, background .12s ease, border-color .12s ease;
}

.upgrade-card:hover{
  transform: translateY(-1px);
  background: rgba(0,0,0,0.30);
  border-color: rgba(160,240,255,0.28);
}

.u-title{
  font-weight: 800;
  font-size: 1.02rem;
}

.u-desc{
  margin-top: 4px;
  opacity: .9;
  font-size: .92rem;
}

.u-level{
  margin-top: 8px;
  opacity: .9;
  font-size: .9rem;
}

.u-footer{
  margin-top: 10px;
  opacity: .9;
  font-size: .95rem;
}

/* Sur écrans larges: garder 2 colonnes pour une meilleure présentation */
@media (min-width: 700px){
  .upgrades-grid{
    grid-template-columns: repeat(2, 1fr);
  }
  .upgrade-card{
    height: 130px;
  }
}

.dashbar{
  width: 140px;
  height: 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.16);
  overflow: hidden;
}

#dashFill{
  height: 100%;
  width: 100%;
  border-radius: 999px;
  background: rgba(120,240,255,0.75);
  transform-origin: left center;
  transform: scaleX(1);
  transition: transform 0.08s linear;
}

/* =========================
   Dash cooldown bar (bas centre)
========================= */
#dashCooldownUI{
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  width: min(520px, 86vw);
  height: 12px;
  border-radius: 999px;
  background: rgba(255,255,255,0.14);
  border: 1px solid rgba(255,255,255,0.18);
  backdrop-filter: blur(8px);
  overflow: hidden;
  z-index: 25000;
  pointer-events: none;
}

#dashCooldownFill{
  height: 100%;
  width: 0%; /* ✅ part vide */
  border-radius: 999px;
  background: rgba(80, 180, 255, 0.95);
  box-shadow: 0 0 18px rgba(80, 180, 255, 0.35);
  transition: width 0.08s linear; /* ✅ fluide */
}

/* Barre bleue visible UNIQUEMENT en jeu */
#dashCooldownUI{ 
  display: none; 
}

body.game-running #dashCooldownUI{
  display: block;
}

/* =========================
   META XP UI + Aquarium
========================= */
#metaUI{
  position: fixed;
  left: 50%;
  bottom: 58px;              /* au-dessus de ta barre dash */
  transform: translateX(-50%);
  width: min(560px, 88vw);
  z-index: 12000;
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: none; /* le bouton aura pointer-events */
}

/* Leaderboard */
.leaderboard {
  position: fixed;
  inset: 0;
  z-index: 20000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(10px);
}

.leaderboard.hidden {
  display: none;
}

.leaderboard .panel {
  width: min(500px, 90vw);
  max-height: 80vh;
  overflow-y: auto;
  background: rgba(5, 15, 25, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  padding: 20px;
}

.leaderboard h3 {
  text-align: center;
  margin-bottom: 15px;
  font-size: 20px;
}

.leaderboard-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
  justify-content: center;
}

.leaderboard-tab {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  padding: 8px 15px;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.2s;
}

.leaderboard-tab:hover {
  background: rgba(255, 255, 255, 0.15);
}

.leaderboard-tab.active {
  background: rgba(0, 150, 255, 0.5);
  border-color: #0096ff;
}

.leaderboard-list {
  list-style: none;
  padding: 0;
  margin-bottom: 15px;
}

.leaderboard-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px;
  background: rgba(255, 255, 255, 0.05);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 5px;
  margin-bottom: 8px;
}

.leaderboard-rank {
  font-weight: bold;
  width: 30px;
  text-align: center;
}

.leaderboard-rank.top1 { color: #ffd700; }
.leaderboard-rank.top2 { color: #c0c0c0; }
.leaderboard-rank.top3 { color: #cd7f32; }

.leaderboard-user {
  flex: 1;
  margin-left: 10px;
}

.leaderboard-user-id {
  font-size: 12px;
  opacity: 0.7;
}

.leaderboard-score {
  font-weight: bold;
  font-size: 16px;
  color: #0f0;
}

#btnCloseLeaderboard {
  width: 100%;
}

/* Aquarium button IN overlay (visible only when overlay is visible) */
#overlay:not(.hidden) #btnAquarium{
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
}

/* position bas gauche dans l’overlay */
#btnAquarium.aquarium{
  position: absolute;
  left: 16px;
  bottom: 16px;
  z-index: 32000;
  width: 52px;
  height: 52px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(0,0,0,0.28);
  backdrop-filter: blur(10px);
  color: white;
  font-size: 22px;
  cursor: pointer;
  display: none; /* caché par défaut, affiché via règle au-dessus */
}


#btnAquarium.aquarium:hover{
  background: rgba(0,0,0,0.38);
}

/* Badge (unseen skins count) */
#aquariumBadge.badge{
  position: absolute;
  right: -6px;
  top: -6px;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(255,80,120,0.95);
  border: 1px solid rgba(255,255,255,0.25);
  color: white;
  font-size: 12px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 16px rgba(0,0,0,0.35);
}

/* NEW badge sur les skins */
.new-badge{
  position: absolute;
  right: 8px;
  top: 8px;
  min-width: 22px;
  height: 22px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255,80,120,0.95);
  border: 1px solid rgba(255,255,255,0.25);
  color: white;
  font-size: 11px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 16px rgba(0,0,0,0.35);
  z-index: 10;
  animation: badgePulse 1.5s ease-in-out infinite;
}

@keyframes badgePulse{
  0%, 100%{ transform: scale(1); }
  50%{ transform: scale(1.08); }
}

/* Show aquarium only when overlay is visible (menus) */
#overlay.hidden #btnAquarium.aquarium{
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.hidden{ display:none !important; }


#metaXPBar{
  flex: 1;
  height: 12px;
  border-radius: 999px;
  background: rgba(255,255,255,0.14);
  border: 1px solid rgba(255,255,255,0.18);
  overflow: hidden;
  backdrop-filter: blur(8px);
}

#metaXPFill{
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: rgba(80, 180, 255, 0.95);
  box-shadow: 0 0 18px rgba(80, 180, 255, 0.35);
  transition: width 0.12s linear;
}

#metaXPText{
  pointer-events: none;
  font-size: 12px;
  opacity: .9;
  white-space: nowrap;
}

/* Visible uniquement en jeu */
#metaUI{ display:none; }
body.game-running #metaUI{ display:flex; }

@media (max-width:520px){
  #metaUI{ bottom: 52px; gap: 8px; }
  #btnAquarium{ width: 42px; height: 42px; }
  #metaXPText{ display:none; }
}

/* =========================
   Skins overlay (Aquarium)
========================= */
#skinOverlay{
  position: fixed;
  inset: 0;
  z-index: 30000;
  background: rgba(0,0,0,0.60);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
}

#skinOverlay.hidden{ display:none; }

.skin-panel{
  width: min(860px, 92vw);
  background: rgba(5, 15, 25, 0.78);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 18px;
  padding: 14px;
}

.skin-head{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.skin-title{
  font-size: 18px;
  font-weight: 800;
}

.skin-tabs{
  display:flex;
  gap: 10px;
  margin-bottom: 12px;
}

.tab{
  border-radius: 999px;
  padding: 8px 12px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(0,0,0,0.18);
  cursor: pointer;
  color: white;
}

.tab.active{
  border-color: rgba(120,240,255,0.35);
  background: rgba(120,240,255,0.12);
}

.skin-grid{
  display:grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
/* === Aquarium scrollable === */
.skin-panel{
  display: flex;              /* AJOUT */
  flex-direction: column;     /* AJOUT */
  max-height: min(80vh, 560px); /* AJOUT */
}

.skin-grid{
  display:grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;

  /* scroll */
  overflow-y: auto;
  flex: 1;
  min-height: 0;

  /* IMPORTANT : pas de max-height ici */
  padding-right: 6px;
}


/* Scrollbar discrète aquarium */
.skin-grid::-webkit-scrollbar{
  width: 8px;
}
.skin-grid::-webkit-scrollbar-thumb{
  background: rgba(255,255,255,0.18);
  border-radius: 999px;
}
.skin-grid::-webkit-scrollbar-track{
  background: rgba(0,0,0,0.15);
}

@media (max-width: 600px){
  .skin-grid{
    max-height: 320px;
  }
}


@media (max-width: 900px){
  .skin-grid{ grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 520px){
  .skin-grid{ grid-template-columns: repeat(2, 1fr); }
}

.skin-card{
  position: relative;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(0,0,0,0.22);
  padding: 10px;
  text-align: left;
}

.skin-top{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.skin-name{
  font-weight: 800;
}

.skin-rarity{
  font-size: 12px;
  opacity: .9;
}

.skin-preview{
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 12px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.10);
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}

.skin-actions{
  display:flex;
  gap: 8px;
  margin-top: 10px;
}

.skin-actions button{
  flex: 1;
}

.locked .skin-preview{
  filter: grayscale(1) brightness(0.7);
}
.locked .skin-actions button{
  opacity: .6;
  cursor: not-allowed;
}

/* Rareté couleurs */
.r-common{ border-color: rgba(255,255,255,0.14); }
.r-rare{ border-color: rgba(60,180,255,0.55); box-shadow: 0 0 14px rgba(60,180,255,0.12); }
.r-epic{ border-color: rgba(180,90,255,0.62); box-shadow: 0 0 16px rgba(180,90,255,0.14); }
.r-legendary{ border-color: rgba(255,210,80,0.75); box-shadow: 0 0 18px rgba(255,210,80,0.16); }

.skin-foot{
  margin-top: 10px;
  opacity: .9;
}

/* Bouton boutique dans le panel (à côté de l’aquarium) */
#btnShop.shop{
  position: absolute;
  left: 80px;  /* à côté du bouton aquarium */
  bottom: 16px;
  width: 52px;
  height: 52px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(0,0,0,0.28);
  backdrop-filter: blur(10px);
  color: white;
  font-size: 20px;
  cursor: pointer;
  display:none;
  z-index: 20001;
}
#btnShop.shop:hover{ background: rgba(0,0,0,0.38); }

/* visible seulement quand overlay visible */
#overlay:not(.hidden) #btnShop{ display:inline-flex !important; align-items:center; justify-content:center; }

/* Shop overlay */
#shopOverlay{
  position: fixed;
  inset: 0;
  z-index: 30000;
  background: rgba(0,0,0,0.60);
  backdrop-filter: blur(10px);
  display:flex;
  align-items:center;
  justify-content:center;
}
#shopOverlay.hidden{ display:none; }

.shop-panel{
  width: min(900px, 94vw);
  background: rgba(5,15,25,0.82);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 18px;
  padding: 14px;
}

.shop-head{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.shop-title{ font-size: 18px; font-weight: 800; }

.shop-topbar{
  display:flex;
  justify-content: flex-end;
  margin-bottom: 10px;
  opacity: .95;
}
.wallet{
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(0,0,0,0.18);
  padding: 8px 12px;
  border-radius: 999px;
}

.shop-tabs{ display:flex; gap: 10px; margin-bottom: 12px; }

.shop-grid{
  display:grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
@media (max-width: 900px){ .shop-grid{ grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 520px){ .shop-grid{ grid-template-columns: repeat(2, 1fr); } }

.shop-card{
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(0,0,0,0.22);
  padding: 10px;
}

.shop-card .preview{
  width:100%;
  aspect-ratio: 1/1;
  border-radius: 12px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.10);
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}

.shop-card .name{ font-weight: 800; margin-top: 8px; }
.shop-card .rarity{ opacity: .9; margin-top: 2px; font-size: 12px; }
.shop-card .price{ opacity: .9; margin-top: 6px; font-size: 13px; }

.shop-card button{
  width:100%;
  margin-top: 10px;
}
.shop-card button:disabled{ opacity:.5; cursor:not-allowed; }

/* ===== UI Premium Pack ===== */
.shop-card{
  position: relative;
  overflow: hidden;
}

.shop-card:hover{
  transform: translateY(-2px);
  box-shadow: 0 14px 28px rgba(0,0,0,0.35);
}

/* Reflet verre */
.shop-card::before{
  content:"";
  position:absolute;
  inset:0;
  pointer-events:none;
  background:
    radial-gradient(600px 220px at 30% 0%, rgba(255,255,255,0.16), transparent 55%);
}

/* Glow rareté */
.shop-card::after{
  content:"";
  position:absolute;
  left:10px;
  right:10px;
  bottom:10px;
  height:3px;
  border-radius:999px;
}

.r-common::after{ background: rgba(255,255,255,0.25); }
.r-rare::after{ background: rgba(60,180,255,0.65); }
.r-epic::after{ background: rgba(180,90,255,0.7); }
.r-legendary::after{ background: rgba(255,210,80,0.75); }


/* =========================================
   Boutique scrollable (si trop de skins)
========================================= */

/* Conteneur de la grille boutique */
.shop-grid{
  max-height: 420px;     /* ≈ 2 lignes de cartes */
  overflow-y: auto;
  padding-right: 6px;
}

/* Scrollbar discrète */
.shop-grid::-webkit-scrollbar{
  width: 8px;
}
.shop-grid::-webkit-scrollbar-thumb{
  background: rgba(255,255,255,0.18);
  border-radius: 999px;
}
.shop-grid::-webkit-scrollbar-track{
  background: rgba(0,0,0,0.15);
}

/* ===== Badge compteur onglets (Poisson / Boss) ===== */
.tab{
  position: relative; /* nécessaire pour positionner le badge */
}

.tab-badge{
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  color: white;
  background: rgba(255, 80, 120, 0.95); 
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 999px;
  box-shadow: 0 6px 14px rgba(0,0,0,0.35);
  pointer-events: none;
}

.tab .count{
  position: absolute;
  top: -6px;
  right: -6px;

  min-width: 20px;
  height: 20px;
  padding: 0 6px;

  display: flex;
  align-items: center;
  justify-content: center;

  font-size: 12px;
  font-weight: 900;
  color: white;

  background: rgba(255, 80, 120, 0.95); 
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 999px;

  box-shadow: 0 6px 14px rgba(0,0,0,0.35);
  pointer-events: none;
}


@media (max-width: 600px){
  .shop-grid{
    max-height: 320px;
  }
}

/* Sur mobile: un peu plus bas/fin */
@media (max-width: 520px){
  #dashCooldownUI{
    bottom: 16px;
    height: 11px;
  }
}

/* mobile : un peu plus grand */
@media (max-width: 520px){
  .dashbar{ width: 120px; }
}


/* =========================================================
   📱 MODE MOBILE COMPACT (auto)
   ========================================================= */
@media (hover: none) and (pointer: coarse), (max-width: 900px){

  /* Curseur poisson */
  #cursorFish{
    width: 48px;
    height: 48px;
  }

  /* Boss (visuel seulement) */
  #boss{
    width: 380px;
    height: 213px;
  }

  /* Entités */
  .entity.food{
    width: 20px;
    height: 20px;
  }

  .entity.bonus{
    width: 26px;
    height: 26px;
  }

  .entity.malus{
    width: 32px;
    height: 32px;
  }

  .entity.power-dash{
    width: 30px;
    height: 30px;
  }

  .entity.power-magnet{
    width: 28px;
    height: 28px;
  }

  /* HUD plus compact */
  #hud{
    min-width: unset;
    padding: 10px;
    font-size: 13px;
  }

  .hud-top{
    gap: 10px;
    font-size: 12px;
  }

  .pill{
    padding: 5px 8px;
    font-size: 11px;
  }

  /* Overlay un peu plus aéré */
  .panel{
    width: min(92vw, 420px);
    padding: 14px;
  }

  .rules{
    font-size: 0.9rem;
    max-height: 50vh;
  }
}
@media (max-width: 768px){
  .swimmer{
    width: 90px;
    height: 38px;
    opacity: 0.7;
  }
}

@media (max-width: 480px){
  .swimmer{
    width: 70px;
    height: 30px;
    opacity: 0.6;
  }
}


.hidden{
  display: none !important;
}


/* =========================================================
   OVERRIDE: Hover Glow (Option 2 + 3)
   - No continuous pulse.
   - Common: no animation
   - Rare/Epic/Legendary: glow animation only on hover
========================================================= */

/* Stop any continuous rarity animations (if present above) */
.upgrade-card.rarity-rare,
.upgrade-card[data-rarity="rare"],
.upgrade-card.rarity-epic,
.upgrade-card[data-rarity="epic"],
.upgrade-card.rarity-legendary,
.upgrade-card[data-rarity="legendary"]{
  animation: none !important;
}

/* Keep rarity borders/glow base (static) */
.upgrade-card.rarity-rare,
.upgrade-card[data-rarity="rare"]{
  border-color: rgba(60, 180, 255, 0.55);
  box-shadow: 0 0 18px rgba(60, 180, 255, 0.18);
}
.upgrade-card.rarity-epic,
.upgrade-card[data-rarity="epic"]{
  border-color: rgba(180, 90, 255, 0.62);
  box-shadow: 0 0 22px rgba(180, 90, 255, 0.20);
}
.upgrade-card.rarity-legendary,
.upgrade-card[data-rarity="legendary"]{
  border-color: rgba(255, 210, 80, 0.75);
  box-shadow: 0 0 26px rgba(255, 210, 80, 0.22);
}

/* Elegant glow animation */
@keyframes hoverGlow {
  0%   { box-shadow: 0 0 12px rgba(255,255,255,0.14); }
  50%  { box-shadow: 0 0 26px rgba(255,255,255,0.34); }
  100% { box-shadow: 0 0 12px rgba(255,255,255,0.14); }
}

/* Common: no animation */
.upgrade-card.rarity-common:hover,
.upgrade-card[data-rarity="common"]:hover{
  animation: none !important;
}

/* Rare: slow glow */
.upgrade-card.rarity-rare:hover,
.upgrade-card[data-rarity="rare"]:hover{
  animation: hoverGlow 2.6s ease-in-out infinite;
  filter: brightness(1.05);
}

/* Epic: a bit faster */
.upgrade-card.rarity-epic:hover,
.upgrade-card[data-rarity="epic"]:hover{
  animation: hoverGlow 2.0s ease-in-out infinite;
  filter: brightness(1.10);
}

/* Legendary: strongest */
.upgrade-card.rarity-legendary:hover,
.upgrade-card[data-rarity="legendary"]:hover{
  animation: hoverGlow 1.4s ease-in-out infinite;
  filter: brightness(1.18) saturate(1.12);
}

/* Shine & sparkle ONLY on hover (not permanent) */
.upgrade-card.rarity-rare::after,
.upgrade-card[data-rarity="rare"]::after,
.upgrade-card.rarity-epic::after,
.upgrade-card[data-rarity="epic"]::after,
.upgrade-card.rarity-legendary::after,
.upgrade-card[data-rarity="legendary"]::after{
  opacity: 0 !important;
  animation: none !important;
}

.upgrade-card.rarity-rare:hover::after,
.upgrade-card[data-rarity="rare"]:hover::after,
.upgrade-card.rarity-epic:hover::after,
.upgrade-card[data-rarity="epic"]:hover::after,
.upgrade-card.rarity-legendary:hover::after,
.upgrade-card[data-rarity="legendary"]:hover::after{
  opacity: 0.55 !important;
  animation: shineSweep 2.8s ease-in-out infinite !important;
}

.upgrade-card.rarity-legendary::before,
.upgrade-card[data-rarity="legendary"]::before{
  opacity: 0 !important;
  animation: none !important;
}

.upgrade-card.rarity-legendary:hover::before,
.upgrade-card[data-rarity="legendary"]:hover::before{
  opacity: 0.35 !important;
  animation: sparkle 1.1s ease-in-out infinite !important;
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce){
  .upgrade-card:hover{
    animation: none !important;
  }
  .upgrade-card::before,
  .upgrade-card::after{
    animation: none !important;
  }
}

/* =========================================================
   PARTICLES POUR FEEDBACK VISUEL
   ========================================================= */
.particle {
  position: absolute;
  pointer-events: none;
  z-index: 10;
  animation: particleFade 1s ease-out forwards;
}

.particle.bubble {
  background: radial-gradient(circle, rgba(255,255,255,0.8) 0%, transparent 70%);
  border-radius: 50%;
  width: 10px;
  height: 10px;
}

.particle.spark {
  background: radial-gradient(circle, #ffd700 0%, transparent 70%);
  width: 8px;
  height: 8px;
  clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}

@keyframes particleFade {
  0% { opacity: 1; transform: scale(1) translateY(0); }
  100% { opacity: 0; transform: scale(0.5) translateY(-20px); }
}

/* =========================================================
   TUTORIAL OVERLAY
   ========================================================= */
#tutorialOverlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.3); /* Semi-transparent pour voir derrière */
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  pointer-events: none; /* Permet les interactions derrière */
}

.tutorial-panel {
  background: rgba(0,0,0,0.9);
  border: 2px solid rgba(255,255,255,0.2);
  border-radius: 10px;
  padding: 20px;
  max-width: 400px;
  text-align: center;
  color: white;
  pointer-events: auto; /* Boutons interactifs */
}

.tutorial-panel button {
  margin: 10px 5px;
  padding: 10px 20px;
  background: #007bff;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
}

.tutorial-panel button:hover {
  background: #0056b3;
}

/* Tutorial guiding hand */
#tutorialHand {
  position: fixed;
  font-size: 48px;
  pointer-events: none;
  z-index: 999;
  transition: transform 0.1s ease;
}

/* Damage flash overlay */
#damageFlash {
  position: fixed;
  inset: 0;
  background: rgba(255, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  z-index: 999999;
  transition: opacity 0.2s ease-out;
}

#damageFlash.active {
  opacity: 1;
}

/* Force hide when game not running */
body:not(.game-running) #damageFlash {
  opacity: 0 !important;
  display: none;
}

/* Mode selection */
.mode-selection {
  margin-bottom: 15px;
  text-align: center;
}

.mode-selection h4 {
  margin: 0 0 10px 0;
  font-size: 16px;
  color: #fff;
}

.mode-btn {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.3);
  color: #fff;
  padding: 8px 12px;
  margin: 0 5px;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.2s;
}

.mode-btn:hover {
  background: rgba(255,255,255,0.2);
}

.mode-btn.active {
  background: rgba(0,150,255,0.5);
  border-color: #0096ff;
}

/* Storm event shake */
.storm {
  animation: shake 0.1s infinite;
}

@keyframes shake {
  0% { transform: translateX(0); }
  25% { transform: translateX(-2px) rotate(-0.5deg); }
  50% { transform: translateX(2px) rotate(0.5deg); }
  75% { transform: translateX(-1px) rotate(-0.25deg); }
  100% { transform: translateX(1px) rotate(0.25deg); }
}

/* Soif de sang - gouttes rouges qui coulent */
body.bloodlust::after {
  content: '';
  position: fixed;
  inset: 0;
  background-image: 
    radial-gradient(3px 10px at 2% 0%, rgba(200, 0, 0, 0.8), transparent 100%),
    radial-gradient(2.5px 9px at 5% 0%, rgba(220, 20, 20, 0.75), transparent 100%),
    radial-gradient(3px 10px at 8% 0%, rgba(180, 0, 0, 0.85), transparent 100%),
    radial-gradient(2px 8px at 11% 0%, rgba(200, 10, 10, 0.8), transparent 100%),
    radial-gradient(3px 10px at 14% 0%, rgba(210, 0, 0, 0.8), transparent 100%),
    radial-gradient(2.5px 9px at 17% 0%, rgba(190, 5, 5, 0.75), transparent 100%),
    radial-gradient(3px 10px at 20% 0%, rgba(200, 0, 0, 0.85), transparent 100%),
    radial-gradient(2px 8px at 23% 0%, rgba(220, 10, 10, 0.8), transparent 100%),
    radial-gradient(3px 10px at 26% 0%, rgba(200, 0, 0, 0.8), transparent 100%),
    radial-gradient(2.5px 9px at 29% 0%, rgba(210, 5, 5, 0.75), transparent 100%),
    radial-gradient(3px 10px at 32% 0%, rgba(200, 0, 0, 0.85), transparent 100%),
    radial-gradient(2px 8px at 35% 0%, rgba(200, 10, 10, 0.8), transparent 100%),
    radial-gradient(3px 10px at 38% 0%, rgba(210, 0, 0, 0.8), transparent 100%),
    radial-gradient(2.5px 9px at 41% 0%, rgba(190, 5, 5, 0.75), transparent 100%),
    radial-gradient(3px 10px at 44% 0%, rgba(200, 0, 0, 0.8), transparent 100%),
    radial-gradient(2px 8px at 47% 0%, rgba(220, 10, 10, 0.8), transparent 100%),
    radial-gradient(3px 10px at 50% 0%, rgba(200, 0, 0, 0.85), transparent 100%),
    radial-gradient(2.5px 9px at 53% 0%, rgba(210, 5, 5, 0.75), transparent 100%),
    radial-gradient(3px 10px at 56% 0%, rgba(180, 0, 0, 0.8), transparent 100%),
    radial-gradient(2px 8px at 59% 0%, rgba(200, 10, 10, 0.8), transparent 100%),
    radial-gradient(3px 10px at 62% 0%, rgba(210, 0, 0, 0.8), transparent 100%),
    radial-gradient(2.5px 9px at 65% 0%, rgba(190, 5, 5, 0.75), transparent 100%),
    radial-gradient(3px 10px at 68% 0%, rgba(200, 0, 0, 0.85), transparent 100%),
    radial-gradient(2px 8px at 71% 0%, rgba(220, 10, 10, 0.8), transparent 100%),
    radial-gradient(3px 10px at 74% 0%, rgba(200, 0, 0, 0.8), transparent 100%),
    radial-gradient(2.5px 9px at 77% 0%, rgba(210, 5, 5, 0.75), transparent 100%),
    radial-gradient(3px 10px at 80% 0%, rgba(200, 0, 0, 0.85), transparent 100%),
    radial-gradient(2px 8px at 83% 0%, rgba(200, 10, 10, 0.8), transparent 100%),
    radial-gradient(3px 10px at 86% 0%, rgba(210, 0, 0, 0.8), transparent 100%),
    radial-gradient(2.5px 9px at 89% 0%, rgba(190, 5, 5, 0.75), transparent 100%),
    radial-gradient(3px 10px at 92% 0%, rgba(200, 0, 0, 0.8), transparent 100%),
    radial-gradient(2px 8px at 95% 0%, rgba(220, 10, 10, 0.8), transparent 100%),
    radial-gradient(3px 10px at 98% 0%, rgba(200, 0, 0, 0.85), transparent 100%);
  background-size: 100% 100%;
  background-repeat: repeat-y;
  animation: bloodDrop 2.2s linear infinite;
  pointer-events: none;
  z-index: 10;
}

@keyframes bloodDrop {
  0% {
    transform: translateY(-100%);
  }
  100% {
    transform: translateY(100vh);
  }
}

/* Marée - effet d'oscillation douce */
body.tide .layer {
  animation: tideWave 4s ease-in-out infinite !important;
}

@keyframes tideWave {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(15px); }
}

/* Plancton lumineux - petits points scintillants verts VISIBLES */
body.plankton::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: 
    radial-gradient(4px 4px at 10% 20%, rgba(0, 255, 150, 1), rgba(0, 255, 150, 0.5) 60%, transparent),
    radial-gradient(3.5px 3.5px at 25% 35%, rgba(100, 255, 180, 0.95), rgba(100, 255, 180, 0.4) 60%, transparent),
    radial-gradient(4px 4px at 40% 15%, rgba(50, 255, 150, 1), rgba(50, 255, 150, 0.5) 60%, transparent),
    radial-gradient(3px 3px at 18% 60%, rgba(0, 255, 180, 0.95), rgba(0, 255, 180, 0.4) 60%, transparent),
    radial-gradient(4px 4px at 70% 45%, rgba(100, 255, 150, 1), rgba(100, 255, 150, 0.5) 60%, transparent),
    radial-gradient(3.5px 3.5px at 45% 70%, rgba(30, 255, 170, 0.9), rgba(30, 255, 170, 0.4) 60%, transparent),
    radial-gradient(4px 4px at 80% 25%, rgba(0, 255, 160, 1), rgba(0, 255, 160, 0.5) 60%, transparent),
    radial-gradient(3px 3px at 55% 55%, rgba(80, 255, 160, 0.95), rgba(80, 255, 160, 0.4) 60%, transparent),
    radial-gradient(4px 4px at 35% 85%, rgba(0, 255, 150, 1), rgba(0, 255, 150, 0.5) 60%, transparent),
    radial-gradient(3.5px 3.5px at 75% 75%, rgba(100, 255, 180, 0.95), rgba(100, 255, 180, 0.4) 60%, transparent),
    radial-gradient(4px 4px at 15% 45%, rgba(50, 255, 160, 1), rgba(50, 255, 160, 0.5) 60%, transparent),
    radial-gradient(3px 3px at 90% 10%, rgba(0, 255, 180, 0.95), rgba(0, 255, 180, 0.4) 60%, transparent);
  background-size: 
    200px 200px,
    220px 220px,
    240px 240px,
    200px 200px,
    220px 240px,
    240px 200px,
    200px 220px,
    220px 200px,
    240px 220px,
    200px 240px,
    220px 200px,
    240px 240px;
  background-repeat: repeat;
  background-position:
    0 0,
    50px 30px,
    20px 50px,
    80px 40px,
    30px 80px,
    60px 60px,
    40px 20px,
    70px 50px,
    10px 90px,
    100px 20px,
    30px 30px,
    90px 80px;
  animation: planktonShimmer 2.5s ease-in-out infinite, planktonDrift 8s linear infinite;
  pointer-events: none;
  z-index: 8;
  filter: drop-shadow(0 0 8px rgba(0, 255, 150, 0.8));
}

/* Plancton lumineux - assombrir l'écran */
body.plankton::after {
  content: '';
  position: fixed;
  inset: 0;
  background: rgba(0, 15, 20, 0.55);
  pointer-events: none;
  z-index: 7;
}

@keyframes planktonShimmer {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

@keyframes planktonDrift {
  0% { background-position: 0 0, 50px 30px, 20px 50px, 80px 40px, 30px 80px, 60px 60px, 40px 20px, 70px 50px, 10px 90px, 100px 20px, 30px 30px, 90px 80px; }
  100% { background-position: -30px -40px, 20px 0px, -10px 20px, 50px 10px, 0px 50px, 30px 30px, 10px -10px, 40px 20px, -20px 60px, 70px -10px, 0px 0px, 60px 50px; }
}

/* Eau trouble - voile troublant sur écran */
body.murky #scene::after {
  content: '';
  position: fixed;
  inset: 0;
  background: rgba(10, 30, 40, 0.4);
  backdrop-filter: blur(2.5px);
  pointer-events: none;
  z-index: 8000;
  animation: murkyPulse 2s ease-in-out infinite;
}

body.murky .entity {
  opacity: 0.8;
}

body.murky #boss {
  filter: brightness(0.75);
}

/* Murky pulse effect */
@keyframes murkyPulse {
  0%, 100% { backdrop-filter: blur(2.5px); }
  50% { backdrop-filter: blur(3.5px); }
}

/* Attaque surprise - boss invisible */
body.attack-surprise #boss {
  opacity: 0 !important;
  pointer-events: none;
}

/* Boss reappears briefly at events end (visual feedback) */
body.attack-surprise .event-notification {
  animation: attackPulse 0.4s ease-out;
}

@keyframes attackPulse {
  0% { transform: translate(-50%, -50%) scale(0.8); opacity: 0; }
  50% { opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

/* =========================================================
   NOTIFICATION D'ÉVÉNEMENT
   ========================================================= */

.event-notification {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1000;
  pointer-events: none;
}

.event-notification.hidden {
  display: none;
}

.event-notification-content {
  background: linear-gradient(135deg, rgba(0,20,40,0.95), rgba(0,40,70,0.95));
  border: 2px solid rgba(120,240,255,0.6);
  border-radius: 16px;
  padding: 24px 48px;
  box-shadow: 
    0 8px 32px rgba(0,0,0,0.6),
    0 0 40px rgba(120,240,255,0.4),
    inset 0 0 30px rgba(120,240,255,0.1);
  animation: eventPopIn 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.event-notification-text {
  font-size: 32px;
  font-weight: bold;
  color: rgba(255,255,255,0.95);
  text-align: center;
  text-shadow: 
    0 0 20px rgba(120,240,255,0.8),
    0 2px 8px rgba(0,0,0,0.8);
  letter-spacing: 2px;
}

@keyframes eventPopIn {
  0% {
    transform: scale(0.5);
    opacity: 0;
  }
  50% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.event-notification.fadeOut .event-notification-content {
  animation: eventFadeOut 0.4s ease-out forwards;
}

@keyframes eventFadeOut {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  100% {
    transform: scale(0.8);
    opacity: 0;
  }
}

/* Style pour le champ de nom (cohérent avec les boutons du menu) */
#usernameInput:hover {
  background: rgba(255,255,255,0.2) !important;
}

#usernameInput:focus {
  outline: none;
  border-color: #0096ff !important;
  background: rgba(0,150,255,0.2) !important;
}

/* Bouton "Continuer" du modal nom avec effet hover */
#btnSetUsername:hover {
  background: rgba(120,240,255,0.28) !important;
  box-shadow: 0 0 20px rgba(120,240,255,0.35) !important;
  transform: translateY(-1px);
}

#btnSetUsername:active {
  transform: translateY(0);
}

/* =========================================================
   MODAL DE CHOIX DE NOM
   ========================================================= */

.username-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 50000;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(10px);
}

.username-panel {
  background: rgba(5,15,25,0.72);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 18px;
  padding: 32px;
  text-align: center;
  max-width: 400px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}

.username-title {
  color: #7ffcff;
  margin-bottom: 16px;
  font-size: 24px;
  font-weight: 600;
  text-shadow: 0 0 8px rgba(127,252,255,0.4);
}

.username-text {
  color: rgba(234,252,255,0.9);
  margin-bottom: 20px;
  font-size: 16px;
}

#usernameInput {
  width: 100%;
  padding: 12px;
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 5px;
  background: rgba(255,255,255,0.1);
  color: #fff;
  font-size: 16px;
  margin-bottom: 16px;
  box-sizing: border-box;
  transition: all 0.2s;
}

#btnSetUsername {
  width: 100%;
  padding: 12px;
  background: rgba(120,240,255,0.18);
  border: 1px solid rgba(120,240,255,0.35);
  color: #fff;
  border-radius: 14px;
  font-weight: 600;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.2s;
  box-shadow: 0 0 14px rgba(120,240,255,0.22);
}

.username-error {
  color: #ff6666;
  font-size: 14px;
  margin-top: 8px;
  display: none;
}

/* =========================================================
   FIN DU FICHIER styles.css
   ========================================================= */
