/* Question mise en avant. Text uses --bs-body-color so it stays readable
   on both light and dark themes; visual prominence comes from the heavy
   weight and the 1.75rem size, not from a hard-coded red that was hard to
   read on either background. */
.question {
    font-family: var(--arc-font); font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    text-align: center;
    color: var(--bs-body-color);
    padding: 1rem;
    margin-bottom: 1.5rem;
    min-height: 135px;
}

/* Boutons */
.option-btn {
    font-family: var(--arc-font); font-weight: 800;
    position: relative;
    flex: 1;
    min-height: 145px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #e60000;
    border-radius: 10px;
    font-size: 1.5rem;
    color: #fff;
    background-color: #d14848ff;
    transition: transform 0.2s, box-shadow 0.2s, background-color 0.2s;
    padding: 15px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.5);
}

.option-btn-with-letter {
  padding: 15px 15px 15px 35px;
}

.option-btn:hover {
    background-color: #b30000;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(230, 0, 0, 0.3);
}

.option-letters {
    position: absolute;
    top: 35px;
    left: -20px;
    background-color: #fff;
    color: #f30;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: 0 2px 6px rgba(0,0,0,0.5);
}

/* Score et progression */
.stats {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--bs-body-color);
}

/* Start screen spécifique */
.main-screen {
    color: #fff;
    text-align: center;
}

/* Titres */
.main-screen h1 {
    font-family: var(--arc-font); font-weight: 900;
    font-size: 3rem;
    margin-bottom: 1rem;
    color: rgb(247, 76, 76);
}

.main-screen h2 {
    font-family: var(--arc-font); font-weight: 800;
    font-size: 2rem;
    margin-bottom: 2rem;
    color: #f87777ff;
}

/* Game screen spécifique */
.game-screen {
    color: #fff;
    text-align: center;
}

.game-screen h2 {
    font-family: var(--arc-font); font-weight: 800;
    font-size: 2rem;
    margin-bottom: 2rem;
    color: #f87777ff;
}

/* Bouton Start */
.start-button {
    font-family: var(--arc-font); font-weight: 900;
    font-size: 1.5rem;
    color: #fff;
    background-color: rgb(247, 76, 76);
    border: 0;
    border-radius: 12px;
    padding: 1rem 2rem;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(0,0,0,0.5);
}

.start-button:hover {
    background-color: #d14848ff;
}

.card-play {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  position: relative; /* nécessaire pour les pseudo-éléments */

  width: 90px;
  height: 120px;

  background: white;
  border: 2px solid #000;
  border-radius: 8px;
  font-size: 28px;
  font-weight: bold;
  font-family: "Georgia", "Times New Roman", serif;

  box-shadow: 2px 4px 6px rgba(0, 0, 0, 0.4);
  padding: 4px;
  user-select: none;
}

/* petits index */
.card-play::before,
.card-play::after {
  content: attr(data-rank) attr(data-suit);
  position: absolute;
  font-size: 12px;
  line-height: 1;
}

/* haut-gauche */
.card-play::before {
  top: 4px;
  left: 4px;
}

/* bas-droite, inversé */
.card-play::after {
  bottom: 4px;
  right: 4px;
  transform: rotate(180deg);
}

.card-play.red {
  color: red;
  border-color: red;
}

.card-play.black {
  color: black;
  border-color: black;
}

/* Tablette (ex. < 768px) */
@media (max-width: 768px) {
  .card-play {
    width: 70px;
    height: 95px;
    font-size: 22px;
  }
}

/* Mobile (ex. < 480px) */
@media (max-width: 480px) {
  .card-play {
    width: 70px;
    height: 95px;
    font-size: 18px;
  }

  /* On ajuste aussi les petits index */
  .card-play::before,
  .card-play::after {
    font-size: 10px;
  }

  .game-screen h2 {
    font-size: 1.5rem;
  }
}

/* Mobile: réduire le texte des questions et boutons pour mieux remplir l'écran */
@media (max-width: 767.98px) {
  .question {
    font-size: 1rem;
    padding: 0.5rem;
    min-height: 80px;
    margin-bottom: 0.75rem;
  }

  .option-btn {
    font-size: 1rem;
    min-height: 90px;
    padding: 10px;
  }

  .main-screen {
    padding-top: 2.5rem;
  }

  .main-screen h1 {
    font-size: 2rem;
  }

  .main-screen h2 {
    font-size: 1.25rem;
    margin-bottom: 1.25rem;
  }

  .start-button {
    font-size: 1.15rem;
    padding: 0.75rem 1.25rem;
  }
}

/* End-of-game signup CTA for anonymous players. Uses the score they just
   earned as the hook ("you got X points, save them!") instead of generic
   login/register buttons. Primary action (Register) is bold red, secondary
   (Login) is an inline text link. */
.end-cta {
  background: var(--bs-tertiary-bg);
  border-radius: 14px;
  padding: 1.5rem 1.25rem;
  margin: 0 auto 2rem;
  max-width: 520px;
  text-align: center;
  border: 2px solid var(--bs-danger);
}

.end-cta-message {
  font-size: 1.05rem;
  line-height: 1.45;
  margin: 0 0 1.25rem;
}

.end-cta-message strong {
  font-family: var(--arc-font); font-weight: 800;
  color: var(--bs-danger);
  font-size: 1.4rem;
  letter-spacing: 0.02em;
}

.end-cta-primary {
  display: inline-block;
  background: var(--bs-danger);
  color: #fff;
  font-weight: 800;
  font-size: 1.15rem;
  padding: 0.85rem 1.5rem;
  border-radius: 12px;
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(220, 53, 69, 0.35);
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}

.end-cta-primary:hover,
.end-cta-primary:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(220, 53, 69, 0.45);
  color: #fff;
  text-decoration: none;
  outline: none;
}

.end-cta-secondary {
  font-size: 0.95rem;
  color: var(--bs-secondary-color);
  margin: 1rem 0 0;
}

.end-cta-secondary a {
  color: var(--bs-danger);
  font-weight: 600;
  text-decoration: none;
}

.end-cta-secondary a:hover {
  text-decoration: underline;
}

/* Rebus — image puzzle layout. Cards arranged inline with "+" separators.
   The prompt itself reuses the global .question class so the text scale matches
   every other game (Proverb, Quiz, Postal Code, …). */
.rebus-round {
  text-align: center;
}

.rebus-images {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem 1rem;
  margin: 0 auto 1.5rem;
  padding: 1rem;
  background: var(--bs-body-bg);
  border: 1px solid var(--bs-border-color);
  border-radius: 14px;
  max-width: 720px;
}

.rebus-images img {
  max-height: 140px;
  max-width: 32%;
  object-fit: contain;
  border-radius: 8px;
  background: #fff;
  padding: 0.25rem;
}

.rebus-plus {
  font-family: var(--arc-font); font-weight: 800;
  font-size: 2rem;
  color: var(--bs-danger);
  line-height: 1;
}

.rebus-category {
  margin-bottom: 1.25rem;
  font-size: 1.15rem;
}

.rebus-form {
  max-width: 480px;
  margin: 0 auto;
}

.rebus-input {
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
  margin-bottom: 1rem;
}

.rebus-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.rebus-skip {
  font-size: 1.15rem;
  color: var(--bs-secondary-color);
  background: none;
  border: 0;
  padding: 0.4rem 1rem;
  text-decoration: underline;
  text-underline-offset: 0.25em;
}

.rebus-skip:hover {
  color: var(--bs-body-color);
}

/* Anagramme Savoie — scrambled letter display + answer form. Shares the
   .rebus-skip style for consistency. */
.word-scramble-round {
  text-align: center;
}

.word-scramble-category {
  margin-bottom: 1.25rem;
  font-size: 1.15rem;
}

.word-scramble-scrambled {
  font-family: var(--arc-font); font-weight: 800;
  font-size: 2.5rem;
  letter-spacing: 0.25em;
  color: var(--bs-danger);
  background: var(--bs-body-bg);
  border: 2px dashed var(--bs-border-color);
  border-radius: 12px;
  padding: 1.25rem 1rem;
  margin: 0 auto 1.5rem;
  max-width: 720px;
  text-align: center;
  word-break: break-word;
}

.word-scramble-form {
  max-width: 480px;
  margin: 0 auto;
}

.word-scramble-input {
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
  margin-bottom: 1rem;
}

.word-scramble-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

@media (max-width: 575.98px) {
  .word-scramble-scrambled {
    font-size: 1.6rem;
    letter-spacing: 0.15em;
    padding: 0.85rem 0.5rem;
  }
}

@media (max-width: 575.98px) {
  .rebus-images {
    gap: 0.4rem 0.6rem;
    padding: 0.75rem;
  }
  .rebus-images img {
    max-height: 90px;
  }
  .rebus-plus {
    font-size: 1.5rem;
  }
}

/* CatchMarmot — Phaser arcade game embedded in a Live Component frame.
   The Stimulus controller computes the parent height in JS so Phaser sees
   real dimensions on mobile portrait (where aspect-ratio CSS used to leave
   the parent at 0px tall on older mobile Safari). */
.catch-marmot-frame {
  text-align: center;
}

.catch-marmot-canvas {
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  background: #2d2d2d;
  border-radius: 12px;
  overflow: hidden;
  touch-action: none;
}

.catch-marmot-controls {
  font-size: 0.95rem;
}

/* On-screen touch controls — visible on touch devices, hidden on desktop.
   Sit BELOW the canvas (separate row) so they don't obscure gameplay. */
.catch-marmot-touch-controls {
  display: none;
  margin: 1rem auto 1.5rem;
  max-width: 800px;
  padding: 0 0.75rem;
  justify-content: space-between;
  align-items: center;
}

@media (pointer: coarse), (max-width: 767.98px) {
  .catch-marmot-touch-controls {
    display: flex;
  }
}

.cm-pad-left {
  display: flex;
  gap: 0.5rem;
}

.cm-btn {
  pointer-events: auto;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.85);
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-size: 1.6rem;
  font-weight: bold;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: background-color 0.05s ease, transform 0.05s ease;
}

.cm-btn:active,
.cm-btn.is-pressed {
  background: rgba(220, 53, 69, 0.85);
  transform: scale(0.95);
}

.cm-btn-jump {
  width: 80px;
  height: 80px;
  font-size: 1.9rem;
}

/* ================= Biathlon 92 (Phaser hybrid) ================= */
.biathlon-frame {
  text-align: center;
}

.biathlon-canvas {
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  background: #cfe6f7;
  border-radius: 12px;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.biathlon-controls {
  font-size: 0.95rem;
}

.biathlon-touch-controls {
  display: none;
  margin: 1rem auto 1.5rem;
  max-width: 800px;
  padding: 0 0.75rem;
  justify-content: space-between;
  align-items: center;
}

@media (pointer: coarse), (max-width: 767.98px) {
  .biathlon-touch-controls {
    display: flex;
  }
}

.bi-btn {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  border: 3px solid var(--arc-edge, #14111f);
  background: #13386b;
  color: #fff;
  font-size: 1.8rem;
  font-weight: bold;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 4px 4px 0 var(--arc-edge, #14111f);
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.bi-btn-fire {
  background: #c8102e;
}

.bi-btn.is-pressed {
  transform: translate(3px, 3px);
  box-shadow: 1px 1px 0 var(--arc-edge, #14111f);
}

/* ============ Challes Sky Rush — planeur (Phaser hybrid) ============ */
.planeur-frame {
  text-align: center;
}

.planeur-canvas {
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  background: #9fd0f0;
  border-radius: 12px;
  overflow: hidden;
  touch-action: none;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}

.planeur-controls {
  font-size: 0.95rem;
}

/* ===================== Slalom (Phaser hybrid) ===================== */
.slalom-frame {
  text-align: center;
}

.slalom-canvas {
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  background: #dff1fb;
  border-radius: 12px;
  overflow: hidden;
  touch-action: none;
}

.slalom-controls {
  font-size: 0.95rem;
}

.slalom-touch-controls {
  display: none;
  margin: 1rem auto 1.5rem;
  max-width: 800px;
  padding: 0 0.75rem;
  justify-content: space-between;
  align-items: center;
}

@media (pointer: coarse), (max-width: 767.98px) {
  .slalom-touch-controls {
    display: flex;
  }
}

.sl-btn {
  pointer-events: auto;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 2px solid rgba(19, 56, 107, 0.6);
  background: rgba(19, 56, 107, 0.55);
  color: #fff;
  font-size: 1.7rem;
  font-weight: bold;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: background-color 0.05s ease, transform 0.05s ease;
}

.sl-btn:active,
.sl-btn.is-pressed {
  background: rgba(220, 53, 69, 0.85);
  transform: scale(0.95);
}

/* ========================================================================
   ARCADE MODERNE — game pages (redesign step 6). Visual only: no change to
   game logic, live actions or anti-cheat. Tokens come from app.css.
   ======================================================================== */

/* The game board = an arcade cabinet: ink edge, red hard shadow. */
.game-board > .card {
    border: 3px solid var(--arc-edge);
    border-radius: 16px;
    box-shadow: 7px 7px 0 var(--arc-red);
}
.game-board .thumbnail-game {
    border: 3px solid var(--arc-edge);
    box-shadow: 6px 6px 0 var(--arc-edge);
}

/* Start / end screens: readable on the card surface in both themes
   (was white text + pink titles on a light card). */
.main-screen,
.game-screen {
    color: var(--bs-body-color);
}
.main-screen h1 {
    /* Game titles are long SEO strings: Rubik, not the pixel font. */
    font-family: var(--arc-font);
    font-weight: 900;
    font-size: clamp(1.7rem, 3.4vw, 2.6rem);
    line-height: 1.15;
    /* Clean ink (light) / white (dark): the red offset shadow behind the
       letters was dropped site-wide, it looked smeared. */
    color: var(--bs-emphasis-color);
    text-shadow: none;
}
.main-screen h2,
.game-screen h2 {
    color: var(--bs-body-color);
    font-weight: 700;
    font-size: 1.35rem;
    line-height: 1.4;
}

/* PRESS START. */
.start-button {
    background: var(--arc-red);
    color: #fff;
    border: 3px solid var(--arc-edge);
    border-radius: 10px;
    box-shadow: 5px 5px 0 var(--arc-edge);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    transition: transform 0.08s, box-shadow 0.08s, background-color 0.15s;
}
.start-button:hover {
    background: var(--arc-red-hover);
    transform: translate(2px, 2px);
    box-shadow: 3px 3px 0 var(--arc-edge);
}
.start-button:active {
    transform: translate(5px, 5px);
    box-shadow: none;
}
.start-button:focus-visible {
    outline: 3px solid var(--arc-focus);
    outline-offset: 3px;
}

/* Answer buttons: chunky arcade keys. */
.option-btn {
    background: var(--arc-red);
    color: #fff;
    border: 3px solid var(--arc-edge);
    border-radius: 12px;
    box-shadow: 5px 5px 0 var(--arc-edge);
    transition: transform 0.08s, box-shadow 0.08s, background-color 0.15s;
}
.option-btn:hover {
    background: var(--arc-red-hover);
    transform: translate(2px, 2px);
    box-shadow: 3px 3px 0 var(--arc-edge);
}
.option-btn:active {
    transform: translate(5px, 5px);
    box-shadow: none;
}
.option-btn:focus-visible {
    outline: 3px solid var(--arc-focus);
    outline-offset: 3px;
}
.option-letters {
    background: var(--arc-gold);
    color: var(--arc-night);
    border: 3px solid var(--arc-edge);
    border-radius: 10px;
    box-shadow: 3px 3px 0 var(--arc-edge);
    font-weight: 800;
}

/* Score line. */
.stats {
    font-variant-numeric: tabular-nums;
}

/* Anonymous end-of-game CTA. */
.end-cta {
    border: 3px solid var(--arc-edge);
    box-shadow: 6px 6px 0 var(--arc-red);
}
.end-cta-message strong {
    color: var(--bs-link-color);
}
.end-cta-primary {
    background: var(--arc-red);
    border: 2px solid var(--arc-edge);
    border-radius: 8px;
    box-shadow: 4px 4px 0 var(--arc-edge);
}
.end-cta-primary:hover,
.end-cta-primary:focus-visible {
    transform: translate(2px, 2px);
    box-shadow: 2px 2px 0 var(--arc-edge);
}
.end-cta-secondary a {
    color: var(--bs-link-color);
}

/* Rebus / word scramble boards. */
.rebus-images,
.word-scramble-scrambled {
    border: 3px solid var(--arc-edge);
    border-radius: 12px;
    box-shadow: 5px 5px 0 var(--arc-edge);
}
.rebus-plus,
.word-scramble-scrambled {
    color: var(--bs-link-color);
}

/* Flex item holding the game: without min-width:0 it can't shrink below
   its content, so a Phaser canvas (800 px intrinsic) could push the page
   wider than a phone screen. */
.game-main {
    min-width: 0;
}

/* Arcade canvases (Slalom, Catch Marmot, Challes Sky Rush). */
.slalom-canvas,
.planeur-canvas,
.biathlon-canvas,
.catch-marmot-canvas {
    border: 3px solid var(--arc-edge);
    border-radius: 12px;
    box-shadow: 6px 6px 0 var(--arc-edge);
}
