/* Les énigmes de Papy-Lou — base : polices, tokens, boutons, fenêtres */
@font-face { font-family: 'Andika'; font-weight: 400; font-display: swap; src: url(fonts/Andika-400.woff2) format('woff2'); }
@font-face { font-family: 'Andika'; font-weight: 700; font-display: swap; src: url(fonts/Andika-700.woff2) format('woff2'); }
@font-face { font-family: 'Fredoka'; font-weight: 400 500; font-display: swap; src: url(fonts/Fredoka-400-500.woff2) format('woff2'); }
@font-face { font-family: 'Fredoka'; font-weight: 600; font-display: swap; src: url(fonts/Fredoka-600.woff2) format('woff2'); }
@font-face { font-family: 'Fredoka'; font-weight: 700; font-display: swap; src: url(fonts/Fredoka-700.woff2) format('woff2'); }

:root {
  --epl-ink:     #2f2a3a;
  --epl-muted:   #6b6480;
  --epl-sky:     #152050;
  --epl-sky-2:   #3b4fa0;
  --epl-gold:    #ffc93c;
  --epl-gold-d:  #e39b00;
  --epl-ok:      #3fa66b;
  --epl-bad:     #e94f64;
  --epl-c:       #2b3a7a;  /* couleur du chapitre courant */
  --epl-bg:      #e9ecfa;
  --epl-radius:  18px;
  --epl-shadow:  0 4px 14px rgba(30, 20, 60, .22);
  --epl-ease:    .2s ease;
  --epl-title:   'Fredoka', 'Andika', 'Trebuchet MS', system-ui, sans-serif;
  --epl-body:    'Andika', 'Trebuchet MS', 'Segoe UI', system-ui, sans-serif;
}

body.app-bare { margin: 0; overflow: hidden; background: var(--epl-sky); overscroll-behavior: none; }
.app-bare-main { margin: 0; padding: 0; max-width: none; }

.epl, .epl * {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none; user-select: none;
  touch-action: manipulation;
}
.epl {
  position: fixed; inset: 0; height: 100dvh;
  font-family: var(--epl-body); color: var(--epl-ink);
  font-size: 18px; line-height: 1.3; overflow: hidden;
}
.epl [hidden] { display: none !important; }
.epl svg { display: block; }
:where(.epl) button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; padding: 0; }
.epl :focus-visible { outline: 3px solid var(--epl-gold); outline-offset: 2px; }

.screen { position: absolute; inset: 0; display: flex; flex-direction: column; }

/* Boutons ronds (≥ 48 px : doigt d'enfant) */
.btn-round {
  width: 52px; height: 52px; flex: none; border-radius: 50%;
  background: #fff; color: var(--epl-c); box-shadow: var(--epl-shadow);
  display: grid; place-items: center; transition: transform var(--epl-ease);
}
.btn-round svg { width: 26px; height: 26px; fill: none; }
.btn-round:active { transform: scale(.92); }
.btn-ghost { background: rgba(255,255,255,.9); }
.btn-round[aria-pressed="true"].is-active, .btn-round.is-active { background: var(--epl-c); color: #fff; }
.btn-round[disabled] { opacity: .35; }

.btn-big {
  min-height: 60px; padding: 0 28px; border-radius: 30px;
  font: 700 22px var(--epl-title); background: var(--epl-gold); color: #4a3200;
  box-shadow: 0 5px 0 var(--epl-gold-d), var(--epl-shadow);
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
}
.btn-big:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--epl-gold-d); }
.btn-big.secondary { background: #fff; color: var(--epl-c); box-shadow: 0 5px 0 #cfc8e6, var(--epl-shadow); }
.btn-big.danger { background: var(--epl-bad); color: #fff; box-shadow: 0 5px 0 #a8304e, var(--epl-shadow); }
.btn-big svg { width: 28px; height: 28px; }

/* Fenêtres */
.overlay {
  position: absolute; inset: 0; z-index: 50; display: grid; place-items: center;
  padding: 16px; background: rgba(21, 32, 80, .72); backdrop-filter: blur(3px);
  overflow-y: auto; animation: epl-fade .2s ease;
}
.sheet {
  width: min(100%, 460px); max-height: 100%; overflow-y: auto;
  background: #fff; border-radius: 26px; padding: 22px 20px 20px;
  box-shadow: 0 10px 40px rgba(0,0,0,.35); text-align: center;
  animation: epl-pop .28s cubic-bezier(.2,1.4,.4,1);
  user-select: text; -webkit-user-select: text;
}
.sheet h2 { margin: 6px 0 10px; font: 700 28px/1.1 var(--epl-title); color: var(--epl-c); }
.sheet p { margin: 8px 0; }
.sheet .row { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-top: 16px; }
.sheet .small { font-size: 15px; color: var(--epl-muted); }
.sheet a { color: var(--epl-c); font-weight: 700; }

@keyframes epl-fade { from { opacity: 0; } }
@keyframes epl-pop { from { transform: scale(.85); opacity: 0; } }
@keyframes epl-shake { 20%, 60% { transform: translateX(-7px); } 40%, 80% { transform: translateX(7px); } }
@keyframes epl-pulse { 50% { opacity: .45; } }
@keyframes epl-bounce { 40% { transform: translateY(-14px); } 70% { transform: translateY(0); } 85% { transform: translateY(-5px); } }
@media (prefers-reduced-motion: reduce) { .epl * { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

/* Appui long (porte d'adulte) */
.epl .hold { position: relative; isolation: isolate; overflow: hidden; }
.epl .hold::before { content: ''; position: absolute; inset: 0; z-index: -1; border-radius: inherit; pointer-events: none;
  background: conic-gradient(rgba(255, 201, 60, .95) calc(var(--p, 0) * 1turn), transparent 0); }
.epl .btn-big.hold::before { background: linear-gradient(90deg, rgba(0, 0, 0, .2) calc(var(--p, 0) * 100%), transparent 0); }
