/* ===========================================================
   LE GRAND DUEL — ring d'arcade, néons rouge et bleu
   =========================================================== */
body.duel {
  --theme: #ff3b5c;
  --theme-2: #ff8a3d;
  --bleu: #3fa9ff;
  --rouge: #ff3b5c;
  --or: #ffd23f;
  --panneau: rgba(16, 10, 34, 0.92);
  --arcade: 'Bungee', 'Inter', system-ui, sans-serif;
  background: #0a0716;
}
.arene-fond {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(50vmax 40vmax at 0% 100%, rgba(255, 59, 92, 0.28), transparent 60%),
    radial-gradient(50vmax 40vmax at 100% 0%, rgba(63, 169, 255, 0.26), transparent 60%),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.03) 0 2px, transparent 2px 6px),
    #0a0716;
}
.duel .btn.primary { background: linear-gradient(180deg, #ff6a5c, #e0244a); color: #fff; border-color: transparent; }

/* ---------- Réglages ---------- */
.affiche { margin: 0; font-family: var(--arcade); font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--or); }
.titre-duel { display: flex; flex-direction: column; align-items: center; margin: 8px 0 4px; line-height: 0.95; }
.titre-duel span { font-family: var(--serif); font-style: italic; font-weight: 700; font-size: clamp(1.8rem, 8vw, 2.4rem); color: #ffe3ea; }
.titre-duel b { font-family: var(--arcade); font-weight: 400; font-size: clamp(3.4rem, 18vw, 5rem); letter-spacing: 0.04em; background: linear-gradient(180deg, #fff 10%, #ffd23f 45%, #ff3b5c 90%); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 4px 0 #5b0b1c) drop-shadow(0 0 18px rgba(255, 59, 92, 0.5)); }

/* ---------- Jeu ---------- */
.jeu-duel { gap: 10px; }
.info-manche { font-family: var(--arcade); font-size: 0.82rem; letter-spacing: 0.06em; color: var(--or); text-align: center; }
.ring {
  --sh: clamp(80px, 16dvh, 128px);
  flex: none;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 6px;
  height: var(--sh);
  padding: 0 6px;
  border-radius: 18px;
  background: linear-gradient(90deg, rgba(255, 79, 134, 0.16), rgba(0, 0, 0, 0.2) 50%, rgba(255, 201, 77, 0.16));
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 -6px 0 rgba(255, 255, 255, 0.04);
}
.coin { --c: var(--p0); display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto auto; column-gap: 8px; align-items: center; min-width: 0; height: 100%; }
.coin.p1 { --c: var(--p1); direction: rtl; }
.coin.p1 > * { direction: ltr; }
.coin .perso { grid-row: 1 / 4; height: calc(var(--sh) * 0.86); width: calc(var(--sh) * 0.86 * 100 / 130); }
.coin .nom { font-weight: 800; font-size: 0.82rem; color: var(--c); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.coin .pts { font-family: var(--arcade); font-weight: 400; font-size: 1.6rem; line-height: 1; color: #fff; text-shadow: 0 0 12px var(--c); }
.coin .etoiles { font-size: 0.7rem; letter-spacing: 1px; color: var(--c); white-space: nowrap; overflow: hidden; }
.vs { font-family: var(--arcade); font-size: 1.2rem; color: var(--or); text-shadow: 0 0 12px rgba(255, 210, 63, 0.6); }

.phase {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
  padding: 18px 16px;
  border-radius: 22px;
  background: var(--panneau);
  border: 1px solid rgba(255, 59, 92, 0.3);
  text-align: center;
}
.phase[hidden] { display: none !important; }
.phase.entree { animation: entree 0.3s ease; }
@keyframes entree { from { opacity: 0; transform: scale(0.97); } }
.ph-etiquette { margin: 0; font-family: var(--arcade); font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--or); }
.ph-titre { margin: 0; font-family: var(--arcade); font-weight: 400; font-size: clamp(1.4rem, 7vw, 2rem); line-height: 1.15; color: #fff; }
.ph-texte { margin: 0; color: #ddd3f0; line-height: 1.45; }
.a-nom { margin: 0; font-family: var(--arcade); font-size: clamp(1.7rem, 9vw, 2.4rem); line-height: 1.1; color: #fff; text-shadow: 0 0 18px rgba(255, 59, 92, 0.6); }
.a-regle { margin: 0; color: #eae2fb; line-height: 1.45; }
.a-mode { margin: 0; padding: 8px 12px; border-radius: 12px; background: rgba(63, 169, 255, 0.12); border: 1px solid rgba(63, 169, 255, 0.4); color: #cfe6ff; font-size: 0.86rem; line-height: 1.35; }
.a-mode:empty { display: none; }

/* Arène des mini-jeux « chacun son tour » */
.arene-phase { justify-content: flex-start; padding: 12px; gap: 10px; }
.arene { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 12px; touch-action: none; user-select: none; -webkit-user-select: none; }
.ar-info { margin: 0; font-weight: 700; color: #eae2fb; }
.ar-cible { margin: 0; font-family: var(--arcade); font-size: clamp(2.4rem, 13vw, 3.4rem); color: var(--or); }
.ar-ecran { margin: 0; font-family: var(--arcade); font-size: clamp(2rem, 11vw, 3rem); color: #fff; font-variant-numeric: tabular-nums; }
.ar-ecran.fige { color: var(--bleu); }
.arene .btn.gros { margin-top: auto; }
.pads { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 12px; max-height: 60dvh; }
.pad { border: 0; border-radius: 22px; cursor: pointer; opacity: 0.35; transition: opacity 0.12s, transform 0.12s; }
.pad.p0 { background: #ff3b5c; } .pad.p1 { background: #3fa9ff; } .pad.p2 { background: #3ee07f; } .pad.p3 { background: #ffd23f; }
.pad.on { opacity: 1; transform: scale(1.04); box-shadow: 0 0 30px currentColor; }
.pads.rate .pad { animation: secoue 0.4s ease; }
@keyframes secoue { 25%, 75% { transform: translateX(-6px); } 50% { transform: translateX(6px); } }
.cible-zone { position: relative; flex: 1; min-height: 240px; border-radius: 18px; background: repeating-radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.04) 0 18px, transparent 18px 36px), rgba(0, 0, 0, 0.35); border: 1px solid rgba(255, 255, 255, 0.1); overflow: hidden; }
.coeur-cible { position: absolute; width: 58px; height: 58px; transform: translate(-50%, -50%); border: 0; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #ff8aa0, #e0244a); color: #fff; font-size: 1.7rem; line-height: 1; cursor: pointer; box-shadow: 0 0 18px rgba(255, 59, 92, 0.7); }
.coeur-cible[hidden] { display: none; }

/* Sanction */
.carte-sanction { display: flex; flex-direction: column; gap: 12px; padding: 16px; border-radius: 18px; text-align: left; background: linear-gradient(160deg, #2a1236, #150a22); border: 1px solid rgba(255, 59, 92, 0.45); }
.carte-tete { display: flex; align-items: center; justify-content: space-between; gap: 8px; font: 800 0.8rem var(--sans); letter-spacing: 0.08em; text-transform: uppercase; color: var(--or); }
.niveau { padding: 3px 9px; border-radius: 999px; font-size: 0.68rem; background: rgba(255, 255, 255, 0.1); color: #fff; }
.niveau.n2 { background: rgba(255, 138, 61, 0.35); }
.niveau.n3 { background: rgba(255, 59, 92, 0.5); }
.carte-texte { margin: 0; font-family: var(--serif); font-weight: 700; font-size: clamp(1.3rem, 6vw, 1.7rem); line-height: 1.25; color: #fff; }
.carte-sanction .btn-chrono { align-self: flex-start; }
.sanction-actions { display: grid; gap: 8px; }

/* ---------- Écran partagé (face à face) ---------- */
.split { position: fixed; inset: 0; z-index: 80; display: grid; grid-template-rows: 1fr auto 1fr; background: #0a0716; touch-action: none; user-select: none; -webkit-user-select: none; }
.split[hidden] { display: none; }
.moitie {
  --c: var(--p0);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
  background: radial-gradient(circle at 50% 60%, color-mix(in srgb, var(--c) 22%, transparent), transparent 70%), #120b26;
  border: 3px solid color-mix(in srgb, var(--c) 60%, transparent);
  overflow: hidden;
  touch-action: none;
}
.moitie.j1 { --c: var(--p1); transform: rotate(180deg); }
.moitie.rouge { background: #4a0d1a; border-color: #ff3b5c; }
.moitie.vert { background: #0d4a26; border-color: #3ee07f; }
.moitie.frappe { animation: frappe 0.12s ease; }
@keyframes frappe { 50% { filter: brightness(1.35); } }
.moitie.bloquee { filter: grayscale(0.8) brightness(0.7); }
.m-nom { font-weight: 800; font-size: 0.95rem; color: var(--c); letter-spacing: 0.04em; }
.m-grand { font-family: var(--arcade); font-size: clamp(2.4rem, 13vw, 4rem); line-height: 1; color: #fff; text-align: center; }
.m-petit { font-size: 0.82rem; color: #cfc4e6; }
.m-q { display: grid; place-items: center; min-height: 60px; }
.m-calc { font-family: var(--arcade); font-size: clamp(1.8rem, 10vw, 2.8rem); color: #fff; }
.m-mot { font-family: var(--arcade); font-size: clamp(2rem, 11vw, 3rem); letter-spacing: 0.06em; }
.m-choix { width: 100%; max-width: 420px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.m-choix button { min-height: 56px; border-radius: 14px; border: 2px solid rgba(255, 255, 255, 0.18); background: rgba(255, 255, 255, 0.07); color: #fff; font: 800 1.2rem var(--sans); cursor: pointer; }
.m-choix button.ok { background: #1f8a4e; border-color: #3ee07f; }
.m-choix button.ko { background: #8a1f2e; border-color: #ff3b5c; }
.split-milieu { position: relative; display: grid; place-items: center; height: 46px; background: linear-gradient(90deg, var(--p0), var(--or), var(--p1)); }
.split-centre { font-family: var(--arcade); font-size: 1.5rem; color: #1a0f2a; }
.split-quitter { position: absolute; left: 10px; top: 50%; width: 32px; height: 32px; transform: translateY(-50%); border-radius: 50%; border: 0; background: rgba(0, 0, 0, 0.35); color: #fff; cursor: pointer; }

/* ---------- Fin ---------- */
.fin h2 { font-family: var(--arcade); font-weight: 400; font-size: clamp(1.5rem, 7vw, 2.2rem); color: #fff; }
.fin-persos { display: flex; justify-content: center; align-items: flex-end; gap: 22px; height: clamp(110px, 20dvh, 160px); }
.fin-perso { display: flex; flex-direction: column; align-items: center; gap: 4px; height: 78%; }
.fin-perso.gagnant { height: 100%; }
.fin-perso.gagnant span::before { content: '👑 '; }
.fin-perso .perso { flex: 1; aspect-ratio: 100 / 130; }
.fin-perso span { font-weight: 800; font-size: 0.85rem; }
.f-score { margin: 0; font-family: var(--arcade); font-size: 2rem; color: var(--or); }
.ordre-boite { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 8px; padding: 14px; border-radius: 16px; background: rgba(0, 0, 0, 0.4); border: 1px solid var(--or); }
.ordre-boite span { font-family: var(--arcade); font-size: 0.8rem; color: var(--or); letter-spacing: 0.08em; }
.ordre-boite p { margin: 0; font-family: var(--serif); font-weight: 700; font-size: 1.25rem; line-height: 1.3; }


/* Écran de fin : personnages à taille fixe, défilement si l'écran est petit */
.fin { justify-content: safe center; overflow-y: auto; }
.fin-persos { --fh: clamp(96px, 17dvh, 140px); height: auto; align-items: flex-end; }
.fin-perso { height: auto; }
.fin-perso .perso { flex: none; height: var(--fh); width: calc(var(--fh) * 100 / 130); }
.fin-perso:not(.gagnant) .perso { height: calc(var(--fh) * 0.8); width: calc(var(--fh) * 0.8 * 100 / 130); }

@media (max-height: 680px) {
  .ring { --sh: clamp(66px, 13dvh, 96px); }
  .phase { padding: 12px; gap: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  .phase.entree, .moitie.frappe, .pads.rate .pad { animation: none; }
}

/* Gage révélé : on libère la place pour qu'il tienne à l'écran */
.fin.revele .fin-persos, .fin.revele .f-texte { display: none; }
.fin .actions-fin { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: 100%; max-width: 380px; }
.fin .actions-fin .primary { grid-column: 1 / -1; }
.fin .actions-fin .btn { margin: 0; }
@media (max-height: 680px) {
  .fin { gap: 8px; padding-top: 10px; padding-bottom: 10px; }
  .fin-persos { --fh: clamp(80px, 13dvh, 110px); }
  .fin h2 { margin: 0; }
}
@media (max-height: 600px) {
  .fin-persos { display: none; }
}
