* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body {
  font-family: "Arial Rounded MT Bold", "Trebuchet MS", system-ui, sans-serif;
  background: linear-gradient(#6ec6ff 0%, #b8e6ff 55%, #fff1b8 100%) center / cover no-repeat;
  color: #3b2a6b; user-select: none; -webkit-user-select: none;
}
#stage { position: fixed; inset: 0; }
#stage canvas { display: block; }
#ui { position: fixed; inset: 0; pointer-events: none; }
#ui > * { pointer-events: auto; }
.hidden { display: none !important; }

button {
  font: inherit; border: 0; cursor: pointer; color: #fff;
  min-width: 64px; min-height: 64px; border-radius: 20px;
  background: #7c4dff; box-shadow: 0 6px 0 #4b2bb3, 0 8px 14px rgba(0,0,0,.25);
  font-size: 32px; line-height: 1; touch-action: manipulation;
}
button:active { transform: translateY(4px); box-shadow: 0 2px 0 #4b2bb3; }
button:focus-visible { outline: 4px solid #fff; }

/* Titre */
#title { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4vh; padding: 16px; background: linear-gradient(#6ec6ff, #c9f0ff 60%, #fff1b8); pointer-events: auto; }
#title h1 { margin: 0; font-size: clamp(40px, 9vw, 96px); text-align: center; line-height: 1.05; }
#title h1 span { display: inline-block; text-shadow: 0 4px 0 rgba(0,0,0,.18); }
.levels { display: flex; flex-wrap: wrap; justify-content: center; gap: 20px; }
.lvl { width: 128px; height: 160px; min-height: 160px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 8px; }
.lvl .num { font-size: 30px; }
.lvl .ico { font-size: 52px; }
.lvl .stars { font-size: 22px; letter-spacing: 2px; }
.lvl:nth-child(1) { background: #ff5d5d; box-shadow: 0 6px 0 #b83030, 0 8px 14px rgba(0,0,0,.25); }
.lvl:nth-child(2) { background: #3d9cff; box-shadow: 0 6px 0 #1f64b8, 0 8px 14px rgba(0,0,0,.25); }
.lvl:nth-child(3) { background: #2fcf5f; box-shadow: 0 6px 0 #1a8a3a, 0 8px 14px rgba(0,0,0,.25); }
.lvl:nth-child(4) { background: #ff8a1f; box-shadow: 0 6px 0 #b35a0a, 0 8px 14px rgba(0,0,0,.25); }
.lvl:disabled { filter: grayscale(.8) brightness(.9); opacity: .7; cursor: default; }

/* HUD */
#hud { position: absolute; inset: 0; pointer-events: none; }
#hud > * { pointer-events: auto; }
.hud-left { position: absolute; top: 12px; left: 12px; display: flex; gap: 12px; align-items: center; }
.badge { min-width: 64px; height: 64px; padding: 0 16px; display: flex; align-items: center; justify-content: center; gap: 6px; background: #fff; border-radius: 20px; font-size: 30px; color: #3b2a6b; box-shadow: 0 4px 10px rgba(0,0,0,.2); }
.progress { position: absolute; right: 51px; top: 12%; bottom: 150px; width: 34px; border-radius: 17px; background: rgba(255,255,255,.75); box-shadow: 0 4px 10px rgba(0,0,0,.2); }
.progress .fill { position: absolute; left: 0; right: 0; bottom: 0; height: 0; border-radius: 17px; background: linear-gradient(#ffd23f, #ff8a1f); transition: height .4s ease-out; }
.progress .goal { position: absolute; top: -34px; left: 50%; transform: translateX(-50%); font-size: 28px; }
.drop { position: absolute; right: 16px; bottom: 20px; width: 104px; height: 104px; font-size: 56px; border-radius: 30px; background: #ff5d8f; box-shadow: 0 8px 0 #b82a58, 0 10px 18px rgba(0,0,0,.3); }
.drop:active { transform: translateY(5px); }
.toast { position: absolute; left: 50%; top: 22%; transform: translateX(-50%); background: #fff; padding: 14px 28px; border-radius: 24px; font-size: 34px; box-shadow: 0 6px 16px rgba(0,0,0,.25); animation: pop .4s ease-out; pointer-events: none !important; }

/* Fenêtres */
#modal { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(40, 20, 90, .25); }
#modal .card { background: #fff; border-radius: 32px; padding: 28px 40px; text-align: center; box-shadow: 0 12px 30px rgba(0,0,0,.35); animation: pop .45s ease-out; }
#modal h2 { margin: 0 0 12px; font-size: 40px; }
#modal .stars-big { font-size: 64px; letter-spacing: 6px; }
#modal .stars-big span { display: inline-block; animation: pop .5s ease-out both; }
#modal .stars-big span:nth-child(2) { animation-delay: .25s; }
#modal .stars-big span:nth-child(3) { animation-delay: .5s; }
#modal .row { display: flex; gap: 20px; justify-content: center; margin-top: 18px; }
#modal .big { width: 120px; height: 96px; font-size: 52px; background: #2fcf5f; box-shadow: 0 6px 0 #1a8a3a; }
@keyframes pop { 0% { transform: translateX(var(--tx, 0)) scale(.3); opacity: 0; } 70% { transform: translateX(var(--tx, 0)) scale(1.12); opacity: 1; } 100% { transform: translateX(var(--tx, 0)) scale(1); } }
.toast { --tx: -50%; }
