* { margin: 0; padding: 0; box-sizing: border-box; }
body { background: #b8e6f0; overflow: hidden; font-family: 'Segoe UI', sans-serif; }
canvas { display: block; }

/* === 시작 화면 ===
   배경은 단색이 아니라 캔버스에서 돌아가는 봇들의 실제 경기다 (client/demo.js).
   이 층은 그 위에 반투명 + blur로 얹혀 글자를 읽히게 하는 역할만 한다.
   애니메이션은 전부 transform/opacity만 건드린다 — 레이아웃을 다시 계산하지
   않으므로 뒤에서 60fps로 도는 경기와 프레임을 다투지 않는다. */
.start-screen {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  background: rgba(240,250,250,0.4);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  transition: opacity 0.3s ease;
}
/* PLAY를 누르면 이 층만 사라지고 뒤의 경기가 그대로 내 경기로 이어진다 */
.start-screen.leaving { opacity: 0; pointer-events: none; }

/* 떠다니는 컬러 blob — 구석에서 천천히 커졌다 작아진다 */
.blobs { position: absolute; inset: 0; pointer-events: none; }
.blob {
  position: absolute; width: 220px; height: 220px; border-radius: 50%;
  filter: blur(40px); opacity: 0.4; will-change: transform;
  animation: float 9s ease-in-out infinite;
}
.b1 { top: -70px; left: -60px; background: #f39c12; animation-duration: 9s; }
.b2 { bottom: -80px; right: -50px; background: #e74c3c; animation-duration: 11s; animation-delay: -3s; }
.b3 { top: 12%; right: -70px; background: #1abc9c; animation-duration: 13s; animation-delay: -6s; }
.b4 { bottom: 8%; left: -70px; background: #8e44ad; animation-duration: 10s; animation-delay: -1.5s; }
.b5 { top: 46%; left: 40%; width: 160px; height: 160px; background: #2980b9; animation-duration: 15s; animation-delay: -8s; }
@keyframes float {
  0%   { transform: translate3d(0, 0, 0) scale(1); }
  50%  { transform: translate3d(26px, -34px, 0) scale(1.22); }
  100% { transform: translate3d(0, 0, 0) scale(1); }
}

/* 떠다니는 Kiro 고스트 — blob과 같은 장식 층이고, .panel(z-index 1)보다 뒤에
   깔리므로 UI를 가리지 않는다 (.start-screen이 overflow: hidden이라 화면 밖으로
   부유해도 스크롤바가 생기지 않는다).
   opacity를 0.15 아래로 눌러 둔 이유: 이 층은 blur된 배경 위에 얹히므로 조금만
   진해도 닉네임 칸·로고와 대비를 다툰다. 움직임도 transform만 쓴다. */
.kiro-ghosts { position: absolute; inset: 0; pointer-events: none; }
.kg {
  position: absolute; height: auto; will-change: transform;
  animation: kiroFloat 10s ease-in-out infinite;
  /* kiro.png는 흰 고스트다 (인게임에서는 스킨 색을 입혀 쓴다 — game.js kiroSprite).
     이 화면은 밝은 하늘색이라 흰색 그대로는 opacity 0.1에서 아무것도 안 보인다.
     brightness(0)으로 검은 실루엣만 남기면 opacity가 그림자 농도가 된다. */
  filter: brightness(0);
}
/* 크기(40~80px)·자리·주기·위상을 넷 다 다르게 둔다. 음수 delay는 첫 프레임부터
   각자 다른 지점에서 시작하게 하는 것이다 (전부 같이 올라가면 눈에 띈다). */
.kg1 { top: 9%;     left: 6%;    width: 78px; opacity: 0.12; animation-duration: 11s;   animation-delay: -2s; }
.kg2 { top: 16%;    right: 7%;   width: 46px; opacity: 0.15; animation-duration: 8s;    animation-delay: -5s; }
.kg3 { bottom: 13%; left: 11%;   width: 58px; opacity: 0.09; animation-duration: 12s;   animation-delay: -7.5s; }
.kg4 { bottom: 6%;  right: 12%;  width: 68px; opacity: 0.14; animation-duration: 9.5s;  animation-delay: -1s; }
@keyframes kiroFloat {
  0%, 100% { transform: translate3d(0, 0, 0); }
  33%      { transform: translate3d(20px, -26px, 0); }
  66%      { transform: translate3d(-16px, -12px, 0); }
}

/* 세로로 쌓이는 UI. 화면이 낮으면(모바일 가로) 잘리지 않고 스크롤된다.
   overflow-x를 명시하는 게 중요하다: overflow-y만 auto로 두면 CSS 규칙상 반대 축의
   visible이 auto로 계산돼(한쪽이 visible이 아니면 다른 쪽도 아니게 된다) 폭이 몇 px만
   넘쳐도 아래에 가로 스크롤바가 생긴다. */
.panel {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; align-items: center;
  width: min(340px, 90vw); max-height: 100%;
  padding: 16px 8px; overflow-x: hidden; overflow-y: auto; text-align: center;
}

/* 로고 — 아래로 4px 짙은 색 + 8px blur로 두께를 만들고, 그 위에 ::after가
   그라디언트 글자를 겹쳐 얹는다. background-clip: text만 쓰면 글자 자체가
   투명해져서 3D 그림자가 글자 앞으로 새어나온다 (그래서 두 겹이다). */
.logo {
  position: relative;
  /* 상한 72px은 "GridWar" 7글자(Segoe UI Black ≈ 4.2em)가 패널 콘텐츠 폭(324px) 안에
     들어오는 크기다 — 더 키우면 글자가 넘쳐 가로 스크롤이 생긴다. */
  font-size: clamp(42px, 12vw, 72px); font-weight: 900; line-height: 1.06;
  white-space: nowrap; letter-spacing: -0.02em; color: #d3462a;
  text-shadow: 0 4px 0 #7d2415, 0 8px 8px rgba(0,0,0,0.3);
  animation: logoBounce 2s ease-in-out infinite;
}
.logo::after {
  content: attr(data-text);
  position: absolute; left: 0; top: 0; width: 100%;
  background: linear-gradient(180deg, #ffd45e 0%, #f39c12 46%, #e74c3c 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
@keyframes logoBounce {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-3px); }
}
.tagline {
  margin: 6px 0 16px; font-size: 14px; font-weight: 700; color: #3f6b74;
  text-shadow: 0 1px 0 rgba(255,255,255,0.7);
}

/* 닉네임 — 이 화면에서 가장 크게 눌릴 자리다 (모바일 터치 기준 52px) */
.name-input {
  width: min(300px, 100%); height: 52px;
  font: inherit; font-size: 20px; font-weight: 700; text-align: center;
  color: #2d3436; background: #fff;
  border: 2px solid rgba(255,255,255,0.9); border-radius: 16px; outline: none;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
  transition: box-shadow 0.15s, border-color 0.15s;
}
.name-input::placeholder { color: #b2bec3; font-weight: 600; font-size: 17px; }
.name-input:focus {
  border-color: #f39c12;
  box-shadow: 0 0 0 3px rgba(243,156,18,0.4), 0 4px 20px rgba(0,0,0,0.08);
}

/* 방 코드 — 선택 입력이므로 닉네임보다 한 단계 작고 옅게 둔다.
   숫자 4자리를 또박또박 보여줘야 조를 잘못 찾는 사고가 줄어든다. */
.room-input {
  width: min(300px, 100%); height: 40px; margin-top: 8px;
  font: inherit; font-size: 15px; font-weight: 700; text-align: center; letter-spacing: 2px;
  color: #2d3436; background: rgba(255,255,255,0.72);
  border: 2px solid rgba(255,255,255,0.8); border-radius: 12px; outline: none;
  transition: background 0.15s, border-color 0.15s;
}
.room-input::placeholder { letter-spacing: 0; font-weight: 600; color: #9fb0b6; }
.room-input:focus { background: #fff; border-color: #f39c12; }
.room-error { min-height: 17px; font-size: 13px; font-weight: bold; color: #c0392b; margin: 6px 0 0; }

/* 스킨 — 인게임 모습(눈 달린 공)을 그대로 미리 보여준다 (game.js drawBall) */
.skin-label {
  margin: 10px 0 6px; font-size: 12px; font-weight: 800;
  letter-spacing: 1px; color: #5f818a;
}
.skin-select {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 2px;
  width: min(300px, 100%);
}
.skin-cell {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 7px 0 5px; border-radius: 12px; cursor: pointer;
}
.skin-face {
  width: 50px; height: 50px; border-radius: 50%;
  transition: transform 0.15s, box-shadow 0.15s;
}
.skin-name {
  font-size: 10px; font-weight: 800; color: #7a8f95; letter-spacing: 0.3px;
  transition: color 0.15s;
}
.skin-cell:hover .skin-face { transform: scale(1.1); }
.skin-cell.selected .skin-face {
  transform: scale(1.2);
  box-shadow: 0 0 0 3px #fff, 0 0 0 6px rgba(243,156,18,0.6), 0 6px 14px rgba(0,0,0,0.2);
  animation: skinPop 0.2s ease-out;
}
.skin-cell.selected .skin-name { color: #2d3436; }
@keyframes skinPop {
  0%   { transform: scale(0.92); }
  60%  { transform: scale(1.32); }
  100% { transform: scale(1.2); }
}

/* PLAY — 화면에서 가장 눈에 띄어야 하는 하나 */
.play-btn {
  position: relative; margin-top: 18px;
  width: min(240px, 100%); height: 56px;
  font: inherit; font-size: 22px; font-weight: 900; letter-spacing: 1px;
  color: #fff; cursor: pointer; border: none; border-radius: 16px;
  background: linear-gradient(135deg, #f39c12, #e74c3c);
  box-shadow: 0 6px 20px rgba(231,76,60,0.4);
  transition: transform 0.15s, box-shadow 0.15s;
}
.play-btn:hover { transform: scale(1.05); box-shadow: 0 10px 28px rgba(231,76,60,0.55); }
.play-btn:active { transform: scale(0.98); }
/* 버튼을 감싸고 천천히 깜빡이는 링 — "여기를 누르세요"를 글자 없이 알린다.
   opacity/transform만 움직이므로 비용이 없다. */
.play-btn::after {
  content: ''; position: absolute; inset: -5px;
  border: 3px solid rgba(231,76,60,0.55); border-radius: 20px;
  pointer-events: none; animation: playPulse 1.8s ease-in-out infinite;
}
@keyframes playPulse {
  0%, 100% { opacity: 0; transform: scale(0.98); }
  50%      { opacity: 1; transform: scale(1.03); }
}

.ghost-btn {
  margin-top: 12px; width: min(240px, 100%); height: 40px;
  font: inherit; font-size: 14px; font-weight: 800;
  color: #4a6169; cursor: pointer; border: none; border-radius: 12px;
  background: rgba(255,255,255,0.72);
  box-shadow: 0 2px 10px rgba(0,0,0,0.08);
  transition: transform 0.15s, background 0.15s;
}
.ghost-btn:hover { background: #fff; transform: scale(1.03); }

/* 대회 현황 한 줄 (시작 화면) */
.tour-info {
  margin: 8px 0 0; font-size: 12px; font-weight: 800; line-height: 1.5;
  color: #2d6a7a; text-shadow: 0 1px 0 rgba(255,255,255,0.7);
}

.foot { display: flex; flex-direction: column; gap: 3px; margin-top: 14px; }
.online { font-size: 13px; font-weight: 800; color: #1e7a52; }
.server-status { font-size: 11px; font-weight: 600; color: #7f8c8d; }

/* 크레딧 — 배경이 밝은 하늘색이므로 검정 계열을 옅게 쓴다 (흰색은 안 읽힌다) */
.credit {
  display: flex; align-items: center; justify-content: center; gap: 5px;
  margin-top: 12px; font-size: 12px; font-weight: 700; color: rgba(0,0,0,0.4);
}
/* 아이콘도 흰 고스트이므로 글자와 같은 농도의 검은 실루엣으로 눌러 맞춘다 */
.credit img { width: 16px; height: auto; filter: brightness(0); opacity: 0.4; }

/* 낮은 화면(모바일 가로 / 작은 노트북)에서는 한 단계 조인다 */
@media (max-height: 720px) {
  .logo { font-size: clamp(38px, 11vw, 60px); }
  .tagline { margin: 4px 0 10px; }
  .name-input { height: 46px; font-size: 18px; }
  .skin-face { width: 42px; height: 42px; }
  .skin-label { margin: 6px 0 2px; }
  .play-btn { height: 50px; margin-top: 12px; font-size: 20px; }
  .ghost-btn { height: 36px; margin-top: 8px; }
  .foot { margin-top: 10px; }
}

/* 움직임을 줄여달라고 설정한 사용자에게는 장식 애니메이션을 끈다 */
@media (prefers-reduced-motion: reduce) {
  .blob, .kg, .logo, .play-btn::after, .skin-cell.selected .skin-face { animation: none; }
}

/* === 조 대기 화면 (토너먼트) ===
   "몇 명 중 몇 명"이 이 화면의 전부다 — 숫자를 화면에서 가장 크게 두고,
   나머지(같은 조 명단·다른 조 진행 상황)는 그 아래로 눌러 둔다.
   대기실(z-index 50)과 같은 층이지만 둘이 동시에 뜨지는 않는다 (game.js updateTour). */
.wait {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(12,28,34,0.86); color: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 16px; text-align: center;
}
.wait-chip {
  background: #f5c542; color: #2d3436;
  padding: 3px 14px; border-radius: 999px;
  font-size: 13px; font-weight: 900; letter-spacing: 0.5px;
}
.wait-title { margin: 12px 0 2px; font-size: clamp(20px, 5vw, 28px); font-weight: 900; }
/* 7 / 10명 — 큰 숫자가 현재 인원, 작은 쪽이 정원 */
.wait-num { display: flex; align-items: baseline; gap: 4px; margin: 10px 0 12px; }
.wait-num b { font-size: clamp(52px, 15vw, 88px); font-weight: 900; line-height: 1; color: #f5c542; font-variant-numeric: tabular-nums; }
.wait-num s { font-size: 30px; text-decoration: none; color: #7f9aa3; }
.wait-num i { font-size: 34px; font-style: normal; font-weight: 900; color: #cfe2e7; font-variant-numeric: tabular-nums; }
.wait-num em { font-size: 16px; font-style: normal; font-weight: 800; color: #7f9aa3; margin-left: 2px; }
.wait-bar { width: min(320px, 82vw); height: 10px; background: rgba(255,255,255,0.14); border-radius: 5px; overflow: hidden; }
.wait-fill { height: 100%; width: 0; border-radius: 5px; background: linear-gradient(90deg, #f39c12, #f5c542); transition: width 0.3s; }
/* 카운트다운 — 인원 대신 이 숫자가 화면을 차지한다 */
.wait-go {
  margin: 14px 0 0; font-size: clamp(64px, 20vw, 120px); font-weight: 900; line-height: 1;
  color: #fff; text-shadow: 0 4px 0 #b3491f, 0 10px 24px rgba(0,0,0,0.45);
  animation: waitGo 1s ease-out infinite;
}
@keyframes waitGo {
  0%   { transform: scale(1.25); opacity: 0.35; }
  35%  { transform: scale(1); opacity: 1; }
  100% { transform: scale(0.97); opacity: 0.9; }
}
.wait-msg { margin-top: 14px; font-size: 14px; font-weight: 700; color: #bcd6dd; min-height: 20px; }
/* 같은 조 사람들 — 스킨 색 점 + 닉네임 */
.wait-names {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 6px;
  margin-top: 14px; max-width: min(460px, 92vw);
}
.wn {
  display: flex; align-items: center; gap: 5px;
  background: rgba(255,255,255,0.1); border-radius: 999px; padding: 3px 10px;
  font-size: 12px; font-weight: 800;
}
.wn i { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.wn.me { background: rgba(245,197,66,0.24); box-shadow: inset 0 0 0 1.5px #f5c542; }
/* 다른 조 진행 상황 */
.wait-rooms {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 5px;
  margin-top: 18px; max-width: min(520px, 94vw);
  font-size: 11px; font-weight: 800; color: #9fb9c1;
}
.wr { background: rgba(255,255,255,0.07); border-radius: 6px; padding: 3px 8px; }
.wr.play { color: #ffe08a; background: rgba(245,197,66,0.14); }
.wr.done { color: #7f9aa3; }
.wr.mine { box-shadow: inset 0 0 0 1.5px rgba(245,197,66,0.6); }
@media (prefers-reduced-motion: reduce) { .wait-go { animation: none; } }

/* 대기실 */
.lobby {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(0,0,0,0.78); color: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.lobby h2 { font-size: 34px; margin-bottom: 6px; }
/* 진출 / 탈락 — 순위표보다 먼저 읽혀야 하는 한 줄 */
.lobby-verdict {
  margin: 2px 0 10px; padding: 7px 20px; border-radius: 999px;
  font-size: clamp(15px, 4vw, 19px); font-weight: 900; text-align: center;
  animation: dpPop 0.45s ease-out;
}
.lobby-verdict.up { background: rgba(46,204,113,0.22); color: #7bed9f; box-shadow: inset 0 0 0 2px rgba(46,204,113,0.55); }
.lobby-verdict.out { background: rgba(231,76,60,0.18); color: #ff9f93; box-shadow: inset 0 0 0 2px rgba(231,76,60,0.45); }
.lobby-verdict.win { background: linear-gradient(135deg, #f39c12, #e74c3c); color: #fff; box-shadow: 0 6px 20px rgba(231,76,60,0.45); }
.lobby-count { font-size: 17px; color: #f5c542; font-weight: bold; margin-bottom: 18px; }
.lobby-rank { display: flex; flex-direction: column; gap: 5px; min-width: 300px; max-height: 52vh; overflow: hidden; }
.lobby-row { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: bold; }
.lobby-row .lr-rank { width: 26px; text-align: right; color: #aaa; }
.lobby-row .lr-dot { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.lobby-row .lr-name { flex: 1; }
.lobby-row .lr-pct { color: #f5c542; }
.lobby-row .lr-kills { color: #999; font-size: 12px; width: 34px; text-align: right; }
.lobby-row.me { background: rgba(255,255,255,0.12); border-radius: 5px; padding: 2px 6px; }
.lobby-hint { font-size: 13px; color: #bbb; margin-top: 18px; }

/* 라운드 종료 후 선택 (다시 플레이 / 홈으로) */
.lobby-choice { display: flex; gap: 12px; margin-top: 22px; }
.lc-btn {
  font: inherit; font-size: 17px; font-weight: bold; cursor: pointer;
  padding: 12px 30px; border-radius: 12px; border: none;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}
.lc-btn:hover { transform: scale(1.05); }
.lc-replay { background: #f5c542; color: #333; }
.lc-home { background: rgba(255,255,255,0.18); color: #eee; }
.lc-home:hover { background: rgba(255,255,255,0.28); }

/* 관전 바 */
.spec-bar {
  position: fixed; bottom: 14px; left: 50%; transform: translateX(-50%); z-index: 20;
  display: flex; align-items: center; gap: 10px;
  background: rgba(0,0,0,0.6); color: #fff; padding: 8px 14px; border-radius: 10px;
  font-size: 13px; font-weight: bold;
}
.spec-bar .spec-eye { color: #f5c542; }
.spec-bar button {
  font: inherit; border: none; cursor: pointer; border-radius: 6px;
  padding: 5px 12px; background: rgba(255,255,255,0.9); color: #333;
}
.spec-bar button:hover { background: #f5c542; }

/* 관전할 조 고르기 — 관전 바 바로 위에 한 줄로 쌓는다 */
.spec-rooms {
  position: fixed; bottom: 52px; left: 50%; transform: translateX(-50%); z-index: 20;
  display: flex; flex-wrap: wrap; justify-content: center; gap: 5px;
  max-width: min(560px, 94vw);
}
.spec-rooms button {
  font: inherit; font-size: 12px; font-weight: 800; cursor: pointer;
  border: none; border-radius: 8px; padding: 5px 10px;
  background: rgba(0,0,0,0.55); color: #e8f4f7;
}
.spec-rooms button:hover { background: rgba(245,197,66,0.9); color: #2d3436; }
.spec-rooms button.here { background: #f5c542; color: #2d3436; }
.spec-rooms button:disabled { opacity: 0.45; cursor: default; }

/* HUD — 알약 모양 배지로 통일한다. 게임 화면이 밝은 종이색이라
   반투명 흰 배경 + 옅은 그림자만으로도 충분히 떠 보인다. */
.hud-percent {
  position: fixed; top: 12px; left: 12px; z-index: 10;
  /* 배경/글자색/테두리색은 내 스킨 색으로 JS가 덮어쓴다 (HUD UPDATE 참조) */
  background: #f5c542; color: #333; border: 3px solid #d4a830;
  border-radius: 999px; padding: 5px 18px;
  font-size: 21px; font-weight: 900; font-variant-numeric: tabular-nums;
  box-shadow: 0 3px 10px rgba(0,0,0,0.18);
}
.hud-timer {
  position: fixed; top: 12px; right: 12px; z-index: 10;
  font-size: 21px; font-weight: 900; color: #2d3436;
  font-variant-numeric: tabular-nums;
  background: rgba(255,255,255,0.88); padding: 5px 18px; border-radius: 999px;
  box-shadow: 0 3px 10px rgba(0,0,0,0.14);
  transition: color 0.2s, background 0.2s;
}
/* 남은 30초 */
.hud-timer.urgent { color: #fff; background: rgba(233,69,96,0.92); animation: tick 1s steps(1) infinite; }
@keyframes tick { 0%{transform:scale(1);} 50%{transform:scale(1.07);} 100%{transform:scale(1);} }
.hud-kills {
  position: fixed; top: 54px; left: 12px; z-index: 10;
  font-size: 14px; font-weight: 900; color: #2d3436;
  background: rgba(255,255,255,0.82); padding: 3px 12px; border-radius: 999px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.12);
}

/* 방 배지 (상단 중앙) — 좌우는 점유율/타이머가 쓰므로 가운데에 둔다.
   z-index는 대기실(50)보다 위 — 라운드가 끝나 순위표가 덮여도 조 이름은 남아야 한다. */
.room-badge {
  position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 60;
  display: flex; align-items: center; gap: 8px;
  background: rgba(45,52,54,0.86); color: #fff;
  padding: 5px 14px; border-radius: 999px;
  font-size: 13px; font-weight: 900; white-space: nowrap;
  box-shadow: 0 3px 10px rgba(0,0,0,0.2);
}
.room-badge span {
  background: #f5c542; color: #2d3436;
  padding: 1px 8px; border-radius: 999px;
  font-variant-numeric: tabular-nums; letter-spacing: 1px;
}

/* 운영자 공지 / 진출 안내 토스트 — 방 배지 바로 아래로 내려온다 */
.notice {
  position: fixed; top: 50px; left: 50%; z-index: 60;
  max-width: min(420px, 88vw); padding: 9px 18px;
  background: rgba(245,197,66,0.96); color: #2d3436;
  border-radius: 10px; text-align: center;
  font-size: 14px; font-weight: bold; line-height: 1.4;
  box-shadow: 0 4px 16px rgba(0,0,0,0.25);
  opacity: 0; transform: translate(-50%, -8px);
  transition: opacity 0.2s, transform 0.2s;
}
.notice.show { opacity: 1; transform: translate(-50%, 0); }

/* 리더보드 — 막대 길이가 1위 대비 영역 비율이다 (JS가 width를 준다) */
.leaderboard {
  position: fixed; top: 54px; right: 12px; z-index: 10;
  width: 186px; padding: 7px 8px;
  background: rgba(255,255,255,0.62); border-radius: 10px;
  box-shadow: 0 3px 10px rgba(0,0,0,0.12);
}
.lb-row { display: flex; align-items: center; gap: 5px; margin: 3px 0; height: 20px; }
.lb-rank { width: 15px; text-align: center; color: #5a6a70; font-size: 11px; font-weight: 900; flex: none; }
.lb-track {
  position: relative; flex: 1; height: 100%;
  background: rgba(0,0,0,0.07); border-radius: 5px; overflow: hidden;
}
.lb-bar { height: 100%; border-radius: 5px; transition: width 0.3s; }
.lb-bar.me { box-shadow: inset 0 0 0 2px #2d3436; }
/* 이름은 막대 위에 겹쳐 얹는다 — 막대가 짧아도 글자가 잘리지 않게 */
.lb-lbl {
  position: absolute; inset: 0; display: flex; align-items: center;
  padding: 0 7px; font-size: 11px; font-weight: bold; color: #2d3436;
  white-space: nowrap; overflow: hidden;
  text-shadow: 0 1px 2px rgba(255,255,255,0.75);
}
.lb-lbl b { margin-left: auto; padding-left: 6px; font-variant-numeric: tabular-nums; }

/* 킬피드 */
.kill-feed { position: fixed; top: 50%; left: 12px; transform: translateY(-50%); z-index: 10; display: flex; flex-direction: column; gap: 4px; }
.kill-feed div {
  background: rgba(0,0,0,0.6); color: #fff; padding: 3px 10px; border-radius: 6px;
  opacity: 0; animation: feedIn 3s forwards; font-size: 12px; font-weight: bold;
}
@keyframes feedIn { 0%{opacity:0;transform:translateX(-10px);} 10%{opacity:1;transform:translateX(0);} 80%{opacity:1;} 100%{opacity:0;} }

/* 미니맵 — 캔버스 한 변 = 맵 한 변. 테두리가 곧 맵 경계다. */
.minimap {
  position: fixed; bottom: 14px; left: 12px; z-index: 10;
  width: 150px; height: 150px;
  /* 캔버스 한 변이 맵 한 변이므로 배경이 곧 "종이"다 — 인게임 맵과 같은 색으로 둔다
     (client/game.js PAPER) */
  background: #f7fbfc;
  border: 3px solid rgba(45,80,95,0.35);
  border-radius: 10px;
  box-shadow: 0 3px 12px rgba(0,0,0,0.18);
}
/* 좁은 화면에서는 부스트 게이지(하단 중앙)와 부딪히지 않게 줄인다 */
@media (max-width: 600px) {
  .minimap { width: 104px; height: 104px; bottom: 40px; }
}

/* 사망 요약 — 죽은 뒤 부활까지 화면 중앙에 띄운다.
   대기실(z-index 50)보다 아래에 둔다 — 라운드가 끝나면 순위표가 이 위를 덮어야 한다. */
.death-panel {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 40;
  min-width: 260px; padding: 18px 24px;
  background: rgba(0,0,0,0.72); color: #fff;
  border-radius: 14px; box-shadow: 0 6px 24px rgba(0,0,0,0.28);
  text-align: center;
}
.dp-title { font-size: 24px; font-weight: 900; }
.dp-sub { font-size: 13px; font-weight: bold; color: #f5c542; margin: 4px 0 14px; }
.dp-stats { display: flex; flex-direction: column; gap: 6px; }
.dp-row { display: flex; justify-content: space-between; gap: 24px; font-size: 13px; font-weight: bold; }
.dp-row span { color: #aaa; font-weight: normal; }
/* 숫자가 매 프레임 바뀌어도 폭이 흔들리지 않게 */
.dp-row b { font-variant-numeric: tabular-nums; }
.dp-best { margin-top: 12px; font-size: 15px; font-weight: bold; color: #f5c542; animation: dpPop 0.45s ease-out; }
@keyframes dpPop { 0%{transform:scale(0.6);opacity:0;} 60%{transform:scale(1.12);} 100%{transform:scale(1);opacity:1;} }
.dp-respawn { margin-top: 12px; font-size: 12px; color: #bbb; }

/* 사운드 토글 — 시작 화면(z-index 100)에서도 눌러야 하므로 그 위에 둔다.
   우상단은 타이머(.hud-timer)가 쓰므로 우하단에 붙인다. */
.sound-btn {
  position: fixed; bottom: 14px; right: 12px; z-index: 110;
  width: 34px; height: 34px; border-radius: 50%;
  border: none; cursor: pointer; font-size: 16px; line-height: 1;
  background: rgba(255,255,255,0.8); color: #333;
  box-shadow: 0 2px 6px rgba(0,0,0,0.12);
}
.sound-btn:hover { background: #f5c542; }

/* 부스트 */
.boost-hud {
  position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 10;
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 900; color: #2d3436;
  background: rgba(255,255,255,0.82); padding: 6px 14px; border-radius: 999px;
  box-shadow: 0 3px 10px rgba(0,0,0,0.14);
}
.boost-bg { width: 130px; height: 10px; background: rgba(0,0,0,0.14); border-radius: 5px; overflow: hidden; }
.boost-fill { height: 100%; border-radius: 5px; transition: width 0.1s; width: 100%; background: #f39c12; }
/* 게이지 위를 훑는 하이라이트 — 준비 완료를 눈에 띄게 */
.boost-fill::after {
  content: ''; display: block; height: 45%;
  margin: 1px 2px 0; border-radius: 3px; background: rgba(255,255,255,0.4);
}
#boostLbl { min-width: 44px; font-variant-numeric: tabular-nums; }
