* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #0d1117; font-family: system-ui, -apple-system, "Segoe UI", sans-serif; color: #fff; user-select: none; }
#game canvas { display: block; }
kbd { display: inline-block; padding: 1px 6px; border-radius: 4px; background: rgba(255,255,255,0.15); border: 1px solid rgba(255,255,255,0.3); font: 600 12px system-ui; }

#loading { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 22px; letter-spacing: 2px; background: #0d1117; z-index: 50; }

.screen { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 30; background: rgba(8,10,20,0.45); }
.panel { background: rgba(14,18,32,0.88); border: 1px solid rgba(255,255,255,0.12); border-radius: 14px; padding: 32px 40px; text-align: center; max-width: 620px; backdrop-filter: blur(6px); box-shadow: 0 20px 60px rgba(0,0,0,0.5); }
.panel.small { padding: 22px 40px; }
.title { font-size: 84px; font-weight: 900; letter-spacing: 6px; line-height: 1; background: linear-gradient(180deg, #ffffff, #9cc4ff 55%, #3f6fff); filter: drop-shadow(0 4px 0 rgba(0,0,0,0.35)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.sub { opacity: 0.75; margin: 4px 0 22px; }
.row { display: flex; gap: 8px; align-items: center; justify-content: center; margin: 10px 0; }
.row label { width: 60px; text-align: right; opacity: 0.7; margin-right: 6px; }
button { cursor: pointer; border: 1px solid rgba(255,255,255,0.25); background: rgba(255,255,255,0.06); color: #fff; padding: 8px 16px; border-radius: 8px; font: 600 14px system-ui; transition: background .15s, transform .1s; }
button:hover { background: rgba(255,255,255,0.16); }
button:active { transform: scale(0.97); }
button.sel { background: #ffb02e; color: #1a1300; border-color: #ffb02e; }
button.big { display: block; width: 100%; margin: 18px 0 10px; padding: 14px; font-size: 20px; letter-spacing: 3px; background: linear-gradient(180deg, #ffd23f, #ff9f1c); color: #2a1a00; border: none; }
.controls { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 18px; text-align: left; font-size: 13px; opacity: 0.85; margin-top: 10px; }
.hint { margin-top: 12px; font-size: 12px; opacity: 0.6; }

#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
#compass { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); background: linear-gradient(90deg, transparent, rgba(0,0,0,0.45) 20%, rgba(0,0,0,0.45) 80%, transparent); }
#topleft { position: absolute; top: 14px; left: 16px; display: flex; flex-direction: column; gap: 4px; text-shadow: 0 1px 3px #000; }
#topleft .stat { display: flex; align-items: baseline; gap: 6px; font-size: 14px; }
#topleft .stat b { font-size: 22px; }
#topleft small { opacity: 0.7; }
#storm-txt { font-size: 13px; color: #ffb38a; margin-top: 4px; }
#location { font-size: 16px; font-weight: 700; color: #ffe066; letter-spacing: 1px; text-transform: uppercase; }
#minimap { position: absolute; top: 12px; right: 12px; border-radius: 50%; box-shadow: 0 4px 16px rgba(0,0,0,0.5); }
#killfeed { position: absolute; top: 232px; right: 12px; display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }
.feed-item { background: rgba(0,0,0,0.5); padding: 4px 10px; border-radius: 4px; font-size: 13px; transition: opacity .6s; }
.feed-item.me { background: rgba(255,160,40,0.55); }
.feed-item .w { opacity: 0.6; font-size: 11px; }
.feed-item .v { color: #ffcf7a; font-style: italic; }

#crosshair { position: absolute; top: 50%; left: 50%; --gap: 8px; }
#crosshair i { position: absolute; background: #fff; box-shadow: 0 0 2px #000; transition: transform .05s; }
#crosshair .t, #crosshair .b { width: 2px; height: 9px; left: -1px; }
#crosshair .l, #crosshair .r { height: 2px; width: 9px; top: -1px; }
#crosshair .t { bottom: var(--gap); } #crosshair .b { top: var(--gap); }
#crosshair .l { right: var(--gap); } #crosshair .r { left: var(--gap); }
#crosshair .dot { width: 3px; height: 3px; left: -1.5px; top: -1.5px; border-radius: 50%; }
#crosshair.ads .t, #crosshair.ads .b, #crosshair.ads .l, #crosshair.ads .r { opacity: 0.35; }

#hitmarker { position: absolute; top: 50%; left: 50%; opacity: 0; }
#hitmarker.show { opacity: 1; }
#hitmarker i { position: absolute; width: 2px; height: 10px; background: #fff; left: -1px; top: -5px; }
#hitmarker i:nth-child(1) { transform: rotate(45deg) translateY(-12px); }
#hitmarker i:nth-child(2) { transform: rotate(135deg) translateY(-12px); }
#hitmarker i:nth-child(3) { transform: rotate(225deg) translateY(-12px); }
#hitmarker i:nth-child(4) { transform: rotate(315deg) translateY(-12px); }
#hitmarker.head i { background: #ffd60a; }
#hitmarker.kill i { background: #ff3b3b; height: 14px; }

#dmg-dirs { position: absolute; top: 50%; left: 50%; }
.dmg-dir { position: absolute; left: -60px; top: -140px; width: 120px; height: 280px; transform-origin: 60px 140px; animation: fadeout .9s forwards; }
.dmg-dir::before { content: ""; position: absolute; left: 30px; top: 0; width: 60px; height: 22px; border-radius: 50% 50% 0 0; background: radial-gradient(ellipse at 50% 100%, rgba(255,40,40,0.9), rgba(255,40,40,0) 70%); }
@keyframes fadeout { from { opacity: 1; } to { opacity: 0; } }

#dmg-numbers { position: absolute; inset: 0; }
.dmg-num { position: absolute; left: 0; top: 0; font: 900 20px system-ui; color: #fff; text-shadow: 0 0 3px #000, 0 2px 2px #000; }
.dmg-num.shield { color: #7cc8ff; }
.dmg-num.head { color: #ffd60a; font-size: 24px; }

#prompt { position: absolute; top: 60%; left: 50%; transform: translateX(-50%); font-size: 16px; text-shadow: 0 1px 3px #000; background: rgba(0,0,0,0.35); padding: 4px 12px; border-radius: 6px; }
#prompt:empty { display: none; }
#progress { position: absolute; top: 66%; left: 50%; transform: translateX(-50%); width: 220px; text-align: center; display: none; font-size: 13px; text-shadow: 0 1px 2px #000; }
#progress .bar { height: 6px; background: rgba(0,0,0,0.5); border-radius: 3px; margin-top: 4px; overflow: hidden; }
#progress-fill { height: 100%; background: #fff; width: 0; }
#toast { position: absolute; bottom: 160px; left: 50%; transform: translateX(-50%); font-size: 15px; background: rgba(0,0,0,0.5); padding: 6px 14px; border-radius: 6px; opacity: 0; transition: opacity .3s; }
#banner { position: absolute; top: 22%; left: 50%; transform: translateX(-50%); font-size: 30px; font-weight: 900; letter-spacing: 2px; text-shadow: 0 2px 8px #000; opacity: 0; transition: opacity .4s; text-align: center; white-space: nowrap; }

#vitals { position: absolute; left: 20px; bottom: 22px; width: 300px; }
#size { font-size: 13px; text-shadow: 0 1px 3px #000; margin-bottom: 4px; }
#size b { font-size: 22px; color: #ffd23f; margin-right: 2px; }
#size span { display: block; font-size: 11px; opacity: 0.75; }
#size span.leaky { color: #ffb38a; opacity: 1; font-weight: 700; }
#vitals .bar { position: relative; height: 20px; background: rgba(0,0,0,0.55); border-radius: 4px; margin-top: 6px; overflow: hidden; transform: skewX(-12deg); }
#vitals .bar > div { height: 100%; transition: width .15s; }
#vitals .bar span { position: absolute; right: 8px; top: 0; font: 800 14px/20px system-ui; transform: skewX(12deg); text-shadow: 0 1px 2px #000; }
#vitals .shield { height: 12px; }
#vitals .shield span { font-size: 11px; line-height: 12px; }
#vitals .bar .lbl { position: absolute; left: 10px; top: 0; font: 800 11px/20px system-ui; letter-spacing: 1.5px; font-style: normal; transform: skewX(12deg); text-shadow: 0 1px 2px #000; opacity: 0.9; }
#vitals .shield .lbl { font-size: 9px; line-height: 12px; }
#shield-fill { background: linear-gradient(90deg, #8a5a34, #d9a066); }
#health-fill { background: linear-gradient(90deg, #3fcf6f, #a6f0b8); }
#vitals .items { display: flex; gap: 14px; margin-top: 8px; font-size: 14px; text-shadow: 0 1px 2px #000; }

#weapon { position: absolute; right: 20px; bottom: 22px; text-align: right; text-shadow: 0 1px 3px #000; }
#weapon-name { font-weight: 800; font-size: 15px; text-transform: uppercase; letter-spacing: 1px; }
#weapon .ammo { font-size: 18px; }
#weapon .ammo b { font-size: 44px; font-weight: 900; }
#weapon .ammo b.low { color: #ff5a5a; }
#weapon .ammo em { font-style: normal; opacity: 0.7; }
#ammo-inv { font-size: 12px; display: flex; gap: 10px; justify-content: flex-end; margin-bottom: 6px; }
#slots { display: flex; gap: 6px; justify-content: flex-end; }
.slot { position: relative; width: 74px; height: 44px; background: rgba(0,0,0,0.45); border: 2px solid #555; border-radius: 6px; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; text-transform: uppercase; }
.slot.active { background: rgba(255,255,255,0.18); transform: translateY(-4px); }
.slot .k { position: absolute; top: 1px; left: 4px; font-size: 10px; opacity: 0.6; }
.slot em { position: absolute; bottom: 1px; right: 4px; font-style: normal; font-size: 10px; opacity: 0.8; }
#fps { position: absolute; bottom: 4px; left: 50%; transform: translateX(-50%); font-size: 11px; opacity: 0.5; }

#scope { position: fixed; inset: 0; display: none; pointer-events: none; z-index: 9;
  background:
    linear-gradient(#000, #000) center/2px 100% no-repeat,
    linear-gradient(#000, #000) center/100% 2px no-repeat,
    radial-gradient(circle at center, transparent 0, transparent 34vmin, rgba(0,0,0,0.9) 34.4vmin, #000 36vmin); }
#storm-fx { position: fixed; inset: 0; pointer-events: none; z-index: 8; opacity: 0; transition: opacity .4s; background: radial-gradient(ellipse at center, rgba(220,70,40,0.22), rgba(170,30,20,0.6)); }
#vignette { position: fixed; inset: 0; pointer-events: none; z-index: 8; opacity: 0; background: radial-gradient(ellipse at center, transparent 50%, rgba(200,0,0,0.55)); }
#bigmap { position: fixed; inset: 0; display: none; flex-direction: column; align-items: center; justify-content: center; z-index: 20; background: rgba(0,0,0,0.6); pointer-events: none; }
#bigmap canvas { width: min(80vh, 90vw); height: min(80vh, 90vw); border-radius: 10px; box-shadow: 0 10px 40px #000; }
#bigmap p { margin-top: 10px; opacity: 0.8; }

#end h1 { font-size: 64px; font-weight: 900; letter-spacing: 6px; }
#end h1.win { color: #ffd23f; text-shadow: 0 0 30px rgba(255,200,60,0.6); }
#end h1.lose { color: #ff5a5a; }
#end .place { font-size: 26px; margin: 4px 0 6px; opacity: 0.9; }
#end .quote { font-size: 17px; font-style: italic; opacity: 0.8; margin-bottom: 18px; }
#end .stats { display: flex; gap: 26px; justify-content: center; flex-wrap: wrap; }
#end .stats div { display: flex; flex-direction: column; font-size: 13px; opacity: 0.85; }
#end .stats span { font-size: 30px; font-weight: 800; }
#end .stats .killer { flex-basis: 100%; font-size: 15px; margin-top: 6px; }

/* ---------- Menus ---------- */
.menu-panel { max-width: 760px; width: calc(100vw - 32px); }
.identity { display: flex; gap: 12px; align-items: center; justify-content: center; margin: 6px 0 18px; flex-wrap: wrap; }
#name { background: rgba(255,255,255,0.08); border: 2px solid rgba(255,255,255,0.2); color: #fff; font: 700 16px system-ui; padding: 9px 14px; border-radius: 10px; width: 200px; outline: none; }
#name:focus { border-color: #ffd23f; }
#swatches { display: grid; grid-template-columns: repeat(6, 44px); gap: 6px; }
.swatch { width: 44px; height: 44px; padding: 0; border-radius: 10px; border: 3px solid rgba(255,255,255,0.3); background: rgba(255,255,255,0.08) center/120% no-repeat; opacity: 0.75; }
.swatch:hover { opacity: 1; }
.swatch.sel { opacity: 1; transform: scale(1.12); box-shadow: 0 0 0 2px #fff, 0 4px 12px rgba(0,0,0,0.5); background-color: rgba(255,255,255,0.22); background-position: center; background-size: 120%; background-repeat: no-repeat; }
.modes { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 640px) { .modes { grid-template-columns: 1fr; } }
.mode { background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; }
.mode h3 { font-size: 16px; letter-spacing: 1px; text-transform: uppercase; margin-bottom: 4px; }
.mode .row { margin: 6px 0; }
.mode .lbl { opacity: 0.6; font-size: 13px; }
.mode .big { margin-top: auto; }
.status { font-size: 13px; color: #9fe8b0; margin: 8px 0; }
button.big.alt { background: linear-gradient(180deg, #7bd3ff, #6c8cff); color: #0e1430; }
.room-row { display: flex; gap: 6px; margin-top: 2px; }
.room-row button { flex: 1; }
#room-code { width: 84px; text-align: center; text-transform: uppercase; letter-spacing: 3px; font: 800 15px system-ui; background: rgba(255,255,255,0.08); border: 2px solid rgba(255,255,255,0.2); color: #fff; border-radius: 8px; outline: none; }
#room-code:focus { border-color: #7bd3ff; }
#room-code.pulse { border-color: #ffd23f; box-shadow: 0 0 0 3px rgba(255,210,63,0.35); }
#room-box { margin: 4px 0 10px; }
#room-box .code-label { font-size: 12px; opacity: 0.6; letter-spacing: 2px; text-transform: uppercase; }
#room-code-big { font: 900 44px system-ui; letter-spacing: 10px; color: #ffd23f; margin: 2px 0 8px; user-select: all; }
#room-box .invite { display: flex; gap: 6px; justify-content: center; }
#invite-link { width: 240px; background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.2); color: #cfe3ff; border-radius: 6px; padding: 6px 8px; font: 12px system-ui; }
#host-controls .lbl { width: 90px; text-align: right; opacity: 0.65; font-size: 13px; margin-right: 6px; }
#host-controls .big { margin-top: 12px; }
button:disabled { opacity: 0.4; cursor: not-allowed; }
.menu-foot { display: flex; justify-content: space-between; align-items: flex-start; margin-top: 14px; gap: 12px; text-align: left; }
.menu-foot details { flex: 1; font-size: 13px; }
.menu-foot summary { cursor: pointer; opacity: 0.8; text-align: right; }
.blob-loader { position: relative; width: 54px; height: 38px; margin: 18px auto 14px; background: #8a5a34; border-radius: 6px; animation: wobble 0.9s ease-in-out infinite; box-shadow: inset 0 -6px 0 rgba(0,0,0,0.18); }
.blob-loader::before { content: ''; position: absolute; left: 16px; top: -10px; width: 22px; height: 12px; border: 4px solid #5e3c22; border-bottom: none; border-radius: 6px 6px 0 0; }
.blob-loader::after { content: ''; position: absolute; left: 24px; top: 14px; width: 6px; height: 6px; background: #ffd23f; border-radius: 1px; }
@keyframes wobble { 0%,100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(-8px) rotate(4deg); } }
#loading { flex-direction: column; gap: 6px; }
#lobby-players { list-style: none; margin: 12px 0; max-height: 200px; overflow: auto; display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
#lobby-players li { background: rgba(255,255,255,0.1); padding: 3px 10px; border-radius: 12px; font-size: 13px; }
.settings-panel { text-align: left; width: min(420px, calc(100vw - 32px)); }
.settings-panel h2 { text-align: center; margin-bottom: 10px; }
.settings-panel label { display: block; margin: 10px 0; font-size: 14px; }
.settings-panel output { float: right; opacity: 0.7; }
.settings-panel input[type=range], .settings-panel select { display: block; width: 100%; margin-top: 4px; accent-color: #3f6fff; }
.settings-panel select { background: #1d2236; color: #fff; border: 1px solid rgba(255,255,255,0.2); border-radius: 6px; padding: 6px; }
.settings-panel .check input { margin-right: 6px; accent-color: #3f6fff; }
#settings { z-index: 40; }
#pause .row { margin-top: 6px; }
#ping { position: absolute; top: 226px; right: 14px; font-size: 11px; opacity: 0.6; text-shadow: 0 1px 2px #000; }
#killfeed { top: 246px; }
#fps { position: fixed; bottom: 4px; left: 50%; transform: translateX(-50%); font-size: 11px; opacity: 0.5; z-index: 11; pointer-events: none; }
.screen { background: rgba(10,16,34,0.35); }

/* ---------- Touch controls ---------- */
#touch { position: fixed; inset: 0; z-index: 12; touch-action: none; user-select: none; -webkit-user-select: none; }
.t-look { position: absolute; right: 0; top: 0; width: 62%; height: 100%; }
.t-stick { position: absolute; left: 60px; bottom: 60px; width: 120px; height: 120px; border-radius: 50%; background: rgba(255,255,255,0.12); border: 2px solid rgba(255,255,255,0.35); opacity: 0.6; pointer-events: none; }
.t-stick.active { opacity: 1; bottom: auto; }
.t-knob { position: absolute; left: 35px; top: 35px; width: 50px; height: 50px; border-radius: 50%; background: rgba(255,255,255,0.7); }
.t-btn { position: absolute; width: 58px; height: 58px; border-radius: 50%; padding: 0; display: flex; align-items: center; justify-content: center; font-size: 22px; background: rgba(20,20,40,0.45); border: 2px solid rgba(255,255,255,0.45); color: #fff; touch-action: none; }
.t-btn.down { background: rgba(255,255,255,0.4); transform: scale(0.94); }
.t-btn.on { background: rgba(255,93,143,0.75); border-color: #fff; }
.t-fire { right: 30px; bottom: 70px; width: 84px; height: 84px; font-size: 32px; background: rgba(255,93,143,0.55); }
.t-fire2 { left: 24px; top: 50%; width: 62px; height: 62px; background: rgba(255,93,143,0.45); }
.t-ads { right: 130px; bottom: 110px; }
.t-jump { right: 130px; bottom: 40px; }
.t-crouch { right: 40px; bottom: 10px; width: 50px; height: 50px; }
.t-reload { right: 200px; bottom: 100px; width: 46px; height: 46px; font-size: 18px; }
.t-swap { right: 200px; bottom: 40px; width: 50px; height: 50px; }
.t-pickup { right: 30px; bottom: 165px; background: rgba(123,211,137,0.6); }
.t-med { left: 50%; bottom: 10px; margin-left: -56px; width: 44px; height: 44px; font-size: 18px; }
.t-shield { left: 50%; bottom: 10px; margin-left: 12px; width: 44px; height: 44px; font-size: 18px; }
.t-map { right: 132px; top: 12px; width: 44px; height: 44px; font-size: 18px; }
.t-pause { left: 50%; top: 46px; margin-left: -20px; width: 40px; height: 40px; font-size: 16px; }
body.touch #minimap { width: 110px; height: 110px; }
body.touch #ping, body.touch #killfeed { display: none; }
body.touch #compass { width: 300px; height: 26px; }
body.touch #weapon { right: auto; left: 50%; bottom: 60px; transform: translateX(-50%) scale(0.7); transform-origin: bottom center; text-align: center; }
body.touch #weapon .ammo b { font-size: 34px; }
body.touch #ammo-inv { justify-content: center; }
body.touch #slots { display: none; }
body.touch #vitals { transform: scale(0.7); transform-origin: top left; bottom: auto; top: 108px; left: 10px; }
body.touch #topleft .stat { font-size: 12px; }
body.touch #fps { display: none; }
body.touch .menu-foot details, body.touch .mode .hint { display: none; }

/* ---------- Small screens ---------- */
@media (max-width: 900px), (max-height: 500px) {
  #minimap { width: 130px; height: 130px; }
  #ping { top: 146px; } #killfeed { top: 162px; } #killfeed .feed-item { font-size: 11px; }
  #compass { width: 320px; height: 26px; }
  #topleft .stat b { font-size: 17px; } #storm-txt { font-size: 11px; }
  #banner { font-size: 20px; white-space: normal; width: 80vw; }
  .panel { padding: 18px 16px; max-height: calc(100vh - 20px); overflow: auto; }
  .title { font-size: 54px; }
}
@media (max-height: 500px) {
  .title { font-size: 40px; }
  .sub { font-size: 12px; margin: 2px 0 10px; }
  .identity { margin: 4px 0 8px; }
  .mode { padding: 8px 10px; }
  .mode h3 { font-size: 13px; }
  button.big { padding: 9px; margin: 8px 0 4px; font-size: 16px; }
  #swatches { grid-template-columns: repeat(12, 30px); gap: 4px; } .swatch { width: 30px; height: 30px; }
}
#career { display: flex; justify-content: center; gap: 18px; flex-wrap: wrap; margin-top: 14px; font-size: 12px; }
#career div { display: flex; flex-direction: column; align-items: center; min-width: 56px; }
#career b { font-size: 18px; color: #ffd23f; }
#career span { opacity: 0.65; }
#career .muted { opacity: 0.55; }
@media (max-height: 500px) { #career { margin-top: 6px; gap: 10px; } #career b { font-size: 14px; } }
