* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #0d1117; color: #e6edf3;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; overscroll-behavior: none; }
#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; z-index: 0; }
.panel { position: fixed; inset: 0; z-index: 20; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; padding: 16px; background: linear-gradient(160deg, rgba(26,35,50,0.88) 0%, rgba(13,17,23,0.92) 60%); overflow-y: auto; touch-action: pan-y; }
.panel h1 { font-size: clamp(1.5rem, 5vw, 2.4rem); letter-spacing: 0.14em; color: #c9d1d9; }
.tagline { opacity: 0.65; font-size: 0.9rem; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 0.85rem; width: min(340px, 90vw); }
input, select { background: #21262d; border: 1px solid #30363d; color: #e6edf3; padding: 10px 12px; border-radius: 8px; font-size: 16px; }
input.code { text-transform: uppercase; letter-spacing: 0.25em; text-align: center; font-weight: 700; width: 110px; }
.row { display: flex; gap: 10px; width: min(340px, 90vw); justify-content: center; }
.row.opts label.mini { width: auto; flex: 1; }
button { background: #30363d; color: #e6edf3; border: 1px solid #484f58; padding: 11px 18px; border-radius: 8px; font-size: 1rem; font-weight: 600; cursor: pointer; touch-action: manipulation; }
button.primary { background: #3d5a2a; border-color: #5a7f3e; }
button.big { width: 100%; padding: 14px; font-size: 1.15rem; letter-spacing: 0.04em; }
button:active { transform: scale(0.97); }
.error { color: #f85149; min-height: 1.1em; font-size: 0.9rem; text-align: center; }
.hint { opacity: 0.55; font-size: 0.75rem; text-align: center; line-height: 1.5; }
.hidden { display: none !important; }
#lobbyRoom { width: min(340px, 90vw); display: flex; flex-direction: column; gap: 8px; align-items: center; }
#playerList { list-style: none; width: 100%; }
#playerList li { display: flex; justify-content: space-between; padding: 8px 12px; margin: 4px 0; background: #21262d; border-radius: 6px; border-left: 4px solid #888; }
#playerList .ready-tag { color: #3fb950; font-size: 0.75rem; }
.limit-row { flex-direction: row; align-items: center; width: auto; }
.limit-row input { width: 64px; padding: 8px; }

/* HUD */
#hud { position: fixed; inset: 0; z-index: 10; pointer-events: none; }
#dmgFlash { position: absolute; inset: 0; opacity: 0; transition: opacity 0.25s; box-shadow: inset 0 0 120px 40px rgba(200,0,0,0.9); }
#crosshair { position: absolute; left: 50%; top: 50%; width: 22px; height: 22px; transform: translate(-50%, -50%); }
#crosshair::before, #crosshair::after { content: ''; position: absolute; background: rgba(255,255,255,0.9); box-shadow: 0 0 2px #000; }
#crosshair::before { left: 50%; top: 0; bottom: 0; width: 2px; margin-left: -1px; clip-path: polygon(0 0,100% 0,100% 35%,0 35%,0 65%,100% 65%,100% 100%,0 100%); }
#crosshair::after { top: 50%; left: 0; right: 0; height: 2px; margin-top: -1px; clip-path: polygon(0 0,35% 0,35% 100%,0 100%,0 0,65% 0,100% 0,100% 100%,65% 100%); }
#crosshair.ontarget::before, #crosshair.ontarget::after { background: #ffb347; }
#crosshair.hit::before, #crosshair.hit::after { background: #3fb950; }
#crosshair.hs::before, #crosshair.hs::after { background: #f85149; }
#topBar { position: absolute; left: 0; right: 0; top: 0; display: flex; align-items: center; gap: 14px;
  padding: 8px 14px; padding-top: max(8px, env(safe-area-inset-top)); padding-left: max(14px, env(safe-area-inset-left)); padding-right: max(14px, env(safe-area-inset-right));
  background: linear-gradient(180deg, rgba(0,0,0,0.5), transparent); font-variant-numeric: tabular-nums; font-weight: 600; font-size: 0.9rem; text-shadow: 0 1px 2px #000; }
#hpPanel { position: absolute; left: max(12px, env(safe-area-inset-left)); bottom: max(14px, env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 4px; min-width: 160px; max-width: 42vw;
  padding: 8px 10px 8px 10px; background: linear-gradient(180deg, rgba(18,16,12,0.72), rgba(10,9,7,0.88));
  border: 1px solid rgba(120,100,70,0.55); border-left: 3px solid #8a7a4a; box-shadow: 0 2px 10px rgba(0,0,0,0.55);
  font-variant-numeric: tabular-nums; pointer-events: none; }
#hpLabel { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.14em; color: #c9b896; text-shadow: 0 1px 2px #000; }
#hpLabel b { color: #e8e0d0; font-size: 1.05rem; letter-spacing: 0.02em; margin-left: 4px; }
#hpBar { display: block; width: 168px; max-width: 100%; height: 14px; background: #1a1814; border-radius: 2px; overflow: hidden;
  border: 1px solid #4a4030; box-shadow: inset 0 1px 3px rgba(0,0,0,0.7); }
#hpFill { display: block; height: 100%; width: 100%; background: linear-gradient(180deg, #6bc46d, #3a8f3e 55%, #2d6b30);
  transition: width 0.1s, background 0.2s; box-shadow: 0 0 6px rgba(70,160,70,0.35); }
#hpPanel.hurt #hpFill { background: linear-gradient(180deg, #e0a020, #b07010); }
#hpPanel.critical #hpFill { background: linear-gradient(180deg, #f07060, #a02820); }
/* Phones: keep HP above the left stick / sprint, away from FIRE cluster */
@media (pointer: coarse) {
  #hpPanel { left: max(10px, env(safe-area-inset-left)); bottom: max(210px, calc(env(safe-area-inset-bottom) + 200px));
    min-width: 140px; padding: 6px 8px; }
  #hpBar { width: 140px; height: 12px; }
  #hpLabel { font-size: 0.68rem; }
}
#ammo { margin-left: auto; margin-right: 56px; }
.pauseBtnDesk { pointer-events: auto; padding: 4px 12px; font-size: 0.85rem; opacity: 0.7; }
@media (pointer: coarse) { .pauseBtnDesk { display: none; } }
@media (pointer: fine) { #ammo { margin-right: 0; } }
#killFeed { position: absolute; top: 40px; right: 14px; text-align: right; font-size: 0.8rem; text-shadow: 0 1px 2px #000; }
#killFeed div { margin: 2px 0; opacity: 0.9; } #killFeed .mine { color: #ffb347; }
#scoreboard { position: absolute; left: 50%; transform: translateX(-50%); top: 36px; background: rgba(13,17,23,0.45);
  padding: 4px 10px; border-radius: 6px; font-size: 0.72rem; display: flex; gap: 14px; }
#scoreboard .row { display: flex; gap: 6px; width: auto; }
#respawnMsg { position: absolute; left: 50%; top: 40%; transform: translate(-50%, -50%); background: rgba(0,0,0,0.7); padding: 16px 26px; border-radius: 10px; }
#protHint { position: absolute; left: 50%; top: 18%; transform: translate(-50%, 0); padding: 8px 18px; border-radius: 999px;
  background: rgba(20, 40, 55, 0.62); color: #d9f6ff; font-weight: 800; letter-spacing: 0.12em; font-size: 0.95rem;
  text-shadow: 0 0 10px rgba(80, 210, 255, 0.85); box-shadow: 0 0 16px rgba(80, 200, 255, 0.35); pointer-events: none; z-index: 8;
  animation: protPulse 1s ease-in-out infinite; }
#protHint b { font-variant-numeric: tabular-nums; color: #fff; }
@keyframes protPulse { 0%,100% { opacity: 0.82; } 50% { opacity: 1; } }

/* Touch controls: big invisible hit areas, small translucent visuals */
#touchUI { position: fixed; inset: 0; z-index: 15; pointer-events: auto; touch-action: none; }
#stickBase { position: absolute; left: 110px; top: calc(100% - 110px); width: 112px; height: 112px; margin: -56px 0 0 -56px;
  border-radius: 50%; border: 2px solid rgba(255,255,255,0.5); background: rgba(255,255,255,0.08); opacity: 0.3; pointer-events: none; transition: opacity 0.12s; }
#stickBase.active { opacity: 0.85; transition: none; }
#stickKnob { position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; margin: -23px 0 0 -23px; border-radius: 50%; background: rgba(255,255,255,0.55); }
.tbtn { position: absolute; display: flex; align-items: center; justify-content: center; border-radius: 50%; }
.tbtn .vis { border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700;
  font-size: 0.7rem; letter-spacing: 0.05em; opacity: 0.4; border: 2px solid rgba(255,255,255,0.7); background: rgba(40,40,40,0.5); pointer-events: none; transition: opacity 0.1s, transform 0.08s; }
.tbtn.active .vis { opacity: 0.95; transform: scale(0.92); }
#tFire { width: 130px; height: 130px; right: max(4px, env(safe-area-inset-right)); bottom: 8px; }
#tFire .vis { width: 72px; height: 72px; background: rgba(200,50,40,0.6); }
#tJump { width: 96px; height: 96px; right: calc(max(4px, env(safe-area-inset-right)) + 120px); bottom: 2px; }
#tJump .vis { width: 50px; height: 50px; }
#tReload { width: 84px; height: 84px; right: calc(max(4px, env(safe-area-inset-right)) + 30px); bottom: 132px; }
#tReload .vis { width: 40px; height: 40px; font-size: 0.85rem; }
#tPause { width: 64px; height: 56px; right: max(2px, env(safe-area-inset-right)); top: 0; border-radius: 8px; }
#tPause .vis { width: 36px; height: 30px; border-radius: 6px; font-size: 0.8rem; }

/* Overlays */
.overlay { position: fixed; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center; background: rgba(5,8,12,0.6); touch-action: pan-y; }
.card { background: rgba(22,27,34,0.96); border: 1px solid #30363d; border-radius: 12px; padding: 16px 22px; display: flex; flex-direction: column; gap: 10px;
  align-items: center; max-height: 96vh; overflow-y: auto; min-width: min(380px, 92vw); }
.card h2 { letter-spacing: 0.12em; }
.card label.check { flex-direction: row; align-items: center; gap: 10px; font-size: 0.9rem; }
.card label.check input { width: 22px; height: 22px; }
.card label.inline { flex-direction: row; align-items: center; justify-content: space-between; }
input[type=range] { padding: 0; height: 32px; accent-color: #5a7f3e; }
#endTitle.win { color: #3fb950; font-size: 2rem; } #endTitle.lose { color: #f85149; font-size: 2rem; }
#endTable { border-collapse: collapse; min-width: 240px; font-variant-numeric: tabular-nums; }
#endTable td, #endTable th { padding: 4px 12px; text-align: center; } #endTable td:first-child { text-align: left; font-weight: 600; }
#endTable tr.me { background: rgba(255,255,255,0.08); }

#rotateHint { display: none; }
body.portrait #rotateHint { display: flex; position: fixed; inset: 0; z-index: 50; background: #0d1117; flex-direction: column; align-items: center; justify-content: center; gap: 18px; font-size: 1.2rem; }
#rotateHint .phone { width: 44px; height: 76px; border: 4px solid #c9d1d9; border-radius: 8px; animation: rot 1.8s ease-in-out infinite; }
@keyframes rot { 0%,30% { transform: rotate(0); } 60%,100% { transform: rotate(-90deg); } }

.mp-off { display: none !important; }

/* --- added: crouch/sprint/scope/weapon/score controls, scope overlay, full scoreboard --- */
#tCrouch { width: 84px; height: 84px; right: calc(max(4px, env(safe-area-inset-right)) + 214px); bottom: 2px; }
#tScope { width: 84px; height: 84px; right: calc(max(4px, env(safe-area-inset-right)) + 112px); bottom: 100px; }
#tWeapon { width: 84px; height: 84px; right: calc(max(4px, env(safe-area-inset-right)) + 200px); bottom: 92px; }
#tSprint { width: 84px; height: 84px; left: max(10px, env(safe-area-inset-left)); bottom: 178px; }
#tScore { width: 64px; height: 56px; right: calc(max(2px, env(safe-area-inset-right)) + 64px); top: 0; border-radius: 8px; }
#tScore .vis { width: 54px; height: 30px; border-radius: 6px; font-size: 0.6rem; }
#tCrouch .vis, #tScope .vis, #tWeapon .vis, #tSprint .vis { width: 50px; height: 50px; font-size: 0.55rem; flex-direction: column; }
#tWeapon small { font-size: 0.45rem; font-weight: 600; opacity: 0.9; max-width: 48px; text-align: center; line-height: 1.05; }
.tbtn.on .vis { opacity: 0.95; background: rgba(90,127,62,0.75); border-color: #b6e39a; }
#wpnName { opacity: 0.85; font-size: 0.8rem; }
#stamBar { display: inline-block; width: 60px; height: 5px; background: rgba(33,38,45,0.8); border-radius: 3px; overflow: hidden; transition: opacity 0.4s; }
#stamBar.full { opacity: 0; }
#stamFill { display: block; height: 100%; width: 100%; background: #e3c55a; }
#scopeOverlay { display: none; position: absolute; inset: 0; pointer-events: none; }
body.scoped #scopeOverlay { display: block; background: radial-gradient(circle at 50% 50%, transparent 0, transparent min(38vh, 38vw), #000 calc(min(38vh, 38vw) + 2px)); }
body.scoped #scopeOverlay::before, body.scoped #scopeOverlay::after { content: ''; position: absolute; background: #000; }
body.scoped #scopeOverlay::before { left: 50%; top: 10%; bottom: 10%; width: 1px; }
body.scoped #scopeOverlay::after { top: 50%; left: 20%; right: 20%; height: 1px; }
body.scoped #crosshair { display: none; }
#scoreFull { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; z-index: 12; }
#scoreFull .card { min-width: min(420px, 92vw); background: rgba(13,17,23,0.88); }
#scoreFull table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
#scoreFull th, #scoreFull td { padding: 4px 10px; text-align: center; } #scoreFull td:nth-child(2) { text-align: left; font-weight: 600; }
#scoreFull tr.me { background: rgba(255,255,255,0.08); }
body.touch-device .desk-only { display: none; }

/* --- added: solo zombies, big join code, host settings, Red/Blue team lobby, team HUD --- */
button.zombie { background: #4a3a6a; border-color: #7a62a8; }
.row .big { flex: 1; }
.codeBox { display: flex; flex-direction: column; align-items: center; gap: 4px; background: #11161d; border: 1px solid #30363d; border-radius: 12px; padding: 10px 16px; width: 100%; }
.codeLabel { font-size: 0.7rem; letter-spacing: 0.2em; opacity: 0.7; }
#roomCode { font-size: clamp(2.6rem, 11vw, 3.6rem); letter-spacing: 0.25em; line-height: 1.05; color: #ffd35a; font-variant-numeric: tabular-nums; user-select: text; -webkit-user-select: text; }
button.small { padding: 6px 12px; font-size: 0.85rem; }
.cfg { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; width: 100%; }
.cfg label.mini { width: auto; } .cfg label.check { flex-direction: row; align-items: center; gap: 8px; width: auto; font-size: 0.82rem; }
.cfg select, .cfg input[type=number] { padding: 6px 8px; }
.cfg.readonly { opacity: 0.7; }
#teamsBox { display: flex; gap: 10px; width: 100%; }
.teamCol { flex: 1; border-radius: 10px; padding: 6px; min-height: 90px; display: flex; flex-direction: column; gap: 4px; }
.teamCol.red { background: rgba(229,72,77,0.16); border: 1px solid rgba(229,72,77,0.6); } .teamCol.blue { background: rgba(62,142,247,0.16); border: 1px solid rgba(62,142,247,0.6); }
.teamCol.dragover { outline: 2px dashed #fff; }
.teamCol h4 { text-align: center; letter-spacing: 0.15em; font-size: 0.8rem; }
.teamCol ul { list-style: none; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.teamCol li { background: #21262d; border-radius: 6px; padding: 6px 8px; font-size: 0.85rem; display: flex; justify-content: space-between; cursor: default; }
.teamCol li.canmove { cursor: pointer; } .teamCol li.canmove::after { content: '⇄'; opacity: 0.5; }
#teamScore { position: absolute; left: 50%; transform: translateX(-50%); top: 34px; display: flex; gap: 10px; font-weight: 800; font-size: 1rem; text-shadow: 0 1px 2px #000; }
#teamScore .r { color: #ff7a7e; } #teamScore .b { color: #7db4ff; }
body.mode-tdm #scoreboard, body.mode-zombies #scoreboard { display: none; }
#zHud { position: absolute; left: 50%; transform: translateX(-50%); top: 34px; display: flex; gap: 16px; font-weight: 700; font-size: 0.95rem; text-shadow: 0 1px 2px #000; background: rgba(13,17,23,0.45); padding: 4px 12px; border-radius: 8px; }
#zHud b { color: #b6f08a; }
#zBanner { position: absolute; left: 50%; top: 26%; transform: translateX(-50%); background: rgba(20,14,34,0.78); border: 1px solid #7a62a8; padding: 10px 20px; border-radius: 10px; text-align: center; font-weight: 700; }

/* Minimap — top-left under score strip; clear of ammo (right) and phone stick/FIRE */
#minimap { position: absolute; left: max(12px, env(safe-area-inset-left)); top: max(42px, calc(env(safe-area-inset-top) + 38px));
  width: 128px; height: 128px; background: rgba(12,10,8,0.72); border: 1px solid rgba(180,150,100,0.5);
  box-shadow: 0 2px 10px rgba(0,0,0,0.55); pointer-events: none; overflow: hidden; }
#minimap canvas { width: 100%; height: 100%; display: block; image-rendering: pixelated; }
@media (pointer: coarse) {
  #minimap { width: 100px; height: 100px; top: max(40px, calc(env(safe-area-inset-top) + 36px)); left: max(10px, env(safe-area-inset-left)); }
}

/* —— High scores (Walter-style gold prompt + cream board, on the existing DF cards) —— */
button.lbBtn { background: #1982c4; border-color: #1d3557; color: #fff; }
#savebox { width: 100%; background: rgba(255,255,255,.92); border-radius: 18px; padding: 10px 12px; display: flex; flex-direction: column; align-items: center; gap: 8px; border: 3px solid #ffca3a; color: #1d3557; }
#savebox.hidden { display: none !important; }
#savebox .t { font: 800 18px system-ui, sans-serif; color: #1d3557; }
#savebox input, input#nameEnd { font: 600 18px system-ui, sans-serif; padding: 10px 12px; border: 3px solid #1d3557; border-radius: 14px; width: 190px; max-width: 60vw; background: #fff; color: #1d3557; }
#savebox button.go, #saveBtn.go { font: 700 18px system-ui, sans-serif; min-height: 44px; padding: 0 18px; border: 0; border-radius: 24px; background: #2e9e44; color: #fff; box-shadow: 0 3px 0 #1d3557; }
#savebox button.gray, #skipBtn.gray { font: 700 18px system-ui, sans-serif; min-height: 44px; padding: 0 18px; border: 0; border-radius: 24px; background: #8899aa; color: #fff; box-shadow: 0 3px 0 #1d3557; }
#savebox #saveMsg { color: #1d3557; min-height: 1em; }
#endScreen .card { max-height: 92vh; overflow: auto; align-items: center; }
#lb { position: fixed; inset: 0; z-index: 40; background: rgba(29,53,87,.55); display: flex; align-items: center; justify-content: center; }
#lb.hidden { display: none !important; }
#lb .card { background: #fffdf3; border: 4px solid #ffca3a; border-radius: 22px; width: min(92vw, 420px); max-height: 86vh; overflow: auto; padding: 14px 14px 16px; text-align: center; color: #1d3557; gap: 8px; }
#lb h2 { margin: 2px 0 6px; color: #1d3557; font-size: 26px; letter-spacing: 0; }
#lb .tabs { display: flex; gap: 6px; justify-content: center; margin: 0 0 6px; flex-wrap: wrap; }
#lb .chip { font: 700 14px system-ui, sans-serif; min-height: 42px; padding: 2px 10px; border: 3px solid #1d3557; border-radius: 16px; background: rgba(255,255,255,.9); color: #1d3557; cursor: pointer; }
#lb .chip[aria-checked="true"] { background: #ffe14d; border-color: #ff7a1a; box-shadow: 0 0 0 3px #ff7a1a; }
#lb h3 { margin: 8px 0 6px; color: #1d3557; font-size: 19px; text-align: left; }
#lb h3 small { font-size: 12px; color: #667; }
#lb ol { list-style: none; margin: 0 0 8px; padding: 0; text-align: left; width: 100%; }
#lb li { display: flex; gap: 10px; align-items: center; padding: 9px 10px; border-radius: 12px; font: 600 18px system-ui, sans-serif; color: #1d3557; }
#lb li:nth-child(odd) { background: #f1f5fb; }
#lb li.me { background: #ffe14d; outline: 3px solid #ff7a1a; }
#lb .rk { width: 34px; font-weight: 800; }
#lb .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#lb .sc { font-weight: 800; }
#lb .dt { font-size: 12px; color: #667; width: 76px; text-align: right; }
#lb .hint { color: #445; }
#lb button.b { font: 700 18px system-ui, sans-serif; min-height: 44px; padding: 0 18px; border: 0; border-radius: 24px; background: #1982c4; color: #fff; box-shadow: 0 3px 0 #1d3557; align-self: center; }
