:root {
  --ink: #3a2312;
  --yellow: #ffd23f;
  --green: #8fdc3c;
  --purple: #2a1838;
  --red: #ff5a4e;
  --font: 'Luckiest Guy', 'Arial Rounded MT Bold', system-ui, sans-serif;
  --army: 'Black Ops One', 'Impact', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: #120b19; color: #fff; font-family: var(--font);
  user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent;
}
button { font-family: inherit; cursor: pointer; }
.hidden { display: none !important; }

/* ---------- barre d'aperçu (navigateur seulement) ---------- */
#devbar {
  height: 52px; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 0 14px; background: #1f1430; border-bottom: 2px solid #000;
  font-family: system-ui, sans-serif;
}
#devbar .devtitle { font-family: var(--army); color: var(--yellow); font-size: 18px; letter-spacing: 1px; white-space: nowrap; }
#devbar .devbtns { display: flex; gap: 8px; overflow-x: auto; }
#devbar button {
  background: #33224a; color: #fff; border: 2px solid #4d3570; border-radius: 10px;
  padding: 7px 12px; font: 600 14px system-ui, sans-serif; white-space: nowrap;
}
#devbar button.active { background: var(--yellow); color: #1b1026; border-color: #fff3b0; }
body.native #devbar { display: none; }

#stage { position: absolute; top: 52px; left: 0; right: 0; bottom: 0; display: flex; align-items: center; justify-content: center; }
body.native #stage { top: 0; }
#device { position: relative; width: 100%; height: 100%; }
body.phone #stage { background: radial-gradient(ellipse at center, #2b1d3c 0%, #120b19 70%); }
body.phone #device {
  width: auto; height: auto; flex: none; padding: 12px; border-radius: 48px;
  background: linear-gradient(145deg, #2b2b30, #0b0b0d);
  box-shadow: 0 0 0 2px #444, 0 0 0 5px #111, 0 30px 80px rgba(0,0,0,.7);
  transform-origin: center center;
}
#game { position: relative; width: 100%; height: 100%; overflow: hidden; background: var(--purple); touch-action: none; }
body.phone #game { border-radius: 36px; }
#punch { display: none; }
body.phone #punch {
  display: block; position: absolute; top: 24px; left: 50%; width: 14px; height: 14px; margin-left: -7px;
  border-radius: 50%; background: #050505; box-shadow: 0 0 0 2px #1a1a1a; z-index: 50; pointer-events: none;
}
body.phone.landscape #punch { top: 50%; left: 24px; margin: -7px 0 0 0; }
#view { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

#loading {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: var(--purple); color: var(--green); font-size: 22px; z-index: 40; text-align: center; padding: 20px;
}

/* ---------- texte cartoon ---------- */
.outline {
  color: #fff;
  text-shadow: 3px 0 0 var(--ink), -3px 0 0 var(--ink), 0 3px 0 var(--ink), 0 -3px 0 var(--ink),
               2px 2px 0 var(--ink), -2px -2px 0 var(--ink), 2px -2px 0 var(--ink), -2px 2px 0 var(--ink),
               0 6px 0 rgba(0,0,0,.35);
}

/* ---------- HUD ---------- */
#hud {
  position: absolute; inset: 0; pointer-events: none; z-index: 10;
  padding: max(8px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
}
body.phone #hud { padding-top: 34px; }
body.phone.landscape #hud { padding: 10px 14px 10px 44px; }
#xpbar {
  position: relative; height: 18px; border-radius: 10px; background: rgba(20,10,30,.75);
  border: 3px solid var(--ink); overflow: hidden;
}
#xpfill { height: 100%; width: 0%; background: linear-gradient(#b8ff6a, #59b62a); transition: width .15s; }
#lvl { position: absolute; inset: 0; text-align: center; font-size: 13px; line-height: 13px; color: #fff; text-shadow: 1px 1px 0 var(--ink), -1px -1px 0 var(--ink); }
#toprow { display: flex; align-items: center; gap: 8px; margin-top: 7px; }
#hpbox { display: flex; align-items: center; gap: 4px; flex: 1; max-width: 230px; }
#hpbox .ico { font-size: 20px; }
#hpbar { flex: 1; height: 16px; border-radius: 9px; background: rgba(20,10,30,.75); border: 3px solid var(--ink); overflow: hidden; }
#hpfill { height: 100%; width: 100%; background: linear-gradient(#ff8a7a, #e5332a); transition: width .15s; }
#timer { font-size: 26px; min-width: 70px; text-align: center; white-space: nowrap; }
#kills { font-size: 18px; }
#timer, #kills { color: #fff; text-shadow: 2px 2px 0 var(--ink), -2px -2px 0 var(--ink), 2px -2px 0 var(--ink), -2px 2px 0 var(--ink); }
#pauseBtn {
  pointer-events: auto; margin-left: auto; width: 44px; height: 44px; border-radius: 12px;
  border: 3px solid var(--ink); background: var(--yellow); color: var(--ink); font-size: 20px; box-shadow: 0 4px 0 var(--ink);
}
#bossbar { margin: 8px auto 0; max-width: 420px; text-align: center; }
#bossname { font-size: 16px; color: #ffb3f0; text-shadow: 2px 2px 0 var(--ink), -2px -2px 0 var(--ink), 2px -2px 0 var(--ink), -2px 2px 0 var(--ink); }
#bossbar .bar { height: 14px; border-radius: 8px; background: rgba(20,10,30,.8); border: 3px solid var(--ink); overflow: hidden; margin-top: 2px; }
#bossfill { height: 100%; width: 100%; background: linear-gradient(#e78bff, #9a2fd0); }
#radio {
  position: absolute; left: 50%; bottom: max(70px, calc(env(safe-area-inset-bottom) + 70px)); transform: translateX(-50%);
  width: min(92%, 440px); display: flex; gap: 10px; align-items: center;
  background: rgba(25, 40, 20, .92); border: 3px solid var(--ink); border-radius: 14px; padding: 8px 12px;
  box-shadow: 0 5px 0 rgba(0,0,0,.4); animation: pop .25s ease-out;
}
#radio .avatar { width: 58px; height: 58px; object-fit: contain; margin: -14px 0 -6px -6px; filter: drop-shadow(0 2px 0 rgba(0,0,0,.4)); }
#radio b { font-family: var(--army); color: var(--green); font-size: 13px; letter-spacing: 1px; font-weight: normal; }
#radio p { margin: 2px 0 0; font-size: 16px; line-height: 1.15; }
#weapons { position: absolute; left: max(10px, env(safe-area-inset-left)); bottom: max(10px, env(safe-area-inset-bottom)); display: flex; gap: 5px; }
body.phone #weapons { bottom: 26px; left: 18px; }
#weapons .w {
  position: relative; width: 38px; height: 38px; border-radius: 10px; background: rgba(20,10,30,.7);
  border: 2px solid var(--ink); display: flex; align-items: center; justify-content: center; font-size: 21px;
}
#weapons .w i { position: absolute; right: -3px; bottom: -5px; font-style: normal; font-size: 12px; color: var(--yellow); text-shadow: 1px 1px 0 var(--ink), -1px -1px 0 var(--ink); }
#pointer {
  position: absolute; left: 0; top: 0; font-size: 34px; color: var(--yellow); margin: -17px 0 0 -17px;
  width: 34px; height: 34px; line-height: 34px; text-align: center;
  text-shadow: 2px 2px 0 var(--ink), -2px -2px 0 var(--ink), 2px -2px 0 var(--ink), -2px 2px 0 var(--ink);
  animation: blink .6s infinite alternate;
}
#banner {
  position: absolute; left: 0; right: 0; top: 34%; text-align: center; font-family: var(--army);
  font-size: clamp(26px, 7vmin, 54px); color: var(--yellow);
  text-shadow: 3px 3px 0 var(--ink), -3px -3px 0 var(--ink), 3px -3px 0 var(--ink), -3px 3px 0 var(--ink), 0 8px 0 rgba(0,0,0,.4);
  animation: slam .35s ease-out; padding: 0 12px;
}
#banner small { display: block; font-family: var(--font); font-size: .5em; color: #fff; margin-top: 6px; }
#flash { position: absolute; inset: 0; pointer-events: none; background: #ff2a2a; opacity: 0; transition: opacity .25s; z-index: 11; }

/* joystick */
#joy {
  position: absolute; width: 120px; height: 120px; margin: -60px 0 0 -60px; border-radius: 50%;
  border: 4px solid rgba(255,255,255,.35); background: rgba(0,0,0,.18); pointer-events: none; z-index: 12;
}
#joyKnob {
  position: absolute; left: 50%; top: 50%; width: 54px; height: 54px; margin: -27px 0 0 -27px; border-radius: 50%;
  background: rgba(255, 210, 63, .85); border: 4px solid var(--ink);
}

/* ---------- écrans ---------- */
#screens { position: absolute; inset: 0; z-index: 20; pointer-events: none; }
.screen {
  position: absolute; inset: 0; pointer-events: auto; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: max(20px, env(safe-area-inset-top)) 18px max(20px, env(safe-area-inset-bottom)); text-align: center; overflow-y: auto;
  animation: fade .25s ease-out;
}
body.phone .screen { padding-top: 40px; }
.screen.transparentbg { background: linear-gradient(rgba(18,8,28,.6), rgba(18,8,28,.2) 45%, rgba(18,8,28,.65)); }
.screen.dim { background: rgba(18, 8, 28, .78); }
.screen.dark { background: radial-gradient(ellipse at center, rgba(42,24,56,.9), rgba(10,5,16,.97)); }
.btn {
  pointer-events: auto; font-family: var(--font); font-size: 22px; color: var(--ink);
  background: var(--yellow); border: 4px solid var(--ink); border-radius: 16px; padding: 12px 26px 9px;
  box-shadow: 0 6px 0 var(--ink); margin: 7px; min-width: 210px; transition: transform .08s;
}
.btn:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--ink); }
.btn.green { background: var(--green); }
.btn.small { font-size: 17px; min-width: 0; padding: 9px 16px 6px; }
.btn.ghost { background: #e9ddff; }

.propaganda {
  font-family: var(--army); font-size: 13px; letter-spacing: 2px; color: #ffe8a6;
  background: #8c1d1d; border: 3px solid var(--ink); padding: 4px 12px; transform: rotate(-2deg); margin-bottom: 6px;
}
.title-main { font-family: var(--army); font-size: clamp(44px, 13vmin, 96px); line-height: .95; color: var(--yellow); margin: 4px 0; }
.title-sub { font-size: clamp(22px, 6vmin, 40px); color: var(--green); margin-bottom: 4px; }
.title-hero { height: clamp(120px, 28vmin, 230px); filter: drop-shadow(0 8px 0 rgba(0,0,0,.35)); animation: bob 1.2s ease-in-out infinite alternate; margin: 6px 0; }
.know { font-size: 14px; color: #c9b6ff; margin-top: 8px; font-family: system-ui, sans-serif; font-style: italic; }
.parts { display: flex; gap: 6px; justify-content: center; margin: 8px 0; flex-wrap: wrap; }
.parts .p {
  width: 46px; height: 46px; border-radius: 12px; border: 3px solid var(--ink); background: rgba(255,255,255,.12);
  display: flex; align-items: center; justify-content: center; font-size: 24px; filter: grayscale(1) opacity(.45);
}
.parts .p.got { background: var(--green); filter: none; }
.parts .p.new { animation: wiggle .5s ease-in-out 3; }

.story-emoji { font-size: clamp(70px, 22vmin, 140px); line-height: 1; margin-bottom: 14px; animation: bob 1s ease-in-out infinite alternate; }
.story-img { height: clamp(140px, 34vmin, 260px); margin-bottom: 10px; }
.story-text { font-size: clamp(20px, 5.4vmin, 34px); max-width: 640px; line-height: 1.2; margin-bottom: 18px; }
.story-dots { display: flex; gap: 6px; margin-bottom: 10px; }
.story-dots span { width: 10px; height: 10px; border-radius: 50%; background: rgba(255,255,255,.25); }
.story-dots span.on { background: var(--yellow); }

.h1 { font-family: var(--army); font-size: clamp(30px, 9vmin, 62px); color: var(--yellow); margin: 0 0 6px; line-height: 1; }
.h2 { font-size: clamp(18px, 5vmin, 28px); margin: 0 0 10px; }
.card-brief {
  background: #f5ecd2; color: var(--ink); border: 4px solid var(--ink); border-radius: 16px; padding: 14px 18px;
  max-width: 460px; font-size: 18px; line-height: 1.25; margin: 8px 0 12px; box-shadow: 0 6px 0 rgba(0,0,0,.4); transform: rotate(-1deg);
}
.card-brief .stamp { display: inline-block; font-family: var(--army); color: #b3261e; border: 3px solid #b3261e; padding: 2px 8px; transform: rotate(-6deg); margin-bottom: 6px; }
.hint { font-size: 15px; color: #d8ccef; margin: 4px 0 10px; font-family: system-ui, sans-serif; }

.cards { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; max-width: 760px; }
.card {
  pointer-events: auto; width: 210px; background: #fff7e0; color: var(--ink); border: 4px solid var(--ink);
  border-radius: 18px; padding: 12px 10px 10px; box-shadow: 0 6px 0 var(--ink); cursor: pointer; transition: transform .1s;
  animation: pop .3s ease-out backwards; font-family: var(--font);
}
.card:hover { transform: translateY(-4px) rotate(-1deg); }
.card:active { transform: translateY(3px); }
.card .ic { font-size: 44px; line-height: 1.1; }
.card .nm { font-size: 20px; margin: 4px 0 2px; }
.card .lv { display: inline-block; font-size: 13px; background: var(--ink); color: var(--yellow); border-radius: 8px; padding: 2px 8px; margin-bottom: 4px; }
.card .lv.new { background: #b3261e; color: #fff; }
.card .ds { font-family: system-ui, sans-serif; font-size: 14px; font-weight: 600; line-height: 1.25; }
body.phone:not(.landscape) .card, .narrow .card { width: 100%; max-width: 320px; display: grid; grid-template-columns: 56px 1fr; text-align: left; align-items: center; column-gap: 8px; padding: 8px 12px; }
body.phone:not(.landscape) .card .ic, .narrow .card .ic { grid-row: span 3; text-align: center; }

.stats { font-size: 20px; line-height: 1.5; margin: 8px 0 14px; }
.stats b { color: var(--yellow); font-weight: normal; }

@keyframes pop { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
#radio { animation-name: radioIn; }
@keyframes radioIn { from { transform: translate(-50%, 20px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes slam { from { transform: scale(2.2); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes bob { from { transform: translateY(0); } to { transform: translateY(-10px); } }
@keyframes blink { from { opacity: 1; } to { opacity: .45; } }
@keyframes wiggle { 0%,100% { transform: rotate(0); } 25% { transform: rotate(-12deg) scale(1.15); } 75% { transform: rotate(12deg) scale(1.15); } }

.know { cursor: pointer; text-decoration: underline dotted; }

.icimg { width: 1em; height: 1em; object-fit: contain; vertical-align: middle; }
#weapons .w .icimg { width: 30px; height: 30px; }
.parts .p .icimg { width: 34px; height: 34px; }
.card .ic .icimg { width: 56px; height: 56px; }
.story-emoji .icimg { width: 1.1em; height: 1.1em; }

/* ---------- mode base (Command & Conquer) ---------- */
#hud.rts .heroOnly, #hud:not(.rts) .rtsOnly { display: none !important; }
.money { display: flex; align-items: center; gap: 4px; font-size: 24px; background: rgba(20,10,30,.75); border: 3px solid var(--ink); border-radius: 12px; padding: 2px 10px 0 4px; }
.money img { width: 30px; height: 30px; object-fit: contain; margin-top: -3px; }
#wave, #nestsLeft { font-size: 20px; color: #fff; text-shadow: 2px 2px 0 var(--ink), -2px -2px 0 var(--ink), 2px -2px 0 var(--ink), -2px 2px 0 var(--ink); }
#wave { color: #ffb3a8; }
#minimap {
  position: absolute; right: max(10px, env(safe-area-inset-right)); top: 64px; width: 120px; height: 120px;
  border-radius: 50%; border: 3px solid var(--ink); background: rgba(20,10,30,.6); pointer-events: auto; cursor: pointer;
}
body.phone #minimap { top: 88px; right: 16px; width: 100px; height: 100px; }
#rtsPanel {
  position: absolute; left: 0; right: 0; bottom: 0; pointer-events: auto;
  padding: 18px max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
  background: linear-gradient(rgba(20,10,30,0), rgba(20,10,30,.85) 30%);
}
body.phone #rtsPanel { padding-bottom: 22px; border-radius: 0 0 34px 34px; }
.rsel { display: flex; align-items: center; gap: 6px; background: rgba(245,236,210,.95); color: var(--ink); border: 3px solid var(--ink); border-radius: 12px; padding: 4px 6px 4px 10px; margin-bottom: 6px; font-size: 15px; }
.rsel span { flex: 1; line-height: 1.15; }
.rsel .icimg { width: 24px; height: 24px; }
.rb { font-family: var(--font); font-size: 16px; border: 3px solid var(--ink); border-radius: 10px; background: var(--yellow); color: var(--ink); padding: 5px 10px 3px; box-shadow: 0 3px 0 var(--ink); }
.rb.ok { background: var(--green); font-size: 20px; padding: 3px 16px 1px; }
.rtabs { display: flex; gap: 5px; margin-bottom: 5px; }
.rt { font-family: var(--font); font-size: 15px; border: 3px solid var(--ink); border-radius: 10px; background: #5a4a6e; color: #fff; padding: 5px 10px 3px; white-space: nowrap; }
.rt.on { background: var(--yellow); color: var(--ink); }
.rt.atk { margin-left: auto; background: #ff7a4e; color: var(--ink); }
.rt.def { background: #8ce0ff; color: var(--ink); }
#wave { font-size: 17px; white-space: nowrap; }
.rlist { display: flex; gap: 6px; overflow-x: auto; padding: 6px 2px 4px; scrollbar-width: thin; }
.ri {
  position: relative; flex: none; width: 82px; font-family: var(--font); border: 3px solid var(--ink); border-radius: 12px; background: #fff7e0; color: var(--ink);
  display: flex; flex-direction: column; align-items: center; padding: 4px 2px 3px; box-shadow: 0 4px 0 var(--ink);
}
.ri:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.ri.on { background: var(--green); }
.ri.no { filter: grayscale(.8) brightness(.8); }
.ri .ic { font-size: 28px; height: 36px; display: flex; align-items: center; }
.ri .ic .icimg { width: 36px; height: 36px; }
.ri .nm { font-size: 11px; line-height: 1.05; text-align: center; min-height: 23px; }
.ri .co { font-size: 13px; color: #2f7a10; }
.ri .q { position: absolute; top: -6px; right: -6px; background: #b3261e; color: #fff; border-radius: 10px; padding: 1px 6px; font-style: normal; font-size: 13px; border: 2px solid var(--ink); }
.ri .lock { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; font-size: 10px; background: rgba(40,20,40,.75); color: #fff; border-radius: 9px; padding: 2px; }
/* en mode base, la radio est petite, en haut à gauche, pour ne pas cacher la carte */
#hud.rts #radio { bottom: auto; top: 58px; left: 10px; transform: none; width: min(62%, 360px); padding: 4px 8px; opacity: .92; animation: none; }
#hud.rts #radio .avatar { width: 40px; height: 40px; margin: -6px 0 -4px -4px; }
#hud.rts #radio b { font-size: 10px; }
#hud.rts #radio p { font-size: 13px; }
body.phone #hud.rts #radio { top: 84px; left: 16px; width: 64%; }

/* petits écrans (téléphone) : les 4 boutons du mode base tiennent sur une ligne */
#game.narrow .rtabs { gap: 4px; }
#game.narrow .rt { font-size: 12px; padding: 5px 6px 3px; border-width: 2px; }
#game.narrow .rt.atk { margin-left: 0; }
#game.narrow .rsel { font-size: 13px; }

.rb.big { font-size: 18px; padding: 6px 12px 4px; animation: pulse 0.9s ease-in-out infinite alternate; white-space: nowrap; }
@keyframes pulse { from { transform: scale(1); } to { transform: scale(1.07); } }

/* pouvoirs de la Flotte (à droite, comme dans Command & Conquer) */
#powers { position: absolute; right: max(10px, env(safe-area-inset-right)); top: 196px; display: flex; flex-direction: column; gap: 8px; pointer-events: auto; }
body.phone #powers { top: 200px; right: 16px; }
.pw { position: relative; width: 54px; height: 54px; border-radius: 50%; border: 3px solid var(--ink); background: #ffd23f; box-shadow: 0 4px 0 var(--ink); font-size: 26px; padding: 0; }
.pw .pi { line-height: 1; }
.pw.on { background: #7dff4a; animation: pulse .6s ease-in-out infinite alternate; }
.pw.wait { background: #6b6278; filter: grayscale(.6); }
.pw i { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-style: normal; font-size: 18px; color: #fff; background: rgba(20,10,30,.55); border-radius: 50%;
  text-shadow: 1px 1px 0 var(--ink), -1px -1px 0 var(--ink); }
.pw b { position: absolute; bottom: -8px; left: 50%; transform: translateX(-50%); font-weight: normal; font-size: 11px; background: var(--ink); color: var(--yellow); border-radius: 8px; padding: 0 5px; }
#selbox { position: absolute; border: 2px dashed #7dff4a; background: rgba(125,255,74,.12); pointer-events: none; z-index: 13; }

/* compétence spéciale de Lucas (mode héros) */
#skillBtn { position: absolute; right: max(14px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom)); width: 78px; height: 78px; border-radius: 50%;
  border: 4px solid var(--ink); background: radial-gradient(circle at 40% 35%, #d8ff7a, #6cc22a); box-shadow: 0 5px 0 var(--ink); pointer-events: auto; padding: 0; }
#skillBtn span { font-size: 32px; display: block; line-height: 1; margin-top: -6px; }
#skillBtn b { position: absolute; left: 50%; bottom: -14px; transform: translateX(-50%); font-weight: normal; font-size: 11px; background: var(--ink); color: var(--yellow); border-radius: 8px; padding: 1px 6px; white-space: nowrap; }
#skillBtn i { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-style: normal; font-size: 26px; color: #fff; border-radius: 50%; text-shadow: 2px 2px 0 var(--ink); }
#skillBtn.wait { filter: grayscale(.7) brightness(.8); }
#skillBtn.wait i { background: rgba(20,10,30,.45); }
body.phone #skillBtn { bottom: 30px; right: 22px; }

/* icônes Gemini */
.pw .pi img { width: 46px; height: 46px; display: block; margin: auto; }
.pw { background: transparent; }
.pw.wait { background: transparent; }
.rt .ti { width: 20px; height: 20px; vertical-align: -5px; margin-right: 3px; }
#skillBtn { background: transparent; border: none; box-shadow: none; }
#skillBtn span img { width: 82px; height: 82px; margin-top: -2px; filter: drop-shadow(0 4px 0 var(--ink)); }
.title-hero.poster { height: clamp(170px, 40vmin, 330px); border: 4px solid var(--ink); border-radius: 10px; box-shadow: 0 8px 0 rgba(0,0,0,.35); animation: none; transform: rotate(-1.5deg); }

.story-img { border-radius: 12px; }
.rsel .selpor { width: 40px; height: 40px; margin: -6px 0 -6px -6px; }

.end-img { height: clamp(120px, 30vmin, 230px); filter: drop-shadow(0 6px 0 rgba(0,0,0,.35)); }
.end-row { display: flex; align-items: center; justify-content: center; gap: 10px; }
.end-row .medal { height: clamp(90px, 22vmin, 170px); animation: wiggle .6s ease-in-out 3; filter: drop-shadow(0 5px 0 rgba(0,0,0,.35)); }
.parts .p { background: transparent; border: none; width: 44px; height: 54px; }
.parts .p .icimg { width: 40px; height: 52px; }
.parts .p.got { background: transparent; filter: none; }

/* ---------- habillage pro (kit d'interface Gemini) ---------- */
.logo { width: min(86%, 520px); filter: drop-shadow(0 8px 0 rgba(0,0,0,.35)); animation: bob 1.4s ease-in-out infinite alternate; margin: -4px 0 0; }
#loading { flex-direction: column; gap: 14px; background: #120b19 url('../assets/chargement.webp') center / cover no-repeat; justify-content: flex-end; padding-bottom: 8%; }
#loading #loadtext { background: rgba(10,5,18,.7); padding: 6px 14px; border-radius: 10px; }
#loading .lbar { width: min(80%, 520px); height: 22px; border: 3px solid var(--ink); border-radius: 12px; background: rgba(10,5,18,.8); overflow: hidden; }
#loading #loadfill { height: 100%; width: 0; background: linear-gradient(#b8ff6a, #59b62a); transition: width .3s; }
#rtsPanel { background: url('../assets/ui/ui_1.webp') center top / 100% 100% no-repeat; padding-top: 22px; }
#mmframe { position: absolute; right: max(10px, env(safe-area-inset-right)); top: 64px; width: 120px; height: 120px; pointer-events: none; transform: scale(1.22); }
body.phone #mmframe { top: 88px; right: 16px; width: 100px; height: 100px; }
#minimap { border: none; }
.card-brief { background: url('../assets/ui/ui_8.webp') center / 100% 100% no-repeat; border: none; box-shadow: none; padding: 34px 34px 30px; }
#pauseBtn { background: url('../assets/ui/ui_4.webp') center / 100% 100% no-repeat; border: none; box-shadow: none; }
#banner { background: url('../assets/ui/ui_6.webp') center / contain no-repeat; padding: 26px 12px 34px; }
.mis-img { width: min(92%, 520px); border: 4px solid var(--ink); border-radius: 12px; box-shadow: 0 6px 0 rgba(0,0,0,.4); margin-bottom: 4px; }
.logo { width: auto; max-width: min(84%, 440px); max-height: 28vh; }
.title-hero.poster { height: clamp(110px, 26vh, 250px); }

/* gestes du tutoriel */
.gestes { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 8px; max-width: 640px; }
.geste { width: 140px; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 12px; line-height: 1.15; color: #fff; text-shadow: 0 1px 2px #000; }
.geste img { width: 54px; height: 54px; object-fit: contain; filter: drop-shadow(0 3px 0 rgba(0,0,0,.35)); }
/* trophées */
.trophies { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; max-width: 640px; width: 100%; overflow-y: auto; max-height: 62vh; padding: 4px; }
.tro { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; color: #fff; font-size: 11px; line-height: 1.15; }
.tro img { width: 64px; height: 72px; object-fit: contain; filter: grayscale(1) brightness(.55); opacity: .7; }
.tro b { font-size: 12px; color: #9aa; }
.tro span { opacity: .75; }
.tro.got img { filter: drop-shadow(0 4px 0 rgba(0,0,0,.35)); opacity: 1; }
.tro.got b { color: #ffd84a; }
#toast { position: absolute; left: 50%; top: 32%; transform: translate(-50%, -40px) scale(.6); opacity: 0; z-index: 60; display: flex; align-items: center; gap: 10px;
  background: linear-gradient(#3b3020, #1e180f); border: 3px solid #ffd84a; border-radius: 14px; padding: 6px 14px 6px 6px; color: #fff;
  box-shadow: 0 6px 0 rgba(0,0,0,.4); transition: transform .45s cubic-bezier(.2,1.4,.4,1), opacity .3s; pointer-events: none; max-width: 92%; }
#toast.show { transform: translate(-50%, 0) scale(1); opacity: 1; }
#toast img { width: 52px; height: 58px; object-fit: contain; }
#toast div { display: flex; flex-direction: column; line-height: 1.1; }
#toast small { color: #ffd84a; font-size: 11px; letter-spacing: 1px; }
#toast b { font-family: 'Luckiest Guy', sans-serif; font-size: 18px; }
#toast span { font-size: 12px; opacity: .85; }
@media (max-width: 520px) {
  .trophies { grid-template-columns: repeat(3, 1fr); }
  .geste { width: 104px; font-size: 11px; }
  .geste img { width: 44px; height: 44px; }
}
/* ordre de mission plus compact (l'image + les gestes doivent tenir dans l'écran) */
.mis-img { max-height: 26vh; width: auto; max-width: min(92%, 520px); object-fit: cover; }
.screen .card-brief { font-size: 14px; padding: 26px 28px 22px; }
.gestes { gap: 4px 6px; }
.geste { width: 92px; font-size: 10.5px; }
.geste img { width: 40px; height: 40px; }
.hint:has(.gestes) { margin: 2px 0 6px; }
.screen { justify-content: safe center; }

/* écran titre : grand décor du menu */
.screen.menubg { background: linear-gradient(rgba(18,8,28,.55), rgba(18,8,28,0) 40%, rgba(18,8,28,0) 60%, rgba(18,8,28,.7)), url('../assets/menu.webp') center / cover no-repeat, #1a0f24; }
.screen.menubg .logo { max-height: 34vh; }

/* logo écrit (en attendant le logo dessiné « Starshiprout ») */
.textlogo { flex-direction: column; align-items: center; gap: 4px; animation: bob 1.4s ease-in-out infinite alternate; margin: 4px 0 8px; }
.textlogo b { font-family: 'Luckiest Guy', sans-serif; font-weight: normal; font-size: clamp(40px, 11vw, 92px); line-height: .95; letter-spacing: 2px;
  color: #ffd84a; -webkit-text-stroke: 3px #3a2412; paint-order: stroke fill;
  text-shadow: 0 6px 0 #3a2412, 0 0 24px rgba(156,255,58,.75), 0 0 6px rgba(156,255,58,.9); transform: rotate(-3deg); }
.textlogo span { font-family: 'Luckiest Guy', sans-serif; font-size: clamp(14px, 3.6vw, 24px); color: #fff; background: #4f8a1f;
  border: 3px solid #3a2412; border-radius: 10px; padding: 4px 14px 2px; box-shadow: 0 4px 0 #3a2412; transform: rotate(-2deg); }

/* pouvoirs de la Flotte : le cercle se remplit pendant l'attente, le bouton brille quand c'est prêt */
.pw.wait i { background: conic-gradient(rgba(255,210,63,.55) var(--p), rgba(20,10,30,.7) 0); font-family: 'Luckiest Guy', sans-serif; font-size: 20px; text-shadow: 0 2px 0 #000; }
.pw.ready { animation: pwReady .5s ease-in-out 5 alternate; }
@keyframes pwReady { from { transform: scale(1); filter: drop-shadow(0 0 0 #ffd23f); } to { transform: scale(1.18); filter: drop-shadow(0 0 12px #ffd23f); } }

/* tutoriel guidé de la première base */
#tuto { position: absolute; top: 56px; left: 8px; right: 150px; max-width: 460px; z-index: 30; display: flex; align-items: center; gap: 8px;
  background: linear-gradient(#fff8dc, #f1e3b4); color: #3a2412; border: 3px solid #3a2412; border-radius: 14px; padding: 6px 8px 6px 4px;
  box-shadow: 0 5px 0 rgba(0,0,0,.35); pointer-events: auto; }
#tuto.pop { animation: tutoPop .45s cubic-bezier(.2,1.5,.4,1); }
@keyframes tutoPop { from { transform: scale(.7); opacity: 0; } to { transform: scale(1); opacity: 1; } }
#tuto img { width: 58px; height: 58px; object-fit: contain; flex: none; margin: -10px 0 -6px; filter: drop-shadow(0 2px 0 rgba(0,0,0,.3)); }
#tuto .tt { flex: 1; min-width: 0; }
#tuto small { display: block; font-family: var(--army); color: #b3261e; font-size: 11px; letter-spacing: 1px; }
#tuto p { margin: 2px 0 0; font-size: 14px; line-height: 1.2; }
#tuto p b { color: #2e6b12; }
#tuto .tskip { flex: none; align-self: flex-start; font-size: 11px; padding: 3px 7px; border-radius: 8px; border: 2px solid #3a2412; background: #e8d9a8; color: #3a2412; }
#hud.rts.tuto-on #radio { top: auto; bottom: 200px; }
.tuto-hl { position: relative; z-index: 5; animation: tutoHl .55s ease-in-out infinite alternate !important; box-shadow: 0 0 0 4px #ffd23f, 0 0 18px 6px rgba(255,210,63,.9) !important; }
@keyframes tutoHl { from { transform: scale(1); } to { transform: scale(1.1); } }
@media (max-width: 520px) { #tuto { right: 128px; } #tuto p { font-size: 12.5px; } #tuto img { width: 46px; height: 46px; } }
#tuto { top: calc(max(8px, env(safe-area-inset-top)) + 52px); }
body.phone #tuto { top: 84px; left: 14px; }

.version { position: absolute; right: 10px; bottom: max(6px, env(safe-area-inset-bottom)); font-size: 11px; color: rgba(255,255,255,.75); text-shadow: 0 1px 2px #000; font-family: system-ui, sans-serif; }

#lives { font-family: 'Luckiest Guy', sans-serif; font-weight: normal; color: #fff; font-size: 15px; margin: 0 4px 0 -2px; text-shadow: 0 2px 0 #000; }
.story-img { max-width: 94%; object-fit: contain; }

.version a { color: #ffd84a; text-decoration: underline; cursor: pointer; pointer-events: auto; }
.credits { font-size: 14px; line-height: 1.35; }
.version { text-align: right; } #updstatus { color: #b8ff6a; }
