* { box-sizing: border-box; }

:root {
  --bg: #d7b07a;
  --wood: #7c3f19;
  --panel: #efe7c8;
  --accent: #c5522b;
  --accent-dark: #8f341c;
  --blue: #0f9bd7;
  --green: #1f8f45;
  --text: #24160d;
  --button-bg: #dcd98a;
  --button-bg-hover: #d5d17f;
  --score-bg: #e3de93;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
}



.app {
  max-width: 1180px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 18px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 14px;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.2rem);
  letter-spacing: .02em;
}

.subtitle {
  margin: 6px 0 0;
  font-weight: 600;
}

.scoreboard {
  display: grid;
  grid-template-columns: repeat(3, minmax(105px, 1fr));
  gap: 10px;
}

.scoreboard div,
.best,
.panel,
.race-panel,
.photo-panel {
  border: 4px solid var(--wood);
  box-shadow: 0 4px 0 rgba(0,0,0,.2);
}

.scoreboard div {
  background: var(--score-bg);
  padding: 8px 12px;
  text-align: center;
}

.scoreboard span {
  display: block;
  font-weight: 700;
  font-size: .9rem;
}

.scoreboard strong {
  font-size: 1.5rem;
}

.panel {
  background: rgba(239, 231, 200, .94);
  padding: 22px;
  border-radius: 10px;
}

.notice {
  font-weight: 700;
  color: var(--accent-dark);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(240px, 1fr));
  gap: 16px;
  margin: 18px 0;
}

label {
  font-weight: 800;
}

input,
select {
  width: 100%;
  margin-top: 6px;
  padding: 11px 12px;
  font-size: 1rem;
  border: 2px solid var(--wood);
  border-radius: 6px;
  background: white;
}

button {
  border: 3px solid var(--accent);
  background: var(--button-bg);
  color: #111;
  padding: 10px 16px;
  font-weight: 900;
  border-radius: 7px;
  cursor: pointer;
  box-shadow: 0 3px 0 rgba(0,0,0,.25);
}

button:hover {
  background: var(--button-bg-hover);
  transform: translateY(-1px);
}

button:active {
  transform: translateY(1px);
  box-shadow: 0 1px 0 rgba(0,0,0,.25);
}

button.primary {
  background: #d38b50;
  color: #111;
}

button.primary:hover {
  background: #c97f43;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.best {
  display: inline-block;
  background: var(--score-bg);
  padding: 8px 12px;
  margin-top: 18px;
}

.game {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 22px;
  align-items: start;
}

.race-panel,
.photo-panel {
  background: rgba(239, 231, 200, .94);
  padding: 16px;
  border-radius: 10px;
}

.race-panel h2 {
  margin-top: 0;
}

.race-buttons {
  display: grid;
  grid-template-columns: repeat(2, minmax(130px, 1fr));
  gap: 9px;
}

.race-buttons button {
  padding: 8px 6px;
  min-height: 44px;
  font-size: .92rem;
}

.photo-panel {
  min-height: 600px;
  display: flex;
  flex-direction: column;
}

.status-line {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  min-height: 34px;
  font-weight: 900;
}

#message.ok {
  color: var(--green);
}

#message.error {
  color: var(--accent-dark);
}

.photo-frame {
  position: relative;
  flex: 1;
  min-height: 420px;
  border: 5px solid var(--wood);
  background: #dfc178;
  border-radius: 8px;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.photo-frame img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}

.image-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 30px;
  font-size: clamp(1.5rem, 4vw, 3rem);
  font-weight: 900;
  background:
    linear-gradient(135deg, rgba(255,255,255,.1), rgba(0,0,0,.08)),
    #dfc178;
}

.bottom-actions {
  margin-top: 14px;
  justify-content: center;
}

.hidden {
  display: none !important;
}

.result-summary {
  display: grid;
  gap: 8px;
  font-size: 1.15rem;
  margin: 15px 0 20px;
}

.api-result {
  background: #222;
  color: #e7ffe7;
  padding: 12px;
  overflow: auto;
  border-radius: 8px;
  min-height: 44px;
}

dialog {
  border: 4px solid var(--wood);
  border-radius: 10px;
  padding: 22px;
  max-width: 760px;
  width: min(94vw, 760px);
}

.online-scores {
  margin-top: 16px;
  overflow-x: auto;
}

.online-scores table {
  width: 100%;
  border-collapse: collapse;
}

.online-scores th,
.online-scores td {
  border-bottom: 1px solid #ddd;
  padding: 8px;
  text-align: left;
}

@media (max-width: 700px) {
  .topbar,
  .game {
    display: block;
  }

  .scoreboard {
    margin-top: 14px;
  }

  .race-panel {
    margin-bottom: 16px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }
}

.brand h1 {
  white-space: nowrap;
}

.credits {
  margin: 4px 0 0;
  font-size: .9rem;
  font-weight: 700;
  opacity: .78;
}

.penalty-info {
  border: 2px solid var(--wood);
  border-radius: 6px;
  background: rgba(255,255,255,.35);
  padding: 6px 10px;
  font-weight: 800;
  min-height: 34px;
  display: flex;
  align-items: center;
}
/* Version téléphone portrait : photo en haut, boutons dessous en 2 colonnes */
@media (max-width: 700px) and (orientation: portrait) {
  .app {
    padding: 8px;
  }

  .topbar {
    display: block;
    margin-bottom: 8px;
  }

  .brand h1 {
    font-size: 1.55rem;
    line-height: 1.05;
    white-space: normal;
  }

  .subtitle {
    font-size: .78rem;
  }

  .credits {
    font-size: .72rem;
  }

  .scoreboard {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 5px;
    margin-top: 8px;
  }

  .scoreboard div {
    padding: 5px 4px;
    border-width: 3px;
  }

  .scoreboard span {
    font-size: .62rem;
  }

  .scoreboard strong {
    font-size: .9rem;
  }

  .game {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .photo-panel {
    order: 1;
    min-height: auto;
    padding: 8px;
  }

  .race-panel {
    order: 2;
    padding: 8px;
    margin-bottom: 0;
  }

  .race-panel h2 {
    margin: 0 0 8px;
    font-size: 1.05rem;
  }

  .photo-frame {
    height: 38vh;
    min-height: 220px;
    border-width: 4px;
  }

  .photo-frame img {
    width: 100%;
    height: 100%;
    object-fit: contain;
  }

  .status-line {
    min-height: 24px;
    font-size: .8rem;
    margin-bottom: 5px;
  }

  .race-buttons {
    grid-template-columns: repeat(2, 1fr);
    gap: 5px;
  }

  .race-buttons button {
    min-height: 32px;
    padding: 4px 3px;
    font-size: .70rem;
    line-height: 1.05;
    border-width: 2px;
    border-radius: 5px;
  }

  .bottom-actions {
    margin-top: 8px;
    gap: 6px;
  }

  .bottom-actions button {
    padding: 6px 8px;
    font-size: .72rem;
    border-width: 2px;
  }
}
/* Les panneaux spéciaux mobile paysage sont cachés par défaut */
.mobile-landscape-races {
  display: none;
}

/* Mobile paysage : 10 races à gauche, photo au centre, 10 races à droite */
@media (max-width: 950px) and (max-height: 520px) and (orientation: landscape) {
  .app {
    max-width: none;
    padding: 3px 4px;
    min-height: 100svh;
  }

  .topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 5px;
    margin-bottom: 3px;
  }

  .brand h1 {
    font-size: .95rem;
    line-height: 1;
    white-space: nowrap;
  }

  .subtitle,
  .credits {
    display: none;
  }

  .scoreboard {
    display: grid;
    grid-template-columns: repeat(3, 52px);
    gap: 3px;
    margin-top: 0;
  }

  .scoreboard div {
    padding: 2px 3px;
    border-width: 2px;
    box-shadow: 0 2px 0 rgba(0,0,0,.2);
  }

  .scoreboard span {
    font-size: .48rem;
    line-height: 1;
  }

  .scoreboard strong {
    font-size: .72rem;
    line-height: 1.05;
  }

  .game {
    display: grid;
    grid-template-columns: 104px minmax(0, 1fr) 104px;
    gap: 3px;
    align-items: stretch;
  }

  .desktop-race-panel {
    display: none;
  }

  .mobile-landscape-races {
    display: block;
    background: rgba(239, 231, 200, .94);
    border: 2px solid var(--wood);
    border-radius: 5px;
    box-shadow: 0 2px 0 rgba(0,0,0,.2);
    padding: 3px;
    min-height: 0;
    overflow: hidden;
  }

  .mobile-landscape-left {
    grid-column: 1;
  }

  .photo-panel {
    grid-column: 2;
    min-height: 0;
    padding: 3px;
    border-width: 2px;
    border-radius: 5px;
    box-shadow: 0 2px 0 rgba(0,0,0,.2);
  }

  .mobile-landscape-right {
    grid-column: 3;
  }

.race-buttons-landscape {
  display: grid;
  grid-template-rows: repeat(10, minmax(0, 1fr));
  gap: 2px;
  height: 100%;
  min-height: 0;
}

.race-buttons-landscape button {
  min-height: 0;
  padding: 0 2px;
  font-size: .47rem;
  line-height: .88;
  border-width: 1px;
  border-radius: 3px;
  box-shadow: 0 1px 0 rgba(0,0,0,.2);
}

  .status-line {
    min-height: 14px;
    margin-bottom: 2px;
    font-size: .56rem;
    line-height: 1;
  }

  .photo-frame {
    height: calc(100svh - 76px);
    min-height: 135px;
    border-width: 2px;
    border-radius: 4px;
  }

  .photo-frame img {
    width: 100%;
    height: 100%;
    object-fit: contain;
  }

  .bottom-actions {
    margin-top: 2px;
    gap: 4px;
  }

  .bottom-actions button {
    padding: 2px 5px;
    font-size: .52rem;
    border-width: 2px;
    border-radius: 4px;
    box-shadow: 0 2px 0 rgba(0,0,0,.2);
  }
}

/* ── Mode apprentissage ────────────────────────────────────── */

button.learn {
  background: #4a9e6b;
  border-color: #2d7a4f;
  color: #fff;
}

button.learn:hover {
  background: #3d8a5c;
}

/* Bouton race maîtrisée (bonne réponse) */
button.learn-mastered {
  background: #1f8f45 !important;
  border-color: #155e2e !important;
  color: #fff !important;
  box-shadow: 0 3px 0 rgba(0,0,0,.3);
}

/* Bouton race ratée (mauvaise réponse — montre la bonne) */
button.learn-missed {
  background: #e07b20 !important;
  border-color: #a0551a !important;
  color: #fff !important;
  box-shadow: 0 3px 0 rgba(0,0,0,.3);
}

/* Badge "mode apprentissage" affiché pendant la partie */
.learn-badge {
  margin-top: 10px;
  text-align: center;
  font-weight: 800;
  font-size: .88rem;
  color: #2d7a4f;
  background: rgba(31, 143, 69, .12);
  border: 2px solid #2d7a4f;
  border-radius: 6px;
  padding: 5px 10px;
}

/* Bandeau révélation flottant sur la photo */
.learn-reveal {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 14px 18px;
  font-size: clamp(1rem, 2.5vw, 1.4rem);
  font-weight: 900;
  text-align: center;
  letter-spacing: .02em;
  pointer-events: none;
  transition: opacity .2s;
}

.learn-reveal-ok {
  background: rgba(31, 143, 69, .88);
  color: #fff;
}

.learn-reveal-error {
  background: rgba(197, 82, 43, .90);
  color: #fff;
}

/* Notice résultats mode apprentissage */
.learn-finish-notice {
  font-weight: 900;
  font-size: 1.1rem;
  color: #2d7a4f;
  background: rgba(31, 143, 69, .1);
  border: 2px solid #2d7a4f;
  border-radius: 6px;
  padding: 8px 12px;
}

/* Adaptation mobile portrait */
@media (max-width: 700px) and (orientation: portrait) {
  .learn-badge {
    font-size: .72rem;
    padding: 3px 6px;
    margin-top: 6px;
  }
}

/* Adaptation mobile paysage */
@media (max-width: 950px) and (max-height: 520px) and (orientation: landscape) {
  .learn-badge {
    font-size: .60rem;
    padding: 2px 5px;
  }
}
@keyframes flash-ok {
  0%   { background: #1f8f45; color: #fff; border-color: #1f8f45; }
  100% { background: var(--button-bg); color: #111; border-color: var(--accent); }
}

@keyframes flash-err {
  0%   { background: #c5522b; color: #fff; border-color: #8f341c; }
  100% { background: var(--button-bg); color: #111; border-color: var(--accent); }
}

button.flash-ok {
  animation: flash-ok 0.4s ease-out forwards;
}

button.flash-err {
  animation: flash-err 0.4s ease-out forwards;
}
/* Logo dans l'en-tête */
.brand {
  display: flex;
  align-items: center;
  gap: 22px;
  min-width: 0;
}

.brand-text {
  min-width: 0;
}

.header-logo {
  width: 150px;
  max-width: 20vw;
  height: auto;
  display: block;
}

/* Adaptation PC / vidéoprojecteur / écran 1366×768 */
@media (min-width: 901px) and (max-height: 780px) {
  .app {
    padding-top: 10px;
    padding-bottom: 10px;
  }

  .topbar {
    max-width: 980px;
    margin-left: auto;
    margin-right: auto;
    margin-bottom: 10px;
    align-items: center;
  }

  .brand {
    display: flex;
    align-items: center;
    gap: 18px;
  }

  .brand h1 {
    font-size: 2.15rem;
    line-height: 1.05;
  }

  .subtitle {
    margin-top: 4px;
    font-size: .86rem;
  }

  .credits {
    margin-top: 2px;
    font-size: .78rem;
  }

  .header-logo {
    width: 92px !important;
    max-width: 92px !important;
  }

  .scoreboard {
    grid-template-columns: repeat(3, 72px);
    gap: 6px;
  }

  .scoreboard div {
    padding: 5px 6px;
    border-width: 3px;
  }

  .scoreboard span {
    font-size: .68rem;
  }

  .scoreboard strong {
    font-size: 1rem;
  }

  .game {
    max-width: 980px;
    margin-left: auto;
    margin-right: auto;
    grid-template-columns: 260px 1fr;
    gap: 14px;
    align-items: start;
  }

  .race-panel,
  .photo-panel {
    padding: 10px;
    border-width: 3px;
  }

  .race-panel h2 {
    margin: 0 0 8px;
    font-size: 1.15rem;
  }

  .race-buttons {
    gap: 5px;
  }

  .race-buttons button {
    min-height: 32px;
    padding: 4px 5px;
    font-size: .72rem;
    line-height: 1.05;
    border-width: 2px;
  }

  .photo-panel {
    min-height: 0;
  }

  .status-line {
    min-height: 22px;
    margin-bottom: 4px;
    font-size: .78rem;
  }

  .photo-frame {
    height: min(52vh, 365px);
    min-height: 300px;
    border-width: 4px;
  }

  .photo-frame img {
    width: 100%;
    height: 100%;
    object-fit: contain;
  }

  .bottom-actions {
    margin-top: 8px;
    gap: 7px;
  }

  .bottom-actions button {
    padding: 6px 10px;
    font-size: .76rem;
    border-width: 2px;
  }

  .learn-badge {
    margin-top: 6px;
    padding: 3px 8px;
    font-size: .72rem;
  }
}
/* ── En-tête écran résultats : même grille que l'écran jeu ── */

body:has(#results:not(.hidden)) .topbar {
  max-width: 1120px;
  margin-left: auto;
  margin-right: auto;
  display: grid;
  grid-template-columns: 1fr 120px auto;
  align-items: center;
  gap: 22px;
  margin-bottom: 14px;
}

body:has(#results:not(.hidden)) .brand {
  display: contents;
}

body:has(#results:not(.hidden)) .brand-text {
  grid-column: 1;
}

body:has(#results:not(.hidden)) .header-logo {
  grid-column: 2;
  justify-self: center;
  width: 100px;
  max-width: 100px;
  height: auto;
}

body:has(#results:not(.hidden)) .scoreboard {
  grid-column: 3;
  justify-self: end;
}

/* Alignement général écran de jeu sur ordinateur */
@media (min-width: 901px) {
  body:has(#game:not(.hidden)) .topbar,
  body:has(#game:not(.hidden)) .game {
    max-width: 1120px;
    margin-left: auto;
    margin-right: auto;
  }

  body:has(#game:not(.hidden)) .topbar {
    display: grid;
    grid-template-columns: 1fr 120px auto;
    align-items: center;
    gap: 22px;
    margin-bottom: 14px;
  }

  body:has(#game:not(.hidden)) .brand {
    display: contents;
  }

  body:has(#game:not(.hidden)) .brand-text {
    grid-column: 1;
  }

  body:has(#game:not(.hidden)) .header-logo {
    grid-column: 2;
    justify-self: center;
    width: 100px;
    max-width: 100px;
    height: auto;
  }

  body:has(#game:not(.hidden)) .scoreboard {
    grid-column: 3;
    justify-self: end;
  }

  body:has(#game:not(.hidden)) .game {
    grid-template-columns: 340px 1fr;
    gap: 18px;
  }

  body:has(#game:not(.hidden)) .race-buttons {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
/* Adaptation PC / vidéoprojecteur / écran 1366×768 */
@media (min-width: 901px) and (max-height: 780px) {
  body:has(#game:not(.hidden)) .app {
    padding-top: 8px;
    padding-bottom: 8px;
  }

  body:has(#game:not(.hidden)) .topbar,
  body:has(#game:not(.hidden)) .game {
    max-width: 1060px;
  }

  body:has(#game:not(.hidden)) .topbar {
    grid-template-columns: 1fr 95px auto;
    gap: 16px;
    margin-bottom: 8px;
  }

  body:has(#game:not(.hidden)) h1 {
    font-size: 2.05rem;
    line-height: 1.05;
  }

  body:has(#game:not(.hidden)) .subtitle {
    margin-top: 3px;
    font-size: .84rem;
  }

  body:has(#game:not(.hidden)) .credits {
    margin-top: 1px;
    font-size: .76rem;
  }

  body:has(#game:not(.hidden)) .header-logo {
    width: 82px !important;
    max-width: 82px !important;
  }

  body:has(#game:not(.hidden)) .scoreboard {
    grid-template-columns: repeat(3, 72px);
    gap: 6px;
  }

  body:has(#game:not(.hidden)) .scoreboard div {
    padding: 5px 6px;
    border-width: 3px;
  }

  body:has(#game:not(.hidden)) .scoreboard span {
    font-size: .68rem;
  }

  body:has(#game:not(.hidden)) .scoreboard strong {
    font-size: 1rem;
  }

  body:has(#game:not(.hidden)) .game {
    grid-template-columns: 320px 1fr;
    gap: 14px;
  }

  body:has(#game:not(.hidden)) .race-panel,
  body:has(#game:not(.hidden)) .photo-panel {
    padding: 10px;
    border-width: 3px;
  }

  body:has(#game:not(.hidden)) .race-panel h2 {
    margin: 0 0 8px;
    font-size: 1.1rem;
  }

  body:has(#game:not(.hidden)) .race-buttons {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 5px;
  }

  body:has(#game:not(.hidden)) .race-buttons button {
    min-height: 32px;
    padding: 4px 4px;
    font-size: .70rem;
    line-height: 1.05;
    border-width: 2px;
  }

  body:has(#game:not(.hidden)) .photo-panel {
    min-height: 0;
  }

  body:has(#game:not(.hidden)) .status-line {
    min-height: 22px;
    margin-bottom: 4px;
    font-size: .78rem;
  }

  body:has(#game:not(.hidden)) .photo-frame {
    height: min(52vh, 365px);
    min-height: 300px;
    border-width: 4px;
  }

  body:has(#game:not(.hidden)) .photo-frame img {
    width: 100%;
    height: 100%;
    object-fit: contain;
  }

  body:has(#game:not(.hidden)) .bottom-actions {
    margin-top: 8px;
    gap: 7px;
  }

  body:has(#game:not(.hidden)) .bottom-actions button {
    padding: 6px 10px;
    font-size: .76rem;
    border-width: 2px;
  }

  body:has(#game:not(.hidden)) .learn-badge {
    margin-top: 6px;
    padding: 3px 8px;
    font-size: .72rem;
  }
}
/* Mobile paysage — bloc unique, sans doublons ni !important */
@media (max-width: 950px) and (max-height: 620px) and (orientation: landscape) {

  body:has(#game:not(.hidden)) .app {
    padding: 3px 4px;
    min-height: 100dvh; /* dvh = tient compte de la barre navigateur Android */
    overflow: hidden;
  }

  body:has(#game:not(.hidden)) .topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 48px auto;
    align-items: center;
    gap: 6px;
    margin-bottom: 3px;
  }

  body:has(#game:not(.hidden)) .brand {
    display: contents;
  }

  body:has(#game:not(.hidden)) .brand-text {
    grid-column: 1;
    min-width: 0;
  }

  body:has(#game:not(.hidden)) .brand h1 {
    font-size: .95rem;
    line-height: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  body:has(#game:not(.hidden)) .subtitle,
  body:has(#game:not(.hidden)) .credits {
    display: none;
  }

  body:has(#game:not(.hidden)) .header-logo {
    grid-column: 2;
    justify-self: center;
    width: 44px;
    max-width: 44px;
    height: auto;
  }

  body:has(#game:not(.hidden)) .scoreboard {
    grid-column: 3;
    display: grid;
    grid-template-columns: repeat(3, 54px);
    gap: 4px;
    justify-self: end;
  }

  body:has(#game:not(.hidden)) .scoreboard div {
    padding: 2px 3px;
    border-width: 2px;
    box-shadow: 0 2px 0 rgba(0,0,0,.2);
  }

  body:has(#game:not(.hidden)) .scoreboard span {
    font-size: .48rem;
    line-height: 1;
  }

  body:has(#game:not(.hidden)) .scoreboard strong {
    font-size: .72rem;
    line-height: 1.1;
  }

  body:has(#game:not(.hidden)) .game {
    display: grid;
    /* Marge gauche 12px pour éviter le panneau système Android */
    grid-template-columns: 104px minmax(0, 1fr) 104px;
    gap: 3px;
    align-items: stretch;
    padding-left: 12px;
  }

  body:has(#game:not(.hidden)) .desktop-race-panel {
    display: none;
  }

  body:has(#game:not(.hidden)) .mobile-landscape-races {
    display: flex;
    flex-direction: column;
    padding: 3px;
    border-width: 2px;
    border-radius: 5px;
    box-shadow: 0 2px 0 rgba(0,0,0,.2);
    min-height: 0;
    overflow: hidden;
  }

  body:has(#game:not(.hidden)) .race-buttons-landscape {
    display: grid;
    grid-template-rows: repeat(10, 1fr);
    gap: 2px;
    flex: 1;
    min-height: 0;
  }

  body:has(#game:not(.hidden)) .race-buttons-landscape button {
    min-height: 0;
    padding: 1px 2px;
    font-size: .52rem;
    line-height: .95;
    border-width: 2px;
    border-radius: 4px;
    box-shadow: 0 1px 0 rgba(0,0,0,.2);
  }

  body:has(#game:not(.hidden)) .photo-panel {
    min-height: 0;
    padding: 3px;
    border-width: 2px;
    border-radius: 5px;
    box-shadow: 0 2px 0 rgba(0,0,0,.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  body:has(#game:not(.hidden)) .status-line {
    min-height: 14px;
    margin-bottom: 2px;
    font-size: .56rem;
    line-height: 1;
  }

  body:has(#game:not(.hidden)) .photo-frame {
    /* dvh garantit que la barre navigateur Android est exclue */
    height: calc(100dvh - 82px);
    min-height: 135px;
    border-width: 2px;
    border-radius: 4px;
  }

  body:has(#game:not(.hidden)) .photo-frame img {
    width: 100%;
    height: 100%;
    object-fit: contain;
  }

  body:has(#game:not(.hidden)) .bottom-actions {
    margin-top: 2px;
    gap: 3px;
  }

  body:has(#game:not(.hidden)) .bottom-actions button {
    padding: 2px 5px;
    font-size: .52rem;
    border-width: 2px;
    border-radius: 4px;
  }

  body:has(#game:not(.hidden)) .learn-badge {
    margin-top: 2px;
    padding: 1px 4px;
    font-size: .50rem;
    line-height: 1;
  }
}
.game-credits-summary {
  margin-top: 18px;
  padding: 14px 16px;
  border: 2px dashed var(--wood);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.42);
}

.game-credits-summary h3 {
  margin: 0 0 6px;
  color: var(--accent-dark);
  font-size: 1.05rem;
}

.game-credits-summary p {
  margin: 0 0 10px;
  line-height: 1.35;
}

.game-credits-summary ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
}

.game-credits-summary li {
  padding: 9px 10px;
  border: 1px solid rgba(124, 63, 25, 0.35);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.55);
}

.game-credit-name {
  font-weight: 900;
  color: var(--accent-dark);
}

.game-credit-name a,
.all-contributors-link {
  color: var(--accent-dark);
  font-weight: 900;
  text-decoration: underline;
}

.game-credit-detail {
  margin-top: 3px;
  font-size: 0.88rem;
}

.all-contributors-link {
  display: inline-block;
  margin-top: 12px;
}
/* Scores groupés : une ligne par joueur + détail dépliable */
.grouped-scores-table {
  width: 100%;
  border-collapse: collapse;
}

.grouped-scores-table th,
.grouped-scores-table td {
  vertical-align: middle;
}

.score-toggle {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 2px solid var(--wood);
  background: var(--button-bg);
  font-weight: 900;
  cursor: pointer;
  line-height: 1;
}

.score-toggle:hover {
  background: var(--button-bg-hover);
}

.score-player-row td {
  border-bottom: 1px solid rgba(124, 63, 25, 0.28);
}

.score-details-row > td {
  padding: 0 0 10px;
  background: rgba(255, 255, 255, 0.38);
}

.score-details-box {
  margin: 6px 8px 10px 42px;
  padding: 10px;
  border: 1px solid rgba(124, 63, 25, 0.45);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.55);
}

.score-details-title {
  margin-bottom: 8px;
  font-weight: 900;
  color: var(--accent-dark);
}

.nested-scores-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.nested-scores-table th,
.nested-scores-table td {
  padding: 5px 6px;
  border-bottom: 1px solid rgba(124, 63, 25, 0.22);
}

.nested-scores-table th {
  text-align: left;
}

@media (max-width: 720px) {
  .score-details-box {
    margin-left: 0;
    overflow-x: auto;
  }

  .grouped-scores-table,
  .nested-scores-table {
    font-size: 0.85rem;
  }
}
/* Meilleurs scores : affichage groupé et plus lisible */
#scoresDialog {
  width: min(920px, calc(100vw - 28px));
  max-width: 920px;
}

#onlineScores {
  margin-top: 16px;
  overflow-x: auto;
}

.scores-table,
.grouped-scores-table,
.nested-scores-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-variant-numeric: tabular-nums;
}

.grouped-scores-table th,
.grouped-scores-table td {
  padding: 10px 9px;
  vertical-align: middle;
}

.grouped-scores-table thead th {
  color: var(--accent-dark);
  background: rgba(220, 217, 138, 0.45);
  border-top: 2px solid rgba(124, 63, 25, 0.35);
  border-bottom: 2px solid rgba(124, 63, 25, 0.35);
  text-align: left;
  font-weight: 900;
}

.score-player-row {
  background: rgba(255, 255, 255, 0.42);
}

.score-player-row:nth-child(4n + 1) {
  background: rgba(255, 255, 255, 0.62);
}

.score-player-row:hover,
.score-player-row.is-open {
  background: rgba(220, 217, 138, 0.55);
}

.score-player-row td {
  border-bottom: 1px solid rgba(124, 63, 25, 0.25);
}

.score-toggle-cell {
  width: 38px;
  text-align: center;
}

.score-toggle {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  border: 2px solid var(--wood);
  background: var(--button-bg);
  box-shadow: 2px 2px 0 rgba(124, 63, 25, 0.32);
  color: #111;
  font-weight: 900;
  cursor: pointer;
  line-height: 1;
}

.score-toggle:hover,
.score-toggle[aria-expanded="true"] {
  background: var(--button-bg-hover);
  transform: translateY(1px);
}

.score-rank {
  width: 34px;
  text-align: center;
  font-weight: 800;
}

.score-player-name {
  font-weight: 900;
}

.score-city {
  max-width: 170px;
}

.score-best {
  font-weight: 900;
  color: var(--accent-dark);
  white-space: nowrap;
}

.score-errors {
  text-align: center;
}

.score-date {
  white-space: nowrap;
  font-size: 0.92rem;
}

.score-history-badge {
  display: inline-block;
  padding: 4px 8px;
  border: 1px solid rgba(124, 63, 25, 0.45);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.65);
  font-weight: 800;
  white-space: nowrap;
}

.score-details-row > td {
  padding: 0 8px 12px 56px;
  background: rgba(255, 255, 255, 0.32);
  border-bottom: 1px solid rgba(124, 63, 25, 0.25);
}

.score-details-box {
  margin: 8px 0 10px;
  padding: 12px;
  border: 2px solid rgba(124, 63, 25, 0.38);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.72);
}

.score-details-title {
  margin-bottom: 8px;
  font-weight: 900;
  color: var(--accent-dark);
}

.nested-scores-table {
  font-size: 0.92rem;
}

.nested-scores-table th,
.nested-scores-table td {
  padding: 6px 8px;
  border-bottom: 1px solid rgba(124, 63, 25, 0.18);
  text-align: left;
}

.nested-scores-table thead th {
  background: rgba(220, 217, 138, 0.35);
  color: #111;
}

.nested-scores-table tbody tr:last-child td {
  border-bottom: 0;
}

@media (max-width: 720px) {
  #scoresDialog {
    width: calc(100vw - 18px);
    padding: 14px;
  }

  .grouped-scores-table th,
  .grouped-scores-table td {
    padding: 8px 6px;
  }

  .score-details-row > td {
    padding-left: 6px;
  }

  .grouped-scores-table,
  .nested-scores-table {
    font-size: 0.85rem;
  }

  .score-city {
    max-width: 120px;
  }
}

/* Pied de page discret : mentions légales */
.site-footer {
  max-width: 1120px;
  margin: 18px auto 8px;
  padding: 10px 0;
  text-align: center;
  font-size: .82rem;
  font-weight: 700;
  opacity: .82;
}

.site-footer a {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.site-footer a:hover {
  color: var(--accent-dark);
}

/* On évite d'encombrer l'écran pendant une partie ou sur les résultats */
body:has(#game:not(.hidden)) .site-footer,
body:has(#results:not(.hidden)) .site-footer {
  display: none;
}

@media (max-width: 700px) {
  .site-footer {
    font-size: .74rem;
    margin-top: 12px;
  }
}


/* ─────────────────────────────────────────────────────────────
   Correctif mobile jeu : boutons races centrés en portrait
   et affichage complet des 20 boutons en paysage/PWA.
   ───────────────────────────────────────────────────────────── */

@media (max-width: 700px) and (orientation: portrait) {
  body:has(#game:not(.hidden)) .game {
    align-items: center;
  }

  body:has(#game:not(.hidden)) .race-panel {
    width: min(100%, 680px);
    margin-left: auto;
    margin-right: auto;
  }

  body:has(#game:not(.hidden)) .race-buttons {
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    justify-items: stretch;
  }

  body:has(#game:not(.hidden)) .race-buttons button {
    width: 100%;
    text-align: center;
  }
}

@media (max-width: 950px) and (max-height: 620px) and (orientation: landscape) {
  body:has(#game:not(.hidden)) {
    overflow: hidden;
  }

  body:has(#game:not(.hidden)) .app {
    padding: 2px 3px;
    min-height: 100dvh;
    height: 100dvh;
    overflow: hidden;
  }

  body:has(#game:not(.hidden)) .topbar {
    display: none !important;
  }

  body:has(#game:not(.hidden)) .game {
    height: calc(100dvh - 4px);
    max-height: calc(100dvh - 4px);
    grid-template-columns: 98px minmax(0, 1fr) 98px;
    gap: 3px;
    padding-left: max(3px, env(safe-area-inset-left));
    padding-right: max(3px, env(safe-area-inset-right));
    align-items: stretch;
    overflow: hidden;
  }

  body:has(#game:not(.hidden)) .mobile-landscape-races,
  body:has(#game:not(.hidden)) .photo-panel {
    height: 100%;
    max-height: 100%;
    min-height: 0;
    box-sizing: border-box;
  }

  body:has(#game:not(.hidden)) .mobile-landscape-races {
    padding: 3px;
    border-width: 2px;
    overflow: hidden;
  }

  body:has(#game:not(.hidden)) .race-buttons-landscape {
    height: 100%;
    grid-template-rows: repeat(10, minmax(0, 1fr));
    gap: 2px;
  }

  body:has(#game:not(.hidden)) .race-buttons-landscape button {
    width: 100%;
    min-width: 0;
    min-height: 0;
    height: 100%;
    padding: 0 2px;
    font-size: clamp(.44rem, 1.55vw, .58rem);
    line-height: .95;
    border-width: 2px;
    border-radius: 4px;
    white-space: normal;
    overflow: hidden;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  body:has(#game:not(.hidden)) .photo-panel {
    padding: 3px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  body:has(#game:not(.hidden)) .status-line {
    flex: 0 0 auto;
    min-height: 16px;
    margin-bottom: 3px;
    font-size: .58rem;
  }

  body:has(#game:not(.hidden)) .photo-frame {
    flex: 1 1 auto;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
  }

  body:has(#game:not(.hidden)) .bottom-actions,
  body:has(#game:not(.hidden)) .learn-badge {
    display: none !important;
  }
}

/* Très petits paysages : on serre encore les colonnes de réponses. */
@media (max-width: 780px) and (max-height: 430px) and (orientation: landscape) {
  body:has(#game:not(.hidden)) .game {
    grid-template-columns: 86px minmax(0, 1fr) 86px;
  }

  body:has(#game:not(.hidden)) .race-buttons-landscape button {
    font-size: clamp(.39rem, 1.45vw, .52rem);
    line-height: .9;
    border-width: 1px;
    border-radius: 3px;
  }
}


/* ─────────────────────────────────────────────────────────────
   v paysage mobile — essai 2
   Base conservée : accueil mobile raccourci + 20 boutons visibles.
   Objectif : photo non déformée + petit bandeau score visible.
   ───────────────────────────────────────────────────────────── */
@media (max-width: 950px) and (max-height: 620px) and (orientation: landscape) {
  body:has(#game:not(.hidden)) {
    overflow: hidden;
  }

  body:has(#game:not(.hidden)) .app {
    display: grid !important;
    grid-template-rows: 20px minmax(0, 1fr) !important;
    gap: 2px !important;
    height: 100dvh !important;
    min-height: 100dvh !important;
    padding: 2px 3px !important;
    overflow: hidden !important;
  }

  /* On garde uniquement les compteurs : pas de titre/logo en paysage jeu. */
  body:has(#game:not(.hidden)) .topbar {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    height: 20px !important;
    min-height: 20px !important;
    margin: 0 !important;
    padding: 0 !important;
    gap: 0 !important;
    overflow: hidden !important;
  }

  body:has(#game:not(.hidden)) .brand {
    display: none !important;
  }

  body:has(#game:not(.hidden)) .scoreboard {
    display: grid !important;
    grid-template-columns: repeat(3, auto) !important;
    gap: 4px !important;
    margin: 0 !important;
    width: auto !important;
    max-width: 100% !important;
  }

  body:has(#game:not(.hidden)) .scoreboard div {
    display: flex !important;
    align-items: baseline !important;
    justify-content: center !important;
    gap: 3px !important;
    min-width: 54px !important;
    padding: 1px 5px !important;
    border-width: 2px !important;
    border-radius: 5px !important;
    box-shadow: none !important;
    background: rgba(220, 217, 138, .92) !important;
    line-height: 1 !important;
  }

  body:has(#game:not(.hidden)) .scoreboard span {
    display: inline !important;
    font-size: .48rem !important;
    line-height: 1 !important;
  }

  body:has(#game:not(.hidden)) .scoreboard strong {
    display: inline !important;
    font-size: .62rem !important;
    line-height: 1 !important;
  }

  body:has(#game:not(.hidden)) .game {
    height: 100% !important;
    max-height: 100% !important;
    min-height: 0 !important;
    display: grid !important;
    grid-template-columns: 92px minmax(0, 1fr) 92px !important;
    gap: 3px !important;
    padding-left: max(3px, env(safe-area-inset-left)) !important;
    padding-right: max(3px, env(safe-area-inset-right)) !important;
    align-items: stretch !important;
    overflow: hidden !important;
  }

  body:has(#game:not(.hidden)) .desktop-race-panel {
    display: none !important;
  }

  body:has(#game:not(.hidden)) .mobile-landscape-races,
  body:has(#game:not(.hidden)) .photo-panel {
    height: 100% !important;
    max-height: 100% !important;
    min-height: 0 !important;
    box-sizing: border-box !important;
  }

  body:has(#game:not(.hidden)) .mobile-landscape-races {
    display: flex !important;
    flex-direction: column !important;
    padding: 2px !important;
    border-width: 2px !important;
    border-radius: 5px !important;
    overflow: hidden !important;
  }

  body:has(#game:not(.hidden)) .race-buttons-landscape {
    height: 100% !important;
    min-height: 0 !important;
    display: grid !important;
    grid-template-rows: repeat(10, minmax(0, 1fr)) !important;
    gap: 2px !important;
  }

  body:has(#game:not(.hidden)) .race-buttons-landscape button {
    width: 100% !important;
    height: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    padding: 0 2px !important;
    font-size: clamp(.42rem, 1.45vw, .55rem) !important;
    line-height: .92 !important;
    border-width: 2px !important;
    border-radius: 4px !important;
    white-space: normal !important;
    overflow: hidden !important;
    text-align: center !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  body:has(#game:not(.hidden)) .photo-panel {
    display: grid !important;
    grid-template-rows: auto minmax(0, 1fr) !important;
    padding: 3px !important;
    border-width: 2px !important;
    border-radius: 5px !important;
    overflow: hidden !important;
  }

  body:has(#game:not(.hidden)) .status-line {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 8px !important;
    min-height: 16px !important;
    max-height: 18px !important;
    margin: 0 0 3px !important;
    padding: 0 2px !important;
    font-size: clamp(.50rem, 1.28vw, .64rem) !important;
    line-height: 1.05 !important;
    overflow: hidden !important;
  }

  body:has(#game:not(.hidden)) .status-line span {
    min-width: 0 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  body:has(#game:not(.hidden)) .photo-frame {
    width: 100% !important;
    height: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    max-width: 100% !important;
    max-height: 100% !important;
    display: grid !important;
    place-items: center !important;
    overflow: hidden !important;
    background: #dfc178 !important;
  }

  /* Important : width + height à 100% + object-fit: contain conserve le ratio.
     Cela évite toute déformation et toute coupe volontaire de l'image. */
  body:has(#game:not(.hidden)) .photo-frame img,
  body:has(#game:not(.hidden)) #cowImage {
    position: static !important;
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: contain !important;
    object-position: center center !important;
    background: #dfc178 !important;
  }

  body:has(#game:not(.hidden)) .bottom-actions,
  body:has(#game:not(.hidden)) .learn-badge {
    display: none !important;
  }
}

@media (max-width: 780px) and (max-height: 430px) and (orientation: landscape) {
  body:has(#game:not(.hidden)) .game {
    grid-template-columns: 82px minmax(0, 1fr) 82px !important;
  }

  body:has(#game:not(.hidden)) .race-buttons-landscape button {
    font-size: clamp(.37rem, 1.35vw, .49rem) !important;
    line-height: .88 !important;
    border-width: 1px !important;
    border-radius: 3px !important;
  }

  body:has(#game:not(.hidden)) .scoreboard div {
    min-width: 48px !important;
    padding-left: 4px !important;
    padding-right: 4px !important;
  }
}


/* ─────────────────────────────────────────────────────────────
   Essai 4 — bandeau supérieur façon application sur l'accueil
   - logo à gauche
   - titre + sous-titre dans le bandeau
   - boutons Encyclopédie / Mode classe à droite
   - conservation des menus déroulants sur ordinateur
   - conservation des boutons horizontaux scrollables sur mobile
   ───────────────────────────────────────────────────────────── */

.header-actions {
  display: none;
}

.header-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 7px 16px;
  border: 2px solid rgba(255, 255, 255, .82);
  border-radius: 7px;
  background: rgba(255, 255, 255, .16);
  color: #fff8e8;
  font-weight: 900;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
}

.header-link:hover {
  background: rgba(255, 255, 255, .28);
  transform: translateY(-1px);
}

/* ─────────────────────────────────────────────────────────────
   Bandeau commun des pages publiques
   Utilisé par l'accueil, l'encyclopédie, les contributeurs et
   les mentions légales. Les règles propres aux états du jeu
   restent plus bas dans ce fichier.
   ───────────────────────────────────────────────────────────── */
.topbar.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
  padding: 12px 18px;
  background: linear-gradient(135deg, #bd7c28, #d19a37);
  border: 3px solid var(--wood);
  border-radius: 12px;
  box-shadow: 0 4px 0 rgba(0,0,0,.16);
}

.topbar.app-header .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: #fff8e8;
}

.topbar.app-header .header-logo {
  width: 46px;
  max-width: 46px;
  height: auto;
  display: block;
  flex: 0 0 auto;
  filter: drop-shadow(0 1px 0 rgba(0,0,0,.18));
}

.topbar.app-header .brand-text {
  min-width: 0;
}

.topbar.app-header h1 {
  margin: 0;
  color: #fff8e8;
  font-size: clamp(1.15rem, 2vw, 1.55rem);
  line-height: 1.05;
  letter-spacing: 0;
  white-space: nowrap;
  text-shadow: 0 1px 0 rgba(0,0,0,.18);
}

.topbar.app-header .subtitle {
  margin: 2px 0 0;
  color: #fff8e8;
  font-size: .78rem;
  font-weight: 800;
  line-height: 1.1;
  opacity: .96;
}

.topbar.app-header .header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-left: auto;
  flex: 0 0 auto;
}

.topbar.app-header .header-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 7px 16px;
  border: 2px solid rgba(255, 255, 255, .82);
  border-radius: 7px;
  background: rgba(255, 255, 255, .16);
  color: #fff8e8;
  font-weight: 900;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
}

.topbar.app-header .header-link:hover {
  background: rgba(255, 255, 255, .28);
  transform: translateY(-1px);
}

.label-mobile {
  display: none;
}

@media (max-width: 760px) {
  .topbar.app-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    padding: 9px 10px;
    border-width: 2px;
    border-radius: 11px;
  }

  .topbar.app-header .brand {
    gap: 7px;
    width: 100%;
  }

  .topbar.app-header .header-logo {
    width: 34px;
    max-width: 34px;
  }

  .topbar.app-header h1 {
    font-size: 1.02rem;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .topbar.app-header .subtitle {
    font-size: .62rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .topbar.app-header .header-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
    width: 100%;
    margin-left: 0;
  }

  .topbar.app-header .header-link {
    min-height: 30px;
    padding: 6px 7px;
    border-width: 1.5px;
    border-radius: 7px;
    font-size: .76rem;
  }

  .label-full,
  .label-desktop {
    display: none;
  }

  .label-mobile {
    display: inline;
  }
}

@media (max-width: 950px) and (max-height: 620px) and (orientation: landscape) {
  .topbar.app-header {
    padding: 7px 10px;
    gap: 10px;
    border-width: 2px;
    margin-bottom: 10px;
  }

  .topbar.app-header .header-logo {
    width: 32px;
    max-width: 32px;
  }

  .topbar.app-header h1 {
    font-size: .96rem;
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .topbar.app-header .subtitle {
    display: none;
  }

  .topbar.app-header .header-actions {
    gap: 7px;
  }

  .topbar.app-header .header-link {
    min-height: 28px;
    padding: 5px 10px;
    border-width: 1.5px;
    font-size: .76rem;
  }
}

@media (max-width: 430px) {
  .topbar.app-header .subtitle {
    display: none;
  }

  .topbar.app-header .header-link {
    font-size: .72rem;
    padding-left: 5px;
    padding-right: 5px;
  }
}

/* Accueil : bandeau commun au-dessus du panneau Joueur */

/* ─────────────────────────────────────────────────────────────
   Essai 6 — écran de jeu ordinateur harmonisé
   Objectif : supprimer l'ancien en-tête dispersé pendant la partie,
   garder un bandeau compact façon application avec compteurs intégrés.
   Mobile portrait/paysage : on conserve les réglages existants.
   ───────────────────────────────────────────────────────────── */

@media (min-width: 901px) and (min-height: 621px) {
  body:has(#game:not(.hidden)) .app {
    max-width: 1240px !important;
    padding-top: 18px !important;
    padding-bottom: 18px !important;
  }

  body:has(#game:not(.hidden)) .topbar.app-header {
    width: min(100%, 1120px) !important;
    max-width: 1120px !important;
    margin: 0 auto 12px !important;
    padding: 10px 14px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 16px !important;
    background: linear-gradient(135deg, #bd7c28, #d19a37) !important;
    border: 3px solid var(--wood) !important;
    border-radius: 12px !important;
    box-shadow: 0 4px 0 rgba(0,0,0,.16) !important;
  }

  body:has(#game:not(.hidden)) .topbar.app-header .brand {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 10px !important;
    width: auto !important;
    min-width: 0 !important;
    color: #fff8e8 !important;
  }

  body:has(#game:not(.hidden)) .topbar.app-header .header-logo {
    order: 0 !important;
    position: static !important;
    justify-self: auto !important;
    width: 46px !important;
    max-width: 46px !important;
    height: auto !important;
    flex: 0 0 auto !important;
    filter: drop-shadow(0 1px 0 rgba(0,0,0,.18));
  }

  body:has(#game:not(.hidden)) .topbar.app-header .brand-text {
    min-width: 0 !important;
  }

  body:has(#game:not(.hidden)) .topbar.app-header h1 {
    margin: 0 !important;
    color: #fff8e8 !important;
    font-size: clamp(1.15rem, 2vw, 1.55rem) !important;
    line-height: 1.05 !important;
    white-space: nowrap !important;
    letter-spacing: 0 !important;
    text-shadow: 0 1px 0 rgba(0,0,0,.18);
  }

  body:has(#game:not(.hidden)) .topbar.app-header .subtitle {
    display: block !important;
    margin: 2px 0 0 !important;
    color: #fff8e8 !important;
    font-size: .76rem !important;
    font-weight: 800 !important;
    line-height: 1.1 !important;
    opacity: .96 !important;
  }

  body:has(#game:not(.hidden)) .topbar.app-header .credits,
  body:has(#game:not(.hidden)) .topbar.app-header .header-actions {
    display: none !important;
  }

  body:has(#game:not(.hidden)) .topbar.app-header .scoreboard {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(92px, auto)) !important;
    gap: 8px !important;
    margin: 0 !important;
    flex: 0 0 auto !important;
    justify-self: auto !important;
  }

  body:has(#game:not(.hidden)) .topbar.app-header .scoreboard div {
    min-width: 92px !important;
    padding: 6px 10px !important;
    border: 2px solid rgba(124, 63, 25, .75) !important;
    border-radius: 8px !important;
    background: rgba(239, 231, 200, .92) !important;
    box-shadow: none !important;
    text-align: center !important;
  }

  body:has(#game:not(.hidden)) .topbar.app-header .scoreboard span {
    display: block !important;
    color: #5a2a12 !important;
    font-size: .66rem !important;
    font-weight: 900 !important;
    line-height: 1 !important;
    text-transform: uppercase !important;
    letter-spacing: .02em !important;
  }

  body:has(#game:not(.hidden)) .topbar.app-header .scoreboard strong {
    display: block !important;
    margin-top: 3px !important;
    color: #24160d !important;
    font-size: 1.12rem !important;
    line-height: 1 !important;
  }

  body:has(#game:not(.hidden)) .game {
    width: min(100%, 1120px) !important;
    max-width: 1120px !important;
    margin: 0 auto !important;
    display: grid !important;
    grid-template-columns: 330px minmax(0, 1fr) !important;
    gap: 16px !important;
    align-items: stretch !important;
  }

  body:has(#game:not(.hidden)) .race-panel,
  body:has(#game:not(.hidden)) .photo-panel {
    border-width: 3px !important;
    border-radius: 10px !important;
    box-shadow: 0 3px 0 rgba(0,0,0,.18) !important;
    background: rgba(239, 231, 200, .94) !important;
  }

  body:has(#game:not(.hidden)) .race-panel {
    padding: 12px !important;
  }

  body:has(#game:not(.hidden)) .race-panel h2 {
    margin: 0 0 12px !important;
    font-size: 1.32rem !important;
    line-height: 1.1 !important;
  }

  body:has(#game:not(.hidden)) .race-buttons {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
  }

  body:has(#game:not(.hidden)) .race-buttons button {
    min-height: 42px !important;
    padding: 7px 6px !important;
    font-size: .86rem !important;
    line-height: 1.05 !important;
    border-width: 2px !important;
    border-radius: 7px !important;
  }

  body:has(#game:not(.hidden)) .photo-panel {
    min-height: 0 !important;
    padding: 12px !important;
    display: flex !important;
    flex-direction: column !important;
  }

  body:has(#game:not(.hidden)) .status-line {
    min-height: 24px !important;
    margin-bottom: 8px !important;
    font-size: .92rem !important;
    line-height: 1.2 !important;
  }

  body:has(#game:not(.hidden)) .photo-frame {
    flex: 1 1 auto !important;
    height: min(58vh, 520px) !important;
    min-height: 360px !important;
    border-width: 4px !important;
    border-radius: 8px !important;
  }

  body:has(#game:not(.hidden)) .photo-frame img,
  body:has(#game:not(.hidden)) #cowImage {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
    object-position: center center !important;
  }

  body:has(#game:not(.hidden)) .bottom-actions {
    margin-top: 12px !important;
    gap: 10px !important;
    justify-content: center !important;
  }

  body:has(#game:not(.hidden)) .bottom-actions button {
    padding: 8px 14px !important;
    font-size: .86rem !important;
    border-width: 2px !important;
    border-radius: 7px !important;
    box-shadow: 0 2px 0 rgba(0,0,0,.18) !important;
  }
}

/* PC / vidéoprojecteur : on serre un peu pour tenir correctement en 1366×768. */
@media (min-width: 901px) and (min-height: 621px) and (max-height: 780px) {
  body:has(#game:not(.hidden)) .app {
    padding-top: 10px !important;
    padding-bottom: 10px !important;
  }

  body:has(#game:not(.hidden)) .topbar.app-header {
    margin-bottom: 10px !important;
    padding: 8px 12px !important;
  }

  body:has(#game:not(.hidden)) .topbar.app-header .header-logo {
    width: 40px !important;
    max-width: 40px !important;
  }

  body:has(#game:not(.hidden)) .topbar.app-header h1 {
    font-size: 1.35rem !important;
  }

  body:has(#game:not(.hidden)) .topbar.app-header .subtitle {
    font-size: .70rem !important;
  }

  body:has(#game:not(.hidden)) .topbar.app-header .scoreboard div {
    min-width: 82px !important;
    padding: 5px 8px !important;
  }

  body:has(#game:not(.hidden)) .topbar.app-header .scoreboard strong {
    font-size: 1rem !important;
  }

  body:has(#game:not(.hidden)) .game {
    grid-template-columns: 300px minmax(0, 1fr) !important;
    gap: 14px !important;
  }

  body:has(#game:not(.hidden)) .race-panel,
  body:has(#game:not(.hidden)) .photo-panel {
    padding: 10px !important;
  }

  body:has(#game:not(.hidden)) .race-panel h2 {
    margin-bottom: 8px !important;
    font-size: 1.15rem !important;
  }

  body:has(#game:not(.hidden)) .race-buttons {
    gap: 6px !important;
  }

  body:has(#game:not(.hidden)) .race-buttons button {
    min-height: 34px !important;
    padding: 5px 5px !important;
    font-size: .74rem !important;
  }

  body:has(#game:not(.hidden)) .status-line {
    min-height: 20px !important;
    margin-bottom: 6px !important;
    font-size: .80rem !important;
  }

  body:has(#game:not(.hidden)) .photo-frame {
    height: min(54vh, 385px) !important;
    min-height: 315px !important;
  }

  body:has(#game:not(.hidden)) .bottom-actions {
    margin-top: 8px !important;
  }

  body:has(#game:not(.hidden)) .bottom-actions button {
    padding: 6px 10px !important;
    font-size: .76rem !important;
  }
}

/* ─────────────────────────────────────────────────────────────
   v7 — écran de fin de partie harmonisé, surtout mobile portrait
   ───────────────────────────────────────────────────────────── */

body:has(#results:not(.hidden)) .app {
  max-width: 1120px !important;
  padding-top: 18px !important;
  padding-bottom: 18px !important;
}

body:has(#results:not(.hidden)) .topbar.app-header {
  width: min(100%, 860px) !important;
  max-width: 860px !important;
  margin: 0 auto !important;
  padding: 12px 18px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 18px !important;
  background: linear-gradient(135deg, #bd7c28, #d19a37) !important;
  border: 3px solid var(--wood) !important;
  border-bottom-width: 0 !important;
  border-radius: 12px 12px 0 0 !important;
  box-shadow: 0 4px 0 rgba(0,0,0,.16) !important;
}

body:has(#results:not(.hidden)) .topbar.app-header .brand {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 10px !important;
  width: auto !important;
  min-width: 0 !important;
  color: #fff8e8 !important;
}

body:has(#results:not(.hidden)) .topbar.app-header .header-logo {
  order: 0 !important;
  position: static !important;
  justify-self: auto !important;
  width: 46px !important;
  max-width: 46px !important;
  height: auto !important;
  flex: 0 0 auto !important;
  filter: drop-shadow(0 1px 0 rgba(0,0,0,.18));
}

body:has(#results:not(.hidden)) .topbar.app-header .brand-text {
  min-width: 0 !important;
}

body:has(#results:not(.hidden)) .topbar.app-header h1 {
  margin: 0 !important;
  color: #fff8e8 !important;
  font-size: clamp(1.15rem, 2vw, 1.55rem) !important;
  line-height: 1.05 !important;
  white-space: nowrap !important;
  letter-spacing: 0 !important;
  text-shadow: 0 1px 0 rgba(0,0,0,.18);
}

body:has(#results:not(.hidden)) .topbar.app-header .subtitle {
  display: block !important;
  margin: 2px 0 0 !important;
  color: #fff8e8 !important;
  font-size: .76rem !important;
  font-weight: 800 !important;
  line-height: 1.1 !important;
  opacity: .96 !important;
}

body:has(#results:not(.hidden)) .topbar.app-header .credits,
body:has(#results:not(.hidden)) .topbar.app-header .scoreboard {
  display: none !important;
}

body:has(#results:not(.hidden)) .topbar.app-header .header-actions {
  display: flex !important;
  flex-wrap: wrap !important;
  justify-content: flex-end !important;
  gap: 10px !important;
}

body:has(#results:not(.hidden)) #results.results-panel {
  width: min(100%, 860px) !important;
  max-width: 860px !important;
  margin: 0 auto !important;
  padding: 22px 26px 24px !important;
  border-width: 3px !important;
  border-top-width: 0 !important;
  border-radius: 0 0 12px 12px !important;
  box-shadow: 0 4px 0 rgba(0,0,0,.16) !important;
  background: rgba(239, 231, 200, .96) !important;
}

body:has(#results:not(.hidden)) #results h2 {
  margin: 0 0 14px !important;
  color: var(--accent-dark) !important;
  font-size: 1.7rem !important;
  line-height: 1.1 !important;
}

.result-summary {
  display: grid !important;
  gap: 12px !important;
  margin: 0 0 18px !important;
}

.result-hero {
  padding: 16px 18px !important;
  border: 2px solid rgba(124, 63, 25, .55) !important;
  border-radius: 12px !important;
  background: linear-gradient(135deg, rgba(211, 139, 80, .20), rgba(220, 217, 138, .62)) !important;
  text-align: center !important;
}

.result-hero-training {
  background: linear-gradient(135deg, rgba(31, 143, 69, .14), rgba(220, 217, 138, .58)) !important;
}

.result-kicker {
  color: var(--accent-dark) !important;
  font-size: .78rem !important;
  font-weight: 900 !important;
  letter-spacing: .04em !important;
  text-transform: uppercase !important;
}

.result-main {
  margin-top: 4px !important;
  font-size: clamp(2rem, 6vw, 3.2rem) !important;
  font-weight: 950 !important;
  line-height: 1 !important;
  color: #24160d !important;
}

.result-sub {
  margin-top: 7px !important;
  font-weight: 800 !important;
  color: #5a2a12 !important;
}

.result-player {
  padding: 9px 12px !important;
  border: 1px solid rgba(124, 63, 25, .35) !important;
  border-radius: 9px !important;
  background: rgba(255,255,255,.42) !important;
  font-weight: 900 !important;
  color: #5a2a12 !important;
}

.result-metrics {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: 10px !important;
}

.result-metric {
  min-width: 0 !important;
  padding: 10px 11px !important;
  border: 1px solid rgba(124, 63, 25, .38) !important;
  border-radius: 10px !important;
  background: rgba(255,255,255,.50) !important;
}

.result-metric span {
  display: block !important;
  color: #7c3f19 !important;
  font-size: .76rem !important;
  font-weight: 900 !important;
  line-height: 1.05 !important;
}

.result-metric strong {
  display: block !important;
  margin-top: 4px !important;
  color: #24160d !important;
  font-size: 1.02rem !important;
  line-height: 1.15 !important;
  overflow-wrap: anywhere !important;
}

.result-metric-wide {
  grid-column: span 2 !important;
}

body:has(#results:not(.hidden)) #results .actions {
  display: grid !important;
  grid-template-columns: 1.35fr 1fr 1fr 1fr !important;
  gap: 10px !important;
  align-items: stretch !important;
}

body:has(#results:not(.hidden)) #results .actions button {
  width: 100% !important;
  min-height: 40px !important;
  padding: 8px 11px !important;
  border-width: 2px !important;
  border-radius: 8px !important;
  box-shadow: 0 2px 0 rgba(0,0,0,.18) !important;
  line-height: 1.1 !important;
}

body:has(#results:not(.hidden)) #sendScoreBtn {
  background: #d85a2a !important;
  color: #fff8e8 !important;
}

#sendResult:empty {
  display: none !important;
}

body:has(#results:not(.hidden)) #sendResult {
  margin-top: 14px !important;
}

@media (max-width: 700px) and (orientation: portrait) {
  body:has(#results:not(.hidden)) .app {
    max-width: none !important;
    padding: 8px !important;
  }

  body:has(#results:not(.hidden)) .topbar.app-header {
    width: 100% !important;
    max-width: none !important;
    padding: 10px 12px !important;
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 8px !important;
  }

  body:has(#results:not(.hidden)) .topbar.app-header .brand {
    justify-content: center !important;
    gap: 8px !important;
    text-align: left !important;
  }

  body:has(#results:not(.hidden)) .topbar.app-header .header-logo {
    width: 36px !important;
    max-width: 36px !important;
  }

  body:has(#results:not(.hidden)) .topbar.app-header h1 {
    font-size: 1.14rem !important;
  }

  body:has(#results:not(.hidden)) .topbar.app-header .subtitle {
    font-size: .64rem !important;
  }

  body:has(#results:not(.hidden)) .topbar.app-header .header-actions {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
    width: 100% !important;
  }

  body:has(#results:not(.hidden)) .topbar.app-header .header-link {
    min-height: 32px !important;
    padding: 6px 8px !important;
    font-size: .78rem !important;
  }

  body:has(#results:not(.hidden)) #results.results-panel {
    width: 100% !important;
    max-width: none !important;
    padding: 14px 14px 16px !important;
  }

  body:has(#results:not(.hidden)) #results h2 {
    display: none !important;
  }

  .result-summary {
    gap: 9px !important;
    margin-bottom: 12px !important;
  }

  .result-hero {
    padding: 14px 12px !important;
    border-radius: 10px !important;
  }

  .result-kicker {
    font-size: .68rem !important;
  }

  .result-main {
    font-size: 2.4rem !important;
  }

  .result-hero-training .result-main {
    font-size: 1.8rem !important;
  }

  .result-sub {
    font-size: .86rem !important;
  }

  .result-player {
    padding: 8px 10px !important;
    font-size: .86rem !important;
    line-height: 1.15 !important;
  }

  .result-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
  }

  .result-metric {
    padding: 8px 9px !important;
    border-radius: 8px !important;
  }

  .result-metric span {
    font-size: .66rem !important;
  }

  .result-metric strong {
    font-size: .88rem !important;
  }

  .result-metric-wide {
    grid-column: 1 / -1 !important;
  }

  body:has(#results:not(.hidden)) #results .actions {
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
  }

  body:has(#results:not(.hidden)) #sendScoreBtn,
  body:has(#results:not(.hidden)) #showScoresAfterGameBtn {
    grid-column: 1 / -1 !important;
  }

  body:has(#results:not(.hidden)) #results .actions button {
    min-height: 42px !important;
    padding: 8px 7px !important;
    font-size: .86rem !important;
  }

  body:has(#results:not(.hidden)) #sendResult {
    max-height: 120px !important;
    margin-top: 10px !important;
    padding: 8px !important;
    font-size: .70rem !important;
  }
}

@media (max-width: 370px) and (orientation: portrait) {
  .result-main {
    font-size: 2.1rem !important;
  }

  .result-hero-training .result-main {
    font-size: 1.55rem !important;
  }

  body:has(#results:not(.hidden)) .topbar.app-header h1 {
    font-size: 1.02rem !important;
  }

  body:has(#results:not(.hidden)) .topbar.app-header .subtitle {
    display: none !important;
  }
}

/* ─────────────────────────────────────────────────────────────
   Défi v1.21.42 — entête commun harmonisé
   - navigation homogène ;
   - bouton actif clairement visible ;
   - variante compacte pour les pages de jeu.
   ───────────────────────────────────────────────────────────── */
.topbar.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border: 3px solid #7a3f1e;
  border-radius: 12px;
  background: linear-gradient(180deg, #c9943d, #bd8732);
  box-shadow: 0 5px 0 rgba(70, 37, 18, .18);
}

.topbar.app-header .brand {
  min-width: 0;
}

.topbar.app-header .header-logo {
  flex: 0 0 auto;
}

.topbar.app-header h1 {
  color: #fff8e3;
  letter-spacing: -.02em;
  text-shadow: 0 2px 0 rgba(55, 27, 12, .22);
}

.topbar.app-header .subtitle,
.topbar.app-header .credits {
  color: #fff5d5;
  font-weight: 850;
}

.topbar.app-header .header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.topbar.app-header .header-link {
  border: 2px solid rgba(255, 248, 226, .94);
  border-radius: 8px;
  background: rgba(255, 248, 226, .08);
  color: #fff8e3;
  font-weight: 900;
  text-decoration: none;
  box-shadow: none;
  transition: background .15s ease, color .15s ease, border-color .15s ease, transform .15s ease;
}

.topbar.app-header .header-link:hover,
.topbar.app-header .header-link:focus-visible {
  background: rgba(255, 248, 226, .22);
  color: #fff;
  outline: none;
  transform: translateY(-1px);
}

.topbar.app-header .header-link.is-active,
.topbar.app-header .header-link.is-active:hover,
.topbar.app-header .header-link.is-active:focus-visible {
  border-color: #246f31;
  background: linear-gradient(180deg, #43a84a, #2f843a);
  color: #fff;
  box-shadow: inset 0 -3px 0 rgba(23, 75, 31, .32), 0 2px 4px rgba(43, 27, 12, .18);
}

.topbar.app-header.app-header-game {
  gap: 12px;
}

.topbar.app-header.app-header-game .header-link:not(.is-active) {
  background: rgba(255, 248, 226, .06);
}

@media (max-width: 700px) {
  .topbar.app-header {
    gap: 10px;
  }

  .topbar.app-header .header-actions {
    gap: 7px;
  }

  .topbar.app-header .header-link {
    border-radius: 7px;
  }
}

@media (max-width: 950px) and (max-height: 620px) and (orientation: landscape) {
  .topbar.app-header .header-link {
    padding-left: 9px !important;
    padding-right: 9px !important;
  }
}

/* ─────────────────────────────────────────────────────────────
   Défi v1.21.57 — navigation mobile commune
   La navigation de bureau reste inchangée au-dessus de 700 px.
   ───────────────────────────────────────────────────────────── */
.site-mobile-header-row,
.site-mobile-menu {
  display: none;
}

@media (max-width: 700px) {
  .topbar.app-header {
    position: relative !important;
    display: block !important;
    min-height: 0 !important;
    margin-bottom: 10px !important;
    padding: 8px 10px !important;
    border: 2px solid #8a4c24 !important;
    border-radius: 14px !important;
    background: linear-gradient(135deg, #d5a24a 0%, #c88c35 100%) !important;
    box-shadow: 0 3px 0 rgba(97, 53, 23, .18) !important;
    overflow: visible !important;
  }

  .topbar.app-header > .brand,
  .topbar.app-header > .header-actions {
    display: none !important;
  }

  .site-mobile-header-row {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 54px;
  }

  .site-mobile-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    color: #3c1d0e;
    text-decoration: none;
    font-weight: 950;
    font-size: clamp(1.12rem, 5.2vw, 1.46rem);
    line-height: 1.05;
    letter-spacing: -.02em;
  }

  .site-mobile-brand:hover,
  .site-mobile-brand:focus-visible {
    color: #2f160a;
    outline: none;
  }

  .site-mobile-logo {
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
    object-fit: contain;
    filter: drop-shadow(0 1px 0 rgba(255,255,255,.28));
  }

  .site-mobile-brand span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .site-mobile-menu-button {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: 43px;
    height: 43px;
    flex: 0 0 43px;
    padding: 0;
    border: 2px solid #7b431f;
    border-radius: 12px;
    background: #fff7df;
    color: #3d1e0f;
    box-shadow: 0 2px 0 rgba(88, 45, 20, .2);
    cursor: pointer;
  }

  .site-mobile-menu-button span {
    display: block;
    width: 19px;
    height: 2.5px;
    border-radius: 999px;
    background: currentColor;
    transition: transform .16s ease, opacity .16s ease;
  }

  .site-mobile-menu-button[aria-expanded="true"] span:nth-child(1) {
    transform: translateY(6.5px) rotate(45deg);
  }

  .site-mobile-menu-button[aria-expanded="true"] span:nth-child(2) {
    opacity: 0;
  }

  .site-mobile-menu-button[aria-expanded="true"] span:nth-child(3) {
    transform: translateY(-6.5px) rotate(-45deg);
  }

  .site-mobile-menu {
    position: absolute;
    z-index: 1000;
    top: calc(100% + 7px);
    right: 0;
    left: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px;
    padding: 9px;
    border: 2px solid #8a4c24;
    border-radius: 13px;
    background: #fff8e2;
    box-shadow: 0 13px 30px rgba(59, 29, 12, .28);
  }

  .site-mobile-menu[hidden] {
    display: none !important;
  }

  .site-mobile-menu a {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 43px;
    padding: 9px 13px;
    border: 1px solid transparent;
    border-radius: 9px;
    color: #3d1e0f;
    background: transparent;
    font-size: .98rem;
    font-weight: 850;
    line-height: 1.1;
    text-align: center;
    text-decoration: none;
  }

  .site-mobile-menu a.site-mobile-menu-cta {
    grid-column: 1 / -1;
    margin-top: 3px;
    border-color: #91b879;
    background: #e8f4dc;
    color: #245c2c;
  }

  .site-mobile-menu a.site-mobile-menu-cta:hover,
  .site-mobile-menu a.site-mobile-menu-cta:focus-visible {
    border-color: #4d8c50;
    background: #d9edc7;
  }

  .site-mobile-menu a:hover,
  .site-mobile-menu a:focus-visible {
    border-color: #d9b575;
    background: #f6e8bf;
    outline: none;
  }

  .site-mobile-menu a.is-active {
    border-color: #2d7735;
    background: linear-gradient(180deg, #4ba94f, #35873d);
    color: #fff;
    box-shadow: inset 0 -2px 0 rgba(24, 84, 31, .25);
  }

  /* Le tableau de score éventuel reste disponible sous le bandeau de jeu. */
  .topbar.app-header > .scoreboard {
    margin-top: 8px;
  }
}

@media (max-width: 370px) {
  .site-mobile-logo {
    width: 42px;
    height: 42px;
    flex-basis: 42px;
  }

  .site-mobile-brand {
    font-size: 1.08rem;
  }
}
