/* ============================================================
   Lilou et la Licorne — feuille de style
   Phase 1 : habillage minimal, l'ambiance viendra avec les SVG.
   ============================================================ */

:root {
  --rose:        #ff7bc4;
  --rose-clair:  #ffd6ec;
  --rose-fonce:  #c2185b;
  --violet:      #9b5de5;
  --blanc:       #fffaff;
  --ombre:       rgba(90, 20, 60, .35);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: #1b0d1a;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  /* Pas de sélection ni de zoom accidentel avec les doigts */
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  touch-action: none;
}

#game {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

#canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* ---------- ATH ---------- */

#hud {
  position: absolute;
  top: 0; left: 0; right: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 12px 16px;
  padding-top: max(12px, env(safe-area-inset-top));
  pointer-events: none;
}

.hud-block {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, .55);
  border-radius: 999px;
  padding: 6px 14px;
  box-shadow: 0 2px 8px var(--ombre);
}

.heart {
  width: 26px;
  height: 26px;
  background: var(--rose-fonce);
  /* Cœur en pur CSS, remplacé par un SVG en phase 2 */
  clip-path: path("M13 24 L2 13 A6.5 6.5 0 0 1 13 5 A6.5 6.5 0 0 1 24 13 Z");
  transition: opacity .2s, transform .2s;
}
.heart.empty {
  opacity: .25;
  transform: scale(.8);
}

.rainbow-icon {
  width: 24px;
  height: 14px;
  border-radius: 24px 24px 0 0;
  border: 5px solid var(--violet);
  border-bottom: none;
}

/* Niveau 2 : le compteur affiche un petit soleil. */
.rainbow-icon.soleil {
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 50%;
  background: #ffe14d;
  box-shadow: 0 0 0 3px #ffb03a, 0 0 10px 3px rgba(255, 225, 77, .7);
}

#rainbow-count {
  font-size: 22px;
  font-weight: bold;
  color: var(--rose-fonce);
  min-width: 2ch;
}

/* ---------- Commandes tactiles ---------- */

#touch-controls {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 20px;
  padding-bottom: max(20px, env(safe-area-inset-bottom));
  pointer-events: none;
}

.pad-left, .pad-right {
  display: flex;
  gap: 16px;
  pointer-events: auto;
}

.btn {
  width: 76px;
  height: 76px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, .6);
  color: var(--rose-fonce);
  font-size: 30px;
  line-height: 1;
  box-shadow: 0 4px 10px var(--ombre);
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}
.btn:active, .btn.pressed {
  background: var(--rose);
  color: var(--blanc);
  transform: scale(.94);
}

.btn-jump {
  width: 92px;
  height: 92px;
  background: rgba(255, 123, 196, .75);
  color: var(--blanc);
  font-size: 36px;
}

/* Sur grand écran (PC), le clavier suffit : on masque les boutons. */
@media (hover: hover) and (pointer: fine) {
  #touch-controls { display: none; }
}

/* ---------- Retour au menu ---------- */

#retour {
  position: absolute;
  z-index: 3;
  left: 14px;
  top: max(56px, calc(env(safe-area-inset-top) + 56px));
  width: 46px; height: 46px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, .55);
  color: var(--rose-fonce);
  font-size: 20px;
  text-decoration: none;
  box-shadow: 0 2px 8px var(--ombre);
}

/* ---------- Écrans (game over / victoire) ---------- */

#overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(60, 10, 45, .6);
  backdrop-filter: blur(3px);
}
#overlay.hidden { display: none; }

.panel {
  background: var(--rose-clair);
  border: 6px solid var(--rose);
  border-radius: 28px;
  padding: 32px 40px;
  text-align: center;
  max-width: 88vw;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .35);
}

.panel h1 {
  margin: 0 0 8px;
  font-size: clamp(28px, 6vw, 44px);
  color: var(--rose-fonce);
}

.panel p {
  margin: 0 0 22px;
  font-size: clamp(16px, 3.5vw, 20px);
  color: #7a2a58;
}

.big-btn {
  border: none;
  border-radius: 999px;
  padding: 14px 34px;
  font-size: clamp(18px, 4vw, 22px);
  font-weight: bold;
  color: var(--blanc);
  background: var(--rose);
  box-shadow: 0 4px 0 var(--rose-fonce);
  cursor: pointer;
}
.big-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--rose-fonce); }
