/* ---------- Écran titre (logo animé, Pokémon du joueur en fond, plaque du Pokémon suivi) ---------- */
.screen.titre-ecran { transform: none; width: 100vw; height: 100vh; height: 100dvh; max-height: none; overflow: hidden; animation: none; position: relative; }
.title-screen.ecran-titre { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer; }
.titre-haut { position: relative; z-index: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; margin-top: -4vh; }
/* Une ombre douce derrière le logo, pour qu'il reste lisible sur tous les décors. */
.titre-haut::before { content: ''; position: absolute; z-index: -1; left: 50%; top: 50%; width: min(1000px, 110vw); height: 150%; transform: translate(-50%, -50%);
  background: radial-gradient(ellipse at center, rgba(4,8,24,.6) 0%, rgba(4,8,24,.35) 45%, rgba(4,8,24,0) 70%); pointer-events: none; }

/* Logo : l'insigne d'explorateur, « Pokémon », puis le nom lettre par lettre */
.titre-logo { display: flex; flex-direction: column; align-items: center; font-family: 'PMD Font', 'Pixelify', sans-serif; animation: titre-flotte 4s 1.6s ease-in-out infinite; }
.titre-embleme { width: clamp(64px, 9vw, 112px); image-rendering: pixelated; filter: drop-shadow(0 0 0 #000) drop-shadow(0 4px 0 #0b1a4a);
  animation: titre-embleme .9s cubic-bezier(.2,1.5,.4,1) both, titre-lueur 2.6s 1s ease-in-out infinite; }
.titre-mot { font-size: clamp(26px, 4.4vw, 54px); line-height: 1; color: #fff; letter-spacing: 6px; margin-top: 4px;
  text-shadow: 0 3px 0 #3a6fd8, 0 6px 0 #0b1a4a, 0 0 18px rgba(120,180,255,.6); animation: titre-glisse .5s .25s cubic-bezier(.2,1.3,.4,1) both; }
.titre-nom { font-size: clamp(40px, 8.2vw, 106px); line-height: .95; color: var(--gold); letter-spacing: 2px; white-space: nowrap;
  text-shadow: 0 4px 0 #a35b00, 0 8px 0 #3a1b00, 0 0 36px rgba(255,200,80,.45); }
.titre-nom span { display: inline-block;
  animation: titre-tombe .55s calc(var(--i) * 45ms + .35s) cubic-bezier(.2,1.6,.4,1) both, titre-vague 4.5s calc(var(--i) * 70ms + 2s) ease-in-out infinite; }
.titre-nom .esp { width: .35em; animation: none; }
.titre-sous { margin-top: 12px; font-size: clamp(14px, 1.9vw, 24px); color: #bfe0ff; letter-spacing: 6px; text-shadow: 0 3px 0 #0b1a4a; animation: titre-apparait .6s 1.2s both; }
.title-screen.ecran-titre .press { margin-top: 3vh; animation: titre-apparait .5s 1.5s both, blink 1.2s 2s steps(2) infinite; text-shadow: 0 2px 0 #000; }
.titre-boutons { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 10px; animation: titre-apparait .5s 1.7s both; }

@keyframes titre-embleme { 0% { transform: translateY(-60px) scale(.2) rotate(-200deg); opacity: 0; } 100% { transform: none; opacity: 1; } }
@keyframes titre-lueur { 50% { filter: drop-shadow(0 0 10px rgba(255,214,96,.9)) drop-shadow(0 4px 0 #0b1a4a); } }
@keyframes titre-glisse { 0% { transform: translateY(-20px); opacity: 0; letter-spacing: 30px; } 100% { transform: none; opacity: 1; } }
@keyframes titre-tombe { 0% { transform: translateY(-90px) scale(1.6); opacity: 0; } 100% { transform: none; opacity: 1; } }
/* Une vague de lumière passe sur le nom toutes les 4 à 5 secondes. */
@keyframes titre-vague { 0%, 14%, 100% { transform: none; filter: none; } 6% { transform: translateY(-7px); filter: brightness(1.45) drop-shadow(0 0 6px #fff4b0); } }
@keyframes titre-flotte { 50% { transform: translateY(-8px); } }
@keyframes titre-apparait { 0% { opacity: 0; transform: translateY(10px); } 100% { opacity: 1; transform: none; } }

/* « Bon retour » (en bas à gauche) et le Pokémon suivi par la caméra (en bas à droite) */
.titre-accueil, .titre-plaque { position: absolute; bottom: 40px; display: flex; align-items: center; gap: 10px; cursor: default; font-size: 18px; }
.titre-accueil { left: 16px; max-width: calc(50vw - 24px); animation: titre-gauche .6s 1.9s cubic-bezier(.2,1.3,.4,1) both; }
.titre-accueil .portrait, .titre-plaque .portrait { width: 56px; height: 56px; flex: none; }
.titre-bonjour { font-size: 20px; }
.titre-stats { display: flex; flex-wrap: wrap; gap: 2px 12px; font-size: 16px; color: #cfe0ff; }
.titre-stats .leg { color: var(--gold); }
.titre-plaque { right: 16px; max-width: calc(50vw - 24px); opacity: 0; }
.titre-plaque b { font-size: 20px; }
.titre-tag { font-size: 15px; color: var(--dim); }
.titre-plaque.montre { animation: titre-droite .5s .2s cubic-bezier(.2,1.3,.4,1) both; }
.titre-plaque.leg { border-image-source: url('assets/ui/cadres/cadre1_yellow_translucide.png'); }
.titre-plaque.leg .titre-tag { color: var(--gold); }
.titre-plaque.leg .portrait { border-color: var(--gold-line); box-shadow: 0 0 14px rgba(255,200,80,.6); }
.titre-plaque.sh .portrait { box-shadow: 0 0 12px rgba(190,230,255,.7); }
@keyframes titre-gauche { 0% { opacity: 0; transform: translateX(-40px); } 100% { opacity: 1; transform: none; } }
@keyframes titre-droite { 0% { opacity: 0; transform: translateX(40px); } 100% { opacity: 1; transform: none; } }
.titre-credits { position: absolute; bottom: 4px; left: 0; right: 0; margin: 0; text-align: center; font-size: 14px; color: var(--dim); text-shadow: 0 2px 0 #000; }

/* Départ : le logo s'envole et l'écran s'illumine. */
.title-screen.ecran-titre.sortie .titre-logo { animation: titre-envol .38s ease-in both; }
.title-screen.ecran-titre.sortie .press, .title-screen.ecran-titre.sortie .titre-boutons, .title-screen.ecran-titre.sortie .titre-accueil,
.title-screen.ecran-titre.sortie .titre-plaque, .title-screen.ecran-titre.sortie .titre-credits { animation: titre-efface .25s both; }
.title-screen.ecran-titre.sortie::after { content: ''; position: fixed; inset: 0; background: #fff; pointer-events: none; animation: titre-flash .38s ease-in both; }
@keyframes titre-envol { 100% { transform: scale(1.25) translateY(-30px); opacity: 0; } }
@keyframes titre-efface { 100% { opacity: 0; } }
@keyframes titre-flash { 0% { opacity: 0; } 70% { opacity: .85; } 100% { opacity: 1; } }

/* Téléphone (portrait) : les deux cadres l'un au-dessus de l'autre, en bas */
@media (max-width: 720px) {
  .titre-accueil, .titre-plaque { left: 10px; right: 10px; max-width: none; font-size: 16px; }
  .titre-accueil { bottom: 112px; }
  .titre-plaque { bottom: 32px; }
  .titre-accueil .portrait, .titre-plaque .portrait { width: 44px; height: 44px; }
  .titre-haut { margin-top: -22vh; }
  .titre-nom { font-size: clamp(30px, 10vw, 60px); letter-spacing: 0; }
  .titre-sous { letter-spacing: 3px; }
  .titre-credits { font-size: 12px; }
}
/* Téléphone couché (peu de hauteur) : tout plus petit */
@media (max-height: 520px) {
  .titre-haut { margin-top: -10vh; gap: 2px; }
  .titre-embleme { width: 52px; }
  .titre-mot { font-size: 24px; }
  .titre-nom { font-size: clamp(30px, 7vw, 64px); }
  .titre-sous { margin-top: 6px; font-size: 13px; }
  .title-screen.ecran-titre .press { margin-top: 8px; font-size: 18px; }
  .titre-accueil, .titre-plaque { bottom: 24px; font-size: 14px; }
  .titre-accueil .portrait, .titre-plaque .portrait { width: 40px; height: 40px; }
  .titre-bonjour, .titre-plaque b { font-size: 16px; }
  .titre-stats, .titre-tag { font-size: 13px; }
}
/* (26/11) Étroit ET bas (zoom 200 % sur un petit PC, 683 × 384) : les deux cadres côte à côte, sinon la plaque cachait « Langue » */
@media (max-width: 720px) and (max-height: 520px) {
  .titre-accueil { right: calc(50% + 4px); }
  .titre-plaque { left: calc(50% + 4px); }
}
@media (prefers-reduced-motion: reduce) {
  .titre-logo, .titre-nom span, .titre-embleme { animation: none !important; }
}
/* Musique de l'écran titre (31/10) : tant que le navigateur bloque le son, une petite ligne dit que le premier appui la lance. */
.title-screen.ecran-titre .press-son { margin-top: 6px; font-size: 16px; color: #ffe08a; text-shadow: 0 2px 0 #000; opacity: 0; max-height: 0; overflow: hidden; transition: opacity .3s steps(3, end); }
.title-screen.ecran-titre.son-bloque .press-son { opacity: 1; max-height: 40px; animation: titre-apparait .5s 1.7s both; }
.title-screen.ecran-titre.sortie .press-son { opacity: 0; }
/* Se déconnecter (5/11) : un petit bouton discret dans la carte « Bon retour », puis une fenêtre où le partenaire s'endort. */
.titre-accueil .titre-deco { align-self: flex-end; margin-left: auto; white-space: nowrap; flex: none; font-size: 14px; line-height: 1.5; opacity: .62; filter: saturate(.6);
  transition: opacity .15s steps(2, end), filter .15s steps(2, end); }
.titre-accueil .titre-deco:hover, .titre-accueil .titre-deco.focus, .titre-accueil .titre-deco:focus-visible { opacity: 1; filter: none; }
.titre-accueil .titre-deco .pxi { --k: 1px; vertical-align: -2px; }
.title-screen.ecran-titre .titre-boutons .titre-deco { font-size: 15px; opacity: .8; }
.deco-titre-corps { display: flex; align-items: center; gap: 16px; }
.deco-titre-poke { position: relative; flex: none; }
.deco-titre-poke .portrait { width: 72px; height: 72px; animation: deco-dort 2.4s ease-in-out infinite; transform-origin: 50% 100%; }
.deco-z { position: absolute; right: -6px; top: 4px; font-style: normal; font-family: 'PMD Font', 'Pixelify', sans-serif; color: #bfe0ff; text-shadow: 0 2px 0 #0b1a4a;
  font-size: 16px; opacity: 0; animation: deco-z 2.4s linear infinite; }
.deco-z:nth-of-type(2) { animation-delay: .8s; font-size: 18px; }
.deco-z:nth-of-type(3) { animation-delay: 1.6s; font-size: 22px; }
@keyframes deco-dort { 50% { transform: scaleY(.94) translateY(2px); filter: brightness(.85); } }
@keyframes deco-z { 0% { opacity: 0; transform: translate(0, 10px); } 20% { opacity: 1; } 100% { opacity: 0; transform: translate(14px, -26px); } }
@media (max-width: 720px) {
  .titre-accueil .titre-deco { font-size: 13px; padding: 0 4px; }
  .deco-titre-corps { gap: 10px; }
  .deco-titre-poke .portrait { width: 56px; height: 56px; }
}
@media (prefers-reduced-motion: reduce) { .deco-titre-poke .portrait, .deco-z { animation: none !important; } }
.titre-accueil > div { text-align: left; }
/* Au doigt (body.is-touch, posé au premier toucher) : l'écran titre reste en plein écran. Sinon la règle des écrans tactiles
   le rétrécissait pendant le premier toucher, tout se décalait et le doigt retombait sur un autre cadre (5/11). */
body.is-touch .screen.titre-ecran { width: 100vw; height: 100vh; height: 100dvh; max-height: none; }
@media (max-width: 720px) { .titre-accueil { bottom: 120px; } }

/* (26/11, lanceur) Flèche « Menu principal / Wiki » en haut à gauche : vers l'accueil du site, et retour par « Jouer » */
.title-screen.ecran-titre .titre-retour { position: absolute; z-index: 3; top: max(8px, env(safe-area-inset-top)); left: max(8px, env(safe-area-inset-left));
  display: inline-flex; align-items: center; gap: 8px; padding: 2px 12px 2px 8px; font-size: 16px; text-decoration: none; color: #eef3ff;
  text-shadow: 0 2px 0 #000; animation: titre-retour-entre .45s 1.2s cubic-bezier(.2,1.4,.4,1) both; transition: transform .12s steps(2, end), filter .12s; }
.title-screen.ecran-titre .titre-retour svg { color: #ffd85a; image-rendering: pixelated; transition: transform .2s; }
.title-screen.ecran-titre .titre-retour:hover, .title-screen.ecran-titre .titre-retour:focus-visible { filter: brightness(1.2); }
.title-screen.ecran-titre .titre-retour:hover svg { transform: translateX(-3px); }
.title-screen.ecran-titre .titre-retour:active { transform: scale(.95); }
.title-screen.ecran-titre.sortie .titre-retour { animation: titre-retour-sort .25s ease-in both; }
@keyframes titre-retour-entre { from { transform: translateX(-24px); opacity: 0; } }
@keyframes titre-retour-sort { to { transform: translateX(-24px); opacity: 0; } }
@media (max-height: 520px) { .title-screen.ecran-titre .titre-retour { font-size: 16px; padding: 0 10px 0 6px; min-height: 36px; } }
@media (prefers-reduced-motion: reduce) { .title-screen.ecran-titre .titre-retour { animation: none; } }
