* {
  box-sizing: border-box;
}
body {
  margin: 0;
  overflow: hidden;
  background: #172b29;
  color: #fff7e8;
  font-family:
    Inter,
    Segoe UI,
    Cairo,
    sans-serif;
  font-size: 16px;
}
button,
select {
  font: inherit;
}
button {
  cursor: pointer;
  border: 1px solid #ffffff35;
  border-radius: 12px;
  padding: 13px 20px;
  background: #ffffff10;
  color: inherit;
  transition: 0.15s;
}
button:hover {
  background: #ffffff25;
  transform: translateY(-1px);
}
button:disabled {
  opacity: 0.35;
  cursor: default;
}
button.primary {
  background: #f5a63a;
  color: #182e29;
  border: 0;
  font-weight: 800;
}
button:focus-visible,
select:focus-visible {
  outline: 3px solid #fac174;
}
#world {
  width: 100vw;
  height: 100dvh;
  display: block;
}
#overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  padding: 5vw;
  background: linear-gradient(90deg, #122c2aee, #122c2a66 58%, #122c2a10);
  backdrop-filter: blur(2px);
}
#overlay[hidden],
[hidden] {
  display: none !important;
}
.menu {
  max-width: 550px;
  width: 100%;
  max-height: 92dvh;
  overflow: auto;
  padding: 28px;
}
.eyebrow {
  font-size: 13px;
  letter-spacing: 3px;
  color: #f5b95d;
  font-weight: 800;
}
.brand {
  font-size: clamp(36px, 5vw, 70px);
  line-height: 0.95;
  font-weight: 950;
  letter-spacing: -3px;
}
.brand span {
  display: block;
  color: #f8ad42;
  font-style: italic;
  font-size: 1.6em;
  letter-spacing: -5px;
}
.menu p {
  color: #d2dfd5;
  line-height: 1.6;
}
.menu h2 {
  font-size: 32px;
  margin-top: 0;
}
.row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.stack {
  display: grid;
  gap: 10px;
  margin-top: 26px;
}
.menu .primary {
  padding: 18px;
  font-size: 19px;
}
.meta {
  display: flex;
  gap: 24px;
  margin-top: 24px;
  color: #e4e6d6;
  font-size: 14px;
}
.levelgrid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}
.levelgrid button {
  padding: 14px 5px;
}
.card {
  background: #183b35e8;
  border: 1px solid #d8e8bf25;
  border-radius: 15px;
  padding: 16px;
  margin: 12px 0;
}
.card small {
  display: block;
  color: #b7c9be;
  margin-top: 6px;
}
select {
  background: #193c35;
  color: white;
  border: 1px solid #ffffff44;
  padding: 10px;
  border-radius: 8px;
}
.settingslabel {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin: 20px 0;
}
#hud {
  position: fixed;
  top: 22px;
  inset-inline: 24px;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  pointer-events: none;
}
#hud > div {
  background: #12352bea;
  border: 1px solid #ffffff25;
  box-shadow: 0 5px 30px #0002;
  border-radius: 15px;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: 20px;
}
#hud button {
  pointer-events: auto;
  padding: 7px 12px;
}
#hud small {
  display: block;
  color: #b5c9be;
  font-size: 12px;
  margin-bottom: 3px;
}
.stars {
  color: #ffc66a;
}
#orders {
  position: fixed;
  top: 112px;
  inset-inline-end: 24px;
  width: 265px;
  max-height: 65vh;
  overflow: auto;
  background: #12352bef;
  border-radius: 16px;
  padding: 16px;
  border: 1px solid #ffffff26;
}
#orders h3 {
  margin: 0 0 12px;
  font-size: 14px;
  letter-spacing: 1px;
}
.ticket {
  padding: 12px 0;
  border-top: 1px dashed #ffffff35;
}
.ticket strong {
  font-size: 16px;
}
.ticket small {
  display: block;
  color: #c9d6cb;
  margin: 6px 0;
}
.bar {
  height: 5px;
  background: #ffffff20;
  border-radius: 9px;
  overflow: hidden;
}
.bar i {
  display: block;
  height: 100%;
  background: #f6b849;
}
.tag {
  font-size: 12px;
  background: #e7f7bc;
  color: #243d2c;
  padding: 3px 6px;
  border-radius: 5px;
}
#hint {
  position: fixed;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%);
  background: #102e28ee;
  border: 1px solid #ffffff40;
  border-radius: 14px;
  padding: 15px 24px;
  text-align: center;
  min-width: 260px;
  pointer-events: none;
}
kbd {
  background: #f5b655;
  color: #15342c;
  padding: 3px 7px;
  border-radius: 5px;
  font-weight: bold;
  margin-inline-end: 8px;
}
#toast {
  position: fixed;
  top: 100px;
  left: 50%;
  transform: translateX(-50%);
  background: #f4b74a;
  color: #15362e;
  font-weight: 700;
  border-radius: 12px;
  padding: 12px 20px;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
  max-width: 85vw;
}
.bubble {
  position: absolute;
  transform: translate(-50%, -100%);
  background: #12352bed;
  border: 1px solid #fff7;
  border-radius: 12px;
  padding: 8px 12px;
  white-space: nowrap;
  font-size: 14px;
  pointer-events: none;
}
.bubble .bar {
  margin-top: 6px;
}
.station {
  color: #ffdc89;
  font-size: 13px;
  border-color: #f5c36b88;
}
.loading {
  margin: auto;
  text-align: center;
  width: 400px;
}
.loading .brand {
  font-size: 42px;
}
progress {
  width: 100%;
  height: 9px;
  accent-color: #f5ad42;
  margin: 18px 0;
}
small {
  font-size: 13px;
}
.loading small {
  display: block;
  color: #c8d3c5;
}
#miniaction {
  position: fixed;
  bottom: 115px;
  left: 50%;
  transform: translateX(-50%);
  width: 340px;
  padding: 20px;
  background: #12352bf5;
  border: 1px solid #f3bd5b;
  border-radius: 16px;
  text-align: center;
}
.timing {
  position: relative;
  height: 22px;
  background: #ffffff25;
  border-radius: 6px;
  margin: 15px 0;
  overflow: hidden;
}
.target {
  position: absolute;
  left: 60%;
  width: 22%;
  height: 100%;
  background: #81bf69;
}
.needle {
  position: absolute;
  top: 0;
  width: 4px;
  height: 100%;
  background: white;
}
#mobile {
  position: fixed;
  inset: 0;
  pointer-events: none;
}
#joystick {
  position: absolute;
  bottom: calc(28px + env(safe-area-inset-bottom));
  left: calc(22px + env(safe-area-inset-left));
  width: 140px;
  height: 140px;
  border: 2px solid rgba(255, 255, 255, 0.55);
  background: radial-gradient(circle, rgba(15, 26, 35, 0.25) 0 30%, rgba(15, 26, 35, 0.55) 70%);
  box-shadow: inset 0 0 0 10px rgba(255, 255, 255, 0.06);
  border-radius: 50%;
  pointer-events: auto;
  touch-action: none;
  transition: border-color 0.15s;
}
#joystick.plein {
  border-color: #007bff;
}
#joystick.sprint {
  border-color: #ffa500;
  box-shadow: inset 0 0 0 10px rgba(255, 165, 0, 0.18), 0 0 18px rgba(255, 165, 0, 0.55);
}
#joystick.sprint::after {
  content: "Course";
  position: absolute;
  top: -26px;
  left: 50%;
  transform: translateX(-50%);
  padding: 2px 10px;
  border-radius: 999px;
  background: #ffa500;
  color: #0f1a23;
  font: 700 12px/1.4 Inter, system-ui, sans-serif;
}
#joystick.flottant {
  transition: none;
}
/* Au repos, le joystick s'efface à demi (comme dans les jeux mobiles) ; il revient en plein sous le pouce. */
#joystick:not(.flottant):not(.plein) {
  opacity: 0.6;
}
#zoneJoystick {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 48%;
  height: 46%;
  pointer-events: auto;
  touch-action: none;
}
#joystick i {
  position: absolute;
  left: 44px;
  top: 44px;
  width: 52px;
  height: 52px;
  background: #007bff;
  border: 3px solid #fff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
  border-radius: 50%;
  will-change: transform;
}
#touchAction {
  position: absolute;
  bottom: 45px;
  right: 35px;
  width: 85px;
  height: 85px;
  border-radius: 50%;
  background: #f7b34c;
  color: #183b31;
  font-weight: bold;
  pointer-events: auto;
}
#touchCamera {
  position: absolute;
  bottom: 143px;
  right: 55px;
  pointer-events: auto;
}
#world {
  touch-action: none;
}
html[dir="rtl"] body {
  font-family:
    Cairo,
    Segoe UI,
    sans-serif;
}
html[dir="rtl"] .brand {
  letter-spacing: -2px;
}
html[dir="rtl"] #overlay {
  background: linear-gradient(270deg, #122c2aee, #122c2a66 58%, #122c2a10);
}
.controls {
  font-size: 14px;
  line-height: 2;
  color: #c5d3c9;
}
.upgrade {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.upgrade button {
  flex-shrink: 0;
}
@media (max-width: 700px) {
  #overlay {
    padding: 12px;
    background: #122c2aba;
  }
  .menu {
    padding: 18px;
    max-width: 100%;
  }
  .brand {
    font-size: 42px;
  }
  #hud {
    top: 10px;
    inset-inline: 10px;
    gap: 6px;
  }
  #hud > div {
    padding: 9px;
    gap: 10px;
    font-size: 13px;
  }
  #hud .desktop {
    display: none;
  }
  #orders {
    top: 82px;
    inset-inline-end: 10px;
    width: 205px;
    padding: 12px;
    font-size: 13px;
    max-height: 40vh;
  }
  #hint {
    bottom: 12px;
    font-size: 13px;
    padding: 9px;
    min-width: 240px;
  }
  #miniaction {
    bottom: 155px;
    width: 300px;
  }
  .meta {
    gap: 12px;
  }
  .bubble {
    font-size: 12px;
  }
}

@media (max-width: 440px) {
  #hud > div {
    gap: 7px;
    padding: 8px;
    font-size: 12px;
  }
  #hud > div > b {
    display: none;
  }
  #hud button {
    padding: 6px 8px;
  }
  #hud small {
    font-size: 11px;
  }
  #orders {
    width: 185px;
    max-height: 35vh;
  }
  .brand {
    font-size: 38px;
  }
}
html {
  width: 100%;
  height: 100%;
  overflow: hidden;
}
body {
  width: 100%;
  height: 100%;
  position: fixed;
  inset: 0;
}
#labels {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

/* Gestes FoodEatUp ajoutés au jeu : ouverture du service, relevé HACCP, rupture, clôture. */
#loadingTip {
  max-width: 420px;
  margin: 18px auto 0;
  color: #d8e8bf;
  font-size: 14px;
  line-height: 1.45;
}
.menu .astuce,
.card.astuce p {
  color: #d8e8bf;
  font-size: 14px;
}
.card.astuce a {
  color: #ffc66a;
}
.card.rapport h3 {
  margin: 0;
}
.card.rapport ul {
  margin: 4px 0 10px;
  padding-inline-start: 18px;
}
#orders .ouverture {
  margin: 10px 0;
  padding: 10px;
  border: 1px dashed #ffc66a88;
  border-radius: 12px;
}
#orders .ouverture small {
  display: block;
  margin-top: 4px;
}
#orders .rupture {
  margin: 10px 0;
  color: #ffb4a6;
  font-weight: 700;
}
#ruptureBtn {
  position: fixed;
  z-index: 12;
  left: 50%;
  bottom: 92px;
  transform: translateX(-50%);
  max-width: min(360px, calc(100vw - 32px));
  min-height: 48px;
  padding: 10px 16px;
  border-radius: 14px;
  border: 1px solid #e66c55;
  background: #5a1f17ee;
  color: white;
  font-weight: 700;
  pointer-events: auto;
}
#ruptureBtn[hidden] {
  display: none;
}
@media (pointer: coarse) {
  #ruptureBtn {
    bottom: 160px;
  }
}
#orders .canal {
  color: #ffc66a;
  font-weight: 700;
}
#releve {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  background: #0007;
  padding: 16px;
}
#releve[hidden] {
  display: none;
}
#releve section {
  width: min(420px, 100%);
  background: #12352bf5;
  border: 1px solid #ffffff30;
  border-radius: 18px;
  padding: 22px;
  color: white;
  text-align: center;
}
#releve small {
  color: #b5c9be;
}
#releve h2 {
  margin: 6px 0 4px;
}
#releve .degres {
  display: block;
  margin: 10px 0;
  font-size: 44px;
  color: #ffc66a;
}
#releve .row {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}
#releve button {
  min-height: 48px;
  font-size: 16px;
}

/* Fiche d'un fournisseur du quartier (boulangerie, boucherie). */
#fournisseur {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  background: #0007;
  padding: 16px;
}
#fournisseur[hidden] {
  display: none;
}
#fournisseur section {
  width: min(460px, 100%);
  max-height: 100%;
  overflow: auto;
  background: #12352bf5;
  border: 1px solid #ffffff30;
  border-radius: 18px;
  padding: 22px;
  color: white;
}
#fournisseur small {
  color: #b5c9be;
}
#fournisseur h2 {
  margin: 6px 0 10px;
}
#fournisseur ul {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
}
#fournisseur li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid #ffffff22;
}
#fournisseur li span {
  color: #ffc66a;
  white-space: nowrap;
}
/* Une ligne de produit : le nom et ses détails passent à la ligne, le bouton prix garde sa place. */
#fournisseur li > span:first-child {
  white-space: normal;
  min-width: 0;
}
#fournisseur li > button {
  flex-shrink: 0;
  align-self: center;
}
#fournisseur p {
  margin: 6px 0;
  font-size: 14px;
}
#fournisseur section {
  position: relative;
}
#fournisseur .fermer-boite {
  position: sticky;
  top: 0;
  float: right;
  min-width: 44px;
  min-height: 44px;
  margin: -10px -10px 0 8px;
  padding: 0;
  border-radius: 50%;
  font-size: 18px;
  z-index: 1;
}
#fournisseur .foodeatup summary {
  cursor: pointer;
  min-height: 32px;
}
#fournisseur .foodeatup {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #ffc66a1f;
  border: 1px solid #ffc66a66;
}
#fournisseur .row {
  display: grid;
  margin-top: 14px;
}
#fournisseur button {
  min-height: 48px;
  font-size: 16px;
}

#fournisseur h3 {
  margin: 12px 0 4px;
  font-size: 15px;
  color: #ffc66a;
}
#fournisseur li button {
  min-height: 40px;
  font-size: 14px;
  white-space: nowrap;
}
#fournisseur li small {
  color: #b5c9be;
}
#fournisseur .qte {
  display: flex;
  align-items: center;
  gap: 8px;
}
#fournisseur .qte button {
  min-width: 40px;
}
#fournisseur .total {
  font-size: 18px;
  text-align: right;
}
#fournisseur .outils li {
  border: 0;
  padding: 2px 0;
}
#fournisseur .row {
  gap: 10px;
}
#fournisseur ul.fiche li {
  display: block;
}
#fournisseur ul.fiche li span {
  white-space: normal;
  color: inherit;
}
/* Courses : panier du supermarché et action possible dans un commerce. */
#panier {
  position: fixed;
  top: calc(env(safe-area-inset-top) + 92px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 12;
  background: #12352bf0;
  color: #fff;
  border: 1px solid #ffc66a88;
  border-radius: 999px;
  padding: 6px 14px;
  font-weight: 700;
  font-size: 14px;
}
#listeBtn {
  position: fixed;
  top: calc(env(safe-area-inset-top) + 132px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 12;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid #ffc66a88;
  background: #12352bf0;
  color: #fff;
  font-weight: 700;
}
#listeBtn[hidden],
#panier[hidden],
#indiceCourses[hidden] {
  display: none;
}
#indiceCourses {
  position: fixed;
  bottom: calc(env(safe-area-inset-bottom) + 96px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 12;
  max-width: min(560px, calc(100vw - 32px));
  background: #12352bf0;
  color: #fff;
  border-radius: 14px;
  padding: 8px 14px;
  font-size: 14px;
  text-align: center;
  pointer-events: none;
}
#orders .reserve {
  display: block;
  margin-top: 4px;
  color: #b9f0c9;
}

/* Défis du parcours : rappel dans l'écran cuisine, bilan à la clôture. */
#orders .defi {
  margin: 10px 0;
  padding: 8px 10px;
  border-radius: 12px;
  background: #ffc66a1f;
  border: 1px solid #ffc66a66;
}
#orders .defi small {
  display: block;
  margin-top: 3px;
}
.card.defi {
  border-color: #ffc66a88;
}
.card.defi.ok {
  border-color: #8fd18f;
  background: #1d4a2ee8;
}
.card.defi p {
  font-size: 14px;
  color: #d8e8bf;
}
.card.defi a {
  color: #ffc66a;
  font-weight: 700;
}

/* Pendant une cinématique (film, briefing, moment du jeu), l'interface du jeu s'efface : seule l'image parle. */
body.cine-actif :is(#hud, #orders, #hint, #toast, #labels, #mobile, #miniaction, #hud-vivant, #stockvision) {
  visibility: hidden;
}
/* Cinématiques : bandes noires, sous-titres lisibles sur téléphone, toujours un bouton « Passer ». */
#cine {
  position: fixed;
  inset: 0;
  z-index: 40;
  color: white;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}
#cine[hidden] {
  display: none;
}
#cine .bande {
  position: absolute;
  left: 0;
  right: 0;
  height: 0;
  background: #000;
  transition: height 0.5s ease;
}
#cine .haut {
  top: 0;
}
#cine .bas {
  bottom: 0;
}
#cine.ouvert .bande {
  height: 11vh;
}
/* Vignettage de cinéma : les bords s'assombrissent, le regard va au centre du cadre. */
#cine .vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, 0.38) 100%);
}
#cine .fondu {
  position: absolute;
  inset: 0;
  background: #000;
  opacity: 0;
  pointer-events: none;
}
#cine .titre-cine {
  position: absolute;
  top: calc(11vh - 30px);
  left: 16px;
  margin: 0;
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #ffc66a;
}
#cine .passer {
  position: absolute;
  top: max(10px, calc(11vh / 2 - 24px));
  right: 16px;
  min-height: 48px;
  min-width: 112px;
  padding: 10px 18px;
  border-radius: 24px;
  border: 1px solid #ffffff55;
  background: #0009;
  color: white;
  font-weight: 700;
  font-size: 16px;
}
#cine .carte-perso {
  position: absolute;
  left: 16px;
  top: calc(11vh + 12px);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px 8px 8px;
  border-radius: 40px;
  background: #102f29d9;
  border: 1px solid #ffc66a66;
  animation: entree-carte 0.5s ease both;
}
#cine .carte-perso[hidden] {
  display: none;
}
#cine .carte-perso img {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  object-position: top;
  background: #ffffff22;
}
#cine .carte-perso strong {
  display: block;
  font-size: 17px;
}
#cine .carte-perso small {
  color: #ffc66a;
  font-size: 13px;
}
@keyframes entree-carte {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
}
#cine .sous-titre {
  position: absolute;
  left: 50%;
  bottom: calc(11vh + 14px);
  transform: translateX(-50%);
  width: min(760px, calc(100vw - 32px));
  margin: 0;
  padding: 10px 16px;
  border-radius: 12px;
  background: #000b;
  font-size: clamp(16px, 2.3vw, 21px);
  line-height: 1.4;
  text-align: center;
}
#cine .sous-titre b {
  color: #ffc66a;
}
#cine .sous-titre.off {
  font-style: italic;
}
#cine .aide-cine {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(11vh / 2 - 8px);
  text-align: center;
  font-size: 12px;
  color: #ffffffaa;
}
@media (pointer: coarse) {
  #cine .aide-cine {
    display: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  #cine .bande,
  #cine .carte-perso {
    transition: none;
    animation: none;
  }
}

/* Mobile : la fenêtre devient un panneau compact en bas, le restaurant reste visible derrière. */
@media (max-width: 700px) {
  #overlay {
    align-items: flex-end;
    justify-content: center;
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
    background: linear-gradient(0deg, #122c2acc, #122c2a33 55%, transparent);
    backdrop-filter: none;
  }
  .menu {
    max-height: 58dvh;
    padding: 14px;
    border-radius: 16px;
    background: #122c2af2;
    font-size: 14px;
  }
  .menu h2 { font-size: 20px; margin-bottom: 6px; }
  .menu p { line-height: 1.4; margin: 6px 0; }
  .menu .primary { padding: 13px; font-size: 16px; }
  .stack { margin-top: 12px; gap: 8px; }
  .meta { margin-top: 10px; font-size: 12px; }
  .card { padding: 10px; margin: 8px 0; }
  .brand { font-size: 30px; letter-spacing: -1px; }
  .levelgrid button { padding: 10px 4px; }
  .loading { text-align: center; width: 100%; }
}
@media (max-height: 500px) and (orientation: landscape) {
  #overlay { align-items: center; justify-content: flex-end; padding: 8px; }
  .menu { max-width: 380px; max-height: 92dvh; padding: 12px; }
}

/* Bulles des mentors (personnages non joueurs) : icône du métier, prénom, astuce. */
#labels .bubble.pnj {
  max-width: min(260px, 70vw);
  white-space: normal;
  text-align: left;
  line-height: 1.3;
  background: #fffdf4;
  color: #12352b;
  border: 2px solid #4ade80;
  border-radius: 14px;
  padding: 8px 10px;
  box-shadow: 0 6px 18px #0004;
}
#labels .bubble.pnj strong {
  color: #b45309;
}
#labels .bubble.pnj .pnj-icone {
  font-size: 18px;
}

/* Régie des écrans : une rangée de vignettes d'affiches par écran, l'écran demandé par le moment est souligné. */
.regie { display: grid; gap: 10px; margin: 12px 0; }
.regie-ecran { display: grid; gap: 8px; }
.regie-ecran.demande { box-shadow: inset 0 0 0 2px #f7b650; }
.regie-ecran.bonne { box-shadow: inset 0 0 0 2px #4fd18b; }
.regie-ecran.acceptable { box-shadow: inset 0 0 0 2px #f7b650; }
.regie-ecran.erreur { box-shadow: inset 0 0 0 2px #ff6b6b; }
.regie-affiches { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.regie-affiches button { padding: 2px; border-radius: 8px; border: 2px solid transparent; background: rgba(255,255,255,.06); min-height: 0; }
.regie-affiches button.choisie { border-color: #f7b650; }
.regie-affiches img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 6px; }

/* Téléphone : le KDS se replie (bouton 📋 du bandeau, avec le nombre de commandes) et ne déborde jamais sur les boutons
   tactiles ; en paysage, le menu tient dans la hauteur sans masquer le bouton principal. */
#hud button .tag { margin-inline-start: 4px; font-size: 11px; }
@media (pointer: coarse) and (orientation: portrait) {
  #orders { max-height: 30dvh; overflow-y: auto; font-size: 12px; }
}
@media (pointer: coarse) and (orientation: landscape) {
  #orders { top: 70px; width: 200px; max-height: calc(100dvh - 210px); overflow-y: auto; font-size: 12px; padding: 10px; }
}
@media (max-height: 500px) and (orientation: landscape) {
  .menu .brand { font-size: 26px; letter-spacing: -1px; }
  .menu .brand span { font-size: 1.3em; letter-spacing: -2px; }
  .menu:has(.brand) > p:not(.astuce), .menu:has(.brand) .controls, .menu:has(.brand) > small { display: none; }
  .menu h2 { font-size: 17px; margin: 6px 0 4px !important; }
  .menu .stack { margin-top: 8px; gap: 6px; }
}

#rapide {
  position: fixed;
  inset: auto 0 calc(16px + env(safe-area-inset-bottom)) 0;
  display: flex;
  justify-content: center;
  z-index: 40;
}
#rapide section {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-width: 420px;
  padding: 12px;
  border-radius: 16px;
  background: rgba(15, 26, 35, 0.92);
  color: #fff;
}
#rapide h3 {
  width: 100%;
  margin: 0 0 4px;
  font-size: 15px;
}
#rapide button {
  min-height: 48px;
  padding: 0 14px;
  border-radius: 12px;
  border: 2px solid #007bff;
  background: #fff;
  color: #000;
  font: inherit;
}
/* Sur écran tactile, l'aide « E · poste » passe au-dessus du joystick et du bouton E. */
@media (pointer: coarse) {
  #hint {
    bottom: calc(196px + env(safe-area-inset-bottom));
    min-width: 0;
    max-width: calc(100vw - 32px);
    padding: 10px 16px;
  }
}

/* ===== Retours du service (ui/retours.js) : messages en file, envols, flèche d'objectif ===== */
#toast {
  /* Devient une pile de messages : deux au plus, sous le bandeau, jamais bloquante. */
  top: 96px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: min(520px, 92vw);
  max-width: none;
  padding: 0;
  background: none;
  opacity: 1;
  transition: none;
}
#toast .message {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 100%;
  padding: 10px 16px 10px 12px;
  border-radius: 14px;
  background: #102e28f2;
  color: #fff;
  font-weight: 600;
  font-size: 15px;
  line-height: 1.3;
  border: 1px solid #ffffff2e;
  border-inline-start: 5px solid #f5b655;
  box-shadow: 0 8px 26px #0005;
  animation: message-entree 0.22s ease-out both;
}
#toast .message.gain { border-inline-start-color: #8fd36a; }
#toast .message.succes { border-inline-start-color: #8fd36a; }
#toast .message.alerte { border-inline-start-color: #ff6b57; background: #3a1712f2; }
#toast .message.defi { border-inline-start-color: #f5b655; background: #3b2a0cf2; }
#toast .message-icone { flex: none; font-size: 18px; }
#toast .message.sortie { animation: message-sortie 0.2s ease-in both; }
#toast .message.rebond { animation: message-rebond 0.3s ease-out; }
@keyframes message-entree { from { opacity: 0; transform: translateY(-10px) scale(0.97); } }
@keyframes message-sortie { to { opacity: 0; transform: translateY(-8px); } }
@keyframes message-rebond { 50% { transform: scale(1.04); } }

#envols { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
.envol {
  position: absolute;
  transform: translate(-50%, -50%);
  font-weight: 800;
  font-size: 22px;
  color: #b9f28f;
  text-shadow: 0 2px 0 #0b241e, 0 0 12px #0008;
  white-space: nowrap;
  animation: envol 1.15s ease-out forwards;
}
.envol.serie { color: #ffc66a; font-size: 18px; }
@keyframes envol {
  0% { opacity: 0; transform: translate(-50%, -30%) scale(0.7); }
  15% { opacity: 1; transform: translate(-50%, -60%) scale(1.12); }
  100% { opacity: 0; transform: translate(-50%, -260%) scale(1); }
}

#objectif {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  pointer-events: none;
  transition: transform 0.08s linear;
  translate: -50% -100%;
}
#objectif .objectif-fleche {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: #f5b655;
  color: #15342c;
  font-size: 18px;
  box-shadow: 0 4px 14px #0006;
  rotate: var(--angle, 90deg);
  animation: objectif-saut 0.9s ease-in-out infinite;
}
#objectif .objectif-texte {
  order: -1;
  padding: 3px 9px;
  border-radius: 999px;
  background: #102e28ee;
  border: 1px solid #f5b65588;
  color: #ffdc89;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
#objectif.bord { translate: -50% -50%; }
#objectif.bord .objectif-fleche { animation: none; }
#objectif.bord .objectif-texte { display: none; }
@keyframes objectif-saut { 50% { translate: 0 6px; } }

/* Série de clients servis d'affilée, dans le bandeau. */
#hud .serie { color: #ffc66a; font-weight: 800; }

/* Écran cuisine : les tickets urgents se voient du coin de l'œil (couleur + « ! » + pulsation), les prêts en vert. */
.ticket.urgent { border-inline-start: 4px solid #ff6b57; padding-inline-start: 8px; animation: ticket-urgent 1s ease-in-out infinite; }
.ticket.pret { border-inline-start: 4px solid #8fd36a; padding-inline-start: 8px; }
.ticket .urgence { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 999px; background: #ff6b57; color: #fff; font-size: 12px; font-weight: 900; }
@keyframes ticket-urgent { 50% { background: #ff6b5722; } }

/* Bilan : les étoiles arrivent une à une. */
.etoiles-bilan span { display: inline-block; }
.etoiles-bilan span.gagnee { animation: etoile-bilan 0.45s cubic-bezier(0.3, 1.6, 0.5, 1) both; animation-delay: calc(0.35s + var(--i) * 0.25s); }
@keyframes etoile-bilan { from { opacity: 0; transform: scale(0.2) rotate(-30deg); } }

/* Bouton d'action contextuel du téléphone : icône + verbe, éteint quand rien n'est à portée. */
#touchAction { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 0; transition: opacity 0.15s, transform 0.15s; }
#touchAction .ta-icone { font-size: 26px; line-height: 1; }
#touchAction .ta-texte { max-width: 78px; font-size: 12px; line-height: 1.1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#touchAction.inactif { opacity: 0.55; transform: scale(0.92); background: #f7b34ccc; }
#touchAction:not(.inactif) { box-shadow: 0 0 0 4px #f7b34c55, 0 8px 22px #0006; }

@media (max-width: 700px) {
  /* Sur téléphone, les messages passent à gauche sous le bandeau quand l'écran cuisine est ouvert à droite. */
  #toast { top: 84px; width: calc(100vw - 20px); }
  #orders:not([hidden]) ~ #toast { left: 10px; transform: none; width: calc(100vw - 215px); align-items: flex-start; }
  #toast .message { font-size: 13px; padding: 8px 12px 8px 10px; }
  #toast .message-icone { font-size: 15px; }
  #orders { max-height: 44vh; }
  .ticket { padding: 8px 0; }
  .ticket strong { font-size: 14px; }
  .ticket small { margin: 3px 0; font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) {
  #toast .message, #toast .message.sortie, #toast .message.rebond, .ticket.urgent, .etoiles-bilan span.gagnee, #objectif .objectif-fleche { animation: none; }
  .envol { animation: envol-calme 1.1s linear forwards; }
  @keyframes envol-calme { 0%, 70% { opacity: 1; } 100% { opacity: 0; } }
  #objectif { transition: none; }
}
@media (max-width: 440px) {
  /* Bandeau du téléphone : les valeurs restent, les intitulés secondaires s'effacent pour tout faire tenir. */
  #hud span { white-space: nowrap; }
  #hud small { display: none; }
  #hud > div:first-child > span:last-child::before { content: "⏱ "; }
  #hud > div { padding-block: 10px; }
  #hud > div:last-child { gap: 5px; padding-inline: 7px; }
  #hud button { padding: 6px 7px; }
}
@media (max-width: 380px) {
  #hud { gap: 4px; inset-inline: 6px; }
  #hud > div { padding-inline: 6px; }
  #hud > div:last-child { gap: 3px; }
  #hud button { padding: 5px; }
}
.etoiles-bilan { font-size: 30px; letter-spacing: 4px; color: #ffc66a; }

/* ---------- Jeu simplifié : assistance, tutoriel, accueil, étoiles ---------- */
/* Le gros bouton « étape suivante » (mode facile et tutoriel) : il emmène le directeur au bon endroit. */
#suivant {
  position: fixed;
  z-index: 13;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  max-width: min(420px, calc(100vw - 32px));
  min-height: 56px;
  padding: 12px 22px;
  border: 0;
  border-radius: 999px;
  background: #ffa500;
  color: #0f1a23;
  font: 800 17px/1.2 inherit;
  box-shadow: 0 8px 24px #0006, 0 0 0 4px #ffa50033;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: auto;
  animation: suivant-pouls 1.8s ease-in-out infinite;
}
#suivant[hidden] { display: none; }
@keyframes suivant-pouls { 50% { box-shadow: 0 8px 24px #0006, 0 0 0 10px #ffa50022; } }
@media (pointer: coarse) {
  /* Au-dessus du bouton d'action, à portée du pouce droit ; le joystick garde la moitié gauche. */
  #suivant { left: auto; right: 14px; transform: none; bottom: calc(150px + env(safe-area-inset-bottom)); max-width: 58vw; font-size: 14px; min-height: 52px; padding: 8px 16px; white-space: normal; text-overflow: clip; text-align: left; line-height: 1.15; }
}
/* La consigne du tutoriel, en une ligne sous le bandeau. */
#guide {
  position: fixed;
  z-index: 12;
  top: calc(64px + env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  max-width: min(560px, calc(100vw - 24px));
  padding: 10px 16px;
  border-radius: 16px;
  background: #0f1a23ee;
  border: 2px solid #ffa500;
  color: #fff;
  font-weight: 600;
  font-size: 15px;
  line-height: 1.35;
  pointer-events: none;
}
#guide[hidden] { display: none; }
#guide .guide-pas { display: inline-block; margin-right: 8px; padding: 2px 8px; border-radius: 999px; background: #ffa500; color: #0f1a23; font-weight: 800; font-size: 13px; }
body.cine-actif :is(#suivant, #guide) { display: none; }
/* Les étiquettes des postes se touchent pour y aller. */
#labels .bubble.station { pointer-events: auto; cursor: pointer; padding: 10px 14px; min-height: 40px; }
#labels .bubble.station.compact { min-width: 44px; min-height: 44px; padding: 8px; font-size: 20px; line-height: 1; text-align: center; border-radius: 50%; }
/* Mode facile : une barre qui se remplit au lieu de l'aiguille à arrêter. */
.timing.auto .progression { position: absolute; inset: 0 auto 0 0; background: #81bf69; transition: width 0.2s linear; }
/* Accueil : « Plus de modes » repliable, modes verrouillés. */
.plus-modes { margin-top: 4px; border: 1px solid #ffffff2e; border-radius: 16px; padding: 4px 10px 8px; background: #ffffff0d; }
.plus-modes > summary { cursor: pointer; list-style: none; min-height: 44px; display: flex; align-items: center; justify-content: space-between; gap: 8px; font-weight: 700; }
.plus-modes > summary::-webkit-details-marker { display: none; }
.plus-modes > summary::after { content: "▾"; }
.plus-modes[open] > summary::after { content: "▴"; }
.plus-modes > summary small { margin-left: auto; opacity: 0.7; font-weight: 500; }
.plus-modes .stack { margin-top: 6px; }
button.verrou { opacity: 0.55; filter: grayscale(0.6); }
/* Bilan : trois grandes étoiles et un mot d'encouragement. */
.etoiles3 { font-size: 44px; letter-spacing: 6px; margin: 4px 0 0; }
.legende-etoiles { margin: 2px 0 10px; opacity: 0.8; }
.encouragement { margin: 0 0 12px; padding: 10px 14px; border-radius: 12px; background: #ffa50022; border: 1px solid #ffa50066; }
#hud .objectif-hud { color: #ffd27a; }
/* Sur téléphone, le bouton d'action dit déjà quoi faire : l'indice clavier « E … » est retiré. */
@media (pointer: coarse) { #hint { display: none !important; } }

/* Le plan du quartier, dehors : en haut à gauche sous le HUD ; replié, il ne garde que son bouton 🗺️. */
#planQuartier {
  position: fixed;
  top: calc(env(safe-area-inset-top) + 104px);
  left: 16px;
  z-index: 12;
  width: 180px;
  padding: 6px;
  border-radius: 14px;
  border: 1px solid #ffffff2a;
  background: #12352bf0;
  color: #fff;
}
#planQuartier[hidden] {
  display: none;
}
#planQuartier canvas {
  display: block;
  width: 100%;
  border-radius: 9px;
  touch-action: none;
  cursor: pointer;
}
#planQuartier small {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  text-align: center;
  opacity: 0.8;
}
.plan-replier {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid #ffc66a88;
  background: #12352b;
  color: #fff;
  font-size: 20px;
}
#planQuartier.replie {
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  background: none;
}
#planQuartier.replie canvas,
#planQuartier.replie small {
  display: none;
}
#planQuartier.replie .plan-replier {
  top: 0;
  right: 0;
}
#fournisseur ul.fiche li button[data-aller] {
  flex: none;
  min-height: 44px;
  margin-left: 8px;
  white-space: nowrap;
}
/* Commande couverte par la réserve du restaurant : servie, elle rapporte le pourboire des produits frais. */
#orders .ticket .frais {
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  background: #2f6b2a;
  color: #e9f7df;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.plan-visite {
  display: block;
  width: 100%;
  min-height: 44px;
  margin-top: 6px;
  border: 1px solid #ffc66a88;
  border-radius: 10px;
  background: transparent;
  color: #fff;
  font: inherit;
  font-weight: 700;
}
#planQuartier.replie .plan-visite {
  display: none;
}

/* Téléphone en portrait : l'accueil va à l'essentiel — logo, bouton Jouer, acte en cours, modes ; l'accroche, le
   paragraphe d'intro, l'astuce et l'aide clavier disparaissent (l'aide reste dans « Comment jouer »). */
@media (pointer: coarse) and (orientation: portrait), (max-width: 520px) {
  .menu:has(.brand) > .eyebrow,
  .menu:has(.brand) .intro-menu,
  .menu:has(.brand) .controls,
  .menu:has(.brand) > small { display: none; }
  .menu:has(.brand) .accroche { font-size: 17px; margin: 4px 0 10px; }
  .menu .brand { font-size: 40px; }
  .menu .astuce { font-size: 13px; }
  /* Le plan du quartier : sans légende, la visite devient une pastille. */
  #planQuartier small { display: none; }
  #planQuartier .plan-visite { font-size: 0; padding: 6px; min-height: 44px; }
  #planQuartier .plan-visite::before { content: "🎬"; font-size: 20px; }
}

/* Téléphone : les fiches (commerces, caisse, matériel) montent du bas de l'écran comme une feuille, à portée du pouce. */
@media (pointer: coarse) and (orientation: portrait), (max-width: 520px) {
  #fournisseur {
    place-items: end stretch;
    padding: 0;
  }
  #fournisseur section {
    width: 100%;
    max-height: 82dvh;
    border-radius: 22px 22px 0 0;
    padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
    animation: feuille 0.22s ease-out;
  }
  #fournisseur p {
    font-size: 13px;
  }
}
@keyframes feuille {
  from {
    transform: translateY(40px);
    opacity: 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  #fournisseur section {
    animation: none;
  }
}
