:root {
  --night: #060a17;
  --navy: #0c1733;
  --velvet: #142250;
  --line: #2a3868;
  --gold: #c9a24a;
  --gold-2: #ebd08a;
  --ivory: #f3ebd8;
  --muted: #8a93b8;
  --danger: #e05a5a;
  --ok: #6fbf8e;
  --glass: rgba(9, 15, 34, 0.78);
  --glass-strong: rgba(9, 15, 34, 0.94);
  --display: 'Marcellus', 'Cormorant Garamond', Georgia, serif;
  --ui: 'Figtree', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 22px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
/* Barres de défilement aux couleurs du lounge : Firefox (scrollbar-*), Chrome / Edge / Opera / Safari (::-webkit-scrollbar) */
* { scrollbar-width: thin; scrollbar-color: rgba(201,162,74,.45) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: rgba(201,162,74,.45); border-radius: 999px; border: 2px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-thumb:hover { background: rgba(235,208,138,.7); background-clip: padding-box; }
*::-webkit-scrollbar-corner { background: transparent; }
html, body { margin: 0; height: 100%; background: var(--night); color: var(--ivory); font-family: var(--ui); font-size: 15px; overflow: hidden; overscroll-behavior: none; }
body { -webkit-font-smoothing: antialiased; touch-action: none; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
a { color: var(--gold-2); }
::selection { background: var(--gold); color: var(--night); }
:focus-visible { outline: 2px solid var(--gold-2); outline-offset: 2px; }
input, textarea, select, .scroll { touch-action: auto; }

/* ───── Boot ───── */
#boot { position: fixed; inset: 0; display: grid; place-content: center; justify-items: center; gap: 22px; background: radial-gradient(circle at 50% 40%, #101c40, var(--night) 70%); z-index: 100; transition: opacity .6s; }
#boot.out { opacity: 0; pointer-events: none; }
.boot-mark { width: 74px; height: 74px; border: 1px solid var(--gold); border-radius: 50%; display: grid; place-items: center; font-family: var(--display); font-size: 38px; color: var(--gold-2); box-shadow: 0 0 40px rgba(201,162,74,.25), inset 0 0 20px rgba(201,162,74,.15); }
.boot-bar { width: 180px; height: 2px; background: var(--line); overflow: hidden; border-radius: 2px; }
.boot-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--gold), var(--gold-2)); transition: width .3s; }
.boot-text { color: var(--muted); margin: 0; font-size: 13px; }

.screen { position: fixed; inset: 0; }
canvas { display: block; }
#entrance-canvas, #game-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }

/* ───── Boutons & champs ───── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 20px; border-radius: 999px; border: 1px solid var(--line); background: rgba(20, 34, 80, .6); cursor: pointer; font-weight: 600; letter-spacing: .01em; transition: background .15s, border-color .15s, transform .1s, box-shadow .2s; white-space: nowrap; }
.btn:hover { border-color: var(--gold); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; pointer-events: none; }
.btn.gold { background: linear-gradient(180deg, var(--gold-2), var(--gold)); color: var(--night); border-color: transparent; box-shadow: 0 6px 24px rgba(201,162,74,.28); }
.btn.gold:hover { box-shadow: 0 8px 32px rgba(201,162,74,.45); }
.btn.ghost { background: transparent; }
.btn.danger { border-color: rgba(224,90,90,.5); color: #f2b0b0; background: rgba(224,90,90,.08); }
.btn.small { min-height: 34px; padding: 0 14px; font-size: 13px; }
.btn.block { width: 100%; }
.btn.big { min-height: 54px; font-size: 17px; padding: 0 30px; }
.btn svg { width: 18px; height: 18px; }
.link-btn { background: none; border: 0; color: var(--gold-2); cursor: pointer; padding: 4px; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(235,208,138,.4); }
.icon-btn { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; border: 1px solid transparent; background: transparent; cursor: pointer; color: var(--ivory); }
.icon-btn:hover { border-color: var(--line); }
.icon-btn svg { width: 20px; height: 20px; }

label.field { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.input, input[type=text], input[type=email], input[type=password], input[type=url], textarea, select {
  width: 100%; min-height: 44px; padding: 10px 14px; border-radius: var(--r-sm); border: 1px solid var(--line); background: rgba(6, 10, 23, .7); color: var(--ivory); outline: none; transition: border-color .15s, box-shadow .15s; font-size: 16px;
}
input:focus, textarea:focus, select:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201,162,74,.15); }
textarea { resize: vertical; min-height: 110px; line-height: 1.5; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--gold) 50%), linear-gradient(135deg, var(--gold) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 36px; }
input[type=range] { width: 100%; accent-color: var(--gold); touch-action: auto; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }
.stack { display: grid; gap: 14px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.err { color: #f2a0a0; font-size: 13px; min-height: 18px; }
.ok-text { color: var(--ok); }
.gold-text { color: var(--gold-2); }
.divider { height: 1px; background: var(--line); margin: 6px 0; }
.kbd { display: inline-block; min-width: 22px; padding: 1px 6px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; font-size: 12px; text-align: center; color: var(--gold-2); }

.glass { background: var(--glass); backdrop-filter: blur(14px) saturate(1.2); -webkit-backdrop-filter: blur(14px) saturate(1.2); border: 1px solid rgba(201,162,74,.28); }
.tabs { display: flex; gap: 4px; padding: 4px; background: rgba(6,10,23,.6); border-radius: 999px; border: 1px solid var(--line); }
.tabs button { flex: 1; min-height: 36px; border: 0; background: transparent; border-radius: 999px; cursor: pointer; color: var(--muted); font-weight: 600; font-size: 14px; padding: 0 10px; white-space: nowrap; }
.tabs button.on { background: var(--velvet); color: var(--gold-2); box-shadow: inset 0 0 0 1px rgba(201,162,74,.35); }
.tabs.scrollable { overflow-x: auto; scrollbar-width: none; }
.tabs.scrollable::-webkit-scrollbar { display: none; }
.tabs.scrollable button { flex: 0 0 auto; }

/* ───── Entrée ───── */
.entrance-ui { position: absolute; inset: 0; display: flex; align-items: center; justify-content: flex-end; padding: calc(24px + var(--safe-t)) calc(5vw + var(--safe-r)) calc(24px + var(--safe-b)) 24px; pointer-events: none; }
#auth-panel { pointer-events: auto; width: min(400px, 100%); border-radius: var(--r-lg); padding: 26px; max-height: 100%; overflow-y: auto; transition: opacity .4s, transform .4s; }
#auth-panel.hide { opacity: 0; transform: translateX(30px); pointer-events: none; }
#auth-panel h1 { font-family: var(--display); font-weight: 400; font-size: 28px; margin: 0; color: var(--gold-2); line-height: 1.15; }
#auth-panel .sub { margin: 6px 0 18px; color: var(--muted); font-size: 14px; }
.welcome-card { display: flex; gap: 14px; align-items: center; padding: 12px; border-radius: var(--r-md); background: rgba(20,34,80,.45); border: 1px solid var(--line); margin-bottom: 16px; }
.welcome-card img { width: 64px; height: 64px; border-radius: 50%; background: var(--navy); border: 1px solid var(--gold); object-fit: cover; }
.welcome-card .name { font-family: var(--display); font-size: 22px; color: var(--ivory); }
.lvl-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--gold-2); border: 1px solid rgba(201,162,74,.4); border-radius: 999px; padding: 2px 10px; background: rgba(201,162,74,.08); white-space: nowrap; }
.entrance-foot { position: absolute; left: calc(20px + var(--safe-l)); right: calc(20px + var(--safe-r)); bottom: calc(16px + var(--safe-b)); display: flex; gap: 8px 16px; flex-wrap: wrap; align-items: center; color: var(--muted); font-size: 13px; }
#online-count { white-space: nowrap; }
#online-count::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); margin-right: 7px; box-shadow: 0 0 8px var(--ok); }
#door-flash { position: absolute; inset: 0; background: radial-gradient(circle, #fff6dc, #ebd08a 40%, #c9a24a); opacity: 0; pointer-events: none; transition: opacity .7s ease-in; }
#door-flash.on { opacity: 1; }
.guest-note { font-size: 12px; color: var(--muted); line-height: 1.5; margin-top: 12px; }

@media (max-width: 760px) {
  .entrance-ui { align-items: flex-end; justify-content: center; padding: 16px 12px calc(56px + var(--safe-b)); }
  #auth-panel { padding: 20px; max-height: 62vh; }
  #auth-panel h1 { font-size: 23px; }
}
/* téléphone en portrait : le pied de page tient sur une ligne sans le badge, sinon il se repliait sur le panneau */
@media (max-width: 480px) {
  .entrance-foot .aso-badge { display: none; }
  .entrance-foot { justify-content: space-between; }
}

/* ───── Modales ───── */
.modal-wrap { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: calc(12px + var(--safe-t)) 12px calc(12px + var(--safe-b)); background: rgba(3,5,12,.55); opacity: 0; transition: opacity .2s; }
.modal-wrap.in { opacity: 1; }
.modal { width: min(460px, 100%); max-height: 100%; display: flex; flex-direction: column; background: var(--glass-strong); border: 1px solid rgba(201,162,74,.35); border-radius: var(--r-lg); box-shadow: 0 30px 80px rgba(0,0,0,.6); transform: translateY(10px) scale(.98); transition: transform .22s; overflow: hidden; }
.modal-wrap.in .modal { transform: none; }
.modal.wide { width: min(900px, 96vw); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 16px 12px 22px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-family: var(--display); font-weight: 400; font-size: 22px; color: var(--gold-2); }
.modal-body { padding: 18px 22px 22px; overflow-y: auto; touch-action: pan-y; }
.modal p { line-height: 1.55; }

.astagh { text-align: center; padding: 10px 0; }
.astagh .big { font-family: var(--display); font-size: 40px; color: var(--gold-2); margin: 6px 0 10px; animation: pulseGold 1.8s ease-in-out infinite; }
@keyframes pulseGold { 50% { text-shadow: 0 0 24px rgba(235,208,138,.6); } }

/* ───── Toasts ───── */
#toasts { position: fixed; top: calc(70px + var(--safe-t)); left: 50%; transform: translateX(-50%); z-index: 80; display: grid; gap: 8px; justify-items: center; pointer-events: none; width: min(92vw, 460px); }
.toast { padding: 10px 18px; border-radius: 999px; background: var(--glass-strong); border: 1px solid var(--line); font-size: 14px; opacity: 0; transform: translateY(-8px); transition: opacity .3s, transform .3s; text-align: center; box-shadow: 0 10px 30px rgba(0,0,0,.4); }
.toast.in { opacity: 1; transform: none; }
.toast-ok { border-color: rgba(111,191,142,.6); }
.toast-warn { border-color: rgba(224,160,64,.7); }
.toast-err { border-color: rgba(224,90,90,.7); }
.toast-gold { border-color: var(--gold); color: var(--gold-2); }

/* ───── Personnalisation ───── */
#customizer { z-index: 40; display: grid; grid-template-columns: minmax(0, 1fr) 440px; background: radial-gradient(ellipse at 30% 50%, #15245a 0%, var(--night) 70%); }
.cz-stage { position: relative; min-height: 0; min-width: 0; }
.cz-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; cursor: grab; touch-action: none; }
.cz-stage .cz-title { position: absolute; top: calc(22px + var(--safe-t)); left: calc(26px + var(--safe-l)); pointer-events: none; }
.cz-title h1 { font-family: var(--display); font-weight: 400; margin: 0; font-size: 30px; color: var(--gold-2); }
.cz-title p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.cz-stage .cz-tools { position: absolute; left: 50%; bottom: calc(22px + var(--safe-b)); transform: translateX(-50%); display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.cz-side { display: flex; flex-direction: column; min-height: 0; min-width: 0; background: var(--glass-strong); border-left: 1px solid rgba(201,162,74,.25); padding-top: var(--safe-t); padding-right: var(--safe-r); }
.cz-side .tabs { margin: 16px 16px 6px; }
.cz-body { flex: 1; overflow-y: auto; padding: 10px 18px 18px; touch-action: pan-y; }
.cz-foot { padding: 14px 18px calc(14px + var(--safe-b)); border-top: 1px solid var(--line); display: grid; gap: 10px; }
.cz-group { margin: 16px 0 6px; }
.cz-group h3 { margin: 0 0 10px; font-size: 13px; font-weight: 600; color: var(--gold-2); display: flex; justify-content: space-between; }
.cz-group h3 span { color: var(--muted); font-weight: 500; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { width: 34px; height: 34px; border-radius: 50%; border: 2px solid rgba(255,255,255,.12); cursor: pointer; position: relative; padding: 0; }
.swatch.on { border-color: var(--gold-2); box-shadow: 0 0 0 3px rgba(201,162,74,.35); }
.swatch.custom { background: conic-gradient(red, yellow, lime, cyan, blue, magenta, red); overflow: hidden; }
.swatch.custom input { opacity: 0; position: absolute; inset: 0; width: 100%; height: 100%; cursor: pointer; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 38px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: rgba(6,10,23,.5); cursor: pointer; font-size: 14px; }
.chip.on { border-color: var(--gold); color: var(--gold-2); background: rgba(201,162,74,.12); }
.slider-row { display: grid; grid-template-columns: 1fr; gap: 4px; }
.gender-screen { position: absolute; inset: 0; display: grid; place-content: center; gap: 26px; text-align: center; padding: 20px; background: radial-gradient(ellipse at 50% 40%, #15245a 0%, var(--night) 75%); z-index: 3; }
.gender-screen h1 { font-family: var(--display); font-weight: 400; font-size: clamp(28px, 5vw, 44px); color: var(--gold-2); margin: 0; }
.gender-cards { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }
.gender-card { width: 180px; padding: 24px 16px; border-radius: var(--r-lg); border: 1px solid var(--line); background: rgba(12,23,51,.7); cursor: pointer; transition: border-color .2s, transform .2s, opacity .4s, width .4s, padding .4s; display: grid; gap: 10px; justify-items: center; overflow: hidden; }
.gender-card:hover { border-color: var(--gold); transform: translateY(-3px); }
.gender-card .sym { font-family: var(--display); font-size: 54px; color: var(--gold-2); line-height: 1; }
.gender-card .lbl { font-size: 18px; font-weight: 600; }
.gender-card.gone { opacity: 0; width: 0; padding: 24px 0; margin: 0 -8px; border-width: 0; pointer-events: none; }

@media (max-width: 900px) {
  #customizer { grid-template-columns: 1fr; grid-template-rows: 42vh 1fr; }
  .cz-side { border-left: 0; border-top: 1px solid rgba(201,162,74,.25); padding-top: 0; min-height: 0; }
  .cz-title h1 { font-size: 22px; }
  .cz-stage .cz-tools { bottom: 10px; }
  .gender-card { width: 140px; padding: 18px 10px; }
}
/* téléphone à l'horizontale : l'empilement stage / réglages ne laissait que quelques lignes aux réglages, on garde
   les deux colonnes avec un panneau plus étroit */
@media (max-width: 900px) and (orientation: landscape) {
  #customizer { grid-template-columns: minmax(0, 1fr) min(52vw, 400px); grid-template-rows: 1fr; }
  .cz-side { border-left: 1px solid rgba(201,162,74,.25); border-top: 0; padding-top: var(--safe-t); }
  .cz-side .tabs { overflow-x: auto; scrollbar-width: none; }
  .cz-side .tabs::-webkit-scrollbar { display: none; }
  .cz-side .tabs button { flex: 0 0 auto; padding: 0 8px; font-size: 13px; }
  .cz-stage .cz-tools { bottom: calc(10px + var(--safe-b)); }
}
/* cibles tactiles : 44 px minimum pour les liens, onglets, pastilles et puces */
@media (pointer: coarse) {
  .link-btn { min-height: 44px; display: inline-flex; align-items: center; padding: 4px 6px; }
  .tabs button { min-height: 44px; }
  .chip { min-height: 44px; }
  .swatch { width: 40px; height: 40px; }
  .btn.small { min-height: 44px; }
  .icon-btn.close { width: 44px; height: 44px; }
}

/* ───── HUD ───── */
#hud { position: absolute; inset: 0; pointer-events: none; }
#hud > * { pointer-events: auto; }
.hud-tl { position: absolute; top: calc(14px + var(--safe-t)); left: calc(14px + var(--safe-l)); display: flex; gap: 8px; z-index: 5; }
.hud-btn { position: relative; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: var(--glass); border: 1px solid rgba(201,162,74,.3); cursor: pointer; color: var(--ivory); transition: border-color .15s, background .15s, color .15s; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.hud-btn:hover { border-color: var(--gold); }
.hud-btn svg { width: 21px; height: 21px; }
.hud-btn.on { color: var(--gold-2); border-color: var(--gold); background: rgba(20,34,80,.85); }
.hud-btn.off { color: #f2a0a0; border-color: rgba(224,90,90,.55); }
.hud-btn .badge { position: absolute; top: -3px; right: -3px; min-width: 18px; height: 18px; border-radius: 9px; background: var(--gold); color: var(--night); font-size: 11px; font-weight: 700; display: grid; place-items: center; padding: 0 5px; }
.hud-btn .ring { position: absolute; inset: -3px; border-radius: 50%; border: 2px solid var(--ok); opacity: 0; transition: opacity .1s; pointer-events: none; }
.hud-btn.talking .ring { opacity: 1; }
.hud-btn .tip { position: absolute; top: 54px; left: 50%; transform: translateX(-50%); white-space: nowrap; background: var(--glass-strong); border: 1px solid var(--line); border-radius: 6px; padding: 4px 8px; font-size: 12px; opacity: 0; pointer-events: none; transition: opacity .15s; }
@media (hover: hover) { .hud-btn:hover .tip { opacity: 1; } }

.hud-menu { position: absolute; top: calc(68px + var(--safe-t)); left: calc(14px + var(--safe-l)); width: 230px; border-radius: var(--r-md); padding: 6px; z-index: 6; transform-origin: top left; transition: opacity .15s, transform .15s; }
#hud > .hud-menu.closed, .hud-menu.closed { opacity: 0; transform: scale(.96) translateY(-4px); pointer-events: none !important; }
.hud-menu button { width: 100%; display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; border: 0; background: transparent; border-radius: var(--r-sm); cursor: pointer; text-align: left; font-size: 15px; }
.hud-menu button:hover { background: rgba(201,162,74,.12); color: var(--gold-2); }
.hud-menu button svg { width: 19px; height: 19px; color: var(--gold); }
.hud-menu .sep { height: 1px; background: var(--line); margin: 4px 6px; }
.hud-menu .danger { color: #f2b0b0; }
.hud-menu .danger svg { color: #f2a0a0; }

.hud-tr { position: absolute; top: calc(14px + var(--safe-t)); right: calc(14px + var(--safe-r)); display: flex; gap: 8px; align-items: flex-start; z-index: 5; }
.xp-card { min-width: 210px; border-radius: var(--r-md); padding: 8px 12px 10px; cursor: pointer; }
.xp-card .top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.xp-card .lv { font-family: var(--display); font-size: 18px; color: var(--gold-2); }
.xp-card .ti { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }
.xp-bar { height: 5px; border-radius: 3px; background: rgba(255,255,255,.08); margin-top: 6px; overflow: hidden; }
.xp-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold-2)); width: 0; transition: width .6s; }
.xp-card .num { font-size: 11px; color: var(--muted); margin-top: 3px; }
.xp-pop { position: absolute; right: 10px; top: 46px; font-weight: 700; color: var(--gold-2); font-size: 13px; animation: xpPop 1.6s forwards; pointer-events: none; white-space: nowrap; }
@keyframes xpPop { from { opacity: 0; transform: translateY(0); } 15% { opacity: 1; } to { opacity: 0; transform: translateY(18px); } }
.online-pill { height: 46px; padding: 0 14px; border-radius: 23px; display: flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 600; }
.online-pill svg { width: 19px; height: 19px; color: var(--gold); }

/* Chat */
.chat { position: absolute; left: calc(14px + var(--safe-l)); top: calc(72px + var(--safe-t)); bottom: calc(110px + var(--safe-b)); width: min(360px, calc(100vw - 28px)); display: flex; flex-direction: column; border-radius: var(--r-md); transition: opacity .35s, transform .35s; z-index: 4; overflow: hidden; }
#hud > .chat.hidden-chat, .chat.hidden-chat { opacity: 0; transform: translateX(-16px); pointer-events: none !important; }
.chat-head { display: flex; justify-content: space-between; align-items: center; padding: 8px 8px 8px 14px; border-bottom: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.chat-log { flex: 1; overflow-y: auto; padding: 10px 14px; display: flex; flex-direction: column; gap: 6px; touch-action: pan-y; }
.msg { font-size: 14px; line-height: 1.45; word-wrap: break-word; animation: msgIn .25s; }
@keyframes msgIn { from { opacity: 0; transform: translateY(4px); } }
.msg .who { font-weight: 700; color: var(--gold-2); cursor: pointer; }
.msg .who.me { color: #9cc3ff; }
.msg .time { font-size: 11px; color: var(--muted); margin-right: 6px; }
.msg.sys { color: var(--muted); font-size: 13px; font-style: italic; }
.msg .adm { font-size: 10px; border: 1px solid var(--gold); color: var(--gold); border-radius: 4px; padding: 0 4px; margin-right: 4px; font-style: normal; }
.chat-input { display: flex; gap: 6px; padding: 8px; border-top: 1px solid var(--line); }
.chat-input input { min-height: 40px; border-radius: 999px; font-size: 15px; }
.chat-input .icon-btn { flex: 0 0 40px; color: var(--gold); }

/* Invite contextuelle */
.interact { position: absolute; left: 50%; bottom: calc(118px + var(--safe-b)); transform: translateX(-50%); display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; z-index: 4; max-width: 92vw; }
.interact button { min-height: 46px; padding: 0 18px 0 8px; border-radius: 999px; display: flex; gap: 10px; align-items: center; cursor: pointer; font-weight: 600; color: var(--ivory); animation: popIn .2s; }
.interact button .k { width: 30px; height: 30px; border-radius: 50%; background: var(--gold); color: var(--night); display: grid; place-items: center; font-size: 13px; font-weight: 800; }
.interact button:hover { border-color: var(--gold); }
@keyframes popIn { from { opacity: 0; transform: translateY(6px) scale(.96); } }

.zone-banner { position: absolute; top: calc(22px + var(--safe-t)); left: 50%; transform: translateX(-50%); text-align: center; pointer-events: none !important; opacity: 0; transition: opacity .5s; z-index: 3; }
.zone-banner.show { opacity: 1; }
.zone-banner .zn { font-family: var(--display); font-size: 26px; color: var(--gold-2); text-shadow: 0 2px 14px rgba(0,0,0,.8); white-space: nowrap; }
.zone-banner .zd { font-size: 13px; color: var(--ivory); opacity: .8; text-shadow: 0 1px 8px #000; }

.announce { position: absolute; top: 22%; left: 50%; transform: translateX(-50%); text-align: center; padding: 18px 30px; border-radius: var(--r-lg); z-index: 9; animation: popIn .3s; max-width: 90vw; }
.announce .a1 { font-size: 12px; color: var(--gold); }
.announce .a2 { font-family: var(--display); font-size: 26px; color: var(--ivory); margin-top: 4px; }

.levelup { position: absolute; top: 30%; left: 50%; transform: translate(-50%, -50%); text-align: center; pointer-events: none !important; z-index: 9; animation: lvl 3.6s forwards; }
.levelup .l1 { font-family: var(--display); font-size: 56px; color: var(--gold-2); text-shadow: 0 0 40px rgba(201,162,74,.7); }
.levelup .l2 { font-size: 18px; color: var(--ivory); }
@keyframes lvl { 0% { opacity: 0; transform: translate(-50%, -40%) scale(.8); } 12% { opacity: 1; transform: translate(-50%, -50%) scale(1); } 80% { opacity: 1; } 100% { opacity: 0; } }

/* Barre du bas */
.hud-bottom { position: absolute; right: calc(14px + var(--safe-r)); bottom: calc(14px + var(--safe-b)); display: flex; gap: 8px; align-items: flex-end; z-index: 5; }
.minimap { position: absolute; right: calc(14px + var(--safe-r)); bottom: calc(72px + var(--safe-b)); width: 176px; height: 128px; border-radius: var(--r-md); overflow: hidden; z-index: 3; }
.minimap canvas { width: 100%; height: 100%; }
.emote-wheel { position: absolute; right: calc(14px + var(--safe-r)); bottom: calc(72px + var(--safe-b)); display: grid; grid-template-columns: repeat(4, 48px); gap: 6px; padding: 8px; border-radius: var(--r-md); z-index: 6; transition: opacity .15s; }
#hud > .emote-wheel.closed, .emote-wheel.closed { opacity: 0; pointer-events: none !important; }
.emote-wheel button { height: 48px; border-radius: 12px; border: 1px solid var(--line); background: rgba(6,10,23,.6); font-size: 22px; cursor: pointer; }
.emote-wheel button:hover { border-color: var(--gold); }
.hold-pill { height: 46px; border-radius: 23px; padding: 0 6px 0 14px; display: flex; align-items: center; gap: 8px; font-size: 13px; }
.hold-pill .dot { width: 12px; height: 12px; border-radius: 50%; }

/* Plaques de nom */
/* z-index : les plaques se classent entre elles par distance (jusqu'à 1000) ; ce contexte d'empilement les garde sous le HUD */
#nameplates { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 1; }
.np { position: absolute; left: 0; top: 0; transform-origin: 50% 100%; display: flex; flex-direction: column; align-items: center; gap: 4px; will-change: transform; white-space: nowrap; }
.np .bubble { max-width: 220px; white-space: normal; background: rgba(243,235,216,.95); color: #0c1733; padding: 6px 10px; border-radius: 12px; font-size: 13px; line-height: 1.35; position: relative; animation: popIn .2s; text-align: center; word-wrap: break-word; }
.np .bubble::after { content: ''; position: absolute; bottom: -5px; left: 50%; margin-left: -5px; border: 5px solid transparent; border-bottom: 0; border-top-color: rgba(243,235,216,.95); }
.np .tag { display: flex; align-items: center; gap: 6px; padding: 3px 9px 3px 4px; border-radius: 999px; background: rgba(6,10,23,.72); border: 1px solid rgba(201,162,74,.35); font-size: 13px; }
.np .tag .lv { min-width: 20px; height: 20px; border-radius: 10px; background: var(--gold); color: var(--night); font-weight: 800; font-size: 11px; display: grid; place-items: center; padding: 0 5px; }
.np .tag .nm { font-weight: 600; }
.np .tag .ic svg { width: 13px; height: 13px; color: #f2a0a0; display: block; }
.np .ti { font-size: 11px; color: var(--gold-2); text-shadow: 0 1px 4px #000; }
.np.speaking .tag { border-color: var(--ok); box-shadow: 0 0 0 2px rgba(111,191,142,.45); }
.np.me .tag { border-color: rgba(156,195,255,.5); }
.np.afk { opacity: .55; }

/* Joystick mobile */
.joy { position: absolute; left: calc(26px + var(--safe-l)); bottom: calc(26px + var(--safe-b)); width: 124px; height: 124px; border-radius: 50%; background: rgba(9,15,34,.45); border: 1px solid rgba(201,162,74,.3); z-index: 4; touch-action: none; }
.joy i { position: absolute; left: 50%; top: 50%; width: 54px; height: 54px; margin: -27px; border-radius: 50%; background: rgba(201,162,74,.55); border: 1px solid var(--gold-2); }
.mobile-actions { position: absolute; right: calc(18px + var(--safe-r)); bottom: calc(80px + var(--safe-b)); display: grid; gap: 10px; z-index: 4; }
.touch-look { position: absolute; top: 0; right: 0; bottom: 0; width: 55%; z-index: 1; touch-action: none; }

/* Plein écran ciné */
.cinema-full { position: fixed; inset: 0; z-index: 50; background: #000; display: flex; flex-direction: column; }
.cinema-full .cf-player { flex: 1; position: relative; }
.cinema-full .cf-player > div, .cinema-full iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.cinema-full .cf-bar { display: flex; align-items: center; gap: 10px; padding: 10px calc(14px + var(--safe-r)) calc(10px + var(--safe-b)) calc(14px + var(--safe-l)); background: var(--glass-strong); border-top: 1px solid var(--line); }
.cinema-full .cf-bar .t { flex: 1; font-size: 14px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.css3d-screen { background: #000; }
#css3d-layer { position: absolute; inset: 0; pointer-events: none; }
.sound-unlock { position: absolute; left: 50%; bottom: calc(180px + var(--safe-b)); transform: translateX(-50%); z-index: 6; }
#spotify-host { position: fixed; width: 300px; height: 80px; left: -400px; bottom: 0; opacity: 0.01; pointer-events: none; z-index: -1; }
#spotify-host.visible { left: auto; right: calc(14px + var(--safe-r)); bottom: calc(210px + var(--safe-b)); opacity: 1; pointer-events: auto; z-index: 5; border-radius: 12px; overflow: hidden; }
#yt-radio-host { position: fixed; width: 200px; height: 120px; left: -400px; bottom: 0; opacity: 0.01; pointer-events: none; }

/* Classement / stats */
.lb-list { display: grid; gap: 4px; margin-top: 12px; }
.lb-row { display: grid; grid-template-columns: 44px 1fr auto; gap: 10px; align-items: center; padding: 8px 12px; border-radius: var(--r-sm); background: rgba(20,34,80,.3); border: 1px solid transparent; cursor: pointer; }
.lb-row:hover { border-color: var(--line); }
.lb-row.me { border-color: rgba(156,195,255,.45); }
.lb-row .rk { font-family: var(--display); font-size: 20px; color: var(--muted); text-align: center; }
.lb-row.r1 .rk { color: #f0cf6d; } .lb-row.r2 .rk { color: #d6d9e0; } .lb-row.r3 .rk { color: #d49a61; }
.lb-row .nm { font-weight: 600; }
.lb-row .nm small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; }
.lb-row .val { font-weight: 700; color: var(--gold-2); text-align: right; }
.dot-online { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); margin-left: 6px; vertical-align: middle; }
.stat-head { display: flex; gap: 16px; align-items: center; margin-bottom: 16px; }
.stat-head img { width: 84px; height: 84px; border-radius: 50%; border: 1px solid var(--gold); background: var(--navy); }
.stat-head .nm { font-family: var(--display); font-size: 26px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.stat { padding: 12px; border-radius: var(--r-sm); background: rgba(20,34,80,.35); border: 1px solid var(--line); }
.stat .v { font-family: var(--display); font-size: 24px; color: var(--gold-2); }
.stat .k { font-size: 12px; color: var(--muted); margin-top: 2px; }
.stat-section { margin: 18px 0 8px; font-size: 14px; color: var(--gold); font-weight: 600; }
.titles-list { display: grid; gap: 4px; }
.titles-list div { display: flex; justify-content: space-between; padding: 6px 10px; border-radius: 6px; font-size: 14px; }
.titles-list .got { color: var(--gold-2); background: rgba(201,162,74,.08); }
.titles-list .cur { box-shadow: inset 0 0 0 1px var(--gold); }
.titles-list .lock { color: var(--muted); }

/* ───── Mini-jeux ───── */
.game-panel { display: grid; gap: 14px; }
.order-list { display: grid; gap: 8px; }
.order { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--r-sm); border: 1px solid var(--line); background: rgba(20,34,80,.3); }
.order .dot { width: 14px; height: 14px; border-radius: 50%; flex: 0 0 14px; }
.order .info { flex: 1; min-width: 0; }
.order .info b { display: block; }
.order .info small { color: var(--muted); }
.recipe-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.recipe-card { padding: 12px; border-radius: var(--r-md); border: 1px solid var(--line); background: rgba(20,34,80,.3); cursor: pointer; text-align: left; display: grid; gap: 6px; }
.recipe-card:hover { border-color: var(--gold); }
.recipe-card .glass-ic { width: 26px; height: 34px; border-radius: 0 0 8px 8px; border: 2px solid rgba(255,255,255,.35); border-top: 0; position: relative; overflow: hidden; }
.recipe-card .glass-ic i { position: absolute; left: 0; right: 0; bottom: 0; height: 75%; }
.recipe-card b { font-size: 15px; }
.recipe-card small { color: var(--muted); font-size: 12px; line-height: 1.35; }

.mixer { display: grid; grid-template-columns: 1fr 250px; gap: 16px; align-items: start; }
@media (max-width: 780px) { .mixer { grid-template-columns: 1fr; } .glass-view { order: -1; } }
.mixer .mixgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.mixer .ticket { padding: 12px 14px; border-radius: var(--r-md); border: 1px dashed rgba(201,162,74,.5); background: rgba(201,162,74,.05); }
.mixer .ticket h4 { margin: 0 0 6px; font-family: var(--display); font-weight: 400; font-size: 20px; color: var(--gold-2); }
.mixer .ticket ul { margin: 6px 0 0; padding-left: 18px; font-size: 14px; line-height: 1.6; }
.ing-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 7px; max-height: 46vh; overflow-y: auto; }
.ing { position: relative; min-height: 64px; padding: 8px 8px 8px 12px; border-radius: var(--r-sm); border: 1px solid var(--line); background: rgba(6,10,23,.6); cursor: pointer; text-align: left; user-select: none; -webkit-user-select: none; touch-action: none; overflow: hidden; }
.ing::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--c); }
.ing .n { font-size: 12.5px; line-height: 1.25; display: block; }
.ing .q { font-size: 12px; color: var(--gold-2); font-weight: 700; margin-top: 4px; display: block; }
.ing.pouring { border-color: var(--gold); background: rgba(201,162,74,.15); }
.ing .fill { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--c); opacity: .9; }
.glass-view { display: grid; justify-items: center; gap: 10px; position: sticky; top: 0; }
.glass-view .g { width: 110px; height: 170px; border: 3px solid rgba(220,230,255,.4); border-top: 0; border-radius: 0 0 22px 22px; position: relative; overflow: hidden; background: rgba(255,255,255,.03); }
.glass-view .g .layer { position: absolute; left: 0; right: 0; transition: height .08s linear; }
.glass-view .g .ice { position: absolute; width: 22px; height: 22px; border-radius: 5px; background: rgba(230,245,255,.55); border: 1px solid rgba(255,255,255,.7); }
.glass-view .vol { font-size: 13px; color: var(--muted); }
.glass-view .live { font-family: var(--display); font-size: 30px; color: var(--gold-2); min-height: 38px; }
.stepper { display: flex; align-items: center; gap: 8px; }
.stepper button { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: rgba(6,10,23,.6); cursor: pointer; font-size: 18px; }
.stepper b { min-width: 24px; text-align: center; }
.result-big { text-align: center; }
.result-big .score { font-family: var(--display); font-size: 64px; color: var(--gold-2); line-height: 1; }
.result-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.result-table td { padding: 6px 4px; border-bottom: 1px solid var(--line); }
.result-table td:last-child { text-align: right; font-weight: 700; }
.bar-s { display: inline-block; width: 60px; height: 6px; background: rgba(255,255,255,.08); border-radius: 3px; overflow: hidden; vertical-align: middle; margin-left: 6px; }
.bar-s i { display: block; height: 100%; background: var(--gold); }
@media (max-width: 640px) { .mixer { grid-template-columns: 1fr; } .glass-view .g { width: 80px; height: 120px; } }

.gauge { position: relative; height: 34px; border-radius: 17px; background: rgba(6,10,23,.7); border: 1px solid var(--line); overflow: hidden; }
.gauge .zone { position: absolute; top: 0; bottom: 0; background: rgba(111,191,142,.35); border-left: 2px solid var(--ok); border-right: 2px solid var(--ok); }
.gauge .zone.perfect { background: rgba(235,208,138,.45); border-color: var(--gold-2); }
.gauge .cursor { position: absolute; top: 3px; bottom: 3px; width: 6px; margin-left: -3px; border-radius: 3px; background: var(--ivory); box-shadow: 0 0 12px #fff; }
.tea-steps { display: flex; gap: 8px; justify-content: center; }
.tea-steps span { padding: 4px 12px; border-radius: 999px; border: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.tea-steps span.on { border-color: var(--gold); color: var(--gold-2); }
.tea-steps span.done { color: var(--ok); border-color: rgba(111,191,142,.5); }

.arcade-box { position: relative; height: min(56vh, 420px); border-radius: var(--r-md); background: radial-gradient(circle at 50% 30%, #13245c, #050814); border: 1px solid var(--line); overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; }
.arcade-box .target { position: absolute; border-radius: 50%; transform: translate(-50%, -50%); cursor: pointer; background: radial-gradient(circle at 35% 30%, #fff6d8, var(--gold) 45%, #6b5215); box-shadow: 0 0 22px rgba(235,208,138,.7); animation: tgt var(--life) linear forwards; }
.arcade-box .target.bad { background: radial-gradient(circle at 35% 30%, #ffd0d0, #d04040 45%, #501010); box-shadow: 0 0 22px rgba(224,90,90,.7); }
@keyframes tgt { from { scale: 0.2; } 12% { scale: 1; } 80% { scale: 1; opacity: 1; } to { scale: .4; opacity: 0; } }
.arcade-box .hudline { position: absolute; top: 10px; left: 14px; right: 14px; display: flex; justify-content: space-between; font-family: var(--display); font-size: 22px; color: var(--gold-2); pointer-events: none; z-index: 2; }
.arcade-box .center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; gap: 12px; z-index: 3; }
.arcade-box .pop { position: absolute; transform: translate(-50%, -50%); font-weight: 800; color: var(--gold-2); pointer-events: none; animation: xpPop .8s forwards; }

.p4-board { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; padding: 10px; border-radius: var(--r-md); background: #13245c; border: 2px solid var(--gold); max-width: 420px; margin: 0 auto; }
.p4-board .cell { aspect-ratio: 1; border-radius: 50%; background: #060a17; box-shadow: inset 0 3px 6px rgba(0,0,0,.6); cursor: pointer; transition: background .2s; }
.p4-board .cell.p1 { background: radial-gradient(circle at 35% 30%, #ff9a9a, #c62a2a); }
.p4-board .cell.p2 { background: radial-gradient(circle at 35% 30%, #fff1b8, #c9a24a); }
.p4-board .cell.win { box-shadow: 0 0 0 3px #fff, 0 0 14px #fff; }
.p4-board.myturn .col-hover { background: rgba(255,255,255,.08); }
.p4-status { text-align: center; font-size: 16px; }

.profile-card .actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.ticket-meta { font-size: 12px; color: var(--muted); padding: 10px 12px; border-radius: var(--r-sm); background: rgba(6,10,23,.5); border: 1px solid var(--line); line-height: 1.6; }
.player-list { display: grid; gap: 4px; }
.player-list .pl { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-sm); cursor: pointer; }
.player-list .pl:hover { background: rgba(201,162,74,.08); }
.player-list .pl .lv { min-width: 26px; height: 22px; border-radius: 11px; background: var(--gold); color: var(--night); font-weight: 800; font-size: 12px; display: grid; place-items: center; }
.player-list .pl .nm { flex: 1; }
.player-list .pl .ic svg { width: 16px; height: 16px; color: var(--muted); }
.help-keys { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 14px; align-items: center; }

#rotate-hint { position: fixed; bottom: 10px; left: 50%; transform: translateX(-50%); z-index: 90; background: var(--glass-strong); padding: 8px 14px; border-radius: 999px; font-size: 13px; border: 1px solid var(--line); }

@media (max-width: 760px) {
  .xp-card { min-width: 0; padding: 6px 10px 8px; }
  .xp-card .ti, .xp-card .num { display: none; }
  .hud-btn { width: 42px; height: 42px; }
  .hud-tl { gap: 6px; }
  .online-pill { height: 42px; padding: 0 10px; }
  .minimap { width: 120px; height: 88px; bottom: auto; top: calc(66px + var(--safe-t)); }
  .chat { bottom: calc(170px + var(--safe-b)); top: calc(66px + var(--safe-t)); width: min(300px, calc(100vw - 150px)); }
  .interact { bottom: calc(160px + var(--safe-b)); }
  .zone-banner { top: calc(118px + var(--safe-t)); }
  .zone-banner .zn { font-size: 20px; }
  .modal-body { padding: 14px 16px 18px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

/* ───── Ajouts v0.2 ───── */
.hud-btn.notify::after { content: ''; position: absolute; top: 6px; right: 6px; width: 9px; height: 9px; border-radius: 50%; background: #e05a5a; box-shadow: 0 0 6px #e05a5a; }
.np.pet .tag { padding: 2px 9px; font-size: 11px; opacity: .85; }
.np.afk { opacity: .6; }
.interact button .k { min-width: 22px; }
.kc-pill { position: absolute; top: calc(78px + var(--safe-t)); right: calc(14px + var(--safe-r)); display: flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; font-size: 13px; pointer-events: auto; }
.kc-pill b { color: var(--gold-2); font-size: 15px; }
.kc-pill small { color: var(--muted); }
@media (max-width: 760px) { .kc-pill { top: calc(62px + var(--safe-t)); font-size: 11px; padding: 4px 9px; } }
.chat-log .msg.pet { color: #f0b27a; font-style: italic; }
.chat-log .msg.pm { color: #c9a6ff; }
.speak-bar { position: absolute; top: calc(12px + var(--safe-t)); left: 50%; transform: translateX(-50%); display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; max-width: 50vw; pointer-events: none; }
.speak-bar span { background: rgba(20,60,40,.85); border: 1px solid #6fbf8e; color: #d8ffe6; padding: 3px 10px; border-radius: 999px; font-size: 12px; }
@media (max-width: 760px) { .speak-bar { top: calc(62px + var(--safe-t)); max-width: 70vw; } }
/* Mobile : barre du haut désencombrée */
@media (max-width: 760px) {
  .kc-pill { left: calc(12px + var(--safe-l, 0px)); right: auto; top: calc(64px + var(--safe-t)); }
  .minimap { top: calc(64px + var(--safe-t)) !important; right: calc(10px + var(--safe-r)) !important; width: 132px !important; height: auto !important; }
  .minimap canvas { width: 100%; height: auto; }
  .hud-tr .xp-card { min-width: 0; max-width: 92px; padding: 6px 8px; }
  .hud-tr .xp-card .ti, .hud-tr .xp-card .num { display: none; }
  #rotate-hint { top: calc(112px + var(--safe-t)) !important; bottom: auto !important; font-size: 11px; animation: hintOut 0s 7s forwards; }
  .modal-card { max-height: calc(100dvh - 24px); }
}
@keyframes hintOut { to { opacity: 0; visibility: hidden; } }
.ing.locked { opacity: .45; filter: grayscale(.6); }
.ing.shake { animation: shake .3s; }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.fast-pill { position: absolute; top: calc(118px + var(--safe-t)); left: 50%; transform: translateX(-50%); padding: 6px 14px; border-radius: 999px; font-size: 13px; border-color: #3fa37c; pointer-events: none; white-space: nowrap; }
@media (max-width: 760px) { .fast-pill { top: calc(150px + var(--safe-t)); font-size: 11px; white-space: normal; max-width: 90vw; text-align: center; } }

/* ───── Jeux à table du casino (games/table.js) ───── */
#hud > .tbl-hud, .tbl-hud { position: absolute; inset: 0; pointer-events: none; z-index: 5; }
.tbl-hud > * { pointer-events: auto; }
.tbl-banner { position: absolute; left: 50%; top: calc(16px + var(--safe-t)); transform: translateX(-50%); display: flex; align-items: center; gap: 12px; padding: 9px 20px; border-radius: 999px; border-color: var(--gold); white-space: nowrap; }
.tbl-banner .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 10px var(--ok); }
.tbl-banner.closed .dot { background: var(--danger); box-shadow: 0 0 10px var(--danger); }
.tbl-banner.urgent .dot { animation: rlBlink .5s steps(2) infinite; }
@keyframes rlBlink { to { opacity: .2; } }
.tbl-banner .ph { font-family: var(--display); font-size: 20px; color: var(--gold-2); }
.tbl-banner .tm { font-size: 14px; color: #c9c3b4; min-width: 36px; }
.tbl-players { position: absolute; left: 50%; top: calc(64px + var(--safe-t)); transform: translateX(-50%); display: flex; gap: 6px; white-space: nowrap; }
.tbl-players .pl { display: flex; align-items: center; gap: 6px; padding: 4px 10px 4px 7px; border-radius: 999px; font-size: 12px; color: #c9c3b4; }
.tbl-players .pl.me { border-color: var(--gold); color: var(--ivory); }
.tbl-players .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--chip); border: 1px solid rgba(0,0,0,.4); }
.tbl-players .nm { font-weight: 600; max-width: 110px; overflow: hidden; text-overflow: ellipsis; }
.tbl-players .ch { color: var(--gold-2); }
.tbl-players .bet { color: var(--muted); }
.tbl-last { position: absolute; left: calc(16px + var(--safe-l)); top: calc(76px + var(--safe-t)); padding: 10px 12px; border-radius: var(--r-md); display: flex; flex-direction: column; gap: 8px; }
#hud > .dlg { pointer-events: none; z-index: 9; }
.tbl-last .lbl, .tbl-rack .lbl { font-size: 11px; color: var(--muted); letter-spacing: .08em; }
.tbl-last .row { display: flex; gap: 6px; }
.tbl-last .n { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13px; color: #fff; border: 1px solid rgba(255,255,255,.25); }
.tbl-rack { position: absolute; left: calc(16px + var(--safe-l)); bottom: calc(16px + var(--safe-b)); width: min(560px, calc(100vw - 32px)); padding: 12px 14px; border-radius: var(--r-md); display: flex; flex-direction: column; gap: 10px; }
.tbl-rack .top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.tbl-rack .tot { font-family: var(--display); font-size: 22px; color: var(--gold-2); font-variant-numeric: tabular-nums; }
.tbl-rack .tot small { font-family: var(--ui); font-size: 13px; color: var(--muted); }
.tbl-rack .chips { display: flex; align-items: center; gap: 8px; }
/* mise en jeu : une case fixe à droite des jetons */
.tbl-rack .stake { margin-left: auto; min-width: 110px; padding: 5px 12px; border-radius: 10px; background: rgba(0,0,0,.28); border: 1px solid rgba(201,162,74,.35); display: flex; flex-direction: column; align-items: flex-end; line-height: 1.1; }
.tbl-rack .stake small { font-size: 10px; letter-spacing: .1em; color: var(--muted); }
.tbl-rack .stake b { font-family: var(--display); font-size: 20px; color: var(--ivory); font-variant-numeric: tabular-nums; }
.tbl-rack .hint { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: -4px; }
/* barre de boutons : autant de colonnes égales que de boutons, rien ne bouge ni ne passe à la ligne */
body:not(.mobile) .tbl-rack .acts { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; padding-top: 10px; border-top: 1px solid rgba(201,162,74,.22); }
body:not(.mobile) .tbl-rack .acts .btn { min-height: 36px; padding: 0 6px; font-size: 13px; white-space: nowrap; justify-content: center; }
/* pourboires : une bulle au-dessus du râtelier, ouverte par le bouton */
body:not(.mobile) .tbl-rack .tipwrap { display: contents; }
body:not(.mobile) .tbl-rack .tips { display: none; position: absolute; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%); gap: 8px; padding: 8px 10px; border-radius: 999px; background: var(--glass-strong); border: 1px solid rgba(201,162,74,.45); box-shadow: 0 8px 24px rgba(0,0,0,.45); z-index: 2; }
body:not(.mobile) .tbl-rack .tips.open { display: flex; align-items: center; }
body:not(.mobile) .tbl-rack .tips .tip { min-width: 46px; }
body:not(.mobile) .tbl-rack .tip-lbl { display: none; }
/* jeton : corps à la couleur du siège (--chip), six pastilles sur la tranche à la couleur de la valeur (--spot) */
.tbl-chip { width: 46px; height: 46px; border-radius: 50%; border: 2px solid rgba(0,0,0,.45); color: var(--chip-text, #fff); text-shadow: 0 1px 2px rgba(0,0,0,.35); font-weight: 700; font-size: 13px; cursor: pointer; transition: transform .1s;
  background: radial-gradient(circle, var(--chip, #555) 0 58%, transparent 59%), repeating-conic-gradient(from -11deg, var(--spot, #fff) 0 22deg, var(--chip, #555) 22deg 60deg); }
.tbl-chip.on { transform: scale(1.15); box-shadow: 0 0 0 3px var(--night), 0 0 0 5px var(--gold-2); }
.tbl-number { position: absolute; left: 50%; top: 30%; transform: translate(-50%, -50%); width: 120px; height: 120px; border-radius: 50%; display: grid; place-items: center; font-family: var(--display); font-size: 56px; color: #fff; border: 4px solid var(--gold-2); box-shadow: 0 0 40px rgba(0,0,0,.6); animation: popIn .25s; pointer-events: none; z-index: 8; }
body.tbl-seated .joy, body.tbl-seated .interact, body.tbl-seated .float-prompt, body.tbl-seated .minimap { display: none !important; }
.tbl-play { position: absolute; right: calc(16px + var(--safe-r)); bottom: calc(16px + var(--safe-b)); display: flex; gap: 10px; animation: popIn .2s; }
.tbl-play .btn { min-width: 112px; min-height: 52px; font-size: 17px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.tbl-play .btn:disabled { opacity: .45; }
.tbl-play kbd { font: 600 11px var(--ui); padding: 2px 6px; border-radius: 6px; background: rgba(0,0,0,.25); }
.tbl-play .btn.advised { position: relative; box-shadow: 0 0 0 3px var(--gold-2), 0 0 22px rgba(235,208,138,.55); }
.tbl-play .btn.advised::after { content: 'conseillé'; position: absolute; top: -9px; left: 50%; transform: translateX(-50%); padding: 1px 7px; border-radius: 999px; background: var(--gold-2); color: #060a17; font: 700 10px var(--ui); letter-spacing: .04em; }
.tbl-guide { position: absolute; right: calc(16px + var(--safe-r)); bottom: calc(84px + var(--safe-b)); width: 340px; max-height: calc(100vh - 220px); overflow: auto; padding: 10px 12px; border-radius: var(--r-md); display: flex; flex-direction: column; gap: 4px; }
.tbl-guide .lbl { font-size: 11px; color: var(--muted); letter-spacing: .08em; margin-bottom: 2px; }
.tbl-guide .row { display: grid; grid-template-columns: 1fr auto; column-gap: 8px; padding: 4px 8px; border-radius: 8px; }
.tbl-guide .row b { font-size: 13px; }
.tbl-guide .row .pay { grid-row: 1 / span 2; grid-column: 2; align-self: center; color: var(--gold-2); font-weight: 700; }
.tbl-guide .row.on { background: rgba(235,208,138,.18); outline: 1px solid var(--gold-2); }
.tbl-guide .note { margin-top: 4px; }
.tbl-views { display: inline-flex; border-radius: 999px; border: 1px solid var(--line); overflow: hidden; }
.tbl-views .seg { min-height: 34px; padding: 0 12px; border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 12px; }
.tbl-views .seg.on { background: var(--line); color: var(--text); }
.tbl-rotate { display: none; position: absolute; inset: 0; z-index: 40; background: var(--night); place-content: center; justify-items: center; gap: 10px; text-align: center; padding: 24px; }
.tbl-rotate .ic { font-size: 44px; color: var(--gold-2); }
.tbl-rotate .ttl { font-family: var(--display); font-size: 22px; color: var(--gold-2); margin: 10px 0 6px; }
body.tbl-portrait .tbl-rotate { display: grid; }
body.tbl-portrait #rotate-hint { display: none !important; }
/* ── mobile : tapis plein écran, jetons en colonne sous le pouce gauche, une barre d'actions en bas,
   numéro et historique en haut pour laisser le tapis et la roue dégagés */
body.mobile.tbl-seated .touch-look { width: 100%; }
body.mobile .tbl-banner { padding: 5px 14px; gap: 8px; top: calc(8px + var(--safe-t)); }
body.mobile .tbl-players { top: calc(46px + var(--safe-t)); gap: 4px; }
body.mobile .tbl-players .pl { padding: 2px 8px 2px 5px; font-size: 11px; gap: 4px; }
body.mobile .tbl-players .nm { max-width: 70px; }
body.mobile .tbl-guide { top: calc(46px + var(--safe-t)); bottom: calc(124px + var(--safe-b)); right: calc(12px + var(--safe-r)); width: 280px; max-height: none; }
body.mobile .tbl-banner .ph { font-size: 15px; }
body.mobile .tbl-last { top: calc(10px + var(--safe-t)); left: auto; right: calc(12px + var(--safe-r)); padding: 5px 6px; flex-direction: row; align-items: center; }
body.mobile .tbl-last .lbl { display: none; }
body.mobile .tbl-last .n { width: 20px; height: 20px; font-size: 9px; }
body.mobile .tbl-last .n:nth-child(n+5) { display: none; }
body.mobile .tbl-number { left: auto; right: calc(12px + var(--safe-r)); top: calc(44px + var(--safe-t)); transform: none; width: 56px; height: 56px; font-size: 28px; border-width: 3px; }
body.mobile .tbl-rack { left: calc(12px + var(--safe-l)); right: calc(12px + var(--safe-r)); width: auto; bottom: calc(8px + var(--safe-b)); padding: 0; background: transparent; border: 0; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; gap: 0; }
body.mobile .tbl-rack .top { display: none; }
body.mobile .tbl-rack .chips { position: fixed; left: calc(10px + var(--safe-l)); top: calc(66px + var(--safe-t)); flex-direction: column; gap: 6px; padding: 6px; border-radius: 30px; background: var(--glass-strong); border: 1px solid var(--line); }
body.mobile .tbl-chip { width: 44px; height: 44px; border-width: 2px; font-size: 11px; }
body.mobile.menu-open .tbl-rack .chips { display: none; }
body.mobile .tbl-rack .acts { display: flex; align-items: center; height: 46px; border-radius: 23px; background: var(--glass-strong); border: 1px solid rgba(201,162,74,.35); padding: 0 8px 0 14px; gap: 6px; flex-wrap: nowrap; }
body.mobile .tbl-rack .acts .inplay { display: flex; align-items: baseline; gap: 6px; margin-right: auto; white-space: nowrap; min-width: 0; }
body.mobile .tbl-rack .acts .tot { font-size: 17px; }
body.mobile .tbl-rack .acts .btn { padding: 0 10px; font-size: 12px; min-height: 34px; white-space: nowrap; }
body.mobile .tbl-rack .tip-lbl { display: none; }
body.mobile .tbl-rack .tipwrap { position: relative; display: flex; }
body.mobile .tbl-rack .tips { display: none; position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(100% + 10px); gap: 6px; padding: 6px; border-radius: 999px; background: var(--glass-strong); border: 1px solid rgba(201,162,74,.35); }
body.mobile .tbl-rack .tips.open { display: flex; }
body.mobile .tbl-rack .acts .tip { min-width: 40px; }
/* téléphones étroits (paysage 667 px) : la barre se resserre plutôt que de chevaucher sa mise en jeu */
body.mobile .tbl-rack .acts .inplay { flex-shrink: 0; }
body.mobile .tbl-views .seg { white-space: nowrap; }
@media (max-width: 760px) {
  body.mobile .tbl-rack .acts { gap: 4px; padding: 0 6px 0 10px; }
  body.mobile .tbl-rack .acts .btn, body.mobile .tbl-views .seg { padding: 0 7px; font-size: 11px; }
  body.mobile .tbl-rack .acts .inplay { font-size: 11px; gap: 4px; }
  body.mobile .tbl-rack .acts .tot { font-size: 15px; }
}
body.mobile .tbl-play { right: calc(12px + var(--safe-r)); bottom: calc(62px + var(--safe-b)); gap: 8px; }
body.mobile .tbl-play .btn { min-width: 78px; min-height: 44px; font-size: 14px; }
body.mobile .tbl-rack .acts .tip::before { content: '+'; opacity: .6; }
body.mobile.tbl-seated .hud-bottom { display: none !important; }
body.mobile.tbl-seated #toasts { bottom: auto; top: calc(74px + var(--safe-t)); width: min(60vw, 420px); }
/* machine à sous : un seul panneau discret, le jeu se joue sur la machine (boutons 3D, levier) */
.slot-hud { position: absolute; left: calc(16px + var(--safe-l)); bottom: calc(16px + var(--safe-b)); max-width: min(420px, calc(100vw - 32px)); padding: 10px 14px; border-radius: var(--r-md); display: flex; flex-direction: column; gap: 6px; z-index: 5; }
.slot-hud .top { display: flex; align-items: baseline; gap: 10px; }
.slot-hud .lbl { font-size: 11px; color: var(--muted); letter-spacing: .08em; }
.slot-hud .ttl { font-family: var(--display); color: var(--gold-2); font-size: 15px; letter-spacing: .04em; }
.slot-hud .row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.slot-hud .cr b { font-family: var(--display); font-size: 22px; color: var(--gold-2); font-variant-numeric: tabular-nums; }
.slot-hud .cr small { color: var(--muted); }
body.mobile .slot-hud { left: calc(12px + var(--safe-l)); bottom: calc(8px + var(--safe-b)); padding: 6px 10px; }
/* téléphone : les boutons du pupitre en grand, sous le pouce droit (MISE −, la mise, MISE +, LANCER) */
.seat-pad { position: absolute; right: calc(12px + var(--safe-r)); bottom: calc(8px + var(--safe-b)); display: flex; align-items: center; gap: 8px; padding: 6px; border-radius: 40px; background: var(--glass-strong); border: 1px solid rgba(201,162,74,.35); z-index: 5; touch-action: none; user-select: none; -webkit-user-select: none; }
.seat-pad .btn { min-width: 48px; min-height: 48px; padding: 0 12px; border-radius: 24px; font-size: 18px; }
.seat-pad .btn.go { min-width: 104px; min-height: 60px; border-radius: 30px; font-size: 16px; letter-spacing: .04em; }
.seat-pad .btn:disabled, .seat-pad .btn.off { opacity: .4; }
.seat-pad .bet { display: flex; flex-direction: column; align-items: center; min-width: 58px; line-height: 1.1; }
.seat-pad .bet small { font-size: 10px; color: var(--muted); letter-spacing: .08em; }
.seat-pad .bet b { font-family: var(--display); font-size: 18px; color: var(--gold-2); font-variant-numeric: tabular-nums; }
@media (max-width: 760px) { .seat-pad { gap: 5px; } .seat-pad .btn { min-width: 42px; padding: 0 9px; } .seat-pad .btn.go { min-width: 88px; } }
.tbl-result { position: absolute; right: calc(16px + var(--safe-r)); bottom: calc(16px + var(--safe-b)); padding: 12px 20px; border-radius: 999px; font-size: 16px; font-weight: 600; border-color: rgba(201,162,74,.35); animation: popIn .2s; }
.tbl-result.win { color: var(--gold-2); border-color: var(--gold); }
body.mobile .tbl-result { right: calc(12px + var(--safe-r)); bottom: calc(64px + var(--safe-b)); padding: 8px 14px; font-size: 13px; }
/* dialogues des PNJ (dialogue.js) : bulle rangée, sans pointe, avec le nom de celui qui parle ; en haut sous les
   bandeaux, au-dessus de la barre de jeu (data-at="bottom" : mobile en vue tapis de la roulette), ou à droite (data-at="side" :
   mobile aux tables de cartes, pour laisser voir les cartes du croupier) */
#hud > .dlg.docked { left: 50%; top: calc(92px + var(--safe-t)); transform: translateX(-50%) !important; }
body.mobile #hud > .dlg.docked { top: calc(72px + var(--safe-t)); }
body.mobile #hud > .dlg.docked[data-at="bottom"] { top: auto; bottom: calc(62px + var(--safe-b)); }
body.mobile #hud > .dlg.docked[data-at="side"] { left: auto; right: calc(12px + var(--safe-r)); top: calc(96px + var(--safe-t)); transform: none !important; max-width: 35vw; }
.dlg.docked .bubble::after { display: none; }
.dlg.docked .bubble::before { content: attr(data-who); display: block; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #8a6a2a; margin-bottom: 2px; }

/* ───── Mode mobile (body.mobile, posé par le HUD d'après la taille d'écran ou le pointeur) ─────
   À l'écran : menu, joystick, emotes, téléportation. Le reste passe dans le menu (entrées .m-only). */
body:not(.mobile) .m-only { display: none !important; }
body.mobile .d-only, body.mobile .hud-tr, body.mobile .kc-pill, body.mobile .minimap, body.mobile .hud-tl .hud-btn:not(:first-child) { display: none !important; }
.joy, .touch-look { display: none; }
body.mobile.touch .joy, body.mobile.touch .touch-look { display: block; }
body.mobile .hud-menu { width: 300px; }
/* bureau : la mini-carte dans le coin bas droit, les boutons juste au-dessus, la roue d'emotes au-dessus des boutons */
body:not(.mobile) .minimap { bottom: calc(14px + var(--safe-b)); }
body:not(.mobile) .hud-bottom { bottom: calc(150px + var(--safe-b)); }
body:not(.mobile) .emote-wheel { bottom: calc(204px + var(--safe-b)); }
/* menus au-dessus des invites, bandeaux et annonces (mais sous les modales) ; notifications et indice de rotation
   descendent en bas en mobile pour ne jamais recouvrir le menu ouvert */
.hud-menu, .tp-menu, .emote-wheel { z-index: 20; }
body.mobile #toasts { top: auto; bottom: calc(84px + var(--safe-b)); width: min(86vw, 420px); z-index: 15; }
body.mobile #rotate-hint { top: auto !important; bottom: calc(150px + var(--safe-b)) !important; z-index: 15; }
.menu-card { margin: 0 0 4px; padding: 12px 10px 10px; border-radius: 10px; background: rgba(20,34,80,.45); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.menu-card .row { display: flex; align-items: center; gap: 12px; }
.menu-card .av { flex: none; width: 44px; height: 44px; border-radius: 50%; background: linear-gradient(135deg, var(--gold), #6b1a2b); border: 1px solid var(--gold-2); display: grid; place-items: center; font-family: var(--display); font-size: 20px; color: #fff; }
.menu-card .who { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.menu-card .name { font-family: var(--display); font-size: 18px; color: var(--gold-2); line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu-card .sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu-card .xp-bar { height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; }
.menu-card .xp-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold-2)); }
.menu-card .chips { display: flex; gap: 8px; }
.menu-card .chip-i { flex: 1; width: auto; min-height: 36px; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 6px 10px; border-radius: 999px; background: rgba(6,10,23,.6); border: 1px solid var(--line); color: var(--ivory); font-size: 13px; white-space: nowrap; }
.menu-card .chip-i b { color: var(--gold-2); font-weight: 600; }
.menu-card .chip-i .u { color: var(--muted); }
.menu-card .chip-i svg { width: 16px; height: 16px; color: var(--gold); }
.menu-card .status { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #c9c3b4; }
.menu-card .status .dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.menu-card.no-status .status .dot { background: var(--muted); box-shadow: none; }
.menu-card .status .st { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-menu .menu-card .status .link-btn { width: auto; flex: none; display: inline-flex; min-height: 36px; padding: 0 8px; font-size: 12px; color: var(--gold-2); text-decoration: underline; text-underline-offset: 3px; }
.menu-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; padding: 2px 2px 4px; }
.hud-menu .menu-tiles .tile { position: relative; width: auto; min-height: 52px; height: 52px; padding: 0; border-radius: 10px; border: 1px solid var(--line); background: rgba(20,34,80,.35); color: var(--gold-2); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 10px; }
.hud-menu .menu-tiles .tile svg { width: 20px; height: 20px; color: currentColor; }
.hud-menu .menu-tiles .tile.off { color: #f2a0a0; border-color: rgba(224,90,90,.55); }
.menu-tiles .tile .badge { position: absolute; top: 4px; right: 6px; min-width: 16px; height: 16px; border-radius: 8px; background: var(--gold); color: var(--night); font-size: 10px; font-weight: 700; display: grid; place-items: center; padding: 0 4px; }
.tp-menu { top: auto; left: auto; right: calc(14px + var(--safe-r)); bottom: calc(72px + var(--safe-b)); width: 250px; transform-origin: bottom right; }
.tp-menu .tp-head { padding: 8px 12px 4px; font-family: var(--display); color: var(--gold-2); font-size: 15px; }
.tp-menu button .ic { width: 24px; text-align: center; font-size: 16px; }
body.mobile .np .bubble { max-width: min(320px, 78vw); font-size: 14px; }
.alphred-bubble { width: max-content; max-width: min(260px, 80vw) !important; }
@media (orientation: portrait) {
  body.mobile .chat { top: calc(66px + var(--safe-t)); bottom: auto; height: min(42vh, 320px); width: min(320px, calc(100vw - 24px)); }
}

/* ───── Mobile v0.4 ───── */
.hud-menu { max-height: calc(100dvh - 90px); overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; }
/* 100 % du conteneur (qui porte déjà les marges de sécurité et la place du pied de page) : avec 100dvh - 24px, le panneau
   dépassait par le haut en téléphone paysage et le titre était coupé */
#auth-panel { max-height: 100%; overflow-y: auto; }
@media (max-width: 760px) {
  .hud-tr .online-pill { display: none; }
  .hud-tl .hud-btn, .hud-tr .hud-btn { width: 40px; height: 40px; }
  .interact { left: 50%; bottom: calc(210px + var(--safe-b)); gap: 6px; }
  .interact button { min-height: 42px; font-size: 13px; padding: 0 12px 0 6px; }
  .modal-wrap { padding: calc(6px + var(--safe-t)) 6px calc(6px + var(--safe-b)); }
  .modal-card { width: 100%; }
  .recipe-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}
/* téléphone à l'horizontale (peu de hauteur) */
@media (max-height: 520px) and (pointer: coarse) {
  .minimap { width: 110px !important; height: 80px !important; top: calc(56px + var(--safe-t)) !important; bottom: auto !important; right: calc(10px + var(--safe-r)) !important; }
  .minimap canvas { width: 100%; height: 100%; }
  .kc-pill { top: calc(56px + var(--safe-t)); right: calc(130px + var(--safe-r)); left: auto; font-size: 11px; padding: 3px 8px; }
  .hud-tl, .hud-tr { top: calc(8px + var(--safe-t)); }
  .hud-btn { width: 44px; height: 44px; }
  .xp-card .ti, .xp-card .num { display: none; }
  .chat { top: calc(54px + var(--safe-t)); bottom: calc(12px + var(--safe-b)); left: calc(170px + var(--safe-l)); width: min(300px, 40vw); }
  .interact { bottom: calc(12px + var(--safe-b)); left: 50%; }
  .joy { width: 110px; height: 110px; left: calc(18px + var(--safe-l)); bottom: calc(18px + var(--safe-b)); }
  .speak-bar { top: calc(52px + var(--safe-t)); }
  .zone-banner { top: calc(60px + var(--safe-t)); }
  .modal-card { max-height: calc(100dvh - 12px); }
  .levelup, .announce { transform: translateX(-50%) scale(.8); }
}

.alphred-bubble { position: fixed; transform: translate(-50%, -100%); max-width: 260px; background: rgba(12,14,30,.92); border: 1px solid var(--gold); color: #f3ebd8; padding: 8px 12px; border-radius: 12px 12px 12px 2px; font: italic 14px Georgia, serif; z-index: 20; pointer-events: none; box-shadow: 0 6px 20px rgba(0,0,0,.5); }
.aso-badge { margin-left: 14px; padding: 3px 10px; border-radius: 999px; border: 1px solid rgba(125,255,196,.45); color: #bff5dc; font-size: 12px; background: rgba(10,40,30,.55); white-space: nowrap; }
.aso-badge b { color: #7dffc4; }
@media (max-width: 760px) { .aso-badge { display: inline-block; margin: 4px 0 0; font-size: 11px; } }
.float-prompt { position: absolute; left: 0; top: 0; z-index: 4; pointer-events: auto; cursor: pointer; background: rgba(10,12,28,.88); border: 1px solid var(--gold); color: #f3ebd8; padding: 5px 12px; border-radius: 999px; font-size: 14px; white-space: nowrap; box-shadow: 0 0 18px rgba(201,162,74,.35); }
.float-prompt b { color: var(--gold-2); margin-right: 2px; }
.race-hud { position: absolute; top: calc(70px + var(--safe-t)); left: 50%; transform: translateX(-50%); padding: 8px 18px; border-radius: 999px; font: 700 20px Figtree, sans-serif; color: #fff; border-color: #5fd0ff; }
.badge-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.badge-chip { display: inline-flex; flex-direction: column; align-items: center; gap: 2px; width: 68px; padding: 6px 2px; border-radius: 10px; background: rgba(255,255,255,.04); border: 1px solid var(--line); text-align: center; opacity: .5; }
.badge-chip.got { opacity: 1; border-color: var(--gold); background: rgba(201,162,74,.12); }
.badge-chip small { font-size: 9px; line-height: 1.1; color: var(--muted); }
.badge-chip.got small { color: var(--gold-2); }
.wolf-card { display: flex; gap: 12px; align-items: center; background: rgba(0,0,0,.3); border: 2px solid; border-radius: 12px; padding: 10px; margin: 6px 0; }
.wolf-players { display: flex; flex-wrap: wrap; gap: 6px; }
.wolf-p { padding: 4px 8px; border-radius: 8px; background: rgba(255,255,255,.05); font-size: 13px; }
.wolf-p.dead { opacity: .45; text-decoration: line-through; }

/* ═══ AlphaNet (réseau social, DA luxurious) ═══ */
.net-app { max-height: 72vh; overflow-y: auto; padding: 0 2px; }
.net-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 4px 10px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel, #0c1020); z-index: 2; }
.net-logo { font: 800 24px var(--display), serif; color: var(--gold-2); letter-spacing: .5px; }
.net-logo span { color: #9fc4ff; }
.net-me { color: var(--muted); font-size: 13px; }
.net-composer { padding: 10px 4px; border-bottom: 1px solid var(--line); }
.net-compose { width: 100%; min-height: 60px; resize: vertical; background: rgba(255,255,255,.04); border: 1px solid var(--line); border-radius: 12px; color: var(--fg, #eee); padding: 10px; font-size: 15px; }
.net-tools { display: flex; align-items: center; gap: 6px; margin-top: 8px; }
.net-attach { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.net-chip { background: rgba(201,162,74,.15); border: 1px solid var(--gold); border-radius: 999px; padding: 3px 10px; font-size: 12px; display: inline-flex; gap: 6px; align-items: center; }
.net-chip button { background: none; border: none; color: var(--muted); cursor: pointer; }
.net-feed { display: flex; flex-direction: column; }
.net-post { padding: 12px 6px; border-bottom: 1px solid var(--line); }
.net-post-head { display: flex; align-items: center; gap: 8px; }
.net-av { width: 38px; height: 38px; border-radius: 50%; background: linear-gradient(135deg, var(--gold), #6b1a2b); display: grid; place-items: center; font-weight: 700; color: #fff; font-family: var(--display), serif; }
.net-handle { color: var(--muted); font-size: 12px; }
.net-x { background: none; border: none; cursor: pointer; opacity: .5; font-size: 15px; }
.net-x:hover { opacity: 1; }
.net-text { margin: 8px 2px; font-size: 15px; line-height: 1.4; white-space: pre-wrap; word-break: break-word; }
.net-img { width: 100%; max-height: 340px; object-fit: cover; border-radius: 12px; margin-top: 6px; border: 1px solid var(--line); }
.net-event { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: rgba(95,176,255,.08); border: 1px solid rgba(95,176,255,.4); border-radius: 12px; padding: 10px; margin-top: 8px; }
.net-bar { display: flex; gap: 4px; margin-top: 8px; flex-wrap: wrap; }
.net-react { background: rgba(255,255,255,.04); border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; font-size: 13px; cursor: pointer; color: var(--fg, #ddd); }
.net-react.on { border-color: var(--gold); background: rgba(201,162,74,.18); color: var(--gold-2); }
.net-comments { margin-top: 8px; padding-left: 8px; border-left: 2px solid var(--line); }
.net-comment { font-size: 13px; margin: 4px 0; }
.net-comment-add { display: flex; gap: 6px; margin-top: 6px; }
.net-comment-add input { flex: 1; background: rgba(255,255,255,.04); border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; color: var(--fg, #eee); }
.net-photo-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.net-photo-pick img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; cursor: pointer; border: 2px solid transparent; }
.net-photo-pick img:hover { border-color: var(--gold); }

/* Perf mobile : le flou d'arrière-plan (backdrop-filter) est très coûteux sur Safari/iOS — on le retire sur tactile */
@media (pointer: coarse), (max-width: 820px) {
  .glass, .hud-btn { backdrop-filter: none !important; -webkit-backdrop-filter: none !important; background: rgba(10,14,30,.82) !important; }
}
