/* As Advertised — styles */
* { margin: 0; padding: 0; box-sizing: border-box; user-select: none; -webkit-user-select: none; }
html, body { height: 100%; overflow: hidden; background: #05070c; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: #eef2ff;
}
button { font-family: inherit; cursor: pointer; border: none; }

/* La scène est dessinée en 960x600 puis mise à l'échelle par JS */
#stage {
  position: absolute; width: 960px; height: 600px;
  transform-origin: top left;
  left: 0; top: 0;
}
#game { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.hidden { display: none !important; }

/* ---------- Écrans plein cadre ---------- */
.screen {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; text-align: center;
  background: radial-gradient(ellipse at 50% 30%, rgba(12,16,28,.55), rgba(5,7,12,.88));
}

/* ---------- Logo ---------- */
.logo {
  font-size: 64px; font-weight: 900; letter-spacing: 2px; line-height: 1.05;
  display: flex; flex-direction: column; align-items: center; gap: 0;
}
.logo-as {
  font-size: 30px; letter-spacing: 14px; color: #ffd9a8; opacity: .95;
  text-shadow: 0 0 18px rgba(255,120,0,.55);
  padding-left: 14px; /* compense le letter-spacing */
}
.logo-main {
  background: linear-gradient(180deg, #ffcf72 0%, #ff8a1e 45%, #ff4d00 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 4px 22px rgba(255,90,0,.45));
}
.title-badge {
  font-size: 12px; letter-spacing: 3px; font-weight: 700;
  color: #9fb0d0; border: 1px solid #33405e; border-radius: 999px;
  padding: 5px 14px; background: rgba(12,17,30,.6);
}
.tagline {
  font-size: 18px; color: #b9c6e2; min-height: 24px; font-weight: 500;
  text-shadow: 0 1px 8px rgba(0,0,0,.6);
}
.footnote { font-size: 13px; color: #71809f; margin-top: 6px; }

/* ---------- Boutons ---------- */
.big-btn {
  font-size: 22px; font-weight: 800; letter-spacing: .5px;
  color: #23100a; padding: 14px 42px; border-radius: 14px;
  background: linear-gradient(180deg, #ffc257, #ff7a1a);
  box-shadow: 0 4px 0 #a13c00, 0 8px 24px rgba(255,110,0,.35);
  transition: transform .08s, filter .15s;
}
.big-btn:hover { filter: brightness(1.08); }
.big-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #a13c00; }
.small-btn {
  font-size: 15px; font-weight: 600; color: #cfd9f2;
  background: #182036; border: 1px solid #2c3a5c;
  padding: 9px 18px; border-radius: 999px;
  transition: background .15s, transform .08s;
}
.small-btn:hover { background: #1f2a47; }
.small-btn:active { transform: scale(.96); }
.menu { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-top: 8px; }
.menu-row { display: flex; gap: 10px; }

/* ---------- HUD ---------- */
#hud {
  position: absolute; top: 0; left: 0; right: 0; height: 52px;
  display: flex; align-items: center; gap: 12px; padding: 0 12px;
  background: linear-gradient(180deg, rgba(5,7,12,.85), rgba(5,7,12,0));
}
#hud-center { flex: 1; text-align: center; }
#hud-level { font-size: 17px; font-weight: 800; letter-spacing: .5px; }
#hud-objectives { font-size: 13px; color: #a8b4d0; margin-top: 1px; }
#hud-right { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 10px; font-size: 18px;
  background: #151d31; color: #e6ecff; border: 1px solid #26314f;
}
.icon-btn:hover { background: #1d2843; }
.icon-btn:active { transform: scale(.94); }
#lava-gauge {
  width: 90px; height: 14px; border-radius: 999px; overflow: hidden;
  background: #141a2c; border: 1px solid #2a3450;
}
#hud-moves {
  height: 28px; display: flex; align-items: center; padding: 0 12px;
  border-radius: 999px; background: #141a2c; border: 1px solid #2a3450;
  font-size: 13.5px; font-weight: 800; color: #ffd970;
}
#hud-moves.empty { color: #ff7a6a; border-color: #5c2a2a; }
#lava-gauge-fill {
  height: 100%; width: 100%;
  background: linear-gradient(90deg, #ff4d00, #ffb020);
  transition: width .2s;
}

/* ---------- Sélection des niveaux ---------- */
#levels-grid {
  display: grid; grid-template-columns: repeat(5, 128px);
  gap: 14px; margin: 10px 0; max-width: 760px;
}
.level-btn {
  height: 96px; border-radius: 16px; padding: 10px;
  background: #141b30; border: 2px solid #273354;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  transition: transform .1s, border-color .15s, background .15s;
}
.level-btn:hover { transform: translateY(-3px); border-color: #ff8a1e; background: #18213a; }
.level-btn .lv-num { font-size: 22px; font-weight: 900; color: #ffffff; }
.level-btn .lv-name { font-size: 11px; color: #93a2c4; line-height: 1.15; }
.level-btn .lv-stars { font-size: 13px; letter-spacing: 2px; color: #3a4a70; }
.level-btn .lv-stars .on { color: #ffc257; }
.level-btn .lv-icons { font-size: 11px; color: #9fb0d0; }

/* ---------- Cartes (victoire / défaite / intro) ---------- */
.overlay {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(4,6,10,.62); backdrop-filter: blur(3px);
}
.card {
  min-width: 420px; max-width: 560px; padding: 30px 36px 26px;
  background: #101627; border: 1px solid #2b3760;
  border-radius: 22px; text-align: center;
  box-shadow: 0 24px 80px rgba(0,0,0,.6), 0 0 0 6px rgba(255,120,0,.06);
  animation: card-in .28s cubic-bezier(.2,1.4,.4,1);
}
@keyframes card-in { from { transform: scale(.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.card h2 { font-size: 30px; font-weight: 900; margin: 6px 0 6px; }
.card-sub { font-size: 15px; color: #aab6d4; margin-bottom: 16px; }
.card-btns { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.big-emoji { font-size: 52px; line-height: 1; }

/* Étoiles */
.stars-big { font-size: 46px; letter-spacing: 10px; color: #313d61; }
.stars-big span { display: inline-block; transition: transform .25s; }
.stars-big span.on { color: #ffc257; text-shadow: 0 0 24px rgba(255,180,0,.55); animation: star-pop .4s cubic-bezier(.2,1.6,.4,1); }
@keyframes star-pop { 0% { transform: scale(.3) rotate(-30deg); } 100% { transform: scale(1) rotate(0); } }

/* Dots d'introduction */
.intro-dots { display: flex; gap: 8px; justify-content: center; margin: 4px 0 16px; }
.intro-dots span { width: 9px; height: 9px; border-radius: 50%; background: #2c3a5c; }
.intro-dots span.on { background: #ff8a1e; }

.hintline { font-size: 12.5px; color: #6d7c9e; margin-top: 12px; }

/* ---------- Toast ---------- */
#toast {  position: absolute; bottom: 26px; left: 50%; transform: translateX(-50%);
  background: rgba(16,22,39,.95); border: 1px solid #33405e; color: #dfe7ff;
  font-size: 15px; padding: 11px 22px; border-radius: 999px;
  box-shadow: 0 10px 30px rgba(0,0,0,.5);
  animation: toast-in .25s ease;
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ---------- Vague 3 : chrono, bannière, badges ---------- */
#hud-time {
  height: 28px; display: flex; align-items: center; justify-content: center;
  padding: 0 12px; min-width: 76px;
  border-radius: 999px; background: #141a2c; border: 1px solid #2a3450;
  font-size: 13.5px; font-weight: 800; color: #9fd4ff;
  font-variant-numeric: tabular-nums;
}
#levels-total {
  font-size: 14px; font-weight: 700; letter-spacing: .4px; color: #ffd970;
  margin-top: -6px;
}
#levels-title { font-size: 30px; font-weight: 900; }

.level-btn { position: relative; }
.level-btn .lv-badge {
  position: absolute; top: -8px; right: -8px;
  font-size: 10px; font-weight: 900; letter-spacing: 1.2px; color: #06281a;
  background: linear-gradient(180deg, #8affc2, #1fd57a);
  padding: 3px 8px; border-radius: 999px;
  box-shadow: 0 3px 12px rgba(60,255,160,.4);
  animation: badge-bob 1.6s ease-in-out infinite;
}
@keyframes badge-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
.level-btn.is-new { border-color: #2f8f5f; }
.level-btn.is-new:hover { border-color: #5cffb0; }

#level-banner {
  position: absolute; left: 50%; top: 76px; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 0;
  pointer-events: none; opacity: 0; z-index: 5;
}
#level-banner.show { animation: banner-pop 2s cubic-bezier(.2,1.2,.3,1) forwards; }
@keyframes banner-pop {
  0% { opacity: 0; transform: translateX(-50%) scale(.72) translateY(-12px); }
  12% { opacity: 1; transform: translateX(-50%) scale(1.07) translateY(0); }
  22% { transform: translateX(-50%) scale(1); }
  78% { opacity: 1; transform: translateX(-50%) scale(1); }
  100% { opacity: 0; transform: translateX(-50%) scale(1.03) translateY(-10px); }
}
#lb-num {
  font-size: 15px; font-weight: 900; letter-spacing: 7px; color: #ffd970;
  text-shadow: 0 0 18px rgba(255,150,0,.65); padding-left: 7px;
}
#lb-name {
  font-size: 32px; font-weight: 900; color: #fff;
  text-shadow: 0 4px 24px rgba(0,0,0,.85), 0 0 40px rgba(255,120,20,.3);
}

#win-time { color: #ffd970; font-weight: 800; }
#overlay-win .card {
  box-shadow: 0 24px 80px rgba(0,0,0,.6), 0 0 0 6px rgba(255,180,60,.10), 0 0 70px rgba(255,140,20,.2);
}
.card { background: linear-gradient(180deg, #141b31, #0e1424); }
#btn-play { animation: play-pulse 2.4s ease-in-out infinite; }
@keyframes play-pulse {
  0%, 100% { box-shadow: 0 4px 0 #a13c00, 0 8px 24px rgba(255,110,0,.35); }
  50% { box-shadow: 0 4px 0 #a13c00, 0 12px 38px rgba(255,150,30,.65); }
}
