@font-face { font-family: "Titillium Web"; font-weight: 400; src: url("fonts/TitilliumWeb-Regular.woff") format("woff"); font-display: swap; }
@font-face { font-family: "Titillium Web"; font-weight: 600; src: url("fonts/TitilliumWeb-SemiBold.woff") format("woff"); font-display: swap; }
@font-face { font-family: "Titillium Web"; font-weight: 700; src: url("fonts/TitilliumWeb-Bold.woff") format("woff"); font-display: swap; }
@font-face { font-family: "Titillium Web"; font-weight: 900; src: url("fonts/TitilliumWeb-Black.woff") format("woff"); font-display: swap; }
@font-face { font-family: "Gothic A1"; font-weight: 400 500; src: url("fonts/GothicA1-Medium.woff") format("woff"); font-display: swap; }
@font-face { font-family: "Gothic A1"; font-weight: 600 700; src: url("fonts/GothicA1-Bold.woff") format("woff"); font-display: swap; }
@font-face { font-family: "Gothic A1"; font-weight: 800 900; src: url("fonts/GothicA1-ExtraBold.woff") format("woff"); font-display: swap; }

:root {
  --bg: rgba(255, 255, 255, .9);
  --line: #e3e7ee;
  --text: #1d2433;
  --ink: #1d3c8a;
  --scene-ink: #2d2a4a; /* 장면(파스텔 하늘·지형) 위에 바로 놓이는 글자: 그림자 없이도 읽히는 짙은 남보라 */
  --muted: #8c95a6;
  /* 짙은 하늘 위 UI 판: 탈락 창·룸 선택 창·순위판과 같은 남색 반투명 + 검정 테두리 */
  --panel: rgba(15, 18, 48, .78); --panel-edge: 0 0 0 2px #000; --panel-hi: rgba(255, 255, 255, .1);
  --navy: linear-gradient(180deg, #2f7bff, #1550d8);
  --red: #e8231b;
  --radius: 5px;
  --font: "Titillium Web", "Gothic A1", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  /* 하늘: 짙은 남색 우주 한 색 (그라데이션 없이). 화면에서 가장 조용한 층 */
  background: #1d2050;
  font-family: var(--font);
  font-weight: 700;
  color: var(--text);
  -webkit-user-select: none;
  user-select: none;
  touch-action: none;
}

/* 처음 불러오는 화면 */
#loading {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center;
  background: #1d2050; /* 로비·게임 하늘과 같은 한 색: 사라질 때 이어진다 */
  transition: opacity .6s ease;
}
#loading.out { opacity: 0; pointer-events: none; }
#loading .box { width: min(320px, 80vw); text-align: center; color: #fff; } /* 짙은 남색 하늘 위 */
/* 로고: 캐릭터가 통통 뛴다 (뛰어오를 때 늘고, 내려앉을 때 눌린다). 그림자는 뛰면 작아진다 */
#loading .mascot { display: block; width: 104px; height: 127px; margin: 0 auto; overflow: visible; }
#loading .mascot .hop { transform-box: view-box; transform-origin: 0 0; animation: hop 1.1s ease-in-out infinite; }
#loading .mascot .shadow { fill: rgba(0, 0, 0, .3); transform-box: fill-box; transform-origin: center; animation: hop-shadow 1.1s ease-in-out infinite; }
@keyframes hop { 0%, 100% { transform: scale(1.06, .92); } 45% { transform: translateY(-14px) scale(.96, 1.05); } }
#loading .mascot .cloth { transform-box: fill-box; transform-origin: 0 50%; animation: wave .9s ease-in-out infinite alternate; } /* 깃대 쪽을 축으로 펄럭 */
@keyframes wave { from { transform: skewY(-5deg) scaleX(.96); } to { transform: skewY(5deg) scaleX(1); } }
@keyframes hop-shadow { 45% { transform: scale(.75); opacity: .6; } }
/* 이름: 로비 제목(#start h1)과 같은 글꼴·색 (흰 "G" + 빨간 "Grab" + 흰 ".io") */
#loading .name { margin: 12px 0 18px; font-family: "Titillium Web", "Gothic A1", sans-serif; font-size: 40px; font-weight: 900; line-height: 1.1; letter-spacing: -.5px; color: #fff; }
#loading .name b { color: #e8231b; }
#loading .bar { height: 10px; border-radius: 999px; overflow: hidden; background: rgba(255, 255, 255, .35); box-shadow: inset 0 1px 2px rgba(10, 40, 100, .2); }
#loading .bar i { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, #ffe14a, #ffc800); box-shadow: 0 0 8px rgba(255, 200, 0, .6); }
#loading .msg { margin-top: 10px; min-height: 1.3em; font-size: 13px; font-weight: 600; opacity: .9; }
#loading.warn .msg { color: #fff; background: rgba(232, 35, 27, .75); border-radius: 4px; padding: 3px 8px; display: inline-block; }

#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; transition: filter .6s; }
body:has(#start:not([hidden])) #game { cursor: grab; touch-action: none; } /* 첫 화면(로비): 끌어서 둘러보기 */
body:has(#start:not([hidden])) #game.dragging { cursor: grabbing; }
/* 게임 중 마우스: 커서를 조준점(흰 고리 + 가운데 점, 검정 테두리)으로. 부스터 중엔 빨간 고리 (input.js) */
#game.aiming { cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32'%3E%3Ccircle cx='16' cy='16' r='10' fill='none' stroke='%23000' stroke-width='5'/%3E%3Ccircle cx='16' cy='16' r='10' fill='none' stroke='%23fff' stroke-width='2.5'/%3E%3Ccircle cx='16' cy='16' r='2.6' fill='%23fff' stroke='%23000' stroke-width='1.5'/%3E%3C/svg%3E") 16 16, crosshair; }
#game.aiming.boosting { cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32'%3E%3Ccircle cx='16' cy='16' r='10' fill='rgba(232,35,27,.35)' stroke='%23000' stroke-width='5'/%3E%3Ccircle cx='16' cy='16' r='10' fill='none' stroke='%23e8231b' stroke-width='2.5'/%3E%3Ccircle cx='16' cy='16' r='2.6' fill='%23fff' stroke='%23000' stroke-width='1.5'/%3E%3C/svg%3E") 16 16, crosshair; }
/* 게임 중 터치: 누르는 동안 손가락 둘레 고리, 떼면 작은 점으로 남는다 (계속 그쪽으로 간다). 부스터 중엔 빨강 */
#touch-mark {
  position: fixed; left: 0; top: 0; width: 64px; height: 64px; margin: -32px 0 0 -32px; z-index: 5;
  pointer-events: none; opacity: 0; transition: opacity .3s;
}
#touch-mark::before, #touch-mark::after { content: ""; position: absolute; border-radius: 50%; transition: transform .25s ease-out, opacity .25s; }
#touch-mark::before { inset: 0; border: 3px solid #fff; box-shadow: 0 0 0 2px rgba(0, 0, 0, .55), inset 0 0 0 2px rgba(0, 0, 0, .35); }
#touch-mark::after { left: 50%; top: 50%; width: 12px; height: 12px; margin: -6px 0 0 -6px; background: #fff; box-shadow: 0 0 0 2px #000; }
#touch-mark.down, #touch-mark.rest { opacity: 1; }
#touch-mark.rest::before { transform: scale(.3); opacity: 0; }
#touch-mark.rest::after { opacity: .75; }
#touch-mark.boost::before { border-color: var(--red); background: rgba(232, 35, 27, .25); }
#touch-mark.boost::after { background: var(--red); }
#touch-mark.pop::before { animation: mark-pop .25s ease-out; }
@keyframes mark-pop { from { transform: scale(.4); opacity: 0; } }
#game.demo-in { animation: demo-in .9s ease-out; } /* 로비 데모를 처음부터 다시 틀 때 (main.js) */
@keyframes demo-in { from { opacity: .15; } }
#game.gray { filter: grayscale(.85) brightness(.92); transition: filter .8s .35s; } /* 내가 탈락한 동안 (터지는 색을 잠깐 보여 준 뒤 바랜다) */

/* 탈락 자리·레벨업 때 떠오르는 글자 (fx/texts.js). 파스텔 스티커: 파스텔로 채우고 짙은 남보라 외곽선 (fx/palette.js 와 같은 색).
   파스텔 하늘·지형 위에서 파스텔 글자가 읽히도록 대비는 색이 아니라 외곽선으로 준다. paint-order: 외곽선을 글자 뒤에 그려 글자가 가늘어지지 않게 */
:root {
  --fx-ink: #463a6e;
  --fx-cream: #fff8ec; --fx-butter: #ffe09a; --fx-peach: #ffc4a8; --fx-coral: #ffaaa0;
  --fx-pink: #ffb3d9; --fx-lilac: #d8c6ff; --fx-mint: #b8efd4; --fx-apricot: #ffcf94;
}
.fx-text {
  position: absolute; left: 0; top: 0; white-space: nowrap; pointer-events: none;
  font-size: 22px; font-weight: 900; color: var(--fx-peach);
  -webkit-text-stroke: 4px var(--fx-ink); paint-order: stroke fill; stroke-linejoin: round;
}
.fx-text .nm { color: color-mix(in srgb, var(--c) 78%, #1a1630); }
/* 처치 알림 (hud.js KillFeed): 화면 가운데 위에 "A killed B" 를 쌓는다. 이름은 그 플레이어 색, 나와 관련되면 크고 산호색.
   짙은 하늘·행성 어디 위에서도 읽히게 흰 글자 + 검정 외곽선. 탄력 있게 나타났다가 몇 초 뒤 위로 흐려지며 사라진다 */
#feed {
  position: absolute; left: 50%; top: max(12px, env(safe-area-inset-top)); transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 3px; pointer-events: none;
}
body:has(#start:not([hidden])) #feed { display: none; } /* 로비(녹화 데모)에서는 숨긴다 */
#feed .kf {
  white-space: nowrap; font-size: 15px; font-weight: 800; color: #fff;
  -webkit-text-stroke: 3px #000; paint-order: stroke fill; stroke-linejoin: round;
  animation: kf-in .35s cubic-bezier(.2, 1.6, .4, 1) both;
}
#feed .kf.me { font-size: 20px; font-weight: 900; color: var(--fx-coral); -webkit-text-stroke-width: 4px; }
#feed .kf .nm { color: color-mix(in srgb, var(--c) 70%, #fff); }
#feed .kf.out { animation: kf-out .4s ease-in forwards; }
@keyframes kf-in { from { opacity: 0; transform: scale(.6); } }
@keyframes kf-out { to { opacity: 0; transform: translateY(-6px); } }
/* 연속 처치: 내 머리 위에서 크게 튀어나왔다가 탄력 있게 줄어든다 (이어 잡을수록 크고 피치 → 코랄 → 핑크 → 라일락) */
.fx-text.combo { font-size: 26px; font-weight: 900; letter-spacing: .5px; color: var(--fx-peach); -webkit-text-stroke-width: 5px; animation: combo-pop .5s cubic-bezier(.2, 1.7, .4, 1) both; }
.fx-text.combo.c2 { font-size: 30px; color: var(--fx-coral); }
.fx-text.combo.c3 { font-size: 34px; color: var(--fx-pink); }
.fx-text.combo.c4 { font-size: 38px; color: var(--fx-lilac); }
@keyframes combo-pop { 0% { scale: 2.4; } 55% { scale: .88; } 100% { scale: 1; } }
/* 아이템 상자를 먹었을 때 머리 위 글자 (main.js itemget): 무엇이 나왔는지. 내 것은 크게 */
.fx-text.item { font-size: 18px; letter-spacing: .5px; animation: combo-pop .45s cubic-bezier(.2, 1.7, .4, 1) both; }
.fx-text.item.mine { font-size: 28px; -webkit-text-stroke-width: 5px; }
.fx-text.item.boost { color: var(--fx-butter); }
.fx-text.item.level { color: var(--fx-mint); }
#hud { position: fixed; inset: 0; pointer-events: none; }

/* 이름표 */
#labels { position: absolute; inset: 0; overflow: hidden; }
.label {
  position: absolute; left: 0; top: 0;
  padding: 1px 4px;
  font-size: 13px; font-weight: 800; color: var(--scene-ink); white-space: nowrap;
  /* 배경 없이 글자만: 파스텔 지형 위에서 읽히는 짙은 잉크색. 지평선 너머 짙은 하늘에 걸려도 읽히게 옅은 흰 테두리 빛 */
  text-shadow: 0 0 3px rgba(255, 255, 255, .75);
  will-change: transform;
}
.label.me { font-size: 14px; }
.label { display: flex; flex-direction: column; align-items: center; line-height: 1.15; }
.label .top {
  /* 윗줄: 레벨, 처치 수, 점유율을 크림색 알약 하나에 담는다 (항목마다 다른 색 바탕을 두지 않아 깔끔하게). 글자는 짙은 잉크색 */
  position: relative; display: flex; align-items: center; gap: 1px; margin-bottom: 2px; padding: 1px 2px; border-radius: 999px;
  font-size: 12px; font-weight: 800; color: var(--scene-ink); font-variant-numeric: tabular-nums;
  background: rgba(255, 250, 242, .9); box-shadow: 0 1px 2px rgba(45, 42, 74, .2), inset 0 0 0 1px rgba(45, 42, 74, .08);
}
.label.me .top { font-size: 13px; }
.label .top > span { padding: 0 4px; border-radius: 999px; }
/* 항목 사이 가는 세로선 */
.label .top > span + span { background-image: linear-gradient(rgba(45, 42, 74, .16), rgba(45, 42, 74, .16)); background-size: 1px 60%; background-position: left center; background-repeat: no-repeat; }
.label .who { display: flex; align-items: center; gap: 4px; } /* 이름 (레벨은 윗줄 .top 에 처치 수·점유율과 함께) */
/* 처치 수: 칼 모양만 코랄빛 */
.label .kl::first-letter { color: #e8590c; }
/* 실시간 점유율: 깃발 아이콘(청록) + 숫자. 숫자는 모든 캐릭터가 같은 잉크색 (늘면 빨강, 줄면 파랑으로 잠깐 바뀐다) */
.label .pc { position: relative; color: var(--scene-ink); }
.label .pc:empty { display: none; }
.label .pc::before { content: "\2691\FE0E"; margin-right: 3px; color: #0c8599; } /* ⚑ (FE0E: 컬러 이모지 대신 글자 모양) */
/* 점유율이 늘면 빨간 글자로 톡, 많이 늘면(1% 넘게) 더 크게, 줄면 파란 글자로 좌우로 흔들림 (players.js labelArea).
   바탕은 바꾸지 않고 글자 색만, 클래스가 붙어 있는 동안(약 1.2초)만. ▲▼ 는 위에 뜨는 변화량 앞에 */
.label .pc.up { color: #e03131; }
.label .pc.down { color: #1c7ed6; }
.label .pc.up { animation: pc-up .55s cubic-bezier(.2, 1.6, .4, 1); }
.label .pc.up.big { animation: pc-up-big .9s cubic-bezier(.2, 1.6, .4, 1); }
.label .pc.down { animation: pc-down .5s ease-out; }
/* 변화량: 점유율 바로 위에 "▲0.84%" 가 잠깐 뜬다 (players.js labelArea 가 data-d 에 넣고 PC_ARROW 뒤에 지운다).
   absolute 라 알약 폭은 그대로. 알약 밖 지형 위에서도 읽히게 흰 테두리 */
.label .pc[data-d]::after {
  content: attr(data-d); position: absolute; left: 50%; bottom: 100%; margin-bottom: 3px;
  font-size: 11px; font-weight: 900; white-space: nowrap; pointer-events: none;
  -webkit-text-stroke: 3px #fff; paint-order: stroke fill; text-shadow: none;
  transform: translateX(-50%); animation: pc-delta .4s cubic-bezier(.2, 1.6, .4, 1);
}
/* 색은 data-dir 로 (up·down 클래스는 다시 붙이는 사이 한 프레임 빠진다) */
.label .pc[data-dir="up"]::after { color: #e03131; }
.label .pc[data-dir="down"]::after { color: #1c7ed6; }
@keyframes pc-delta { from { opacity: 0; transform: translate(-50%, 5px) scale(.7); } }
@keyframes pc-up {
  0% { transform: scale(1); }
  30% { transform: scale(1.35); }
  100% { transform: scale(1); }
}
@keyframes pc-up-big {
  0% { transform: scale(1); }
  25% { transform: scale(1.8); }
  100% { transform: scale(1); }
}
@keyframes pc-down {
  0%, 100% { transform: translateX(0); }
  15% { transform: translateX(-3px); }
  35% { transform: translateX(3px); }
  55% { transform: translateX(-2px); }
  75% { transform: translateX(1px); }
}
/* 레벨: 윗줄 크림색 알약 안에 "Lv.n" */
.label .lv { display: inline-block; padding-left: 2px; letter-spacing: .2px; }
/* 레벨업: 레벨 표시가 크게 튀었다가 돌아온다 */
.label.lvup .lv { animation: lv-pop .9s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes lv-pop {
  0% { transform: scale(1); }
  25% { transform: scale(1.9); box-shadow: 0 0 14px #ffd23f; }
  100% { transform: scale(1); }
}
/* 레벨업 때 윗줄 알약 오른쪽에 잠깐 뜨는 민트색 "Spd +N%" 칩 (players.js setLevel). absolute 라 이름표 폭·가운데 정렬은 그대로.
   시간은 players.js LV_SHOW 와 같게 */
.label .spd {
  position: absolute; left: 100%; top: 50%; margin-left: 4px; padding: 1px 6px; border-radius: 999px;
  font-style: normal; font-size: 11px; font-weight: 800; white-space: nowrap; pointer-events: none;
  color: #17543a; background: #b8efd4; box-shadow: 0 1px 2px rgba(45, 42, 74, .25);
  opacity: 0; transform: translateY(-50%); transform-origin: left center;
}
.label .spd:empty { display: none; }
.label.lvup .spd { animation: spd-show 1.6s cubic-bezier(.2, 1.6, .4, 1) both; }
@keyframes spd-show {
  0% { opacity: 0; transform: translate(-6px, -50%) scale(.6); }
  15% { opacity: 1; transform: translate(0, -50%) scale(1.15); }
  25% { transform: translate(0, -50%) scale(1); }
  80% { opacity: 1; transform: translate(0, -50%) scale(1); }
  100% { opacity: 0; transform: translate(0, -60%) scale(1); }
}

/* 오른쪽 위: 순위 (반투명한 짙은 남색 판 위에 밝은 글자, 시스템 기본 폰트). 하늘이든 행성이든 위에서 읽힌다 */
#board {
  /* 폭은 내용에 맞춰 줄었다 늘었다 한다 (오른쪽 끝은 고정). 가장 넓어도 닉네임 16칸(영문 16자·한글 8자) + Lv.100 이 1위 줄에 들어가는 320px */
  position: absolute; right: 12px; top: 12px; width: max-content; min-width: 200px; max-width: 320px;
  border-radius: var(--radius); overflow: hidden;
  color: #eef0ff; background: rgba(15, 18, 48, .32);
  text-shadow: 0 1px 2px rgba(0, 0, 0, .7); /* 판이 옅어 밝은 땅 위에서도 글자가 읽히게 */
  /* 줄이 등수마다 오른쪽으로 물러나는 계단을 따라 판의 왼쪽 변도 비스듬히: 위는 그대로, 아래는 마지막 줄이 물러난 만큼 (--slant, hud.js) */
  clip-path: polygon(0 0, 100% 0, 100% 100%, var(--slant, 0px) 100%);
  font-family: system-ui, -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  font-size: 11px; font-weight: 500;
}
#board .head { display: flex; justify-content: flex-end; align-items: baseline; gap: 6px; white-space: nowrap; padding: 4px 9px; color: #eef0ff; font-weight: 700; }
#board .head small { opacity: .75; font-weight: 400; font-size: 9.5px; overflow: hidden; text-overflow: ellipsis; }
#board ol { margin: 0; padding: 3px 0; list-style: none; counter-reset: r; }
/* 계단식: 1위는 왼쪽 위에서 크게, 등수가 내려갈수록 오른쪽으로 물러나며 작아진다 (--i: 0부터, hud.js) */
#board li { --step: 3px; display: flex; align-items: center; gap: 3px; padding: 1px 9px; margin-left: calc(var(--i, 0) * var(--step)); counter-increment: r; border-radius: 4px; }
#board li::before { content: counter(r); width: 14px; flex: none; color: rgba(255, 255, 255, .5); text-align: right; font-variant-numeric: tabular-nums; }
#board li:nth-child(1) { --rk: #ffc83d; font-size: 13px; font-weight: 800; padding: 3px 9px; background: linear-gradient(90deg, rgba(255, 200, 40, .32), rgba(255, 200, 40, 0) 85%); }
#board li:nth-child(2) { --rk: #c4cedb; font-size: 12px; font-weight: 700; padding: 2px 9px; background: linear-gradient(90deg, rgba(220, 230, 240, .2), rgba(220, 230, 240, 0) 80%); }
#board li:nth-child(3) { --rk: #f0a060; font-size: 11.5px; font-weight: 700; padding: 2px 9px; background: linear-gradient(90deg, rgba(230, 150, 90, .2), rgba(230, 150, 90, 0) 75%); }
#board li:nth-child(-n+3)::before { color: var(--rk); font-weight: 800; width: 16px; }
#board li:nth-child(1) .sc { color: #ffd23f; }
#board li.extra { font-size: 11px; font-weight: 700; padding: 1px 9px; background: none; }
/* 레벨 "Lv.n": 작은 알약 (모두 같은 색) */
#board li .ri, .lg-rows .ri {
  flex: none; display: inline-flex; align-items: center; justify-content: center; padding: 0 4px; border-radius: 999px;
  min-width: 2.7em; font-size: .82em; font-weight: 800; line-height: 1.35; font-variant-numeric: tabular-nums;
  color: #fff; background: rgba(20, 30, 50, .55);
}
/* 이름은 플레이어 색으로 (색 사각형 대신). 짙은 판 위에서 남색 같은 어두운 색도 읽히게 흰색을 조금 섞는다 */
#board li .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: color-mix(in srgb, var(--c, #888) 70%, #fff); }
#board li .kl { flex: none; min-width: 28px; white-space: nowrap; text-align: right; color: rgba(255, 255, 255, .55); font-variant-numeric: tabular-nums; } /* 처치 수 */
#board li .pc { flex: none; min-width: 34px; white-space: nowrap; text-align: right; color: rgba(255, 255, 255, .55); font-variant-numeric: tabular-nums; } /* 지금 점유율 */
#board li .sc { flex: none; min-width: 40px; margin-left: 4px; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; } /* 이번 판 점수 (순위 기준) */
#board li.me { background-color: rgba(255, 255, 255, .16); font-weight: 700; }
#board li.extra { margin-top: 3px; border-top: 1px dashed rgba(255, 255, 255, .35); padding-top: 2px; } /* 10위 밖 내 순위 */

body:has(#start:not([hidden])) #board { display: none; } /* 로비 배경은 녹화 데모라 순위표(실시간 정보)를 보이지 않는다 */

/* 왼쪽 위: 이번 판 점수 (휴대폰에서 전체 화면 버튼이 보이면 그 오른쪽). 배경 없이 글자만: 짙은 하늘 위 흰 글자 (행성 위로 내려와도 읽히게 옅은 그림자) */
#score {
  position: absolute; left: max(12px, env(safe-area-inset-left)); top: max(10px, env(safe-area-inset-top));
  display: flex; align-items: baseline; gap: 7px; padding: 4px 2px 5px; pointer-events: none;
}
body:has(#btn-fs:not([hidden])) #score { left: calc(max(12px, env(safe-area-inset-left)) + 48px); }
#score { text-shadow: 0 1px 3px rgba(10, 12, 40, .6); }
#score small { color: rgba(255, 255, 255, .7); font-size: 16.5px; font-weight: 800; letter-spacing: .6px; text-transform: uppercase; }
#score b { min-width: 2ch; color: #fff; font-size: 30px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }

/* 아래 가운데: 부스터 게이지. 남색 판 + 검정 테두리, 납작한 단색 막대: 모으는 중 라일락 → 쓸 수 있음 버터 → 쓰는 중 빨강 */
#boost {
  position: absolute; left: 50%; bottom: 40px; transform: translateX(-50%);
  width: min(320px, calc(100% - 300px)); min-width: 180px;
  display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 4px 10px;
  padding: 7px 10px 6px; border-radius: 8px;
  background: var(--panel); box-shadow: var(--panel-edge);
  font-size: 12px; color: #fff;
}
#boost .bar {
  grid-column: 1 / -1; height: 12px; border-radius: 4px; overflow: hidden;
  background: var(--panel-hi); box-shadow: inset 0 0 0 1.5px rgba(0, 0, 0, .6);
}
#boost .bar i { display: block; height: 100%; width: 0; border-radius: 4px; background: #8d86b8; transition: width .1s linear; }
#boost.ready .bar i { background: var(--fx-butter); }
#boost.on .bar i { background: var(--red); }
#boost .name {
  font-family: "Titillium Web", "Gothic A1", sans-serif; font-size: 14px; font-weight: 900; letter-spacing: 1px; text-transform: uppercase;
  color: rgba(255, 255, 255, .75); -webkit-text-stroke: 3px #000; paint-order: stroke fill;
}
#boost.ready .name { color: var(--fx-butter); }
#boost.on .name { color: var(--red); }
#boost .hint { justify-self: end; color: rgba(255, 255, 255, .6); font-weight: 600; }
#boost.home .hint { color: var(--fx-butter); }
#boost.home .hint::before { content: "⚡ "; }
#boost.on .name::after { content: " ON!"; }
/* 무한 부스터(아이템): 막대가 가득 찬 채 무지개빛으로 흐르고, 힌트 자리에 남은 초 (hud.js updateBoost 의 data-left) */
#boost.inf .bar i { background: linear-gradient(90deg, #ff8787, #ffd43b, #69db7c, #4dabf7, #b197fc, #ff8787) 0 0 / 200% 100%; animation: inf-flow .8s linear infinite; }
#boost.inf .name { color: var(--fx-butter); }
#boost.inf .hint { font-size: 0; }
#boost.inf .hint::before { content: none; }
#boost.inf .hint::after { content: attr(data-left); font-size: 12px; color: var(--fx-butter); }
@keyframes inf-flow { to { background-position: -200% 0; } }

#help {
  position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); white-space: nowrap;
  padding: 2px 10px; border-radius: 10px; font-size: 11px; color: #fff; background: rgba(10, 16, 34, .35);
}
/* ?fps: 성능 확인용 */
#fps { position: fixed; left: 8px; top: 92px; z-index: 50; padding: 2px 7px; white-space: pre; border-radius: 4px; font: 11px/1.4 ui-monospace, monospace; color: #fff; background: rgba(0, 0, 0, .6); pointer-events: none; }
#ping {
  /* 오른쪽 아래 맨 구석. 미니맵은 그 위 (minimap.js BOTTOM) */
  position: absolute; right: 14px; bottom: 14px; padding: 1px 8px; border-radius: 9px;
  font-size: 11px; color: #fff; background: rgba(10, 16, 34, .35); pointer-events: none;
}
#ping::before { content: '●'; margin-right: 4px; font-size: 9px; }
#ping.good::before { color: #5ee36a; }
#ping.ok::before { color: #ffd23f; }
#ping.bad::before { color: #ff5a4f; }
#offline {
  position: absolute; left: 50%; top: 14px; transform: translateX(-50%);
  padding: 6px 14px; border-radius: 4px; color: #fff; background: var(--red);
}


/* 처음 화면: 관전 위에 제목과 닉네임 입력·시작 버튼 */
#start { position: fixed; inset: 0; pointer-events: none; --logo: clamp(44px, 6.4vw, 72px); --logo-top: max(28px, env(safe-area-inset-top)); --logo-gap: 32px; } /* --logo: 제목 글자 크기, --logo-top: 제목 위 여백, --logo-gap: 제목과 HIGH SCORES 사이 (표 위치도 이것으로) */
/* 제목: 화면 가운데 위, HIGH SCORES 바로 위에 한 줄. 흰색 */
#start h1 {
  position: absolute; left: 50%; top: var(--logo-top); transform: translateX(-50%);
  margin: 0; white-space: nowrap; line-height: 1.1;
  font-size: var(--logo); font-weight: 900; letter-spacing: -.5px; color: #fff;
}
#start h1 b { display: inline; color: #e8231b; } /* GGrab.io: 가운데 "Grab" 만 빨강 */
#start .cta {
  position: absolute; left: 50%; bottom: max(28px, 5vh, env(safe-area-inset-bottom)); transform: translateX(-50%); margin: 0;
  display: flex; flex-direction: column; align-items: center; text-align: center;
  width: min(320px, calc(100vw - 32px));
}
/* 가운데: 고른 룸의 레전드 (hud.js RoomLegend). 옛 오락실 게임의 HIGH SCORES 표처럼 바탕 없이 큰 글자만.
   하늘·행성 위에서 읽히게 흰 글자에 검정 외곽선. 줄은 모두 흰색 (1위만 조금 크게).
   칸: 순위 · 점수 · 이름 · (그 판의 점유율·처치). 표처럼 세로 줄을 맞추려고 ol 이 격자, li 는 display: contents */
#room-legend {
  /* 제목(GGrab.io) 바로 아래: 제목 위치 + 제목 높이(글자 × 1.1) + 틈 */
  position: absolute; left: 50%; top: calc(var(--logo-top) + var(--logo) * 1.1 + var(--logo-gap)); transform: translateX(-50%);
  width: min(560px, calc(100vw - 24px)); text-align: center;
  font-family: "Titillium Web", "Gothic A1", sans-serif; font-weight: 400; color: #fff;
  -webkit-text-stroke: 4px #000; paint-order: stroke fill; /* 외곽선은 모두 검정 */
}
#room-legend h2 { margin: 0 0 6px; font-size: 28px; font-weight: 900; line-height: 1.1; letter-spacing: 2px; color: var(--fx-butter); }
#room-legend h2 .ttl { display: block; }
#room-legend h2 .room { display: block; font-size: 17px; letter-spacing: 1px; color: var(--fx-mint); -webkit-text-stroke-width: 4px; }
#room-legend ol {
  display: grid; grid-template-columns: max-content minmax(0, max-content) max-content max-content; column-gap: 22px; /* 순위 · 이름(길면 줄임) · 점수 · 점유율·처치 */ row-gap: 8px;
  width: max-content; max-width: 100%; margin: 0 auto; padding: 0; list-style: none; font-size: 20px; font-weight: 600; line-height: 1.22; font-variant-numeric: tabular-nums;
}
#room-legend li { display: contents; }
#room-legend li > span { white-space: nowrap; }
#room-legend .rk { text-align: right; }
#room-legend .sc { text-align: right; }
#room-legend .nm { text-align: left; overflow: hidden; text-overflow: ellipsis; padding: 0 3px; } /* padding: 외곽선이 잘리지 않게 */
#room-legend .ex { text-align: left; align-self: center; font-size: .6em; font-weight: 600; -webkit-text-stroke-width: 2.5px; }
#room-legend .r1 { font-size: 1.12em; }
#room-legend li.empty { color: rgba(255, 255, 255, .75); }
#room-legend li.empty > span { letter-spacing: 1px; }
/* 휴대폰: 글자를 줄인다. 낮은 화면(가로로 든 휴대폰)에서는 룸 목록·닉네임 칸 자리가 모자라 숨긴다 */
@media (max-width: 640px) {
  #room-legend { -webkit-text-stroke-width: 3.5px; }
  #room-legend h2 { font-size: 23px; }
  #room-legend h2 .room { font-size: 14px; -webkit-text-stroke-width: 3px; }
  #room-legend ol { font-size: 16px; column-gap: 11px; row-gap: 5px; }
  #room-legend .ex { -webkit-text-stroke-width: 2px; }
}
/* 표가 보이는 칸: 제목 아래부터 룸 목록 위까지 (높이는 hud.js RoomLegend.fit). 표가 더 길면 위로 천천히 흘러가고 (엔딩 크레딧처럼),
   끝나면 이어 붙인 같은 표(ol.copy)가 이어받아 끊김 없이 돈다. 위아래 가장자리는 흐리게 */
#room-legend .roll { overflow: hidden; padding: 0 6px; }
#room-legend .roll:has(.rolling) {
  -webkit-mask-image: linear-gradient(transparent, #000 18px, #000 calc(100% - 18px), transparent);
  mask-image: linear-gradient(transparent, #000 18px, #000 calc(100% - 18px), transparent);
}
#room-legend .reel.rolling { padding-top: 18px; } /* 멈춰 있는 처음에 1ST 가 위 흐린 띠에 걸리지 않게 */
#room-legend .reel ol + ol { margin-top: 56px; } /* 표 끝과 다음 바퀴 1ST 사이 */
#room-legend .reel.rolling { animation: hs-roll var(--dur, 60s) linear 2.5s infinite; will-change: transform; } /* 처음엔 1ST 부터 잠깐 보여 준다 */
@keyframes hs-roll { to { transform: translateY(calc(-1 * var(--loop, 0px))); } }
@media (prefers-reduced-motion: reduce) { #room-legend .reel.rolling { animation: none; } }
/* 칸이 너무 낮으면 (가로로 든 휴대폰 등) 숨긴다. display 가 아니라 visibility: 창이 커지면 다시 잴 수 있게 */
#room-legend.cramped { visibility: hidden; }
/* 로비에서는 데모 캐릭터의 이름표·떠오르는 글자를 숨긴다 (HIGH SCORES 글자와 겹쳐 읽기 어렵다) */
body:has(#room-legend:not([hidden])):has(#start:not([hidden])) #labels { display: none; }
#start .lbl {
  margin-bottom: 6px; font-family: "Titillium Web", "Gothic A1", sans-serif; font-size: 15px; font-weight: 900; letter-spacing: 1px;
  color: #fff; -webkit-text-stroke: 3px #000; paint-order: stroke fill;
}
/* 닉네임 칸과 시작 버튼을 한 덩어리로 */
/* 전체 화면 버튼 (휴대폰, 모든 화면): 동그란 반투명 버튼에 아이콘 (전체 화면이면 줄이기 아이콘으로).
   첫 화면에서는 왼쪽 위 제목 아래, 게임 중에는 제목이 없으니 왼쪽 위 구석. 창(탈락·레전드) 위에도 보이고 눌린다 */
#btn-fs {
  position: fixed; z-index: 30; left: max(12px, env(safe-area-inset-left)); top: calc(max(10px, env(safe-area-inset-top)) + 36px);
  display: grid; place-items: center; width: 38px; height: 38px; padding: 0; border: 0; border-radius: 50%;
  background: var(--panel); box-shadow: var(--panel-edge); color: #fff; cursor: pointer; pointer-events: auto; -webkit-tap-highlight-color: transparent;
}
body:has(#start[hidden]) #btn-fs { top: max(10px, env(safe-area-inset-top)); }
#btn-fs:active { background: rgba(40, 44, 96, .9); transform: scale(.94); }
#btn-fs svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
#btn-fs .to-exit, #btn-fs.on .to-full { display: none; }
#btn-fs.on .to-exit { display: block; }
/* 로비 오른쪽 위 i 버튼 (게임 설명 창 열기): 전체 화면 버튼과 같은 동그란 반투명 버튼 */
#btn-info {
  position: absolute; right: max(12px, env(safe-area-inset-right)); top: max(10px, env(safe-area-inset-top));
  display: grid; place-items: center; width: 38px; height: 38px; padding: 0; border: 0; border-radius: 50%;
  background: var(--panel); box-shadow: var(--panel-edge); color: #fff; cursor: pointer; pointer-events: auto; -webkit-tap-highlight-color: transparent;
  font: italic 900 20px/1 Georgia, "Times New Roman", serif;
}
#btn-info:hover { background: rgba(40, 44, 96, .9); }
#btn-info:active { transform: scale(.94); }
#start .join {
  pointer-events: auto; display: flex; gap: 4px; width: 100%; padding: 4px; border-radius: 10px;
  background: var(--panel); box-shadow: var(--panel-edge);
}
#start .join:focus-within { box-shadow: var(--panel-edge), 0 0 0 4px rgba(255, 255, 255, .7), 0 0 16px 5px rgba(255, 255, 255, .3); } /* 고른 칸: 흰 테두리 + 은은한 빛 */
#in-name {
  flex: 1; min-width: 0; padding: 0 10px; border: 0; outline: none; background: none;
  font: inherit; font-size: 16px; font-weight: 700; color: #fff;
}
#in-name::placeholder { color: rgba(255, 255, 255, .5); font-weight: 600; }
#btn-start {
  flex: none; cursor: pointer; padding: 7px 18px; border: 3px solid #000; border-radius: 7px;
  font: inherit; font-size: 16px; font-weight: 900; letter-spacing: .5px; color: #fff; background: var(--red);
  transition: background .15s;
}
#btn-start:hover { background: #ff3a2e; }
#btn-start:disabled { opacity: .7; cursor: default; }
/* 로비: 서버(이름·지역·핑) 머리줄 아래 룸 줄 (이름 · 상태 · 인원 막대 · 인원). 고른 룸은 버터색 테두리.
   첫 화면 목록과 룸 선택 창이 같은 모양 (짙은 판 위 흰 글자) */
#start .rooms {
  pointer-events: auto; width: 100%; max-height: 34vh; overflow-y: auto; margin-bottom: 10px; padding: 4px;
  border-radius: 10px; text-align: left; background: var(--panel); box-shadow: var(--panel-edge);
}
.rooms .srv { display: flex; align-items: baseline; gap: 6px; padding: 4px 8px 2px; font-size: 12px; color: #fff; }
.rooms .srv b { font-weight: 800; }
.rooms .srv small { color: rgba(255, 255, 255, .55); font-weight: 700; }
:is(.rooms, .room-chip) .png { margin-left: auto; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
:is(.rooms, .room-chip) .png::before { content: '●'; margin-right: 4px; font-size: 9px; color: rgba(255, 255, 255, .4); }
:is(.rooms, .room-chip) .png.good::before { color: #5ee36a; }
:is(.rooms, .room-chip) .png.ok::before { color: #ffd23f; }
:is(.rooms, .room-chip) .png.bad::before, :is(.rooms, .room-chip) .png.off::before { color: #ff5a4f; }
.rooms .room {
  display: grid; grid-template-columns: minmax(0, 1fr) auto 64px 42px; align-items: center; gap: 8px; width: 100%;
  padding: 6px 8px; border: 2px solid transparent; border-radius: 7px; background: none; cursor: pointer;
  font: inherit; font-size: 14px; color: #eef0ff; text-align: left; -webkit-tap-highlight-color: transparent;
}
.rooms .room:hover:not(:disabled) { background: var(--panel-hi); }
.rooms .room.sel { border-color: rgba(255, 255, 255, .75); background: rgba(255, 255, 255, .14); box-shadow: 0 0 10px rgba(255, 255, 255, .3); } /* 고른 룸: 흰 테두리 + 은은한 빛 */
.rooms .room:disabled { cursor: default; opacity: .5; }
.rooms .nm { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-weight: 700; }
.rooms .room em { font-style: normal; font-size: 11px; font-weight: 800; color: rgba(255, 255, 255, .6); }
.rooms .room.busy em { color: #ffc83d; }
.rooms .room.full em, .rooms .room.offline em { color: #ff6a5f; }
.rooms .bar { height: 6px; border-radius: 3px; background: rgba(255, 255, 255, .15); overflow: hidden; }
.rooms .bar i { display: block; height: 100%; border-radius: 3px; background: #5ee36a; }
.rooms .busy .bar i { background: #ffc83d; }
.rooms .full .bar i { background: var(--red); }
.rooms .cnt { font-size: 12px; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; color: rgba(255, 255, 255, .8); }
/* 룸이 많을 때: 목록 대신 고른 룸 한 줄 (● 서버 · 룸  상태  인원  핑  Change) */
.room-chip {
  pointer-events: auto; display: flex; align-items: center; gap: 8px; width: 100%; margin-bottom: 10px; padding: 8px 8px 8px 12px;
  border: 0; border-radius: 10px; background: var(--panel); box-shadow: var(--panel-edge);
  font: inherit; font-size: 14px; color: #eef0ff; text-align: left; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.room-chip:hover { background: rgba(28, 32, 74, .85); }
.room-chip .where { flex: 1; font-weight: 400; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.room-chip .where b { font-weight: 400; color: #fff; }
.room-chip em { font-style: normal; font-size: 11px; font-weight: 800; color: #ff6a5f; }
.room-chip .cnt { font-size: 12px; font-weight: 700; color: rgba(255, 255, 255, .8); font-variant-numeric: tabular-nums; }
.room-chip .png { margin: 0; font-size: 12px; }
.room-chip .chg { flex: none; padding: 3px 10px; border-radius: 6px; background: var(--fx-butter); color: #1d2050; font-size: 12px; font-weight: 400; }

/* 룸 선택 창: 탈락 창처럼 짙은 바탕에 흰 글자, 제목은 HIGH SCORES 처럼 버터색 + 검정 외곽선 */
#room-dlg, #info-dlg { z-index: 20; background: rgba(10, 12, 32, .58); }
.panel.rooms-dlg {
  display: flex; flex-direction: column; width: min(440px, 100%); max-height: min(640px, 100%); overflow: hidden;
  padding: 14px 12px 12px; background: rgba(18, 21, 54, .94); color: #eef0ff; box-shadow: 0 0 0 2px #000, 0 10px 40px rgba(0, 0, 0, .5);
}
.panel.rooms-dlg h2 {
  margin: 0 0 12px; text-align: center; font-family: "Titillium Web", "Gothic A1", sans-serif; font-size: 26px; font-weight: 900; letter-spacing: 2px;
  color: var(--fx-butter); -webkit-text-stroke: 4px #000; paint-order: stroke fill;
}
.panel.rooms-dlg button.close { color: rgba(255, 255, 255, .7); }
.panel.rooms-dlg button.close:hover { background: rgba(255, 255, 255, .12); color: #fff; }
/* 게임 설명 창: 짧은 항목들, 길면 안에서 스크롤 */
.info-body { overflow-y: auto; padding: 0 6px 4px; font-size: 14px; line-height: 1.45; }
.info-body h3 { margin: 12px 0 4px; font-size: 15px; font-weight: 900; letter-spacing: .5px; color: var(--fx-mint); }
.info-body h3:first-child { margin-top: 0; }
.info-body p, .info-body ul { margin: 0; color: rgba(238, 240, 255, .9); }
.info-body ul { padding-left: 18px; }
.info-body li + li { margin-top: 3px; }
.info-body b { color: var(--fx-butter); }
.rd-top { display: flex; gap: 8px; margin-bottom: 8px; }
.rd-top:has(#rd-search[hidden]) { display: none; } /* 검색 칸이 없으면 빈 줄도 없앤다 */
#rd-search {
  flex: 1; min-width: 0; margin: 0; padding: 8px 10px; border: 0; border-radius: 7px; text-align: left;
  background: rgba(255, 255, 255, .12); color: #fff; font-size: 15px;
}
#rd-search::placeholder { color: rgba(255, 255, 255, .5); }
.rd-tabs { display: flex; gap: 6px; margin-bottom: 8px; overflow-x: auto; scrollbar-width: none; }
.panel.rooms-dlg .rd-tabs button {
  flex: none; width: auto; margin: 0; padding: 4px 12px; border-radius: 999px;
  background: rgba(255, 255, 255, .1); color: rgba(255, 255, 255, .8); font-size: 13px; font-weight: 800;
}
.panel.rooms-dlg .rd-tabs button.on { background: var(--fx-butter); color: #1d2050; }
.rd-list { flex: 1; min-height: 0; overflow-y: auto; margin: 0 -4px; padding: 0 4px; }
.panel.rooms-dlg .rd-list button.srv {
  display: flex; align-items: baseline; gap: 6px; width: 100%; margin: 6px 0 2px; padding: 7px 8px; border-radius: 7px;
  background: rgba(255, 255, 255, .07); color: #fff; font-size: 13px; text-align: left;
}
.panel.rooms-dlg .rd-list button.srv:hover { background: rgba(255, 255, 255, .14); }
.panel.rooms-dlg .rd-list button.srv.off { opacity: .5; }
.rd-list .srv .car { flex: none; width: 10px; font-style: normal; color: rgba(255, 255, 255, .6); }
.rd-list .srv b { font-weight: 800; }
.rd-list .srv small { color: rgba(255, 255, 255, .55); font-weight: 700; }
.rd-list .srv .sum { margin-left: auto; color: rgba(255, 255, 255, .55); font-size: 12px; white-space: nowrap; }
.rd-list .srv .png { margin-left: 8px; }
.panel.rooms-dlg .rd-list .room { margin: 0; padding: 7px 8px 7px 24px; font-size: 14px; color: #eef0ff; }
.rd-list .none { margin: 18px 0; text-align: center; color: rgba(255, 255, 255, .6); }
@media (max-width: 640px) {
  #room-dlg { place-items: end center; padding: 0; }
  .panel.rooms-dlg { width: 100%; max-height: 82vh; border-radius: 14px 14px 0 0; padding-bottom: max(12px, env(safe-area-inset-bottom)); animation: rd-up .25s ease-out; }
  /* 설명 창은 아래에 붙는 시트가 아니라 가운데 뜨는 창: 네 모서리 모두 둥글게 */
  .panel.rooms-dlg.info { border-radius: 14px; padding-bottom: 12px; animation: none; }
  .rd-list .srv .sum { display: none; }
  .rd-list .srv .png { margin-left: auto; }
}
@keyframes rd-up { from { transform: translateY(40%); opacity: 0; } }
#start-err { min-height: 1.2em; margin: 6px 0 0; color: #fff; font-size: 12px; }
#start-err:empty { visibility: hidden; }
#start-err:not(:empty) { padding: 2px 8px; border-radius: 4px; background: rgba(232, 35, 27, .85); }

/* 입장·탈락 창 */
.panel-wrap { position: fixed; inset: 0; display: grid; place-items: center; padding: 16px; background: rgba(30, 60, 100, .18); }
.panel {
  width: min(340px, 100%); max-height: 100%; overflow: auto;
  padding: 16px 16px; border-radius: 8px; background: #fff; /* 창 안쪽 여백 (탈락 창 제목 띠의 -16px 와 맞춘다) */
  box-shadow: 0 0 0 1px rgba(10, 20, 40, .08);
  position: relative;
}
.panel h2.title { margin: 0 0 16px; font-size: 22px; color: var(--ink); text-align: center; }
.panel button.close {
  position: absolute; top: 6px; right: 6px; width: 34px; height: 34px; margin: 0; padding: 0;
  border-radius: 50%; background: none; color: var(--muted); font-size: 26px; line-height: 1;
}
.panel button.close:hover { background: #f0f2f6; color: var(--ink); }
.panel h2 { margin: 0 0 4px; font-size: 28px; color: var(--red); }
.panel label { display: block; margin-bottom: 10px; font-size: 13px; color: var(--ink); text-align: center; }
.panel input { text-align: center; }
.panel input {
  display: block; width: 100%; margin-top: 4px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 4px; font: inherit; font-size: 16px;
}
.panel input:focus { outline: 2px solid #2f7bff; border-color: transparent; }
.panel button {
  width: 100%; margin-top: 6px; padding: 12px; border: 0; border-radius: 5px;
  font: inherit; font-size: 17px; color: #fff; background: var(--navy); cursor: pointer;
}
.panel button:disabled { opacity: .6; cursor: default; }
.panel button small { opacity: .7; font-weight: 600; }
.err { min-height: 1.2em; margin: 8px 0 0; color: var(--red); font-size: 13px; }
/* 탈락 창: 로비 HIGH SCORES 처럼 카드 없이 화면 위에 바로 큰 글자 (흰 글자 + 검정 외곽선), 제목은 빨강.
   뒤 게임 화면은 짙은 막으로 눌러 글자가 묻히지 않게 */
#dead { z-index: 15; background: rgba(10, 12, 32, .58); } /* 이름표·순위판 위에 (레전드 창 20 보다는 아래) */
.panel.dead {
  width: min(420px, 100%); padding: 8px 12px; overflow: hidden auto;
  background: none; box-shadow: none; text-align: center;
  font-family: "Titillium Web", "Gothic A1", sans-serif; font-weight: 900; color: #fff;
  -webkit-text-stroke: 4px #000; paint-order: stroke fill;
}
.dead-head { display: flex; flex-direction: column; align-items: center; gap: 2px; margin: 0 0 12px; }
.dead-head .ico { font-size: 42px; line-height: 1; -webkit-text-stroke: 0; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .5)); animation: dead-ico .6s cubic-bezier(.3, 1.6, .5, 1) both; }
.panel .dead-head h2 { margin: 2px 0 0; font-size: 46px; font-weight: 900; line-height: 1.05; letter-spacing: 2px; color: var(--red); -webkit-text-stroke-width: 5px; animation: dead-slam .45s cubic-bezier(.3, 1.5, .5, 1) .1s both; }
.dead-head small { display: block; font-size: 21px; letter-spacing: 1px; color: var(--fx-butter); }
@keyframes dead-ico { from { transform: scale(.2) rotate(-30deg); opacity: 0; } 60% { transform: scale(1.2) rotate(8deg); opacity: 1; } to { transform: none; } }
@keyframes dead-slam { from { transform: scale(1.8); opacity: 0; } }
/* 왜 죽었는지: 잡은 플레이어는 레벨 알약 + 그 색 이름 */
#dead-why { margin: 0 0 16px; font-size: 18px; line-height: 1.45; -webkit-text-stroke-width: 3.5px; }
#dead-why b { font-weight: 900; color: #fff; }
#dead-why .killer { display: inline-flex; align-items: center; gap: 5px; vertical-align: middle; white-space: nowrap; }
#dead-why .killer > b { color: color-mix(in srgb, var(--c) 70%, #fff); }
#dead-why .killer .lv { padding: 0 5px; border-radius: 8px; font-size: 11px; font-weight: 700; color: #fff; background: #5b6372; box-shadow: 0 0 0 1.5px #000; -webkit-text-stroke: 0; }
/* 기록 세 칸: 상자 없이 작은 이름 + 큰 숫자. 새 최고 점수면 숫자를 버터색, 아래 빨간 NEW BEST */
.dead-stats { display: flex; gap: 8px; margin: 0 0 16px; }
.dead-stats div { flex: 1; min-width: 0; }
.dead-stats small { display: block; font-size: 13px; letter-spacing: 1px; text-transform: uppercase; color: rgba(255, 255, 255, .8); -webkit-text-stroke-width: 3px; }
.dead-stats b { display: block; font-size: 30px; line-height: 1.15; font-weight: 900; color: #fff; font-variant-numeric: tabular-nums; }
.dead-stats .pb { display: block; margin-top: 2px; font-size: 12px; font-weight: 700; color: rgba(255, 255, 255, .75); -webkit-text-stroke-width: 2.5px; }
.dead-stats .new { display: none; }
.dead-stats .record b { color: var(--fx-butter); }
.dead-stats .record .new {
  display: inline-block; margin-top: 4px; padding: 1px 8px; border-radius: 999px;
  background: var(--red); box-shadow: 0 0 0 2px #000; color: #fff; -webkit-text-stroke: 0;
  font-style: normal; font-size: 11px; font-weight: 800; letter-spacing: .5px; white-space: nowrap;
  animation: pop .5s cubic-bezier(.2, 1.6, .4, 1);
}
@keyframes pop { from { transform: scale(.3); opacity: 0; } }
#dead-legend { margin: 0 0 16px; font-size: 16px; color: var(--fx-butter); -webkit-text-stroke-width: 3px; }
.panel button.link { margin-top: 8px; padding: 6px; background: none; color: var(--ink); font-size: 14px; font-weight: 700; }
.panel button.link:hover { text-decoration: underline; }

/* 레전드 순위 창 */
#legend { z-index: 20; }
.panel.legend { width: min(400px, 100%); padding: 14px 12px 12px; }
.panel.legend .title { margin-bottom: 10px; color: #b07800; }
.legend .sub { margin: 6px 0 4px; color: var(--muted); font-size: 12px; text-align: center; }
.lg-rows { margin: 0; padding: 0; list-style: none; }
.lg-rows li {
  display: flex; align-items: center; gap: 7px; padding: 5px 8px; border-radius: 5px;
  color: var(--text); font-size: 13px;
}
.lg-rows li + li { margin-top: 2px; }
.lg-rows li:nth-child(1) { font-size: 17px; font-weight: 800; padding: 9px 10px; background: linear-gradient(90deg, #ffe79a, #fff6d6 70%, #fff0); }
.lg-rows li:nth-child(2) { font-size: 15px; font-weight: 700; padding: 7px 9px; background: linear-gradient(90deg, #e5ebf2, #f5f7fa 70%, #fff0); }
.lg-rows li:nth-child(3) { font-size: 14px; font-weight: 700; padding: 6px 9px; background: linear-gradient(90deg, #f6d9bf, #fbeee3 70%, #fff0); }
.lg-rows li.me { box-shadow: inset 0 0 0 2px #2f7bff; }
.lg-rows li.slot { opacity: .45; }
.lg-rows li.slot .nm { color: var(--muted); font-weight: 400; }
.lg-rows li.slot .rk { filter: grayscale(1); }
.lg-rows .ri.ghost { visibility: hidden; }
.lg-rows .rk { flex: none; width: 24px; text-align: center; color: var(--muted); font-variant-numeric: tabular-nums; }
.lg-rows li:nth-child(-n+3) .rk { font-size: 1.2em; }
.lg-rows .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lg-rows .nm b { font-weight: inherit; }
/* 이름 아래 작게: 그 판의 최대 점유율 · 처치 수 */
.lg-rows .nm .ex { display: block; overflow: hidden; text-overflow: ellipsis; color: var(--muted); font-size: 11px; font-weight: 400; line-height: 1.2; }
.lg-rows .when { flex: none; color: var(--muted); font-size: 11px; font-weight: 400; }
.lg-rows li.live .when { color: #fff; background: var(--red); padding: 0 5px; border-radius: 3px; font-weight: 800; font-size: 10px; animation: blink 1.2s ease-in-out infinite; }
@keyframes blink { 50% { opacity: .55; } }
.lg-rows .val { flex: none; min-width: 64px; text-align: right; font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; }
.lg-rows li:nth-child(1) .val { color: #b07800; }

/* 탈락 창 버튼: 다시 하기(넓게, 빨강 + 검정 테두리) + 그만하기(테두리만) */
.dead-btns { display: flex; gap: 8px; }
.panel.dead button { -webkit-text-stroke: 0; font-weight: 900; letter-spacing: .5px; border-radius: 6px; }
.panel.dead #btn-again { flex: 1; border: 3px solid #000; background: var(--red); }
.panel.dead #btn-again:hover { background: #ff3a2e; }
.panel .dead-btns button.quit { width: auto; padding: 12px 16px; border: 2px solid rgba(255, 255, 255, .85); color: #fff; background: transparent; }
.panel .dead-btns button.quit:hover { background: rgba(255, 255, 255, .12); }
#dead-auto { margin: 10px 0 0; min-height: 1.2em; font-size: 13px; font-weight: 700; color: rgba(255, 255, 255, .8); -webkit-text-stroke-width: 3px; }

@media (max-width: 640px) {
  #start { --logo: 40px; --logo-top: max(20px, env(safe-area-inset-top)); --logo-gap: 22px; }
  #board { max-width: 262px; font-size: 10.5px; }
  #board li { --step: 2px; }
  #board li:nth-child(1) { font-size: 12px; }
  #board li:nth-child(2) { font-size: 11px; }
  #board li:nth-child(3) { font-size: 10.5px; }
  #board li:nth-child(n+6):not(.me) { display: none; }
  #board li :is(.kl, .pc) { display: none; } /* 좁은 화면: 이름 자리를 위해 점수만 (처치 수·점유율은 이름표에서) */
  #help { display: none; }
  #boost { bottom: 14px; width: calc(100% - 300px); }
  #boost .hint { font-size: 10.5px; line-height: 1.15; text-align: right; }
  /* 좁은 화면: 큰 점수가 오른쪽 순위판에 닿지 않게 SCORE 를 숫자 위에 쌓는다 */
  #score { flex-direction: column; align-items: flex-start; gap: 1px; }
  #score small { line-height: 1; }
  #score b { font-size: 25.5px; }
  #feed { top: calc(max(10px, env(safe-area-inset-top)) + 128px); } /* 좁은 화면: 오른쪽 위 순위판과 겹치지 않게 그 아래로 */
  #feed .kf { font-size: 13px; }
  #feed .kf.me { font-size: 16px; }
  body:has(#btn-fs:not([hidden])) #score { top: calc(max(10px, env(safe-area-inset-top)) - 2px); } /* 전체 화면 버튼(38px)과 가운데 높이 맞춤 */
  .panel.dead { -webkit-text-stroke-width: 3.5px; }
  .panel .dead-head h2 { font-size: 36px; -webkit-text-stroke-width: 4px; }
  .dead-head small { font-size: 18px; }
  #dead-why { font-size: 16px; -webkit-text-stroke-width: 3px; }
  .dead-stats { gap: 6px; }
  .dead-stats small { font-size: 11px; -webkit-text-stroke-width: 2.5px; }
  .dead-stats b { font-size: 24px; }
}


/* 그리기 오류 알림 (stage.js watchGLErrors) */
/* 불러오는 화면(z-index 100)보다도 위에. 아래쪽 안전 영역(홈 막대)을 피한다 */
#glerr {
  position: fixed; left: 8px; right: 8px; bottom: max(8px, env(safe-area-inset-bottom)); z-index: 1000;
  display: flex; align-items: flex-start; gap: 8px; max-height: 40vh; overflow: auto;
  padding: 8px 10px; border-radius: var(--radius); background: rgba(190, 20, 20, .92); color: #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .3); pointer-events: auto;
}
#glerr[hidden] { display: none; }
#glerr pre { flex: 1; margin: 0; font: 600 12px/1.4 ui-monospace, monospace; white-space: pre-wrap; user-select: text; -webkit-user-select: text; }
#glerr button {
  flex: none; padding: 6px 12px; border: 0; border-radius: 6px; background: #fff; color: #b01414;
  font: 800 12px/1 system-ui, sans-serif; cursor: pointer;
}
