/* Mots fléchés : habillage « Paris, rouge et bleu » (voir SPEC_THEME_PSG.md).
   Aucun écusson ni logo officiel : la bande du maillot, la tour Eiffel et le ballon sont dessinés ici. */

:root {
  --nuit: #0B1F3F;
  --bleu: #004170;
  --rouge: #DA291C;
  --rouge-f: #B51E14;
  --rouge-clair: #FF8F84;
  --blanc: #FFFFFF;
  --fond: #F2F5FA;
  --def: #E4EBF5;
  --def-actif: #CFDBEE;
  --encre: #0B1F3F;
  --encre-2: #3E4F6B;
  --ligne: #C5CFDF;
  --filet: #DDE4EF;
  --mot: #FFE9E6;
  --sel: #FFC9C2;
  --mystere: #F7E2A6; /* or pâle (trophée), distinct du surlignage rose du mot courant */
  --revele: #004170;
  --faux: #A3140C;
  --ombre: 0 1px 2px rgba(11, 31, 63, .08), 0 10px 28px rgba(11, 31, 63, .12);
  --sans: "Atkinson Hyperlegible", Verdana, "Helvetica Neue", Arial, sans-serif;
  --serif: "Fraunces", "Playfair Display", Georgia, "Times New Roman", serif;
  --topbar-h: 60px;
  --cell: 56px;
  --echelle: 1;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--fond);
  color: var(--encre);
  font-family: var(--sans);
  font-size: 18px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
@media (min-width: 900px) {
  body.en-jeu { height: 100vh; height: 100dvh; overflow: hidden; }
}

button { font: inherit; }
button:focus-visible, .carte:focus-visible, .reprendre:focus-visible {
  outline: 3px solid #F2B705;
  outline-offset: 2px;
}

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 8px 16px;
  border-radius: 10px;
  border: 1.5px solid var(--bleu);
  background: var(--blanc);
  color: var(--bleu);
  font-family: var(--sans);
  font-size: 17px;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .08s;
}
.btn:hover { background: #EAF1FA; border-color: var(--nuit); color: var(--nuit); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .4; cursor: default; }
.btn-principal { background: var(--rouge); border-color: var(--rouge); color: #fff; }
.btn-principal:hover { background: var(--rouge-f); border-color: var(--rouge-f); color: #fff; }
.btn-petit { min-height: 44px; min-width: 56px; padding: 6px 12px; font-size: 19px; }

/* ---------- Barre du haut (écran de jeu) : bleu nuit, bande du maillot à gauche ---------- */
.topbar {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 24px 0 0;
  background: var(--nuit);
  color: #fff;
  box-shadow: 0 3px 0 var(--rouge);
}
.marque-zone { display: flex; align-items: stretch; gap: 16px; min-width: 0; }
.bande-mini {
  flex: 0 0 22px;
  background: linear-gradient(90deg, #fff 0 4px, var(--rouge) 4px calc(100% - 4px), #fff calc(100% - 4px));
}
.titres { display: flex; align-items: baseline; gap: 16px; min-width: 0; align-self: center; }
.marque {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 23px;
  line-height: 1;
  color: #fff;
  white-space: nowrap;
}
.fil {
  font-size: 17px;
  color: #B9CBE8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.haut-actions { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.taille { display: flex; gap: 6px; }
.topbar .btn { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .6); }
.topbar .btn:hover { background: rgba(255, 255, 255, .14); border-color: #fff; color: #fff; }
.topbar .btn:disabled { opacity: .35; }

/* ---------- Ballon (fait main) ---------- */
.ballon { width: 26px; height: 26px; flex: none; }
.ballon.off { opacity: .22; }

/* ---------- Accueil : bandeau bleu nuit, bande du maillot, tour Eiffel ---------- */
.accueil { min-height: 100vh; background: var(--fond); }
.bandeau {
  position: relative;
  background: var(--nuit);
  color: #fff;
  overflow: visible;
}
.bandeau::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 46px;
  background: linear-gradient(90deg, #fff 0 5px, var(--rouge) 5px calc(100% - 5px), #fff calc(100% - 5px));
}
.bandeau::after {
  content: "";
  position: absolute;
  left: -6%; right: -6%;
  bottom: -34px;
  height: 68px;
  background: var(--fond);
  border-radius: 50%;
}
.bandeau-inner {
  position: relative;
  z-index: 1;
  max-width: 1040px;
  margin: 0 auto;
  padding: 44px 24px 80px 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.titre-accueil {
  margin: 0;
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(34px, 4.6vw, 54px);
  line-height: 1.08;
  letter-spacing: -.01em;
  color: #fff;
}
.allez {
  display: inline-block;
  margin-top: 14px;
  padding-bottom: 6px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: .02em;
  color: #fff;
  border-bottom: 3px solid var(--rouge);
}
.accroche { margin: 16px 0 0; font-size: 19px; color: #C9D7EE; }
.tour { width: 96px; height: auto; flex: none; color: #fff; opacity: .95; }

.accueil-corps { max-width: 1040px; margin: 0 auto; padding: 48px 24px 32px; }
.chargement { font-size: 20px; color: var(--encre-2); padding: 60px 0; text-align: center; }

.reprendre {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  max-width: 640px;
  margin-top: 4px;
  padding: 20px 26px;
  border: 0;
  border-radius: 14px;
  background: var(--rouge);
  color: #fff;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 12px 26px rgba(218, 41, 28, .28);
  transition: background .15s;
}
.reprendre:hover { background: var(--rouge-f); }
.reprendre-petit { font-size: 16px; opacity: .95; }
.reprendre-titre { font-family: var(--serif); font-weight: 700; font-size: 30px; line-height: 1.15; }
.reprendre-info { font-size: 18px; font-weight: 700; }

.sous-titre {
  margin: 34px 0 16px;
  font-family: var(--serif);
  font-weight: 700;
  font-size: 25px;
  color: var(--bleu);
}
.cartes { display: grid; grid-template-columns: repeat(auto-fit, minmax(226px, 1fr)); gap: 18px; }
.carte {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 262px;
  padding: 30px 22px 22px;
  border: 0;
  border-radius: 14px;
  background: var(--blanc);
  box-shadow: var(--ombre);
  color: var(--encre);
  text-align: left;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
}
.carte::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 14px;
  background: var(--nuit);
}
.carte::after {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 14px;
  height: 3px;
  background: var(--rouge);
}
.carte:hover { transform: translateY(-2px); box-shadow: 0 2px 4px rgba(11, 31, 63, .08), 0 16px 34px rgba(11, 31, 63, .16); }
.carte-force {
  margin-top: 8px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--bleu);
}
.carte-nom { font-family: var(--serif); font-weight: 700; font-size: 28px; line-height: 1.12; color: var(--nuit); min-height: 2.24em; }
.etoiles { display: flex; gap: 5px; margin: 2px 0 8px; }
.carte-compte { font-size: 17px; color: var(--encre-2); }
.barre { display: block; height: 8px; border-radius: 99px; background: #E4EAF3; overflow: hidden; margin-top: 4px; }
.barre > span { display: block; height: 100%; background: var(--rouge); border-radius: 99px; transition: width .4s ease; }
.carte-suite {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 18px;
  font-weight: 700;
  color: var(--bleu);
}
.carte-suite svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }

.pied {
  margin-top: 40px;
  padding-top: 16px;
  border-top: 1px solid var(--filet);
  font-size: 15px;
  line-height: 1.6;
  color: var(--encre-2);
}
.pied p { margin: 0; }
.erreur { max-width: 620px; margin: 60px auto; text-align: center; }
.erreur h1 { font-family: var(--serif); font-size: 32px; color: var(--nuit); }

/* ---------- Écran de jeu : bloc grille + panneau centré ---------- */
.jeu {
  height: calc(100vh - var(--topbar-h));
  height: calc(100dvh - var(--topbar-h));
  display: grid;
  grid-template-columns: auto 340px;
  justify-content: center;
  align-items: stretch;
  column-gap: 32px;
  padding: 16px 24px;
}
.zone-plateau {
  min-width: 0;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
}

.plateau {
  position: relative;
  display: grid;
  flex: none;
  box-sizing: content-box;
  border: 3px solid var(--nuit);
  background: #fff;
  box-shadow: 0 12px 30px rgba(11, 31, 63, .16);
}

.cell {
  position: relative;
  width: var(--cell);
  height: var(--cell);
  border-right: 1px solid var(--ligne);
  border-bottom: 1px solid var(--ligne);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  user-select: none;
}

/* Cases de définition */
.cell.def { flex-direction: column; background: var(--def); cursor: pointer; }
.moitie {
  position: relative;
  flex: 1 1 0;
  min-height: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1px 2px;
}
.moitie + .moitie { border-top: 1px solid rgba(11, 31, 63, .30); }
.moitie.actif { background: var(--def-actif); }
.dtxt {
  display: block;
  width: 100%;
  text-align: center;
  color: var(--encre);
  line-height: 1.04;
  overflow-wrap: anywhere;
  hyphens: auto;
}
.coeur {
  position: absolute;
  right: 3px;
  bottom: 2px;
  width: 13px;
  height: 13px;
  fill: var(--rouge);
  display: none;
}
.moitie.trouve .coeur { display: block; }

/* Cases de lettres */
.cell.lettre { background: #fff; cursor: pointer; }
.cell.lettre:hover { background: #FFF8F6; }
.cell.dansmot { background: var(--mot); }
.cell.sel { background: var(--sel); box-shadow: inset 0 0 0 2px var(--rouge); }
.cell .ch {
  position: relative;
  z-index: 1;
  font-family: var(--sans);
  font-weight: 700;
  font-size: calc(var(--cell) * .6);
  line-height: 1;
  color: var(--encre);
  text-transform: uppercase;
}
.cell.rev .ch { color: var(--revele); }
.cell.faux .ch { color: var(--faux); text-decoration: line-through; text-decoration-thickness: 2px; }

.fleches {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  pointer-events: none;
  fill: var(--encre);
}
.fleches .trait { fill: none; stroke: var(--encre); stroke-width: 4.5; }

.cell.mys .mcercle {
  position: absolute;
  left: 8%;
  top: 8%;
  width: 84%;
  height: 84%;
  border-radius: 50%;
  background: var(--mystere);
  z-index: 0;
}
.cell .mnum {
  position: absolute;
  right: 3px;
  bottom: 2px;
  z-index: 2;
  font-size: max(10px, calc(var(--cell) * .2));
  font-weight: 700;
  line-height: 1;
  color: #8A5A00;
}

/* ---------- Panneau de droite : tableau d'affichage ---------- */
.panneau {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px 22px;
  background: #fff;
  border-radius: 14px;
  box-shadow: var(--ombre);
  overflow: auto;
}
.def-carte {
  padding: 16px 20px 18px;
  border-radius: 10px;
  border-top: 4px solid var(--rouge);
  background: var(--nuit);
  color: #fff;
}
.def-sens {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #AFC4E6;
}
.def-sens svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: #fff;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform .15s;
}
.def-texte {
  margin: 0;
  font-size: calc(26px * min(var(--echelle, 1), 1.3));
  line-height: 1.25;
  color: #fff;
  overflow-wrap: anywhere;
}
.def-compte { margin: 10px 0 0; font-size: 17px; font-weight: 700; color: var(--rouge-clair); }

.mystere-bloc {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 14px;
  border-top: 1px dashed #C9D3E3;
}
.mystere-titre {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--bleu);
}
.mystere-indice { margin: 0; font-size: 18px; color: var(--encre); }
.mystere-cases { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 4px 3px; }
.mcase {
  position: relative;
  width: 24px;
  height: 32px;
  padding: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  border: 1.5px solid var(--nuit);
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
}
.mcase-n {
  position: absolute;
  left: 2px;
  top: 1px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  color: var(--rouge);
}
.mcase-l {
  padding-bottom: 3px;
  font-size: 19px;
  font-weight: 700;
  line-height: 1;
  color: var(--encre);
  text-transform: uppercase;
}
.mcase.sel { background: var(--sel); }
.mcase.rev .mcase-l { color: var(--revele); }
.mcase.faux { background: #FBE3DF; }
.mcase.faux .mcase-l { color: var(--faux); text-decoration: line-through; }
.mcase.static { cursor: default; }
.mgap { width: 9px; }

.bulle {
  position: relative;
  margin: 10px 0 0;
  padding: 10px 14px;
  border: 1.5px solid var(--rouge);
  border-radius: 12px;
  background: #FFF4F2;
  font-size: 17px;
  line-height: 1.4;
  color: var(--encre);
  animation: surgir .45s ease-out;
}
.bulle::before {
  content: "";
  position: absolute;
  top: -8px;
  left: 22px;
  width: 14px;
  height: 14px;
  background: #FFF4F2;
  border-left: 1.5px solid var(--rouge);
  border-top: 1.5px solid var(--rouge);
  transform: rotate(45deg);
}

.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.actions .btn { min-height: 48px; padding: 8px 6px; font-size: 16px; }
.message {
  min-height: 46px;
  margin: 0;
  display: flex;
  align-items: center;
  padding: 10px 14px;
  border-radius: 10px;
  background: #EEF3FA;
  font-size: 17px;
  line-height: 1.35;
  color: var(--encre);
}
.message.alerte { background: #FDE8E6; color: var(--faux); }
.message.bien { background: #E8F0FB; color: var(--bleu); }
.aide { margin: 0; font-size: 16px; line-height: 1.5; color: var(--encre-2); }
.avance { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
.avance-txt { margin: 0; font-size: 16px; font-weight: 700; color: var(--encre-2); }
.avance .barre { height: 10px; margin-top: 0; }

/* ---------- Fenêtres ---------- */
#modales .fond {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(11, 31, 63, .55);
  animation: fondu .2s ease-out;
}
.modale {
  width: min(540px, 100%);
  padding: 30px 36px 30px;
  border-radius: 18px;
  border-top: 8px solid var(--rouge);
  background: #fff;
  text-align: center;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .3);
  animation: surgir .3s ease-out;
}
.modale h2 { margin: 0 0 10px; font-family: var(--serif); font-weight: 700; font-size: 30px; line-height: 1.15; color: var(--nuit); }
.modale-texte { margin: 0; font-size: 19px; line-height: 1.45; color: var(--encre-2); }
.modale-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 24px; }
.modale-actions .btn { min-width: 170px; }

.bravo h2.buut {
  margin: 0 0 8px;
  font-family: var(--serif);
  font-weight: 700;
  font-size: 76px;
  line-height: 1;
  letter-spacing: .01em;
  color: var(--rouge);
  text-shadow: 3px 3px 0 var(--nuit);
}
.bravo-badge { width: 74px; height: 74px; margin: 0 auto 2px; display: block; }
.bravo-phrase { margin: 0 0 16px; font-size: 22px; line-height: 1.4; color: var(--nuit); font-weight: 700; }
.bravo-note { margin: 0 0 14px; font-size: 17px; line-height: 1.4; color: var(--bleu); }
.bravo-petit { margin: 14px 0 6px; font-size: 16px; font-weight: 700; color: var(--bleu); }
.mystere-revele { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 3px; }
.mystere-revele .mcase { width: 30px; height: 38px; }
.mystere-revele .mcase-l { font-size: 23px; padding-bottom: 4px; }
.mystere-revele .mgap { width: 12px; }
.bravo .bulle { text-align: left; margin-top: 16px; }

.secret .grand-coeur { width: 88px; height: 88px; margin: 4px auto 6px; display: block; fill: var(--rouge); animation: battre 1.2s ease-in-out infinite; }
.petit-titre { margin: 0 0 8px; font-size: 16px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--rouge); }
.secret-def { margin: 0 0 14px; font-family: var(--serif); font-weight: 600; font-size: 30px; line-height: 1.25; color: var(--nuit); }
.secret-msg { margin: 0; font-family: var(--serif); font-style: italic; font-size: 22px; line-height: 1.45; color: var(--nuit); }

#confettis { position: fixed; inset: 0; z-index: 60; pointer-events: none; }

@keyframes battre {
  0%, 100% { transform: scale(1); }
  15% { transform: scale(1.14); }
  30% { transform: scale(1); }
  45% { transform: scale(1.1); }
  60% { transform: scale(1); }
}
@keyframes surgir {
  from { opacity: 0; transform: translateY(6px) scale(.98); }
  to { opacity: 1; transform: none; }
}
@keyframes fondu { from { opacity: 0; } to { opacity: 1; } }
@keyframes clignote {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); background-color: #FFE7A3; }
}
.cell.flash, .mcase.flash { animation: clignote .5s ease-in-out 2; }

/* ---------- Écrans peu hauts : le panneau reste sans défilement ---------- */
@media (max-height: 820px) and (min-width: 900px) {
  .panneau { gap: 9px; padding: 14px 18px; }
  .def-carte { padding: 10px 16px 12px; }
  .def-sens { margin-bottom: 4px; }
  .def-compte { margin-top: 6px; }
  .mystere-bloc { padding-top: 10px; gap: 6px; }
  .actions { gap: 8px; }
  .actions .btn { min-height: 42px; }
  .message { min-height: 40px; padding: 8px 12px; }
  .avance { margin-top: 0; gap: 6px; }
  .def-texte { line-height: 1.2; }
}
@media (max-height: 700px) and (min-width: 900px) {
  .aide { display: none; }
  .avance { display: none; }
}

/* ---------- Petits écrans : le panneau passe sous la grille ---------- */
@media (max-width: 899px) {
  .topbar { height: auto; flex-wrap: wrap; gap: 10px; padding: 0 16px 10px 0; }
  .topbar .bande-mini { flex-basis: 16px; }
  .jeu { height: auto; grid-template-columns: 1fr; padding: 12px 16px 24px; }
  .zone-plateau { overflow: visible; }
  .panneau { overflow: visible; }
  .cartes { grid-template-columns: 1fr 1fr; }
  .tour { width: 70px; }
}
@media (max-width: 640px) {
  .tour { display: none; }
  .bandeau-inner { padding-left: 64px; }
}
@media (max-width: 520px) {
  .cartes { grid-template-columns: 1fr; }
  .modale { padding: 24px 20px 22px; }
  .bravo h2.buut { font-size: 56px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Loupe : bulle qui reprend la définition survolée en grand, sans capter la souris. */
.loupe {
  position: fixed;
  z-index: 40;
  pointer-events: none;
  max-width: 260px;
  padding: 10px 14px;
  background: #fff;
  color: var(--nuit);
  border: 2px solid var(--bleu);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(11, 31, 63, .25);
  font: 700 19px/1.25 var(--sans);
  text-align: center;
}
.loupe[hidden] { display: none; }
.loupe hr { border: 0; border-top: 1px solid var(--ligne); margin: 7px 0; }
