@charset "UTF-8";
/* Écran de jeu : HUD, plateau, sac, ressources, effets et mises en page.
   Trois plans de valeur : le décor, flouté et assombri ; le plateau, sombre ;
   les objets sur leurs plaques, la surface la plus claire. */

/* ---- Identité des lieux ------------------------------------------------------
   La grammaire du jeu ne change jamais (plaque carrée = payant, médaillon rond =
   gratuit, or = pièces et score, cramoisi = danger). Chaque lieu redéfinit ses
   matières et son accent au travers de ces variables. La carte des stages et
   le grimoire (.page) reçoivent exactement les mêmes. */
.game-page,
.page {
  --frame-src: url("../assets/ui/frame.svg");
  --frame-repeat: stretch;
  --plate-src: url("../assets/ui/plate.svg");
  --panel: linear-gradient(90deg, #0e1129f2, #151938ee 48%, #0e1129f2);
  --panel-glow: none;
  --button-bg: linear-gradient(135deg, #1c2148f2, #0d0f26f2);
  --button-bg-hover: linear-gradient(135deg, #293166f2, #131734f2);
  --board-bg: #070818;
  --accent: #e3cca3;
  --label: #dcc69e;
  --title: #f6ddaf;
  --value: #ffe5b4;
  --detail: #cdb995;
  --gauge: linear-gradient(90deg, #585e79, #f7deaf);
  --kbd-bg: linear-gradient(#f3daad, #b8a788);
  --slot-bg: radial-gradient(ellipse at 50% 100%, #37428566, #0c0e24e8), var(--wood);
  --slot-border: #72799d66;
  --slot-filled-bg: radial-gradient(ellipse, #4e536b4d, #0c0f25);
  --slot-filled-border: #d5c09a;
}
/* Le Village : l'atelier. Chêne blond, cordes, miel. */
.game-page[data-realm="village"],
.page[data-realm="village"] {
  --frame-src: url("../assets/ui/frame-village.svg");
  --plate-src: url("../assets/ui/plate-village.svg");
  --panel:
    repeating-linear-gradient(0deg, rgba(255, 229, 180, 0.025) 0 1px, transparent 1px 5px),
    linear-gradient(90deg, #131735f2, #1b2046ee 48%, #131735f2);
  --panel-glow: inset 0 -14px 16px -14px rgba(255, 229, 180, 0.35);
  --button-bg: linear-gradient(160deg, #222956f2, #0e112af2);
  --button-bg-hover: linear-gradient(160deg, #2d366ff2, #141836f2);
  --board-bg: #030411;
  --accent: #e8d1a6;
  --label: #edd5a9;
  --title: #fde3b3;
  --value: #ffe5b4;
  --detail: #d9c49d;
  --gauge: linear-gradient(90deg, #636988, #ffe5b4);
  --slot-bg: radial-gradient(ellipse at 50% 100%, #585e7955, #0d1027e8), linear-gradient(#1a1f43, #0b0d23);
  --slot-border: #63698866;
  --slot-filled-bg: radial-gradient(ellipse at 50% 100%, rgba(255, 229, 180, 0.25), transparent 70%), linear-gradient(#222956, #0d1027);
  --slot-filled-border: #e8d1a6aa;
}
/* Le Château : la grande salle. Chêne ciré, or, bleu roi. */
.game-page[data-realm="castle"],
.page[data-realm="castle"] {
  --frame-src: url("../assets/ui/frame-castle.svg");
  --plate-src: url("../assets/ui/plate-castle.svg");
  --panel:
    radial-gradient(ellipse 70% 120% at 50% 0, rgba(91, 143, 224, 0.12), transparent 70%),
    linear-gradient(90deg, #131734f2, #1c2148ee 48%, #131734f2);
  --panel-glow: inset 0 -14px 16px -14px rgba(120, 160, 240, 0.35);
  --button-bg: linear-gradient(160deg, #222956f2, #10132df2);
  --button-bg-hover: linear-gradient(160deg, #2d3670f2, #161a3af2);
  --board-bg: #060817;
  --accent: #5b8fe0;
  --label: #e6cfa5;
  --title: #f6ddaf;
  --value: #ffe5b4;
  --detail: #b9c6e6;
  --gauge: linear-gradient(90deg, #2c4c96, #8fb4ff);
  --slot-bg: radial-gradient(ellipse at 50% 100%, rgba(91, 143, 224, 0.2), transparent 65%), linear-gradient(#121532, #07091a);
  --slot-border: #4e536b66;
  --slot-filled-bg: radial-gradient(ellipse at 50% 100%, rgba(120, 160, 240, 0.28), transparent 70%), linear-gradient(#161b3b, #090b1d);
  --slot-filled-border: #d9c49d;
}
/* La Crypte : le sanctuaire englouti. Pierre, bronze patiné, vert-de-gris. */
.game-page[data-realm="crypt"],
.page[data-realm="crypt"] {
  --kbd-bg: linear-gradient(#d8f0e4, #6f9a88);
  --frame-src: url("../assets/ui/frame-crypt.svg");
  --frame-repeat: round;
  --plate-src: url("../assets/ui/plate-crypt.svg");
  --panel:
    radial-gradient(ellipse 60% 140% at 50% 120%, rgba(95, 201, 168, 0.12), transparent 70%),
    linear-gradient(180deg, #161b3bf5, #10132df5);
  --panel-glow: inset 0 -14px 16px -14px rgba(95, 201, 168, 0.4);
  --button-bg: linear-gradient(160deg, #272f63f2, #121531f2);
  --button-bg-hover: linear-gradient(160deg, #333d7df2, #171c3ef2);
  --board-bg: #050513;
  --accent: #5fc9a8;
  --label: #8fd6be;
  --title: #dcf2ea;
  --value: #eefaf5;
  --detail: #a9c8bd;
  --gauge: linear-gradient(90deg, #2a7a62, #9ff0d4);
  --slot-bg: radial-gradient(ellipse at 50% 100%, rgba(95, 201, 168, 0.14), transparent 62%), linear-gradient(#1f2550, #0e1129);
  --slot-border: #3b4790;
  --slot-filled-bg: radial-gradient(ellipse at 50% 100%, rgba(95, 201, 168, 0.28), transparent 70%), linear-gradient(#272f63, #111430);
  --slot-filled-border: #5fc9a8aa;
  --wood: linear-gradient(160deg, #2c346c, #161a3a 50%, #212754);
}
/* Le Temple : l'observatoire. Ardoise, argent, lapis, violet. */
.game-page[data-realm="temple"],
.page[data-realm="temple"] {
  --kbd-bg: linear-gradient(#f4f6fc, #9aa3b8);
  --frame-src: url("../assets/ui/frame-temple.svg");
  --plate-src: url("../assets/ui/plate-temple.svg");
  --panel:
    radial-gradient(ellipse 70% 120% at 50% 0, rgba(182, 156, 240, 0.12), transparent 70%),
    linear-gradient(90deg, #121632f2, #1a1f44ee 48%, #121632f2);
  --panel-glow: inset 0 -14px 16px -14px rgba(182, 156, 240, 0.4);
  --button-bg: linear-gradient(160deg, #232a58f2, #10132df2);
  --button-bg-hover: linear-gradient(160deg, #2d3670f2, #151938f2);
  --board-bg: #060716;
  --accent: #b69cf0;
  --label: #c8bcf2;
  --title: #eee8ff;
  --value: #f6f2ff;
  --detail: #b8b7d6;
  --gauge: linear-gradient(90deg, #6a52b8, #e2d8ff);
  --slot-bg: radial-gradient(ellipse at 50% 100%, rgba(182, 156, 240, 0.14), transparent 62%), linear-gradient(#1c2249, #0c0f25);
  --slot-border: #384489;
  --slot-filled-bg: radial-gradient(ellipse at 50% 100%, rgba(182, 156, 240, 0.28), transparent 70%), linear-gradient(#242b5b, #0e112a);
  --slot-filled-border: #b69cf0aa;
  --wood: linear-gradient(160deg, #293167, #131735 50%, #1f254f);
}
/* Shared realm touches: the top bar, the carousel and the icons of the HUD. */
.game-page[data-realm] .game-location-name,
.page[data-realm] .game-location-name {
  color: var(--title);
}
.game-page[data-realm] .game-location-name small,
.page[data-realm] .game-location-name small {
  color: var(--label);
}
.game-page[data-realm] .realm-emblem-mini,
.page[data-realm] .realm-emblem-mini {
  filter: drop-shadow(0 0 6px var(--accent));
}

/* ---- Le Donjon : la forge des profondeurs ---------------------------------
   Fer forgé noirci, rivets, braise. L'accent reste orange : le cramoisi est
   réservé au danger. */
.game-page[data-realm="dungeon"],
.page[data-realm="dungeon"] {
  --kbd-bg: linear-gradient(#ffe5b4, #c9b693);
  --frame-src: url("../assets/ui/frame-dungeon.svg");
  --frame-repeat: round;
  --plate-src: url("../assets/ui/plate-dungeon.svg");
  --panel:
    radial-gradient(ellipse 60% 140% at 50% 120%, rgba(255, 229, 180, 0.16), transparent 70%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.018) 0 1px, transparent 1px 6px),
    linear-gradient(180deg, #131634f5, #0b0e23f5 72%, #0b0e23f5);
  --panel-glow: inset 0 -14px 16px -14px rgba(255, 229, 180, 0.5);
  --button-bg:
    radial-gradient(ellipse 90% 60% at 50% 115%, rgba(255, 229, 180, 0.16), transparent 70%),
    linear-gradient(165deg, #222956f2, #0f122af2);
  --button-bg-hover:
    radial-gradient(ellipse 90% 70% at 50% 115%, rgba(255, 229, 180, 0.3), transparent 70%),
    linear-gradient(165deg, #2d366ff2, #131735f2);
  --board-bg: #040411;
  --accent: #ffe5b4;
  --label: #f2daac;
  --title: #ffe5b4;
  --value: #ffe5b4;
  --detail: #d9c49d;
  --gauge: linear-gradient(90deg, #636988, #ffe5b4);
  --slot-bg:
    radial-gradient(ellipse at 50% 120%, rgba(255, 229, 180, 0.16), transparent 62%),
    linear-gradient(#181d41, #0b0d21);
  --slot-border: #2e3771;
  --slot-filled-bg:
    radial-gradient(ellipse at 50% 110%, rgba(255, 229, 180, 0.32), transparent 70%),
    linear-gradient(#202752, #0d1027);
  --slot-filled-border: #ffe5b4aa;
  --wood:
    repeating-linear-gradient(90deg, #ffffff06 0 1px, transparent 1px 7px),
    linear-gradient(160deg, #202651, #10132d 50%, #171c3e);
}
.game-page[data-realm="dungeon"] .game-topbar,
.page[data-realm="dungeon"] .game-topbar {
  background: linear-gradient(180deg, #0c0e24f2, #10132de0 75%, #070819e8);
  border-bottom: 2px solid #202652;
  box-shadow:
    0 1px 0 rgba(255, 229, 180, 0.4),
    0 4px 24px #000000aa;
}
.game-page[data-realm="dungeon"] .game-location-name,
.page[data-realm="dungeon"] .game-location-name {
  color: #ffe5b4;
}
.game-page[data-realm="dungeon"] .game-location-name small,
.page[data-realm="dungeon"] .game-location-name small {
  color: #d9c49d;
}
.game-page[data-realm="dungeon"] .game-actions .icon-button,
.page[data-realm="dungeon"] .game-actions .icon-button {
  border-color: #364184;
  box-shadow:
    inset 0 0 0 2px #07091a,
    inset 0 0 0 3px rgba(255, 229, 180, 0.25),
    0 3px 7px #00000066;
}
.game-page[data-realm="dungeon"] .family-focus {
  border-color: #2d3670;
}
.game-page[data-realm="dungeon"] .family-focus-item .artifact-icon {
  background: radial-gradient(ellipse at 50% 90%, rgba(255, 229, 180, 0.2), #0c0e23 72%);
  border-color: #364184;
}
.game-page[data-realm="dungeon"] .trio-badge:not(.done) {
  border-color: #4e536b;
  color: #c9b693;
}
/* The forge glows under the board. */
.game-page[data-realm="dungeon"] .board-frame {
  box-shadow:
    0 14px 40px #000000cc,
    0 18px 50px -20px rgba(255, 229, 180, 0.35);
}

/* ---- Carte-titre et emblème d'un lieu --------------------------------------- */
.realm-emblem-mini {
  width: 30px;
  height: 30px;
  margin-right: -4px;
  filter: drop-shadow(0 0 6px rgba(255, 229, 180, 0.45));
}
.realm-card {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 4px;
  pointer-events: none;
  text-align: center;
  /* An ellipse of shadow with soft edges, no hard band across the board. */
  background: radial-gradient(ellipse 46% 44% at 50% 50%, rgba(3, 4, 16, 0.9) 35%, rgba(3, 4, 16, 0.62) 62%, rgba(3, 4, 16, 0) 100%);
  animation: realm-card 2.3s ease both;
}
.realm-card-emblem {
  width: 98px;
  height: 98px;
  filter: drop-shadow(0 0 20px rgba(255, 229, 180, 0.6));
  animation: realm-emblem 0.75s cubic-bezier(0.2, 0.9, 0.3, 1.25) both;
}
.realm-card strong {
  font: 600 46px var(--display);
  letter-spacing: 0.14em;
  color: var(--title);
  text-shadow:
    0 0 26px rgba(255, 229, 180, 0.6),
    0 3px 4px #000000;
  animation: realm-title 0.9s ease-out 0.1s both;
}
.realm-card-sub {
  font: 600 13px var(--display);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--label);
}
.realm-card-motto {
  margin-top: 2px;
  font: 18px var(--serif);
  color: var(--detail);
}
@keyframes realm-card {
  0% {
    opacity: 0;
  }
  12%,
  80% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(-12px);
  }
}
@keyframes realm-emblem {
  from {
    opacity: 0;
    transform: scale(0.4) rotate(-25deg);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes realm-title {
  from {
    opacity: 0;
    letter-spacing: 0.5em;
  }
  to {
    opacity: 1;
    letter-spacing: 0.14em;
  }
}

/* ---- Scène ---------------------------------------------------------------- */
.game-page:before {
  background:
    radial-gradient(ellipse 80% 75% at 50% 50%, rgba(4, 5, 18, 0.12), rgba(3, 3, 15, 0.55)),
    linear-gradient(#07081890, #080a1c38 30%, #0a0c1f40 75%, #050513c0);
}
.game-topbar {
  height: 48px;
}
.game-location .brand {
  font-size: 16px;
}
.game-location .brand-mark {
  font-size: 24px;
}
.game-location-name {
  font-size: 15px;
}
.game-location-name small {
  font: 12px var(--display);
  letter-spacing: 0.08em;
}
.game-location-name small .num {
  font-size: 14px;
}
.game-actions .icon-button {
  width: 42px;
  height: 38px;
}
.game-actions svg.glyph {
  width: 21px;
  height: 21px;
}
.game-table {
  width: min(clamp(1500px, 70vw, 2100px), calc((100dvh - 322px) * 20 / 7), calc(100vw - 100px));
}
@media (max-width: 1100px) {
  .game-table {
    width: min(calc((100dvh - 322px) * 20 / 7), calc(100vw - 64px));
  }
}
.game-footer {
  position: absolute;
  left: 14px;
  bottom: 6px;
  padding: 0;
  z-index: 2;
  font-size: 12px;
}

/* ---- HUD ------------------------------------------------------------------ */
.game-hud {
  grid-template-columns: 1fr 1.15fr 2.4fr 1fr 1fr;
  height: 108px;
  gap: 10px;
  margin: 0 12px;
  padding: 2px 6px 0;
  border: 12px solid transparent;
  border-bottom: 0;
  border-image: var(--frame-src) 24 24 0 24 / 12px 12px 0 12px var(--frame-repeat);
  background: var(--panel) padding-box;
  box-shadow:
    0 -8px 28px #00000066,
    var(--panel-glow);
}
.hud-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 0;
}
.hud-stat .label {
  margin: 0;
  font-weight: 600;
  letter-spacing: 0.16em;
  color: var(--label);
}
.hud-stat .value,
.game-hud .value {
  font: 500 28px/1.02 var(--numeric);
  font-variant-numeric: lining-nums tabular-nums;
  color: var(--value);
  text-shadow: 0 2px 3px #000000;
  white-space: nowrap;
}
/* The time is the vital reading: it dominates. The score is only a result. */
.hud-time .value,
.game-hud .hud-time .value {
  font-size: 38px;
  font-weight: 600;
}
.hud-score .value,
.game-hud .hud-score .value {
  font-size: 24px;
}
.hud-time-readout {
  position: relative;
  isolation: isolate;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
}
.time-astrolabe {
  position: absolute;
  width: calc(100% + 30px);
  height: 72px;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  fill: none;
  stroke: var(--accent);
  stroke-width: .7;
  opacity: .5;
  pointer-events: none;
  z-index: -1;
}
.hud-time-readout::before {
  content: "";
  position: absolute;
  width: calc(100% + 18px);
  height: 64px;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: conic-gradient(var(--gold) var(--time-arc, 360deg), #a6b5df18 0);
  mask: radial-gradient(transparent 64%, #000 66% 69%, transparent 71%);
  opacity: .7;
  pointer-events: none;
  z-index: -1;
}
.hud-time.is-urgent .hud-time-readout::before { background: conic-gradient(var(--danger) var(--time-arc), transparent 0); }
.hud-time.is-frozen .hud-time-readout::before { background: var(--ice); }
.hud-thaw {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--ice);
  border-radius: 8px;
  color: var(--ice);
  background: #222956;
  box-shadow: 0 0 10px #7fdfff55;
  cursor: pointer;
}
.hud-thaw[hidden] {
  display: none;
}
.hud-thaw:hover,
.hud-thaw:focus-visible {
  background: #354082;
  outline: 2px solid var(--ice);
  outline-offset: 2px;
}
.hud-thaw svg.glyph {
  width: 17px;
  height: 17px;
  fill: currentColor;
  stroke: currentColor;
}
.hud-stat .detail {
  margin: 0;
  min-height: 17px;
  font: 14px/1.2 var(--serif);
  color: var(--detail);
  white-space: nowrap;
}
.cup-gauge,
.time-gauge,
.count-gauge {
  position: relative;
  display: block;
  width: min(128px, 82%);
  height: 6px;
  background: #050614;
  border: 1px solid #2b336a;
  border-radius: 3px;
}
.cup-gauge i,
.time-gauge i,
.count-gauge i {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  border-radius: 2px;
  background: linear-gradient(90deg, #6c7294, #ffe5b4);
  transition: width 0.35s ease;
}
.cup-gauge b {
  position: absolute;
  top: -4px;
  bottom: -4px;
  width: 3px;
  margin-left: -1.5px;
  border-radius: 1px;
  background: #1a2045;
  box-shadow: 0 0 0 1px #050614;
}
.cup-gauge b.bronze {
  left: 50%;
}
.cup-gauge b.silver {
  left: 75%;
}
.cup-gauge b.gold {
  left: 100%;
}
.cup-gauge.bronze b.bronze {
  background: #e0caa1;
  box-shadow: 0 0 6px #e0caa1;
}
.cup-gauge.silver b.silver {
  background: #e3edf6;
  box-shadow: 0 0 6px #e3edf6;
}
.cup-gauge.gold b.gold {
  background: #ffe5b4;
  box-shadow: 0 0 8px #ffe5b4;
}
#hud-time.danger {
  color: #ff4b62;
  text-shadow:
    0 0 16px rgba(255, 59, 92, 0.75),
    0 2px 3px #000000;
}
.hud-time.is-urgent .time-gauge i {
  background: var(--danger);
}
.hud-time.is-frozen .value {
  color: var(--ice);
  text-shadow:
    0 0 14px rgba(160, 230, 255, 0.85),
    0 2px 3px #000000;
}
.hud-time.is-frozen .time-gauge i {
  background: linear-gradient(90deg, #6fc3e6, #d9f6ff);
}
.hud-time .detail {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--ice);
}
.hud-time .detail svg.glyph {
  width: 15px;
  height: 15px;
  stroke: var(--ice);
  filter: none;
  stroke-width: 2;
}
.hud-trios .value,
.hud-pairs .value {
  font-size: 28px;
}
.time-gauge i,
.count-gauge i {
  background: var(--gauge);
}

/* Family in focus: its three objects, the pair of each, the trio of all. */
.family-focus {
  gap: 4px;
  padding: 0 2px;
}
.family-focus .icon-button {
  width: 34px;
  height: 64px;
  border: 0;
  background: transparent;
  box-shadow: none;
}
.family-focus-title {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 10px;
  margin-bottom: 5px;
  font: 600 14px var(--display);
  letter-spacing: 0.06em;
  color: var(--title);
}
.family-focus-title small {
  font: 14px var(--numeric);
  font-variant-numeric: lining-nums tabular-nums;
  color: #c3b18f;
}
.family-focus-icons {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
}
.family-focus-item {
  position: relative;
}
.family-focus-item .artifact-icon {
  width: 56px;
  height: 56px;
}
.family-focus-item.pair-done .artifact-icon {
  border-color: #f0d8ab;
  box-shadow:
    inset 0 0 9px #00000077,
    0 0 10px #f0d8ab66;
}
.family-focus-item .variant-glyph {
  left: 2px;
  bottom: 2px;
}
.pair-mark {
  position: absolute;
  right: -7px;
  bottom: -7px;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #0c0f25;
  border: 1.5px solid #364185;
}
.pair-done .pair-mark {
  background: radial-gradient(circle at 40% 35%, #ffe5b4, #c2b08e);
  border-color: #ffe5b4;
}
/* The trio still to gather: three dotted objects, in the dashed medallion. */
.trio-badge:not(.done) svg.glyph {
  width: 18px;
  height: 18px;
  stroke: #c9b693;
  stroke-width: 2;
  filter: none;
}
.pair-mark svg.glyph,
.trio-badge svg.glyph {
  width: 13px;
  height: 13px;
  stroke: #10132d;
  stroke-width: 3.2;
  filter: none;
}
.trio-badge {
  display: grid;
  place-items: center;
  align-content: center;
  width: 58px;
  height: 58px;
  margin-left: 4px;
  border-radius: 50%;
  border: 1.5px dashed #50556e;
  font: 600 12px var(--display);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #71789c;
}
.trio-badge.done {
  border: 2px solid #ffe5b4;
  background: radial-gradient(circle at 40% 35%, #ffe5b4, #b8a788);
  color: #10132d;
  box-shadow: 0 0 12px #f0d8ab90;
}
.trio-badge.done span {
  font-size: 12px;
  line-height: 1;
}
/* ---- Plateau et sac --------------------------------------------------------- */
.board-frame {
  padding: 0;
  border: 14px solid transparent;
  border-image: var(--frame-src) 24 / 14px var(--frame-repeat);
  background: var(--board-bg);
  box-shadow: 0 14px 40px #000000bb;
}
.board-frame:before,
.board-frame:after {
  display: none;
}
#board {
  box-shadow: 0 0 0 1px #000000;
}
/* Shortcuts are pressed while the board has focus: its ring stays discreet,
   the arrow keys draw their own cursor on the cell. */
#board:focus-visible {
  outline: 1px solid rgba(255, 229, 180, 0.35);
  outline-offset: -2px;
}
.bag-meter {
  position: relative;
  z-index: 3;
  width: max-content;
  margin: -15px 30px -13px auto;
  display: flex;
  align-items: baseline;
  gap: 5px;
  padding: 0 10px;
  border: 7px solid transparent;
  border-image: var(--plate-src) 8 fill / 7px stretch;
  font: 600 12px var(--display);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--label);
  text-shadow: 0 1px 1px #000000;
}
.bag-meter b {
  font: 700 16px var(--numeric);
  letter-spacing: 0;
  color: #ffe5b4;
}
.bag-meter .num:last-child {
  font-size: 14px;
  letter-spacing: 0;
}
.bag-meter.warn,
.bag-meter.warn b {
  color: #ffe5b4;
}
.bag-meter.danger,
.bag-meter.danger b {
  color: #ff8a9a;
}
.bag-meter.danger b {
  color: #ff5a70;
}
.bag-slots {
  gap: 5px;
  margin-top: 12px;
}
.game-page .bag-slot {
  background: var(--slot-bg);
  border-color: var(--slot-border);
}
.game-page .bag-slot.filled {
  background: var(--slot-filled-bg);
  border-color: var(--slot-filled-border);
}
.bag-slot {
  height: clamp(38px, 4vw, 58px);
}
.bag-slot.incoming .artifact-icon,
.bag-slot.incoming .variant-glyph {
  opacity: 0;
}
.bag-slots.warn .bag-slot:not(.filled) {
  border-color: #ffe5b4aa;
  box-shadow:
    inset 0 3px 8px #000000aa,
    inset 0 0 0 1px #ffe5b455;
}
.bag-slots.danger .bag-slot:not(.filled) {
  border-color: var(--danger);
  box-shadow:
    inset 0 3px 8px #000000aa,
    inset 0 0 14px rgba(255, 59, 92, 0.4);
}
/* A run in the order of the family card: a gold thread beneath, worth double. */
.game-page .bag-slot.ordered {
  border-color: #ffe5b4;
  background: radial-gradient(ellipse at 50% 100%, #c8b59266, #0c0f25);
  box-shadow:
    inset 0 3px 8px #000000aa,
    inset 0 -4px 0 #f5dcae,
    0 0 14px #ffe5b488;
  animation: ordered-glow 1.6s ease-in-out infinite;
}
/* Colour variants also carry a shape: never colour alone. */
.variant-glyph {
  position: absolute;
  left: 3px;
  bottom: 3px;
  width: 12px;
  height: 12px;
  pointer-events: none;
  background: center / contain no-repeat;
}
.variant-glyph.diamond {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M6 .8 10.4 6 6 11.2 1.6 6Z' fill='%23ef4a5e' stroke='%23120a04' stroke-width='1.3'/%3E%3C/svg%3E");
}
.variant-glyph.circle {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Ccircle cx='6' cy='6' r='4.6' fill='%233fc47a' stroke='%23120a04' stroke-width='1.3'/%3E%3C/svg%3E");
}
.variant-glyph.triangle {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M6 1 11.2 10.4H.8Z' fill='%235b96f5' stroke='%23120a04' stroke-width='1.3'/%3E%3C/svg%3E");
}

/* ---- Ressources ----------------------------------------------------------- */
.resource-bar {
  gap: 8px;
  margin: 12px 0 0;
}
.resource-button,
.resource-display {
  min-height: 54px;
  max-width: 230px;
  padding: 3px 12px;
  gap: 10px;
  border: 7px solid transparent;
  border-image: var(--frame-src) 24 / 7px var(--frame-repeat);
  background: var(--button-bg) padding-box;
  box-shadow: 0 3px 8px #00000077;
}
.resource-button:hover:not([aria-disabled="true"]) {
  background: var(--button-bg-hover) padding-box;
  box-shadow: 0 0 14px #c7b49144;
}
.resource-text .resource-label {
  font-weight: 600;
  letter-spacing: 0.025em;
  white-space: normal;
  line-height: 1.15;
  padding-right: 16px;
  color: var(--label);
}
.resource-text .resource-value {
  font: 600 24px/1 var(--numeric);
  font-variant-numeric: lining-nums tabular-nums;
  color: var(--value);
}
.resource-button .artifact-icon,
.resource-display .artifact-icon {
  width: 34px;
  height: 34px;
}
.resource-button[aria-disabled="true"] {
  cursor: default;
}
/* Three readable states: nothing to use, available, running. */
/* Empty: desaturated but still legible, the icon is the only clue on a phone. */
.is-empty .artifact-icon {
  filter: grayscale(0.85) brightness(0.95);
  opacity: 0.62;
}
.is-empty .resource-value {
  color: #737a9e;
}
.resource-display.is-empty[data-resource="gold"] .resource-value {
  color: var(--danger-soft);
}
/* Ready: only a glowing ring. Active (inventory running): a filled plate. */
.resource-button.is-ready {
  box-shadow:
    0 0 0 1px #ffe5b4,
    0 0 14px #ffe5b488;
}
.resource-button.is-ready .artifact-icon {
  filter: drop-shadow(0 0 7px #ffe5b4);
}
.resource-button.is-active {
  background:
    linear-gradient(180deg, rgba(255, 229, 180, 0.28), transparent 45%),
    radial-gradient(ellipse at 30% 50%, #666d8df2, #202752f2) padding-box;
  box-shadow:
    0 0 18px #f3daad70,
    inset 0 0 14px #ffe5b440;
}
.resource-button.is-active .artifact-icon {
  filter: drop-shadow(0 0 8px #ffe5b4);
}
.resource-button.is-active .resource-value {
  font: 700 14px var(--display);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #ffe5b4;
}
.resource-button kbd {
  position: absolute;
  top: 2px;
  right: 3px;
  bottom: auto;
  min-width: 17px;
  height: 17px;
  padding: 0 3px;
  display: grid;
  place-items: center;
  font: 700 12px/1 var(--display);
  color: #10132d;
  background: var(--kbd-bg);
  border: 1px solid #191d41;
  border-radius: 3px;
  box-shadow: 0 2px 0 #191d41;
}
@media (hover: none) {
  .resource-button kbd {
    display: none;
  }
}
.mult-badge {
  position: absolute;
  top: -13px;
  right: 12px;
  padding: 0 7px;
  font: 700 16px/1.3 var(--numeric);
  color: #0e112a;
  background: linear-gradient(#ffe5b4, #e0caa1);
  border: 1px solid #ffe5b4;
  border-radius: 10px;
  box-shadow:
    0 0 12px #ffe5b4aa,
    0 2px 3px #000000aa;
}
.mult-badge[hidden] {
  display: none;
}
.gear-sockets {
  display: flex;
  gap: 5px;
}
.gear-sockets i {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 2px solid #595f7a;
  background: #08091b;
}
.gear-sockets.one i:first-child {
  background: radial-gradient(circle at 40% 35%, #ffe5b4, #b8a788);
  border-color: #ffe5b4;
  box-shadow: 0 0 8px #f0d8ab;
}

/* Nothing on the game screen is selectable text: a double tap or a long
   press never selects the HUD nor opens a callout on the board. */
.game-page {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  padding-top: env(safe-area-inset-top);
}
.game-topbar {
  padding-left: calc(28px + env(safe-area-inset-left));
  padding-right: calc(28px + env(safe-area-inset-right));
}

/* ---- Effets d'interface ---------------------------------------------------- */
#fx-layer {
  position: fixed;
  inset: 0;
  z-index: 60;
  overflow: hidden;
  pointer-events: none;
}
.fx-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.fx-sprite {
  position: absolute;
  left: 0;
  top: 0;
  will-change: transform;
}
.fx-sprite .artifact-icon {
  width: 100%;
  height: 100%;
}
.fx-flying {
  filter: drop-shadow(0 0 9px rgba(255, 229, 180, 0.8)) drop-shadow(0 7px 7px rgba(0, 0, 0, 0.6));
}
.fx-ghost {
  filter: drop-shadow(0 0 10px #ffe5b4) brightness(1.25);
}
.fx-text {
  position: absolute;
  left: 0;
  top: 0;
  white-space: nowrap;
  font: 700 22px var(--numeric);
  font-variant-numeric: lining-nums tabular-nums;
  color: #ffe5b4;
  text-shadow:
    0 0 10px rgba(255, 229, 180, 0.85),
    0 2px 2px #000000;
  will-change: transform, opacity;
}
.fx-text.cost {
  font-size: 19px;
  color: #ffc2b6;
  text-shadow:
    0 0 8px rgba(255, 80, 80, 0.55),
    0 2px 2px #000000;
}
.fx-text.score {
  font-size: 28px;
}
.fx-text.big {
  font-size: 34px;
}
.fx-text.banner {
  padding: 2px 16px;
  font: 600 16px var(--display);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #ffe5b4;
  border: 8px solid transparent;
  border-image: url("../assets/ui/plate.svg") 8 fill / 8px stretch;
}
.fx-text.score.ordered {
  font-size: 42px;
  color: #ffe5b4;
  text-shadow:
    0 0 14px rgba(255, 229, 180, 0.95),
    0 0 32px rgba(255, 229, 180, 0.6),
    0 2px 2px #000000;
}
.fx-text.banner.ordered {
  font-size: 15px;
  color: #a1c4ff;
  text-shadow: 0 0 10px rgba(255, 229, 180, 0.9);
}
.fx-tip {
  position: absolute;
  max-width: 290px;
  padding: 9px 14px;
  font: 16px/1.4 var(--serif);
  color: #f3daad;
  background: #10142ef5;
  border: 1px solid #b8a788;
  border-radius: 4px;
  box-shadow: 0 8px 24px #000000cc;
  transition: opacity 0.22s ease;
}
.fx-tip:after {
  content: "";
  position: absolute;
  left: var(--arrow, 50%);
  bottom: -7px;
  width: 12px;
  height: 12px;
  margin-left: -6px;
  background: inherit;
  border-right: 1px solid #b8a788;
  border-bottom: 1px solid #b8a788;
  transform: rotate(45deg);
}
.fx-tip.below:after {
  top: -7px;
  bottom: auto;
  transform: rotate(225deg);
}
.fx-tip.error {
  background: #10132df5;
  border-color: var(--danger);
}
.fx-tip.error:after {
  border-color: var(--danger);
}
.fx-tip.leaving {
  opacity: 0;
}

/* ---- Très grands écrans : l'interface grandit avec le plateau --------------- */
@media (min-width: 2200px) and (min-height: 1200px) {
  .game-hud {
    height: 134px;
  }
  .hud-stat .label,
  .resource-text .resource-label {
    font-size: 14px;
  }
  .hud-stat .value,
  .game-hud .value {
    font-size: 34px;
  }
  .game-hud .hud-time .value {
    font-size: 48px;
  }
  .game-hud .hud-score .value {
    font-size: 30px;
  }
  .family-focus-title {
    font-size: 17px;
  }
  .family-focus-item .artifact-icon,
  .trio-badge {
    width: 68px;
    height: 68px;
  }
  .resource-button,
  .resource-display {
    min-height: 66px;
    max-width: 290px;
  }
  .resource-text .resource-value {
    font-size: 30px;
  }
  .resource-button .artifact-icon,
  .resource-display .artifact-icon {
    width: 44px;
    height: 44px;
  }
  .bag-slot {
    height: 72px;
  }
  .bag-meter b {
    font-size: 19px;
  }
}

/* System messages appear at the top, under the bar of the screen: in play the
   resources at the bottom stay in sight, in the menus the top bar stays clear. */
#toast {
  top: 100px;
  bottom: auto;
}
body[data-scene] #toast {
  top: 60px;
}
@media (max-width: 760px) {
  #toast {
    top: 76px;
  }
}

/* ---- Urgence --------------------------------------------------------------- */
.game-page.is-urgent:after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 52%, rgba(255, 40, 72, 0.34) 100%);
}

/* ---- Appareil tenu en portrait -------------------------------------------- */
/* The overlay sits in <body>, above the dialogs, and shows only during a game. */
.rotate-overlay {
  display: none;
}
@media (orientation: portrait) and (max-width: 600px) {
  body[data-scene] .rotate-overlay {
    position: fixed;
    inset: 0;
    z-index: 300;
    display: grid;
    place-items: center;
    padding: 24px;
    background: #050615;
  }
  .rotate-card {
    display: grid;
    justify-items: center;
    gap: 16px;
    max-width: 300px;
    text-align: center;
  }
  .rotate-card strong {
    font: 600 22px var(--display);
    letter-spacing: 0.06em;
    color: #f6ddaf;
  }
  .rotate-card p {
    font: 17px/1.6 var(--serif);
    color: #dcc69e;
  }
  .rotate-phone {
    position: relative;
    width: 46px;
    height: 76px;
    border: 3px solid #e3cca3;
    border-radius: 9px;
  }
  .rotate-phone:after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 5px;
    width: 10px;
    height: 3px;
    margin-left: -5px;
    border-radius: 2px;
    background: #e3cca3;
  }
  .game-page .orientation-note {
    display: none;
  }
}

/* ---- Tablette et téléphone tenus en portrait ------------------------------- */
@media (orientation: portrait) {
  .game-hud {
    height: auto;
    padding: 6px 4px 10px;
    grid-template-columns: repeat(4, 1fr);
    row-gap: 10px;
  }
  .hud-time .value,
  .game-hud .hud-time .value {
    font-size: 30px;
  }
  .family-focus {
    grid-column: 1 / -1;
    grid-row: 2;
  }
}

/* ---- Téléphone en paysage : tout tient à l'écran, sans défilement ----------- */
/* A laptop screen (501 to 700 px tall): the bag and the reserves close in,
   and the board takes what is left, so that the whole game fits. */
@media (min-height: 501px) and (max-height: 700px) and (orientation: landscape) {
  .game-table {
    width: min(clamp(1500px, 70vw, 2100px), calc((100dvh - 312px) * 20 / 7), calc(100vw - 64px));
    margin-block: 4px;
  }
  .bag-slots {
    margin-top: 8px;
  }
  .bag-slot {
    height: clamp(34px, 6.4vh, 42px);
  }
  .resource-bar {
    margin-top: 8px;
  }
  .resource-button,
  .resource-display {
    min-height: 46px;
  }
}
@media (max-height: 500px) and (orientation: landscape) {
  .game-page {
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
  }
  .game-topbar {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 5;
    height: 44px;
    padding: 0 6px;
    border: 0;
    background: none;
    box-shadow: none;
  }
  .game-location {
    display: none;
  }
  .game-actions {
    gap: 3px;
  }
  .game-actions .icon-button {
    width: 38px;
    height: 36px;
  }
  .game-table {
    width: calc(100vw - 12px - env(safe-area-inset-left) - env(safe-area-inset-right));
    height: calc(100dvh - 8px);
    margin: 4px calc(6px + env(safe-area-inset-right)) 4px calc(6px + env(safe-area-inset-left));
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr);
    grid-template-rows: 40px minmax(0, 1fr) auto;
    gap: 4px 6px;
    align-content: start;
  }
  .game-hud {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 14px;
    height: 40px;
    margin: 0 134px 0 0;
    padding: 0 8px;
    border: 1px solid color-mix(in srgb, var(--accent) 55%, transparent);
    border-image: none;
    background: var(--panel);
  }
  .hud-stat {
    flex-direction: row;
    align-items: baseline;
    gap: 6px;
  }
  .hud-stat .detail,
  .cup-gauge,
  .time-gauge,
  .count-gauge,
  .hud-score .label,
  .hud-time .label,
  .family-focus-title small {
    display: none;
  }
  .game-hud .value,
  .game-hud .hud-score .value,
  .hud-trios .value,
  .hud-pairs .value {
    font-size: 20px;
  }
  .game-hud .hud-time .value {
    font-size: 24px;
  }
  .hud-time-readout {
    gap: 4px;
  }
  .hud-thaw {
    width: 30px;
    height: 30px;
  }
  .hud-score .value {
    color: #d9c49d;
  }
  .family-focus {
    flex: 1;
    order: 5;
    gap: 2px;
    padding: 0;
    border: 0;
  }
  .family-focus .icon-button {
    width: 24px;
    height: 36px;
  }
  .family-focus-content {
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .family-focus-title {
    margin: 0;
    font-size: 12px;
  }
  .family-focus-icons {
    gap: 7px;
  }
  .family-focus-item .artifact-icon {
    width: 30px;
    height: 30px;
  }
  .pair-mark {
    right: -4px;
    bottom: -4px;
    width: 14px;
    height: 14px;
  }
  .pair-mark svg.glyph {
    width: 9px;
    height: 9px;
  }
  .trio-badge {
    width: 30px;
    height: 30px;
  }
  .trio-badge span {
    display: none;
  }
  .board-frame {
    grid-column: 2;
    grid-row: 2;
    justify-self: center;
    align-self: start;
    width: min(100%, calc((100dvh - 106px) * 20 / 7 + 10px));
    border-width: 5px;
    border-image-width: 5px;
  }
  .bag-slots {
    grid-column: 2;
    grid-row: 3;
    justify-self: center;
    width: min(100%, calc((100dvh - 106px) * 20 / 7 + 10px));
    margin: 0;
    gap: 3px;
  }
  .bag-slot {
    height: clamp(26px, 9dvh, 36px);
  }
  .bag-meter {
    grid-column: 1;
    grid-row: 3;
    align-self: center;
    justify-self: stretch;
    width: auto;
    margin: 0;
    padding: 0 2px;
    border-width: 4px;
    border-image-width: 4px;
    justify-content: center;
  }
  .bag-meter > span:first-child {
    display: none;
  }
  .resource-bar {
    grid-column: 1;
    grid-row: 2;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 3px;
    margin: 0;
    min-height: 0;
    overflow: hidden;
  }
  .resource-button,
  .resource-display {
    flex: 1 1 0;
    flex-direction: column;
    justify-content: center;
    gap: 0;
    height: auto;
    max-height: 44px;
    min-height: 0;
    max-width: none;
    padding: 1px;
    border-width: 4px;
    border-image-width: 4px;
  }
  .resource-button .artifact-icon,
  .resource-display .artifact-icon {
    width: 20px;
    height: 20px;
  }
  .resource-text {
    text-align: center;
  }
  .resource-text .resource-label,
  .resource-button kbd {
    display: none;
  }
  .resource-text .resource-value {
    font-size: 15px;
  }
  .resource-button.is-active .resource-value {
    font-size: 12px;
    letter-spacing: 0.04em;
  }
  .gear-sockets {
    position: absolute;
    top: 2px;
    right: 2px;
    gap: 2px;
  }
  .gear-sockets i {
    width: 7px;
    height: 7px;
    border-width: 1px;
  }
  .mult-badge {
    top: -7px;
    right: -5px;
    padding: 0 4px;
    font-size: 12px;
  }
  .orientation-note {
    display: none;
  }
  body[data-scene] #toast {
    top: 48px;
  }
  .realm-card-emblem {
    width: 56px;
    height: 56px;
  }
  .realm-card strong {
    font-size: 26px;
  }
  .realm-card-motto {
    display: none;
  }
}

/* ---- Fenêtres : tout tient à l'écran ----------------------------------------
   Une fenêtre ne défile jamais. Un texte trop long se lit en pages, qu'on
   tourne avec ‹ › ou les flèches ; le reste se resserre (fitDialog). */
.book-page[hidden] {
  display: none !important;
}
.book-page > :first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}
.book-pager {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: none;
}
.book-pager .icon-button {
  width: 40px;
  height: 40px;
}
.book-pager .icon-button[aria-disabled="true"] {
  opacity: 0.35;
  cursor: default;
}
.book-count {
  min-width: 92px;
  text-align: center;
  font: 600 13px var(--display);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
}
.modal.paged .modal-actions:last-of-type {
  justify-content: space-between;
  align-items: center;
}
.modal.paged .modal-actions:last-of-type .button {
  flex: 0 1 260px;
}
/* The first stage explains the game: its dialog takes the width it needs. */
.modal:has(.tutorial-grid) {
  width: min(760px, 100%);
}
/* On a tall screen, « Voir le tutoriel » stands under the stage's choices. */
.modal .intro-tutorial {
  order: 3;
  flex-basis: 100%;
}
/* A full constellation of families needs a broad introduction: its twenty
   portraits stay readable without shrinking the entire dialog. */
.modal:has(.intro-families) {
  width: min(860px, 100%);
}
@media (min-height: 821px) {
  .modal:has(.intro-families) {
    padding: 28px 34px 30px;
  }
  .modal:has(.intro-families) .modal-heading {
    margin-bottom: 18px;
  }
  .modal:has(.intro-families) .modal-heading h2 {
    font-size: 32px;
  }
  .modal:has(.intro-families) .modal-heading:after {
    margin-top: 14px;
  }
}
/* A laptop screen: the frame and the headings give back some room, and the
   dialogs of a stage spread across rather than down. */
@media (max-height: 820px) {
  .modal {
    padding: 26px 34px 28px;
  }
  .modal:has(.stage-objectives, .result-stats) {
    width: min(760px, 100%);
  }
  .modal .stage-objectives,
  .modal .result-stats {
    padding-block: 12px;
  }
  .tutorial-grid {
    margin: 14px 0;
  }
  .tutorial-tip {
    margin-top: 10px;
  }
  .result-emblem .artifact-icon {
    width: 80px;
    height: 80px;
  }
  .result-rays {
    width: 170px;
    height: 170px;
  }
  .result-stats {
    margin: 14px 0;
  }
  .modal-heading {
    margin-bottom: 16px;
  }
  .modal-heading h2 {
    font-size: 30px;
    margin-top: 6px;
  }
  .modal-heading p {
    margin-top: 8px;
  }
  .modal-heading:after {
    margin-top: 12px;
  }
  .modal-actions {
    margin-top: 18px;
  }
  .rule-bonus-grid {
    margin-top: 18px;
    padding-top: 18px;
  }
  .keyboard-hints {
    margin-top: 16px;
    padding-top: 14px;
  }
}
/* A small laptop: the ornament goes, the figures and the steps close in. */
@media (max-height: 700px) {
  .modal {
    padding-block: 18px 20px;
  }
  .modal-heading {
    margin-bottom: 10px;
  }
  .modal-heading h2 {
    font-size: 26px;
  }
  .modal-heading:after {
    display: none;
  }
  .modal .stage-objectives,
  .modal .result-stats {
    padding-block: 8px;
    margin-block: 8px;
  }
  .stage-objectives strong,
  .result-stats strong {
    font-size: 22px;
    margin-bottom: 2px;
  }
  .tutorial-grid {
    margin: 8px 0;
  }
  .tutorial-step .tile-plaque,
  .tutorial-step .tile-medallion {
    width: 42px;
    height: 42px;
    margin-bottom: 4px;
  }
  .tutorial-step p,
  .tutorial-tip,
  .result-note {
    font-size: 14px;
    line-height: 1.4;
  }
  .tutorial-tip {
    margin-top: 6px;
  }
  .modal-actions {
    margin-top: 10px;
  }
  .modal-actions .button {
    min-height: 42px;
  }
  /* The settings on two columns. */
  .modal:has(.settings-grid) {
    width: min(760px, 100%);
  }
  .settings-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 28px;
  }
  .storage-note {
    font-size: 14px;
    line-height: 1.45;
  }
  .settings-row {
    padding-block: 10px;
  }
}
/* A phone held upright: the frame thins and a book gives its room to the page. */
@media (max-width: 560px) {
  .modal {
    padding: 24px 16px 20px;
    border-width: 12px;
    border-image-width: 12px;
  }
  .modal.paged .modal-heading p {
    display: none;
  }
  .rule-row,
  .rule-bonus-grid .rule-row {
    gap: 10px;
  }
  .rule-row > .tile-plaque,
  .rule-row > .tile-medallion,
  .rule-row > .tile-copper,
  .rule-row > .tile-bare,
  .rule-row .tile-pair > * {
    width: 40px;
    height: 40px;
  }
  .rule-row .tile-pair {
    flex-direction: column;
    gap: 4px;
  }
  .book-count {
    min-width: 70px;
    letter-spacing: 0.06em;
  }
  .modal.paged .modal-actions:last-of-type .button {
    flex: 1 1 auto;
    min-width: 0;
    padding-inline: 12px;
  }
}

/* ---- Fenêtres sur écran bas (téléphone en paysage) --------------------------
   L'action principale reste visible sans faire défiler. */
@media (max-height: 500px) {
  .modal-backdrop {
    padding: 6px;
  }
  .modal {
    padding: 14px 20px 16px;
    border-width: 9px;
    border-image-width: 9px;
  }
  .modal.wide {
    width: min(760px, 100%);
  }
  .modal-heading {
    margin-bottom: 10px;
  }
  .modal-heading h2 {
    font-size: 24px;
    margin-top: 4px;
  }
  .modal-heading p {
    margin-top: 4px;
    font-size: 15px;
    line-height: 1.4;
  }
  .modal-heading:after {
    display: none;
  }
  .stage-objectives,
  .result-stats {
    padding: 8px 0;
    margin: 8px 0;
  }
  .stage-objectives strong,
  .result-stats strong {
    font-size: 22px;
    margin-bottom: 2px;
  }
  .tutorial-grid {
    margin: 10px 0;
  }
  .tutorial-step .tile-plaque,
  .tutorial-step .tile-medallion {
    width: 40px;
    height: 40px;
    margin-bottom: 4px;
  }
  .tutorial-step h3 {
    font-size: 15px;
  }
  .tutorial-tip,
  .result-note {
    margin-top: 6px;
    font-size: 14px;
    line-height: 1.45;
  }
  .modal-actions {
    margin-top: 10px;
  }
  .modal-actions.stacked {
    flex-direction: row;
    flex-wrap: wrap;
  }
  .modal-actions.stacked .button {
    flex: 1 1 40%;
  }
  /* The pause keeps its choices; its figures are already on the HUD. */
  .modal .stage-objectives:has(+ .modal-actions.stacked) {
    display: none;
  }
  .modal-actions.stacked .text-button {
    flex: 1 1 100%;
    min-height: 32px;
  }
  .modal .tutorial-tip {
    display: none;
  }
  /* Only the decorative lines of the stage dialogs are cut short. */
  .modal:has(.stage-objectives, .result-stats) .modal-heading p {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .modal-actions .button {
    min-height: 40px;
    padding-block: 8px;
  }
  .result-emblem .artifact-icon {
    width: 64px;
    height: 64px;
  }
  .result-rays {
    width: 140px;
    height: 140px;
  }
  .modal .intro-tutorial {
    order: 0;
    flex: 0 0 auto;
  }
  /* The result's second choices stand beside the first ones. */
  .modal .result-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 14px;
    margin-top: 10px;
  }
  .result-actions > .modal-actions {
    margin-top: 0;
  }
  .result-actions > .modal-actions:first-child {
    flex: 1 1 60%;
  }
  /* A book keeps its title and gives the rest of the room to its pages. */
  .modal.paged .modal-heading p {
    display: none;
  }
  .rules-list {
    gap: 10px;
  }
  .rule-row,
  .rule-bonus-grid .rule-row {
    gap: 12px;
  }
  .rule-row h3,
  .rule-bonus-grid h3 {
    font-size: 15px;
    margin-bottom: 2px;
  }
  .rule-row p,
  .rule-bonus-grid p,
  .keyboard-hints {
    font-size: 14px;
    line-height: 1.45;
  }
  .rule-row > .tile-plaque,
  .rule-row > .tile-medallion,
  .rule-row > .tile-copper,
  .rule-row > .tile-bare,
  .rule-row .tile-pair > * {
    width: 40px;
    height: 40px;
  }
  .rule-bonus-grid {
    gap: 10px 20px;
  }
  .book-pager .icon-button {
    width: 36px;
    height: 36px;
  }
  /* The travellers side by side, on rows as low as they can be. */
  .modal:has(.profile-book) {
    width: min(760px, 100%);
  }
  .profile-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    margin-bottom: 10px;
  }
  .profile-row {
    padding: 6px 10px;
    gap: 10px;
  }
  .profile-row strong {
    font-size: 15px;
    margin-bottom: 1px;
  }
  .profile-row small {
    font-size: 13px;
    line-height: 1.3;
  }
  .form-error:empty {
    margin: 0;
    min-height: 0;
  }
}
/* A very low screen: a dialog keeps its title, its content and its actions.
   Only the decorative subtitles go; a question, a warning or the cause of a
   defeat stays. */
@media (max-height: 400px) {
  .modal:has(.settings-grid, .tutorial-chapters, .profile-book, .stage-reserves):not(:has(.result-stats)) .modal-heading p {
    display: none;
  }
  .modal-heading h2 {
    font-size: 22px;
  }
  .modal-actions {
    margin-top: 8px;
  }
  .settings-row {
    padding-block: 4px;
  }
  .storage-note {
    font-size: 13px;
    line-height: 1.3;
  }
  /* The figures of a stage on one line, each number beside its word. */
  .modal .stage-objectives,
  .modal .result-stats {
    padding-block: 5px;
    margin-block: 6px;
  }
  .stage-objectives strong,
  .result-stats strong {
    display: inline;
    margin: 0 4px 0 0;
    font-size: 19px;
  }
  .stage-reserves {
    margin-block: 6px;
    padding-block: 4px;
  }
  /* The intro's reserves speak for themselves; a result says what became of them. */
  .modal:not(:has(.result-stats)) .stage-reserves p {
    display: none;
  }
  .result-note {
    margin-top: 2px;
    font-size: 13px;
    line-height: 1.3;
  }
  .result-emblem {
    margin-bottom: 0;
  }
  .result-emblem .artifact-icon {
    width: 46px;
    height: 46px;
  }
  .result-rays {
    width: 100px;
    height: 100px;
  }
  .tutorial-grid {
    margin: 4px 0;
  }
  .tutorial-step .tile-plaque,
  .tutorial-step .tile-medallion {
    width: 34px;
    height: 34px;
    margin-bottom: 2px;
  }
  .tutorial-step h3 {
    font-size: 14px;
    margin-bottom: 2px;
  }
  .tutorial-step p {
    font-size: 13px;
    line-height: 1.3;
  }
}

/* ---- Défaite : la cause reste visible derrière la fenêtre ------------------- */
.modal-backdrop:has(.result-emblem.lost) {
  background: rgba(3, 3, 15, 0.55);
  backdrop-filter: none;
}
.modal-backdrop.peeking,
.modal-backdrop.peeking:has(.result-emblem.lost) {
  background: transparent;
  backdrop-filter: none;
  pointer-events: none;
}
.modal-backdrop.peeking .modal {
  visibility: hidden;
}
body.peek-board:after {
  content: "Touchez ou appuyez sur une touche pour revenir";
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 80;
  transform: translateX(-50%);
  padding: 8px 16px;
  font: 15px var(--serif);
  color: #f3daad;
  background: #0c0e24f0;
  border: 1px solid #697090;
}
.game-page[data-lost="bag_blocked"] .bag-slots,
.game-page[data-lost="bag_blocked"] .bag-meter {
  outline: 3px solid var(--danger);
  outline-offset: 3px;
  animation: danger-pulse 0.9s ease-in-out infinite;
}
.game-page[data-lost="timeout"] .hud-time {
  outline: 3px solid var(--danger);
  outline-offset: 2px;
  animation: danger-pulse 0.9s ease-in-out infinite;
}

/* ---- Téléphone : le score porte une coupe, il ne reste pas un « 0 » anonyme -- */
@media (max-height: 500px) and (orientation: landscape) {
  .game-hud .hud-score .value::before {
    content: "";
    display: inline-block;
    width: 15px;
    height: 15px;
    margin-right: 5px;
    vertical-align: -1px;
    background: center / contain no-repeat
      url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 3h10v5.6a5 5 0 0 1-10 0Z' fill='%23e3b262'/%3E%3Cpath d='M7 5.6H3.6v1.9a4 4 0 0 0 4 4M17 5.6h3.4v1.9a4 4 0 0 1-4 4' fill='none' stroke='%23e3b262' stroke-width='2'/%3E%3Cpath d='M10.4 14h3.2v3.4h2.6v3.1H7.8v-3.1h2.6Z' fill='%23e3b262'/%3E%3C/svg%3E");
  }
}

/* ---- Tablette en portrait : l'invitation au paysage est une vraie action ---- */
.orientation-note .button {
  min-height: 34px;
  margin-left: 12px;
  padding: 4px 18px;
  vertical-align: middle;
}

/* Keep the full cosmic resource labels readable on a landscape tablet. */
@media (max-width: 1100px) and (min-height: 501px) and (orientation: landscape) {
  .resource-button, .resource-display { padding-inline: 5px; gap: 5px; }
  .resource-button .artifact-icon, .resource-display .artifact-icon { width: 26px; height: 26px; }
  .resource-text .resource-label { padding-right: 0; font-size: 11px; letter-spacing: 0; overflow-wrap: anywhere; }
  .resource-text .resource-value { font-size: 19px; }
  .resource-button.is-active .resource-value { font-size: 13px; }
  .resource-button kbd { top: auto; bottom: 2px; }
}

/* Keep the astrolabe inside the compact landscape HUD. */
@media (max-height: 540px) and (orientation: landscape) {
  .time-astrolabe { width: calc(100% + 16px); height: 38px; }
  .hud-time-readout::before { width: calc(100% + 10px); height: 34px; }
}
