/* ==========================================================================
   Canards autour du monde — feuille de style
   Sections : 1 variables & police · 2 base · 3 ciel & bassin · 4 boutons · 5 écran titre ·
   6 écran de jeu (mise en page, HUD, jauge) · 7 plateau & cellules · 8 canard ·
   9 messages & transitions · 10 écran score · 11 responsive (portrait étroit, paysage court) ·
   12 mouvement réduit
   ========================================================================== */

/* 1. Variables & police ---------------------------------------------------- */
@font-face {
  font-family: 'Fredoka';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url('../fonts/fredoka-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Fredoka';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url('../fonts/fredoka-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --t-scale: 1;                                   /* facteur temporel (0.1 en mode rapide) */
  --font: 'Fredoka', 'Nunito', 'Segoe UI Rounded', system-ui, sans-serif;
  --ink: #1f2a44;
  --ink-soft: #46587a;
  --sky-top: #5ab9ff;
  --sky-mid: #9ddcff;
  --sky-bottom: #e6f8ff;
  --yellow: #ffd21f;
  --yellow-dark: #e0a400;
  --yellow-deep: #b57f00;
  --orange: #ff8c1a;
  --blue: #1d5fb0;                                 /* boutons secondaires : blanc ≥ 5,9:1 */
  --blue-dark: #143f78;
  --water-btn: #2277c9;                            /* boutons d'eau : blanc ≥ 4,6:1 */
  --water-btn-dark: #154a8a;
  --green: #2ecc71;
  --green-dark: #1d9e55;
  --red: #e0452c;
  --slab: #d99a5b;
  --slab-dark: #a4622c;
  --slab-deep: #7d461e;
  --slab-light: #f0bd85;
  --floor: #f6ecd6;
  --floor-tile: #fff8ea;
  --floor-line: rgba(150, 100, 50, 0.16);
  --stone: #97a3ae;
  --stone-light: #c3ccd4;
  --stone-dark: #5a6570;
  --btn-radius: 16px;
  --board-size: 320px;                            /* côté du conteneur carré (posé par game.js) */
  --cell: 48px;
  --sat: env(safe-area-inset-top, 0px);           /* insets d'encoche (voir .screen-host) */
  --sar: env(safe-area-inset-right, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
}

/* 2. Base ------------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }

html {
  margin: 0;
  min-height: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  overflow-x: clip;               /* pas de défilement horizontal, sans casser `position: sticky` */
  font-family: var(--font);
  font-weight: 500;
  color: var(--ink);
  background: var(--sky-mid);
  min-height: 100dvh;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

#app { position: relative; min-height: 100dvh; }
#sprite-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.screen-host {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  /* Encoches : les insets sont comptés une seule fois, ici (variables surchargeables en test). */
  padding: var(--sat) var(--sar) var(--sab) var(--sal);
  overflow: clip;                 /* les canvas d'effets qui débordent ne créent pas de défilement */
  transition: opacity calc(300ms * var(--t-scale)) ease;
}
.screen-host.is-fading { opacity: 0; }
.screen { min-height: calc(100dvh - var(--sat) - var(--sab)); display: flex; flex-direction: column; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
svg { display: block; }

/* 3. Ciel : dégradé, soleil, nuages dérivants ; bassin extérieur ---------------- */
.sky {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: linear-gradient(180deg, var(--sky-top) 0%, var(--sky-mid) 55%, var(--sky-bottom) 100%);
}
/* Soleil discret en haut à gauche : zone vide sur tous les écrans desktop */
.sun {
  position: absolute;
  top: 3%;
  left: 3%;
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: radial-gradient(circle at 42% 38%, #fff6c0 0%, #ffe45a 55%, #ffd21f 100%);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.35), 0 0 0 14px rgba(255, 236, 140, 0.28), 0 0 40px 16px rgba(255, 240, 170, 0.45);
  pointer-events: none;
}
.clouds {
  position: absolute;
  inset: 0;
  /* rien sous la surface de l'eau (publiée par le bassin) ; tout le ciel sinon */
  clip-path: inset(0 0 calc(100% - var(--surface-y, 100%) + 4px) 0);
}
.cloud {
  position: absolute;
  left: -32vw;
  animation: cloud-drift linear infinite;
  will-change: transform;
}
.cloud svg {
  width: 100%;
  height: auto;
  aspect-ratio: 2 / 1;
  fill: #fff;
  filter: drop-shadow(0 8px 10px rgba(40, 90, 160, 0.16));
}
@keyframes cloud-drift {
  from { transform: translateX(0); }
  to { transform: translateX(165vw); }
}
/* Bassin extérieur : canvas plein écran entre le ciel et les écrans (boîte, canard, HUD au-dessus) */
.pool {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}
/* 4. Boutons « chunky » 3D ------------------------------------------------- */
.btn {
  --btn-bg: var(--yellow);
  --btn-edge: var(--yellow-dark);
  --btn-fg: var(--ink);
  appearance: none;
  font: 600 18px/1 var(--font);
  color: var(--btn-fg);
  background: linear-gradient(180deg, color-mix(in srgb, var(--btn-bg) 80%, #fff) 0%, var(--btn-bg) 45%);
  border: 0;
  border-radius: var(--btn-radius);
  min-width: 48px;
  height: 52px;
  padding: 0 22px;
  box-shadow: 0 5px 0 var(--btn-edge), 0 9px 14px rgba(20, 50, 90, 0.22);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
}
.btn:hover:not(:disabled) { filter: brightness(1.05); }
.btn:active:not(:disabled), .btn.is-pressed:not(:disabled) {
  transform: translateY(4px);
  box-shadow: 0 1px 0 var(--btn-edge), 0 3px 6px rgba(20, 50, 90, 0.22);
}
.btn:focus-visible {
  /* anneau blanc (≥ 4,9:1 sur l'eau) cerclé d'encre (≥ 6,6:1 sur le ciel) : ≥ 3:1 sur tous les fonds */
  outline: 3px solid #fff;
  outline-offset: 2px;
  box-shadow: 0 5px 0 var(--btn-edge), 0 0 0 8px var(--ink);
}
:focus:not(:focus-visible) { outline: none; }
[tabindex='-1']:focus { outline: none; }
.btn:disabled {
  --btn-bg: #c9d1da;
  --btn-edge: #9aa5b3;
  --btn-fg: #4a5566;                               /* ≥ 4,5:1 sur le fond désactivé */
  cursor: default;
  text-shadow: none;
  box-shadow: 0 4px 0 var(--btn-edge), 0 6px 10px rgba(20, 50, 90, 0.12);
}
.btn-secondary { --btn-bg: var(--blue); --btn-edge: var(--blue-dark); --btn-fg: #fff; text-shadow: 0 1px 0 rgba(0, 0, 0, 0.25); }
.btn-big { height: 74px; font-size: 32px; padding: 0 54px; border-radius: 24px; letter-spacing: 0.5px; }
.btn-small { height: 48px; font-size: 16px; padding: 0 18px; border-radius: 13px; }
.btn-icon {
  --btn-bg: #fff;
  --btn-edge: #c6d3e2;
  width: 48px;
  height: 48px;
  padding: 0;
  border-radius: 13px;
}
.btn-icon .icon { width: 26px; height: 26px; color: var(--ink-soft); }
.btn-close { font-size: 22px; font-weight: 700; color: #c93a22; }
.btn-pad {
  position: relative;
  z-index: 7;                                      /* toujours devant le plateau qui tourne */
  width: 64px;
  height: 64px;
  padding: 0;
  border-radius: 20px;
  font-size: 30px;
  box-shadow: 0 5px 0 var(--btn-edge), 0 10px 18px rgba(20, 50, 90, 0.32);
}
.btn-rot { --btn-bg: var(--yellow); }
.btn-water { --btn-bg: var(--water-btn); --btn-edge: var(--water-btn-dark); --btn-fg: #fff; text-shadow: 0 1px 0 rgba(0, 0, 0, 0.3); font-size: 24px; }
.btn-pad .glyph { display: block; line-height: 1; transform: translateY(-1px); }

/* 5. Écran titre --------------------------------------------------------- */
.screen-title {
  align-items: center;
  justify-content: center;
  padding: 28px 16px;
  gap: 18px;
}
.game-title {
  margin: 0;
  font-size: clamp(36px, 8vw, 78px);
  font-weight: 700;
  line-height: 1.05;
  text-align: center;
  color: #fff;
  letter-spacing: 0.5px;
  -webkit-text-stroke: 2px #1d5fb0;        /* contour sombre : ≥ 3:1 sur le ciel */
  paint-order: stroke fill;
  text-shadow: 0 3px 0 #2a7ac7, 0 6px 0 #1d5fb0, 0 12px 22px rgba(10, 40, 90, 0.3);
}
.hero {
  --hero-waterline: 62%;          /* = HERO_WATERLINE dans game.js */
  display: flex;
  align-items: flex-start;        /* la Terre reste au-dessus de l'eau, seul le canard flotte */
  justify-content: center;
  gap: clamp(12px, 5vw, 70px);
  width: 100%;
  max-width: 1000px;
}
.earth { width: clamp(100px, min(21vw, 26vh), 235px); flex: none; }
.earth-svg {
  width: 100%;
  height: auto;
  filter: drop-shadow(0 14px 18px rgba(0, 20, 80, 0.3));
  animation: earth-bob 3.6s ease-in-out infinite;
}
@keyframes earth-bob {
  0%, 100% { transform: translateY(0) rotate(1deg); }
  50% { transform: translateY(-8px) rotate(-1deg); }
}
.earth-strip path { fill: #46b34c; stroke: #2f8f39; stroke-width: 2; stroke-linejoin: round; }
.earth-cap { fill: #fff; opacity: 0.9; }
.earth-land { animation: earth-spin 32s linear infinite; }
@keyframes earth-spin { to { transform: translateX(-100px); } }
.hero-duck { width: clamp(190px, min(42vw, 52vh), 470px); flex: none; }
.hero-float {
  position: relative;
  animation: hero-float 3.2s ease-in-out infinite;
}
.hero-duck .duck-svg {
  width: 100%;
  height: auto;
  filter: drop-shadow(0 16px 16px rgba(0, 20, 80, 0.28));
}
@keyframes hero-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-14px); }
}
/* Voile d'immersion du grand canard : masqué par sa silhouette, nappe fixe à la ligne d'eau */
.hero-veil {
  position: absolute;
  inset: 0;
  pointer-events: none;
  -webkit-mask: var(--duck-mask) no-repeat 0 0 / 100% 100%;
  mask: var(--duck-mask) no-repeat 0 0 / 100% 100%;
}
.hero-water {
  position: absolute;
  left: 0;
  right: 0;
  top: var(--hero-waterline);
  bottom: -30%;
  background: linear-gradient(180deg, rgba(90, 180, 250, 0.55) 0%, rgba(50, 135, 235, 0.72) 30%, rgba(30, 95, 205, 0.88) 100%);
  border-top: 3px solid rgba(255, 255, 255, 0.85);
  animation: hero-water 3.2s ease-in-out infinite;   /* compense le flottement */
}
@keyframes hero-water {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(14px); }
}
.title-actions {
  position: relative;
  z-index: 3;                    /* au-dessus du voile d'immersion du bassin */
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  margin-top: 8px;
}
@media (max-height: 720px) {
  .screen-title { padding: 12px 16px; gap: 10px; }
  .game-title { font-size: clamp(32px, 6vw, 56px); }
  .title-actions { gap: 10px; margin-top: 0; }
}
.notice {
  margin: 0;
  padding: 10px 18px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--red);
  font-weight: 600;
}

/* 6. Écran de jeu : mise en page, HUD, jauge --------------------------------- */
.screen-game { padding: 0 0 16px; }
.hud {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 16px 6px;
}
.hud-info {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 8px 16px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 3px 0 rgba(255, 255, 255, 0.5), 0 6px 14px rgba(20, 50, 90, 0.12);
}
.hud-level { margin: 0; font-size: 22px; font-weight: 700; }
.hud-stat { font-size: 16px; color: var(--ink-soft); }
.hud-actions { display: flex; align-items: center; gap: 10px; }

/* Desktop : ▲ au-dessus du plateau, ↺ plateau ↻ jauge, ▼ en dessous */
.play {
  flex: 1;
  display: grid;
  grid-template-columns: auto auto auto auto;
  grid-template-rows: auto auto auto;
  grid-template-areas:
    '. up . .'
    'left stage right gauge'
    '. down . .';
  align-items: center;
  justify-items: center;
  justify-content: center;
  align-content: center;
  gap: 18px;
  padding: 8px 16px;
}
#btn-up { grid-area: up; }
#btn-down { grid-area: down; }
#btn-left { grid-area: left; }
#btn-right { grid-area: right; }
/* Desktop : les boutons (et la jauge avec ↻) suivent les bords visibles de la dalle et non
   le carré qui la contient — même écart des 4 côtés, suivi image par image pendant la
   rotation (--pull-* calculés par game.js, fitGauge). */
@media (min-width: 600px) and (min-height: 521px), (min-width: 600px) and (orientation: portrait) {
  #btn-up { translate: 0 var(--pull-up, 0px); }
  #btn-down { translate: 0 var(--pull-down, 0px); }
  #btn-left { translate: var(--pull-left, 0px) 0; }
  #btn-right, .play > .gauge { translate: var(--pull-right, 0px) 0; }
}
.stage {
  grid-area: stage;
  width: var(--board-size);
  height: var(--board-size);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

/* Jauge d'eau : tube 3D vertical, crans min/max, niveau animé */
.gauge {
  grid-area: gauge;
  width: 72px;
  height: calc(var(--board-size) + 22px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding-right: 34px;
}
/* Le tube couvre exactement la hauteur intérieure de la dalle (orientation courante) :
   1 cellule = 1 ligne d'eau ; --tube-top / --tube-h / --gcell posés par game.js (fitTube). */
.gauge-tube {
  position: relative;
  align-self: flex-start;
  margin-top: var(--tube-top, 0px);
  width: 28px;
  height: var(--tube-h, 100%);
  border-radius: 14px;
  background: linear-gradient(90deg, #c6dcef 0%, #f3fbff 45%, #c6dcef 100%);
  box-shadow: 0 6px 12px rgba(20, 50, 90, 0.25);
}
/* Pied du tube */
.gauge-tube::before {
  content: '';
  position: absolute;
  left: -6px;
  right: -6px;
  bottom: -7px;
  height: 14px;
  border-radius: 50%;
  background: linear-gradient(180deg, #6f9cc7, #4b6f92);
  box-shadow: 0 3px 6px rgba(20, 50, 90, 0.3);
  z-index: -1;
}
.gauge-fill {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(var(--gw, 0) * var(--gcell, 0px));
  border-radius: 0 0 14px 14px;
  background: linear-gradient(90deg, #2c88e0 0%, #74caff 45%, #2c88e0 100%);
  transition: height calc(300ms * var(--t-scale)) cubic-bezier(0.4, 0, 0.2, 1);
}
.gauge.is-tracking .gauge-fill, .gauge.no-anim .gauge-fill { transition: none; }   /* spin : le tube suit le zoom image par image */
.gauge-fill::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: -3px;
  height: 6px;
  border-radius: 3px;
  background: #e2f5ff;
  box-shadow: 0 2px 0 rgba(255, 255, 255, 0.5);
}
.gauge-tube::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 3px #6f9cc7, inset 3px 0 0 4px rgba(255, 255, 255, 0.35);
  pointer-events: none;
}
.gauge-gloss {
  position: absolute;
  left: 5px;
  top: 10px;
  bottom: 10px;
  width: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.75);
  z-index: 1;
}
.gauge-tick {
  position: absolute;
  bottom: calc(var(--gt, 0) * var(--gcell, 0px));
  left: -7px;
  right: -7px;
  height: 0;
  border-top: 3px solid var(--blue-dark);
  margin-bottom: -1.5px;   /* trait centré sur la ligne wmin / wmax */
  z-index: 2;
}
/* Étiquettes : pastille blanche → ≥ 4,5:1 sur ciel comme sur eau */
.gauge-tick span {
  position: absolute;
  left: calc(100% + 5px);
  top: -9px;
  padding: 1px 5px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.9);
  font-size: 12px;
  font-weight: 700;
  color: var(--blue-dark);
  line-height: 1.2;
  white-space: nowrap;
}
.gauge.is-same .gauge-tick-max { display: none; }
.gauge.is-same .gauge-tick-min span::after { content: '/max'; }
/* Niveau sans eau (wmax = 0) : tube grisé, sans crans, une seule étiquette horizontale au pied */
.gauge-dry {
  display: none;
  position: absolute;
  left: calc(100% + 5px);
  bottom: 0;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--blue-dark);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  z-index: 2;
}
.gauge.is-dry .gauge-dry { display: block; }
.gauge.is-dry .gauge-tick, .gauge.is-dry .gauge-fill { display: none; }
.gauge.is-dry .gauge-tube { background: linear-gradient(90deg, #d3d9e0 0%, #eef1f4 45%, #d3d9e0 100%); }

/* 7. Plateau & cellules ------------------------------------------------------- */
.board { position: relative; flex: none; }
/* Ombre portée (toujours) + face inférieure (au repos) de la dalle : ne tournent pas */
.slab-shadow {
  position: absolute;
  z-index: 0;
  border-radius: 18px;
  box-shadow: 0 14px 30px rgba(20, 40, 80, 0.38);
  transform-origin: 50% 50%;
}
.slab-shadow::after {
  content: '';
  position: absolute;
  inset: 40% 0 0;
  border-radius: 0 0 18px 18px;
  background: linear-gradient(180deg, var(--slab-dark) 0%, var(--slab-deep) 100%);
}
/* Pendant une rotation ou le spin, le « dessous » fixe et son ombre directionnelle
   disparaissent instantanément (aucun fantôme) et reviennent en fondu une fois posés */
.slab-shadow { transition: opacity calc(160ms * var(--t-scale)) ease; }
.board.is-rotating .slab-shadow { opacity: 0; transition: none; }
.board-rot {
  position: absolute;
  inset: 0;
  z-index: 1;
  transform-origin: 50% 50%;
  will-change: transform;
}
.slab {
  position: absolute;
  background-color: var(--floor);
  background-image:
    linear-gradient(var(--floor-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--floor-line) 1px, transparent 1px);
  background-size: var(--cell) var(--cell);
  /* Lèvre intérieure sombre : l'eau bute sur le rebord */
  box-shadow: inset 0 0 0 2px rgba(90, 50, 10, 0.45), inset 0 0 14px rgba(90, 50, 10, 0.28);
}
/* Rebord épais de la dalle : biseau sur les 4 côtés (il tourne avec le plateau, c'est voulu) */
.slab::before {
  content: '';
  position: absolute;
  inset: -11px;
  z-index: -1;
  border-radius: 16px;
  background: var(--slab);
  background: linear-gradient(180deg, var(--slab-light) 0%, var(--slab) 28%, var(--slab) 72%, var(--slab-dark) 100%);
  box-shadow:
    inset 0 5px 0 rgba(255, 235, 200, 0.55),
    inset 0 -5px 0 rgba(90, 45, 10, 0.5),
    inset 5px 0 0 rgba(255, 235, 200, 0.22),
    inset -5px 0 0 rgba(90, 45, 10, 0.3),
    0 0 0 2px rgba(80, 40, 10, 0.4),
    0 0 22px 4px rgba(20, 40, 80, 0.28);
}
.cells {
  position: absolute;
  inset: 0;
  display: grid;
  z-index: 1;
}
.fx-lava { position: absolute; left: 0; top: 0; z-index: 2; pointer-events: none; }
.fx-water { position: absolute; z-index: 3; pointer-events: none; transform-origin: 50% 50%; }
.fx-top { position: absolute; z-index: 5; pointer-events: none; transform-origin: 50% 50%; }

.cell { position: relative; width: var(--cell); height: var(--cell); }
.floor {
  position: absolute;
  inset: 7%;
  border-radius: 14%;
  background: var(--floor-tile);
  box-shadow: inset 0 0 0 1px rgba(150, 100, 50, 0.1), 0 1px 0 rgba(255, 255, 255, 0.6);
}

/* Blocs : « 3D sans profondeur », biseau à 4 facettes */
.block {
  position: absolute;
  inset: 5%;
  border-radius: 18%;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1), 0 0 10px 2px rgba(20, 20, 40, 0.28);
}
.block .face {
  position: absolute;
  inset: 16%;
  border-radius: 14%;
}
/* Pierre : 4 facettes extrudées (haut clair, bas sombre), face creusée, fissure anguleuse */
.stone {
  background: conic-gradient(from 45deg, #6f7a86 0 90deg, var(--stone-dark) 90deg 180deg, #8d98a4 180deg 270deg, var(--stone-light) 270deg 360deg);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.28), inset 0 0 0 4px rgba(0, 0, 0, 0.16), 0 0 0 1px rgba(0, 0, 0, 0.14), 0 0 10px 2px rgba(20, 20, 40, 0.3);
}
.stone .face {
  inset: 19%;
  border-radius: 13% 15% 11% 14%;
  background: linear-gradient(160deg, #cfd7de 0%, #b2bcc6 55%, #9ea9b4 100%);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.55), 0 0 0 1px rgba(40, 50, 60, 0.35), inset 0 0 6px rgba(0, 0, 0, 0.18);
}
.stone .face::after {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Cpath d='M0 14l7 4-2 6 8 5' fill='none' stroke='%232f3841' stroke-width='1.2' stroke-linecap='round' stroke-linejoin='round' opacity='.55'/%3E%3Cpath d='M40 30l-6-3-1 5' fill='none' stroke='%232f3841' stroke-width='1.1' stroke-linecap='round' stroke-linejoin='round' opacity='.45'/%3E%3Ccircle cx='30' cy='12' r='0.9' fill='%232f3841' opacity='.4'/%3E%3Ccircle cx='22' cy='34' r='0.8' fill='%232f3841' opacity='.35'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
}
.cell:nth-child(3n) .stone .face::after { transform: scaleX(-1); }
.cell:nth-child(5n) .stone .face::after { transform: rotate(90deg); }
.cell:nth-child(7n) .stone .face::after { transform: scaleY(-1); }

/* Lave : magma orange vif → jaune (≥ 70 % de la tuile), deux petites taches de croûte
   décentrées, veines lumineuses sinueuses non croisées, lueur pulsante large, halo ;
   paillettes et braises sur le canvas fx-lava */
.lava {
  background: linear-gradient(160deg, #ffd23f 0%, #ff9a1f 45%, #ff7a1a 80%, #f05a0a 100%);
  box-shadow: 0 0 0 1px rgba(120, 30, 0, 0.35), 0 0 16px 5px rgba(255, 120, 20, 0.55);
}
.lava .crust {
  position: absolute;
  inset: 0;
  border-radius: 18%;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Cg fill='%23c2410c' fill-opacity='.55'%3E%3Cpath d='M3 5c3-3 9-2 10 1 1 3-2 6-6 6-3 0-6-4-4-7z'/%3E%3Cpath d='M28 29c3-2 8-1 9 2 1 3-2 6-6 6-3 0-5-5-3-8z'/%3E%3Cpath d='M30 6c2-1 4 0 4 2s-2 3-4 2c-1-1-1-3 0-4z'/%3E%3C/g%3E%3Cg fill='none' stroke='%23fff0a0' stroke-linecap='round' opacity='.8'%3E%3Cpath d='M3 30c6-2 9-7 15-6s8-6 12-10' stroke-width='1.3'/%3E%3Cpath d='M26 38c1-5 5-7 4-12' stroke-width='.9'/%3E%3Cpath d='M16 3c-1 4 2 6 1 10' stroke-width='.8'/%3E%3C/g%3E%3C/svg%3E") center / 100% 100% no-repeat;
}
.cell:nth-child(2n) .lava .crust { transform: scaleX(-1); }
.cell:nth-child(3n) .lava .crust { transform: rotate(90deg); }
.lava .face {
  inset: 12%;
  border-radius: 40%;
  background: radial-gradient(circle at 45% 45%, #fff4b0 0%, rgba(255, 220, 90, 0.8) 35%, rgba(255, 150, 40, 0) 100%);
  animation: lava-pulse calc(2.8s * var(--t-scale)) ease-in-out infinite alternate;
}
@keyframes lava-pulse {
  from { opacity: 0.55; transform: scale(0.92); }
  to { opacity: 0.95; transform: scale(1.06); }
}
.gate {
  background: radial-gradient(circle at 50% 50%, #ffffff 0%, #eef2f6 65%, #cfd8e2 100%);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1), 0 0 10px 2px rgba(20, 20, 40, 0.25);
}
.gate .face {
  background: radial-gradient(circle at 50% 40%, #ffffff 0%, #f4f7fa 70%, #e6ecf2 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.9);
}
.gate-arrows { position: absolute; inset: 12%; width: 76%; height: 76%; }
.gate-arrow { fill: #1d9e55; stroke: #0f6b39; stroke-width: 5; stroke-linejoin: round; }   /* ≥ 3:1 sur blanc */
.cell.is-open .gate {
  animation: gate-shimmer calc(1.6s * var(--t-scale)) ease-in-out infinite alternate;
}
.cell.is-open .gate-arrow { fill: #1fae5c; }
@keyframes gate-shimmer {
  from { box-shadow: 0 0 0 1px rgba(46, 204, 113, 0.5), inset 0 0 6px 1px rgba(46, 204, 113, 0.3); }
  to { box-shadow: 0 0 0 2px rgba(46, 204, 113, 0.95), inset 0 0 10px 3px rgba(46, 204, 113, 0.7); }
}
.finish {
  background: #fff;
  overflow: hidden;
  box-shadow: 0 0 0 2px #333, 0 0 10px 2px rgba(20, 20, 40, 0.25);
}
.checker {
  position: absolute;
  inset: 0;
  background: repeating-conic-gradient(#25252b 0 25%, #fff 0 50%);
  background-size: 50% 50%;
}
.flag-wrap {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transform-origin: 50% 50%;
}
.flag { width: 78%; height: 78%; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.45)); }
.flag-cloth {
  transform-origin: 7.4px 8.2px;
  animation: flag-wave calc(1.3s * var(--t-scale)) ease-in-out infinite alternate;
}
@keyframes flag-wave {
  from { transform: skewY(-7deg) scaleX(1); }
  to { transform: skewY(6deg) scaleX(0.92); }
}
.cell.is-reached .finish {
  box-shadow: 0 0 0 3px var(--yellow), 0 0 24px 8px rgba(255, 210, 31, 0.85);
}

/* Secousse du plateau à l'atterrissage : deux oscillations (propriété `translate`, indépendante de `transform`) */
.board.is-nudge .board-rot, .board.is-nudge .duck-layer, .board.is-nudge .fx-water, .board.is-nudge .fx-top {
  animation: board-nudge calc(200ms * var(--t-scale)) ease-out;
}
@keyframes board-nudge {
  0% { translate: 0 0; }
  25% { translate: 0 7px; }
  55% { translate: 0 -3px; }
  80% { translate: 0 2px; }
  100% { translate: 0 0; }
}
/* Flash du sol sous le point d'impact */
.cell.is-hit .floor, .cell.is-hit .block { animation: floor-hit calc(220ms * var(--t-scale)) ease-out; }
@keyframes floor-hit {
  0% { filter: brightness(1.55) saturate(0.7); }
  100% { filter: none; }
}
/* Nouveau plateau après brûlure : apparition en fondu (eau comprise), léger dépôt ; busy reste à 1 */
.board.is-reborn {
  animation: board-reborn calc(320ms * var(--t-scale)) ease-out;
}
@keyframes board-reborn {
  from { opacity: 0; translate: 0 -10px; }
  to { opacity: 1; translate: 0 0; }
}

/* 8. Canard ---------------------------------------------------------------- */
.duck-layer {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  transform-origin: 50% 50%;
  will-change: transform;
}
#duck {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--cell);
  height: var(--cell);
  will-change: transform;
}
.duck-sprite { position: absolute; inset: 0; transform-origin: 50% 50%; }
.duck-lift { position: absolute; inset: 0; transition: transform calc(220ms * var(--t-scale)) ease-out; }
.duck-lift.is-surface {
  transform: translateY(calc(var(--cell) * var(--float-lift)));
  animation: duck-bob calc(2.6s * var(--t-scale)) ease-in-out infinite;
}
/* Flottaison : la ligne d'eau (bord haut de la cellule) coupe le corps sous l'œil ; le bob
   fait entrer et sortir le ventre de l'eau. Le voile suit le même mouvement que le sprite. */
#duck { --float-lift: -0.46; --float-bob: 0.06; --sprite-top: 0.105; }
@keyframes duck-bob {
  0%, 100% { transform: translateY(calc(var(--cell) * var(--float-lift))); }
  50% { transform: translateY(calc(var(--cell) * (var(--float-lift) + var(--float-bob)))); }
}
.duck-veil {
  position: absolute;
  inset: 0;
  display: none;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(80, 170, 250, 0.5) 0%, rgba(50, 130, 230, 0.66) 45%, rgba(35, 100, 210, 0.85) 100%);
  -webkit-mask: var(--duck-mask) no-repeat;
  mask: var(--duck-mask) no-repeat;
  -webkit-mask-size: 94% auto;
  mask-size: 94% auto;
  -webkit-mask-position: 50% calc(var(--cell) * (var(--sprite-top) + var(--float-lift)));
  mask-position: 50% calc(var(--cell) * (var(--sprite-top) + var(--float-lift)));
}
.duck-lift.is-surface + .duck-veil {
  display: block;
  animation: duck-veil-bob calc(2.6s * var(--t-scale)) ease-in-out infinite;
}
@keyframes duck-veil-bob {
  0%, 100% { -webkit-mask-position: 50% calc(var(--cell) * (var(--sprite-top) + var(--float-lift))); mask-position: 50% calc(var(--cell) * (var(--sprite-top) + var(--float-lift))); }
  50% { -webkit-mask-position: 50% calc(var(--cell) * (var(--sprite-top) + var(--float-lift) + var(--float-bob))); mask-position: 50% calc(var(--cell) * (var(--sprite-top) + var(--float-lift) + var(--float-bob))); }
}
.duck-anim { position: absolute; inset: 0; transform-origin: 50% 92%; }
.duck-anim.is-stretch { transform: scale(0.94, 1.08); }
.duck-anim.is-landing { animation: duck-land calc(120ms * var(--t-scale)) ease-out; }
@keyframes duck-land {
  0% { transform: scale(1.22, 0.76); }
  55% { transform: scale(0.94, 1.08); }
  100% { transform: scale(1, 1); }
}
.duck-anim.is-dive { animation: duck-dive calc(340ms * var(--t-scale)) ease-out; }
@keyframes duck-dive {
  0% { transform: translateY(0) scale(1.1, 0.9); }
  45% { transform: translateY(calc(var(--cell) * 0.16)) scale(0.96, 1.06); }
  100% { transform: none; }
}
#duck .duck-svg {
  position: absolute;
  inset: 3%;
  width: 94%;
  height: 94%;
  filter: drop-shadow(0 3px 2px rgba(0, 0, 0, 0.28));
}
/* Sous l'eau : le voile bleuté est dessiné par le canvas de surface ; le canard reste jaune */
.duck-layer.is-below .duck-svg { filter: brightness(0.9); }

.duck-body, .duck-head { fill: var(--duck-fill, #ffd21f); stroke: var(--duck-line, #e0a400); stroke-width: 3; }
.duck-tail { fill: var(--duck-wing, #f0b400); stroke: var(--duck-line, #e0a400); stroke-width: 2.6; stroke-linejoin: round; }
.duck-wing { fill: var(--duck-wing, #f2b900); stroke: var(--duck-line, #e0a400); stroke-width: 1.8; stroke-linejoin: round; transform-origin: 60px 62px; }
.duck-wing-shine { fill: none; stroke: #fff; stroke-width: 1.6; stroke-linecap: round; opacity: 0.45; transform-origin: 60px 62px; }
#duck.is-burned .duck-wing-shine { display: none; }
.duck-beak { fill: var(--duck-beak, #ff8c1a); stroke: var(--duck-beak-line, #e0761a); stroke-width: 2.4; stroke-linejoin: round; }
.duck-beak-line { fill: none; stroke: var(--duck-beak-line, #e0761a); stroke-width: 1.8; stroke-linecap: round; }
.duck-foot { fill: var(--duck-beak, #ff8c1a); stroke: var(--duck-beak-line, #e0761a); stroke-width: 2.4; stroke-linejoin: round; }
.duck-foot-back { fill: var(--duck-beak2, #ee7a10); }
.duck-eye { fill: #24222b; }
.duck-eye-shine { fill: #fff; }
.duck-cheek { fill: #ff9a8a; opacity: 0.5; }
.duck-shine { fill: #fff; opacity: 0.4; }
.duck-eyelid {
  fill: var(--duck-fill, #ffd21f);
  transform-origin: 72px 27.2px;
  transform: scaleY(0);
  animation: duck-blink 4.6s infinite;
}
@keyframes duck-blink {
  0%, 91%, 100% { transform: scaleY(0); }
  94%, 97% { transform: scaleY(1); }
}
.duck-eye-x { display: none; stroke: #fff; stroke-width: 2.6; fill: none; }
.is-flap .duck-wing, .is-flap .duck-wing-shine { animation: duck-flap calc(420ms * var(--t-scale)) ease-out 2; }
@keyframes duck-flap {
  0% { transform: rotate(0deg); }
  40% { transform: rotate(-42deg); }
  100% { transform: rotate(0deg); }
}
#duck.is-burned {
  --duck-fill: #2a2a30;
  --duck-line: #101014;
  --duck-wing: #1b1b21;
  --duck-beak: #3a3a44;
  --duck-beak2: #2b2b33;
  --duck-beak-line: #17171c;
}
#duck.is-burned .duck-eye, #duck.is-burned .duck-eye-shine, #duck.is-burned .duck-eyelid,
#duck.is-burned .duck-cheek, #duck.is-burned .duck-shine { display: none; }
#duck.is-burned .duck-eye-x { display: block; }
#duck.is-burned .duck-anim { animation: duck-jitter calc(300ms * var(--t-scale)) ease-in-out 4; }
@keyframes duck-jitter {
  0%, 100% { transform: translateX(0) rotate(0); }
  25% { transform: translateX(-6%) rotate(-5deg); }
  75% { transform: translateX(6%) rotate(5deg); }
}

/* 9. Messages & transitions --------------------------------------------------- */
.message {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  pointer-events: none;
}
.msg-card {
  max-width: min(92vw, 640px);
  padding: 28px 44px;
  border-radius: 30px;
  background: #fff;
  text-align: center;
  box-shadow: 0 10px 0 #cfd8e3, 0 22px 44px rgba(10, 40, 90, 0.3);
  animation: msg-pop calc(360ms * var(--t-scale)) cubic-bezier(0.2, 1.5, 0.4, 1);
}
.message.is-leaving .msg-card {
  animation: msg-out calc(180ms * var(--t-scale)) ease-in forwards;
}
@keyframes msg-pop {
  from { transform: scale(0.5) rotate(-4deg); opacity: 0; }
  to { transform: scale(1) rotate(0); opacity: 1; }
}
@keyframes msg-out {
  from { transform: scale(1); opacity: 1; }
  to { transform: scale(0.88) translateY(8px); opacity: 0; }
}
.msg-title { font-size: clamp(30px, 6vw, 50px); font-weight: 700; line-height: 1.1; }
.msg-sub { margin-top: 10px; font-size: clamp(17px, 3vw, 22px); color: var(--ink-soft); }
.msg-won .msg-title { color: var(--green-dark); }
.msg-burned .msg-title { color: var(--red); }
.msg-finished .msg-title { color: var(--blue-dark); }

/* 10. Écran score : plateau de tuiles -------------------------------------- */
.screen-score { padding-bottom: 24px; }
.score-count { font-size: 17px; color: var(--ink-soft); }
.score-board {
  --tile: clamp(44px, 5vw, 56px);
  align-self: center;
  margin: auto 16px;
  padding: 14px;
  border-radius: 22px;
  background: linear-gradient(180deg, var(--slab-light) 0%, var(--slab) 12%, var(--slab) 88%, var(--slab-dark) 100%);
  box-shadow: inset 0 0 0 3px var(--slab-dark), inset 0 0 0 5px rgba(255, 235, 200, 0.45), 0 8px 0 var(--slab-deep), 0 0 0 2px rgba(80, 40, 10, 0.35), 0 18px 32px rgba(20, 40, 80, 0.35);
  max-width: calc(100vw - 32px);
}
.score-grid {
  display: grid;
  grid-template-columns: repeat(13, var(--tile));
  gap: 8px;
  padding: 12px;
  border-radius: 12px;
  background-color: var(--floor);
  background-image:
    linear-gradient(var(--floor-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--floor-line) 1px, transparent 1px);
  background-size: calc(var(--tile) + 8px) calc(var(--tile) + 8px);
  background-position: 8px 8px;
  box-shadow: inset 0 0 0 2px rgba(90, 50, 10, 0.4), inset 0 0 12px rgba(90, 50, 10, 0.25);
}
.level-tile {
  position: relative;
  width: var(--tile);
  height: var(--tile);
  border: 0;
  border-radius: 22%;
  font: 700 18px/1 var(--font);
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.tile-done {
  background: radial-gradient(circle at 50% 40%, #fff 0%, #f1f5f9 70%, #d9e2ec 100%);
  box-shadow: 0 4px 0 #b9c6d4, 0 6px 10px rgba(20, 50, 90, 0.2);
}
.tile-current {
  background: radial-gradient(circle at 50% 40%, #ffe57a 0%, var(--yellow) 65%, #f0b400 100%);
  box-shadow: 0 4px 0 var(--yellow-deep), 0 0 0 3px #fff, 0 0 18px 4px rgba(255, 210, 31, 0.7);
  animation: tile-glow calc(1.6s * var(--t-scale)) ease-in-out infinite alternate;
}
@keyframes tile-glow {
  from { box-shadow: 0 4px 0 var(--yellow-deep), 0 0 0 3px #fff, 0 0 10px 2px rgba(255, 210, 31, 0.5); }
  to { box-shadow: 0 4px 0 var(--yellow-deep), 0 0 0 3px #fff, 0 0 22px 6px rgba(255, 210, 31, 0.9); }
}
.tile-current .tile-play { font-size: 20px; line-height: 1; }
.tile-current .tile-num, .tile-locked .tile-num {
  position: absolute;
  right: 7%;
  bottom: 4%;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.45);
}
.tile-locked {
  background: radial-gradient(circle at 50% 50%, #b9c1ca 0%, #97a3ae 70%, #6f7a86 100%);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.12), 0 3px 0 #58626d;
  color: #e6ebf0;
  cursor: default;
}
.tile-lock { width: 52%; height: 52%; color: #2b333d; }
.level-tile:not(:disabled):hover { transform: translateY(-2px); }
.level-tile:not(:disabled):active { transform: translateY(3px); box-shadow: 0 1px 0 #b9c6d4; }
.level-tile:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 2px;
  box-shadow: 0 4px 0 #b9c6d4, 0 0 0 8px var(--ink);
}
.tile-current:focus-visible {
  animation: none;
  box-shadow: 0 4px 0 var(--yellow-deep), 0 0 0 8px var(--ink);
}

/* 11. Responsive ------------------------------------------------------------- */
/* Portrait étroit (téléphone) */
@media (max-width: 599px) {
  .sun { display: none; }
  .hud { padding: 8px 8px 2px; gap: 8px; flex-wrap: nowrap; justify-content: space-between; }
  .hud-info { gap: 8px; padding: 6px 10px; flex-wrap: wrap; row-gap: 0; }
  .hud-level { font-size: 17px; }
  .hud-stat { font-size: 13px; }
  .hud-actions { gap: 8px; }
  .hud .btn-small { padding: 0 12px; font-size: 15px; min-height: 48px; }
  .hud .btn-icon { width: 48px; height: 48px; }
  /* Plateau centré verticalement dans l'espace au-dessus de la croix, croix basse (pouces) */
  .play {
    grid-template-columns: 1fr auto auto auto 1fr;
    grid-template-rows: minmax(0, 1fr) auto minmax(0, 1fr) auto auto auto;
    grid-template-areas:
      '. . . . .'
      'stage stage stage stage stage'
      '. . . . .'
      '. . up . .'
      '. left . right .'
      '. . down . .';
    gap: 8px;
    padding: 24px 6px 12px;
    align-content: stretch;
  }
  /* Le plateau est décalé de 22 px vers la gauche pour laisser la jauge et ses étiquettes dans
     l'écran ; la croix est décalée d'autant : plateau et croix partagent le même axe vertical. */
  .stage { justify-self: center; margin-right: 44px; }
  .btn-pad { width: 60px; height: 60px; border-radius: 18px; translate: -22px 0; }
  /* Jauge fine superposée au bord droit du plateau (accrochée au rebord) */
  .gauge {
    grid-area: stage;
    justify-self: start;
    align-self: center;
    /* accrochée au bord droit de la dalle (orientation courante), pas au conteneur carré */
    margin-left: calc(50% - 22px - var(--board-size) / 2 + var(--slab-right, var(--board-size)));
    width: 44px;
    height: var(--board-size);
    padding: 0;
    justify-content: flex-start;
    z-index: 6;
    pointer-events: none;
  }
  .earth { width: clamp(80px, 21vw, 120px); }
  .hero-duck { width: clamp(150px, 50vw, 240px); }
  .btn-big { height: 64px; font-size: 26px; padding: 0 40px; }
  .msg-card { padding: 20px 26px; }
  .screen-score .hud {
    position: sticky;
    top: var(--sat);
    z-index: 8;
    background: linear-gradient(180deg, #7ac6ff, #86ccff);
    box-shadow: 0 4px 12px rgba(20, 50, 90, 0.18);
  }
}
/* Score : 13 × 4 en large, 4 × 13 en étroit (spec 6.3) ; 13 colonnes de 48 px + écarts de 8 px
   demandent ≈ 780 px, d'où le seuil (le paysage court a sa propre règle plus bas). */
@media (max-width: 779px) {
  .score-board { --tile: clamp(48px, 14vw, 60px); }
  .score-grid { grid-template-columns: repeat(4, var(--tile)); }
}
/* Jauge fine (portrait étroit et paysage court) */
@media (max-width: 599px), (max-height: 520px) and (orientation: landscape) {
  .gauge { --gauge-pad: 16px; }
  .gauge-tube { width: 12px; border-radius: 6px; }
  .gauge-tube::before { left: -3px; right: -3px; bottom: -4px; height: 8px; }
  .gauge-fill { border-radius: 0 0 6px 6px; }
  .gauge-fill::after { top: -2px; height: 4px; }
  .gauge-gloss { left: 3px; width: 2px; top: 6px; bottom: 6px; }
  .gauge-tick { left: -3px; right: -3px; border-top-width: 2px; margin-bottom: -1px; }
  .gauge-tick span { left: calc(100% + 3px); top: -8px; padding: 1px 3px; font-size: 12px; }
  .gauge-tube::after { box-shadow: inset 0 0 0 2px #6f9cc7; }
  .gauge-dry { left: calc(100% + 3px); padding: 1px 3px; font-size: 11px; white-space: normal; width: min-content; text-align: center; }
}

/* Paysage court (téléphone couché) : plateau à gauche, commandes 2×2 à côté, tout dans le viewport */
@media (max-height: 520px) and (orientation: landscape) {
  .sun { width: 56px; height: 56px; top: 2%; left: 1.5%; }
  .hud { padding: 1px 8px; gap: 6px; flex-wrap: nowrap; }
  .hud-info { padding: 4px 10px; gap: 10px; }
  .hud-level { font-size: 16px; }
  .hud-stat { font-size: 12px; }
  .hud .btn-icon { width: 48px; height: 48px; }
  .hud .btn-small { height: 48px; min-height: 48px; font-size: 14px; padding: 0 12px; }
  /* Jeu : le HUD passe en colonne à droite, toute la hauteur revient au plateau (dalle entière,
     épaisseur comprise, avec de l'air au-dessus et au-dessous) */
  .screen-game { flex-direction: row; padding-bottom: 0; }
  .screen-game > .hud { order: 2; flex-direction: column; justify-content: center; align-items: stretch; padding: 8px 10px 8px 0; gap: 10px; }
  .screen-game .hud-info { flex-direction: column; align-items: flex-start; gap: 0; padding: 6px 10px; }
  .screen-game .hud-actions { flex-direction: column; align-items: stretch; gap: 8px; }
  .screen-game .hud .btn-icon { width: auto; }
  .screen-game .play { min-width: 0; }
  /* ↺ ↻ à gauche du plateau, ▲ ▼ à droite (après la jauge), répartis sur la largeur */
  .play {
    grid-template-columns: 1fr auto auto auto auto 1fr;
    grid-template-rows: auto auto;
    grid-template-areas:
      '. left stage gauge up .'
      '. right stage gauge down .';
    gap: 10px;
    padding: 4px 8px;
    align-content: center;
    align-items: center;
  }
  /* marges : ≥ 10 px entre les pads et le rebord (11 px) ; en bas, l'épaisseur de la dalle (8 px) */
  .stage { justify-self: center; margin: 0 12px 8px; }
  .btn-pad { width: 56px; height: 56px; border-radius: 16px; font-size: 24px; }
  .gauge {
    grid-area: gauge;
    margin-left: 0;
    justify-self: start;
    align-self: center;
    width: 44px;
    height: var(--board-size);
    padding: 0;
    justify-content: flex-start;
    pointer-events: none;
  }
  /* Titre : héros réduits, boutons côte à côte */
  .screen-title { padding: 8px 12px; gap: 8px; }
  .game-title { font-size: clamp(22px, 7vh, 40px); }
  .hero { gap: 24px; }
  .hero-duck { width: clamp(90px, 30vh, 160px); }
  .earth { width: clamp(50px, 15vh, 80px); }
  .title-actions { flex-direction: row; gap: 14px; margin-top: 0; }
  .btn-big { height: 48px; font-size: 20px; padding: 0 28px; border-radius: 14px; }
  .score-board { --tile: 48px; padding: 8px; margin: auto 8px; }
  .score-grid { gap: 8px; padding: 8px; grid-template-columns: repeat(13, var(--tile)); }
  .screen-score .hud { position: sticky; top: 0; z-index: 8; background: linear-gradient(180deg, #7ac6ff, #86ccff); }
}
@media (max-height: 520px) and (orientation: landscape) and (max-width: 779px) {
  .score-grid { grid-template-columns: repeat(4, var(--tile)); }   /* 4 × 13, défilement vertical */
}

/* 12. Mouvement réduit / mode rapide : effets décoratifs désactivés --------------- */
html[data-reduced='1'] .cloud,
html[data-reduced='1'] .earth-land,
html[data-reduced='1'] .earth-svg,
html[data-reduced='1'] .hero-float,
html[data-reduced='1'] .hero-water,
html[data-reduced='1'] .lava .face,
html[data-reduced='1'] .cell.is-open .gate,
html[data-reduced='1'] .flag-cloth,
html[data-reduced='1'] .duck-eyelid,
html[data-reduced='1'] .duck-lift.is-surface,
html[data-reduced='1'] .duck-lift.is-surface + .duck-veil,
html[data-reduced='1'] .tile-current {
  animation: none;
}
html[data-reduced='1'] .cloud { transform: translateX(var(--cloud-x, 60vw)); }
html[data-reduced='1'] .duck-lift { transition: none; }

/* Préférence « moins de mouvement » (pas ?fast=1) : ni secousse, ni rebond, ni zoom ; les
   cartes et le plateau apparaissent en fondu (le spin de fin est un fondu enchaîné, game.js). */
html[data-motion='reduce'] #duck.is-burned .duck-anim,
html[data-motion='reduce'] .board.is-nudge .board-rot,
html[data-motion='reduce'] .board.is-nudge .duck-layer,
html[data-motion='reduce'] .board.is-nudge .fx-water,
html[data-motion='reduce'] .board.is-nudge .fx-top,
html[data-motion='reduce'] .duck-anim.is-landing,
html[data-motion='reduce'] .duck-anim.is-dive,
html[data-motion='reduce'] .is-flap .duck-wing,
html[data-motion='reduce'] .is-flap .duck-wing-shine {
  animation: none;
}
html[data-motion='reduce'] .duck-anim.is-stretch { transform: none; }
html[data-motion='reduce'] .msg-card { animation-name: fade-in; }
html[data-motion='reduce'] .message.is-leaving .msg-card { animation-name: fade-out; }
html[data-motion='reduce'] .board.is-reborn { animation-name: fade-in; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes fade-out { from { opacity: 1; } to { opacity: 0; } }

/* 13. Contraste forcé (Windows) : le plateau est une image de jeu, ses couleurs sont conservées */
@media (forced-colors: active) {
  #board, .stage, .btn-pad, #water-gauge, .gauge, .level-tile, .score-grid, .score-board, .msg-card, .hero-duck {
    forced-color-adjust: none;
  }
  .hud .btn, #btn-play, #btn-title-score, #btn-score-back, .gauge-dry {
    border: 2px solid ButtonText;
  }
  .cell[data-type='#'] .block { outline: 2px solid #000; }
  .cell[data-type='L'] .block { outline: 3px solid #b00; }
  .cell[data-type='H'] .block, .cell[data-type='V'] .block { outline: 2px solid #0a6; }
  .cell[data-type='F'] .block { outline: 3px solid #000; }
}
