:root {
  --ink: #f3efe6;
  --dim: rgba(243, 239, 230, 0.66);
  --red: #e0352b;
  --gold: #ffc247;
  --panel: rgba(12, 10, 12, 0.82);
  --line: rgba(243, 239, 230, 0.18);
  --font: 'Rajdhani', 'Bahnschrift', 'Arial Narrow', 'Segoe UI', sans-serif;
  --stencil: 'Saira Stencil One', 'Impact', 'Arial Black', sans-serif;
  /* marges de sécurité : encoche, coins arrondis, barre d'accueil */
  --sat: env(safe-area-inset-top, 0px);
  --sar: env(safe-area-inset-right, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
}
* { box-sizing: border-box; }
html { height: 100%; }
html, body { margin: 0; overflow: hidden; background: #050405; color: var(--ink); font-family: var(--font); font-weight: 600; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; overscroll-behavior: none; touch-action: manipulation; }
/* corps figé : ni défilement, ni rebond élastique, ni tirer pour rafraîchir */
body { position: fixed; inset: 0; }
#c { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.hidden { display: none !important; }
body.playing #c { cursor: none; }

/* ---------- écrans ---------- */
.screen { position: fixed; inset: 0; display: none; z-index: 20; overflow-y: auto; touch-action: pan-y; padding: max(24px, calc(var(--sat) + 12px)) max(24px, calc(var(--sar) + 12px)) max(24px, calc(var(--sab) + 12px)) max(24px, calc(var(--sal) + 12px)); }
.screen.show { display: flex; }
.screen > * { margin: auto; flex: none; }
#loading { background: radial-gradient(120% 90% at 50% 40%, #2a1512 0%, #0a0607 62%, #000 100%); }
#menu { background: linear-gradient(90deg, rgba(5, 3, 4, 0.9) 0%, rgba(5, 3, 4, 0.62) 34%, rgba(5, 3, 4, 0) 66%); }
#pause, #armory, #options, #controls, #over, #briefing, #fatal { background: rgba(4, 3, 5, 0.62); backdrop-filter: blur(7px); -webkit-backdrop-filter: blur(7px); }
#armory, #options, #controls { z-index: 30; }
.title-wrap { text-align: center; width: min(640px, 100%); }
.menu-col { width: min(470px, 100%); display: flex; flex-direction: column; gap: 14px; }
#menu > .menu-col { margin: auto auto auto min(7vw, 96px); }
.menu-btns { display: flex; flex-direction: column; gap: 10px; }
.menu-col.center { gap: 10px; align-items: stretch; text-align: center; }
.kicker, .tag { font-size: 13px; letter-spacing: 0.34em; color: var(--gold); }
.kicker { font-size: clamp(13px, 2.3vh, 17px); letter-spacing: 0.42em; margin-right: -0.42em; }
h1 { font-family: var(--stencil); font-weight: 400; font-size: clamp(40px, min(14.5vw, 15vh), 92px); line-height: 0.92; margin: 6px 0 4px; letter-spacing: 0.02em; text-shadow: 0 4px 30px rgba(0, 0, 0, 0.7); }
h1 span { color: var(--red); display: block; }
h2 { font-family: var(--stencil); font-weight: 400; font-size: clamp(28px, 4vw, 44px); margin: 4px 0 10px; letter-spacing: 0.04em; }
.tagline { color: var(--dim); font-size: 18px; line-height: 1.35; margin: 10px 0 0; }
.sub { color: var(--dim); font-size: 16px; line-height: 1.4; margin: 0 0 12px; }
.footnote { position: absolute; right: 24px; bottom: 18px; color: rgba(243, 239, 230, 0.4); font-size: 13px; max-width: 46vw; text-align: right; margin: 0; }
#best { color: var(--gold); font-size: 15px; letter-spacing: 0.12em; min-height: 1em; }
#best:empty { display: none; }
.btn { font: inherit; font-size: 19px; letter-spacing: 0.12em; color: var(--ink); background: rgba(20, 16, 18, 0.74); border: 1px solid var(--line); border-left: 4px solid transparent; padding: 12px 18px; min-height: 52px; text-align: left; cursor: pointer; transition: transform 0.12s, background 0.12s, border-color 0.12s; touch-action: manipulation; }
.btn:focus-visible { background: rgba(60, 22, 20, 0.85); border-left-color: var(--red); outline: none; }
.btn:active { background: rgba(70, 24, 21, 0.92); border-left-color: var(--red); transform: scale(0.985); }
.btn.primary { background: var(--red); border-color: var(--red); color: #fff; font-size: 22px; }
.btn.primary:active { background: #f2473c; border-left-color: var(--gold); }
/* les effets de survol sont réservés aux appareils qui ont vraiment un pointeur */
@media (hover: hover) {
  .btn:hover { background: rgba(60, 22, 20, 0.85); border-left-color: var(--red); transform: translateX(6px); outline: none; }
  .btn.primary:hover { background: #f2473c; border-left-color: var(--gold); }
  .menu-col.center .btn:hover, .panel .btn:hover { transform: none; }
  .wcard:hover { background: rgba(70, 26, 22, 0.95); border-color: var(--red); transform: translateY(-2px); }
  .promo:hover { border-color: var(--gold); background: rgba(40, 28, 14, 0.86); }
  .promo:hover .promo-link { background: #ffd47a; }
  .credit:hover { color: var(--gold); }
}
.menu-col.center .btn, .panel .btn { text-align: center; }
.btn-row { display: flex; flex-direction: column; gap: 10px; }

/* réclame discrète pour le site de l'auteur */
.promo { display: grid; gap: 3px; text-decoration: none; color: var(--ink); background: rgba(20, 16, 18, 0.74); border: 1px solid rgba(255, 194, 71, 0.4); border-left: 4px solid var(--gold); padding: 12px 16px 14px; transition: background 0.12s, border-color 0.12s; }
.promo-by { font-size: 13px; letter-spacing: 0.24em; color: var(--gold); }
.promo-line { font-size: 16px; line-height: 1.25; color: var(--ink); }
.promo-link { justify-self: start; margin-top: 8px; font-size: 17px; font-weight: 700; letter-spacing: 0.05em; background: var(--gold); color: #1a1208; padding: 6px 14px; border-radius: 3px; transition: background 0.12s; }
.promo:active .promo-link { background: #ffd47a; }
.credit { display: block; color: var(--dim); font-size: 14px; letter-spacing: 0.05em; text-decoration: none; text-align: center; padding: 10px 6px 2px; }

.panel { background: var(--panel); border: 1px solid var(--line); border-top: 3px solid var(--red); padding: 26px 28px; width: min(540px, 100%); max-height: 100%; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; display: flex; flex-direction: column; gap: 10px; }
.panel > * { flex: none; }
.panel.wide { width: min(1040px, 100%); }
.panel label { display: flex; align-items: center; justify-content: space-between; gap: 16px; font-size: 17px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.panel label.check { justify-content: flex-start; gap: 12px; cursor: pointer; }
.panel input[type='checkbox'] { width: 22px; height: 22px; flex: none; accent-color: var(--red); }
.panel select, .panel input[type='range'] { font: inherit; width: 46%; accent-color: var(--red); }
.panel select { background: #1b1517; color: var(--ink); border: 1px solid var(--line); padding: 6px; }
.loadbar { height: 6px; background: rgba(255, 255, 255, 0.12); margin: 26px auto 10px; width: 100%; overflow: hidden; }
#loadfill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--red), var(--gold)); transition: width 0.2s; }
#loadtext { color: var(--dim); font-size: 15px; letter-spacing: 0.12em; min-height: 1.3em; }
.brief-box { width: min(680px, 100%); background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--gold); padding: 26px 30px; display: flex; flex-direction: column; gap: 14px; }
#brief-text { font-size: clamp(16px, 2.1vw, 20px); line-height: 1.5; min-height: 9em; white-space: pre-wrap; }
#brief-text b { color: var(--gold); }
#brief-text p { margin: 0 0 10px; }
.brief-how { list-style: none; margin: 14px 0 0; padding: 12px 0 0; border-top: 1px solid var(--line); display: grid; gap: 7px; color: var(--dim); font-size: 16px; line-height: 1.25; }
.keys { display: grid; gap: 6px; }
.keys > div { display: flex; align-items: center; gap: 8px; font-size: 16px; }
.keys span { color: var(--dim); margin-left: auto; text-align: right; }
kbd { font: inherit; font-size: 14px; background: #241c1e; border: 1px solid var(--line); border-bottom-width: 3px; border-radius: 4px; padding: 2px 9px; letter-spacing: 0.08em; white-space: nowrap; }
.touch-scheme { gap: 10px; }
.touch-scheme > div { display: grid; grid-template-columns: 46px 1fr; gap: 12px; align-items: center; }
.touch-scheme span { margin: 0; text-align: left; font-size: 15px; line-height: 1.25; }
.touch-scheme b { display: block; color: var(--ink); font-size: 16px; }
.ico { width: 46px; height: 46px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.4); background: rgba(15, 12, 14, 0.55); display: flex; align-items: center; justify-content: center; font-style: normal; font-size: 21px; color: #fff; }
.ico svg { width: 56%; height: 56%; fill: currentColor; }
.ico.fire { background: rgba(224, 53, 43, 0.75); font-family: var(--stencil); font-size: 13px; letter-spacing: 0.04em; }
.ico.stick::after { content: ''; width: 20px; height: 20px; border-radius: 50%; background: rgba(255, 255, 255, 0.65); }
.ico.aim { border-style: dashed; font-size: 18px; }
#armory-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.wcard { background: rgba(28, 22, 25, 0.9); border: 1px solid var(--line); padding: 10px 12px; cursor: pointer; display: grid; grid-template-columns: 40px 1fr; gap: 2px 8px; align-items: center; transition: background 0.12s, border-color 0.12s, transform 0.12s; text-align: left; font: inherit; color: var(--ink); touch-action: manipulation; }
.wcard:focus-visible { border-color: var(--red); outline: none; }
.wcard:active { background: rgba(70, 26, 22, 0.95); border-color: var(--red); }
.wcard.cur { border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); }
.wcard.out { opacity: 0.45; }
.wcard .ic { font-size: 30px; grid-row: span 2; }
.wcard .nm { font-size: 17px; line-height: 1.05; }
.wcard .ds { font-size: 13px; color: var(--dim); line-height: 1.15; }
.wcard .am { grid-column: span 2; font-size: 12px; color: var(--gold); letter-spacing: 0.08em; }
.wcard .am:empty { display: none; }
#over-stats { display: grid; grid-template-columns: 1fr auto; gap: 4px 20px; font-size: 18px; margin: 4px 0 10px; }
#over-stats b { color: var(--gold); text-align: right; }

/* ---------- interface en jeu (ordinateur par défaut) ---------- */
#hud { position: fixed; inset: 0; z-index: 10; pointer-events: none; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85); }
#hurt { position: absolute; inset: 0; opacity: 0; background: radial-gradient(ellipse at center, rgba(160, 0, 0, 0) 42%, rgba(190, 10, 10, 0.55) 100%); }
#scope { position: absolute; inset: 0; opacity: 0; background: radial-gradient(circle at center, rgba(0, 0, 0, 0) 0, rgba(0, 0, 0, 0) min(34vh, 34vw), #000 calc(min(34vh, 34vw) + 3px)); }
#scope .lens { position: absolute; left: 50%; top: 50%; width: min(68vh, 68vw); height: min(68vh, 68vw); transform: translate(-50%, -50%); border-radius: 50%; background: linear-gradient(#000, #000) center / 1.5px 100% no-repeat, linear-gradient(#000, #000) center / 100% 1.5px no-repeat; box-shadow: inset 0 0 60px rgba(0, 0, 0, 0.8); }
#crosshair { position: absolute; left: 50%; top: 50%; --gap: 8px; }
#crosshair i { position: absolute; background: #fff; box-shadow: 0 0 2px #000; opacity: 0.9; }
#crosshair .t, #crosshair .b { width: 2px; height: 9px; left: -1px; }
#crosshair .l, #crosshair .r { height: 2px; width: 9px; top: -1px; }
#crosshair .t { bottom: var(--gap); }
#crosshair .b { top: var(--gap); }
#crosshair .l { right: var(--gap); }
#crosshair .r { left: var(--gap); }
#crosshair b { position: absolute; width: 3px; height: 3px; left: -1.5px; top: -1.5px; background: #fff; border-radius: 50%; box-shadow: 0 0 2px #000; }
#hitmarker { position: absolute; left: 50%; top: 50%; opacity: 0; transform: rotate(45deg) scale(1); }
#hitmarker i { position: absolute; background: #fff; box-shadow: 0 0 3px #000; }
#hitmarker i:nth-child(1) { width: 2px; height: 10px; left: -1px; bottom: 7px; }
#hitmarker i:nth-child(2) { width: 2px; height: 10px; left: -1px; top: 7px; }
#hitmarker i:nth-child(3) { height: 2px; width: 10px; top: -1px; right: 7px; }
#hitmarker i:nth-child(4) { height: 2px; width: 10px; top: -1px; left: 7px; }
#hitmarker.kill i { background: var(--gold); }
#hitmarker.head i { background: #ff5a4a; }
#dmg { position: absolute; left: 50%; top: 50%; }
#dmg .arc { position: absolute; left: -110px; top: -110px; width: 220px; height: 220px; border-radius: 50%; background: conic-gradient(from -22deg, rgba(255, 60, 40, 0) 0deg, rgba(255, 70, 45, 0.95) 22deg, rgba(255, 60, 40, 0) 44deg, rgba(255, 60, 40, 0) 360deg); -webkit-mask: radial-gradient(circle, transparent 0 62%, #000 64% 70%, transparent 72%); mask: radial-gradient(circle, transparent 0 62%, #000 64% 70%, transparent 72%); animation: arc 1.1s ease-out forwards; }
@keyframes arc { from { opacity: 1; } to { opacity: 0; } }

#top { display: contents; }
#status { position: absolute; left: 28px; top: 22px; display: flex; align-items: baseline; gap: 8px; border-left: 3px solid var(--gold); padding-left: 10px; font-size: 18px; white-space: nowrap; }
#wave { font-family: var(--stencil); font-weight: 400; font-size: 22px; line-height: 1; letter-spacing: 0.05em; }
#remain { color: var(--dim); overflow: hidden; text-overflow: ellipsis; }
#remain:not(:empty)::before { content: '· '; }
#score { position: absolute; right: 28px; top: 18px; font-family: var(--stencil); font-weight: 400; font-size: 30px; line-height: 1; color: var(--gold); }
.bar { height: 8px; background: rgba(0, 0, 0, 0.55); border: 1px solid var(--line); overflow: hidden; }
#health { position: absolute; left: 28px; bottom: 26px; width: 220px; display: flex; align-items: center; gap: 8px; }
#health::before { content: ''; flex: none; width: 15px; height: 15px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23f3efe6' d='M12 21.2C6.6 17.1 2 13.3 2 8.9 2 6 4.2 3.8 7 3.8c1.9 0 3.7 1 5 2.7 1.3-1.7 3.1-2.7 5-2.7 2.8 0 5 2.2 5 5.1 0 4.4-4.6 8.2-10 12.3z'/%3E%3C/svg%3E") center / contain no-repeat; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.8)); }
#health .bar { flex: 1; }
#health-fill { height: 100%; width: 100%; background: linear-gradient(90deg, #58d06a, #c9f06a); transition: width 0.15s, background 0.3s; }
#health.low #health-fill { background: linear-gradient(90deg, #ff3b2f, #ff8a3a); }
#health.low::before { animation: blink 0.7s infinite; }
@keyframes blink { 50% { opacity: 0.35; } }
#boss { position: absolute; left: 50%; top: 20px; transform: translateX(-50%); width: min(520px, 46vw); text-align: center; }
#boss-name { font-family: var(--stencil); font-weight: 400; letter-spacing: 0.2em; font-size: 18px; color: #ff6a5a; margin-bottom: 3px; }
#boss-fill { height: 100%; width: 100%; background: linear-gradient(90deg, #ff4a3a, var(--gold)); transition: width 0.15s; }
#radar { position: absolute; left: 28px; bottom: 50px; width: 120px; height: 120px; border-radius: 50%; background: rgba(8, 10, 9, 0.5); border: 1px solid var(--line); }
#weapon { position: absolute; right: 28px; bottom: 20px; display: flex; align-items: baseline; gap: 8px; }
#wicon { font-size: 40px; align-self: center; margin-right: 4px; filter: drop-shadow(0 2px 3px #000); }
#ammo-mag { font-family: var(--stencil); font-weight: 400; font-size: 52px; line-height: 0.95; }
#ammo-mag.low { color: #ff5a4a; }
#ammo-res { font-size: 22px; color: var(--dim); }
#wbar { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); display: flex; gap: 4px; opacity: 0; transition: opacity 0.35s; }
#wbar.show { opacity: 1; }
#wbar span { width: clamp(24px, 2.9vw, 38px); height: 44px; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 20px; background: rgba(10, 8, 10, 0.55); border: 1px solid var(--line); line-height: 1; }
#wbar span small { font-size: 10px; color: var(--dim); margin-top: 2px; }
#wbar span.cur { border-color: var(--gold); background: rgba(90, 40, 20, 0.75); transform: translateY(-6px); }
#wbar span.out { opacity: 0.35; }
#wname { position: absolute; left: 50%; bottom: 72px; transform: translateX(-50%); font-size: 17px; letter-spacing: 0.16em; white-space: nowrap; opacity: 0; transition: opacity 0.3s; }
#wname.show { opacity: 1; }
#toast { position: absolute; left: 50%; top: 20%; transform: translateX(-50%); width: max-content; max-width: min(88vw, 640px); text-align: center; font-size: 19px; line-height: 1.25; letter-spacing: 0.1em; background: rgba(10, 8, 10, 0.64); padding: 6px 18px; border-bottom: 2px solid var(--gold); opacity: 0; transition: opacity 0.3s; }
#toast.show { opacity: 1; }
#banner { position: absolute; left: 0; right: 0; top: 27%; text-align: center; opacity: 0; transition: opacity 0.5s; padding: 0 5vw; }
#banner.show { opacity: 1; }
#banner-title { font-family: var(--stencil); font-weight: 400; font-size: clamp(28px, 4.6vw, 68px); letter-spacing: 0.06em; line-height: 1.05; }
#banner-sub { font-size: clamp(15px, 1.8vw, 24px); letter-spacing: 0.3em; margin-right: -0.3em; color: var(--gold); margin-top: 10px; }
#edges { position: absolute; inset: 0; display: none; }

/* ---------- commandes tactiles ---------- */
#touch { position: absolute; inset: 0; display: none; pointer-events: auto; touch-action: none; }
body.touch #touch { display: block; }
#stick { position: absolute; left: calc(var(--sal) + 20px); bottom: calc(var(--sab) + 82px); width: 124px; height: 124px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.4); background: radial-gradient(circle, rgba(255, 255, 255, 0.06) 0 54%, rgba(15, 12, 14, 0.36) 56% 100%); transition: border-color 0.15s; }
#stick.on { border-color: rgba(255, 255, 255, 0.75); }
#knob { position: absolute; left: 50%; top: 50%; width: 54px; height: 54px; margin: -27px 0 0 -27px; border-radius: 50%; background: rgba(255, 255, 255, 0.5); border: 2px solid rgba(255, 255, 255, 0.8); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45); will-change: transform; }
#stick.run #knob { background: rgba(255, 194, 71, 0.9); border-color: #fff; }
.tbtn { position: absolute; display: flex; align-items: center; justify-content: center; border-radius: 50%; background: rgba(15, 12, 14, 0.52); border: 2px solid rgba(255, 255, 255, 0.42); color: #fff; text-shadow: none; touch-action: none; transition: transform 0.08s, filter 0.08s; }
.tbtn svg { width: 54%; height: 54%; fill: currentColor; pointer-events: none; }
.tbtn span { pointer-events: none; }
.tbtn.on { transform: scale(0.93); filter: brightness(1.4); }
#t-fire { right: calc(var(--sar) + 18px); bottom: calc(var(--sab) + 96px); width: 96px; height: 96px; background: rgba(224, 53, 43, 0.64); border-color: rgba(255, 255, 255, 0.62); font-family: var(--stencil); font-size: 25px; letter-spacing: 0.06em; }
#t-weapon { right: calc(var(--sar) + 128px); bottom: calc(var(--sab) + 70px); width: 74px; height: 74px; flex-direction: column; border-color: rgba(255, 194, 71, 0.8); }
#tw-icon { font-size: 31px; line-height: 1.05; }
#tw-ammo { font-size: 16px; line-height: 1; margin-top: 1px; color: var(--gold); font-weight: 700; text-shadow: 0 1px 2px #000; }
#t-weapon.low #tw-ammo { color: #ff6a5a; }
#t-weapon.out { border-color: #ff5a4a; animation: blink 0.7s infinite; }
#t-jump { right: calc(var(--sar) + 36px); bottom: calc(var(--sab) + 208px); width: 60px; height: 60px; }
.tbtn.small { top: calc(var(--sat) + 8px); width: 46px; height: 46px; }
/* cible tactile élargie à 62 px autour des petits boutons du haut */
.tbtn.small::after { content: ''; position: absolute; inset: -8px; border-radius: 50%; }
#t-pause { left: calc(var(--sal) + 10px); }
#t-rotate { right: calc(var(--sar) + 10px); }
@media (orientation: landscape) {
  #stick { left: calc(var(--sal) + 44px); bottom: calc(var(--sab) + 28px); }
  #t-fire { right: calc(var(--sar) + 40px); bottom: calc(var(--sab) + 30px); }
  #t-weapon { right: calc(var(--sar) + 154px); bottom: calc(var(--sab) + 20px); }
  #t-jump { right: calc(var(--sar) + 58px); bottom: calc(var(--sab) + 140px); }
}

/* ---------- interface en jeu sur téléphone : le strict minimum ---------- */
body.touch #radar, body.touch #wbar, body.touch #weapon { display: none; }
body.touch #top { display: grid; position: absolute; top: calc(var(--sat) + 6px); left: calc(var(--sal) + 64px); right: calc(var(--sar) + 64px); max-width: 420px; margin: 0 auto; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 10px; align-items: baseline; background: rgba(10, 8, 10, 0.42); border-radius: 12px; padding: 7px 11px 9px; }
body.touch #status, body.touch #score, body.touch #health { position: static; }
body.touch #status { border: 0; padding: 0; font-size: 15px; gap: 6px; min-width: 0; }
body.touch #remain { color: rgba(243, 239, 230, 0.86); }
body.touch #wave { font-size: 16px; }
body.touch #score { font-size: 18px; }
body.touch #health { grid-column: 1 / -1; width: auto; gap: 6px; }
body.touch #health::before { width: 12px; height: 12px; }
body.touch #health .bar { height: 7px; }
body.touch #boss { top: calc(var(--sat) + 64px); width: min(78vw, 420px); }
body.touch #boss-name { font-size: 14px; letter-spacing: 0.16em; }
body.touch #toast { top: calc(var(--sat) + 108px); font-size: 15px; letter-spacing: 0.05em; padding: 5px 12px; }
body.touch #wname { bottom: auto; top: calc(50% + 64px); font-size: 15px; letter-spacing: 0.1em; background: rgba(10, 8, 10, 0.5); padding: 2px 10px; }
body.touch #banner-sub { letter-spacing: 0.12em; margin-right: 0; }
body.touch #edges { display: block; }
#edges i { position: absolute; top: 0; width: 30px; height: 30px; opacity: 0; transition: opacity 0.25s, transform 0.14s linear; }
#edges i.snap { transition: opacity 0.25s; }
#edges i.l { left: calc(var(--sal) + 4px); transform-origin: left center; }
#edges i.r { right: calc(var(--sar) + 4px); transform-origin: right center; }
#edges i::before { content: ''; position: absolute; left: 10px; top: 6px; width: 17px; height: 17px; border-left: 6px solid #ff4a3a; border-bottom: 6px solid #ff4a3a; border-radius: 3px; transform: rotate(45deg); filter: drop-shadow(0 0 2px #000) drop-shadow(0 0 5px rgba(0, 0, 0, 0.6)); }
#edges i.r::before { left: 3px; transform: rotate(-135deg); }
#edges i.on { opacity: var(--o, 1); }

/* ---------- menus compacts : téléphones dans les deux sens ---------- */
@media (max-width: 760px), (max-height: 520px) {
  .screen { padding: max(14px, calc(var(--sat) + 8px)) max(16px, calc(var(--sar) + 8px)) max(14px, calc(var(--sab) + 8px)) max(16px, calc(var(--sal) + 8px)); }
  #menu { background: linear-gradient(180deg, rgba(5, 3, 4, 0.86) 0%, rgba(5, 3, 4, 0.5) 40%, rgba(5, 3, 4, 0.9) 100%); }
  #menu > .menu-col { margin: auto; }
  .menu-col { width: min(440px, 100%); gap: 14px; }
  .menu-head { text-align: center; }
  .tagline { font-size: 15px; line-height: 1.3; margin-top: 8px; }
  .btn { min-height: 56px; text-align: center; padding: 10px 14px; }
  .btn.primary { min-height: 64px; font-size: 24px; }
  #best { text-align: center; }
  .promo { text-align: center; justify-items: center; border-left-width: 1px; border-top: 3px solid var(--gold); padding: 10px 12px 12px; }
  .promo-line { font-size: 15px; }
  .promo-link { justify-self: center; }
  .footnote { display: none; }
  .panel { padding: 18px 16px; max-width: 560px; }
  .panel.wide { max-width: 720px; }
  h2 { margin: 0 0 4px; }
  .panel label { padding: 6px 0; }
  .panel label:not(.check) { flex-direction: column; align-items: stretch; gap: 4px; }
  .panel label.check { min-height: 50px; }
  .panel input[type='checkbox'] { width: 28px; height: 28px; }
  .panel select, .panel input[type='range'] { width: 100%; }
  .panel input[type='range'] { height: 32px; }
  .panel select { min-height: 44px; font-size: 17px; }
  /* le bouton du bas reste sous le pouce même quand le panneau défile */
  .panel > .btn:last-child { position: sticky; bottom: 0; z-index: 1; }
  #btn-armory-close { background: #1b1517; }
  #over-tag { font-size: 12px; letter-spacing: 0.14em; }
  .credit { font-size: 13px; letter-spacing: 0.02em; }
  .brief-box { padding: 20px 18px; }
  #brief-text { font-size: 17px; line-height: 1.4; }
  #armory-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .wcard { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 3px; padding: 8px 4px; min-height: 98px; }
  .wcard .ic { font-size: 38px; line-height: 1.1; }
  .wcard .nm { font-size: 13px; line-height: 1.1; }
  .wcard .ds { display: none; }
  .wcard .am { font-size: 13px; letter-spacing: 0.04em; }
  #armory .sub { margin: 0 0 4px; font-size: 15px; }
}
/* téléphone couché : deux colonnes, sinon rien ne tient en hauteur */
@media (max-height: 520px) and (orientation: landscape) {
  .menu-col:not(.center) { width: min(780px, 100%); display: grid; grid-template-columns: 1fr 1fr; grid-template-areas: 'head btns' 'promo btns'; gap: 10px 26px; align-items: center; }
  .menu-head { grid-area: head; }
  .menu-btns { grid-area: btns; gap: 8px; }
  .promo { grid-area: promo; }
  .tagline { display: none; }
  .btn { min-height: 54px; padding: 8px 14px; }
  .btn.primary { min-height: 56px; }
  .menu-col.center { width: min(620px, 100%); display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px; }
  .menu-col.center h2, .menu-col.center .btn.primary, .menu-col.center .credit { grid-column: 1 / -1; }
  h2 { font-size: 26px; }
  .panel { padding: 12px 16px; gap: 8px; }
  /* arsenal couché : titre et bouton Fermer sur la même ligne, cinq colonnes de tuiles */
  #armory .panel { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px 12px; }
  #armory h2 { margin: 0; font-size: 24px; }
  #armory .sub { display: none; }
  #armory-grid { grid-column: 1 / -1; grid-row: 2; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
  #btn-armory-close { grid-column: 2; grid-row: 1; min-height: 50px; min-width: 132px; padding: 6px 22px; position: static; }
  .wcard { min-height: 66px; padding: 5px 4px; gap: 1px; }
  .wcard .ic { font-size: 27px; }
  #over .panel { width: min(760px, 100%); max-width: 760px; }
  #over .sub { margin: 0 0 2px; font-size: 15px; }
  .credit { padding-top: 4px; }
  #over-stats { grid-template-columns: 1fr auto 1fr auto; font-size: 16px; margin: 0 0 4px; }
  #over-stats b { margin-right: 14px; }
  .btn-row { flex-direction: row; }
  .btn-row .btn { flex: 1; font-size: 16px; letter-spacing: 0.06em; }
  .brief-box { padding: 14px 18px; gap: 10px; }
  #brief-text { font-size: 15px; }
  .brief-how { margin-top: 8px; padding-top: 8px; grid-template-columns: repeat(3, 1fr); font-size: 14px; }
}

/* ---------- variantes téléphone / ordinateur ---------- */
.mobile-only { display: none !important; }
body.mobile .mobile-only { display: flex !important; }
body.mobile .keys.mobile-only { display: grid !important; }
body.mobile .desktop-only { display: none !important; }
body.mobile #brief-text { white-space: normal; min-height: 0; }
