:root {
  --bg: #07100b;
  --bg2: #0f1a13;
  --panel: rgba(12, 22, 16, 0.78);
  --panel-solid: #0e1912;
  --line: rgba(160, 200, 150, 0.14);
  --line2: rgba(160, 200, 150, 0.28);
  --text: #e6eedd;
  --muted: #8fa391;
  --moss: #9ccc65;
  --moss-d: #4f7a2a;
  --ember: #ffa04d;
  --blood: #ff4d5a;
  --monster: #ff4d5a;
  --cyan: #5ff2d6;
  --lcd: #b8f27a;
  --lcd-bg: #15240f;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --ease: cubic-bezier(.2, .8, .2, 1);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: Rajdhani, system-ui, sans-serif; font-size: 17px; overscroll-behavior: none; }
body { overflow: hidden; }
button { font: inherit; color: inherit; cursor: pointer; }
input { font: inherit; color: var(--text); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.grow { flex: 1; min-width: 0; }

/* ======================= DÉCOR ======================= */
#bg { position: fixed; inset: 0; overflow: hidden; z-index: 0; transition: opacity 1s; }
body.in-game #bg { opacity: 0; }
.sky { position: absolute; inset: 0; background: radial-gradient(ellipse 120% 70% at 70% 10%, #1b3a2c 0%, #0c1d15 40%, #050b08 100%); }
.moon { position: absolute; top: 9%; right: 14%; width: 74px; height: 74px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fbfbe6, #d9dcc0 60%, #b8bd9c);
  box-shadow: 0 0 60px 20px rgba(230, 240, 200, .18), 0 0 140px 60px rgba(150, 200, 160, .08); animation: moon 8s ease-in-out infinite alternate; }
@keyframes moon { to { transform: translateY(6px); box-shadow: 0 0 70px 26px rgba(230,240,200,.22), 0 0 160px 70px rgba(150,200,160,.1); } }
.layer { position: absolute; left: -5%; width: 110%; bottom: 0; transform-origin: bottom center; }
.l3 { height: 52%; fill: #0f2419; opacity: .9; animation: sway 14s ease-in-out infinite alternate; }
.l2 { height: 44%; fill: #0a1a11; animation: sway 11s ease-in-out infinite alternate-reverse; }
.l1 { height: 34%; fill: #040a06; animation: sway 9s ease-in-out infinite alternate; }
@keyframes sway { from { transform: translateX(-1.2%) skewX(-.6deg); } to { transform: translateX(1.2%) skewX(.6deg); } }
.fog { position: absolute; left: -50%; width: 200%; pointer-events: none; }
.f1 { bottom: 18%; height: 30%; background: radial-gradient(ellipse 30% 50% at 30% 60%, rgba(170,210,180,.10), transparent 70%), radial-gradient(ellipse 25% 40% at 70% 50%, rgba(170,210,180,.08), transparent 70%); animation: drift 40s linear infinite; }
.f2 { bottom: -4%; height: 26%; background: radial-gradient(ellipse 35% 55% at 20% 70%, rgba(170,210,180,.13), transparent 70%), radial-gradient(ellipse 30% 50% at 65% 60%, rgba(170,210,180,.10), transparent 70%); animation: drift 28s linear infinite reverse; }
@keyframes drift { from { transform: translateX(0); } to { transform: translateX(25%); } }
#fireflies { position: absolute; inset: 0; width: 100%; height: 100%; }

/* ======================= ÉCRANS & TRANSITIONS ======================= */
.screen { position: fixed; inset: 0; z-index: 1; display: none; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; }
.screen.active { display: block; }
.screen.enter { animation: screenIn .55s var(--ease) both; }
.screen.leave { display: block; pointer-events: none; animation: screenOut .38s ease-in both; }
.screen.enter.back { animation-name: screenInBack; }
.screen.leave.back { animation-name: screenOutBack; }
@keyframes screenIn { from { opacity: 0; transform: translateX(40px) scale(.98); filter: blur(6px); } }
@keyframes screenOut { to { opacity: 0; transform: translateX(-40px) scale(.98); filter: blur(6px); } }
@keyframes screenInBack { from { opacity: 0; transform: translateX(-40px) scale(.98); filter: blur(6px); } }
@keyframes screenOutBack { to { opacity: 0; transform: translateX(40px) scale(.98); filter: blur(6px); } }
.screen.enter .reveal { animation: rise .6s var(--ease) both; animation-delay: calc(var(--i, 0) * 60ms + 120ms); }
@keyframes rise { from { opacity: 0; transform: translateY(18px); } }
#game.enter { animation: gameIn .9s ease both; }
@keyframes gameIn { from { opacity: 0; filter: brightness(3) blur(10px); } }

.page { position: relative; max-width: 480px; margin: 0 auto; padding: calc(22px + var(--safe-t)) 16px calc(40px + var(--safe-b)); display: flex; flex-direction: column; gap: 14px; }
.page.with-radio { padding-bottom: calc(210px + var(--safe-b)); }

/* ======================= SPLASH ======================= */
#splash { display: none; align-items: center; justify-content: center; }
#splash.active { display: flex; }
.splash-inner { text-align: center; }
.emblem { width: 130px; height: 130px; }
.emblem .ring { fill: none; stroke: var(--moss); stroke-width: 1.5; stroke-dasharray: 360; stroke-dashoffset: 360; animation: draw 1.6s var(--ease) forwards; opacity: .7; }
.emblem .trees { fill: var(--moss); opacity: 0; animation: fadeUp .9s .5s var(--ease) forwards; filter: drop-shadow(0 0 12px rgba(156,204,101,.5)); }
.emblem .m { fill: #f3f3dc; opacity: 0; animation: fadeUp .8s 1s ease forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.title { font-family: Cinzel, serif; font-weight: 800; font-size: 46px; letter-spacing: 10px; margin: 14px 0 4px; text-shadow: 0 0 30px rgba(156,204,101,.35); }
.title span { display: inline-block; opacity: 0; animation: letter .7s var(--ease) forwards; }
.title span:nth-child(1) { animation-delay: .9s; } .title span:nth-child(2) { animation-delay: .97s; } .title span:nth-child(3) { animation-delay: 1.04s; }
.title span:nth-child(4) { animation-delay: 1.11s; } .title span:nth-child(5) { animation-delay: 1.18s; } .title span:nth-child(6) { animation-delay: 1.25s; } .title span:nth-child(7) { animation-delay: 1.32s; }
@keyframes letter { from { opacity: 0; transform: translateY(20px) scale(.8); filter: blur(6px); } to { opacity: 1; transform: none; filter: none; } }
.subtitle { color: var(--muted); letter-spacing: 6px; text-transform: uppercase; font-size: 13px; opacity: 0; animation: fadeUp 1s 1.6s ease forwards; }

/* ======================= COMPOSANTS ======================= */
.brand { text-align: center; font-family: Cinzel, serif; font-weight: 800; font-size: 34px; letter-spacing: 8px; margin: 10px 0 4px; text-shadow: 0 0 24px rgba(156,204,101,.35); }
.page-head h2, .topbar h2, .end-hero h2 { font-family: Cinzel, serif; margin: 0; letter-spacing: 2px; }
.page-head { text-align: center; margin-top: 24px; }
.page-head p { margin: 6px 0 0; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 16px; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); box-shadow: 0 10px 40px rgba(0,0,0,.35); }
.label { margin: 0 0 8px; color: var(--muted); font-size: 13px; letter-spacing: 1.5px; text-transform: uppercase; }
.section { margin: 8px 0 -4px; font-size: 13px; letter-spacing: 2px; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.hint { margin: 0; color: var(--muted); font-size: 15px; text-align: center; }
.err { color: var(--blood); text-align: center; min-height: 1.2em; margin: 0; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field span { color: var(--muted); font-size: 13px; letter-spacing: 1.5px; text-transform: uppercase; }
.field input, .join-row input { background: rgba(0,0,0,.35); border: 1px solid var(--line2); border-radius: 14px; padding: 14px; width: 100%; outline: none; transition: border-color .2s, box-shadow .2s; }
.field input:focus, .join-row input:focus { border-color: var(--moss); box-shadow: 0 0 0 4px rgba(156,204,101,.15); }
.join-row { display: flex; gap: 10px; }
.join-row input { text-transform: uppercase; letter-spacing: 3px; text-align: center; font-family: "Share Tech Mono", monospace; font-size: 18px; min-width: 0; }

.btn { position: relative; overflow: hidden; border: 1px solid var(--line2); background: var(--panel); backdrop-filter: blur(10px); border-radius: 16px; padding: 14px 18px; font-weight: 700; font-size: 17px; letter-spacing: 1px; text-transform: uppercase;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; transition: transform .15s var(--ease), box-shadow .2s, background .2s, opacity .2s; }
.btn:active { transform: scale(.96); }
.btn.big { padding: 18px; font-size: 19px; }
.btn.small { padding: 8px 14px; font-size: 14px; border-radius: 12px; }
.btn.primary { background: linear-gradient(180deg, #a5d66b, #5f8f30); border-color: #b9e57f; color: #08130b; box-shadow: 0 8px 30px rgba(156,204,101,.3), inset 0 1px 0 rgba(255,255,255,.4); }
.btn.primary::after { content: ''; position: absolute; top: 0; left: -60%; width: 40%; height: 100%; background: linear-gradient(100deg, transparent, rgba(255,255,255,.35), transparent); animation: shine 3.5s ease-in-out infinite; }
@keyframes shine { 0%, 60% { left: -60%; } 100% { left: 140%; } }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); backdrop-filter: none; }
.btn.danger { background: linear-gradient(180deg, #ff5d68, #a3121e); border-color: #ff8a92; color: #fff; box-shadow: 0 8px 26px rgba(255,77,90,.35); }
.btn.purple { background: linear-gradient(180deg, #9a72f0, #4f2e9b); border-color: #c0a3ff; color: #fff; }
.btn.cyan { background: linear-gradient(180deg, #6ff5dc, #1f9c86); border-color: #a5fff0; color: #04211b; box-shadow: 0 8px 26px rgba(95,242,214,.3); }
.btn[disabled] { opacity: .4; pointer-events: none; }
.btn .ico { font-size: 22px; }
.badge { background: var(--blood); color: #fff; border-radius: 999px; padding: 0 8px; font-size: 13px; min-width: 22px; animation: pop .4s var(--ease); }
.pill { font-style: normal; font-size: 12px; color: var(--moss); letter-spacing: 1px; }
@keyframes pop { from { transform: scale(0); } }
.icon-btn { width: 44px; height: 44px; border-radius: 14px; border: 1px solid var(--line2); background: var(--panel); backdrop-filter: blur(10px); font-size: 18px; display: inline-flex; align-items: center; justify-content: center; transition: transform .15s; flex: none; }
.icon-btn:active { transform: scale(.9); }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.topbar h2 { font-size: 24px; }
.topbar > span { width: 44px; }

.toggle { display: flex; gap: 12px; align-items: center; color: var(--muted); font-size: 15px; cursor: pointer; }
.toggle input { display: none; }
.switch { position: relative; width: 46px; height: 26px; flex: none; border-radius: 13px; background: rgba(0,0,0,.4); border: 1px solid var(--line2); transition: background .25s; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--muted); transition: transform .25s var(--ease), background .25s; }
.toggle input:checked + .switch { background: rgba(156,204,101,.3); }
.toggle input:checked + .switch::after { transform: translateX(20px); background: var(--moss); }
.toggle small { display: block; font-size: 13px; opacity: .8; }

/* profil */
.profile { display: flex; align-items: center; gap: 14px; }
.avatar { width: 44px; height: 44px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 24px; background: radial-gradient(circle at 30% 30%, #2a4430, #0d1a12); border: 2px solid var(--line2); flex: none; position: relative; }
.avatar.xl { width: 64px; height: 64px; font-size: 36px; border-color: var(--moss-d); box-shadow: 0 0 24px rgba(156,204,101,.25); animation: breathe 4s ease-in-out infinite; }
@keyframes breathe { 50% { box-shadow: 0 0 34px rgba(156,204,101,.4); } }
.avatar .dot { position: absolute; right: -2px; bottom: -2px; width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--panel-solid); background: #555; }
.dot.online { background: var(--moss); } .dot.lobby { background: var(--ember); } .dot.game { background: var(--blood); }
.pname { font-size: 22px; font-weight: 700; }
.tag { border: 1px dashed var(--line2); background: rgba(0,0,0,.25); color: var(--lcd); border-radius: 10px; padding: 4px 10px; font-family: "Share Tech Mono", monospace; font-size: 14px; }
.tag.big { width: 100%; font-size: 22px; padding: 10px; letter-spacing: 2px; }
.avatars { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.avatars button { aspect-ratio: 1; border-radius: 14px; border: 1px solid var(--line); background: rgba(0,0,0,.3); font-size: 26px; transition: transform .2s var(--ease), border-color .2s, background .2s; }
.avatars button.sel { border-color: var(--moss); background: rgba(156,204,101,.18); transform: scale(1.08); box-shadow: 0 0 16px rgba(156,204,101,.35); }

/* listes */
.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.list li { display: flex; align-items: center; gap: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 10px 12px; backdrop-filter: blur(10px); animation: rise .45s var(--ease) both; }
.list li .who { flex: 1; min-width: 0; }
.list li .who b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list li .who small { color: var(--muted); }
.list li .acts { display: flex; gap: 6px; }
.st-online { color: var(--moss); } .st-lobby { color: var(--ember); } .st-game { color: var(--blood); } .st-offline { color: var(--muted); }

/* lobby */
.code-card { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 10px 16px; backdrop-filter: blur(10px); }
.code { font-family: "Share Tech Mono", monospace; font-size: 40px; letter-spacing: 10px; color: var(--lcd); text-shadow: 0 0 18px rgba(184,242,122,.45); }
.roles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.role-card { position: relative; overflow: hidden; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 16px 10px; border-radius: 20px; border: 2px solid var(--line); background: var(--panel); backdrop-filter: blur(10px); transition: transform .3s var(--ease), border-color .3s, box-shadow .3s; }
.role-card .r-ico { font-size: 40px; transition: transform .4s var(--ease); }
.role-card b { font-size: 19px; letter-spacing: 1px; text-transform: uppercase; }
.role-card small { color: var(--muted); font-size: 13px; line-height: 1.2; text-align: center; }
.role-card::before { content: ''; position: absolute; inset: 0; opacity: 0; transition: opacity .4s; }
.role-card.surv::before { background: radial-gradient(circle at 50% 0%, rgba(95,242,214,.28), transparent 70%); }
.role-card.mons::before { background: radial-gradient(circle at 50% 0%, rgba(255,77,90,.32), transparent 70%); }
.role-card.sel { transform: translateY(-3px); }
.role-card.sel::before { opacity: 1; }
.role-card.sel .r-ico { transform: scale(1.18) rotate(-6deg); }
.role-card.surv.sel { border-color: var(--cyan); box-shadow: 0 10px 30px rgba(95,242,214,.25); }
.role-card.mons.sel { border-color: var(--monster); box-shadow: 0 10px 30px rgba(255,77,90,.3); animation: growl 2.4s ease-in-out infinite; }
@keyframes growl { 50% { box-shadow: 0 10px 40px rgba(255,77,90,.5); } }
.rbadge { font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; letter-spacing: 1px; text-transform: uppercase; }
.rbadge.survivant { background: rgba(95,242,214,.15); color: var(--cyan); }
.rbadge.monstre { background: rgba(255,77,90,.18); color: #ff8a92; }
.ready-ok { color: var(--moss); font-size: 18px; }
.host-crown { color: var(--ember); font-size: 13px; margin-left: 4px; }
.map-card { position: relative; border-radius: 20px; overflow: hidden; border: 1px solid var(--line2); background: #050a07; box-shadow: 0 10px 40px rgba(0,0,0,.4); }
#lobby-map { height: 300px; }
.tools { display: flex; gap: 6px; padding: 8px; overflow-x: auto; background: rgba(8,14,10,.9); border-top: 1px solid var(--line); }
.tool { flex: none; border: 1px solid var(--line2); background: rgba(255,255,255,.04); border-radius: 12px; padding: 8px 12px; font-weight: 700; font-size: 14px; transition: background .2s, border-color .2s, transform .15s; }
.tool:active { transform: scale(.94); }
.tool.active { background: rgba(156,204,101,.2); border-color: var(--moss); color: #dff5c4; }
.map-card .hint { padding: 0 10px 10px; background: rgba(8,14,10,.9); font-size: 14px; }
.range { display: block; font-size: 15px; margin-bottom: 10px; }
.range output { color: var(--lcd); font-family: "Share Tech Mono", monospace; }
.range input { display: block; width: 100%; margin-top: 6px; accent-color: var(--moss); }

/* fin */
.end-hero { text-align: center; margin-top: 30px; }
.end-emoji { font-size: 84px; animation: trophy 1.2s var(--ease) both; filter: drop-shadow(0 0 30px rgba(255,200,100,.4)); }
@keyframes trophy { from { transform: scale(0) rotate(-30deg); } 60% { transform: scale(1.2) rotate(8deg); } }
.end-hero h2 { font-size: 44px; letter-spacing: 6px; margin-top: 6px; }
.end-hero h2.win { color: var(--lcd); text-shadow: 0 0 30px rgba(184,242,122,.5); }
.end-hero h2.lose { color: var(--blood); text-shadow: 0 0 30px rgba(255,77,90,.5); }
.stat-row { font-size: 13px; color: var(--muted); }

/* ======================= JEU ======================= */
#game { overflow: hidden; }
#map { position: absolute; inset: 0; background: #050a07; }
.leaflet-container { background: #050a07; font-family: Rajdhani, sans-serif; }
.leaflet-control-attribution { background: rgba(0,0,0,.5) !important; color: #667 !important; font-size: 9px; }
.leaflet-control-attribution a { color: #889 !important; }
.leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.55) contrast(1.05) saturate(.35) sepia(.4) hue-rotate(60deg); }
#vignette { position: absolute; inset: 0; pointer-events: none; z-index: 400; background: radial-gradient(ellipse at center, transparent 35%, rgba(0,4,2,.8) 100%); }
#danger-flash { position: absolute; inset: 0; pointer-events: none; z-index: 401; transition: box-shadow .3s; }
#game.hb2 #danger-flash { box-shadow: inset 0 0 70px 14px rgba(255,77,90,.35); }
#game.hb3 #danger-flash { animation: dflash .55s infinite; }
@keyframes dflash { 50% { box-shadow: inset 0 0 130px 34px rgba(255,77,90,.6); } }
#game.flair #vignette { background: radial-gradient(ellipse at center, rgba(255,40,60,.05) 30%, rgba(80,0,10,.75) 100%); }

#hud { position: absolute; top: 0; left: 0; right: 0; z-index: 500; padding: calc(10px + var(--safe-t)) 12px 0; pointer-events: none; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.hud-row { display: flex; gap: 8px; width: 100%; justify-content: space-between; }
.chip { pointer-events: auto; background: var(--panel); border: 1px solid var(--line2); border-radius: 999px; padding: 7px 14px; display: flex; gap: 8px; align-items: center; font-weight: 700; backdrop-filter: blur(10px); white-space: nowrap; }
#phase-timer { font-family: "Share Tech Mono", monospace; color: var(--lcd); }
.chip.role.survivant { color: var(--cyan); border-color: rgba(95,242,214,.5); }
.chip.role.monstre { color: #ff8a92; border-color: rgba(255,77,90,.6); }
.carry { background: rgba(10,40,34,.9); border: 1px solid var(--cyan); color: #c8fff4; border-radius: 12px; padding: 6px 14px; font-weight: 700; font-size: 15px; animation: carryGlow 1.6s ease-in-out infinite; }
@keyframes carryGlow { 50% { box-shadow: 0 0 20px rgba(95,242,214,.5); } }
.heart { display: none; align-items: center; gap: 8px; background: var(--panel); border: 1px solid rgba(255,77,90,.5); border-radius: 999px; padding: 4px 14px; color: var(--blood); font-weight: 700; }
.heart span { display: inline-block; font-size: 20px; }
#game.hb1 .heart, #game.hb2 .heart, #game.hb3 .heart { display: flex; }
#game.hb1 .heart span { animation: beat 1.2s infinite; } #game.hb2 .heart span { animation: beat .7s infinite; } #game.hb3 .heart span { animation: beat .38s infinite; }
@keyframes beat { 0%, 100% { transform: scale(1); } 15% { transform: scale(1.4); } 30% { transform: scale(1); } 45% { transform: scale(1.25); } }
.banner { text-align: center; background: var(--panel); border: 1px solid var(--line2); border-radius: 14px; padding: 6px 14px; font-weight: 700; display: none; max-width: 94%; backdrop-filter: blur(10px); }
.banner.show { display: block; animation: rise .35s var(--ease); }
.banner.red { border-color: var(--blood); color: #ffb3b8; } .banner.gold { border-color: var(--ember); color: #ffd7b0; } .banner.cyan { border-color: var(--cyan); color: #c8fff4; }

.fab { position: absolute; right: 12px; z-index: 500; width: 48px; height: 48px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line2); font-size: 20px; backdrop-filter: blur(10px); }
#btn-center { bottom: calc(238px + var(--safe-b)); }
#btn-roster { bottom: calc(294px + var(--safe-b)); }
#actions { position: absolute; left: 12px; right: 72px; bottom: calc(232px + var(--safe-b)); z-index: 500; display: flex; flex-wrap: wrap-reverse; gap: 8px; }
#actions .btn { padding: 12px 16px; font-size: 16px; border-radius: 14px; animation: rise .3s var(--ease); }

.progress { position: absolute; left: 50%; top: 42%; transform: translate(-50%,-50%); z-index: 700; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.ring { position: relative; width: 150px; height: 150px; filter: drop-shadow(0 0 20px rgba(95,242,214,.35)); }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: rgba(6,14,10,.88); stroke: rgba(255,255,255,.08); stroke-width: 7; }
.ring #ring-fg { fill: none; stroke: var(--cyan); stroke-linecap: round; stroke-dasharray: 276.5; stroke-dashoffset: 276.5; }
.ring span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; font-weight: 700; padding: 22px; }

.sheet { position: absolute; left: 0; right: 0; bottom: 0; z-index: 800; background: rgba(8,16,11,.95); border-top: 1px solid var(--line2); border-radius: 22px 22px 0 0; max-height: 70%; overflow-y: auto; transform: translateY(105%); transition: transform .4s var(--ease); padding: 8px 16px calc(20px + var(--safe-b)); backdrop-filter: blur(14px); }
.sheet.open { transform: none; }
.grab { width: 44px; height: 5px; background: var(--line2); border-radius: 3px; margin: 4px auto 12px; cursor: pointer; }

/* marqueurs */
.mk { position: relative; display: flex; align-items: center; justify-content: center; border-radius: 50%; line-height: 1; }
.mk-label { position: absolute; top: 100%; left: 50%; transform: translateX(-50%); font-size: 11px; font-weight: 700; white-space: nowrap; text-shadow: 0 1px 3px #000, 0 0 6px #000; margin-top: 3px; color: #dfe9d6; }
.mk-me { background: var(--cyan); border: 3px solid #fff; box-shadow: 0 0 0 7px rgba(95,242,214,.2), 0 0 18px rgba(95,242,214,.9); }
.mk-me.monstre { background: var(--monster); box-shadow: 0 0 0 7px rgba(255,77,90,.2), 0 0 18px rgba(255,77,90,.9); }
.mk-me::after { content: ''; position: absolute; inset: -12px; border-radius: 50%; border: 2px solid currentColor; color: rgba(95,242,214,.5); animation: ping 2s ease-out infinite; }
.mk-me.monstre::after { color: rgba(255,77,90,.5); }
@keyframes ping { from { transform: scale(.4); opacity: 1; } to { transform: scale(1.6); opacity: 0; } }
.mk-pl { font-size: 18px; background: rgba(6,16,12,.92); border: 2px solid var(--cyan); box-shadow: 0 0 12px rgba(95,242,214,.4); }
.mk-pl.monstre { border-color: var(--monster); box-shadow: 0 0 18px rgba(255,77,90,.8); animation: throb 1.2s infinite; }
.mk-pl.down { border-color: var(--blood); animation: throb .7s infinite; filter: saturate(.4); }
.mk-pl.out { opacity: .35; filter: grayscale(1); }
.mk-pl .carry-b { position: absolute; top: -8px; right: -10px; font-size: 13px; background: #062a24; border: 1px solid var(--cyan); border-radius: 8px; padding: 1px 2px; }
@keyframes throb { 50% { transform: scale(1.14); } }
.mk-beacon { font-size: 20px; background: radial-gradient(circle, rgba(95,242,214,.45), rgba(4,20,16,.9) 70%); border: 2px solid var(--cyan); box-shadow: 0 0 22px rgba(95,242,214,.7); animation: float 2.4s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-4px); box-shadow: 0 0 32px rgba(95,242,214,.9); } }
.mk-site { font-size: 22px; background: radial-gradient(circle, rgba(255,160,77,.35), rgba(30,14,4,.92) 70%); border: 2px dashed var(--ember); box-shadow: 0 0 18px rgba(255,160,77,.5); }
.mk-site::after { content: ''; position: absolute; inset: -10px; border-radius: 50%; border: 2px solid rgba(255,160,77,.5); animation: ping 2.4s ease-out infinite; }
.mk-site.on { border: 2px solid var(--lcd); background: radial-gradient(circle, rgba(184,242,122,.6), rgba(10,30,6,.92) 70%); box-shadow: 0 0 30px rgba(184,242,122,.9); }
.mk-site.on::after { border-color: rgba(184,242,122,.6); }
/* Point de sortie : fermé (gris), armé (compte à rebours), ouvert (blanc lumineux) */
.mk-exit { font-size: 22px; background: radial-gradient(circle, rgba(200,210,220,.25), rgba(8,12,14,.92) 70%); border: 2px solid rgba(200,210,220,.6); box-shadow: 0 0 14px rgba(200,210,220,.35); }
.mk-exit.armed { border-color: var(--ember); box-shadow: 0 0 24px rgba(255,160,77,.7); animation: float 1.6s ease-in-out infinite; }
.mk-exit.open { border: 3px solid #fff; background: radial-gradient(circle, rgba(255,255,255,.75), rgba(20,40,30,.9) 70%); box-shadow: 0 0 36px rgba(255,255,255,.95); }
.mk-exit.open::after { content: ''; position: absolute; inset: -12px; border-radius: 50%; border: 2px solid rgba(255,255,255,.7); animation: ping 1.4s ease-out infinite; }
.mk-exit .mk-label { color: #fff; }
#game.live #obj-chip { border-color: var(--ember); }

/* ======================= TALKIE-WALKIE ======================= */
.radio { position: fixed; left: 12px; right: 12px; bottom: calc(12px + var(--safe-b)); z-index: 900; max-width: 480px; margin: 0 auto; transition: transform .5s var(--ease), opacity .4s; }
.radio.hidden { display: block !important; transform: translateY(130%); opacity: 0; pointer-events: none; }
.antenna { position: absolute; right: 40px; top: -40px; width: 12px; height: 48px; border-radius: 6px 6px 2px 2px; background: linear-gradient(90deg, #161a17, #3a443c, #161a17); }
.antenna::after { content: ''; position: absolute; left: 3px; top: 4px; width: 6px; height: 6px; border-radius: 50%; background: #333; transition: background .2s, box-shadow .2s; }
.radio.tx .antenna::after { background: var(--blood); box-shadow: 0 0 12px var(--blood); }
.radio.rx .antenna::after { background: var(--lcd); box-shadow: 0 0 12px var(--lcd); }
.radio-body { position: relative; display: grid; grid-template-columns: 1fr auto; gap: 10px; padding: 12px; border-radius: 24px;
  background: linear-gradient(160deg, #2d362f 0%, #171d19 55%, #0e120f 100%); border: 1px solid #3a463d;
  box-shadow: 0 16px 50px rgba(0,0,0,.75), inset 0 1px 0 rgba(255,255,255,.1), inset 0 -3px 0 rgba(0,0,0,.4); }
.radio-body::before { content: ''; position: absolute; inset: 6px; border-radius: 19px; border: 1px dashed rgba(255,255,255,.05); pointer-events: none; }
.lcd { position: relative; overflow: hidden; background: var(--lcd-bg); border-radius: 12px; padding: 8px 12px; font-family: "Share Tech Mono", monospace; color: var(--lcd); text-shadow: 0 0 6px rgba(184,242,122,.6); box-shadow: inset 0 2px 10px rgba(0,0,0,.75); border: 1px solid #08120a; min-height: 86px; }
.lcd::after { content: ''; position: absolute; inset: 0; background: repeating-linear-gradient(0deg, rgba(0,0,0,.2) 0 1px, transparent 1px 3px); pointer-events: none; }
.lcd-top { display: flex; justify-content: space-between; font-size: 13px; opacity: .85; }
.lcd-main { font-size: 22px; letter-spacing: 2px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lcd-sub { font-size: 12px; opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.eq { position: absolute; right: 10px; bottom: 8px; display: flex; gap: 2px; align-items: flex-end; height: 18px; opacity: 0; transition: opacity .2s; }
.eq i { width: 3px; background: currentColor; height: 4px; }
.radio.tx .eq, .radio.rx .eq { opacity: .9; }
.radio.tx .eq i, .radio.rx .eq i { animation: eq .5s ease-in-out infinite alternate; }
.eq i:nth-child(3n) { animation-delay: -.2s !important; } .eq i:nth-child(3n+1) { animation-delay: -.35s !important; } .eq i:nth-child(4n) { animation-duration: .35s !important; }
@keyframes eq { from { height: 3px; } to { height: 18px; } }
.sig { display: inline-flex; gap: 2px; align-items: flex-end; }
.sig i { width: 4px; background: currentColor; opacity: .25; }
.sig i:nth-child(1) { height: 4px; } .sig i:nth-child(2) { height: 7px; } .sig i:nth-child(3) { height: 10px; } .sig i:nth-child(4) { height: 13px; }
.sig.s1 i:nth-child(-n+1), .sig.s2 i:nth-child(-n+2), .sig.s3 i:nth-child(-n+3), .sig.s4 i:nth-child(-n+4) { opacity: 1; }
.radio.jam .lcd { animation: jam .15s steps(2) infinite; }
@keyframes jam { 50% { filter: contrast(1.6) brightness(1.3); transform: translateX(1px); } }
.radio.monstres .lcd { color: #ff9aa1; background: #2a0d10; text-shadow: 0 0 6px rgba(255,120,130,.6); }
.radio.esprits .lcd { color: #9fd9ff; background: #0f1d28; text-shadow: 0 0 6px rgba(159,217,255,.6); }
.radio.survivants .lcd { color: #8ff5e0; background: #0a2420; text-shadow: 0 0 6px rgba(95,242,214,.6); }
.radio-side { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 66px; }
.led { width: 14px; height: 14px; border-radius: 50%; background: #2a2f2b; box-shadow: inset 0 1px 2px rgba(0,0,0,.8); transition: background .15s, box-shadow .15s; }
.radio.tx .led { background: var(--blood); box-shadow: 0 0 12px var(--blood); }
.radio.rx .led { background: var(--lcd); box-shadow: 0 0 12px var(--lcd); }
.grille { width: 60px; flex: 1; min-height: 52px; border-radius: 12px; background: radial-gradient(circle, #070907 1.6px, transparent 2px) 0 0 / 8px 8px, #1d231f; box-shadow: inset 0 2px 5px rgba(0,0,0,.6); }
.radio.rx .grille { animation: speaker .12s infinite alternate; }
@keyframes speaker { to { transform: scale(1.03); } }
.ptt { grid-column: 1 / -1; height: 64px; border-radius: 18px; border: none; user-select: none; -webkit-user-select: none; touch-action: none;
  background: linear-gradient(180deg, #4d5650 0%, #2a312c 100%); box-shadow: 0 5px 0 #0b0e0c, inset 0 1px 0 rgba(255,255,255,.15); color: #d5ded1; font-weight: 700; letter-spacing: 2px; font-size: 15px; transition: transform .06s, box-shadow .06s, background .2s; }
.ptt span { pointer-events: none; }
.radio.tx .ptt { transform: translateY(4px); box-shadow: 0 1px 0 #0b0e0c, inset 0 2px 10px rgba(0,0,0,.6); background: linear-gradient(180deg, #a12a33, #5e1218); color: #fff; }

/* ======================= MODALE & TOASTS ======================= */
.modal { position: fixed; inset: 0; z-index: 2000; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(0,0,0,.55); backdrop-filter: blur(6px); animation: fade .3s ease; }
@keyframes fade { from { opacity: 0; } }
.modal-card { width: 100%; max-width: 380px; background: linear-gradient(180deg, #13241a, #0a140e); border: 1px solid var(--line2); border-radius: 24px; padding: 22px; text-align: center; box-shadow: 0 30px 80px rgba(0,0,0,.6); animation: modalIn .45s var(--ease); }
@keyframes modalIn { from { opacity: 0; transform: translateY(30px) scale(.94); } }
.modal-card h3 { font-family: Cinzel, serif; margin: 6px 0; font-size: 22px; }
.modal-card p { color: #c5d2c0; line-height: 1.4; }
.modal-card .row { display: flex; gap: 10px; margin-top: 14px; }
.modal-card .row .btn { flex: 1; }
.modal-card .avatar { width: 80px; height: 80px; font-size: 44px; margin: 0 auto; }
.rules-list { text-align: left; padding-left: 4px; list-style: none; }
.rules-list li { margin-bottom: 10px; color: #c5d2c0; line-height: 1.35; font-size: 15px; }
#toasts { position: fixed; top: calc(12px + var(--safe-t)); left: 12px; right: 12px; z-index: 2100; display: flex; flex-direction: column; gap: 6px; pointer-events: none; align-items: center; }
body.in-game #toasts { top: calc(118px + var(--safe-t)); }
.toast { background: rgba(10,20,14,.94); border: 1px solid var(--line2); border-left: 4px solid var(--moss); padding: 10px 14px; border-radius: 12px; font-weight: 600; font-size: 15px; max-width: 100%; box-shadow: 0 8px 24px rgba(0,0,0,.5); animation: toastIn .45s var(--ease); backdrop-filter: blur(10px); }
.toast.out { animation: toastOut .35s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-14px) scale(.95); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-10px) scale(.95); } }
.toast.danger, .toast.err { border-left-color: var(--blood); }
.toast.good { border-left-color: var(--lcd); }
.toast.phase { border-left-color: var(--ember); font-size: 16px; }
.toast.pulse { border-left-color: var(--monster); }
.toast.friend, .toast.join { border-left-color: var(--cyan); }

@media (min-height: 780px) { #lobby-map { height: 340px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; } }

/* ======================= iOS : fluidité & ergonomie ======================= */
html { -webkit-text-size-adjust: 100%; }
body { font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", Rajdhani, system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
.btn, .tool, .chip, .tag, .section, .label, .lcd, .ptt, .rbadge, .code, #phase-timer { font-family: Rajdhani, -apple-system, system-ui, sans-serif; }
button, a, .btn, .tool, .role-card, .avatars button { touch-action: manipulation; -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.btn, .icon-btn, .tool, .fab { min-height: 44px; } /* zone tactile minimale Apple : 44 pt */
.btn.small { min-height: 36px; }
input, select, textarea { font-size: 17px !important; } /* ≥ 16 px : pas de zoom auto sur iOS */
.screen { overscroll-behavior: contain; scroll-behavior: smooth; }
:root { --ios: cubic-bezier(.32, .72, 0, 1); }
.screen.enter { animation-duration: .5s; animation-timing-function: var(--ios); }
.small { font-size: 14px; }

/* logo */
.brand { display: flex; align-items: center; justify-content: center; gap: 10px; }
.brand-logo { width: 38px; height: 44px; filter: drop-shadow(0 0 12px rgba(156,204,101,.4)); }
.emblem { position: relative; width: 150px; height: 170px; margin: 0 auto; }
.emblem img { position: relative; width: 100%; height: 100%; animation: treeGrow 1.3s var(--ios) both; transform-origin: 50% 100%; filter: drop-shadow(0 0 24px rgba(156,204,101,.45)); }
.emblem .halo { position: absolute; inset: 10% -20% -10%; border-radius: 50%; background: radial-gradient(circle, rgba(156,204,101,.28), transparent 65%); animation: fadeUp 1.4s .4s ease both; }
@keyframes treeGrow { from { opacity: 0; transform: scaleY(.2) scaleX(.6); filter: blur(8px); } }

/* connexion */
.auth-page { min-height: 100%; justify-content: center; gap: 12px; }
.auth-hero { text-align: center; margin-bottom: 10px; }
.auth-logo { width: 96px; height: 112px; filter: drop-shadow(0 0 22px rgba(156,204,101,.45)); animation: sway 6s ease-in-out infinite alternate; transform-origin: 50% 100%; }
.auth-hero p { margin: 4px 0 0; }
.social { width: 100%; text-transform: none; letter-spacing: 0; font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif; font-weight: 600; font-size: 18px; border-radius: 14px; min-height: 52px; }
.social svg { width: 20px; height: 20px; }
.social.apple { background: #fff; color: #000; border-color: #fff; }
.social.google { background: #131314; color: #e3e3e3; border-color: #8e918f; }
.gsi { display: flex; justify-content: center; min-height: 44px; }
.or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; letter-spacing: 1px; text-transform: uppercase; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--line2); }
.seg { display: grid; grid-template-columns: 1fr 1fr; background: rgba(0,0,0,.35); border-radius: 11px; padding: 3px; margin-bottom: 14px; }
.seg button { border: 0; background: transparent; border-radius: 9px; padding: 9px; font-weight: 600; color: var(--muted); transition: background .25s var(--ios), color .25s; min-height: 36px; }
.seg button.on { background: rgba(255,255,255,.12); color: var(--text); box-shadow: 0 2px 8px rgba(0,0,0,.3); }
.legal { text-align: center; color: var(--muted); font-size: 13px; line-height: 1.4; }
.legal a { color: var(--moss); }
.name-status { margin: -6px 0 12px; min-height: 1.2em; font-size: 14px; font-weight: 600; color: var(--muted); }
.name-status.ok { color: var(--moss); } .name-status.ko { color: var(--blood); }

/* modales → feuilles iOS en bas d'écran sur mobile */
@media (max-width: 600px) {
  .modal { align-items: flex-end; padding: 0; }
  .modal-card { max-width: none; border-radius: 26px 26px 0 0; padding-bottom: calc(22px + var(--safe-b)); animation: sheetUp .45s var(--ios); max-height: 90%; overflow-y: auto; }
}
@keyframes sheetUp { from { transform: translateY(100%); } }
.grabber { width: 38px; height: 5px; border-radius: 3px; background: rgba(255,255,255,.25); margin: -8px auto 10px; }
.list-ios { margin-top: 16px; border-radius: 14px; overflow: hidden; background: rgba(255,255,255,.05); border: 1px solid var(--line); text-align: left; }
.list-ios > a, .list-ios > button { display: flex; justify-content: space-between; align-items: center; width: 100%; padding: 14px 16px; min-height: 48px; background: none; border: 0; border-bottom: 1px solid var(--line); color: var(--text); text-decoration: none; font-size: 16px; font-weight: 500; }
.list-ios > :last-child { border-bottom: 0; }
.list-ios span { color: var(--muted); }
.list-ios .destructive { color: #ff6b74; justify-content: center; font-weight: 600; }

/* bouton « Je suis mort » */
.btn.dead { background: linear-gradient(180deg, #2b2b2b, #0e0e0e); border-color: #6b6b6b; color: #f1f1f1; }
.chip.role.infected { color: #b6ff6a; border-color: rgba(182,255,106,.6); text-shadow: 0 0 8px rgba(182,255,106,.6); }

/* ======================= TRANSFORMATION EN INFECTÉ ======================= */
.infect { position: fixed; inset: 0; z-index: 3000; display: flex; align-items: center; justify-content: center; text-align: center; background: #000; overflow: hidden; pointer-events: none; }
.infect.go { animation: infBg 5.2s ease forwards; }
.inf-blood { position: absolute; inset: 0; background: radial-gradient(circle at 50% 40%, rgba(160,0,10,.9), rgba(30,0,0,.95) 60%, #000); opacity: 0; }
.infect.go .inf-blood { animation: infBlood 5.2s ease forwards; }
.inf-1, .inf-2 { position: absolute; padding: 20px; }
.inf-1 h2, .inf-2 h2 { font-family: Cinzel, serif; font-size: 44px; letter-spacing: 6px; margin: 10px 0; }
.inf-1 h2 { color: #ff3b46; text-shadow: 0 0 30px rgba(255,0,20,.8); }
.inf-2 h2 { color: #b6ff6a; text-shadow: 0 0 30px rgba(150,255,60,.8); line-height: 1.1; }
.inf-2 p { color: #d6ffc0; font-size: 17px; }
.skull, .zombie { font-size: 90px; display: inline-block; }
.inf-1 { opacity: 0; } .inf-2 { opacity: 0; }
.infect.go .inf-1 { animation: inf1 5.2s ease forwards; }
.infect.go .inf-2 { animation: inf2 5.2s ease forwards; }
.infect.go .skull { animation: shake .12s 6 .3s; }
.infect.go .zombie { animation: rise2 1s 2.4s var(--ios) both; }
@keyframes infBg { 0% { opacity: 0; } 5% { opacity: 1; } 88% { opacity: 1; } 100% { opacity: 0; } }
@keyframes infBlood { 0% { opacity: 0; } 10% { opacity: 1; } 42% { opacity: 1; filter: hue-rotate(0); } 52% { opacity: 1; filter: hue-rotate(100deg) saturate(1.4); } 100% { opacity: 1; filter: hue-rotate(100deg) saturate(1.4); } }
@keyframes inf1 { 0% { opacity: 0; transform: scale(1.6); filter: blur(12px); } 10% { opacity: 1; transform: none; filter: none; } 38% { opacity: 1; } 46% { opacity: 0; transform: scale(.85); filter: blur(6px); } 100% { opacity: 0; } }
@keyframes inf2 { 0%, 44% { opacity: 0; transform: translateY(30px); filter: blur(10px); } 54% { opacity: 1; transform: none; filter: none; } 90% { opacity: 1; } 100% { opacity: 0; } }
@keyframes shake { 25% { transform: translate(-6px, 3px) rotate(-6deg); } 75% { transform: translate(6px, -3px) rotate(6deg); } }
@keyframes rise2 { from { transform: translateY(60px) scale(.6); opacity: 0; } }

/* ======================= PING (vue des monstres) ======================= */
.mk-ghost { font-size: 20px; background: rgba(40, 6, 10, .75); border: 2px dashed rgba(255, 77, 90, .85); opacity: .9; filter: saturate(.7); }
.mk-ghost.fresh { animation: pingIn .9s var(--ios) both; }
.mk-ghost.fresh::after { content: ''; position: absolute; inset: -14px; border-radius: 50%; border: 2px solid rgba(255, 77, 90, .7); animation: ping 1.2s ease-out infinite; }
.mk-ghost.old { opacity: .55; filter: grayscale(.6); }
@keyframes pingIn { from { transform: scale(1.8); opacity: 0; } }
.mk-ghost .carry-b { position: absolute; top: -8px; right: -10px; font-size: 13px; background: #062a24; border: 1px solid var(--cyan); border-radius: 8px; padding: 1px 2px; }
.ping-tag { background: rgba(20, 4, 6, .88); border: 1px solid rgba(255, 77, 90, .55); border-radius: 8px; padding: 2px 7px; margin-top: 6px; font-size: 12px; color: #ffd4d7; text-shadow: none; }
.ping-tag b { color: #fff; }
.ping-tag i { font-style: normal; font-family: "Share Tech Mono", monospace; color: #ff9aa1; font-variant-numeric: tabular-nums; }
.toast.ping { border-left-color: var(--monster); }
.radio.muted .ptt { opacity: .45; background: linear-gradient(180deg, #2b2f2c, #1a1d1b); }
.radio.muted .lcd-sub { white-space: normal; line-height: 1.25; }
.sig.s0 i { opacity: .25; }

/* Version web PHP (BryOne) : talkie-walkie masqué jusqu'à la prochaine version (envoi des messages vocaux à refaire). */
#radio { display: none !important; }
