* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #0a0a0f;
  font-family: system-ui, "Segoe UI", "Malgun Gothic", sans-serif; color: #e8e8ef;
  user-select: none; -webkit-user-select: none; }
canvas { display: block; }
.hidden { display: none !important; }

/* ---- 메뉴 ---- */
.overlay { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 30%, #1a1a2e, #0a0a0f); z-index: 100; }
.panel { width: 340px; max-width: 90vw; background: rgba(20,20,32,.9); border: 1px solid #2a2a45;
  border-radius: 16px; padding: 28px; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.panel h1 { font-size: 34px; letter-spacing: 2px; text-align: center; }
.panel h1 span { color: #4ade80; }
.sub { text-align: center; color: #8a8aa0; margin: 4px 0 20px; font-size: 13px; }
.panel label { display: block; font-size: 12px; color: #9a9ab0; margin-top: 12px; }
.panel input, .panel select { width: 100%; margin-top: 4px; padding: 10px; border-radius: 8px;
  border: 1px solid #333350; background: #14141f; color: #fff; font-size: 15px; }
#playBtn, #resumeBtn { width: 100%; margin-top: 22px; padding: 13px; border: 0; border-radius: 8px;
  background: #4ade80; color: #06210f; font-size: 17px; font-weight: 700; cursor: pointer; }
#playBtn:active, #resumeBtn:active { transform: scale(.98); }
#settings input[type=range] { width: 100%; margin-top: 6px; accent-color: #4ade80; }
#settings.overlay { z-index: 200; }
.hint { margin-top: 16px; font-size: 11px; color: #6a6a80; text-align: center; line-height: 1.6; }
#status { text-align: center; color: #f87171; font-size: 13px; margin-top: 10px; min-height: 16px; }

/* ---- HUD ---- */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 50; }
/* 조준점: 중앙 점 + 사방 틱, 검은 외곽선으로 어떤 배경에서도 선명 */
#crosshair { position: absolute; left: 50%; top: 50%; width: 22px; height: 22px; margin: -11px 0 0 -11px; }
#crosshair::before { content: ""; position: absolute; left: 9px; top: 9px; width: 4px; height: 4px;
  border-radius: 50%; background: #6bff9e; box-shadow: 0 0 0 1.5px rgba(0,0,0,.9), 0 0 6px rgba(0,0,0,.6); }
#crosshair::after { content: ""; position: absolute; inset: 0;
  background:
    linear-gradient(#6bff9e,#6bff9e) 50% 0/2px 6px no-repeat,
    linear-gradient(#6bff9e,#6bff9e) 50% 100%/2px 6px no-repeat,
    linear-gradient(#6bff9e,#6bff9e) 0 50%/6px 2px no-repeat,
    linear-gradient(#6bff9e,#6bff9e) 100% 50%/6px 2px no-repeat;
  filter: drop-shadow(0 0 1px rgba(0,0,0,.95)); }

/* 원형 스코프: 바깥은 완전히 어둡게, 원 안은 밝게 + 선명한 조준 레티클 */
#scope { position: absolute; inset: 0; z-index: 2; }
#scope::before { content: ""; position: absolute; inset: 0;
  background: radial-gradient(circle at 50% 50%, transparent 0, transparent 30vh, rgba(4,6,10,.86) 31vh, #04060a 34vh); }
.scope-ring { position: absolute; left: 50%; top: 50%; width: 60vh; height: 60vh; margin: -30vh 0 0 -30vh;
  border-radius: 50%; box-shadow: 0 0 0 3px rgba(0,0,0,.9), inset 0 0 60px 20px rgba(0,0,0,.55); }
.scope-h { position: absolute; left: 50%; top: 50%; width: 60vh; height: 1px; margin-left: -30vh; background: rgba(0,0,0,.6); }
.scope-v { position: absolute; left: 50%; top: 50%; height: 60vh; width: 1px; margin-top: -30vh; background: rgba(0,0,0,.6); }
/* 스코프 중앙 조준점(선명한 초록) */
#scope::after { content: ""; position: absolute; left: 50%; top: 50%; width: 8px; height: 8px; margin: -4px 0 0 -4px;
  border-radius: 50%; background: #6bff9e; box-shadow: 0 0 0 1.5px rgba(0,0,0,.9), 0 0 8px rgba(107,255,158,.8); }

#hitmarker { position: absolute; left: 50%; top: 50%; width: 22px; height: 22px; margin: -11px 0 0 -11px;
  opacity: 0; transition: opacity .1s; }
#hitmarker::before, #hitmarker::after { content: ""; position: absolute; background: #ffffff;
  box-shadow: 0 0 2px rgba(0,0,0,.8); }
#hitmarker::before { left: 10px; top: 0; width: 2px; height: 22px; }
#hitmarker::after { left: 0; top: 10px; width: 22px; height: 2px; }
#hitmarker.show { opacity: 1; }
/* 피격 피드백: 피 대신 화면 가장자리에 알록달록 물감 얼룩 */
#damage-vignette { position: absolute; inset: 0; opacity: 0; transition: opacity .3s;
  background:
    radial-gradient(circle at 8% 20%, rgba(77,210,255,.55) 0, transparent 16%),
    radial-gradient(circle at 92% 30%, rgba(255,77,109,.55) 0, transparent 15%),
    radial-gradient(circle at 15% 85%, rgba(255,210,63,.5) 0, transparent 14%),
    radial-gradient(circle at 85% 80%, rgba(107,255,168,.5) 0, transparent 16%),
    radial-gradient(circle at 50% 98%, rgba(181,107,255,.45) 0, transparent 18%);
  filter: blur(1px); }
#damage-vignette.show { opacity: 1; }
/* 저체력: 화면 가장자리에 서리 낀 듯한 뿌연 효과 */
#hud.lowhp::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  box-shadow: inset 0 0 120px 24px rgba(200,225,255,.35); backdrop-filter: saturate(.7); }

.hud-bottom-left { position: absolute; left: 24px; bottom: 24px; }
#health { font-size: 30px; font-weight: 800; text-shadow: 0 2px 6px #000; }
#health .hp-val { color: #4ade80; }
#health.low .hp-val { color: #f87171; }
#weapon-info { font-size: 15px; color: #cfcfe0; margin-top: 4px; text-shadow: 0 1px 4px #000; }
#grenade-info { font-size: 13px; color: #9a9ab0; margin-top: 3px; text-shadow: 0 1px 4px #000; }
#grenade-info .key { border: 1px solid #555; border-radius: 3px; padding: 0 4px; font-size: 11px; }
#grenade-info #nades { color: #fbbf24; font-weight: 700; }
#stance-info { font-size: 12px; color: #8a8aa0; margin-top: 3px; text-shadow: 0 1px 4px #000; }
#stance-info .key { border: 1px solid #555; border-radius: 3px; padding: 0 4px; font-size: 10px; }
#stance-info #stance { color: #9ad0ff; font-weight: 700; }
.hud-top-left { position: absolute; left: 24px; top: 20px; }
#modeLabel { font-size: 14px; color: #9a9ab0; }
#waveLabel { font-size: 22px; font-weight: 800; color: #fbbf24; margin-top: 4px; }

#scoreboard { position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%);
  min-width: 320px; background: rgba(12,12,20,.92); border: 1px solid #2a2a45; border-radius: 12px;
  padding: 16px 20px; }
#scoreboard table { width: 100%; border-collapse: collapse; font-size: 14px; }
#scoreboard th, #scoreboard td { text-align: left; padding: 5px 10px; }
#scoreboard th { color: #8a8aa0; border-bottom: 1px solid #2a2a45; font-size: 12px; }
#scoreboard tr.me td { color: #4ade80; font-weight: 700; }
#scoreboard { display: flex; gap: 20px; }
#scoreboard h3 { font-size: 13px; color: #cfcfe0; margin-bottom: 6px; }
#sb-lifetime { border-left: 1px solid #2a2a45; padding-left: 20px; }
#sb-lifetime:empty { display: none; }

#minimap { position: absolute; right: 20px; bottom: 20px; width: 150px; height: 150px;
  background: rgba(10,10,18,.6); border: 1px solid #2a2a45; border-radius: 8px; }
#teamscore { position: absolute; left: 50%; top: 16px; transform: translateX(-50%);
  font-size: 26px; font-weight: 800; text-shadow: 0 2px 6px #000; }
#teamscore #ts-red { color: #f87171; } #teamscore #ts-blue { color: #60a5fa; }
#teamscore b { font-size: 16px; color: #8a8aa0; margin: 0 8px; }

#bossbar { position: absolute; left: 50%; top: 54px; transform: translateX(-50%); width: 44vw; text-align: center; }
.boss-label { font-size: 13px; color: #f87171; font-weight: 700; margin-bottom: 3px; text-shadow: 0 1px 3px #000; }
.boss-track { height: 14px; background: rgba(0,0,0,.6); border: 1px solid #7a1a1a; border-radius: 7px; overflow: hidden; }
#boss-fill { height: 100%; width: 100%; background: linear-gradient(90deg, #dc2626, #f87171); transition: width .15s; }

#wave-banner { position: absolute; left: 50%; top: 40%; transform: translate(-50%,-50%);
  font-size: 40px; font-weight: 900; color: #fbbf24; text-shadow: 0 3px 12px #000; opacity: 0;
  pointer-events: none; text-align: center; }
#wave-banner.show { animation: waveIn 2.2s ease-out; }
@keyframes waveIn { 0% { opacity: 0; transform: translate(-50%,-50%) scale(.6); }
  15% { opacity: 1; transform: translate(-50%,-50%) scale(1); }
  80% { opacity: 1; } 100% { opacity: 0; } }

#killfeed { position: absolute; right: 20px; top: 20px; text-align: right; }
#killfeed div { font-size: 13px; margin-bottom: 4px; background: rgba(0,0,0,.4); padding: 3px 8px;
  border-radius: 4px; display: inline-block; animation: fade 5s forwards; }
@keyframes fade { 0%,80% { opacity: 1; } 100% { opacity: 0; } }

#chatbox { position: absolute; left: 24px; bottom: 90px; width: 320px; max-width: 60vw; }
#chatlog div { font-size: 13px; margin-bottom: 2px; text-shadow: 0 1px 3px #000; }
#chatlog .n { color: #60a5fa; }
#chatinput { pointer-events: auto; width: 100%; margin-top: 6px; padding: 7px 10px; border-radius: 6px;
  border: 1px solid #333350; background: rgba(10,10,18,.9); color: #fff; }

#result { position: absolute; inset: 0; z-index: 3; display: flex; flex-direction: column;
  align-items: center; justify-content: center; background: rgba(6,6,12,.9); pointer-events: auto; }
#result h1 { font-size: 46px; margin-bottom: 6px; }
#result-board { min-width: 320px; background: rgba(20,20,32,.9); border: 1px solid #2a2a45;
  border-radius: 12px; padding: 14px 20px; margin: 12px 0; }
#result-board table { width: 100%; border-collapse: collapse; font-size: 14px; }
#result-board th, #result-board td { text-align: left; padding: 5px 10px; }
#result-board th { color: #8a8aa0; border-bottom: 1px solid #2a2a45; font-size: 12px; }
#result-board tr.me td { color: #4ade80; font-weight: 700; }
.result-sub { color: #8a8aa0; font-size: 14px; }

#respawn { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center;
  justify-content: center; background: rgba(120,0,0,.35); }
#respawn h2 { font-size: 44px; }

/* ---- 모바일 ---- */
#touch { position: fixed; inset: 0; z-index: 60; pointer-events: none; }
#joystick { position: absolute; left: 30px; bottom: 30px; width: 120px; height: 120px;
  border-radius: 50%; background: rgba(255,255,255,.08); border: 2px solid rgba(255,255,255,.15);
  pointer-events: auto; }
#stick { position: absolute; left: 40px; top: 40px; width: 40px; height: 40px; border-radius: 50%;
  background: rgba(255,255,255,.4); }
.tbtn { position: absolute; right: 30px; width: 84px; height: 84px; border-radius: 50%;
  background: rgba(74,222,128,.25); border: 2px solid rgba(74,222,128,.5); pointer-events: auto;
  display: flex; align-items: center; justify-content: center; font-weight: 700; }
#btn-fire { bottom: 40px; }
#btn-jump { bottom: 140px; background: rgba(96,165,250,.25); border-color: rgba(96,165,250,.5); }
