/* Pétard — table du jeu de mots, plus le catalogue de jeux de l'accueil.
   IDEA    un ticket de papier posé sur la table en noyer, la syllabe en grand, et un pétard
           dont la mèche crépite à côté. Téléphone d'abord : tout tient au-dessus du clavier. */

/* ---------- accueil : catalogue des jeux */
.games { display: grid; gap: 12px; margin: 18px 0 4px; }
.games .game-tile { margin: 0; grid-template-columns: 112px minmax(0, 1fr); row-gap: 12px; }
.game-tile > .btn { grid-column: 1 / -1; width: 100%; min-height: 48px; font-size: 16px; }
.tile-art { display: grid; place-items: center; }
.tile-art .mini-fan { padding-left: 32px; }
.pt-tile-art { position: relative; width: 96px; height: 86px; display: grid; place-items: center; }
.pt-tile-art .pt-cracker { width: 58px; translate: 10px 0; }
.pt-tile-syl {
  position: absolute; left: 0; bottom: 8px; padding: 2px 8px; border-radius: 8px; rotate: -7deg;
  background: #fff; color: var(--ink); font: 700 17px/1.2 var(--display); letter-spacing: .06em;
  box-shadow: 0 2px 0 var(--line), 0 4px 10px rgba(0, 0, 0, .12);
}

/* ---------- la table (suit la zone visible, clavier compris) */
.pt-screen {
  position: fixed; left: 0; right: 0; top: var(--vvt, 0px); height: var(--vvh, 100dvh);
  display: grid; grid-template-rows: auto minmax(0, 1fr); overflow: hidden;
}
.pt-table {
  position: relative; width: min(100%, 1120px); margin: 0 auto; min-height: 0;
  display: grid; grid-template-rows: auto minmax(0, 1fr) auto auto auto auto; row-gap: 6px;
  padding: 8px max(12px, env(safe-area-inset-left)) max(10px, env(safe-area-inset-bottom));
}

/* joueurs */
.pt-players {
  position: relative; list-style: none; margin: 0; padding: 2px 2px 4px;
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none;
}
.pt-players::-webkit-scrollbar { display: none; }
.pt-p {
  flex: none; width: 100px; display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 7px; align-items: center;
  padding: 6px 8px 5px; border-radius: 14px; background: rgba(0, 0, 0, .24); border: 2px solid transparent;
  transition: background .2s, border-color .2s, opacity .2s;
}
.pt-p .avatar { grid-row: span 2; width: 30px; height: 30px; font-size: 12px; box-shadow: 0 0 0 2px rgba(255, 255, 255, .7); }
.pt-pn { font: 600 14px/1.15 var(--display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pt-p.me .pt-pn { color: var(--k-safran); }
.pt-hearts { display: flex; gap: 2px; height: 14px; }
.pt-hearts svg { width: 13px; height: 13px; flex: none; }
.pt-hearts svg.on { fill: var(--k-corail); }
.pt-hearts svg.off { fill: none; stroke: rgba(255, 255, 255, .4); stroke-width: 2.2; }
.pt-prog { grid-column: 1 / -1; height: 4px; margin-top: 6px; border-radius: 99px; background: rgba(255, 255, 255, .14); overflow: hidden; }
.pt-prog i { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--k-safran); transition: width .3s; }
.pt-last {
  grid-column: 1 / -1; min-height: 1.35em; margin-top: 2px; font-size: 12px; font-weight: 800; line-height: 1.35;
  color: var(--on-wood-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-transform: lowercase;
}
.pt-p.turn { border-color: var(--k-safran); background: rgba(245, 179, 26, .17); }
.pt-p.turn .avatar { box-shadow: 0 0 0 2px var(--k-safran); }
.pt-p.off { opacity: .6; }
.pt-p.out { opacity: .4; filter: grayscale(.85); }
.pt-p.out .pt-last::before { content: "éliminé·e"; text-transform: none; }
.pt-p.out .pt-last { font-size: 0; }
.pt-p.out .pt-last::before { font-size: 12px; }
.pt-p.win { border-color: var(--k-lagon); }

/* centre : ticket + pétard */
.watching .pt-letters { opacity: .55; }
.pt-stage { position: relative; display: grid; place-items: center; min-height: 0; }
.pt-center { display: flex; align-items: center; justify-content: center; filter: drop-shadow(0 14px 22px rgba(0, 0, 0, .38)); }
.pt-ticket {
  position: relative; min-width: 200px; padding: 12px 26px 14px; text-align: center; rotate: -1.5deg;
  background: var(--paper); color: var(--ink); border-radius: 20px;
  /* encoches de ticket sur les côtés */
  -webkit-mask: radial-gradient(circle 10px at 0 50%, transparent 96%, #000) left / 51% 100% no-repeat,
    radial-gradient(circle 10px at 100% 50%, transparent 96%, #000) right / 51% 100% no-repeat;
  mask: radial-gradient(circle 10px at 0 50%, transparent 96%, #000) left / 51% 100% no-repeat,
    radial-gradient(circle 10px at 100% 50%, transparent 96%, #000) right / 51% 100% no-repeat;
}
.pt-turn { margin: 0; min-height: 1.4em; font: 800 15px/1.4 Nunito, system-ui, sans-serif; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 62vw; }
.my-turn .pt-turn { color: var(--k-corail); }
.pt-syl { margin: 0; font: 700 clamp(68px, 21vw, 132px)/1 var(--display); letter-spacing: .06em; padding-left: .06em; min-height: 1em; }
.pt-hint { margin: 4px 0 0; font-size: 13px; font-weight: 700; color: var(--ink-2); }
.pt-ticket.pop { animation: pt-pop .34s cubic-bezier(.2, .9, .3, 1.35); }
@keyframes pt-pop { from { transform: scale(.82) rotate(-4deg); opacity: .4; } }

.pt-stage .pt-cracker { width: clamp(80px, 23vw, 150px); margin: 0 0 0 -16px; align-self: flex-end; overflow: visible; }
.pt-spark { transform-box: fill-box; transform-origin: center; animation: pt-spark var(--spark, .5s) ease-in-out infinite alternate; }
.pt-glow { animation: pt-glow calc(var(--spark, .5s) * 2.4) ease-in-out infinite alternate; transform-box: fill-box; transform-origin: center; }
.pt-ember { animation: pt-ember calc(var(--spark, .5s) * 2) ease-out infinite; transform-box: fill-box; opacity: 0; }
.pt-ember.e2 { --dx: -11px; --dy: -9px; animation-delay: calc(var(--spark, .5s) * -.7); }
.pt-ember.e3 { --dx: 3px; --dy: -15px; animation-delay: calc(var(--spark, .5s) * -1.3); }
[data-heat="1"] { --spark: .38s; }
[data-heat="2"] { --spark: .28s; }
[data-heat="3"] { --spark: .2s; }
@keyframes pt-spark { from { transform: scale(.78) rotate(-8deg); } to { transform: scale(1.12) rotate(14deg); } }
@keyframes pt-glow { from { transform: scale(.8); opacity: .25; } to { transform: scale(1.35); opacity: .55; } }
@keyframes pt-ember { 0% { opacity: 1; transform: translate(0, 0); } 100% { opacity: 0; transform: translate(var(--dx, 12px), var(--dy, -6px)); } }
.over .pt-spark, .over .pt-ember, .over .pt-glow { visibility: hidden; }
.pt-cracker.burst { animation: pt-burst .5s cubic-bezier(.2, .9, .3, 1.2); }
@keyframes pt-burst { 30% { transform: scale(1.25) rotate(8deg); } }

.pt-banner { /* par-dessus la rangée des joueurs : la nouvelle syllabe reste lisible */
  position: absolute; left: 12px; right: 12px; top: 6px; z-index: 3; width: fit-content; margin: 0 auto;
  padding: 10px 18px; border-radius: 16px; rotate: -3deg; text-align: center;
  background: var(--k-corail); color: #fff; font: 700 clamp(20px, 6vw, 30px)/1.15 var(--display);
  box-shadow: 0 4px 0 #b63c3c, 0 18px 40px rgba(0, 0, 0, .4);
}
.pt-banner.bonus { background: var(--k-lagon); box-shadow: 0 4px 0 #0c7a71, 0 18px 40px rgba(0, 0, 0, .4); }
.pt-banner.show { animation: pt-stamp .32s cubic-bezier(.2, .9, .3, 1.4); }
@keyframes pt-stamp { from { scale: 1.6; opacity: 0; } }
.pt-stage.quake { animation: pt-quake .45s; }
@keyframes pt-quake { 20% { transform: translate(-7px, 2px); } 40% { transform: translate(6px, -3px); } 60% { transform: translate(-4px, 1px); } 80% { transform: translate(2px, 0); } }
.pt-flash {
  position: fixed; inset: 0; z-index: 15; pointer-events: none; opacity: 0;
  background: radial-gradient(circle at 50% 40%, rgba(255, 238, 190, .95), rgba(239, 91, 91, .6) 35%, rgba(239, 91, 91, 0) 75%);
}
.pt-flash.on { animation: pt-flash .6s ease-out; }
@keyframes pt-flash { 0% { opacity: 0; } 12% { opacity: 1; } 100% { opacity: 0; } }

/* saisie */
.pt-entry { position: relative; width: min(100%, 560px); justify-self: center; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.pt-entry.solo { grid-template-columns: minmax(0, 1fr); }
.pt-field { position: relative; min-height: 54px; border-radius: 14px; }
.pt-input {
  height: 54px; padding: 0 16px; border-width: 3px; border-radius: 14px;
  font: 700 21px var(--display); letter-spacing: .05em; text-transform: uppercase;
}
.pt-input::placeholder { text-transform: none; letter-spacing: 0; font: 700 16px Nunito, system-ui, sans-serif; color: #a8968a; }
.pt-input:focus { border-color: var(--k-safran); }
.pt-field.has-syl .pt-input { border-color: var(--k-lagon); box-shadow: 0 0 0 3px rgba(19, 163, 152, .3); }
.pt-field.bad .pt-input { border-color: var(--k-corail); }
.pt-field.shake { animation: pt-shake .38s; }
@keyframes pt-shake { 20%, 60% { transform: translateX(-7px); } 40%, 80% { transform: translateX(7px); } }
.pt-field.good .pt-input, .pt-field.good .pt-live { animation: pt-good .7s ease-out; }
@keyframes pt-good { 0%, 30% { background: #d8f5ec; border-color: var(--k-lagon); } }
.pt-send { min-height: 54px; padding: 0 20px; font-size: 16px; border-radius: 14px; }
.pt-send:disabled { opacity: .35; }

/* frappe en direct du joueur actif (par-dessus le champ, qui garde le focus) */
.pt-live {
  position: absolute; inset: 0; margin: 0; display: none; align-items: center; gap: 8px; padding: 0 16px;
  border-radius: 14px; background: rgba(0, 0, 0, .26); border: 2px dashed rgba(255, 255, 255, .26);
  pointer-events: none; white-space: nowrap; overflow: hidden;
}
.pt-field.live-on .pt-live { display: flex; }
.pt-field.live-on .pt-input { opacity: 0; }
.pt-field.live-on:focus-within .pt-live { border-color: var(--k-safran); border-style: solid; }
.pt-live-who { flex: none; max-width: 40%; overflow: hidden; text-overflow: ellipsis; font: 800 14px Nunito, system-ui, sans-serif; color: var(--on-wood-2); }
.pt-live-text { overflow: hidden; text-overflow: ellipsis; font: 700 21px var(--display); letter-spacing: .05em; text-transform: uppercase; color: var(--on-wood); }
.pt-live-text.empty { font: 700 15px Nunito, system-ui, sans-serif; letter-spacing: 0; text-transform: none; color: var(--on-wood-2); }
.pt-live mark { background: var(--k-safran); color: #3a2500; border-radius: 6px; padding: 0 2px; }
.pt-fly {
  position: absolute; left: 50%; top: 0; z-index: 2; pointer-events: none; white-space: nowrap;
  translate: -50% 0; font: 700 26px var(--display); letter-spacing: .05em; color: #8fe3cf;
  animation: pt-fly .85s cubic-bezier(.2, .7, .3, 1) forwards;
}
@keyframes pt-fly { from { transform: translateY(8px); opacity: 1; } to { transform: translateY(-90px) scale(1.15); opacity: 0; } }

.pt-msg { margin: 0; min-height: 1.45em; text-align: center; font: 800 15px/1.45 Nunito, system-ui, sans-serif; color: var(--on-wood-2); }
.pt-msg.bad { color: #ffb4a8; }
.pt-msg.good { color: #8fe3cf; }

/* tes lettres bonus */
.pt-letters { display: flex; align-items: center; justify-content: center; gap: 8px; }
.pt-letters-label { font-size: 12px; font-weight: 800; color: var(--on-wood-2); }
.pt-cells { display: flex; gap: 2px; }
.pt-cells i {
  width: 14px; height: 20px; display: grid; place-items: center; border-radius: 4px; font: 700 11px/1 var(--display); font-style: normal;
  background: rgba(255, 255, 255, .09); color: rgba(255, 243, 230, .55); transition: background .25s, color .25s;
}
.pt-cells i.on { background: var(--k-safran); color: #3a2500; }
.pt-letters-count { font-size: 12px; color: var(--on-wood-2); font-variant-numeric: tabular-nums; min-width: 3.2em; }

.pt-feed { list-style: none; margin: 0; padding: 0; text-align: center; font-size: 14px; color: var(--on-wood-2); }
.pt-feed li:first-child { color: var(--on-wood); }
.pt-feed li:nth-child(3) { opacity: .6; }

.pt-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; margin: 0; }

/* fin de manche */
.pt-final li { grid-template-columns: minmax(0, 8em) 1fr auto; padding: 6px 0; }
.pt-final li.win .lo-name { color: var(--k-lagon); }
.pt-final-word { color: var(--ink-2); font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pt-final em { color: #b63c3c; font-weight: 800; font-style: normal; font-size: 14px; }
.pt-results .pt-hearts svg.on { fill: var(--k-corail); }

/* ---------- petits écrans et clavier ouvert */
@media (max-width: 600px) {
  .pt-feed li:nth-child(n+3) { display: none; }
  .pt-feed { font-size: 13px; }
  .pt-letters-label { display: none; }
}
@media (min-width: 720px) {
  .pt-players { flex-wrap: wrap; justify-content: center; overflow: visible; }
  .pt-p { width: 128px; }
  .pt-cells { gap: 3px; }
  .pt-cells i { width: 22px; height: 28px; font-size: 14px; border-radius: 6px; }
  .pt-letters-label, .pt-letters-count { font-size: 14px; }
  .pt-table { row-gap: 10px; padding-top: 14px; }
}
.pt-screen.short .pt-feed { display: none; }
.pt-screen.short .pt-hint { display: none; }
.pt-screen.short .pt-syl { font-size: clamp(56px, 17vw, 96px); }
/* clavier ouvert (~350 px utiles) : on serre tout */
.pt-screen.tiny .bar { min-height: 44px; padding-top: max(4px, env(safe-area-inset-top)); padding-bottom: 4px; }
.pt-screen.tiny .bar .cup { width: 24px; height: 24px; }
.pt-screen.tiny .bar .btn.small { min-height: 34px; }
.pt-screen.tiny .pt-table { row-gap: 4px; padding-top: 4px; padding-bottom: 6px; }
.pt-screen.tiny .pt-p { padding: 4px 7px 3px; }
.pt-screen.tiny .pt-p .avatar { width: 26px; height: 26px; font-size: 11px; }
.pt-screen.tiny .pt-prog { margin-top: 4px; }
.pt-screen.tiny .pt-last { min-height: 1.25em; line-height: 1.25; }
.pt-screen.tiny .pt-ticket { padding: 6px 20px 8px; }
.pt-screen.tiny .pt-turn { font-size: 14px; min-height: 1.3em; line-height: 1.3; }
.pt-screen.tiny .pt-syl { font-size: 54px; }
.pt-screen.tiny .pt-stage .pt-cracker { width: 58px; }
.pt-screen.tiny .pt-field, .pt-screen.tiny .pt-input, .pt-screen.tiny .pt-send { min-height: 48px; height: 48px; }
.pt-screen.tiny .pt-msg { min-height: 1.3em; line-height: 1.3; font-size: 14px; }
.pt-screen.tiny .pt-cells i { height: 16px; }

@media (prefers-reduced-motion: reduce) {
  .pt-spark, .pt-glow, .pt-ember, .pt-fly, .pt-flash { animation: none !important; }
  .pt-ember { opacity: 0; }
}
