*, *::before, *::after { box-sizing: border-box; }

:root {
  --bg: #140f24;
  --bg2: #1e1636;
  --card: rgba(255, 255, 255, .07);
  --line: rgba(255, 255, 255, .14);
  --text: #f4f1ff;
  --muted: rgba(244, 241, 255, .62);
  --gold: #ffe66d;
  --fight: #ff7a3d;
  --ok: #56d364;
  --danger: #ff5a5a;
  --radius: 18px;
}

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Trebuchet MS", system-ui, -apple-system, sans-serif;
  overscroll-behavior: none;
}

body { -webkit-tap-highlight-color: transparent; }

.screen { min-height: 100%; }
[hidden] { display: none !important; }

/* ---------- Carte ---------- */

.screen-map {
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;
  overflow: hidden;
  touch-action: none;
  background:
    radial-gradient(130% 70% at 50% 8%, #4a3a86 0%, transparent 62%),
    linear-gradient(180deg, #241a44, #120d20);
}

#map-canvas { position: absolute; top: 0; right: 0; bottom: 0; left: 0; width: 100%; height: 100%; display: block; }

.map-labels { position: absolute; top: 0; right: 0; bottom: 0; left: 0; pointer-events: none; }

.map-label {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: auto;
  border: 1px solid var(--line);
  background: rgba(10, 6, 20, .62);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  font-weight: bold;
  padding: 5px 12px;
  border-radius: 999px;
  white-space: nowrap;
  cursor: pointer;
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  transition: background .15s ease, border-color .15s ease;
}
.map-label.is-selected {
  background: var(--gold);
  border-color: var(--gold);
  color: #2a2100;
}
.map-label.is-locked { opacity: .5; }

.map-head {
  position: absolute;
  top: max(14px, env(safe-area-inset-top));
  left: 0;
  right: 0;
  text-align: center;
  pointer-events: none;
}
.map-head h1 {
  margin: 0;
  font-size: clamp(26px, 7vw, 38px);
  line-height: 1;
  letter-spacing: -1px;
  text-shadow: 0 4px 16px rgba(0, 0, 0, .6);
}
.map-head h1 span { color: var(--gold); }

.sel-panel {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: max(16px, env(safe-area-inset-bottom));
  width: min(440px, calc(100% - 28px));
  background: rgba(12, 8, 24, .86);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 16px;
  text-align: center;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.sel-panel h2 { margin: 0; font-size: 21px; }
.sel-sub { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.sel-meta { margin: 8px 0 0; font-size: 13px; font-weight: bold; }
.sel-best { margin: 4px 0 0; font-size: 12px; color: var(--gold); }
.sel-panel .btn-fight { width: 100%; margin-top: 14px; padding: 14px; font-size: 16px; }

.link-btn {
  margin-top: 10px;
  background: none;
  border: 0;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  text-decoration: underline;
  cursor: pointer;
}

.help-sheet {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  background: rgba(8, 5, 16, .85);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 5;
}
.help-card {
  background: linear-gradient(180deg, rgba(255, 255, 255, .1), rgba(255, 255, 255, .04));
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 22px;
  max-width: 420px;
  width: 100%;
}
.help-card h2 { margin: 0 0 14px; font-size: 19px; }
.help-card ol { margin: 0 0 18px; padding-left: 20px; display: grid; gap: 9px; }
.help-card li { font-size: 14px; color: var(--muted); line-height: 1.45; }
.help-card li b { color: var(--text); }
.help-card .btn-ghost { width: 100%; }

/* ---------- Boutons ---------- */

.btn {
  border: 0;
  border-radius: 12px;
  padding: 12px 18px;
  font: inherit;
  font-weight: bold;
  color: #1a1030;
  background: #fff;
  cursor: pointer;
  transition: transform .08s ease, filter .15s ease;
  touch-action: manipulation;
}
.btn:active { transform: scale(.96); }
.btn:disabled { opacity: .4; cursor: default; }

.btn-fight { background: var(--fight); color: #2a1000; }
.btn-buy { background: var(--gold); }
.btn-share { background: var(--ok); color: #05210b; }
.btn-ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
}
.btn-reset {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  width: 100%;
  margin-top: 14px;
  font-size: 13px;
  padding: 10px;
}

/* ---------- Écran de jeu ---------- */

.screen-game {
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;
  overflow: hidden;
  touch-action: none;
}

#game-canvas { position: absolute; top: 0; right: 0; bottom: 0; left: 0; width: 100%; height: 100%; display: block; }
.fx-layer { position: absolute; top: 0; right: 0; bottom: 0; left: 0; pointer-events: none; overflow: hidden; }

.hud { position: absolute; left: 0; right: 0; padding: 12px; pointer-events: none; }
.hud-top { top: max(10px, env(safe-area-inset-top)); display: flex; gap: 10px; align-items: center; }
.hud-bottom { bottom: max(12px, env(safe-area-inset-bottom)); display: grid; gap: 10px; }
.core-hud { top: calc(72px + env(safe-area-inset-top)); }

.btn-icon {
  pointer-events: auto;
  width: 42px; height: 42px;
  flex: 0 0 42px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, .45);
  color: #fff;
  font-size: 20px;
  cursor: pointer;
}

.top-stats { display: flex; gap: 8px; margin-left: auto; }

.chip {
  background: rgba(0, 0, 0, .5);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 14px;
  font-weight: bold;
}
.chip-coin { color: var(--gold); }
.chip-coin::before { content: '◈ '; }

.core-bar { max-width: 460px; margin: 0 auto; transition: transform .1s ease; }
.core-bar.hurt { animation: hurt .25s ease; }
@keyframes hurt { 50% { transform: scale(1.04); } }

.bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: bold;
  text-shadow: 0 2px 6px rgba(0, 0, 0, .75);
  margin-bottom: 4px;
}

.bar {
  height: 14px;
  border-radius: 999px;
  background: rgba(0, 0, 0, .55);
  border: 1px solid rgba(255, 255, 255, .22);
  overflow: hidden;
}
.fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #6fe3ff, #9d7bff);
  transition: width .2s ease;
}

/* Panneau de construction */

.build-panel {
  pointer-events: auto;
  background: rgba(12, 8, 24, .88);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  max-width: 520px;
  margin: 0 auto;
  width: 100%;
}
.panel-title { margin: 0 0 10px; font-size: 13px; color: var(--muted); text-align: center; }

.tower-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }

.tower-card {
  display: grid;
  gap: 2px;
  align-content: start;
  background: rgba(255, 255, 255, .08);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 8px;
  color: var(--text);
  font: inherit;
  text-align: center;
  cursor: pointer;
}
.tower-card strong { font-size: 13px; }
.tower-card span { font-size: 10px; color: var(--muted); line-height: 1.25; }
.tower-card em { font-style: normal; font-weight: bold; color: var(--gold); font-size: 14px; margin-top: 4px; }
.tower-card:disabled { opacity: .4; cursor: default; }
.tower-card.static { cursor: default; }
.tower-card.static span { font-size: 16px; color: var(--text); font-weight: bold; }

.btn.wide { width: 100%; margin-top: 10px; }

.wave-row { display: flex; align-items: center; justify-content: center; gap: 12px; pointer-events: auto; }
.wave-status {
  font-size: 13px;
  font-weight: bold;
  text-shadow: 0 2px 6px rgba(0, 0, 0, .75);
}
#wave-btn { pointer-events: auto; padding: 14px 28px; }

/* Nombres flottants */

.float {
  position: absolute;
  transform: translate(-50%, -50%);
  font-weight: bold;
  font-size: 20px;
  text-shadow: 0 3px 8px rgba(0, 0, 0, .85);
  animation: floatUp .9s ease-out forwards;
  pointer-events: none;
}
.float.dmg { color: #fff; }
.float.coin { color: var(--gold); font-size: 22px; }

@keyframes floatUp {
  to { transform: translate(calc(-50% + var(--dx)), -170%); opacity: 0; }
}

.toast {
  position: absolute;
  top: 26%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(12, 8, 24, .9);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 22px;
  font-weight: bold;
  font-size: 15px;
  animation: popIn .3s ease-out;
  pointer-events: none;
  white-space: nowrap;
}
@keyframes popIn { from { transform: translateX(-50%) scale(.7); opacity: 0; } }

/* Écran de fin */

.overlay {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  background: rgba(10, 6, 20, .85);
  display: grid;
  place-items: center;
  padding: 20px;
  animation: fadeIn .25s ease-out;
}
@keyframes fadeIn { from { opacity: 0; } }

.result-card {
  background: linear-gradient(180deg, rgba(255, 255, 255, .1), rgba(255, 255, 255, .04));
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 26px 22px;
  text-align: center;
  max-width: 400px;
  width: 100%;
}
.result-card h2 { margin: 0 0 10px; font-size: 28px; letter-spacing: 1px; }
.overlay.won h2 { color: var(--gold); }
.overlay.lost h2 { color: var(--danger); }
.result-card p { margin: 0 0 8px; color: var(--muted); font-size: 15px; }

.result-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 18px 0 12px;
}
.result-stats span {
  display: grid;
  gap: 2px;
  background: rgba(0, 0, 0, .3);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 6px;
  font-size: 11px;
  color: var(--muted);
}
.result-stats b { font-size: 24px; color: var(--text); }

.result-next { color: var(--ok) !important; font-weight: bold; }
.result-actions { display: grid; gap: 10px; margin-top: 18px; }

/* ---------- Son et signalement ---------- */

.sound-btn,
.bug-btn {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  left: 12px;
  z-index: 40;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, .45);
  color: var(--muted);
  font: inherit;
  font-size: 10px;
  font-weight: bold;
  letter-spacing: .5px;
  cursor: pointer;
}
/* Sur l'écran de jeu, la flèche retour occupe déjà le coin : on décale. */
.sound-btn { left: 52px; }
.sound-btn.is-off { color: rgba(255, 90, 90, .9); }

/* Sur l'écran de jeu, la flèche retour occupe déjà le coin : on décale. */
#screen-game:not([hidden]) ~ .bug-btn { left: 62px; }
#screen-game:not([hidden]) ~ .sound-btn { left: 102px; }
.bug-btn:active, .sound-btn:active { transform: scale(.94); }

.bug-sheet {
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;
  z-index: 50;
  background: rgba(8, 5, 16, .88);
  display: grid;
  place-items: center;
  padding: 20px;
}
.bug-card {
  background: linear-gradient(180deg, rgba(255, 255, 255, .1), rgba(255, 255, 255, .04));
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 20px;
  max-width: 420px;
  width: 100%;
}
.bug-card h2 { margin: 0 0 6px; font-size: 19px; }
.bug-hint { margin: 0 0 12px; font-size: 13px; color: var(--muted); line-height: 1.4; }
.bug-card textarea {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, .35);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  padding: 10px;
  resize: vertical;
}
.bug-status { margin: 10px 0 0; font-size: 13px; color: var(--muted); }
.bug-status.ok { color: var(--ok); }
.bug-status.err { color: var(--danger); }
.bug-actions { display: grid; gap: 8px; margin-top: 14px; }

/* ---------- Sort de foudre ---------- */

.bolt-btn {
  position: absolute;
  right: max(14px, env(safe-area-inset-right));
  top: 42%;
  width: 74px;
  height: 74px;
  border-radius: 50%;
  border: 0;
  background: rgba(0, 0, 0, .5);
  color: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
  pointer-events: auto;
  --charge: 1;
  font: inherit;
  touch-action: manipulation;
}
.bolt-ring {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  border-radius: 50%;
  background: conic-gradient(#8fd4ff calc(var(--charge) * 360deg), rgba(255, 255, 255, .14) 0);
  -webkit-mask: radial-gradient(circle, transparent 62%, #000 64%);
  mask: radial-gradient(circle, transparent 62%, #000 64%);
}
.bolt-icon { font-size: 10px; font-weight: bold; letter-spacing: .5px; opacity: .5; }
.bolt-btn.ready .bolt-icon { opacity: 1; }
.bolt-btn.ready { background: rgba(120, 200, 255, .22); }
.bolt-btn.armed {
  background: rgba(150, 220, 255, .45);
  animation: pulse 1s ease-in-out infinite;
}
@keyframes pulse { 50% { transform: scale(1.08); } }

.bolt-hint {
  position: absolute;
  top: 30%;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  background: rgba(12, 8, 24, .88);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 18px;
  font-size: 14px;
  font-weight: bold;
  color: #bdf4ff;
  pointer-events: none;
  white-space: nowrap;
}

/* Safari ne transmet pas la police aux boutons : on la force partout. */
button, textarea { font-family: inherit; }

/* Gardien, recentrage de la vue, bandeau d'evenement */
.chip-hero { background: rgba(63, 111, 216, 0.85); }
.side-stack {
  position: absolute; left: 12px; top: 40%; z-index: 6;
  display: flex; flex-direction: column; align-items: flex-start; gap: 8px;
}
.view-btn {
  padding: 6px 12px; border-radius: 999px; border: 0;
  background: rgba(20, 14, 40, 0.6); color: #fff; font: inherit; font-size: 13px; font-weight: 700;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.banner {
  position: absolute; left: 50%; top: 30%; z-index: 8; pointer-events: none;
  transform: translate(-50%, -50%); white-space: nowrap;
  font-size: clamp(20px, 6vw, 34px); font-weight: 900; letter-spacing: 0.02em; color: #fff4c2;
  text-shadow: 0 3px 0 #7a3b12, 0 6px 18px rgba(0, 0, 0, 0.55);
}
.banner.show { animation: banner-in 2.2s ease both; }
@keyframes banner-in {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(1.8); }
  12% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  80% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -62%) scale(0.96); }
}

/* Glisser pour tourner l'ile ne doit jamais selectionner de texte. */
.screen { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }

/* En jeu, son et bug passent dans le menu pause : le haut d'ecran respire. */
#screen-game:not([hidden]) ~ .bug-btn,
#screen-game:not([hidden]) ~ .sound-btn { display: none; }
.overlay.pause { z-index: 30; }
.overlay.pause .result-card { max-width: 320px; }
#pause-btn { font-weight: 900; letter-spacing: -1px; }

/* Cartes de tourelle : pastille de couleur par type. */
.tower-card { position: relative; padding-top: 30px; }
.tower-card::before {
  content: ''; position: absolute; top: 10px; left: 50%; width: 18px; height: 18px; margin-left: -9px;
  border-radius: 50%; box-shadow: 0 0 0 3px rgba(255, 255, 255, .15), 0 0 12px currentColor;
}
.tower-card.static { padding-top: 10px; }
.tower-card.static::before { display: none; }
.t-ballista::before { background: #c89a62; color: #c89a62; }
.t-cannon::before { background: #ff7a3d; color: #ff7a3d; }
.t-frost::before { background: #8fe6ff; color: #8fe6ff; }
.tower-card:not(:disabled):active { transform: scale(.96); }
.btn:not(:disabled):active { transform: scale(.97); }
.float.dmg { text-shadow: 0 2px 0 rgba(0, 0, 0, .55); }

.side-stack .chip, .side-stack .view-btn { font-size: 12px; padding: 5px 10px; }

/* Mondes, etoiles, cristaux, Armurerie */
.sel-world { margin: 0 0 2px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--gold); font-weight: 800; }
.sel-links { display: flex; justify-content: center; gap: 18px; }
.map-label .stars { display: block; font-style: normal; font-size: 10px; color: #ffd84d; letter-spacing: 1px; line-height: 1; }
.gem-chip {
  position: absolute; top: max(12px, env(safe-area-inset-top)); right: 12px; z-index: 5;
  padding: 7px 12px; border-radius: 999px; background: rgba(20, 14, 40, .7); color: #9fe8ff;
  font-weight: 800; font-size: 14px; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.result-stars { margin: 4px 0 0; font-size: 34px; color: #ffd84d; letter-spacing: 4px; text-shadow: 0 2px 10px rgba(255, 200, 60, .6); }
.result-stars:empty { display: none; }
.result-gems { margin: 6px 0 0; color: #9fe8ff; font-weight: 800; }
.armory-card { max-width: 420px; }
.armory-sub { margin: -6px 0 14px; color: var(--muted); font-size: 13px; }
.armory-sub b { color: #9fe8ff; }
.armory-list { display: grid; gap: 10px; margin-bottom: 16px; }
.perk { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; background: rgba(255, 255, 255, .06); }
.perk > div { flex: 1; display: grid; gap: 2px; }
.perk strong { font-size: 14px; }
.perk span { font-size: 12px; color: var(--muted); }
.perk em { font-style: normal; font-size: 9px; color: #9fe8ff; letter-spacing: 2px; }
.perk .btn { padding: 8px 12px; min-width: 76px; font-size: 13px; }

/* Aides a la lecture : tutoriel, apercu de vague, gains d'amelioration */
.coach {
  position: absolute; left: 50%; top: calc(118px + env(safe-area-inset-top)); z-index: 7; transform: translateX(-50%);
  width: min(80vw, 320px); margin: 0; padding: 9px 14px; border-radius: 16px; text-align: center;
  background: #fff6c8; color: #2a1d05; font-weight: 800; font-size: 14px; line-height: 1.3;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .35), 0 0 0 3px #ffd84d; pointer-events: none;
}
.coach.pop { animation: coach-pop .45s ease; }
@keyframes coach-pop { 0% { transform: translateX(-50%) scale(.85); opacity: 0; } 100% { transform: translateX(-50%) scale(1); opacity: 1; } }
.wave-preview {
  pointer-events: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-bottom: 8px;
}
.wave-preview .pv-title { width: 100%; text-align: center; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: rgba(255, 255, 255, .8); font-weight: 800; text-shadow: 0 1px 3px rgba(0,0,0,.6); }
.wave-preview .pv { padding: 4px 10px; border-radius: 999px; background: rgba(20, 14, 40, .72); color: #fff; font-size: 12px; font-weight: 700; }
.wave-preview .pv i { font-style: normal; color: #9fe8ff; font-size: 10px; }
.wave-preview .pv.boss { background: #b3261e; }
.tower-card .up { color: #7dffa0; font-weight: 800; }

/* ================= Refonte visuelle v2 =================
   Police de jeu arrondie embarquee (hors ligne), boutons en relief, panneaux
   vitres a liseré dore, barres et pastilles plus lisibles. */
@font-face { font-family: 'Baloo 2'; src: url('../fonts/baloo2-500.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Baloo 2'; src: url('../fonts/baloo2-700.woff2') format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Baloo 2'; src: url('../fonts/baloo2-800.woff2') format('woff2'); font-weight: 800; font-display: swap; }
@font-face { font-family: 'Baloo 2'; src: url('../fonts/baloo2-500.woff2') format('woff2'); font-weight: 400; font-display: swap; }
html, body, button, textarea { font-family: 'Baloo 2', "Trebuchet MS", system-ui, sans-serif; }
:root {
  --panel: linear-gradient(180deg, rgba(46, 32, 88, .95), rgba(20, 14, 42, .97));
  --trim: rgba(255, 214, 110, .28);
  --shadow: 0 14px 40px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 255, 255, .12);
}

/* Boutons en relief : ils s'enfoncent sous le doigt. */
.btn {
  border: 0; border-radius: 16px; font-weight: 800; letter-spacing: .2px;
  box-shadow: 0 5px 0 rgba(0, 0, 0, .28), 0 10px 20px rgba(0, 0, 0, .25);
  transition: transform .08s ease, box-shadow .08s ease, filter .15s ease;
}
.btn:not(:disabled):active { transform: translateY(4px); box-shadow: 0 1px 0 rgba(0, 0, 0, .28), 0 4px 10px rgba(0, 0, 0, .2); }
.btn-fight {
  background: linear-gradient(180deg, #ffa04f, #ff6a2b); color: #fff;
  text-shadow: 0 2px 0 rgba(140, 50, 10, .55);
  box-shadow: 0 5px 0 #b8431a, 0 10px 22px rgba(255, 106, 43, .35);
}
.btn-fight:not(:disabled):active { box-shadow: 0 1px 0 #b8431a, 0 4px 10px rgba(255, 106, 43, .3); }
.btn-buy {
  background: linear-gradient(180deg, #fff09a, #ffc93d); color: #3a2600;
  box-shadow: 0 5px 0 #b88a14, 0 10px 20px rgba(255, 201, 61, .25);
}
.btn-buy:not(:disabled):active { box-shadow: 0 1px 0 #b88a14; }
.btn-share {
  background: linear-gradient(180deg, #7ff08a, #3fc25a); color: #06300f;
  box-shadow: 0 5px 0 #237a36, 0 10px 20px rgba(63, 194, 90, .25);
}
.btn-ghost {
  background: rgba(255, 255, 255, .08); color: var(--text);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .16), 0 4px 0 rgba(0, 0, 0, .25);
}
.btn:disabled { filter: grayscale(.6); opacity: .5; }

/* Panneaux vitrés à liseré doré. */
.sel-panel, .build-panel, .help-card, .result-card, .bug-card {
  background: var(--panel);
  border: 2px solid var(--trim);
  border-radius: 24px;
  box-shadow: var(--shadow);
}
.sel-panel h2 { font-size: 26px; font-weight: 800; line-height: 1.1; }
.sel-world { font-size: 12px; }
.panel-title { font-size: 15px; font-weight: 800; color: #fff; }

/* Titre du jeu en relief. */
.map-head h1 {
  font-size: clamp(34px, 9vw, 48px); font-weight: 800; letter-spacing: -.5px;
  text-shadow: 0 3px 0 #5a2fb0, 0 6px 0 rgba(30, 10, 70, .6), 0 10px 24px rgba(0, 0, 0, .55);
}
.map-head h1 span { color: #ffd84d; }

/* Étiquettes d'îles. */
.map-label {
  font-size: 13px; font-weight: 800; padding: 4px 14px 3px;
  background: linear-gradient(180deg, rgba(40, 28, 78, .9), rgba(16, 10, 34, .9));
  border: 2px solid rgba(255, 255, 255, .18);
  box-shadow: 0 3px 0 rgba(0, 0, 0, .35);
}
.map-label.is-selected {
  background: linear-gradient(180deg, #fff09a, #ffc93d); border-color: #fff4c0; color: #3a2600;
  box-shadow: 0 3px 0 #b88a14, 0 0 18px rgba(255, 216, 77, .6);
  animation: label-bob 1.6s ease-in-out infinite;
}
@keyframes label-bob { 50% { margin-top: -4px; } }

/* Pastilles du haut. */
.chip {
  font-weight: 800; font-size: 16px; padding: 6px 14px;
  background: linear-gradient(180deg, rgba(40, 28, 78, .92), rgba(16, 10, 34, .92));
  border: 2px solid rgba(255, 255, 255, .14);
  box-shadow: 0 3px 0 rgba(0, 0, 0, .35);
}
.chip-coin { border-color: rgba(255, 216, 77, .55); }
.chip-hero { background: linear-gradient(180deg, #5b8bff, #3456d8); border-color: #9fbaff; color: #fff; }
.gem-chip { border: 2px solid rgba(159, 232, 255, .5); box-shadow: 0 3px 0 rgba(0, 0, 0, .35); }
.btn-icon {
  background: linear-gradient(180deg, rgba(40, 28, 78, .92), rgba(16, 10, 34, .92));
  border: 2px solid rgba(255, 255, 255, .16); box-shadow: 0 3px 0 rgba(0, 0, 0, .35); color: #fff;
}

/* Barre du cœur : plus épaisse, reflet, cœur devant le libellé. */
.bar { height: 18px; border: 2px solid rgba(255, 255, 255, .25); box-shadow: inset 0 2px 4px rgba(0, 0, 0, .4); }
.fill { position: relative; }
.fill::after {
  content: ''; position: absolute; left: 4px; right: 4px; top: 2px; height: 35%;
  border-radius: 999px; background: rgba(255, 255, 255, .35);
}
.bar-label { font-weight: 800; font-size: 14px; text-shadow: 0 2px 3px rgba(0, 0, 0, .6); }
.bar-label span:first-child::before { content: '♥ '; color: #ff6b8a; }

/* Cartes de tourelles. */
.tower-card {
  background: linear-gradient(180deg, rgba(255, 255, 255, .12), rgba(255, 255, 255, .04));
  border: 2px solid rgba(255, 255, 255, .12); border-radius: 16px;
  box-shadow: 0 4px 0 rgba(0, 0, 0, .3);
}
.tower-card strong { font-size: 15px; font-weight: 800; }
.tower-card span { font-size: 11px; }
.tower-card em { font-size: 16px; font-weight: 800; }
.tower-card em::before { content: '◈ '; font-size: 12px; }
.tower-card.static span { font-size: 20px; }

/* Bouton de foudre plus magique. */
.bolt-btn {
  background: radial-gradient(circle at 50% 35%, rgba(120, 200, 255, .35), rgba(20, 30, 70, .8));
  border: 2px solid rgba(160, 220, 255, .45); box-shadow: 0 4px 0 rgba(0, 0, 0, .35), 0 0 18px rgba(120, 200, 255, .25);
}
.bolt-btn.ready { box-shadow: 0 4px 0 rgba(0, 0, 0, .35), 0 0 26px rgba(140, 220, 255, .7); }
.bolt-icon { font-size: 12px; font-weight: 800; }
.bolt-icon::before { content: '⚡'; display: block; font-size: 24px; line-height: 1; }

/* Fin de partie. */
.result-card h2 { font-size: 34px; font-weight: 800; text-shadow: 0 3px 0 rgba(0, 0, 0, .35); }
.overlay.won h2 { color: #ffd84d; text-shadow: 0 3px 0 #a0740a, 0 0 24px rgba(255, 216, 77, .5); }
.result-stars { animation: stars-in .8s cubic-bezier(.2, 1.6, .4, 1) both; }
@keyframes stars-in { from { transform: scale(0) rotate(-20deg); opacity: 0; } }
.result-stats span { border-radius: 14px; background: rgba(255, 255, 255, .07); }

/* Chiffres flottants. */
.float { font-weight: 800; -webkit-text-stroke: 1px rgba(0, 0, 0, .45); }
.float.coin { font-size: 24px; }
.toast, .wave-status { font-weight: 800; }
.banner { font-weight: 800; -webkit-text-stroke: 1.5px rgba(90, 30, 10, .6); }

.tower-card strong { font-size: 14px; line-height: 1.1; }
body { font-weight: 500; }

/* Bandeaux de monde sur la carte */
.world-tag {
  position: absolute; top: 0; left: 0; pointer-events: none; text-align: center; white-space: nowrap;
  font-weight: 800; font-size: 15px; color: #fff4c2; letter-spacing: .04em; text-transform: uppercase;
  text-shadow: 0 2px 0 rgba(60, 20, 110, .9), 0 0 14px rgba(255, 216, 77, .45);
  opacity: .85;
}
.world-tag small { display: block; font-size: 10px; color: #9fe8ff; letter-spacing: .14em; }
.world-tag::before, .world-tag::after {
  content: ''; position: absolute; top: 60%; width: 44px; height: 2px;
  background: linear-gradient(90deg, transparent, rgba(255, 216, 77, .7));
}
.world-tag::before { right: 100%; margin-right: 8px; }
.world-tag::after { left: 100%; margin-left: 8px; transform: scaleX(-1); }

.world-banner {
  display: inline-block; margin: 8px 0 0; padding: 3px 16px; border-radius: 999px;
  font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: #fff4c2;
  background: linear-gradient(180deg, rgba(90, 47, 176, .85), rgba(40, 20, 90, .85));
  border: 2px solid rgba(255, 216, 77, .45); box-shadow: 0 3px 0 rgba(0, 0, 0, .35);
}
.world-banner:empty { display: none; }
.world-banner.swap { animation: coach-pop2 .4s ease; }
@keyframes coach-pop2 { from { transform: scale(.8); opacity: 0; } }
.world-tag { display: none; }

.perk.shop { background: linear-gradient(135deg, rgba(255, 160, 79, .22), rgba(155, 93, 229, .25)); border: 2px solid rgba(255, 216, 77, .45); }
.perk.shop .restore { margin-top: 4px; font-size: 11px; padding: 0; text-align: left; }
.perk.shop .btn { min-width: 86px; }

.sel-mod { margin: 8px auto 0; padding: 6px 12px; border-radius: 12px; max-width: 360px; font-size: 13px; line-height: 1.3;
  background: rgba(255, 216, 77, .12); border: 1px solid rgba(255, 216, 77, .35); color: var(--text); }
.sel-mod b { color: #ffd84d; }
