/* Jeux | Blog-United — socle visuel, aux couleurs de Blog United
   Bleu nuit #0D335D · Orange #F7A531 · Bleu ciel #E0EFFF · Blanc · police Poppins (réglages Elementor du site)
   Joueur 1 = orange, joueur 2 = bleu vif (le couple orange/bleu reste lisible, même pour un daltonien).
   Pour changer la palette, tout passe par les jetons de :root. */
@font-face { font-family: "Poppins"; font-style: normal; font-weight: 400; font-display: swap; src: url("/fonts/poppins-400.woff") format("woff"); }
@font-face { font-family: "Poppins"; font-style: normal; font-weight: 500; font-display: swap; src: url("/fonts/poppins-500.woff") format("woff"); }
@font-face { font-family: "Poppins"; font-style: normal; font-weight: 700; font-display: swap; src: url("/fonts/poppins-700.woff") format("woff"); }

:root {
  --ink: #071d36;
  --navy: #0d335d;
  --night: #0d335d;
  --tile: #124273;
  --tile-hi: #1b5489;
  --line: rgba(224, 239, 255, 0.16);
  --text: #f4f9ff;
  --muted: #a9c4e4;
  --p0: #f7a531;
  --p1: #5bb8ff;
  --sky: #e0efff;
  --danger: #ffb4a0;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --font: "Poppins", "Avenir Next", ui-rounded, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; background: var(--ink); }
body {
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--ink);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
h1, h2, h3 { font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; }
a { color: inherit; }
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--sky); outline-offset: 3px; border-radius: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- ambiance : le fond prend la couleur du joueur dont c'est le tour ---- */
.ambient { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.amb {
  position: absolute; left: 50%; top: -22vh; width: 150vw; height: 80vh; transform: translateX(-50%);
  opacity: 0; transition: opacity 0.8s var(--ease);
}
.amb-0 { background: radial-gradient(closest-side, var(--p0), transparent); }
.amb-1 { background: radial-gradient(closest-side, var(--p1), transparent); }
body[data-turn="0"] .amb-0 { opacity: 0.26; }
body[data-turn="1"] .amb-1 { opacity: 0.3; }

/* ---- écrans ---- */
.screen {
  position: relative; z-index: 1;
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column; gap: 14px;
  width: 100%; max-width: 520px; margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) 20px max(20px, env(safe-area-inset-bottom));
}
.grow { flex: 1 1 auto; display: flex; flex-direction: column; justify-content: center; gap: 14px; }
.topbar { display: flex; align-items: center; justify-content: space-between; min-height: 44px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 700; letter-spacing: -0.02em; font-size: 18px; }
/* logo Jeux | Blog-United (image) ; dans les écrans de jeu, l'emblème seul */
.brand-logo { display: block; height: 42px; width: auto; }
.logo-badge { display: block; width: 32px; height: 32px; border-radius: 50%; }

.h-display { font-size: clamp(42px, 13vw, 68px); letter-spacing: -0.03em; line-height: 1.02; }
.h-title { font-size: clamp(30px, 9vw, 42px); }
.lede { color: var(--muted); font-size: 17px; max-width: 34ch; }
.muted { color: var(--muted); }
.hint { min-height: 1.4em; color: var(--danger); font-size: 14px; }

/* ---- boutons ---- */
.btn {
  appearance: none; border: 0; cursor: pointer; min-height: 54px; padding: 0 26px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  font-weight: 700; font-size: 17px; letter-spacing: -0.01em; text-decoration: none; text-align: center;
  transition: transform 0.18s var(--spring), opacity 0.2s, box-shadow 0.3s;
  touch-action: manipulation; user-select: none; -webkit-user-select: none;
}
.btn:active { transform: scale(0.97); }
.btn[disabled] { opacity: 0.45; cursor: default; transform: none; }
.btn-primary {
  color: var(--navy);
  background: var(--p0);
  box-shadow: 0 10px 28px -10px rgba(247, 165, 49, 0.75);
}
.btn-ghost { background: transparent; color: var(--text); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn-soft { background: rgba(224, 239, 255, 0.13); color: var(--text); }
.btn-block { width: 100%; }
.btn svg { width: 22px; height: 22px; flex: none; }

/* ---- champs ---- */
.field { display: flex; flex-direction: column; gap: 8px; font-size: 14px; color: var(--muted); }
.input {
  width: 100%; min-height: 54px; padding: 0 18px; border-radius: 16px; border: 0;
  background: var(--night); color: var(--text); font-size: 17px; font-weight: 500;
  box-shadow: inset 0 0 0 1.5px var(--line);
}
.input::placeholder { color: rgba(169, 196, 228, 0.55); font-weight: 500; }

/* ---- accueil : une carte par jeu (visuel, description, trois boutons) ---- */
.home { gap: 20px; padding-bottom: 36px; }
.intro { display: flex; flex-direction: column; gap: 16px; }
.intro-copy { display: flex; flex-direction: column; gap: 10px; }
.intro .h-display { font-size: clamp(27px, 7.4vw, 46px); text-wrap: balance; }
.intro .h-display span { white-space: nowrap; }
.intro .lede { font-size: 16px; max-width: 44ch; }
.field-inline { flex-direction: row; align-items: center; gap: 12px; }
.field-inline span { flex: none; }
.field-inline .input { min-height: 48px; }
.games { display: flex; flex-direction: column; gap: 20px; }
.game-card {
  display: flex; flex-direction: column; overflow: hidden; border-radius: 28px;
  background: linear-gradient(165deg, var(--night), #0a2747); border: 1.5px solid var(--line);
}
/* le visuel : une scène par jeu, avec sa propre lueur (bleu pour Wall Go, orange pour Gradation) */
.stage { display: grid; place-items: center; min-height: 236px; padding: 22px 18px; border-bottom: 1.5px solid var(--line); }
.stage-wallgo { background: radial-gradient(110% 80% at 50% 0%, rgba(91, 184, 255, 0.3), transparent 62%), linear-gradient(180deg, #0b2b50, #09213f); }
.stage-gradation { background: radial-gradient(110% 80% at 50% 0%, rgba(247, 165, 49, 0.28), transparent 62%), linear-gradient(180deg, #0b2b50, #09213f); }
.stage-equation { background: radial-gradient(110% 80% at 50% 0%, rgba(53, 200, 138, 0.26), transparent 62%), linear-gradient(180deg, #0b2b50, #09213f); }
.hero-board { width: min(100%, 216px); touch-action: manipulation; }
.gradation-art { width: min(100%, 340px); }
.equation-art { width: min(100%, 330px); }
.game-body { flex: 1 1 auto; display: flex; flex-direction: column; gap: 16px; padding: 20px 20px 22px; }
.game-text { flex: 1 1 auto; }
.game-text h2 { font-size: 28px; margin-bottom: 6px; }
.game-text p { color: var(--muted); font-size: 16px; }
.game-actions { display: flex; flex-direction: column; gap: 10px; }
.game-body .hint:empty { display: none; }
.soon { color: var(--muted); font-size: 15px; padding: 2px 6px; }
@media (min-width: 820px) {
  .home { max-width: 1000px; gap: 24px; padding-top: 20px; padding-bottom: 56px; }
  /* titre sur toute la largeur, puis la phrase d'accroche à gauche et le pseudo à droite */
  .intro { display: grid; grid-template-columns: 1fr 340px; align-items: end; gap: 12px 40px; }
  .intro-copy { display: contents; }
  .intro .h-display { grid-column: 1 / -1; }
  .games { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
  .stage { min-height: 244px; padding: 18px; }
  .hero-board { width: min(100%, 212px); }
  .game-actions .btn { min-height: 50px; }
  .soon { align-self: center; padding: 0 12px; }
}

/* visuel de Gradation : les gobelets du haut se soulèvent un par un (7 × 1,2 s) et révèlent leur cube */
.ha-art { display: block; width: 100%; height: auto; overflow: visible; }
.ha-art .gr-cup { width: 40px; height: 46px; }
.ha-table { stroke: var(--line); stroke-width: 1.5; }
.ha-cube { fill: var(--p0); }
.ha-top .ha-cube { fill: var(--p1); }
.ha-num { fill: var(--navy); font: 700 14px var(--font); }
.ha-low .ha-cup { transform: translateY(-26px); }
.ha-top .ha-cup { animation: ha-lift 8.4s var(--ease) infinite; animation-delay: calc(var(--d) * 1.2s); }
@keyframes ha-lift { 0% { transform: translateY(0); } 4%, 16% { transform: translateY(-26px); } 20%, 100% { transform: translateY(0); } }

/* ---- salon d'attente ---- */
.linkbox {
  display: flex; align-items: center; min-height: 58px; padding: 0 18px; border-radius: 18px;
  background: var(--night); box-shadow: inset 0 0 0 1.5px var(--line);
  font-weight: 700; font-size: 17px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  user-select: all; -webkit-user-select: all;
}
.waiting { display: inline-flex; align-items: center; gap: 12px; color: var(--muted); font-weight: 500; }
.dots { display: inline-flex; gap: 5px; }
.dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--sky); animation: blink 1.2s infinite var(--ease); }
.dots i:nth-child(2) { animation-delay: 0.15s; }
.dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes blink { 0%, 80%, 100% { opacity: 0.25; transform: scale(0.8); } 40% { opacity: 1; transform: scale(1.1); } }
.stack-actions { display: flex; flex-direction: column; gap: 12px; }
/* lien discret (règles) : texte souligné, zone de toucher de 44 px */
.btn-link {
  appearance: none; border: 0; background: none; cursor: pointer; align-self: center; touch-action: manipulation;
  min-height: 44px; padding: 0 10px; color: var(--sky); font: inherit; font-weight: 500; font-size: 16px;
  text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1.5px;
}
.btn-link:active { opacity: 0.7; }

/* ---- messages ---- */
.toasts { position: fixed; z-index: 50; left: 0; right: 0; top: max(14px, env(safe-area-inset-top)); display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast {
  max-width: min(92vw, 420px); padding: 12px 18px; border-radius: 999px; background: var(--tile-hi); color: var(--text);
  font-weight: 700; font-size: 15px; box-shadow: 0 12px 30px -12px rgba(0, 0, 0, 0.7), inset 0 0 0 1.5px var(--line);
  animation: toast-in 0.35s var(--spring) both;
}
.toast.out { animation: toast-out 0.25s var(--ease) both; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-14px) scale(0.96); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-10px); } }

/* ---- feuille (règles) ---- */
.sheet-backdrop { position: fixed; z-index: 40; inset: 0; background: rgba(3, 14, 30, 0.7); display: flex; align-items: flex-end; justify-content: center; animation: fade-in 0.25s both; }
.sheet {
  width: 100%; max-width: 520px; max-height: 88dvh; overflow: auto;
  background: var(--night); border-radius: 30px 30px 0 0; padding: 26px 22px max(22px, env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 16px; animation: sheet-up 0.4s var(--ease) both;
  box-shadow: inset 0 1.5px 0 var(--line);
}
.sheet h2 { font-size: 28px; }
.sheet p { color: var(--muted); font-size: 17px; }
.sheet p strong { color: var(--text); }
.sheet-slide { display: flex; flex-direction: column; gap: 14px; }
.sheet-art { display: block; margin: 4px auto 10px; width: 100%; max-width: min(280px, 34dvh); align-self: center; }
/* Fermer à gauche, Suivant à droite : une seule rangée, Suivant prend la place restante */
.rule-actions { display: flex; gap: 12px; }
.rule-actions .btn { padding: 0 22px; }
.rule-actions .btn-primary { flex: 1 1 auto; }
@media (max-height: 700px) {
  .sheet { padding-top: 20px; gap: 12px; max-height: 92dvh; }
  .sheet h2 { font-size: 24px; }
  .sheet p { font-size: 16px; }
  .sheet-slide { gap: 10px; }
  .sheet-art { max-width: min(280px, 25dvh); margin-bottom: 4px; }
}
.sheet-dots { display: flex; gap: 8px; justify-content: center; }
.sheet-dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--line); transition: all 0.3s var(--ease); }
.sheet-dots i.on { width: 24px; border-radius: 6px; background: var(--sky); }
/* choix du niveau (jouer seul) */
.choices { display: flex; flex-direction: column; gap: 10px; }
.choice {
  appearance: none; border: 0; cursor: pointer; width: 100%; min-height: 64px; padding: 12px 18px; border-radius: 20px;
  display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 2px; text-align: left;
  background: var(--tile); box-shadow: inset 0 0 0 1.5px var(--line);
  transition: transform 0.18s var(--spring), box-shadow 0.25s var(--ease);
  touch-action: manipulation;
}
.choice:active { transform: scale(0.98); }
.choice.on { box-shadow: inset 0 0 0 2px var(--sky); background: var(--tile-hi); }
.choice-name { font-weight: 700; font-size: 19px; letter-spacing: -0.02em; }
.choice-desc { color: var(--muted); font-size: 15px; }
/* choix du niveau : une carte par adversaire, avec un indicateur de force (1 à 3 barres) */
.sheet-levels { gap: 14px; }
.lv-head { display: flex; align-items: center; gap: 14px; }
.lv-badge {
  flex: none; width: 52px; height: 52px; border-radius: 17px; display: grid; place-items: center; color: var(--sky);
  background: linear-gradient(145deg, var(--tile-hi), var(--tile)); box-shadow: inset 0 0 0 1.5px var(--line);
}
.lv-badge svg { width: 28px; height: 28px; }
.lv-game { color: var(--muted); font-size: 15px; font-weight: 500; margin-bottom: 2px; }
.lv-head h2 { font-size: 25px; }
.choice.lv { flex-direction: row; align-items: center; gap: 14px; min-height: 76px; padding: 12px 14px 12px 16px; }
.lv-meter { flex: none; display: flex; align-items: flex-end; gap: 4px; width: 38px; height: 34px; }
.lv-meter i { flex: 1; border-radius: 3px; background: rgba(224, 239, 255, 0.2); }
.lv-meter i:nth-child(1) { height: 36%; }
.lv-meter i:nth-child(2) { height: 66%; }
.lv-meter i:nth-child(3) { height: 100%; }
.lv-meter i.on { background: var(--p0); }
.lv-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.lv-name { display: flex; align-items: center; gap: 10px; }
.lv-tag { flex: none; padding: 3px 9px; border-radius: 999px; background: rgba(224, 239, 255, 0.14); color: var(--sky); font-size: 12px; font-weight: 700; }
.lv-go { flex: none; display: grid; width: 20px; height: 20px; color: var(--muted); transition: transform 0.25s var(--ease), color 0.25s; }
.lv-go svg { width: 20px; height: 20px; }
@media (hover: hover) {
  .choice.lv:hover { background: var(--tile-hi); }
  .choice.lv:hover .lv-go { transform: translateX(3px); color: var(--text); }
}
/* grand écran : les fenêtres s'ouvrent au centre plutôt qu'en bas */
@media (min-width: 820px) {
  .sheet-backdrop { align-items: center; padding: 24px; }
  .sheet { max-width: 480px; max-height: 90dvh; border-radius: 30px; animation: pop-in 0.35s var(--ease) both; box-shadow: inset 0 0 0 1.5px var(--line), 0 30px 80px -24px rgba(0, 0, 0, 0.7); }
}
@keyframes pop-in { from { transform: translateY(14px) scale(0.97); opacity: 0; } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
