/* ============================================================================
   Livraisons dans l'espace — ce fichier complète ../espace/style.css
   (même HUD, même scène, même copilote que Mission Cosmos).
   ============================================================================ */

.game-header h1 { text-shadow: 3px 3px 0 var(--sky); }

/* ---------- HUD : l'or et le portail à construire ---------- */
.gold-item #gold { font-weight: 800; color: #FFD24A; }
.gold-item.bump { animation: goldBump .5s ease; }
@keyframes goldBump {
  40% { transform: scale(1.18); background: rgba(255, 210, 74, 0.35); }
}
.portal-item {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  padding-bottom: .55rem;
  overflow: hidden;
}
.portal-item #portalSpent { font-weight: 800; color: #D9C2FF; }
.gold-goal { color: var(--muted); font-size: .85em; }
.gold-bar {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 5px;
  height: 4px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.15);
  overflow: hidden;
}
.gold-bar i {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #9B6BFF, #9EE7FF);
  transition: width .5s ease;
}
.portal-item.ready { box-shadow: 0 0 0 2px #C38BFF, 0 0 16px rgba(195, 139, 255, 0.8); }

/* ---------- Mes quêtes ---------- */
.quest-panel { width: 300px; }
.q-count { margin-left: .2rem; color: var(--muted); font-weight: 700; }
.quest-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: .3rem;
}
.q-item {
  display: flex;
  align-items: center;
  gap: .4rem;
  background: rgba(255, 255, 255, 0.07);
  border-radius: 12px;
  padding: .25rem .3rem .25rem .25rem;
  font-size: .82rem;
  line-height: 1.2;
}
.q-face {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(79, 184, 232, 0.25);
}
.q-body { flex: 1; min-width: 0; }
.q-top { display: flex; justify-content: space-between; gap: .3rem; margin: 0 0 .15rem; }
.q-top strong { font-family: 'Baloo 2', sans-serif; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.q-reward { font-family: 'Baloo 2', sans-serif; font-weight: 800; color: #FFD24A; white-space: nowrap; }
.q-needs { display: flex; flex-wrap: wrap; gap: .2rem; }
.need {
  display: inline-flex;
  align-items: baseline;
  gap: .15rem;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  padding: 0 .4rem;
  font-family: 'Baloo 2', sans-serif;
  font-weight: 700;
  font-size: .8rem;
  white-space: nowrap;
}
.need b { font-weight: 400; }
.need small { color: var(--muted); font-size: .66rem; font-weight: 700; }
.need.carry { border-color: #FFC93C; background: rgba(255, 201, 60, 0.18); }
.need.done { border-color: var(--green); background: rgba(88, 201, 123, 0.3); }
.need.done small { display: none; }
.q-drop {
  flex: 0 0 auto;
  align-self: flex-start;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
  font-size: .7rem;
  cursor: pointer;
}
.q-drop:hover { background: var(--red); color: var(--white); }
.q-item.q-empty {
  display: block;
  background: none;
  border: 1px dashed rgba(255, 255, 255, 0.2);
  color: var(--muted);
  font-size: .75rem;
  padding: .35rem .5rem;
}
.q-empty b { color: #FFC93C; }
/* replié : seulement les visages */
.quest-panel.collapsed .q-count { display: none; }
.quest-panel.collapsed .quest-list { flex-direction: row; flex-wrap: wrap; gap: .2rem; }
.quest-panel.collapsed .q-item { padding: .1rem; border-radius: 50%; }
.quest-panel.collapsed .q-body,
.quest-panel.collapsed .q-drop,
.quest-panel.collapsed .q-empty { display: none; }
.quest-panel.collapsed .q-face { width: 32px; height: 32px; }

/* ---------- La soute ---------- */
.cargo-panel {
  position: absolute;
  top: 10px;
  right: 10px;
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 16px;
  padding: .3rem .45rem .45rem;
  max-width: 220px;
  backdrop-filter: blur(3px);
}
.cargo-head {
  margin: 0 0 .25rem;
  font-family: 'Baloo 2', sans-serif;
  font-weight: 800;
  font-size: .95rem;
  color: var(--yellow);
}
.cargo-slots {
  display: grid;
  grid-template-columns: repeat(4, 34px);
  gap: .25rem;
}
.slot {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  border: 2px dashed rgba(255, 255, 255, 0.2);
  display: grid;
  place-items: center;
  font-size: 1.2rem;
  padding: 0;
  background: none;
}
.slot.full {
  border: 2px solid #C98A4B;
  background: rgba(201, 138, 75, 0.3);
  cursor: pointer;
  animation: pop .3s ease;
}
.slot.full:hover { border-color: var(--red); background: rgba(232, 87, 87, 0.3); }

/* ---------- Fiche « Le savais-tu ? » ---------- */
.fact-card { top: auto; bottom: 10px; right: 180px; width: min(380px, 52%); }
.fact-card .pc-pic { position: relative; }
.fc-icon {
  position: absolute;
  right: 2px;
  bottom: 0;
  font-size: 1.6rem;
  line-height: 1;
}

/* ---------- Commandes tactiles ---------- */
.pad-actions { display: flex; gap: .6rem; align-items: center; }
.fire-btn {
  font-family: 'Baloo 2', sans-serif;
  font-weight: 800;
  font-size: 1.2rem;
  padding: 1.2rem 1.4rem;
  border: none;
  border-radius: 999px;
  background: var(--pink);
  color: var(--white);
  box-shadow: 0 5px 0 #c94f6e;
  touch-action: none;
}
.fire-btn:active { transform: translateY(3px); box-shadow: 0 2px 0 #c94f6e; }
/* pas encore d'arme : bouton gris avec un cadenas */
.fire-btn.locked { background: #6E6A8E; box-shadow: 0 5px 0 #4B4768; }
.fire-btn.locked::after { content: '🔒'; font-size: .8em; }
/* turbo en recharge : le bouton se remplit de bleu */
.turbo-btn.charging {
  background: linear-gradient(90deg, var(--sky) var(--charge, 0%), #3A4878 var(--charge, 0%));
  box-shadow: 0 5px 0 #26305A;
}

.desk-help {
  text-align: center;
  color: var(--muted);
  font-size: .82rem;
  margin: .7rem 0 0;
}
.desk-help kbd { color: var(--ink); }
@media (pointer: coarse) { .desk-help { display: none; } }

/* ---------- Écran de départ ---------- */
.start-card { text-align: center; }
.start-card .order-title { font-size: 1.7rem; color: var(--ink); }
.start-goal { margin: .3rem 0 .8rem; font-size: 1.02rem; line-height: 1.45; }
.start-card .how-to { text-align: left; }
.save-note { margin: .6rem 0 0; font-size: .78rem; color: #8a84a6; }
.start-level { margin: 0; font-family: 'Baloo 2', sans-serif; font-weight: 800; color: var(--pink); }
.start-done {
  margin: .3rem 0 .8rem;
  background: #FFF3C9;
  border-radius: 14px;
  padding: .6rem .8rem;
  font-size: 1rem;
  line-height: 1.45;
}
.ms-portal { margin: 0 0 .3rem; background: rgba(155, 107, 255, 0.18); border-radius: 12px; padding: .35rem .5rem; line-height: 1.5; }

/* ---------- Fenêtres (quête, marchand, Terre) ---------- */
.dlg-overlay {
  position: fixed;
  inset: 0;
  z-index: 48;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 1rem;
  background: rgba(7, 9, 32, 0.6);
  overflow-y: auto;
}
.dlg-card {
  position: relative;
  margin: auto 0;
  background: #FFFCF3;
  color: var(--ink);
  border-radius: 22px;
  padding: 1rem 1.2rem .9rem;
  max-width: 440px;
  width: 100%;
  box-shadow: 0 14px 0 rgba(0, 0, 0, 0.25);
  animation: orderIn .35s cubic-bezier(.2, 1.3, .4, 1);
}
.dlg-card.dlg-wide { max-width: 620px; }
.dlg-head { display: flex; align-items: center; gap: .7rem; margin-bottom: .5rem; }
.dlg-face {
  flex: 0 0 auto;
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #2B3380, #0B0F33);
  box-shadow: 0 0 0 4px #FFC93C;
}
.dlg-name { margin: 0; font-family: 'Baloo 2', sans-serif; font-weight: 800; font-size: 1.3rem; line-height: 1.1; color: var(--pink); }
.dlg-where { margin: .1rem 0 0; font-size: .85rem; color: #6a6486; }
.dlg-gold {
  margin: 0 0 0 auto;
  align-self: flex-start;
  font-family: 'Baloo 2', sans-serif;
  font-weight: 800;
  background: #FFF3C9;
  border-radius: 999px;
  padding: .1rem .7rem;
  white-space: nowrap;
}
.dlg-say {
  margin: 0 0 .6rem;
  background: #F1EDF8;
  border-radius: 14px;
  padding: .5rem .7rem;
  font-size: .95rem;
  line-height: 1.35;
}
.dlg-title { margin: 0 0 .3rem; font-family: 'Baloo 2', sans-serif; font-weight: 800; font-size: 1.3rem; color: var(--pink); text-align: center; }
.dlg-sub { margin: .2rem 0 .35rem; font-family: 'Baloo 2', sans-serif; font-weight: 700; font-size: .95rem; }
.dlg-card > .dlg-sub:only-of-type { text-align: center; }
.need-rows { list-style: none; margin: 0 0 .6rem; padding: 0; display: flex; flex-direction: column; gap: .3rem; }
.need-rows li {
  display: flex;
  align-items: center;
  gap: .5rem;
  background: #0B0F33;
  color: var(--white);
  border-radius: 12px;
  padding: .3rem .6rem;
}
.nr-icon { font-size: 1.6rem; }
.nr-count { font-family: 'Baloo 2', sans-serif; font-weight: 800; font-size: 1.25rem; color: #FFD24A; min-width: 2.2rem; }
.nr-name { display: flex; flex-direction: column; font-weight: 700; line-height: 1.2; }
.nr-name small { display: flex; align-items: center; gap: .25rem; color: var(--muted); font-size: .75rem; }
.nr-name small img { width: 22px; height: 22px; transform: scale(1.4); }
.dlg-reward { margin: 0 0 .5rem; text-align: center; font-size: 1.05rem; }
.dlg-reward b { font-family: 'Baloo 2', sans-serif; font-size: 1.35rem; color: #C99212; }
.dlg-warn { margin: 0 0 .5rem; background: #FFE3E3; color: #B0303F; border-radius: 10px; padding: .35rem .6rem; font-size: .85rem; text-align: center; }
.dlg-actions { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; align-items: center; margin-top: .6rem; }
.dlg-card button.primary,
.dlg-card button.danger {
  font-family: 'Baloo 2', sans-serif;
  font-weight: 800;
  font-size: 1.05rem;
  border: none;
  border-radius: 999px;
  padding: .5rem 1.3rem;
  cursor: pointer;
  color: var(--white);
  background: var(--green);
  box-shadow: 0 5px 0 #3a9c58;
}
.dlg-card button.danger { background: var(--red); box-shadow: 0 5px 0 #a83a3a; }
.dlg-card button.primary:disabled { background: #BDB8CC; box-shadow: 0 5px 0 #9a95aa; cursor: not-allowed; }
.dlg-card button.royal { background: linear-gradient(180deg, #FFD24A, #F2A93B); color: var(--ink); box-shadow: 0 5px 0 #C99212; font-size: 1.15rem; }

/* marchands */
.shop-rows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .35rem; }
.shop-row {
  display: flex;
  align-items: center;
  gap: .55rem;
  background: #F1EDF8;
  border-radius: 14px;
  padding: .4rem .55rem;
}
.sr-icon { font-size: 1.6rem; }
.sr-text { flex: 1; display: flex; flex-direction: column; line-height: 1.25; font-size: .95rem; }
.sr-text b { font-family: 'Baloo 2', sans-serif; }
.sr-text small { color: #6a6486; font-size: .75rem; }
.sr-text small b { color: var(--ink); }
.sr-text .sr-poor { color: var(--red); font-weight: 700; }
.dlg-card button.buy {
  flex: 0 0 auto;
  font-family: 'Baloo 2', sans-serif;
  font-weight: 800;
  font-size: .95rem;
  border: none;
  border-radius: 999px;
  padding: .35rem .8rem;
  background: #FFC93C;
  color: var(--ink);
  box-shadow: 0 4px 0 #d9a21e;
  cursor: pointer;
  white-space: nowrap;
}
.dlg-card button.buy:disabled { background: #E2DEEA; color: #9a95aa; box-shadow: 0 4px 0 #c9c4d4; cursor: not-allowed; }
.dlg-card button.buy.equip { background: var(--sky); color: var(--white); box-shadow: 0 4px 0 #2f8fb8; }
.shop-max { font-family: 'Baloo 2', sans-serif; font-weight: 800; font-size: .85rem; color: var(--green); white-space: nowrap; }
.style-grid {
  list-style: none;
  margin: 0 0 .4rem;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: .4rem;
}
.style-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .2rem;
  background: #0B0F33;
  color: var(--white);
  border: 3px solid transparent;
  border-radius: 14px;
  padding: .3rem .25rem .45rem;
  font-family: 'Baloo 2', sans-serif;
  font-weight: 700;
  font-size: .8rem;
  text-align: center;
}
.style-card.on { border-color: var(--green); }
.style-card img { width: 90px; height: 72px; }
.style-card .shop-max { color: #7CF0A0; font-size: .72rem; }

/* l'histoire : chapitres, missions, bâtiment terminé */
.q-item.q-story {
  background: linear-gradient(90deg, rgba(255, 201, 60, 0.22), rgba(255, 201, 60, 0.08));
  border: 1px solid rgba(255, 201, 60, 0.55);
  cursor: pointer;
}
.q-item.q-story:hover { background: rgba(255, 201, 60, 0.3); }
.q-story .q-face { box-shadow: 0 0 0 2px #FFC93C; }
.q-story .q-top strong { color: #FFE58A; }
.q-mission { margin: 0 0 .2rem; font-size: .76rem; color: #F4F1FF; font-weight: 700; }
.dlg-chapter { margin: 0; font-size: .8rem; color: #8a84a6; font-weight: 700; }
.dlg-intro { margin: 0 0 .5rem; font-size: .98rem; line-height: 1.4; }
.dlg-mission {
  margin: 0 0 .4rem;
  background: #FFF3C9;
  border-radius: 12px;
  padding: .35rem .6rem;
  font-size: .95rem;
}
.dlg-story .dlg-face { box-shadow: 0 0 0 4px #FFC93C, 0 0 18px rgba(255, 201, 60, 0.6); }
.built { text-align: center; }
.built img { width: 140px; height: 140px; border-radius: 50%; background: radial-gradient(circle at 50% 40%, #2B3380, #0B0F33); }
.built-fact { margin: .2rem 0 .5rem; background: #E4F5FD; border-radius: 12px; padding: .4rem .6rem; font-size: .9rem; line-height: 1.35; }
.unlocks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .3rem; }
.unlocks li { background: #F1EDF8; border-radius: 12px; padding: .35rem .6rem; font-size: .9rem; line-height: 1.3; }
.ms-story li { display: block; padding: .3rem .5rem; }
.ms-story li.now { background: rgba(255, 201, 60, 0.22); border: 1px solid rgba(255, 201, 60, 0.5); }

/* chantier du portail */
.portal-progress {
  background: #1C2260;
  color: var(--white);
  border-radius: 14px;
  padding: .45rem .7rem .55rem;
  margin-bottom: .45rem;
}
.portal-progress p { margin: 0 0 .3rem; font-size: .9rem; }
.pp-bar { display: block; height: 10px; border-radius: 6px; background: rgba(255, 255, 255, 0.15); overflow: hidden; }
.pp-bar i { display: block; height: 100%; background: linear-gradient(90deg, #9B6BFF, #9EE7FF); border-radius: 6px; }
.portal-row.full { background: #E3F7E9; }
.part-dots { display: inline-flex; align-items: center; gap: 3px; margin-left: .3rem; font-size: .75rem; color: #6a6486; }
.part-dots i { width: 9px; height: 9px; border-radius: 50%; background: #D9D4E6; }
.part-dots i.on { background: #9B6BFF; }
.dlg-portal .sr-text small { font-size: .74rem; line-height: 1.3; }

/* ---------- La grande carte ---------- */
.map-overlay {
  position: fixed;
  inset: 0;
  z-index: 46;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(7, 9, 32, 0.75);
}
.map-card {
  position: relative;
  width: min(1150px, 100%);
  height: min(760px, 100%);
  display: flex;
  flex-direction: column;
  background: #141A4A;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 22px;
  padding: .7rem .9rem .9rem;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.5);
}
.map-card h2 { margin: 0 0 .4rem; font-family: 'Baloo 2', sans-serif; font-size: 1.2rem; text-align: center; }
.map-notice {
  margin: 0 auto .5rem;
  max-width: 720px;
  background: linear-gradient(90deg, #9B6BFF, #C38BFF);
  color: var(--white);
  border-radius: 14px;
  padding: .45rem .9rem;
  font-family: 'Baloo 2', sans-serif;
  font-weight: 800;
  text-align: center;
  animation: soonPulse 1.6s ease-in-out infinite;
}
.map-body { flex: 1; min-height: 0; display: flex; gap: .8rem; }
.map-canvas-wrap { flex: 1 1 auto; min-width: 0; min-height: 0; display: flex; }
#bigMap { width: 100%; height: 100%; display: block; }
.map-side {
  flex: 0 0 320px;
  overflow-y: auto;
  font-size: .82rem;
}
.ms-head { margin: .3rem 0 .3rem; font-family: 'Baloo 2', sans-serif; font-weight: 800; color: var(--yellow); }
.ms-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .3rem; }
.ms-list li { display: flex; align-items: center; gap: .45rem; background: rgba(255, 255, 255, 0.07); border-radius: 12px; padding: .25rem .4rem; line-height: 1.3; }
.ms-list img { width: 38px; height: 38px; border-radius: 50%; background: rgba(79, 184, 232, 0.2); flex: 0 0 auto; }
.ms-list small { color: var(--muted); }
.ms-tag { display: inline-block; font-family: 'Baloo 2', sans-serif; font-weight: 800; font-size: .7rem; border-radius: 999px; padding: 0 .4rem; background: rgba(255, 255, 255, 0.15); }
.ms-offer { background: var(--yellow); color: var(--ink); }
.ms-active { background: var(--sky); color: var(--white); }
.ms-grid { display: grid; grid-template-columns: 1fr 1fr; }
.ms-res span { font-size: 1.1rem; }
.ms-note { margin: .6rem 0 0; color: var(--muted); font-size: .72rem; line-height: 1.4; }

/* ---------- La fin ---------- */
.end-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: #1C2260;
}
#endCanvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.end-text {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: max(1rem, env(safe-area-inset-top)) 1rem 0;
  text-align: center;
  opacity: 0;
  transform: translateY(-20px);
  transition: opacity .8s ease, transform .8s cubic-bezier(.2, 1.4, .4, 1);
  pointer-events: none;
}
.end-overlay.show-text .end-text { opacity: 1; transform: none; pointer-events: auto; }
.end-title {
  margin: 0;
  font-family: 'Baloo 2', sans-serif;
  font-weight: 800;
  font-size: clamp(1.6rem, 5vw, 3rem);
  color: #FFD24A;
  text-shadow: 3px 3px 0 var(--pink), 0 0 30px rgba(255, 210, 74, 0.6);
}
.end-sub { margin: .1rem 0; font-size: clamp(.9rem, 2.2vw, 1.15rem); }
.end-stats { margin: .1rem 0 .4rem; color: var(--muted); font-size: .85rem; }
.end-sub { max-width: 760px; margin-left: auto; margin-right: auto; }
.end-soon {
  display: inline-block;
  margin: .2rem 0 .2rem;
  padding: .35rem 1.1rem;
  border-radius: 999px;
  background: linear-gradient(90deg, #FFC93C, #FF8A3C);
  color: var(--ink);
  font-family: 'Baloo 2', sans-serif;
  font-weight: 800;
  font-size: clamp(.95rem, 2.4vw, 1.25rem);
  box-shadow: 0 0 22px rgba(255, 170, 60, 0.6);
  animation: soonPulse 1.6s ease-in-out infinite;
}
@keyframes soonPulse {
  50% { transform: scale(1.06); box-shadow: 0 0 34px rgba(255, 170, 60, 0.9); }
}
.end-actions { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: .4rem; margin-top: .5rem; }
#endNext {
  font-family: 'Baloo 2', sans-serif;
  font-weight: 800;
  font-size: 1.1rem;
  border: none;
  border-radius: 999px;
  padding: .55rem 1.4rem;
  background: linear-gradient(180deg, #FFD24A, #F2A93B);
  color: var(--ink);
  box-shadow: 0 5px 0 #C99212;
  cursor: pointer;
}
#endReplay {
  font-family: 'Baloo 2', sans-serif;
  font-weight: 800;
  font-size: 1rem;
  border: none;
  border-radius: 999px;
  padding: .5rem 1.3rem;
  background: var(--green);
  color: var(--white);
  box-shadow: 0 5px 0 #3a9c58;
  cursor: pointer;
}
.end-actions .ghost-btn { color: #D8D5F5; }
.end-actions .ghost-btn:hover { color: var(--white); }

.confetti-layer { z-index: 70; }

/* ---------- L'animation de départ ---------- */
.intro-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: #05061A;
}
#introCanvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.intro-skip {
  position: absolute;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  font-family: 'Baloo 2', sans-serif;
  font-weight: 800;
  font-size: 1rem;
  border: 2px solid rgba(255, 255, 255, 0.6);
  border-radius: 999px;
  padding: .4rem 1.1rem;
  background: rgba(11, 15, 51, 0.55);
  color: var(--white);
  cursor: pointer;
}
.intro-skip:hover { background: rgba(255, 255, 255, 0.2); }

/* ---------- Écrans plus petits ---------- */
@media (max-width: 900px) {
  .map-body { flex-direction: column; overflow-y: auto; }
  .map-canvas-wrap { flex: 0 0 auto; height: min(70vh, 92vw); }
  .map-side { flex: none; overflow: visible; }
}
@media (max-width: 700px) {
  .quest-panel { width: 230px; }
  .q-face { width: 32px; height: 32px; }
  .cargo-panel { max-width: 170px; padding: .2rem .3rem .3rem; }
  .cargo-slots { grid-template-columns: repeat(4, 28px); gap: .15rem; }
  .slot { width: 28px; height: 28px; font-size: 1rem; }
  .fact-card { right: 110px; bottom: 70px; width: min(300px, 70%); }
  .fire-btn { padding: .9rem 1.1rem; font-size: 1rem; }
}

/* ---------- Bouton Quitter : toujours visible, même par-dessus les fenêtres ---------- */
.exit-btn {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 65;
  display: none;
  align-items: center;
  gap: .3rem;
  height: 40px;
  padding: 0 1rem;
  border: none;
  border-radius: 999px;
  background: var(--pink);
  color: var(--white);
  font-family: 'Baloo 2', sans-serif;
  font-weight: 800;
  font-size: 1rem;
  box-shadow: 0 4px 0 #c94f6e, 0 6px 14px rgba(0, 0, 0, 0.35);
  cursor: pointer;
}
.exit-btn:hover { transform: translateY(2px); box-shadow: 0 2px 0 #c94f6e, 0 4px 10px rgba(0, 0, 0, 0.35); }
body.full .exit-btn, body.phone .exit-btn { display: inline-flex; }
/* la question « Quitter ? » passe devant tout le reste (même la fin) */
.quit-overlay { z-index: 66; }

#fsBtn { display: inline-flex; align-items: center; justify-content: center; }
body.phone #fsBtn { display: none; }
#fsBtn .fs-out { display: none; }
#fsBtn.on .fs-in { display: none; }
#fsBtn.on .fs-out { display: inline; }

/* ---------- Ordinateur : le jeu occupe toute la fenêtre ---------- */
body.full {
  padding: 0;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}
body.full .back-link,
body.full .game-header,
body.full .desk-help { display: none; }
body.full .hud {
  position: fixed;
  top: 10px;
  left: 0;
  right: 0;
  z-index: 12;
  margin: 0;
  padding: 0 130px;
  max-width: none;
  pointer-events: none;
}
body.full .hud > * { pointer-events: auto; }
body.full .hud-item,
body.full .hud-btn {
  height: 40px;
  display: inline-flex;
  align-items: center;
  background: rgba(11, 15, 51, 0.72);
  backdrop-filter: blur(3px);
}
body.full .portal-item { padding-bottom: .4rem; }
body.full .game-layout { display: block; padding: 0; max-width: none; }
body.full .stage-col { max-width: none; }
body.full .stage {
  position: fixed;
  inset: 0;
  height: auto;
  border-radius: 0;
  box-shadow: none;
}
body.full .quest-panel { top: 62px; max-height: calc(100% - 200px); }
body.full .cargo-panel { top: 62px; }
/* Boutons Tir et Turbo en bas, juste à gauche de la mini-carte (souris ou doigt) */
body.full .touch-pad {
  display: flex;
  position: fixed;
  right: 186px;
  bottom: 18px;
  z-index: 11;
  margin: 0;
  padding: 0;
}
body.full .dpad { display: none; }
body.full .turbo-btn,
body.full .fire-btn {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .65rem 1.2rem;
  font-size: 1.1rem;
  cursor: pointer;
}
body.full .pad-actions kbd { font-size: .7rem; padding: 0 .35em; color: var(--ink); }
body.full .fact-card { bottom: 96px; }
@media (max-width: 700px) {
  body.full .touch-pad { right: 112px; bottom: 10px; }
  body.full .turbo-btn, body.full .fire-btn { padding: .5rem .8rem; font-size: .95rem; }
  body.full .pad-actions kbd { display: none; }
}

/* ---------- Téléphone : le jeu occupe tout l'écran ---------- */
body.phone .portal-item { padding-bottom: .1rem; }
body.phone .gold-goal { display: none; }
body.phone .gold-bar { left: 6px; right: 6px; bottom: 2px; height: 3px; }
body.phone .quest-panel.collapsed .q-face { width: 26px; height: 26px; }
body.phone .quest-panel:not(.collapsed) { width: min(270px, 74vw); }
body.phone .q-item { font-size: .72rem; }
body.phone .q-top strong { font-size: .78rem; }
body.phone .need { font-size: .7rem; }
body.phone .cargo-panel {
  top: calc(var(--under-hud) + 92px);
  right: max(6px, env(safe-area-inset-right));
  max-width: 132px;
  padding: .15rem .25rem .25rem;
  border-radius: 12px;
}
body.phone .cargo-title { display: none; }
body.phone .cargo-head { font-size: .78rem; margin-bottom: .1rem; }
body.phone .cargo-slots { grid-template-columns: repeat(4, 24px); gap: .12rem; }
body.phone .slot { width: 24px; height: 24px; font-size: .85rem; border-radius: 6px; }
body.phone .fact-card {
  top: auto;
  bottom: calc(max(8px, env(safe-area-inset-bottom)) + 60px);
  left: max(6px, env(safe-area-inset-left));
  right: auto;
  width: min(280px, 72vw);
}
body.phone .fact-card .pc-pic { width: 52px; height: 52px; }
body.phone .fc-icon { font-size: 1.2rem; }
body.phone .pad-actions { gap: .4rem; }
body.phone .fire-btn { padding: .8rem 1rem; font-size: 1rem; opacity: .92; }
body.phone .copilot { max-width: calc(100% - 210px); }
body.phone .exit-btn {
  top: var(--top);
  left: max(6px, env(safe-area-inset-left));
  height: var(--hud-h);
  padding: 0 .6rem;
  font-size: .9rem;
  box-shadow: none;
}
body.phone .dlg-overlay { padding: .5rem; }
body.phone .dlg-card { padding: .7rem .8rem .7rem; border-radius: 16px; }
body.phone .dlg-face { width: 56px; height: 56px; }
body.phone .dlg-name { font-size: 1.1rem; }
body.phone .map-overlay { padding: .4rem; }
body.phone .map-card { height: 100%; padding: .5rem; border-radius: 14px; }
body.phone .start-goal { font-size: .9rem; margin-bottom: .5rem; }
body.phone .start-card .order-title { font-size: 1.25rem; }
body.phone .save-note { display: none; }
body.phone .end-text { padding-top: calc(var(--top) + var(--hud-h) + 4px); }
@media (orientation: landscape) {
  body.phone .map-body { flex-direction: row; overflow: hidden; }
  body.phone .map-canvas-wrap { flex: 1 1 auto; height: auto; }
  body.phone .map-side { flex: 0 0 45%; overflow-y: auto; }
}
