/* Piégé ! — palette Éclat provisoire (revue à l'étape 4b). Mobile d'abord. */
:root {
  --bg: #16132e;
  --bg2: #241f4a;
  --ink: #fff8ec;
  --muted: #b9b3d9;
  --accent: #ffd23f;
  /* Le vert est clair, le rouge foncé : ils diffèrent aussi en luminosité. */
  --go: #2fd66b;
  --go-ink: #0b2a16;
  --stop: #c81d32;
  --warn: #ffc61a;
  --idle: #4a4570;
  --font: 'Fredoka', system-ui, sans-serif;
}
/* Mode daltonien : vert → bleu, rouge → orange. */
.cb {
  --go: #2f7dff;
  --go-ink: #fff;
  --stop: #ff8a1f;
  --warn: #f2f2f2;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: radial-gradient(120% 80% at 50% 0%, var(--bg2), var(--bg) 70%) fixed, var(--bg);
  color: var(--ink);
  font-family: var(--font);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  overflow: hidden;
}
button { font: inherit; color: inherit; cursor: pointer; }
#app {
  position: relative;
  height: 100dvh;
  max-width: 520px;
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) 16px max(28px, env(safe-area-inset-bottom));
}

.screen {
  position: absolute;
  inset: 0;
  padding: inherit;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  text-align: center;
}
.screen[data-active] { display: flex; }

.logo {
  margin: 0;
  font-size: clamp(56px, 17vw, 92px);
  font-weight: 700;
  letter-spacing: -1px;
  color: var(--accent);
  transform: rotate(-4deg);
  text-shadow: 0 6px 0 rgba(0, 0, 0, .35);
}
.sub { margin: 0; color: var(--muted); font-size: 18px; }
.sub b { color: var(--accent); }
.rule { margin: 0; font-size: 20px; }
.c-go { color: var(--go); }

/* Gros bouton rond */
.big-btn {
  width: min(72vw, 330px);
  aspect-ratio: 1;
  border-radius: 50%;
  border: 0;
  display: grid;
  place-items: center;
  font-size: clamp(30px, 9vw, 44px);
  font-weight: 700;
  line-height: 1.05;
  color: #fff;
  box-shadow: 0 12px 0 rgba(0, 0, 0, .35), inset 0 -10px 0 rgba(0, 0, 0, .18);
  transition: transform .06s;
}
.big-btn.press { transform: translateY(6px) scale(.97); }
.look-go { background: var(--go); color: var(--go-ink); }
.look-stop { background: var(--stop); }
.look-warn { background: var(--warn); color: #3a2a00; }
.look-idle { background: var(--idle); color: var(--muted); }
.ink-go { color: var(--go); }
#start { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.04); } }

/* Jeu */
#play { justify-content: flex-start; padding-top: max(16px, env(safe-area-inset-top)); }
.hud { width: 100%; display: flex; align-items: center; gap: 12px; }
.timebar { flex: 1; height: 14px; border-radius: 7px; background: rgba(255, 255, 255, .12); overflow: hidden; }
.timebar i { display: block; height: 100%; background: var(--accent); transform-origin: left; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 50%; border: 0;
  background: rgba(255, 255, 255, .12); font-weight: 700; font-size: 16px;
}
.score { font-size: clamp(96px, 30vw, 150px); font-weight: 700; line-height: 1; margin-top: 8px; font-variant-numeric: tabular-nums; }
.zone { position: relative; flex: 1; width: 100%; display: grid; place-items: center; }
.zone .big-btn { width: min(80vw, 380px); }
.pop {
  position: absolute; top: 4%; left: 0; right: 0;
  font-size: 34px; font-weight: 700; pointer-events: none; opacity: 0;
}
.pop.show { animation: pop .7s ease-out; }
.pop.good { color: var(--accent); }
.pop.bad { color: #ff9aa5; }
@keyframes pop {
  0% { opacity: 0; transform: translateY(14px) scale(.8); }
  15% { opacity: 1; transform: translateY(0) scale(1.1); }
  100% { opacity: 0; transform: translateY(-30px) scale(1); }
}
.trap {
  position: fixed; inset: 0; display: none; z-index: 5;
  flex-direction: column; align-items: center; justify-content: center;
  background: rgba(200, 29, 50, .92); pointer-events: none;
}
.cb .trap { background: rgba(230, 110, 10, .94); }
.trap.show { display: flex; animation: shake .45s; }
.trap b { font-size: clamp(64px, 20vw, 110px); transform: rotate(-6deg); }
.trap span { font-size: 48px; font-weight: 700; }
@keyframes shake {
  20% { transform: translateX(-14px); } 40% { transform: translateX(12px); }
  60% { transform: translateX(-8px); } 80% { transform: translateX(5px); }
}

/* Fin */
.end-score { font-size: clamp(110px, 34vw, 170px); font-weight: 700; line-height: .9; }
.pts { margin: -10px 0 0; color: var(--muted); font-size: 20px; }
.tier {
  margin: 4px 0 0; padding: 8px 20px; border-radius: 999px;
  background: var(--accent); color: #2a1d00; font-size: 26px; font-weight: 700;
}
.record { margin: 0; color: var(--accent); font-size: 24px; font-weight: 700; animation: pulse 1s infinite; }
.stats, .best, .challenge { margin: 0; color: var(--muted); font-size: 16px; }
.challenge { color: var(--ink); font-size: 20px; font-weight: 600; }
.cta {
  min-width: 220px; padding: 16px 28px; border: 0; border-radius: 999px;
  background: var(--accent); color: #2a1d00; font-size: 26px; font-weight: 700;
  box-shadow: 0 6px 0 rgba(0, 0, 0, .35);
}
.cta:active { transform: translateY(3px); box-shadow: 0 3px 0 rgba(0, 0, 0, .35); }
.cta:disabled { opacity: .5; }
.cta.ghost { min-width: 0; flex: 1; background: rgba(255, 255, 255, .12); color: var(--ink); font-size: 20px; padding: 13px 18px; }
.row { display: flex; gap: 12px; width: min(100%, 340px); }

/* Réglages */
.settings { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 6px; }
.settings button {
  border: 1px solid rgba(255, 255, 255, .2); background: transparent; border-radius: 999px;
  padding: 7px 13px; font-size: 14px; color: var(--muted);
}
.settings button[aria-pressed="true"] { color: var(--ink); border-color: var(--accent); }
h2 { margin: 0; font-size: 48px; }

.toast {
  position: fixed; left: 50%; bottom: 60px; transform: translateX(-50%);
  background: #000c; padding: 10px 18px; border-radius: 999px; font-size: 16px;
  opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 9;
}
.toast.show { opacity: 1; }
.foot {
  position: fixed; bottom: max(6px, env(safe-area-inset-bottom)); left: 0; right: 0;
  text-align: center; font-size: 12px; color: var(--muted); opacity: .7;
}
body.playing .foot { display: none; }
/* ?clip=1 : écran propre pour filmer */
.clip [data-noclip] { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  #start, .record { animation: none; }
  .trap.show { animation: none; }
}
