/* Écran d'énigme, clavier de chiffres, victoire */
#screen-ex { background: linear-gradient(#fff 0, #fff 55%, var(--epl-bg) 100%); }
.ex-head {
  flex: none; display: flex; align-items: center; gap: 8px; margin: max(8px, env(safe-area-inset-top)) 10px 0;
  padding: 5px 8px 5px 5px; border-radius: 34px; background: var(--epl-c); color: #fff;
}
.ex-head .btn-round { width: 46px; height: 46px; }
.ex-num { width: 46px; height: 46px; border-radius: 50%; background: #fff; color: var(--epl-c); font: 700 24px/46px var(--epl-title); text-align: center; flex: none; }
.ex-level { flex: 1; display: flex; justify-content: center; }
.ex-level span { display: flex; gap: 2px; padding: 4px 10px; border-radius: 20px; background: #fff; }
.ex-level svg { width: 24px; height: 24px; }
.ex-instr { flex: none; display: flex; align-items: center; gap: 8px; margin: 8px 12px 2px; min-height: 56px; }
.ex-icons { display: flex; gap: 2px; flex: none; }
.ex-icons svg { width: 38px; height: 38px; }
.ex-text { flex: 1; margin: 0; font: 700 clamp(17px, 4.6vw, 22px)/1.2 var(--epl-body); }
.ex-instr .btn-round { width: 46px; height: 46px; }
.ex-stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; overflow-y: auto; padding: 0 12px; }
.ex-fig { width: 100%; height: 100%; max-height: 100%; touch-action: none; }
.ex-toast { flex: none; min-height: 28px; margin: 0; text-align: center; font: 600 19px var(--epl-title); color: var(--epl-c); padding: 0 12px; }
.ex-toast.bad { color: var(--epl-bad); }
.ex-bar { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 12px max(12px, env(safe-area-inset-bottom)); }
.ex-bar .btn-round { color: var(--epl-c); width: 46px; height: 46px; }
.btn-check {
  flex: 1; min-width: 0; max-width: 220px; min-height: 58px; border-radius: 30px; background: var(--epl-ok); color: #fff;
  font: 700 22px var(--epl-title); white-space: nowrap; display: flex; align-items: center; justify-content: center; gap: 6px;
  box-shadow: 0 5px 0 #2a7a4c, var(--epl-shadow);
}
.btn-check svg { width: 26px; height: 26px; flex: none; }
.btn-check:active { transform: translateY(3px); box-shadow: 0 2px 0 #2a7a4c; }
.btn-check.np-away { visibility: hidden; }
.btn-check.nudge { animation: epl-bounce .6s; }

/* Éléments dessinés dans la figure */
.fig-hit { fill: transparent; cursor: pointer; }
.fig-sel { fill: color-mix(in srgb, var(--epl-c) 16%, transparent); stroke: var(--epl-c); stroke-width: 5; stroke-dasharray: 10 7; }
.fig-box-on { stroke: var(--epl-c) !important; stroke-width: 5 !important; animation: epl-pulse 1.1s infinite; }
.fig-bad { stroke: var(--epl-bad) !important; stroke-width: 5 !important; fill: #ffe3e7 !important; }
.fig-good { stroke: var(--epl-ok) !important; stroke-width: 5 !important; fill: #e2f7e9 !important; }
.fig-num { font-family: var(--epl-title); font-weight: 700; fill: var(--epl-ink); text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.fig-line { stroke: var(--epl-c); stroke-width: 7; stroke-linecap: round; fill: none; pointer-events: none; }
.fig-ring { fill: none; stroke: var(--epl-gold); stroke-width: 6; }
.fig-shake { animation: epl-shake .4s; }
.fig-doodle { stroke: #e94f64; stroke-width: 6; stroke-linecap: round; stroke-linejoin: round; fill: none; }

/* Clavier de chiffres : volet bas, ne masque pas la figure (la scène défile) */
.numpad {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 20; padding: 8px;
  background: #fff; border-radius: 22px; margin: 0 8px; box-shadow: 0 -4px 24px rgba(30,20,60,.3);
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; animation: epl-slide .22s ease;
}
@keyframes epl-slide { from { transform: translateY(100%); } }
.numpad button { min-height: 56px; border-radius: 16px; background: #f2eefc; color: var(--epl-c); font: 700 30px var(--epl-title); box-shadow: 0 3px 0 #cfc8e6; }
.numpad button:active { transform: translateY(2px); box-shadow: 0 1px 0 #cfc8e6; }
.numpad .np-del { grid-column: span 2; }
.numpad .np-ok { grid-column: span 3; background: var(--epl-ok); color: #fff; box-shadow: 0 3px 0 #2a7a4c; display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 24px; }
.numpad .np-del { display: grid; place-items: center; }
.ex-stage.np-fit { overflow: hidden; }
.ex-stage.np-open { align-items: flex-start; }
.ex-stage.np-open .ex-fig { height: auto; width: min(100%, 420px); aspect-ratio: 470 / 630; max-height: none; flex: none; }
.numpad svg { width: 28px; height: 28px; fill: none; }

/* Écrans bas (téléphone couché) : clavier sur une seule ligne pour laisser voir la question et la figure */
@media (max-height: 520px) {
  .numpad { grid-template-columns: repeat(14, 1fr); gap: 5px; padding: 6px; }
  .numpad button { min-height: 44px; font-size: 24px; }
  .numpad .np-del, .numpad .np-ok { grid-column: span 2; }
  .numpad .np-ok { font-size: 20px; }
}

/* Victoire */
.win-star { width: 120px; height: 120px; margin: 0 auto; animation: epl-bounce 1s; }
.win-msg { font: 600 22px var(--epl-title); color: var(--epl-ink); margin: 4px 0 0; }
.confetti { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.confetti i { position: absolute; top: -20px; width: 12px; height: 18px; border-radius: 3px; animation: epl-fall linear forwards; }
@keyframes epl-fall { to { transform: translateY(110vh) rotate(720deg); } }

.help-picto { display: grid; grid-template-columns: 52px 1fr; gap: 6px 12px; align-items: center; text-align: left; margin: 12px 0; }
.help-picto svg { width: 46px; height: 46px; }
.help-hint { background: #fff8e1; border: 3px dashed var(--epl-gold); border-radius: 18px; padding: 10px 12px; margin-top: 12px; font-weight: 700; }
@media (max-height: 560px) {
  .ex-icons svg { width: 30px; height: 30px; } .ex-instr { min-height: 44px; }
  .btn-check { min-height: 50px; } .ex-bar .btn-round { width: 46px; height: 46px; }
}
