:root {
  --bar: 76px;
  --tools: 0px;
  --ink: #2d2a4a;
  --bg: #fff6e0;
}
* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
html, body { margin: 0; height: 100%; }
body {
  font-family: 'Baloo 2', 'Chalkboard SE', 'Comic Sans MS', system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
  overscroll-behavior: none;
}
body.game { overflow: hidden; touch-action: none; position: fixed; inset: 0; }
body.with-tools { --tools: 96px; }

/* Barre du haut */
.bar {
  position: fixed; top: 0; left: 0; right: 0; height: var(--bar);
  padding: 8px max(12px, env(safe-area-inset-right)) 8px max(12px, env(safe-area-inset-left));
  display: flex; align-items: center; gap: 10px;
  background: #fff; box-shadow: 0 3px 0 rgba(45, 42, 74, .08); z-index: 10;
}
.bar .title {
  font-size: 28px; font-weight: 800; flex: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: center;
}

/* Gros boutons */
.btn {
  appearance: none; -webkit-appearance: none; border: 0;
  background: #ffe08a; color: inherit; text-decoration: none; font-family: inherit;
  border-radius: 18px; min-width: 58px; height: 58px; padding: 0 10px;
  font-size: 30px; font-weight: 800;
  display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
  box-shadow: 0 5px 0 #e0b84a; cursor: pointer; transition: transform .08s, box-shadow .08s;
}
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 #e0b84a; }
.btn.home { background: #a0e7a0; box-shadow: 0 5px 0 #6cbf6c; }
.btn.home:active { box-shadow: 0 1px 0 #6cbf6c; }
.btn.on { background: #bde0fe; box-shadow: 0 5px 0 #7fb4e6; }
.btn.warn { background: #ffadad; box-shadow: 0 5px 0 #e07a7a; }

/* Zone de jeu */
.game main { position: absolute; top: var(--bar); bottom: var(--tools); left: 0; right: 0; overflow: hidden; }

/* Barre d'outils du bas */
.tools {
  position: fixed; left: 0; right: 0; bottom: 0; height: var(--tools);
  background: #fff; display: flex; align-items: center; gap: 12px; padding: 0 14px;
  overflow-x: auto; overflow-y: hidden; touch-action: pan-x;
  box-shadow: 0 -3px 0 rgba(45, 42, 74, .08); z-index: 10; scrollbar-width: none;
}
.tools::-webkit-scrollbar { display: none; }
.swatch {
  flex: 0 0 auto; width: 56px; height: 56px; border-radius: 50%;
  border: 4px solid #fff; box-shadow: 0 0 0 3px rgba(0, 0, 0, .12);
  background: var(--c); cursor: pointer; transition: transform .12s;
}
.swatch.on { transform: scale(1.18); box-shadow: 0 0 0 4px var(--ink); }
.sep { flex: 0 0 3px; height: 50px; background: #eee; border-radius: 2px; }

/* Message "Bravo" */
.bravo {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%) scale(.3);
  background: #fff; border-radius: 40px; padding: 20px 44px; text-align: center;
  font-size: 54px; font-weight: 800; box-shadow: 0 10px 0 rgba(0, 0, 0, .12);
  z-index: 1000; opacity: 0; pointer-events: none; max-width: 92vw;
  transition: transform .35s cubic-bezier(.3, 1.6, .5, 1), opacity .2s;
}
.bravo.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.bravo .big { font-size: 120px; line-height: 1.15; }
.confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 999; }

@keyframes pulse { 50% { transform: scale(1.15); } }
.pulse { animation: pulse .8s ease-in-out infinite; }
@keyframes wobble { 25% { transform: rotate(-12deg); } 75% { transform: rotate(12deg); } }
.wobble { animation: wobble .3s ease-in-out infinite; }

@media (max-width: 520px) {
  :root { --bar: 66px; }
  .btn { min-width: 50px; height: 50px; font-size: 26px; }
  .bar .title { font-size: 22px; }
}
