* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
@font-face { font-family: 'Baloo 2'; src: url('fonts/Baloo2.ttf') format('truetype'); font-weight: 400 800; font-display: swap; }
body { background: #0b1c30; font-family: 'Baloo 2', 'Segoe UI', system-ui, sans-serif; color: #eaf6ff; overflow: hidden; }
button, input, select, textarea { font-family: inherit; }
#scaler { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; }
#stage { position: relative; width: 800px; height: 600px; flex: none; transform-origin: center center; border-radius: 6px; overflow: hidden; box-shadow: 0 10px 50px rgba(0,0,0,.6); background: #123; }
.screen { position: absolute; inset: 0; }
.hidden { display: none !important; }
.dlg { position: absolute; inset: 0; background: rgba(2, 20, 45, .55); display: flex; align-items: center; justify-content: center; z-index: 300; }
.dlg-panel { width: 340px; background: linear-gradient(#2f8fe8, #1663b8); border: 2px solid #9fdcff; border-radius: 14px; padding: 18px 20px 16px; box-shadow: 0 10px 34px rgba(0,0,0,.5); max-height: 584px; overflow-y: auto; }
.dlg-title { font-size: 17px; font-weight: 900; color: #fff; text-align: center; letter-spacing: .5px; text-shadow: 0 1px 3px rgba(0,0,0,.45); margin-bottom: 12px; }
.dlg-panel input { width: 100%; box-sizing: border-box; font-size: 15px; font-weight: 600; padding: 9px 11px; border-radius: 9px; border: 2px solid #0b4d86; background: #eaf7ff; color: #0a2c4c; outline: none; }
.dlg-btns { display: flex; gap: 10px; margin-top: 14px; }
.dlg-btn { flex: 1; height: 38px; border-radius: 10px; font-size: 14px; font-weight: 900; cursor: pointer; border: 2px solid #9fdcff; }
.dlg-btn.primary { background: linear-gradient(#ffd76a, #ffb400); color: #4a2c00; border-color: #ffe9a8; box-shadow: 0 3px 0 #a86e00; }
.dlg-btn.ghost { background: rgba(6, 52, 110, .55); color: #cfeaff; box-shadow: 0 3px 0 #0b4d86; }
.dlg-btn:active { transform: translateY(2px); box-shadow: none; }
.stagebg { position: absolute; inset: 0; width: 800px; height: 600px; user-select: none; -webkit-user-drag: none; }
.spr { display: inline-block; background-repeat: no-repeat; }
.sprbtn { cursor: pointer; user-select: none; }
.sprbtn.dis { cursor: default; filter: saturate(.4) brightness(.85); }
.abs { position: absolute; }
#toast { position: absolute; left: 50%; bottom: 64px; transform: translateX(-50%); background: rgba(6,30,56,.92); border: 2px solid #35a7e8; color: #fff; padding: 8px 18px; border-radius: 10px; font-weight: 600; display: none; z-index: 50; max-width: 90%; text-align: center; }

/* ---------- LOGIN ---------- */
#scr-login { background: radial-gradient(1100px 480px at 50% -8%, #2f8fe8 0%, #1663b8 48%, #0a3d75 100%); display: flex; align-items: center; justify-content: center; }
.login-panel { position: relative; z-index: 1; width: 384px; background: linear-gradient(180deg, rgba(10, 54, 105, .94), rgba(6, 36, 75, .94)); border: 2px solid #57b6ff; border-radius: 16px; padding: 26px 28px 20px; text-align: center; box-shadow: inset 0 2px 0 rgba(255,255,255,.25), 0 10px 34px rgba(0,20,50,.5); }
.login-title { font-size: 29px; font-weight: 900; letter-spacing: .5px; line-height: 1.1; background: linear-gradient(#ffe27a, #ffb400); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 2px 0 rgba(122, 62, 0, .55)); }
.login-sub { color: #bfe3ff; font-size: 14px; font-weight: 700; letter-spacing: 1px; margin: 7px 0 18px; }
.login-panel label { display: block; text-align: left; font-weight: 700; color: #dff3ff; font-size: 13px; margin-bottom: 5px; }
#nameInput { width: 100%; font-size: 17px; padding: 11px 12px; border-radius: 9px; border: 2px solid #57b6ff; background: #eaf7ff; color: #0a2c4c; font-weight: 600; outline: none; }
#nameInput:focus { border-color: #ffd76a; box-shadow: 0 0 0 3px rgba(255, 183, 0, .35); }
.login-btn { width: 100%; height: 48px; margin-top: 15px; font-size: 18px; font-weight: 900; letter-spacing: 1px; border-radius: 11px; border: 2px solid #ffe9a8; background: linear-gradient(#ffd76a, #ffb400); color: #4a2c00; box-shadow: 0 3px 0 #a86e00; cursor: pointer; }
.login-btn:active { transform: translateY(2px); box-shadow: none; }
.login-note { margin-top: 14px; color: #a8d4f5; font-size: 12px; line-height: 1.5; }

/* ---------- LOBBY ---------- */
#scr-lobby { background: radial-gradient(1100px 480px at 50% -8%, #2f8fe8 0%, #1663b8 48%, #0a3d75 100%); }
.lob-head { position: absolute; left: 0; top: 0; width: 800px; height: 64px; display: flex; align-items: center; justify-content: space-between; padding: 0 22px; background: linear-gradient(180deg, rgba(4, 30, 66, .5), rgba(4, 30, 66, 0)); }
.lob-logo { font-size: 29px; font-weight: 900; letter-spacing: 1px; line-height: 1; background: linear-gradient(#ffe27a, #ffb400); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 2px 0 rgba(122, 62, 0, .55)); }
.lob-sub { font-size: 10px; font-weight: 700; letter-spacing: 3.5px; color: #bfe3ff; -webkit-text-fill-color: #bfe3ff; margin-top: 3px; }
.chan-name { padding: 6px 16px; display: flex; align-items: center; justify-content: center; font-size: 12.5px; font-weight: 800; letter-spacing: .5px; color: #dff3ff; text-shadow: 0 1px 2px #000; white-space: nowrap; background: rgba(4, 42, 92, .6); border: 1.5px solid rgba(90, 180, 255, .4); border-radius: 12px; }
.profile-card { position: absolute; left: 24px; top: 84px; width: 150px; padding: 12px 10px 11px; text-align: center; background: linear-gradient(180deg, #1063ad, #0a4680); border: 2px solid #57b6ff; border-radius: 12px; box-shadow: inset 0 2px 0 rgba(255,255,255,.25), 0 4px 14px rgba(0,20,50,.35); }
#myFace { width: 54px; height: 54px; border-radius: 12px; background: rgba(6, 52, 110, .5); border: 2px solid rgba(120, 200, 255, .5); }
.myname { margin-top: 7px; font-size: 14.5px; font-weight: 800; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.6); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mywins { margin-top: 5px; display: inline-block; font-size: 11.5px; color: #ffe27a; background: rgba(2, 32, 71, .55); padding: 2px 9px; border-radius: 10px; white-space: nowrap; }
.users-panel { position: absolute; left: 24px; top: 228px; width: 150px; height: 356px; display: flex; flex-direction: column; padding: 10px; background: linear-gradient(180deg, #1063ad, #0a4680); border: 2px solid #57b6ff; border-radius: 12px; box-shadow: inset 0 2px 0 rgba(255,255,255,.25), 0 4px 14px rgba(0,20,50,.35); }
.users-head { font-size: 12px; font-weight: 900; letter-spacing: 1.5px; color: #9fd8ff; text-align: center; margin-bottom: 8px; }
.userlist { flex: 1; overflow-y: auto; scrollbar-width: thin; }
.userlist .u { font-size: 12px; height: 20px; line-height: 20px; margin-bottom: 3px; padding: 0 6px 0 8px; color: #dff3ff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-radius: 4px; }
.userlist .u.me { background: rgba(255,216,61,.25); font-weight: 700; color: #fff; }
.userlist .u .w { color: #ffd83d; font-size: 11px; }
.userlist .u .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #e84d2f; margin-right: 6px; }
.userlist .u .dot.on { background: #2fbf71; box-shadow: 0 0 5px rgba(47, 191, 113, .9); }
.userlist .u.off { opacity: .5; }
.roompanel { position: absolute; left: 190px; top: 84px; width: 586px; padding: 12px; background: linear-gradient(180deg, #1063ad, #0a4680); border: 2px solid #57b6ff; border-radius: 12px; box-shadow: inset 0 2px 0 rgba(255,255,255,.25), 0 4px 14px rgba(0,20,50,.35); }
.roompanel-head { display: flex; justify-content: space-between; align-items: baseline; margin: 0 2px 10px; font-size: 13px; font-weight: 900; letter-spacing: 1.5px; color: #dff3ff; }
.rp-create { padding: 5px 12px; font-size: 12px; font-weight: 900; letter-spacing: .5px; border-radius: 8px; border: 2px solid #ffe9a8; background: linear-gradient(#ffd76a, #ffb400); color: #4a2c00; box-shadow: 0 2px 0 #a86e00; cursor: pointer; }
.rp-create:active { transform: translateY(2px); box-shadow: none; }
.roomgrid { height: 196px; display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: repeat(2, 1fr); gap: 8px; }
.roomcard { background: rgba(4, 42, 92, .55); border: 2px solid rgba(90, 180, 255, .35); border-radius: 10px; padding: 9px 12px; cursor: pointer; transition: border-color .12s, background .12s; position: relative; display: flex; flex-direction: column; justify-content: center; min-width: 0; overflow: hidden; }
.roomcard:hover { border-color: #57c1ff; background: rgba(120,200,255,.12); }
.roomcard .rn { font-weight: 800; font-size: 15px; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.7); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 98px; }
.roomcard .rm { font-size: 12px; color: #bfe3ff; margin-top: 3px; }
.roomcard .rs { position: absolute; right: 10px; top: 22px; font-size: 11.5px; font-weight: 800; padding: 2px 8px; border-radius: 20px; background: #2fbf71; color: #04240f; }
.roomcard .rs.play { background: #ffb400; }
.roomcard.empty { cursor: default; display: flex; align-items: center; justify-content: center; color: rgba(220,240,255,.35); font-weight: 700; letter-spacing: 2px; }
.roomcard.empty:hover { border-color: transparent; background: transparent; }
.roomcard.create-card { background: linear-gradient(#ffd76a, #ffb400); border-color: #ffe9a8; align-items: center; justify-content: center; cursor: pointer; box-shadow: 0 3px 0 #a86e00; }
.roomcard.create-card:active { transform: translateY(2px); box-shadow: none; }
.create-card .cc-t { font-size: 17px; font-weight: 900; letter-spacing: .5px; color: #4a2c00; }
.create-card .cc-s { font-size: 11.5px; font-weight: 700; color: #7a5200; margin-top: 3px; }
.ca-btn { background: linear-gradient(#4db2ff, #1673c9); border: 2px solid #9fdcff; border-radius: 12px; color: #fff; font-weight: 900; font-size: 15px; padding: 10px 14px; cursor: pointer; box-shadow: 0 3px 0 #0b4d86; line-height: 1.15; }
.ca-btn span { font-size: 11px; font-weight: 600; color: #d6efff; }
.ca-btn:active { transform: translateY(2px); box-shadow: none; }

.chatbox { position: absolute; overflow-y: auto; scrollbar-width: thin; padding: 6px 10px; font-size: 13px; line-height: 1.45; color: #eaf6ff; background: rgba(3, 32, 68, .55); border: 2px solid rgba(90, 180, 255, .35); border-radius: 10px; }
.chatbox .ln b { color: #ffd83d; }
.chatbox .ln.sys { color: #9fd8ff; font-style: italic; }
.lobby-chat { left: 190px; top: 346px; width: 586px; height: 198px; }
.room-chat-panel { position: absolute; left: 24px; top: 364px; width: 452px; height: 220px; display: flex; flex-direction: column; gap: 8px; padding: 12px; background: linear-gradient(180deg, #1063ad, #0a4680); border: 2px solid #57b6ff; border-radius: 12px; box-shadow: inset 0 2px 0 rgba(255,255,255,.25), 0 4px 14px rgba(0,20,50,.35); }
.room-chat { position: static; flex: 1; width: auto; height: auto; }
.room-chat-row { display: flex; gap: 8px; align-items: center; }
.chat-tag { position: absolute; left: 190px; top: 552px; width: 105px; height: 26px; display: flex; align-items: center; justify-content: center; font-size: 12.5px; font-weight: 700; color: #cfeaff; background: #0a3d75; border: 1.5px solid rgba(120, 200, 255, .5); border-radius: 12px; }
.room-tag { position: static; flex: none; width: 92px; height: 29px; }
.chatin { position: absolute; height: 22px; background: rgba(234,247,255,.95); border: 2px solid #57b6ff; border-radius: 8px; padding: 0 9px; line-height: 22px; font-size: 13px; color: #0a2c4c; outline: none; }
.lobby-chatin { left: 303px; top: 552px; width: 473px; height: 26px; line-height: 26px; }
.room-chatin { position: static; flex: 1; width: auto; height: 29px; line-height: 29px; }

/* ---------- ROOM ---------- */
#scr-room { background: radial-gradient(1100px 480px at 50% -8%, #2f8fe8 0%, #1663b8 48%, #0a3d75 100%); }
.room-head { position: absolute; left: 0; top: 0; width: 800px; height: 56px; display: flex; align-items: center; justify-content: space-between; padding: 0 20px; background: linear-gradient(180deg, rgba(4, 30, 66, .5), rgba(4, 30, 66, 0)); }
.room-title { max-width: 560px; padding: 8px 16px; font-size: 16px; font-weight: 900; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.55); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: rgba(4, 42, 92, .6); border: 1.5px solid rgba(90, 180, 255, .4); border-radius: 10px; }
.exit-btn { flex: none; padding: 8px 16px; font-size: 13px; font-weight: 900; letter-spacing: .5px; color: #fff; background: linear-gradient(#ff7a6b, #d8342c); border: 2px solid #ffb3ab; border-radius: 10px; box-shadow: 0 3px 0 #8f1d16; cursor: pointer; }
.exit-btn:active { transform: translateY(2px); box-shadow: none; }
.slots-panel { position: absolute; left: 24px; top: 68px; width: 452px; padding: 14px; background: linear-gradient(180deg, #1063ad, #0a4680); border: 2px solid #57b6ff; border-radius: 12px; box-shadow: inset 0 2px 0 rgba(255,255,255,.25), 0 4px 14px rgba(0,20,50,.35); }
.slotgrid { display: grid; grid-template-columns: repeat(4, 1fr); grid-template-rows: 1fr 1fr; gap: 8px; }
.slot { position: relative; height: 124px; display: flex; flex-direction: column; background: rgba(4, 42, 92, .5); border: 2px solid rgba(90, 180, 255, .3); border-radius: 10px; }
.slot .face { position: relative; flex: 1; display: flex; align-items: flex-end; justify-content: center; }
.slot .slotcv { display: block; }
.slot .bar { margin: 4px 4px 5px; height: 17px; line-height: 17px; text-align: center; font-size: 11.5px; font-weight: 700; color: #eaf6ff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: rgba(2, 32, 71, .6); border-radius: 5px; }
.slot .badge { position: absolute; right: 4px; top: 4px; font-size: 10px; font-weight: 900; padding: 2px 6px; border-radius: 4px; background: #2fbf71; color: #04240f; display: none; z-index: 3; }
.slot.ready .badge { display: block; }
.slot .crown { position: absolute; left: 4px; top: 2px; font-size: 15px; display: none; z-index: 3; }
.slot.host .crown { display: block; }
.slot .bot-tag { position: absolute; left: 4px; bottom: 27px; font-size: 10px; background: rgba(0,0,0,.45); padding: 1px 5px; border-radius: 4px; color: #bfe3ff; z-index: 3; }
.slot.addbot { cursor: pointer; }
.slot.addbot:hover { border-color: #ffd76a; }
.slot.empty.addbot .face::after { content: '＋'; color: #ffd76a; font-size: 26px; font-weight: 900; }
.slot.addbot .bar { color: #ffd76a; }
.bot-x { position: absolute; left: 4px; top: 4px; width: 16px; height: 16px; border-radius: 50%; background: rgba(216, 52, 44, .92); color: #fff; font-size: 10px; font-weight: 900; line-height: 16px; text-align: center; cursor: pointer; z-index: 5; }
.slot.empty .face::after { content: '—'; color: rgba(255,255,255,.35); font-size: 22px; align-self: center; }
.char-panel { position: absolute; left: 492px; top: 68px; width: 284px; height: 232px; text-align: center; background: linear-gradient(180deg, #1063ad, #0a4680); border: 2px solid #57b6ff; border-radius: 12px; box-shadow: inset 0 2px 0 rgba(255,255,255,.25), 0 4px 14px rgba(0,20,50,.35); padding: 10px; display: flex; flex-direction: column; align-items: center; }
.char-panel canvas { margin-top: 0; flex: none; }
.char-name { font-weight: 900; font-size: 16px; line-height: 19px; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.6); margin-top: -38px; flex: none; }
.char-stats { font-size: 12.5px; color: #bfe3ff; width: 100%; flex: none; margin-top: 1px; }
.char-nav { position: absolute; top: 64px; width: 34px; height: 44px; border: none; border-radius: 10px; background: rgba(10, 40, 80, .55); color: #fff; font-size: 17px; cursor: pointer; z-index: 3; }
.char-nav:hover { background: rgba(255, 170, 40, .85); }
.char-nav.prev { left: 12px; }
.char-nav.next { right: 12px; }
.csrow { display: flex; align-items: center; justify-content: center; gap: 5px; font-size: 11px; line-height: 14.5px; color: #eaf6ff; flex-wrap: nowrap; }
.csrow span:first-child { width: 46px; text-align: right; font-weight: 700; white-space: nowrap; }
.csrow .doton { color: #ffb63d; white-space: nowrap; }
.csrow .dotoff { color: rgba(255,255,255,.35); white-space: nowrap; }
.cswins { margin-top: 2px; font-size: 11px; color: #bfe3ff; }
.char-name .cw { font-size: 12px; color: #ffd76a; font-weight: 700; }
.team-tag { position: absolute; top: 25px; right: 4px; width: 20px; height: 20px; border-radius: 50%; color: #fff; font-weight: 900; font-size: 12px; line-height: 20px; text-align: center; z-index: 4; }
.team-tag.t0, .tchip.t0 { background: #2470d8; }
.team-tag.t1, .tchip.t1 { background: #d8342c; }
.tchip { display: inline-block; width: 15px; height: 15px; border-radius: 50%; color: #fff; font-size: 10px; font-weight: 900; line-height: 15px; text-align: center; vertical-align: 1px; }
.team-panel { position: absolute; left: 492px; top: 308px; width: 284px; height: 52px; display: flex; gap: 8px; align-items: center; justify-content: center; background: rgba(4, 42, 92, .55); border: 2px solid rgba(90, 180, 255, .35); border-radius: 10px; padding: 8px 10px; }
.team-btn { flex: 1; height: 32px; padding: 0; display: flex; align-items: center; justify-content: center; background: #0d4d86; color: #9fc6e8; border: 2px solid #2f9be8; border-radius: 8px; font-weight: 800; font-size: 11.5px; white-space: nowrap; }
.team-btn.on { background: #ffb400; color: #4a2c00; border-color: #ffe27a; }
.team-btn.boss-btn.on { background: #e5322d; color: #fff; border-color: #ff9d94; }
.team-btn.zombie-btn.on { background: #37d67a; color: #06330f; border-color: #b6ffd2; }
.mode-panel { justify-content: space-between; }
.mode-mid { flex: 1; text-align: center; min-width: 0; padding: 0 4px; }
.mode-name { font-weight: 900; font-size: 14.5px; color: #ffd76a; text-shadow: 0 1px 2px rgba(0, 0, 0, .5); white-space: nowrap; }
.mode-desc { font-size: 11.5px; color: #bfe3ff; white-space: nowrap; margin-top: 2px; }
.mode-nav { width: 32px; height: 36px; flex: none; border: none; border-radius: 9px; background: rgba(10, 40, 80, .55); color: #fff; font-size: 15px; cursor: pointer; }
.mode-nav:hover { background: rgba(255, 170, 40, .85); }
.mode-nav.dis { opacity: .3; pointer-events: none; }
.zombie-bar { margin-left: auto; padding: 5px 12px; font-size: 12.5px; font-weight: 800; color: #b9ffd2; background: rgba(6, 60, 30, .65); border: 1.5px solid rgba(92, 255, 138, .5); border-radius: 9px; white-space: nowrap; }
.coop-bar { margin-left: auto; padding: 5px 12px; font-size: 12.5px; font-weight: 800; color: #cdeeff; background: rgba(7, 52, 84, .65); border: 1.5px solid rgba(96, 200, 250, .55); border-radius: 9px; white-space: nowrap; }
.map-panel { position: absolute; left: 492px; top: 372px; width: 284px; display: flex; gap: 8px; }
.map-info { position: relative; width: 128px; flex: none; }
.map-nav { position: absolute; top: 41px; width: 30px; height: 30px; border: 1.5px solid rgba(160, 220, 255, .65); border-radius: 50%; background: rgba(8, 35, 75, .55); color: #fff; font-size: 12px; line-height: 1; padding: 0 0 2px 0; cursor: pointer; z-index: 3; }
.map-nav:hover { background: rgba(255, 170, 40, .85); }
.map-nav.prev { left: -15px; }
.map-nav.next { left: 133px; }
.map-panel canvas { border-radius: 8px; background: #0a3d75; border: 2px solid rgba(90, 180, 255, .5); flex: none; }
.map-name { height: 20px; display: flex; align-items: center; font-weight: 900; font-size: 14px; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.5); white-space: nowrap; background: rgba(4, 42, 92, .85); border-radius: 5px; padding-left: 6px; }
.map-desc { height: 18px; margin-top: 5px; display: flex; align-items: center; font-size: 11.5px; color: #bfe3ff; white-space: nowrap; background: rgba(4, 42, 92, .85); border-radius: 5px; padding-left: 6px; }
.map-stars { position: absolute; top: 66px; left: 0; width: 128px; height: 17px; display: flex; align-items: center; justify-content: flex-start; padding-left: 23px; box-sizing: border-box; background: rgba(4, 42, 92, .85); border-radius: 5px; }
.map-stars svg { width: 17px; height: 17px; flex: none; fill: #ffd83d; stroke: #c78f00; stroke-width: 1.2; }
.map-stars svg + svg { margin-left: -1px; }
.start-panel { position: absolute; left: 492px; top: 490px; width: 284px; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px; background: rgba(4, 42, 92, .55); border: 2px solid rgba(90, 180, 255, .35); border-radius: 10px; }
.fill-wrap { font-size: 12.5px; font-weight: 700; color: #dff3ff; cursor: pointer; user-select: none; }
.start-btn { width: 210px; height: 42px; font-size: 19px; font-weight: 900; letter-spacing: 1px; border-radius: 11px; border: 2px solid #ffe9a8; background: linear-gradient(#ffd76a, #ffb400); color: #4a2c00; box-shadow: 0 3px 0 #a86e00; cursor: pointer; }
.start-btn:active { transform: translateY(2px); box-shadow: none; }
.ready-btn { background: linear-gradient(#4db2ff, #1673c9); color: #fff; border-color: #9fdcff; box-shadow: 0 3px 0 #0b4d86; }
.ready-btn.on { background: linear-gradient(#3ddc84, #1faa59); border-color: #b9ffd9; box-shadow: 0 3px 0 #0e7a3c; color: #04240f; }
.room-msg { padding: 1px 8px; border-radius: 7px; background: rgba(2,32,71,.55); text-align: center; font-size: 11.5px; line-height: 15px; color: #ffe27a; min-height: 0; }
.room-msg:empty { background: none; }

/* ---------- GAME ---------- */
#scr-game { background: radial-gradient(1100px 480px at 50% -8%, #2f8fe8 0%, #1663b8 48%, #0a3d75 100%); }
.game-head { position: absolute; left: 0; top: 0; width: 800px; height: 40px; display: flex; align-items: center; padding: 0 14px; background: linear-gradient(180deg, rgba(4, 30, 66, .5), rgba(4, 30, 66, 0)); }
.game-room-name { max-width: 420px; padding: 5px 12px; font-size: 12.5px; font-weight: 800; color: #dff3ff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: rgba(4, 42, 92, .6); border: 1.5px solid rgba(90, 180, 255, .4); border-radius: 9px; }
.field-frame { position: absolute; left: 2px; top: 41px; width: 612px; height: 528px; background: #083b73; border: 2px solid #57b6ff; border-radius: 10px; box-shadow: inset 0 2px 0 rgba(255,255,255,.25), 0 4px 14px rgba(0,20,50,.35); }
#cv { position: absolute; left: 8px; top: 45px; width: 600px; height: 520px; border-radius: 6px; }
.timer-panel { position: absolute; left: 622px; top: 45px; width: 170px; padding: 7px 10px 8px; text-align: center; background: rgba(4, 42, 92, .55); border: 2px solid rgba(90, 180, 255, .35); border-radius: 10px; }
.timer-label { font-size: 11px; font-weight: 900; letter-spacing: 1.5px; color: #9fd8ff; margin-bottom: 4px; }
.timer-digits { display: flex; align-items: center; justify-content: center; gap: 0; }
.timer-digits .tsp { width: 14px; flex: none; text-align: center; font-size: 14px; font-weight: 900; line-height: 15px; color: #ffb400; text-shadow: 0 1px 2px rgba(0,0,0,.6); }
.prow-box { position: absolute; left: 622px; top: 103px; width: 170px; padding: 6px; background: rgba(4, 42, 92, .45); border: 2px solid rgba(90, 180, 255, .3); border-radius: 10px; }
.prow { height: 40px; margin-bottom: 3px; position: relative; display: flex; align-items: flex-start; gap: 5px; padding: 4px 3px 0 24px; background: rgba(6, 44, 96, .92); border: 1.5px solid rgba(90, 180, 255, .4); border-radius: 8px; }
.prow .pf { width: 42px; height: 31px; flex: none; border-radius: 3px; overflow: hidden; background: rgba(6,52,110,.35); }
.prow .pf canvas { display: block; }
.prow .pn { height: 19px; line-height: 19px; display: flex; align-items: center; font-size: 12.5px; font-weight: 700; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.6); width: 100%; box-sizing: border-box; padding: 0 5px; background: rgba(2,48,105,.88); border: 1px solid rgba(110,190,255,.55); border-radius: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prow .ps { height: 17px; line-height: 17px; display: flex; align-items: center; font-size: 11.5px; color: #ffe27a; white-space: nowrap; padding-left: 2px; margin-top: 1px; }
.prow .btag { flex: none; font-size: 8px; font-weight: 900; background: #ffb400; color: #4a2c00; border-radius: 4px; padding: 1px 3px; margin-left: 3px; letter-spacing: .3px; }
.prow .ptx { width: 84px; flex: none; }
.prow.dead { opacity: .45; }
.prow.me .pn { color: #ffe066; }
.prow.zombie .pn { color: #5cff8a; border-color: rgba(92, 255, 138, .6); }
/* side colours from the local player's view (Bach): green = me + my side,
   red = opponents. Placed after the .me/.zombie rules so they win ties;
   ally/enemy is recomputed on every HUD render, so zombie infections
   recolour this column too. */
.prow.ally .pn { color: #3dff6e; border-color: rgba(61, 255, 110, .55); }
.prow.enemy .pn { color: #ff5252; border-color: rgba(255, 82, 82, .55); }
.item-panel { position: absolute; left: 622px; top: 465px; width: 170px; padding: 7px 8px; background: rgba(4, 42, 92, .55); border: 2px solid rgba(90, 180, 255, .35); border-radius: 10px; }
.item-title { font-size: 11px; font-weight: 900; letter-spacing: 1.5px; color: #9fd8ff; text-align: center; margin-bottom: 3px; }
.item-box { height: 58px; display: flex; gap: 6px; align-items: stretch; justify-content: center; }
.item-cell { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.item-cell .iic { transform: scale(.75); margin: -12px -6px -27px; }
.item-cell .cnt { font-size: 12px; font-weight: 800; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.7); margin-top: 1px; }
.game-exit { position: absolute; left: 622px; top: 560px; width: 170px; height: 32px; }
/* in-match chat: fading log lines hug the bottom edge of the field frame;
   the slim bar below the frame swaps a hint for the real input (Enter) */
.game-chat-log { position: absolute; left: 10px; bottom: 33px; width: 560px; display: flex; flex-direction: column; justify-content: flex-end; align-items: flex-start; gap: 2px; pointer-events: none; z-index: 40; }
.game-chat-log .ln { max-width: 100%; font-size: 12.5px; line-height: 1.35; color: #fff; background: rgba(3, 26, 54, .72); border-radius: 6px; padding: 2px 8px; text-shadow: 0 1px 2px rgba(0,0,0,.8); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: 1; transition: opacity 1.2s ease; }
.game-chat-log .ln b { color: #ffd83d; }
.game-chat-log .ln.fade { opacity: 0; }
.game-chat-bar { position: absolute; left: 8px; top: 571px; width: 600px; height: 24px; z-index: 41; }
.game-chat-hint { height: 24px; line-height: 22px; font-size: 12px; color: rgba(220, 240, 255, .75); background: rgba(3, 32, 68, .45); border: 1.5px solid rgba(90, 180, 255, .3); border-radius: 7px; padding: 0 9px; cursor: text; user-select: none; }
.game-chat-in { width: 100%; height: 24px; background: rgba(234, 247, 255, .97); border: 2px solid #ffd76a; border-radius: 7px; padding: 0 9px; font-size: 13px; color: #0a2c4c; outline: none; }
/* end-of-match scoreboard, overlaid on the field in the shared panel style */
.result-panel { position: absolute; left: 308px; top: 305px; transform: translate(-50%, -50%); width: 460px; z-index: 120; background: linear-gradient(180deg, #1063ad, #0a4680); border: 2px solid #57b6ff; border-radius: 14px; padding: 16px 18px 14px; box-shadow: inset 0 2px 0 rgba(255,255,255,.25), 0 12px 40px rgba(0,10,30,.6); text-align: center; }
.result-title { font-size: 21px; font-weight: 900; letter-spacing: .5px; color: #fff; text-shadow: 0 2px 3px rgba(0,0,0,.5); margin-bottom: 10px; }
.result-title.win { color: #ffe27a; }
.result-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.result-table th { color: #9fd8ff; font-size: 11.5px; letter-spacing: .5px; padding: 5px 6px; border-bottom: 2px solid rgba(120, 200, 255, .4); text-align: center; }
.result-table th:first-child, .result-table td:first-child { text-align: left; }
.result-table td { padding: 5px 6px; border-bottom: 1px solid rgba(120, 200, 255, .15); color: #eaf6ff; text-align: center; font-weight: 600; white-space: nowrap; }
.result-table tr.me td { background: rgba(255, 216, 61, .16); color: #fff; font-weight: 800; }
.result-table .rw { font-weight: 900; color: #3ddc84; }
.result-table .rl { font-weight: 800; color: #ff9d94; }
.result-table .rd { font-weight: 800; color: #bfe3ff; }
.result-close { margin-top: 12px; width: 150px; height: 36px; font-size: 14px; font-weight: 900; letter-spacing: .5px; border-radius: 10px; border: 2px solid #ffe9a8; background: linear-gradient(#ffd76a, #ffb400); color: #4a2c00; box-shadow: 0 3px 0 #a86e00; cursor: pointer; }
.result-close:active { transform: translateY(2px); box-shadow: none; }
/* touch controls live OUTSIDE the stage, in the strip the layout reserves
   next to / below the play frame — they never overlap the field */
#touch { position: fixed; inset: 0; display: none; pointer-events: none; z-index: 60; }
#joyZone { position: fixed; pointer-events: auto; touch-action: none; }
#joyBase { position: fixed; width: 118px; height: 118px; border-radius: 50%; background: rgba(10, 45, 85, .38); border: 2px solid rgba(160, 220, 255, .55); opacity: .55; }
#joyBase.on { opacity: .95; }
#joyKnob { position: absolute; left: 50%; top: 50%; width: 54px; height: 54px; margin: -27px 0 0 -27px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #9fdcff, #2f9be8 65%, #1673c9); border: 2px solid rgba(255,255,255,.75); box-shadow: 0 3px 8px rgba(0,0,0,.4); }
#bombBtn { position: fixed; width: 76px; height: 76px; display: flex; align-items: center; justify-content: center; overflow: hidden; background: radial-gradient(circle at 35% 30%, #ffb066, #e07b39 60%, #b3541e); border: 2px solid rgba(255,255,255,.7); border-radius: 50%; pointer-events: auto; touch-action: none; box-shadow: 0 4px 10px rgba(0,0,0,.45); }

/* outfit (avatar) button + dialog */
.outfit-btn { flex: none; margin-top: 5px; padding: 3px 14px; line-height: 15px; border-radius: 9px; border: 2px solid #ffe9a8; background: linear-gradient(#ffd76a, #ffb400); color: #4a2c00; font-weight: 900; font-size: 12px; cursor: pointer; box-shadow: 0 2px 0 #a86e00; }
.outfit-btn:active { transform: translateY(2px); box-shadow: none; }
/* the outfit panel is a flex column capped below the 600px stage height:
   the item grid shrinks and scrolls internally, so the XONG button can
   never be pushed outside the stage (it measured 718px tall before, with
   the close button clipped away and the modal trapping every tap) */
.outfit-panel { width: 380px; text-align: center; display: flex; flex-direction: column; max-height: 584px; overflow: hidden; }
.outfit-panel .dlg-title { flex: none; }
.outfit-panel canvas { background: rgba(4, 42, 92, .45); border: 2px solid rgba(90, 180, 255, .35); border-radius: 10px; flex: none; align-self: center; }
#outfitRows { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
.outfit-panel .dlg-btns { flex: none; }
.of-tabs { display: flex; flex-wrap: wrap; gap: 5px; justify-content: center; margin-top: 8px; flex: none; }
.of-tab { padding: 4px 9px; border-radius: 8px; border: 2px solid #57b6ff; background: #0d4d86; color: #dff3ff; font-size: 12px; font-weight: 800; cursor: pointer; }
.of-tab:hover { background: rgba(255, 170, 40, .85); color: #fff; }
.of-tab.act { background: linear-gradient(#ffd76a, #ffb400); border-color: #ffe9a8; color: #4a2c00; }
.of-cur { margin-top: 7px; font-size: 13px; font-weight: 800; color: #ffe9a8; flex: none; }
.of-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 7px; flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 6px; background: rgba(4, 42, 92, .45); border: 2px solid rgba(90, 180, 255, .35); border-radius: 10px; }
.of-cell { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 2px 5px; border-radius: 9px; border: 2px solid rgba(90, 180, 255, .35); background: rgba(13, 77, 134, .55); cursor: pointer; }
.of-cell:hover { border-color: #ffb400; }
.of-cell.sel { border-color: #ffd76a; background: rgba(255, 180, 0, .28); box-shadow: 0 0 0 1px #ffd76a inset; }
.of-cell canvas { width: 63px; height: 78px; }
.of-cell span { font-size: 10.5px; font-weight: 700; color: #eaf7ff; line-height: 1.15; text-align: center; }
