/* Style « verre moderne » : panneaux sombres translucides et floutés au-dessus de l'île 3D,
   coins arrondis, typo Poppins / Inter, couleurs vives en accent. */
:root {
  --glass: rgba(16, 18, 36, 0.62);
  --glass-strong: rgba(16, 18, 36, 0.82);
  --glass-light: rgba(255, 255, 255, 0.08);
  --stroke: rgba(255, 255, 255, 0.12);
  --stroke-strong: rgba(255, 255, 255, 0.22);
  --text: #f4f5fb;
  --muted: #a3a8c3;
  --violet: #8b5cf6;
  --cyan: #22d3ee;
  --pink: #f472b6;
  --green: #4ade80;
  --amber: #fbbf24;
  --red: #f87171;
  --accent: linear-gradient(135deg, #8b5cf6, #22d3ee);
  --title: "Poppins", "Inter", system-ui, sans-serif;
  --body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --radius: 16px;
  --gap: 14px;
  --shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.55);
  --blur: blur(14px) saturate(140%);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { height: 100%; }
body {
  margin: 0;
  color: var(--text);
  font-family: var(--body);
  font-size: 15px;
  background: #0b0d1a;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; font-size: inherit; color: inherit; }

/* ---------- Verre : briques communes ---------- */

.glass, .card, .hud-card, .panel, .build-bar, .tooltip, .toast, .boss-banner, .mission, .mode-hint {
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card { padding: 18px 20px; }

.logo { font-family: var(--title); font-weight: 700; letter-spacing: -0.5px; }
.logo span { background: var(--accent); -webkit-background-clip: text; background-clip: text; color: transparent; }
.logo.big { font-size: 3.4rem; margin: 0; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--accent);
  border: none;
  border-radius: 999px;
  padding: 9px 18px;
  cursor: pointer;
  text-decoration: none;
  color: #fff;
  font-weight: 600;
  box-shadow: 0 6px 18px -6px rgba(139, 92, 246, 0.7);
  transition: transform 0.12s, box-shadow 0.12s, filter 0.12s;
}
.btn:hover { transform: translateY(-1px); filter: brightness(1.1); box-shadow: 0 8px 24px -6px rgba(34, 211, 238, 0.7); }
.btn:active { transform: translateY(1px); }
.btn.small { padding: 5px 13px; font-size: 0.85rem; }
.btn.danger { background: linear-gradient(135deg, #ef4444, #f97316); box-shadow: 0 6px 18px -6px rgba(239, 68, 68, 0.7); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; filter: grayscale(0.5); box-shadow: none; }

.icon-btn {
  background: var(--glass-light);
  border: 1px solid var(--stroke);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  transition: background 0.15s;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.18); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--glass-light);
  border: 1px solid var(--stroke);
  white-space: nowrap;
  font-size: 0.85rem;
}
.chip.bonus { background: rgba(74, 222, 128, 0.15); border-color: rgba(74, 222, 128, 0.4); color: #bbf7d0; }
.chip.bonus:empty { display: none; }

.hint { color: var(--muted); font-size: 0.86rem; margin: 6px 0; line-height: 1.45; }
.error { color: var(--red); min-height: 1.2em; margin: 0; }
.price { white-space: nowrap; }
.price::before { content: "🪙 "; }

/* ---------- Connexion ---------- */

.auth {
  min-height: 100vh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 26px;
  padding: 24px 16px;
  text-align: center;
  overflow: auto;
  background:
    radial-gradient(ellipse at 20% 10%, rgba(139, 92, 246, 0.35), transparent 50%),
    radial-gradient(ellipse at 80% 90%, rgba(34, 211, 238, 0.25), transparent 50%),
    #0b0d1a;
}
.auth-card { max-width: 430px; display: grid; gap: 16px; }
.auth-card p { margin: 0; color: var(--muted); line-height: 1.5; }
.auth-doodle { font-size: 2.2rem; letter-spacing: 6px; }
.discord-btn { background: #5865f2; box-shadow: 0 6px 18px -6px rgba(88, 101, 242, 0.8); font-size: 1rem; padding: 12px 20px; }

/* ---------- Scène + ciel ---------- */

.game { position: fixed; inset: 0; }
.stage {
  position: absolute;
  inset: 0;
  background: var(--sky, linear-gradient(#5fb4ea, #cfe9f8 75%));
  transition: background 2s;
}
.game.w-sun { --sky: linear-gradient(#4aa8e8, #cde8f8 75%); }
.game.w-heat { --sky: linear-gradient(#f08a4b, #fbd7a6 75%); }
.game.w-rain { --sky: linear-gradient(#6c7d99, #c6cfdc 75%); }
.game.w-storm { --sky: linear-gradient(#323a52, #7c8599 80%); }
.game.w-snow { --sky: linear-gradient(#a9bfdb, #eef3fa 75%); }
.game.w-fog { --sky: linear-gradient(#aeb6c0, #e3e6ea 75%); }
.game.night { --sky: linear-gradient(#060918, #141b3d 60%, #26305f); }
.game.night.w-storm { --sky: linear-gradient(#04050c, #10142a 75%); }
.game.night.w-fog { --sky: linear-gradient(#141829, #2c3352 75%); }
.game.night.w-heat { --sky: linear-gradient(#170d24, #3b2140 75%); }

.board3d { position: absolute; inset: 0; }
.board3d canvas { display: block; touch-action: none; cursor: grab; }

/* ---------- HUD haut ---------- */

.hud-top {
  position: absolute;
  top: var(--gap);
  left: var(--gap);
  right: var(--gap);
  display: flex;
  align-items: flex-start;
  gap: var(--gap);
  pointer-events: none;
  z-index: 5;
}
.hud-top > * { pointer-events: auto; }

.money { padding: 10px 18px 12px; }
.island-name { font-size: 0.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; font-weight: 600; }
.score { font-family: var(--title); font-weight: 700; font-size: 2rem; line-height: 1.15; letter-spacing: -0.5px; }
.score small { font-size: 0.95rem; font-weight: 600; background: var(--accent); -webkit-background-clip: text; background-clip: text; color: transparent; }
.rates { display: flex; gap: 6px; margin-top: 6px; }

.env {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  cursor: pointer;
  text-align: left;
  margin: 0 auto;
  transition: border-color 0.15s;
}
.env:hover { border-color: var(--stroke-strong); }
.env-icon { font-size: 1.9rem; line-height: 1; }
.env-text { display: grid; line-height: 1.2; }
.env-text strong { font-family: var(--title); font-size: 1.05rem; font-weight: 600; }
.env-text small { color: var(--muted); font-size: 0.8rem; }
.env-next { font-size: 0.8rem; color: var(--muted); border-left: 1px solid var(--stroke); padding-left: 12px; line-height: 1.35; max-width: 150px; }

.me { display: flex; align-items: center; gap: 10px; padding: 6px 8px 6px 6px; max-width: 290px; border-radius: 999px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--violet); flex-shrink: 0; }
.me-text { display: grid; min-width: 0; line-height: 1.15; }
.me-text strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; font-size: 0.9rem; }
.sync { color: var(--muted); font-size: 0.72rem; }
.trophies { background: rgba(251, 191, 36, 0.15); border: 1px solid rgba(251, 191, 36, 0.4); color: #fde68a; border-radius: 999px; padding: 1px 9px; font-size: 0.8rem; white-space: nowrap; }
.trophies:empty { display: none; }

.boss-banner {
  position: absolute;
  top: 104px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 16px 6px 10px;
  border-radius: 999px;
  border-color: rgba(248, 113, 113, 0.45);
  cursor: pointer;
  max-width: calc(100% - 32px);
}
.boss-banner .b-icon { font-size: 1.5rem; }
.boss-banner .b-name { font-family: var(--title); font-weight: 600; white-space: nowrap; }
.boss-banner .b-hp { width: 130px; height: 8px; border-radius: 999px; overflow: hidden; background: rgba(255, 255, 255, 0.12); }
.boss-banner .b-hp span { display: block; height: 100%; background: linear-gradient(90deg, #ef4444, #f97316); }
.boss-banner small { color: var(--muted); white-space: nowrap; font-size: 0.78rem; }

/* ---------- Menu latéral + panneau ---------- */

.hud-side {
  position: absolute;
  left: var(--gap);
  top: 50%;
  transform: translateY(-50%);
  display: grid;
  gap: 6px;
  padding: 8px;
  z-index: 5;
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border: 1px solid var(--stroke);
  border-radius: 22px;
  box-shadow: var(--shadow);
}
.side-btn {
  position: relative;
  width: 62px;
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: 8px 2px 6px;
  border: none;
  border-radius: 14px;
  background: transparent;
  cursor: pointer;
  transition: background 0.15s;
}
.side-btn b { font-size: 1.35rem; line-height: 1.1; font-weight: 400; }
.side-btn span { font-size: 0.68rem; color: var(--muted); font-weight: 500; }
.side-btn small { font-size: 0.62rem; color: var(--muted); }
.side-btn:hover { background: var(--glass-light); }
.side-btn.active { background: rgba(139, 92, 246, 0.28); box-shadow: inset 0 0 0 1px rgba(139, 92, 246, 0.6); }
.side-btn.active span { color: var(--text); }
.dot { position: absolute; top: 4px; right: 8px; width: 9px; height: 9px; border-radius: 50%; background: var(--red); box-shadow: 0 0 10px var(--red); animation: pulse 1.2s ease-in-out infinite; }
.dot.ok { background: var(--green); box-shadow: 0 0 10px var(--green); }
@keyframes pulse { 50% { opacity: 0.4; } }

.panel {
  position: absolute;
  left: calc(var(--gap) + 96px);
  top: 104px;
  bottom: 160px;
  width: 380px;
  overflow-y: auto;
  z-index: 6;
  padding: 18px 20px;
  background: var(--glass-strong);
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
  animation: slide-in 0.2s ease-out;
}
@keyframes slide-in { from { opacity: 0; transform: translateX(-10px); } }
.panel-close { position: sticky; top: 0; float: right; }
.panel-title { font-family: var(--title); font-weight: 700; font-size: 1.4rem; margin: 0 0 8px; }

/* Météo */
.meteo-now { display: flex; align-items: center; gap: 14px; }
.meteo-now .big { font-size: 3rem; line-height: 1; }
.meteo-now strong { font-family: var(--title); font-size: 1.3rem; font-weight: 600; }
.meteo-now small { color: var(--muted); }
.effects { margin: 10px 0 12px; padding-left: 18px; line-height: 1.6; }
.forecast { border-top: 1px solid var(--stroke); padding-top: 12px; margin-top: 12px; }
.tip { background: rgba(251, 191, 36, 0.12); border: 1px solid rgba(251, 191, 36, 0.35); color: #fde68a; border-radius: 12px; padding: 10px 12px; font-size: 0.88rem; }

/* Boss */
.boss-card { text-align: center; }
.boss-head { display: flex; align-items: center; justify-content: center; gap: 8px; }
.boss-tag { font-size: 0.7rem; font-weight: 700; letter-spacing: 1px; background: linear-gradient(135deg, #ef4444, #f97316); color: #fff; padding: 2px 8px; border-radius: 999px; }
.boss-name { font-family: var(--title); font-size: 1.35rem; margin: 0; font-weight: 700; }
.boss-taunt { color: var(--muted); margin: 2px 0 6px; font-size: 0.88rem; }
.boss-face {
  font-size: 78px;
  line-height: 1;
  background: none;
  border: none;
  cursor: crosshair;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  filter: drop-shadow(0 8px 20px rgba(248, 113, 113, 0.35));
  animation: float 2.5s ease-in-out infinite;
}
.boss-face.hit { animation: shake 0.15s linear; }
.boss-face:disabled { cursor: default; filter: grayscale(1); animation: none; }
@keyframes float { 50% { transform: translateY(-6px); } }
@keyframes shake { 25% { transform: translateX(-6px) rotate(-6deg); } 75% { transform: translateX(6px) rotate(6deg); } }
.hp { position: relative; height: 18px; border-radius: 999px; background: rgba(255, 255, 255, 0.1); overflow: hidden; margin: 8px 0 4px; }
.hp > span { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, #ef4444, #f97316); transition: width 0.3s; }
.hp > em { position: relative; font-style: normal; font-size: 0.75rem; line-height: 18px; font-weight: 600; }
.boss-meta { display: flex; justify-content: space-between; font-size: 0.8rem; color: var(--muted); }
.boss-top { list-style: none; margin: 10px 0 0; padding: 0; text-align: left; font-size: 0.86rem; display: grid; gap: 4px; }
.boss-top li { display: flex; gap: 8px; align-items: center; }
.boss-top img { width: 22px; height: 22px; border-radius: 50%; }
.boss-top .dmg { margin-left: auto; color: var(--muted); }
.boss-help { font-size: 0.85rem; color: var(--muted); margin: 10px 0 0; line-height: 1.45; }

/* Classement */
.board { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.board li { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 12px; background: var(--glass-light); border: 1px solid transparent; }
.board li.me { border-color: rgba(139, 92, 246, 0.6); background: rgba(139, 92, 246, 0.18); }
.board .rank { font-family: var(--title); font-weight: 700; width: 2ch; text-align: right; color: var(--muted); }
.board li:nth-child(1) .rank { color: var(--amber); }
.board li:nth-child(2) .rank { color: #d1d5db; }
.board li:nth-child(3) .rank { color: #fb923c; }
.board img { width: 28px; height: 28px; border-radius: 50%; }
.board .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.board .prog { color: var(--muted); font-size: 0.75rem; font-weight: 400; }
.board .total { font-size: 0.85rem; white-space: nowrap; color: var(--muted); }
.board .empty { justify-content: center; color: var(--muted); }

/* Succès */
.ach-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(54px, 1fr)); gap: 8px; }
.ach { aspect-ratio: 1; display: grid; place-items: center; font-size: 1.6rem; border-radius: 14px; background: var(--glass-light); border: 1px solid var(--stroke); position: relative; cursor: help; }
.ach.done { background: rgba(74, 222, 128, 0.14); border-color: rgba(74, 222, 128, 0.45); }
.ach.locked { filter: grayscale(1); opacity: 0.35; }
.ach .progress { position: absolute; left: 8px; right: 8px; bottom: 5px; height: 3px; background: rgba(255, 255, 255, 0.15); border-radius: 2px; overflow: hidden; }
.ach .progress > span { display: block; height: 100%; background: var(--accent); }

/* Stats */
.stats { display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; margin: 0 0 16px; }
.stats dt { color: var(--muted); }
.stats dd { margin: 0; text-align: right; font-weight: 600; }

/* Mission */
.mission { display: flex; align-items: center; gap: 10px; max-width: 100%; padding: 6px 6px 6px 8px; border-radius: 999px; font-size: 0.9rem; }
.mission:empty { display: none; }
.mission.done { border-color: rgba(74, 222, 128, 0.6); box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.15), var(--shadow); }
.mission .m-num { font-weight: 700; font-size: 0.75rem; background: var(--accent); color: #fff; border-radius: 999px; padding: 3px 9px; white-space: nowrap; }
.mission .m-text { min-width: 0; }
.mission .m-reward { color: var(--muted); white-space: nowrap; padding-right: 8px; }

/* Fusée */
.stages { list-style: none; margin: 10px 0; padding: 0; display: grid; gap: 8px; }
.stage { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; background: var(--glass-light); border: 1px solid var(--stroke); }
.stage .s-icon { font-size: 1.4rem; }
.stage .s-body { display: grid; flex: 1; line-height: 1.35; }
.stage .s-body small { color: var(--muted); font-size: 0.8rem; }
.stage.built { opacity: 0.7; }
.stage.next { border-color: rgba(139, 92, 246, 0.6); background: rgba(139, 92, 246, 0.14); }
.stage.later { opacity: 0.4; }
.launch { text-align: center; margin-top: 14px; }
.launch p { background: rgba(248, 113, 113, 0.12); border: 1px solid rgba(248, 113, 113, 0.35); border-radius: 12px; padding: 10px; color: #fecaca; }
.launch-btn { font-size: 1.05rem; padding: 12px 22px; background: linear-gradient(135deg, #f472b6, #8b5cf6); animation: glow 1.6s ease-in-out infinite; }
@keyframes glow { 50% { box-shadow: 0 0 28px rgba(244, 114, 182, 0.7); } }

/* ---------- Barre de construction ---------- */

.hud-bottom {
  position: absolute;
  left: 50%;
  bottom: var(--gap);
  transform: translateX(-50%);
  width: min(1000px, calc(100% - 2 * var(--gap)));
  display: grid;
  justify-items: center;
  gap: 8px;
  z-index: 5;
  pointer-events: none;
}
.hud-bottom > * { pointer-events: auto; }
.mode-hint { margin: 0; padding: 5px 14px; border-radius: 999px; font-size: 0.85rem; text-align: center; max-width: 100%; }
.mode-hint:empty { display: none; }
.mode-hint strong { color: var(--cyan); }

.build-bar { list-style: none; margin: 0; padding: 8px; display: flex; gap: 6px; overflow-x: auto; max-width: 100%; border-radius: 20px; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.2) transparent; }
.pal {
  position: relative;
  width: 92px;
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: 8px 4px 7px;
  background: var(--glass-light);
  border: 1px solid transparent;
  border-radius: 14px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
}
.pal .icon { font-size: 1.7rem; line-height: 1.15; }
.pal .name { font-size: 0.74rem; line-height: 1.15; text-align: center; min-height: 2.3em; display: grid; place-items: center; font-weight: 500; }
.pal .price { font-size: 0.74rem; color: var(--muted); }
.pal .count { position: absolute; top: 4px; right: 6px; background: rgba(34, 211, 238, 0.2); color: #a5f3fc; border-radius: 999px; font-size: 0.68rem; font-weight: 600; min-width: 18px; padding: 0 5px; }
.pal .count:empty { display: none; }
.pal:hover:not(.mystery) { background: rgba(255, 255, 255, 0.14); transform: translateY(-2px); }
.pal.poor { opacity: 0.45; }
.pal.selected { background: rgba(139, 92, 246, 0.3); border-color: rgba(139, 92, 246, 0.8); opacity: 1; transform: translateY(-4px); }
.pal.mystery { cursor: default; }
.pal.mystery .icon { filter: brightness(0) invert(1); opacity: 0.18; }

/* ---------- Vue 2D de secours ---------- */

.grid-wrap { position: absolute; inset: 110px 16px 190px 110px; display: grid; place-items: center; }
.grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; width: min(100%, 520px, calc(100vh - 330px)); padding: 12px; border-radius: 20px; background: var(--glass); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); border: 1px solid var(--stroke); }
.tile { aspect-ratio: 1; position: relative; display: grid; place-items: center; border: 1px solid var(--stroke); border-radius: 10px; background: rgba(255, 255, 255, 0.06); cursor: pointer; padding: 0; min-width: 0; }
.tile .t-icon { font-size: clamp(1rem, 3vw, 2rem); line-height: 1; }
.tile .t-prod { position: absolute; bottom: 2px; left: 0; right: 0; font-size: clamp(0.5rem, 1vw, 0.68rem); line-height: 1; text-align: center; color: var(--muted); }
.tile.empty { border-style: dashed; }
.tile.empty:hover { background: rgba(139, 92, 246, 0.25); }
.tile.boost { background: rgba(74, 222, 128, 0.18); }
.tile.malus { background: rgba(248, 113, 113, 0.2); }
.tile.support { background: rgba(34, 211, 238, 0.15); }
.tile.locked { opacity: 0.25; cursor: default; }
.tile.expand { border-style: dashed; }
.tile.expand .t-icon { font-size: 1rem; color: var(--muted); }
.tile.expand:hover { background: rgba(34, 211, 238, 0.2); }
.tile.moving { outline: 2px solid var(--pink); outline-offset: 1px; }
.tile.lava { background: rgba(249, 115, 22, 0.55); cursor: default; }
.tile.pad { background: rgba(255, 255, 255, 0.14); border-color: var(--stroke-strong); }
.tile .bubble { position: absolute; top: -12px; right: -8px; font-size: 1.2rem; background: #fff; border-radius: 50%; width: 32px; height: 32px; display: grid; place-items: center; cursor: pointer; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4); animation: float 1.2s ease-in-out infinite; z-index: 2; }

/* ---------- Infobulle, notifications, effets ---------- */

.tooltip { position: fixed; z-index: 30; width: 285px; padding: 12px 14px; pointer-events: none; font-size: 0.86rem; background: var(--glass-strong); line-height: 1.45; }
.tt-head { display: flex; align-items: center; gap: 8px; }
.tt-icon { font-size: 1.6rem; }
.tt-name { font-family: var(--title); font-weight: 600; font-size: 1.05rem; }
.tt-desc { color: var(--muted); margin: 6px 0; }
.tooltip ul { margin: 4px 0; padding-left: 18px; }
.tooltip .plus { color: var(--green); }
.tooltip .minus { color: var(--red); }
.tt-total { border-top: 1px solid var(--stroke); padding-top: 6px; margin-top: 6px; }

.toasts { position: fixed; right: var(--gap); bottom: 170px; display: grid; gap: 8px; width: min(370px, calc(100% - 32px)); z-index: 40; }
.toast { padding: 12px 14px; font-size: 0.88rem; line-height: 1.45; background: var(--glass-strong); animation: toast-in 0.25s ease-out; }
.toast.out { opacity: 0; transition: opacity 0.4s; }
@keyframes toast-in { from { transform: translateX(16px); opacity: 0; } }

.pop { position: fixed; pointer-events: none; font-family: var(--title); font-weight: 700; font-size: 1.3rem; color: #fff; text-shadow: 0 2px 10px rgba(139, 92, 246, 0.9); animation: pop 0.9s ease-out forwards; z-index: 20; }
.pop.dmg { text-shadow: 0 2px 10px rgba(248, 113, 113, 0.95); }
@keyframes pop { to { transform: translateY(-60px); opacity: 0; } }

/* ---------- Carte de la galaxie ---------- */

.galaxy { position: fixed; inset: 0; z-index: 50; background: radial-gradient(ellipse at 50% 45%, #18143a, #05040d 70%); animation: fade-in 0.35s ease-out; }
@keyframes fade-in { from { opacity: 0; } }
.galaxy-canvas { position: absolute; inset: 0; }
.galaxy-canvas canvas { display: block; touch-action: none; }
.galaxy-head { position: absolute; top: var(--gap); left: 50%; transform: translateX(-50%); padding: 10px 22px; text-align: center; max-width: calc(100% - 120px); }
.galaxy-head h2 { margin: 0; font-family: var(--title); font-weight: 700; font-size: 1.3rem; }
.galaxy-head p { margin: 2px 0 0; color: var(--muted); font-size: 0.82rem; }
.galaxy-close { position: absolute; top: var(--gap); right: var(--gap); width: 40px; height: 40px; font-size: 1rem; }
.galaxy-card { position: absolute; left: 50%; bottom: 28px; transform: translateX(-50%); width: min(420px, calc(100% - 32px)); padding: 16px 18px; background: var(--glass-strong); animation: rise 0.25s ease-out; }
@keyframes rise { from { opacity: 0; transform: translate(-50%, 10px); } }
.galaxy-card .g-head { display: flex; align-items: center; gap: 12px; }
.galaxy-card .g-icon { font-size: 2.2rem; }
.galaxy-card h3 { margin: 0; font-family: var(--title); font-weight: 700; font-size: 1.2rem; }
.galaxy-card small { color: var(--muted); }
.galaxy-card p { margin: 10px 0; color: var(--muted); line-height: 1.45; }
.galaxy-card .g-actions { display: flex; gap: 8px; justify-content: flex-end; }

/* ---------- Petits écrans ---------- */

@media (max-width: 860px) {
  :root { --gap: 8px; --radius: 14px; }
  body { font-size: 14px; }
  .hud-top { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
  .money { padding: 6px 12px 8px; }
  .score { font-size: 1.5rem; }
  .env { grid-column: 1 / -1; width: 100%; margin: 0; padding: 5px 12px; }
  .env-icon { font-size: 1.5rem; }
  .env-next { margin-left: auto; max-width: none; }
  .me { align-self: start; grid-column: 2; grid-row: 1; }
  .me-text { display: none; }
  .boss-banner { top: 192px; }
  .boss-banner .b-hp { width: 70px; }
  .hud-side { top: auto; bottom: 178px; transform: none; left: var(--gap); right: var(--gap); display: flex; gap: 2px; overflow-x: auto; padding: 4px; border-radius: 18px; }
  .side-btn { width: 56px; flex-shrink: 0; padding: 6px 2px 4px; }
  .side-btn b { font-size: 1.15rem; }
  .panel { left: var(--gap); right: var(--gap); width: auto; top: 128px; bottom: 250px; }
  .mission { font-size: 0.8rem; gap: 6px; }
  .pal { width: 76px; }
  .pal .icon { font-size: 1.4rem; }
  .grid-wrap { inset: 140px 8px 260px 8px; }
  .toasts { bottom: 256px; }
  .tooltip { display: none !important; }
  .galaxy-head { max-width: calc(100% - 70px); left: var(--gap); transform: none; text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  .boss-face, .dot, .tile .bubble, .launch-btn, .panel { animation: none; }
}
