:root {
  --bg: #0d1017;
  --panel: #161b27;
  --accent: #ff5a4d;
  --accent2: #4dd2ff;
  --text: #e8edf5;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; background: var(--bg); color: var(--text);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif; }

#game { position: fixed; inset: 0; display: block; }

.hidden { display: none !important; }

/* ---- Menu overlay ---- */
.overlay { position: fixed; inset: 0; display: grid; place-items: center;
  background: radial-gradient(circle at 50% 30%, #1a2233, #0d1017 70%); z-index: 20;
  overflow-y: auto; padding: 16px 0; }
.panel { background: var(--panel); border: 1px solid #2a3346; border-radius: 16px;
  padding: 36px 40px; width: min(440px, 90vw); text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
  max-height: 92vh; overflow-y: auto; }   /* scroll long panels (shop, skins) */
.panel h1 { font-size: 44px; letter-spacing: 4px; color: var(--accent);
  text-shadow: 0 0 24px rgba(255,90,77,.5); }
.panel .sub { color: #9fb0c7; margin: 10px 0 22px; font-size: 14px; }
.panel h2 { font-size: 26px; letter-spacing: 2px; color: var(--text); margin-bottom: 18px; }
#nameInput, .code-input { width: 100%; padding: 12px 14px; border-radius: 10px; border: 1px solid #2f3a4f;
  background: #0f1420; color: var(--text); font-size: 16px; text-align: center; }
.code-input { font-size: 30px; letter-spacing: 10px; font-weight: 800; text-transform: uppercase; }

.btn { margin-top: 12px; width: 100%; padding: 13px; border: 1px solid #2f3a4f; border-radius: 10px;
  background: #1b2233; color: var(--text); font-weight: 800; font-size: 16px; letter-spacing: 1px;
  cursor: pointer; transition: transform .06s ease, filter .15s ease; display: flex;
  justify-content: center; align-items: baseline; gap: 8px; }
.btn:hover { filter: brightness(1.15); }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--accent); color: #170606; border-color: transparent; }
.btn.ghost { background: transparent; border-color: transparent; color: #8ea0ba; font-weight: 600; }
.btn .hint { font-size: 11px; font-weight: 500; opacity: .7; letter-spacing: 0; }

.err { color: var(--accent); font-size: 13px; min-height: 18px; margin: 8px 0; }

.code-box { background: #0f1420; border: 1px solid #2f3a4f; border-radius: 12px; padding: 16px;
  margin-bottom: 18px; display: flex; flex-direction: column; gap: 4px; }
.code-label { font-size: 11px; letter-spacing: 2px; color: #7f90a8; }
.code-big { font-size: 52px; font-weight: 900; letter-spacing: 12px; color: var(--accent2);
  text-shadow: 0 0 24px rgba(77,210,255,.4); }
.code-hint { font-size: 11px; color: #7f90a8; }

.player-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; text-align: left; }
.player-list .p { background: #0f1420; border: 1px solid #26314a; border-radius: 8px;
  padding: 8px 12px; font-size: 14px; display: flex; justify-content: space-between; }
.player-list .p .tag { color: var(--accent2); font-size: 11px; }
.wait { color: #8ea0ba; font-size: 14px; margin-top: 8px; }

.controls { list-style: none; margin-top: 22px; font-size: 12.5px; color: #8ea0ba; line-height: 2; }
.controls b { color: var(--accent2); }

/* ---- Skin picker ---- */
.skin-panel { width: min(680px, 94vw); }
.skin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 8px;
  max-height: 60vh; overflow-y: auto; margin-bottom: 16px; padding: 4px; }
.skin-swatch { background: #0f1420; border: 2px solid #2a3346; border-radius: 10px; padding: 8px 4px 6px;
  cursor: pointer; text-align: center; transition: border-color .12s ease, transform .06s ease; }
.skin-swatch:hover { border-color: #4a5872; transform: translateY(-1px); }
.skin-swatch.selected { border-color: var(--accent); box-shadow: 0 0 12px rgba(255,90,77,.4); }
.skin-figure { width: 40px; height: 48px; margin: 0 auto 5px; position: relative; }
.skin-figure .fp { position: absolute; border-radius: 2px; }
.skin-name { font-size: 10.5px; color: #b9c6db; line-height: 1.15; }
.skin-swatch .glow-badge { font-size: 9px; color: #ffd24d; }

.chooser-label { text-align: left; font-size: 11px; letter-spacing: 1.5px; text-transform: uppercase;
  color: #7f90a8; margin: 4px 0 8px; }
.face-row { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 8px; margin-bottom: 8px; }
.face-swatch { flex: 0 0 auto; width: 52px; height: 52px; border-radius: 10px; cursor: pointer;
  background: #dfe4ee; border: 2px solid #2a3346; display: grid; place-items: center; transition: border-color .12s; }
.face-swatch canvas { width: 40px; height: 40px; }
.face-swatch:hover { border-color: #4a5872; }
.face-swatch.selected { border-color: var(--accent); box-shadow: 0 0 10px rgba(255,90,77,.4); }

/* ---- Settings ---- */
.setting-row { text-align: left; margin: 16px 0; }
.setting-row label { display: block; font-size: 14px; color: #cdd8e8; margin-bottom: 8px; }
.setting-row label span { color: var(--accent2); font-weight: 800; font-variant-numeric: tabular-nums; }
.setting-row input[type=range] { width: 100%; accent-color: var(--accent); height: 6px; cursor: pointer; }
.settings-hint { font-size: 12px; color: #7f90a8; margin-top: 14px; }
.gfx-hint { color: #7f90a8; font-weight: 500; font-size: 12px; }

/* ---- Admin panel ---- */
.admin-players { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; max-height: 50vh; overflow-y: auto; }
.admin-players .arow { display: flex; align-items: center; gap: 8px; background: #0f1420; border: 1px solid #26314a;
  border-radius: 8px; padding: 8px 10px; }
.admin-players .arow .aname { flex: 1; text-align: left; font-size: 14px; }
.admin-players .arow button { border: none; border-radius: 6px; padding: 6px 12px; font-weight: 700; font-size: 12px; cursor: pointer; }
.admin-players .arow .kick { background: #d0a020; color: #201800; }
.admin-players .arow .ban { background: var(--accent); color: #200606; }
.admin-players .empty { color: #7f90a8; font-size: 13px; }

/* ---- Win screen ---- */
#winScreen { background: radial-gradient(circle at 50% 35%, #2a2140, #0d1017 75%); z-index: 40; overflow: hidden; }
.win-inner { text-align: center; z-index: 2; }
.win-trophy { font-size: 90px; animation: winpop .6s ease; }
@keyframes winpop { from { transform: scale(0) rotate(-30deg); } to { transform: scale(1) rotate(0); } }
.win-name { font-size: 52px; font-weight: 900; color: #ffd24d; text-shadow: 0 0 30px rgba(255,200,60,.6);
  letter-spacing: 2px; margin-top: 8px; animation: winpop .6s ease .1s both; }
.win-sub { font-size: 22px; color: #cdd8e8; margin-top: 6px; }
.win-count { font-size: 14px; color: #8ea0ba; margin-top: 22px; }
#confetti, #podiumConfetti { position: absolute; inset: 0; pointer-events: none; z-index: 1; }
#confetti i, #podiumConfetti i { position: absolute; top: -12px; width: 10px; height: 14px; opacity: .9;
  animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(105vh) rotate(720deg); } }

/* ---- Podium ---- */
.podium-inner { text-align: center; z-index: 2; width: min(560px, 92vw); }
.podium-title { font-size: 30px; margin-bottom: 18px; }
.podium-blocks { display: flex; align-items: flex-end; justify-content: center; gap: 14px; }
.podium-col { display: flex; flex-direction: column; align-items: center; width: 120px; }
.podium-col.empty { opacity: 0; }
.podium-medal { font-size: 34px; }
.podium-name { font-weight: 800; font-size: 15px; margin: 4px 0; max-width: 116px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.podium-bar { width: 100%; border-radius: 10px 10px 0 0; display: flex; align-items: flex-start; justify-content: center;
  padding-top: 8px; background: #33405c; animation: podrise .5s ease; }
.place-1 .podium-bar { background: linear-gradient(#ffe07a, #f5b301); }
.place-2 .podium-bar { background: linear-gradient(#e6ecf5, #9fb0d0); }
.place-3 .podium-bar { background: linear-gradient(#e6a86b, #c17a33); }
.podium-col.me .podium-name { color: var(--accent2); }
.podium-num { font-size: 22px; font-weight: 900; color: rgba(0,0,0,.5); }
.podium-reward { margin-top: 6px; font-weight: 800; color: #ffd257; font-size: 14px; }
.podium-prize { margin-top: 20px; font-size: 18px; font-weight: 800; color: #7CFF9B; }
@keyframes podrise { from { height: 0 !important; } }

/* ---- HUD ---- */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; }

#crosshair { position: fixed; top: 50%; left: 50%; transform: translate(-50%,-50%);
  color: rgba(255,255,255,.7); font-size: 22px; }

/* ---- Shop & Skills ---- */
.shop-panel { max-width: 620px; }
.wallet { font-size: 20px; font-weight: 800; color: #ffd257; margin: 4px 0 8px; }
.skill-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0; }
.skill-card { border: 1px solid #2f3a4f; border-radius: 12px; padding: 12px; background: rgba(255,255,255,.03);
  display: flex; flex-direction: column; gap: 6px; text-align: left; }
.skill-card .top { display: flex; align-items: center; gap: 8px; }
.skill-card .ic { font-size: 26px; }
.skill-card .nm { font-weight: 800; font-size: 15px; }
.skill-card .kb { margin-left: auto; font-size: 11px; background: #1a2233; border: 1px solid #33405c;
  border-radius: 6px; padding: 2px 7px; color: #9fb0d0; font-weight: 700; }
.skill-card .ds { font-size: 12px; color: #9fb0d0; min-height: 30px; }
.skill-card .buy { border: none; border-radius: 8px; padding: 8px; font-weight: 800; font-size: 13px; cursor: pointer; }
.skill-card .buy.can { background: var(--accent); color: #fff; }
.skill-card .buy.cant { background: #2a3243; color: #6b7790; cursor: not-allowed; }
.skill-card .buy.equip { background: #223; color: #cfe; border: 1px solid #3c8; }
.skill-card .buy.equipped { background: #1f5136; color: #b8f5cf; border: 1px solid #3c8; }
.skill-card.owned { border-color: #3c8a5f; }

/* ---- Crates & accessories ---- */
.crate-row { display: flex; gap: 10px; flex-wrap: wrap; }
.crate-card { flex: 1 1 0; min-width: 150px; border: 1px solid #2f3a4f; border-radius: 12px; padding: 12px; text-align: center; }
.crate-card .ic { font-size: 34px; }
.crate-card .nm { font-weight: 800; margin: 4px 0; }
.crate-card button { width: 100%; border: none; border-radius: 8px; padding: 8px; font-weight: 800; cursor: pointer; }
.crate-card button.can { background: var(--accent); color: #fff; }
.crate-card button.cant { background: #2a3243; color: #6b7790; cursor: not-allowed; }
.crate-reveal { margin: 10px 0; padding: 14px; border-radius: 12px; text-align: center;
  background: rgba(255,255,255,.05); border: 1px solid #33405c; }
.crate-reveal .big { font-size: 42px; }
.crate-reveal .rar { font-weight: 800; letter-spacing: 1px; text-transform: uppercase; font-size: 13px; }
.acc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 8px; }
.acc-swatch { border: 1px solid #2f3a4f; border-radius: 10px; padding: 8px 4px; text-align: center; cursor: pointer; }
.acc-swatch .ic { font-size: 26px; }
.acc-swatch .nm { font-size: 10px; color: #9fb0d0; margin-top: 3px; }
.acc-swatch.on { border-color: #3ccf7a; background: rgba(60,207,122,.12); }
.acc-empty { grid-column: 1/-1; color: #6b7790; font-size: 13px; padding: 6px; }

.admin-toggle { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700;
  color: #cdd7ea; padding: 8px 2px; cursor: pointer; }
.admin-toggle input { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }
.admin-email { width: 100%; padding: 9px 12px; border-radius: 8px; border: 1px solid #2f3a4f;
  background: #10151f; color: var(--text); font-size: 14px; margin: 6px 0; }
.admin-players .arow button.give { background: #1f5136; color: #b8f5cf; }

/* ---- Ultimate (owner) cinematic cutscene ---- */
#ultimateFx { position: fixed; inset: 0; pointer-events: none; z-index: 60; overflow: hidden; display: none; }
#ultimateFx.play { display: block; }
#ultimateFx > div { position: absolute; inset: 0; }
/* dark vignette that closes in */
#ultimateFx .ult-dark { background: radial-gradient(circle at 50% 50%, transparent 20%, rgba(0,0,0,.88) 75%); opacity: 0; }
#ultimateFx.play .ult-dark { animation: ultDark 2.6s ease-out both; }
@keyframes ultDark { 0%{opacity:0} 12%{opacity:1} 78%{opacity:1} 100%{opacity:0} }
/* cosmic aura — swirling purple/blue core */
#ultimateFx .ult-aura { background:
    radial-gradient(circle at 50% 52%, rgba(255,255,255,.95) 0%, rgba(180,120,255,.9) 12%, rgba(120,80,255,.7) 26%, rgba(60,40,180,.5) 42%, transparent 62%);
  transform: scale(0); opacity: 0; mix-blend-mode: screen; }
#ultimateFx.play .ult-aura { animation: ultAura 2.6s cubic-bezier(.2,.8,.2,1) both; }
@keyframes ultAura { 0%{transform:scale(0);opacity:0} 18%{transform:scale(1);opacity:1} 70%{opacity:.85} 100%{transform:scale(1.15);opacity:0} }
/* radial speed-lines burst */
#ultimateFx .ult-streaks {
  background: repeating-conic-gradient(from 0deg at 50% 50%, rgba(255,255,255,.85) 0deg 1.2deg, transparent 1.2deg 5deg);
  -webkit-mask: radial-gradient(circle at 50% 50%, transparent 8%, #000 30%, transparent 62%);
          mask: radial-gradient(circle at 50% 50%, transparent 8%, #000 30%, transparent 62%);
  transform: scale(.2) rotate(0deg); opacity: 0; }
#ultimateFx.play .ult-streaks { animation: ultStreaks 1.4s ease-out both; }
@keyframes ultStreaks { 0%{transform:scale(.2) rotate(0);opacity:0} 20%{opacity:.9} 100%{transform:scale(2.4) rotate(26deg);opacity:0} }
/* expanding shockwave rings */
#ultimateFx .ult-ring { top:50%; left:50%; width: 40px; height: 40px; inset: auto; border-radius: 50%;
  border: 4px solid rgba(200,170,255,.9); box-shadow: 0 0 40px rgba(160,110,255,.9), inset 0 0 30px rgba(160,110,255,.7);
  transform: translate(-50%,-50%) scale(0); opacity: 0; }
#ultimateFx.play .ult-ring.r1 { animation: ultRing 1.5s ease-out .45s both; }
#ultimateFx.play .ult-ring.r2 { animation: ultRing 1.5s ease-out .75s both; }
#ultimateFx.play .ult-ring.r3 { animation: ultRing 1.5s ease-out 1.05s both; }
@keyframes ultRing { 0%{transform:translate(-50%,-50%) scale(0);opacity:0} 15%{opacity:1} 100%{transform:translate(-50%,-50%) scale(34);opacity:0} }
/* white climax flash */
#ultimateFx .ult-flash { background: #fff; opacity: 0; }
#ultimateFx.play .ult-flash { animation: ultFlash 2.6s ease-out both; }
@keyframes ultFlash { 0%,36%{opacity:0} 42%{opacity:.95} 52%{opacity:.15} 60%{opacity:0} }
/* big stylized ULTIMATE text */
#ultimateFx .ult-text { display: flex; align-items: center; justify-content: center;
  font-family: system-ui, sans-serif; font-weight: 900; font-size: clamp(40px, 11vw, 150px);
  letter-spacing: .06em; color: #fff; text-align: center;
  text-shadow: 0 0 18px #b98bff, 0 0 44px #7a3bff, 0 0 90px #4a1fd0; transform: scale(.4); opacity: 0; }
#ultimateFx.play .ult-text { animation: ultText 2.6s cubic-bezier(.18,.9,.2,1) both; }
@keyframes ultText { 0%,22%{transform:scale(.4);opacity:0} 34%{transform:scale(1.08);opacity:1} 46%{transform:scale(1)} 80%{opacity:1} 100%{transform:scale(1.25);opacity:0} }

/* ---- Mobile touch controls (only when body.touch) ---- */
#mobileLook, #joystick, .mbtn { display: none; }
body.touch #mobileLook { display: block; position: fixed; inset: 0; z-index: 9; pointer-events: auto; touch-action: none; }
body.touch #joystick { display: block; position: fixed; left: 24px; bottom: 30px; width: 130px; height: 130px;
  border-radius: 50%; background: rgba(20,26,40,.35); border: 2px solid rgba(150,170,210,.4);
  z-index: 13; pointer-events: auto; touch-action: none; }
#joyKnob { position: absolute; left: 50%; top: 50%; width: 58px; height: 58px; margin: -29px 0 0 -29px;
  border-radius: 50%; background: rgba(120,150,210,.75); border: 2px solid rgba(220,230,250,.7); }
body.touch .mbtn { display: flex; flex-direction: column; align-items: center; justify-content: center;
  position: fixed; z-index: 13; pointer-events: auto; touch-action: none; width: 76px; height: 76px;
  border-radius: 50%; background: rgba(20,26,40,.55); border: 2px solid rgba(150,170,210,.45);
  color: #eaf0fb; font-size: 26px; font-weight: 800; }
body.touch .mbtn span { font-size: 9px; letter-spacing: 1px; margin-top: 1px; }
body.touch #jumpBtn { right: 28px; bottom: 40px; }
body.touch #mShiftBtn { right: 118px; bottom: 46px; width: 62px; height: 62px; font-size: 20px; }
body.touch #mViewBtn { right: 40px; bottom: 128px; width: 62px; height: 62px; font-size: 20px; }
body.touch .mbtn:active { background: rgba(60,80,130,.8); }
/* give skill slots a tappable feel on mobile, moved up off the jump button */
body.touch #skillBar { bottom: 130px; }

/* ---- In-game skill bar ---- */
#skillBar { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%);
  display: flex; gap: 8px; pointer-events: none; z-index: 11; }
#skillBar .slot { position: relative; width: 46px; height: 46px; border-radius: 10px;
  background: rgba(15,20,32,.8); border: 1px solid #46527a; display: flex; align-items: center;
  justify-content: center; font-size: 22px; overflow: hidden; }
#skillBar .slot .k { position: absolute; bottom: 1px; right: 3px; font-size: 9px; color: #9fb0d0; font-weight: 800; }
#skillBar .slot .cd { position: absolute; left: 0; bottom: 0; width: 100%; background: rgba(0,0,0,.6); }
#skillBar .slot.ready { border-color: #6b7bb5; }
/* Only show the crosshair while actively looking (mouse captured). Otherwise the
   OS cursor is visible for aiming clicks — Roblox-style free-cursor mode. */
body:not(.mouselook) #crosshair { display: none; }

.bomb-timer { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -120px);
  font-size: 72px; font-weight: 900; color: var(--accent);
  text-shadow: 0 0 30px rgba(255,90,77,.9); font-variant-numeric: tabular-nums; }
.bomb-timer.danger { animation: pulse .35s infinite alternate; }
@keyframes pulse { from { transform: translate(-50%,-120px) scale(1); }
  to { transform: translate(-50%,-120px) scale(1.18); } }

.map-name { position: fixed; top: 16px; left: 50%; transform: translateX(-50%);
  font-size: 20px; font-weight: 700; letter-spacing: 2px; color: #cdd8e8; }
.map-timer { position: fixed; top: 42px; left: 50%; transform: translateX(-50%);
  font-size: 12px; color: #7f90a8; }

#ownerBtn { position: fixed; top: 14px; right: 16px; z-index: 12; pointer-events: auto;
  background: rgba(15,20,32,.82); color: #dfe7f5; border: 1px solid #46527a;
  border-radius: 10px; padding: 7px 12px; font-size: 12px;
  font-weight: 700; letter-spacing: .5px; cursor: pointer; }
#ownerBtn:hover { background: rgba(40,52,84,.95); border-color: #6b7bb5; }
#exitBtn { position: fixed; top: 14px; left: 16px; z-index: 12; pointer-events: auto;
  background: rgba(40,16,20,.82); color: #ffd7d7; border: 1px solid #7a4650;
  border-radius: 10px; padding: 7px 12px; font-size: 12px;
  font-weight: 700; letter-spacing: .5px; cursor: pointer; }
#exitBtn:hover { background: rgba(120,40,48,.95); border-color: #c05a66; }
#scoreboard { position: fixed; top: 58px; right: 16px; background: rgba(15,20,32,.72);
  border: 1px solid #26314a; border-radius: 10px; padding: 10px 14px; min-width: 180px;
  font-size: 13px; }
#scoreboard h3 { font-size: 11px; text-transform: uppercase; letter-spacing: 1px;
  color: #7f90a8; margin-bottom: 6px; }
#scoreboard .row { display: flex; justify-content: space-between; gap: 12px; padding: 2px 0; }
#scoreboard .row.me { color: var(--accent2); font-weight: 700; }
#scoreboard .row .bomb { color: var(--accent); }

#eventFeed { position: fixed; bottom: 16px; left: 16px; font-size: 13px; color: #b9c6db;
  display: flex; flex-direction: column; gap: 4px; }
#eventFeed .ev { background: rgba(15,20,32,.6); padding: 3px 8px; border-radius: 6px;
  opacity: 0; animation: fadein .2s forwards; }
@keyframes fadein { to { opacity: 1; } }

#deathBanner { position: fixed; top: 50%; left: 50%; transform: translate(-50%,-50%);
  font-size: 34px; font-weight: 800; color: var(--accent); text-shadow: 0 0 20px #000; }

#spectatorBanner { position: fixed; top: 76px; left: 50%; transform: translateX(-50%);
  background: rgba(15,20,32,.85); border: 1px solid #3a4761; border-radius: 10px;
  padding: 10px 18px; font-size: 14px; color: #cdd8e8; max-width: 90vw; text-align: center; }

#duelBanner { position: fixed; top: 110px; left: 50%; transform: translateX(-50%);
  font-size: 22px; font-weight: 800; letter-spacing: 1px; color: #ffd24d;
  text-shadow: 0 0 18px rgba(255,180,40,.6); }

#bigMessage { position: fixed; top: 42%; left: 50%; transform: translate(-50%,-50%);
  font-size: 30px; font-weight: 900; text-align: center; color: #7CFF9B;
  text-shadow: 0 0 24px rgba(0,0,0,.7); max-width: 92vw; padding: 0 12px; }

#netStatus { position: fixed; bottom: 10px; right: 12px; font-size: 11px; color: #5f6f88; }
