:root { --violet:#8B3FE0; --violet-d:#5B2AA6; --navy:#14183A; --bg:#f3ecff; --ink:#1b1b2f; }
* { box-sizing: border-box; }
html, body { margin:0; height:100%; font-family: system-ui, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--bg); overflow:hidden; }
.hidden { display:none !important; }
.screen { position:fixed; inset:0; }
.center { display:flex; overflow-y:auto; padding:12px; background: radial-gradient(circle at 30% 20%, #c9a6ff 0%, #8B3FE0 45%, #3a1c6b 100%); }
.center > .card { margin:auto; }
.card { background:#fff; border-radius:22px; padding:28px 30px; width:min(400px, 92vw); box-shadow:0 20px 60px rgba(20,24,58,.35); }
.logo { font-size:34px; font-weight:900; color:var(--violet); letter-spacing:-1px; text-align:center; }
.tagline { text-align:center; color:#6a6a86; margin:4px 0 18px; }
.tabs { display:flex; gap:6px; background:#efe8fb; padding:4px; border-radius:12px; margin-bottom:14px; }
.tab { flex:1; border:0; background:transparent; padding:9px; border-radius:9px; font-weight:700; color:#6a6a86; cursor:pointer; font-size:14px; }
.tab.active { background:#fff; color:var(--violet-d); box-shadow:0 1px 4px rgba(0,0,0,.12); }
label { display:block; font-size:13px; font-weight:700; color:#44445f; margin-bottom:12px; }
input[type=text], input[type=password] { display:block; width:100%; margin-top:5px; padding:11px 13px; border:2px solid #e2d8f5; border-radius:11px; font-size:15px; outline:none; background:#fbf9ff; }
input:focus { border-color: var(--violet); }
.btn { border:0; border-radius:12px; padding:12px 18px; font-weight:800; font-size:15px; cursor:pointer; }
.btn.primary { background: var(--violet); color:#fff; width:100%; box-shadow:0 4px 0 var(--violet-d); }
.btn.primary:active { transform: translateY(2px); box-shadow:0 2px 0 var(--violet-d); }
.btn.big { padding:15px; font-size:17px; margin-top:6px; }
.msg { min-height:20px; margin-top:10px; font-size:14px; font-weight:600; }
.msg.err { color:#c62839; } .msg.ok { color:#1f8f55; }
.small { font-size:12px; color:#7a7a96; font-weight:500; }
.card .small { text-align:center; margin:14px 0 0; }

.create-layout { display:flex; height:100%; background: linear-gradient(160deg,#efe4ff,#d9c3ff); }
.preview-wrap { flex:1; position:relative; min-width:0; }
#preview { width:100%; height:100%; display:block; cursor:grab; touch-action:none; }
.preview-hint { position:absolute; left:0; right:0; bottom:18px; text-align:center; color:#5b2aa6; font-weight:600; opacity:.75; font-size:14px; }
.panel { width:min(430px, 46vw); background:#fff; padding:22px 26px; overflow:auto; box-shadow:-10px 0 40px rgba(20,24,58,.18); }
.panel h2 { margin:0 0 6px; color:var(--violet-d); font-size:26px; }
.group { margin:14px 0; }
.group h3 { margin:0 0 8px; font-size:13px; text-transform:uppercase; letter-spacing:.06em; color:#6a6a86; }
.seg { display:flex; gap:8px; flex-wrap:wrap; }
.seg button { flex:1; min-width:90px; border:2px solid #e2d8f5; background:#fbf9ff; border-radius:11px; padding:10px 8px; font-weight:700; cursor:pointer; color:#44445f; font-size:14px; }
.seg button.sel { border-color:var(--violet); background:#efe4ff; color:var(--violet-d); }
.swatches { display:flex; gap:9px; flex-wrap:wrap; }
.sw { width:38px; height:38px; border-radius:50%; border:3px solid #fff; box-shadow:0 0 0 2px #d6cbea; cursor:pointer; padding:0; }
.sw.sel { box-shadow:0 0 0 3px var(--violet); transform:scale(1.1); }

#game { position:absolute; inset:0; width:100%; height:100%; display:block; outline:none; cursor:grab; touch-action:none; }
#hud-top { position:absolute; top:12px; left:12px; display:flex; gap:8px; align-items:center; }
.pill { background:rgba(20,24,58,.72); color:#fff; padding:8px 14px; border-radius:999px; font-weight:700; font-size:14px; backdrop-filter: blur(4px); }
.btn-pill { border:0; cursor:pointer; background:rgba(139,63,224,.9); }
#world-map { position:absolute; inset:0; z-index:40; background:rgba(15,24,42,.72); display:grid; place-items:center; padding:16px; }
.map-card { width:min(660px,96vw); max-height:96vh; overflow:auto; padding:16px; border-radius:20px; background:#fffaf1; box-shadow:0 20px 60px #10182780; }
.map-card header { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.map-card h2 { margin:0 0 10px; color:var(--violet-d); }
#map-canvas { display:block; width:min(100%, min(72vh,600px)); aspect-ratio:1; margin:auto; border:5px solid #7b5a43; border-radius:12px; background:#a5d687; }
.map-card p { margin:10px 0 0; text-align:center; font-weight:700; }
.map-dot { display:inline-block; width:13px; height:13px; border-radius:50%; margin:0 5px 0 18px; vertical-align:middle; }
.map-dot.me { background:#ed5a55; } .map-dot.other { background:#7542c9; }
.help { position:absolute; top:12px; right:12px; background:rgba(255,255,255,.82); padding:10px 14px; border-radius:14px; font-size:12.5px; line-height:1.6; max-width:340px; }
#chat { position:absolute; z-index:6; left:12px; bottom:12px; width:min(430px, 92vw); display:flex; flex-direction:column; gap:6px; pointer-events:none; }
#chat-panel { max-height:250px; overflow:hidden; border:1px solid rgba(225,232,255,.45); border-radius:16px; background:linear-gradient(145deg,rgba(24,31,65,.88),rgba(48,35,84,.82)); box-shadow:0 10px 30px rgba(18,22,46,.22); backdrop-filter:blur(12px); color:#fff; pointer-events:auto; transition:opacity .28s ease,transform .28s ease,max-height .28s ease,border-color .28s ease; }
#chat.faded #chat-panel { max-height:0; opacity:0; transform:translateY(8px); border-color:transparent; border-width:0; pointer-events:none; }
.chat-head { display:flex; align-items:center; justify-content:space-between; gap:8px; padding:7px 9px 5px 13px; font-size:12px; font-weight:800; letter-spacing:.02em; color:#f4e9ff; border-bottom:1px solid rgba(255,255,255,.14); }
#chat-pin { border:1px solid rgba(255,255,255,.3); border-radius:999px; padding:5px 9px; background:rgba(255,255,255,.12); color:#fff; font-size:11px; font-weight:700; font-family:inherit; cursor:pointer; }
#chat-pin:hover, #chat-pin[aria-pressed="true"] { background:#d9b8ff; border-color:#d9b8ff; color:#34204d; }
#chat-reopen { display:none; align-self:flex-start; border:1px solid rgba(255,255,255,.65); border-radius:999px; padding:7px 12px; background:rgba(29,34,73,.72); color:#fff; font-size:12px; font-weight:700; font-family:inherit; box-shadow:0 4px 12px rgba(20,24,58,.18); cursor:pointer; pointer-events:auto; }
#chat.faded #chat-reopen { display:block; }
#chat-log { max-height:176px; overflow-y:auto; padding:6px 8px 8px; font-size:13px; color:#fff; line-height:1.35; scrollbar-width:thin; scrollbar-color:#bba4e0 transparent; }
#chat-log .line { margin:3px 0; padding:5px 7px; border-radius:8px; background:rgba(255,255,255,.07); word-wrap:break-word; }
#chat-log .name { font-weight:800; color:#d8b8ff; } #chat-log .name.me { color:#ffe08a; }
#chat-log .sys { color:#d9f5ff; background:rgba(84,178,218,.18); border-left:2px solid #72d5ef; }
#chat-form { pointer-events:auto; } #chat-form input { margin:0; background:rgba(255,255,255,.94); border:1px solid rgba(255,255,255,.7); border-radius:12px; box-shadow:0 5px 16px rgba(20,24,58,.16); }
.overlay { position:absolute; inset:0; background:rgba(20,24,58,.7); display:flex; align-items:center; justify-content:center; }
.overlay .card { text-align:center; }

@media (max-width: 760px) { .create-layout { flex-direction:column; } .panel { width:100%; height:55%; } .help { display:none; } }

/* ===== phase 2 : garde-robe, emotes ===== */
.seg.compact button { min-width:0; flex:0 1 auto; padding:7px 11px; font-size:13px; }
#emote-bar { position:absolute; left:50%; bottom:14px; transform:translateX(-50%); display:flex; gap:8px; }
.emote-btn { border:0; background:rgba(255,255,255,.9); color:var(--violet-d); font-weight:800; padding:9px 16px; border-radius:999px; cursor:pointer; font-size:14px; box-shadow:0 2px 8px rgba(20,24,58,.25); }
.emote-btn:hover { background:#fff; }
#wardrobe { position:absolute; top:58px; right:12px; bottom:12px; width:min(450px, 96vw); background:rgba(255,255,255,.97); border-radius:20px; box-shadow:0 12px 40px rgba(20,24,58,.35); display:flex; flex-direction:column; overflow:hidden; }
#wardrobe header { display:flex; align-items:center; gap:10px; padding:12px 16px 4px; }
#wardrobe h2 { margin:0; flex:1; color:var(--violet-d); font-size:20px; }
#wardrobe .pill { background:#efe4ff; color:var(--violet-d); font-size:13px; padding:5px 12px; }
.btn-x { border:0; background:#efe4ff; color:var(--violet-d); width:30px; height:30px; border-radius:50%; cursor:pointer; font-weight:800; }
.wd-preview-wrap { height:230px; flex:none; background:linear-gradient(160deg,#efe4ff,#d9c3ff); margin:6px 14px; border-radius:14px; overflow:hidden; }
#wd-preview { width:100%; height:100%; display:block; cursor:grab; touch-action:none; }
#wd-tabs { display:flex; gap:4px; padding:4px 14px; flex-wrap:wrap; }
.wd-tab { border:0; background:#f1eafc; color:#5b2aa6; font-weight:700; font-size:12.5px; padding:6px 10px; border-radius:9px; cursor:pointer; }
.wd-tab.active { background:var(--violet); color:#fff; }
#wd-body { flex:1; overflow-y:auto; padding:6px 16px 14px; }
.wd-group { margin:10px 0; } .wd-group h4 { margin:0 0 6px; font-size:12px; text-transform:uppercase; letter-spacing:.05em; color:#6a6a86; }
.wd-grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(118px, 1fr)); gap:8px; margin:8px 0; }
.wd-card { border:2px solid #e2d8f5; border-radius:12px; padding:8px 9px; cursor:pointer; background:#fbf9ff; min-height:66px; }
.wd-card:hover { border-color:#b793f0; }
.wd-card.worn { border-color:var(--violet); background:#efe4ff; }
.wd-card.selected { box-shadow:0 0 0 3px rgba(139,63,224,.35); }
.wd-card.locked { opacity:.5; cursor:not-allowed; filter:grayscale(.8); }
.wd-name { font-weight:800; font-size:13px; line-height:1.2; }
.wd-state { font-size:11.5px; color:#6a6a86; margin-top:2px; } .wd-card.worn .wd-state { color:var(--violet-d); font-weight:700; }
.wd-price { font-size:12px; margin-top:6px; color:#6a6a86; }
.wd-dots { display:flex; gap:4px; margin-top:5px; } .wd-dot { width:14px; height:14px; border-radius:50%; border:1.5px solid rgba(0,0,0,.2); }
.wd-editor { border-top:2px dashed #e2d8f5; margin-top:10px; padding-top:8px; }
.wd-editor-head { display:flex; justify-content:space-between; align-items:center; }
.btn-small { border:0; background:var(--violet); color:#fff; font-weight:700; border-radius:9px; padding:6px 14px; cursor:pointer; }
.small-sw .sw { width:26px; height:26px; border-width:2px; }
.wd-pick { width:30px; height:28px; padding:0; border:0; background:none; cursor:pointer; }
.wd-hint { text-align:left !important; }
.wd-open .help { display:none; }
.wd-open #chat { width:min(380px, 40vw); }

/* ===== 2.1.0 : écrans tactiles ===== */
html, body { overscroll-behavior:none; -webkit-tap-highlight-color:transparent; }
#screen-game { touch-action:none; user-select:none; -webkit-user-select:none; -webkit-touch-callout:none; }
#screen-game input { user-select:text; -webkit-user-select:text; }
#wd-body, #chat-log { touch-action:pan-y; overscroll-behavior:contain; }
#touch-ui { display:none; }
.screen { height:100vh; height:100dvh; }
@media (pointer:coarse) { input[type=text], input[type=password] { font-size:16px; } }
body.touch input[type=text], body.touch input[type=password] { font-size:16px; }
@media (max-height:520px) {
  .panel { padding:12px 18px; } .panel h2 { font-size:20px; } .group { margin:8px 0; } .card { padding:18px 22px; } .logo { font-size:28px; } .tagline { margin-bottom:10px; }
}

body.touch #touch-ui { display:block; position:absolute; inset:0; pointer-events:none; z-index:5; }
body.touch #screen-game.wd-open #touch-ui, body.chat-open #touch-ui { display:none; }
#joy { position:absolute; left:max(18px, env(safe-area-inset-left)); bottom:max(24px, env(safe-area-inset-bottom)); width:148px; height:148px; border-radius:50%;
  background:rgba(255,255,255,.22); border:3px solid rgba(255,255,255,.55); box-shadow:0 4px 16px rgba(20,24,58,.25); pointer-events:auto; touch-action:none; }
#joy-knob { position:absolute; left:50%; top:50%; width:64px; height:64px; margin:-32px 0 0 -32px; border-radius:50%; background:rgba(139,63,224,.85); border:3px solid rgba(255,255,255,.85); pointer-events:none; }
#touch-btns { position:absolute; right:max(14px, env(safe-area-inset-right)); bottom:max(20px, env(safe-area-inset-bottom)); width:230px; height:250px; pointer-events:none; }
.tbtn { position:absolute; width:64px; height:64px; border-radius:50%; border:2px solid rgba(255,255,255,.7); background:rgba(20,24,58,.55); color:#fff; pointer-events:auto; touch-action:none;
  display:flex; flex-direction:column; align-items:center; justify-content:center; gap:1px; padding:0; font-weight:800; font-family:inherit; box-shadow:0 3px 10px rgba(20,24,58,.3); backdrop-filter:blur(3px); }
.tbtn i { font-style:normal; font-size:22px; line-height:1; } .tbtn span { font-size:10.5px; line-height:1.1; text-align:center; }
.tbtn:active { background:rgba(139,63,224,.9); transform:scale(.94); }
.tbtn-main { width:80px; height:80px; right:0; bottom:0; background:rgba(139,63,224,.78); } .tbtn-main i { font-size:28px; }
#tb-sit { right:92px; bottom:4px; } #tb-wave { right:6px; bottom:94px; } #tb-wardrobe { right:82px; bottom:100px; width:60px; height:60px; } #tb-chat { right:6px; bottom:170px; width:60px; height:60px; }
/* 2.13.0 : le Sac quitte le bord gauche du groupe (trop près du joystick) et passe au-dessus de Chat ; Parler au-dessus de Garde-robe */
#tb-bag { right:6px; bottom:240px; width:60px; height:60px; }
#fridge-action { position:absolute; left:50%; bottom:100px; transform:translateX(-50%); z-index:12; border:2px solid #fff; border-radius:999px; background:#237db6; color:#fff; padding:12px 18px; font-weight:800; cursor:pointer; }
#water-bag { position:absolute; right:12px; top:58px; width:min(380px,96vw); max-height:calc(100vh - 70px); overflow:auto; z-index:31; padding:18px; border-radius:18px; background:#fffdf8; box-shadow:0 15px 45px #10182780; }
#water-bag header { display:flex; justify-content:space-between; align-items:center; } #water-bag h2 { margin:0 0 16px; color:var(--violet-d); }
/* .bag-item : marqueur des emplacements remplis (2.11.0) */ .bag-item strong { color:#1973a8; }
.bag-actions { display:flex; gap:7px; flex-wrap:wrap; margin:14px 0; } .bag-actions button, #bag-give-list button, #throw-fire { border:0; border-radius:10px; padding:10px 14px; background:var(--violet); color:#fff; font-weight:800; cursor:pointer; }
.bag-actions button:disabled { opacity:.45; cursor:default; } #bag-give-list { display:grid; gap:7px; } #bag-msg { min-height:20px; font-size:13px; font-weight:700; }
#throw-aim { position:absolute; inset:0; z-index:25; touch-action:none; cursor:crosshair; color:#fff; text-shadow:0 2px 6px #000; } #throw-aim.orienting { cursor:grabbing; } #throw-aim span { position:absolute; transform:translate(-50%,-50%); pointer-events:none; font-size:64px; line-height:1; } #throw-aim small { position:absolute; left:50%; bottom:112px; transform:translateX(-50%); width:max-content; max-width:92vw; text-align:center; background:#101827a8; padding:8px 12px; border-radius:8px; pointer-events:none; } #throw-fire { position:absolute; left:50%; transform:translateX(-50%); bottom:48px; }
body.touch #water-bag { inset:0; width:100%; max-height:none; border-radius:0; padding:max(18px, env(safe-area-inset-top)) 18px max(18px, env(safe-area-inset-bottom)); }
body.touch #fridge-action { bottom:225px; max-width:55vw; font-size:12px; }

body.touch #hud-top { top:max(10px, env(safe-area-inset-top)); left:max(10px, env(safe-area-inset-left)); gap:6px; flex-wrap:wrap; max-width:calc(100vw - 20px); }
body.touch .pill { padding:6px 11px; font-size:13px; }
body.touch #btn-wardrobe, body.touch #hud-help, body.touch #emote-bar { display:none; }
body.touch #btn-logout { min-height:36px; }
body.touch #chat { left:max(10px, env(safe-area-inset-left)); top:calc(max(10px, env(safe-area-inset-top)) + 46px); bottom:auto; width:min(54vw, 360px); pointer-events:none; }
body.touch #chat-panel { pointer-events:auto; }
body.touch #chat-log { max-height:min(24vh, 150px); font-size:13px; pointer-events:auto; }
body.touch #chat-form { display:none; }
body.touch.chat-open #chat { position:fixed; left:0; right:0; top:0; width:auto; padding:max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) 8px max(8px, env(safe-area-inset-left)); background:rgba(20,24,58,.85); pointer-events:auto; z-index:20; }
body.touch.chat-open #chat-form { display:block; }
body.touch.chat-open #chat-log { max-height:28vh; }
body.touch #chat-input { height:46px; }

/* garde-robe : feuille plein écran sur mobile (écran étroit ou tactile) */
@media (max-width:760px) { #wardrobe { top:0; right:0; bottom:0; left:0; width:100%; border-radius:0; } .create-layout { overflow:hidden; } }
body.touch #wardrobe { top:0; right:0; bottom:0; left:0; width:100%; border-radius:0; padding:env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); z-index:30; }
body.touch .wd-preview-wrap { height:min(230px, 32vh); }
body.touch .btn-x { width:44px; height:44px; font-size:16px; } body.touch .wd-tab { padding:10px 12px; font-size:13.5px; } body.touch .wd-card { min-height:72px; }
body.touch .wd-grid { grid-template-columns:repeat(auto-fill, minmax(104px, 1fr)); }
body.touch .wd-pick { width:44px; height:40px; } body.touch .small-sw .sw { width:34px; height:34px; }
@media (max-width:760px) and (orientation:portrait) { .preview-wrap { min-height:38%; } .panel { height:62%; } }
@media (orientation:landscape) and (max-height:520px) { .create-layout { flex-direction:row; } .panel { width:min(430px, 56vw); height:100%; } .preview-wrap { min-height:0; } }
#tb-wardrobe span { font-size:9.5px; letter-spacing:-.2px; }

/* ===== 2.2.0 : administration en jeu (comptes admin) ===== */
.badge { background:#d6303a; color:#fff; border-radius:999px; font-size:12px; padding:1px 8px; margin-left:4px; font-weight:800; }
#btn-admin.has-pending { background:#d6303a; animation:ad-pulse 1.6s ease-in-out infinite; }
@keyframes ad-pulse { 50% { box-shadow:0 0 0 6px rgba(214,48,58,.3); } }
#admin-panel { position:absolute; top:58px; right:12px; bottom:12px; width:min(450px, 96vw); background:rgba(255,255,255,.97); border-radius:20px; box-shadow:0 12px 40px rgba(20,24,58,.35); display:flex; flex-direction:column; overflow:hidden; z-index:12; }
#admin-panel header { display:flex; align-items:center; gap:10px; padding:12px 16px 4px; }
#admin-panel h2 { margin:0; flex:1; color:var(--violet-d); font-size:20px; }
#ad-tabs { display:flex; gap:4px; padding:4px 14px; flex-wrap:wrap; }
#ad-body { flex:1; overflow-y:auto; padding:6px 16px 14px; touch-action:pan-y; overscroll-behavior:contain; }
.ad-row { display:flex; align-items:center; gap:10px; padding:10px 0; border-bottom:1px solid #eee6fb; }
.ad-who { flex:1; min-width:0; display:flex; flex-wrap:wrap; align-items:baseline; gap:2px 8px; } .ad-who b { font-size:15px; overflow-wrap:anywhere; } .ad-who small { flex-basis:100%; color:#7a7a96; font-size:11.5px; }
.ad-act { display:flex; gap:6px; flex:none; }
.btn-small.ok { background:#2e9e5b; } .btn-small.no { background:#d6303a; }
.tag { font-size:11px; font-weight:800; border-radius:999px; padding:2px 8px; background:#eee; color:#444; } .tag.pending { background:#fff0c9; color:#7a5200; } .tag.approved { background:#d9f5e3; color:#1d6b3c; } .tag.rejected { background:#fde0e2; color:#9b1c25; }
.ad-gift { display:flex; flex-direction:column; gap:10px; margin:8px 0; }
.ad-gift select { padding:11px 12px; border:2px solid #e2d8f5; border-radius:11px; font-size:15px; background:#fbf9ff; font-family:inherit; }
.ad-gift .btn-small { padding:11px 14px; font-size:15px; }
.muted { color:#7a7a96; }
#ad-body .msg { margin-top:10px; min-height:20px; } #ad-body .msg.ok { color:#1d6b3c; font-weight:700; } #ad-body .msg.err { color:#b3202a; font-weight:700; }
#admin-toast { position:absolute; top:max(56px, calc(env(safe-area-inset-top) + 50px)); left:50%; transform:translateX(-50%); max-width:min(92vw, 420px); z-index:40; border:2px solid #fff; background:#5B2AA6; color:#fff; padding:12px 18px; border-radius:14px; font-weight:800; font-size:14px; line-height:1.3; font-family:inherit; cursor:pointer; box-shadow:0 10px 30px rgba(0,0,0,.35); animation:ad-pop .25s ease-out; }
@keyframes ad-pop { from { transform:translateX(-50%) translateY(-12px); opacity:0; } }
.ad-open .help { display:none; }
@media (max-width:760px) { #admin-panel { top:0; right:0; bottom:0; left:0; width:100%; border-radius:0; } }
body.touch #admin-panel { top:0; right:0; bottom:0; left:0; width:100%; border-radius:0; padding:env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); z-index:30; }
body.touch #screen-game.ad-open #touch-ui { display:none; }
body.touch #btn-admin { min-height:38px; }
body.touch .ad-act .btn-small { min-height:44px; min-width:76px; font-size:14px; }
body.touch .ad-gift select { min-height:48px; font-size:16px; }
body.touch #ad-tabs .wd-tab { padding:10px 12px; font-size:13.5px; }

/* ===== 2.3.0 : reconnexion silencieuse ===== */
#net-banner { position:fixed; top:max(10px, env(safe-area-inset-top)); left:50%; transform:translateX(-50%); z-index:60; background:rgba(20,24,58,.88); color:#fff; padding:8px 16px; border-radius:999px; font-weight:700; font-size:14px; pointer-events:none; }

/* ===== 2.4.0 : cinéma ===== */
#cinema-layer { position:absolute; inset:0; overflow:hidden; pointer-events:none; background:#000; }
#cinema-bg { position:absolute; inset:0; background:#000; }
#cinema-frame { position:absolute; left:0; top:0; width:1280px; height:720px; border:0; background:#000; transform-origin:0 0; pointer-events:none; }
#vol-pop { position:absolute; top:58px; left:12px; z-index:15; width:min(300px, 90vw); background:rgba(255,255,255,.96); border-radius:14px; padding:12px 14px; box-shadow:0 8px 28px rgba(20,24,58,.35); }
#vol-pop label { display:flex; justify-content:space-between; font-weight:800; font-size:14px; color:var(--violet-d); margin:0 0 8px; }
#vol-pop input[type=range] { width:100%; height:32px; margin:0; accent-color:var(--violet); touch-action:pan-x; }
#vol-pop small { display:block; margin-top:6px; color:#6a6a86; font-size:12px; line-height:1.35; }
body.touch #vol-pop { top:calc(max(10px, env(safe-area-inset-top)) + 46px); left:max(10px, env(safe-area-inset-left)); }
#btn-sound { position:absolute; left:50%; bottom:max(70px, calc(env(safe-area-inset-bottom) + 60px)); transform:translateX(-50%); z-index:18; border:2px solid #fff; background:#d6303a; color:#fff; font-weight:800; font-size:16px; padding:12px 20px; border-radius:999px; cursor:pointer; box-shadow:0 8px 24px rgba(0,0,0,.4); font-family:inherit; }
#cinema-hint { display:none; position:absolute; left:50%; bottom:max(14px, env(safe-area-inset-bottom)); transform:translateX(-50%); z-index:8; background:rgba(0,0,0,.6); color:#fff; padding:8px 16px; border-radius:999px; font-size:13px; font-weight:600; pointer-events:none; white-space:nowrap; }
#cinema-hint .t { display:none; }
body.cinema-view #cinema-hint { display:block; } body.cinema-view.touch #cinema-hint { display:none; }
body.cinema-view #hud-help, body.cinema-view #emote-bar, body.cinema-view #chat { display:none; }
body.cinema-view #joy, body.cinema-view #tb-jump, body.cinema-view #tb-wave, body.cinema-view #tb-wardrobe, body.cinema-view #tb-bag, body.cinema-view #tb-chat { display:none; }
body.cinema-view.touch #hud-top { opacity:.85; }
#ad-cin-form label { display:block; } #ad-cin-form select, #ad-cin-form input[type=text] { width:100%; } #ad-cin-vol { display:block; width:100%; height:32px; margin:6px 0 0; accent-color:var(--violet); }

/* ===== 2.4.1 : mode « aide son » (iOS : le son ne démarre que sur un toucher dans l'iframe) ===== */
body.cinema-tw #cinema-layer, body.cinema-tw.cinema-assist #cinema-layer { z-index: 6; background: transparent; } /* au-dessus de #touch-ui (z 5, transparent mais recouvrant : Twitch le prend pour un obstacle et refuse de démarrer) */
body.cinema-tw #cinema-bg { display: none; }
body.cinema-tw #cinema-frame { pointer-events: auto; transform-origin: 0 0; }
.tw-away { visibility: hidden !important; }
body.cinema-tw #screen-game { background: #000; } /* 2.4.3 : Twitch passe devant le canvas (lecteur réellement visible, sinon pas d'autoplay) */
body.cinema-assist #cinema-layer { z-index: 4; background: transparent; }
body.cinema-assist #cinema-bg { display: none; }
body.cinema-assist #cinema-frame { pointer-events: auto; }
body.cinema-assist #btn-sound { bottom: auto; top: calc(max(10px, env(safe-area-inset-top)) + 54px); background: #1d6fe0; max-width: 92vw; }
body.touch #btn-sound { bottom: max(170px, calc(env(safe-area-inset-bottom) + 160px)); }
body.touch.cinema-assist #btn-sound { bottom: auto; }

body.cinema-assist #joy, body.cinema-assist #tb-jump, body.cinema-assist #tb-wave, body.cinema-assist #tb-wardrobe, body.cinema-assist #tb-bag, body.cinema-assist #tb-chat { display:none; } /* le lecteur agrandi reste entièrement touchable */
body.cinema-assist #screen-game, body.cinema-view #screen-game { background:#000; } /* zones transparentes du canvas (ciel au-dessus de la salle) : noir, pas le fond de page */

/* 2.5.0 : chat vocal de proximité */
#voice-pill { font-size:13px; } #voice-pill.live { background:#d6303a; }
#tb-mic { right:82px; bottom:170px; width:60px; height:60px; } #tb-mic.live { background:rgba(214,48,58,.92); }
body.cinema-assist #tb-mic { display:none; }
body.cinema-view #tb-mic { right:164px; bottom:4px; width:64px; height:64px; z-index:5; } /* 2.6.2 : assis au cinéma, « Parler » à côté de « Se lever » */
/* 2.10.0 : salle de jeux */
#table-action { position:absolute; left:50%; bottom:150px; transform:translateX(-50%); z-index:12; border:2px solid #fff; border-radius:999px; background:#2f6b4f; color:#fff; padding:12px 18px; font-weight:800; box-shadow:0 6px 18px rgba(0,0,0,.25); cursor:pointer; }
body.touch #table-action { bottom:280px; max-width:70vw; font-size:13px; }
#gt-overlay { position:fixed; inset:0; z-index:60; display:flex; flex-direction:column; background:#10261c; }
#gt-overlay .gt-bar { flex:0 0 auto; display:flex; justify-content:space-between; align-items:center; gap:10px; padding:max(8px, env(safe-area-inset-top)) 12px 8px; background:#2f6b4f; color:#fff; font-size:16px; }
#gt-stand { border:2px solid #fff; border-radius:999px; background:#fff; color:#2f6b4f; font-weight:800; padding:10px 18px; font-size:15px; cursor:pointer; min-height:44px; }
#gt-body { flex:1 1 auto; overflow:auto; position:relative; -webkit-overflow-scrolling:touch; }
#gt-body > div { min-height:100%; }
#gt-chess #btn-fullscreen, #gt-chess [data-mode="2player"], #gt-chess .board-controls, #gt-chess .mode-panel h2 { display:none !important; }
#gt-chess .mode-buttons { grid-template-columns:1fr !important; }
body.game-open #joy, body.game-open .tbtn, body.game-open #chat, body.game-open #hud-help { display:none !important; }
#gt-overlay #gt-body [hidden] { display:none; }
/* 2.11.0 : sac générique avec miniatures */
.visually-hidden { position:absolute !important; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap; }
.bag-grid { display:grid; grid-template-columns:repeat(4, 1fr); gap:8px; margin-bottom:12px; }
.bag-slot { position:relative; aspect-ratio:1; border-radius:12px; border:2px solid #d9cfe6; background:#f3eff8; display:flex; align-items:center; justify-content:center; padding:6px; cursor:pointer; }
.bag-slot.empty { cursor:default; background:#f8f6fb; border-style:dashed; }
.bag-slot.selected { border-color:var(--violet-d); background:#e8f6fc; box-shadow:0 0 0 3px rgba(124,58,237,.18); }
.bag-slot img { max-width:78%; max-height:78%; object-fit:contain; pointer-events:none; }
.bag-slot .qty { position:absolute; right:4px; bottom:2px; min-width:22px; padding:1px 6px; border-radius:999px; background:#2b2140; color:#fff; font-size:12px; font-weight:800; text-align:center; }
.bag-detail-head { display:flex; gap:14px; align-items:center; padding:12px; border-radius:14px; background:#e8f6fc; }
.bag-detail-head img { width:56px; height:56px; object-fit:contain; } .bag-detail-head p { margin:4px 0; font-size:13px; }
body.touch .bag-grid { grid-template-columns:repeat(4, 1fr); gap:10px; }
/* 2.12.0 : sandwich du frigo et pommes */
#fridge-sandwich, #apple-action { position:absolute; left:50%; transform:translateX(-50%); z-index:12; border:2px solid #fff; border-radius:999px; color:#fff; padding:12px 18px; font-weight:800; box-shadow:0 6px 18px rgba(0,0,0,.25); cursor:pointer; }
#fridge-sandwich { bottom:160px; background:#c9822f; } #apple-action { bottom:100px; background:#c23a2c; }
body.touch #fridge-sandwich { bottom:280px; max-width:55vw; font-size:12px; } body.touch #apple-action { bottom:225px; max-width:60vw; font-size:13px; }

/* 2.13.0 : HUD mobile compact (icônes), Déconnexion = icône Power en haut à droite */
#btn-logout .ico { display:none; }
body.touch #hud-top { flex-wrap:nowrap; gap:6px; max-width:calc(100vw - 120px); overflow:hidden; }
body.touch #hud-top .pill { padding:0 10px; height:38px; min-height:38px; display:inline-flex; align-items:center; font-size:13px; white-space:nowrap; flex:none; }
body.touch #hud-user { max-width:30vw; overflow:hidden; text-overflow:ellipsis; display:block !important; line-height:38px; flex:none !important; }
body.touch #hud-top .lbl { display:none; }
body.touch #btn-map, body.touch #btn-vol { width:40px; padding:0 !important; justify-content:center; font-size:18px !important; }
body.touch #btn-bag, body.touch #chat-reopen { display:none !important; }
body.touch #btn-admin, body.touch #btn-logout { position:fixed; top:max(10px, env(safe-area-inset-top)); width:40px; height:40px; min-height:40px; padding:0; justify-content:center; font-size:18px; z-index:7; }
body.touch #btn-logout { right:max(10px, env(safe-area-inset-right)); background:rgba(190,40,52,.85); }
body.touch #btn-admin { right:calc(max(10px, env(safe-area-inset-right)) + 48px); }
body.touch #btn-admin .badge { position:absolute; top:-4px; right:-4px; }
body.touch #btn-logout .ico { display:inline; font-size:20px; line-height:1; }
body.touch #btn-logout .lbl { display:none; }
body.touch #voice-pill { position:fixed; right:max(10px, env(safe-area-inset-right)); top:calc(max(10px, env(safe-area-inset-top)) + 48px); max-width:36vw; white-space:normal; font-size:11.5px; line-height:1.25; padding:6px 10px; height:auto; z-index:6; }
body.touch #chat { top:calc(max(10px, env(safe-area-inset-top)) + 48px); width:min(58vw, 360px); }
body.touch #vol-pop { top:calc(max(10px, env(safe-area-inset-top)) + 48px); }
/* actions contextuelles : toutes à DROITE, au-dessus de l'arc, jamais près du joystick */
body.touch #fridge-action, body.touch #apple-action, body.touch #fridge-sandwich, body.touch #table-action, body.touch #btn-sound, body.touch #throw-fire { left:auto; right:max(14px, env(safe-area-inset-right)); transform:none; max-width:min(58vw, 260px); font-size:13px; text-align:right; }
body.touch #fridge-action, body.touch #apple-action, body.touch #btn-sound { bottom:calc(max(20px, env(safe-area-inset-bottom)) + 310px); }
body.touch #fridge-sandwich, body.touch #table-action { bottom:calc(max(20px, env(safe-area-inset-bottom)) + 362px); }
body.touch #throw-fire { bottom:calc(max(20px, env(safe-area-inset-bottom)) + 8px); min-width:96px; min-height:56px; font-size:16px; }
body.touch.cinema-assist #btn-sound { right:auto; left:50%; transform:translateX(-50%); }
@media (max-width:400px) { body.touch #joy { width:136px; height:136px; } }
/* 2.13.0 : table de jeu défilable sur téléphone, échiquier adapté à l'écran, barre « Se lever » fixe */
#gt-overlay { height:100vh; height:100dvh; }
#gt-body { touch-action:pan-y; overscroll-behavior:contain; min-height:0; }
#gt-overlay #gt-chess, #gt-overlay #gt-blackjack { min-height:0; padding-bottom:max(24px, env(safe-area-inset-bottom)); }
@media (max-width:760px) {
  #gt-chess #chess-container { width:min(100%, calc(100dvh - 300px)) !important; height:auto !important; margin:0 auto; }
  #gt-overlay .gt-bar b { font-size:14px; line-height:1.2; }
  #gt-stand { padding:8px 14px; white-space:nowrap; }
}
@media (max-width:760px) { #gt-chess > .container > header, #gt-chess header:first-of-type { display:none; } }
#gt-overlay #gt-chess, #gt-overlay #gt-blackjack { overflow-x:clip; overflow-y:visible; } /* pas de second conteneur défilant : le doigt fait défiler #gt-body */
@media (max-width:760px) {
  #gt-overlay #gt-chess .sidebar.left, #gt-overlay #gt-chess .sidebar.right { display:flex; flex-direction:column; gap:.75rem; }
  #gt-overlay #gt-chess .panel { height:auto !important; max-height:none !important; min-height:0 !important; overflow:visible !important; }
  #gt-overlay #gt-chess .container, #gt-overlay #gt-chess .chess-main { min-height:0; }
}
body.touch #btn-wardrobe { display:none !important; }
