/* 뱅글 타워: 공용 /common/nin.css(토큰·카드·알약·입력칸·모달) 다음에 읽는다.
   화풍 = 커버(cover.svg)의 네온 신스웨이브: 밤 보라 하늘 + 줄무늬 해 + 지평선 핑크 격자, 시안·핑크 네온 선, 크롬 글자.
   메뉴(.screen.nin)와 게임 화면(#hud)이 같은 배경(하늘 · 해 · 격자)을 쓰고, 카드·알약·입력칸은 어두운 바탕 + 발광 테두리.
   게임 화면(#hud)은 투명 WebGL 캔버스(#stage) 아래 그 배경, 위 가운데 깊이(큰 숫자)·점수·콤보, 왼쪽 위 내 최고·남은 시간, 오른쪽 위 모드 · 나가기,
   깊이 아래 가로 참가자 순위 띠(#racers), 연출 층(#fx), 빨간 번쩍임(#flash) */
:root {
  /* 팔레트 (커버에서) */
  --p-night: #0d0221; --p-violet: #2d0a5a; --p-plum: #7a1f8f; --p-floor: #14002c; --p-col: #4b2a9a;
  --p-cyan: #38f3ff; --p-teal: #196d73; --p-pink: #ff2d95; --p-mag: #ff3df0; --p-lilac: #c9b8ff;
  --p-sun: #ffe66d; --p-coral: #ff7a59; --p-hot: #ff2a55;
  --p-panel: #14002cd9;                                   /* 어두운 유리판 */
  --p-chrome: linear-gradient(#fff 8%, #8fd8ff 44%, #2a1a6e 51%, #ff7ad9 57%, #fff2fb 96%);
  --horizon: 62vh;                                        /* 지평선 높이 (해 가운데 = 격자 시작) */
  /* 공용 토큰 → 네온 */
  --ink: #f4e9ff; --sub: #b9a2dd;
  --red: var(--p-pink); --red-d: #8a0050;                 /* 주 버튼(다음 ▶ · 혼자 하기 · 시작) */
  --blue: var(--p-cyan); --blue-d: #0e7c88;               /* 보조(방 만들기) */
  --yellow: var(--p-sun); --yellow-d: #c98a1a;
  --card-sh: 0 0 0 1px #38f3ff40, 0 0 18px #38f3ff55, inset 0 0 22px #38f3ff1c;
  --glow: 0 0 4px var(--p-cyan), 0 0 14px #38f3ffaa, 0 0 30px #ff2d9566;   /* 네온 글자 2겹 */
  --logo: "Arial Black", "Arial Rounded MT Bold", var(--ui);
}
html, body {
  margin: 0; padding: 0; width: 100%; height: 100%;
  overflow: hidden; background: var(--p-floor); color: var(--ink);
  font-family: ui-rounded, "Arial Rounded MT Bold", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  -webkit-user-select: none; user-select: none; touch-action: none;
}
.hidden { display: none !important; }

/* ══ 신스웨이브 배경 (메뉴 · 게임 화면 공용): 별 하늘 → 지평선, ::before 줄무늬 해, ::after 원근 격자 바닥 ══ */
.screen.nin, #hud {
  isolation: isolate;
  background:
    radial-gradient(circle at 50% var(--horizon), #ff2d9555, transparent min(48vh, 60vw)),
    radial-gradient(circle, #fff 0 1px, transparent 1.6px) 0 0 / 97px 61px,
    radial-gradient(circle, #ffffffa0 0 .8px, transparent 1.4px) 41px 23px / 131px 89px,
    linear-gradient(var(--p-night), var(--p-violet) 45%, var(--p-plum) var(--horizon), var(--p-floor) var(--horizon));
}
.screen.nin::before, #hud::before, .screen.nin::after, #hud::after { content: ""; position: fixed; z-index: -1; pointer-events: none; }
/* 해: 위 노랑 → 아래 핑크, 지평선 가까이 가로 틈 */
.screen.nin::before, #hud::before {
  left: 50%; top: var(--horizon); width: min(52vh, 78vw); aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%;
  background: linear-gradient(var(--p-sun) 4%, var(--p-coral) 28%, var(--p-pink) 50%);
  -webkit-mask: linear-gradient(#000 0 30%, transparent 30%), repeating-linear-gradient(#000 0 7px, transparent 7px 11px);
  mask: linear-gradient(#000 0 30%, transparent 30%), repeating-linear-gradient(#000 0 7px, transparent 7px 11px);
}
/* 격자 바닥: 지평선에서 퍼지는 세로 빛줄(conic) + 멀수록 촘촘한 가로줄, 지평선 발광 선 */
.screen.nin::after, #hud::after {
  left: 0; right: 0; top: var(--horizon); bottom: 0;
  border-top: 2px solid #ffb3f4; box-shadow: 0 0 16px 2px var(--p-mag);
  background:
    linear-gradient(transparent 1.2%, #ff3df0d0 1.2% 1.9%, transparent 1.9% 5.6%, #ff3df0d0 5.6% 6.4%, transparent 6.4% 13.6%, #ff3df0d0 13.6% 14.6%,
      transparent 14.6% 24.8%, #ff3df0d0 24.8% 26%, transparent 26% 38.8%, #ff3df0d0 38.8% 40.2%, transparent 40.2% 56.4%, #ff3df0d0 56.4% 58%,
      transparent 58% 76.6%, #ff3df0d0 76.6% 78.4%, transparent 78.4% 97.6%, #ff3df0d0 97.6%),
    repeating-conic-gradient(from 90deg at 50% 0, transparent 0 3.6deg, #ff3df0c0 3.6deg 4deg),
    linear-gradient(#14002cb8, #1c0038e8);
}

/* ---------- 게임 화면 ---------- */
#hud { position: fixed; inset: 0; overflow: hidden; touch-action: none; cursor: grab; }
#hud:active { cursor: grabbing; }
#stage { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
/* 네온 알약 (HUD 작은 글자판 공용) */
#hud-score, #hud-combo, #hud-best, #hud-time, #hud-mode, #toast {
  background: var(--p-panel); color: var(--ink); border: 2px solid var(--line, var(--p-cyan)); border-radius: 10px;
  box-shadow: 0 0 8px var(--line, var(--p-cyan)), inset 0 0 8px #38f3ff30; white-space: nowrap;
}
/* 위 가운데: 깊이(큰 숫자 · 층) · 점수 · 콤보 — 흰 글자 + 시안·핑크 글로우 */
.hud-top {
  position: absolute; top: max(10px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); z-index: 3; pointer-events: none;
  display: flex; flex-direction: column; align-items: center; font-family: var(--ui); color: #fff;
}
.hud-depth { display: flex; align-items: baseline; gap: 6px; text-shadow: var(--glow); }
.hud-depth span { font-size: 20px; color: var(--p-cyan); }
#hud-depth { font-family: var(--logo); font-weight: 900; font-style: italic; font-size: 64px; line-height: 1; color: #f2feff; display: inline-block; }
#hud-depth.bump { animation: bump .25s ease-out; }
@keyframes bump { 40% { transform: scale(1.25); } }
.hud-sub { display: flex; gap: 8px; margin-top: 6px; }
#hud-score, #hud-combo { font-size: 16px; padding: 2px 12px; }
#hud-combo { --line: var(--p-pink); color: #fff; text-shadow: 0 0 6px var(--p-pink); animation: throb .4s ease-in-out infinite alternate; }
@keyframes throb { to { transform: scale(1.08); } }
/* 왼쪽 위: 내 최고(혼자) · 남은 시간(온라인) */
.hud-left { position: absolute; top: max(12px, env(safe-area-inset-top)); left: 10px; z-index: 3; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; pointer-events: none; font-family: var(--ui); }
#hud-best, #hud-time { font-size: 17px; padding: 2px 12px; }
#hud-best:empty { display: none; }
#hud-time.low { --line: var(--p-hot); color: #fff; text-shadow: 0 0 6px var(--p-hot); animation: throb .5s ease-in-out infinite alternate; }
.hud-opts { position: absolute; top: max(10px, env(safe-area-inset-top)); right: 10px; z-index: 4; display: flex; align-items: center; gap: 8px; }
#hud-mode { --line: #7a3fd0; font-family: var(--ui); font-size: 11px; color: var(--p-lilac); padding: 3px 10px; }
.hud-leave { margin: 0; }
/* 참가자 순위 띠 (깊이 아래 가로, 온라인): 순위 순 네온 칩 한 줄 — 순위(::before ← data-rank, 1등 👑) · 이름 · 깊이(큰 숫자 + 층) / 아래 자리 색 발광 막대.
   나 = 짙은 보라 + 굵은 발광 테두리, 죽음·나감 = 흐리게. 아래 #toast 는 띠가 보이면 띠 밑으로 */
#racers {
  position: absolute; top: calc(max(10px, env(safe-area-inset-top)) + 112px); left: 10px; right: 10px; z-index: 3; pointer-events: none;
  list-style: none; margin: 0; padding: 0; display: flex; justify-content: center; gap: 10px; font-family: var(--ui);
}
#racers li {
  flex: 0 1 180px; min-width: 0; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 4px 7px;
  padding: 5px 10px 6px 6px; color: var(--ink); background: var(--p-panel); border: 2px solid var(--c); border-radius: 10px;
  box-shadow: 0 0 8px var(--c), inset 0 0 8px #38f3ff30; transition: opacity .3s, filter .3s;
}
#racers li::before {
  content: attr(data-rank); width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font: italic 900 14px var(--logo); color: var(--c); border: 2px solid var(--c); box-sizing: border-box; text-shadow: 0 0 6px var(--c);
}
#racers li[data-rank="1"]::before { content: "👑"; border: 0; font-style: normal; font-size: 17px; filter: drop-shadow(0 0 4px var(--p-sun)); }
#racers li.me { background: #2d0a5af0; border-width: 3px; padding: 4px 9px 5px 5px; box-shadow: 0 0 16px var(--c), inset 0 0 12px var(--c); }
#racers li.dead { opacity: .5; filter: grayscale(.7); }
#racers .rn { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#racers li.me .rn { font-weight: bold; }
#racers .rv { font-size: 12px; color: var(--p-cyan); white-space: nowrap; }
#racers .rv b { font: italic 900 20px var(--logo); color: #fff; margin-right: 2px; text-shadow: 0 0 8px var(--c); }
#racers .bar { grid-column: 1 / -1; display: block; height: 5px; border-radius: 3px; background: #ffffff1a; overflow: hidden; }
#racers .bar i { display: block; height: 100%; border-radius: inherit; background: var(--c); box-shadow: 0 0 6px var(--c); transition: width .3s; }
#racers:not(.hidden) ~ #toast { top: calc(max(10px, env(safe-area-inset-top)) + 178px); }
/* 준비 숫자 (온라인 ready) */
#ready { position: absolute; inset: 0; z-index: 5; display: flex; align-items: center; justify-content: center; pointer-events: none; }
#ready b { font-family: var(--logo); font-style: italic; font-size: 140px; color: #fff; text-shadow: var(--glow), 0 0 60px var(--p-pink); animation: bump .5s ease-out infinite; }
#hint, #wait {
  position: absolute; left: 50%; bottom: max(22px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 5; pointer-events: none;
  max-width: calc(100% - 32px); text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  background: var(--p-panel); color: var(--p-sun); border: 2px solid var(--p-sun); border-radius: 10px; padding: 6px 18px;
  font-family: var(--ui); font-size: 17px; text-shadow: 0 0 6px #ffe66d99; box-shadow: 0 0 12px #ffe66d88, inset 0 0 10px #ffe66d30;
  animation: hint-pulse 1s ease-in-out infinite alternate;
}
#wait { color: var(--ink); border-color: var(--p-lilac); box-shadow: 0 0 10px #c9b8ff66; text-shadow: none; animation: none; }
/* 부활 창: 판 위 어두운 막 + 핑크 네온 카드 (광고 보고 한 번 더 · 남은 초) */
#revive-overlay { position: absolute; inset: 0; z-index: 6; display: flex; align-items: center; justify-content: center; padding: 16px; background: #0d022199; }
.rmodal {
  max-width: 360px; width: 100%; padding: 22px; background: linear-gradient(#2d0a5af0, #14002cf0); color: var(--ink); border: 2px solid var(--p-pink);
  border-radius: 16px; text-align: center; box-shadow: 0 0 22px var(--p-pink), inset 0 0 18px #ff2d9533; font-family: var(--ui);
}
.rmodal h3 { font-size: 25px; letter-spacing: -1px; margin: 4px 0 8px; text-shadow: 0 0 8px var(--p-pink); }
.rmodal .rsub { font-size: 15px; opacity: .85; margin: 0 0 6px; }
.rmodal small { display: block; font-size: 12px; opacity: .75; margin-top: 10px; }
#revive-btn { width: 100%; font-size: 20px; margin: 8px 0 0; }
/* 부활 광고 (자체 광고 자리, common/ads.js — 폴짝 로드·봄버독과 같다) */
#ad { position: fixed; inset: 0; z-index: 30; background: var(--p-night); font-family: var(--ui); color: #fff; line-height: 2;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 40px; padding: 16px; }
.ad-top { position: absolute; left: 18px; top: 16px; font-size: 18px; }
.ad-tag { background: var(--p-sun); color: var(--p-floor); border-radius: 4px; padding: 1px 8px; margin-right: 4px; line-height: 1.5; }
.ad-box { width: 640px; max-width: 100%; aspect-ratio: 16 / 9; border-radius: 14px; background: #1c0038; border: 2px dashed #7a3fd0; display: flex; align-items: center; justify-content: center; }
.ad-slot { font-size: 28px; color: var(--sub); }
.ad-actions { display: flex; gap: 12px; }
@keyframes hint-pulse { to { transform: translateX(-50%) scale(1.05); } }
#toast {
  position: absolute; left: 50%; top: 120px; transform: translateX(-50%); pointer-events: none; z-index: 5;
  padding: 4px 16px; font-family: var(--ui); font-size: 16px; opacity: 0; transition: opacity .25s;
}
#toast.show { opacity: 1; }
/* 죽음: 빨간 번쩍임 */
#flash { position: absolute; inset: 0; z-index: 2; pointer-events: none; opacity: 0; background: radial-gradient(circle, #ff2a5500 30%, #ff2a55cc); }
#flash.on { animation: flash .6s ease-out; }
@keyframes flash { 0% { opacity: 1; } 100% { opacity: 0; } }

/* 연출 층 (fx.js): 네온 간판 배너 · 팝업 */
#fx { position: absolute; inset: 0; pointer-events: none; z-index: 4; overflow: hidden; }
.fx-banner {
  --line: var(--p-cyan);
  position: absolute; left: 50%; top: 45%; min-width: min(78vw, 300px); max-width: 90vw; border-radius: 16px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-align: center; padding: 18px 30px 20px;
  background: linear-gradient(#2d0a5ae8, #14002ce8); border: 3px solid var(--line);
  box-shadow: 0 0 10px var(--line), 0 0 34px var(--line), inset 0 0 22px color-mix(in srgb, var(--line) 30%, transparent);
  color: #fff; font-family: var(--ui); transform: translate(-50%, -50%);
  animation: slam var(--dur, 1.4s) cubic-bezier(.2, 1.4, .4, 1) forwards;
}
.fx-banner.red { --line: var(--p-hot); }
.fx-banner.gold { --line: var(--p-sun); }
.fx-banner .ic { font-size: 50px; line-height: 1.1; filter: drop-shadow(0 0 8px var(--line)); }
.fx-banner .big {
  font-family: var(--logo); font-weight: 900; font-style: italic; font-size: clamp(28px, 7vmin, 46px); line-height: 1.1; word-break: keep-all;
  text-shadow: 0 0 4px var(--line), 0 0 16px var(--line), 0 0 30px var(--p-pink);
}
.fx-banner .sub { font-size: clamp(14px, 3.2vmin, 18px); opacity: .95; color: var(--p-lilac); }
@keyframes slam {
  0% { transform: translate(-50%, -50%) scale(2) rotate(-12deg); opacity: 0; }
  14% { transform: translate(-50%, -50%) scale(.94) rotate(2deg); opacity: 1; }
  22%, 80% { transform: translate(-50%, -50%) scale(1) rotate(0); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(.6); opacity: 0; }
}
.fx-pop { position: absolute; transform: translate(-50%, -50%); font-family: var(--logo); font-weight: 900; font-style: italic; font-size: 34px; color: #f2feff; text-shadow: var(--glow); white-space: nowrap; animation: pop 1s ease-out forwards; }
.fx-pop.hot { color: #fff6c4; font-size: 42px; text-shadow: 0 0 4px var(--p-sun), 0 0 16px var(--p-coral), 0 0 30px var(--p-pink); }
@keyframes pop {
  0% { transform: translate(-50%, -50%) scale(.3); opacity: 0; }
  20% { transform: translate(-50%, -90%) scale(1.3); opacity: 1; }
  100% { transform: translate(-50%, -190%) scale(1); opacity: 0; }
}

/* ══ 메뉴 화면: 어두운 유리 카드 + 발광 테두리 알약 ══ */
.screen {
  position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: safe center;
  overflow-y: auto; text-align: center; padding: 20px 16px; z-index: 10;
}
.screen.nin, .modal { font-family: var(--ui); text-shadow: none; color: var(--ink); line-height: 2; touch-action: manipulation; }
.modal { background: #0d0221cc; }

/* 로고: 크롬 그라데이션 기울임 글자 + 핑크 네온 테두리 빛, 위에 네온 탑 조각(커버의 탑 · 고리 · 공) */
.logo-wrap { position: relative; margin: 4px 0 6px; max-width: 100%; }
.logo-ic { display: block; width: 104px; height: 72px; margin: 0 auto 2px; filter: drop-shadow(0 0 3px var(--p-cyan)) drop-shadow(0 0 10px #38f3ff88); }
.logo-ic .ball { animation: ball-hop .9s cubic-bezier(.4, 0, .6, 1) infinite alternate; }
@keyframes ball-hop { from { transform: translateY(-12px); } }
.logo {
  font-family: var(--logo); font-weight: 900; font-style: italic; font-size: 88px; line-height: 1.1; letter-spacing: 1px; padding: 0 .12em;
  color: transparent; background: var(--p-chrome); -webkit-background-clip: text; background-clip: text;
  -webkit-text-stroke: 1.5px #2a0a4a; transform: skewX(-6deg);
  filter: drop-shadow(0 0 1px var(--p-mag)) drop-shadow(0 0 2px var(--p-mag)) drop-shadow(0 0 10px var(--p-mag)) drop-shadow(0 6px 0 #2a0a4a);
}
.tagline { font-size: 21px; margin: 34px 0; text-shadow: 0 0 8px #ff3df0aa, 0 2px 0 var(--p-floor); }
.tagline b { font-weight: normal; color: var(--p-sun); text-shadow: 0 0 8px #ffe66d99; }

/* 카드: 어두운 유리 + 시안 발광 테두리 */
.nin .card, .modal .card {
  background: linear-gradient(#24084cf0, #12002af0); color: var(--ink); border: 2px solid var(--p-cyan); border-radius: 16px; box-shadow: var(--card-sh);
  display: flex; flex-direction: column; align-items: center; width: 400px; max-width: 100%;
}
.card-title { margin-bottom: 10px; color: #fff; text-shadow: 0 0 8px #38f3ff88; }
.nin-input {
  font-size: 22px; padding: 12px 16px; margin-bottom: 10px; color: #fff; background: var(--p-night); border: 2px solid #7a3fd0; border-radius: 10px;
}
.nin-input::placeholder { color: #8d78b8; }
.nin-input:focus { background: var(--p-night); border-color: var(--p-cyan); box-shadow: 0 0 10px #38f3ff99; }
select.nin-input, select.nin-input:focus {
  background: var(--p-night) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='10' viewBox='0 0 16 10'%3E%3Cpath d='M2 2l6 6 6-6' fill='none' stroke='%2338f3ff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 16px center / 16px 10px;
}
select.nin-input option { background: var(--p-floor); color: #fff; }

/* 알약: 어두운 판 + 자기 색(--bg) 발광 테두리·글자 빛. 누르면 살짝 들어간다 */
.pill {
  color: #fff; background: linear-gradient(color-mix(in srgb, var(--bg, var(--red)) 26%, transparent), transparent 70%), var(--p-panel);
  border: 2px solid var(--bg, var(--red)); border-radius: 12px; text-shadow: 0 0 8px var(--bg, var(--red));
  box-shadow: 0 0 8px var(--bg, var(--red)), inset 0 0 12px color-mix(in srgb, var(--bg, var(--red)) 40%, transparent), 0 4px 0 var(--sh, var(--red-d));
}
.pill:hover, .pill:active { box-shadow: 0 0 14px var(--bg, var(--red)), 0 0 30px color-mix(in srgb, var(--bg, var(--red)) 50%, transparent), inset 0 0 16px color-mix(in srgb, var(--bg, var(--red)) 50%, transparent), 0 4px 0 var(--sh, var(--red-d)); }
.pill:active { transform: translateY(3px); }
.pill.yellow, .pill.white { color: #fff; }
.pill.white { --bg: var(--p-lilac); --sh: #4b2a9a; }
.pill { margin: 14px 0; }
.pill.big { font-size: 26px; padding: 14px 0; }
.screen > .pill.big { width: 340px; max-width: 100%; }
.pill.hud-leave { box-shadow: 0 0 6px var(--bg), 0 3px 0 var(--sh); }
.link, .card .link, .modal .link {
  font-size: 21px; padding: 11px 30px; min-height: 50px; margin-top: 16px;
  color: var(--p-lilac); background: #14002c99; border: 2px solid #7a3fd0; border-radius: 12px; box-shadow: 0 0 8px #7a3fd088;
}
.link:hover, .card .link:hover, .modal .link:hover { background: #2d0a5acc; color: #fff; border-color: var(--p-lilac); box-shadow: 0 0 12px #c9b8ff99; }
.link:active { transform: translateY(3px); }
.msg { min-height: 22px; margin-top: 20px; color: var(--p-sun); font-size: 17px; }
.card .msg { color: #ff7ad9; }
#name-msg { margin-top: 10px; }
#name-msg:empty { display: none; }
.controls { font-size: 15px; opacity: .95; text-shadow: 0 2px 0 var(--p-floor); }
.controls b { font-weight: normal; color: var(--p-cyan); text-shadow: 0 0 6px #38f3ff88; }

/* 방 목록 위 인사 한 줄: 안녕, 이름! · ◀ 닉네임 바꾸기 · ℹ️ 게임 소개 */
.hello.small { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 4px 14px; font-size: 22px; line-height: 1.4; margin: -10px 0 10px; }
.hello b { font-weight: normal; color: var(--p-cyan); text-shadow: 0 0 8px #38f3ff88; }
.hello .link { font-size: 15px; padding: 4px 14px; min-height: 0; margin: 0; }
#rooms > .pill.big { margin: 8px 0; }
/* 화면 제목: 로고와 같은 크롬 글자 */
.nin h2, .res-title {
  font-family: var(--logo); font-weight: 900; font-style: italic; line-height: 1.15; padding: 0 .12em;
  color: transparent; background: var(--p-chrome); -webkit-background-clip: text; background-clip: text; -webkit-text-stroke: 1px #2a0a4a;
  filter: drop-shadow(0 0 2px var(--p-mag)) drop-shadow(0 0 8px var(--p-mag));
}
.nin h2 { font-size: 44px; margin: 0 0 28px; }

/* 방 목록 위 내 최고 한 줄 */
.best-line { font-size: 17px; line-height: 1.4; margin: 0 0 12px; padding: 3px 16px; border-radius: 10px; background: var(--p-panel); border: 1px solid var(--p-sun); color: var(--p-sun); box-shadow: 0 0 8px #ffe66d66; }

/* 방 목록 */
#room-list { width: 520px; max-height: 34vh; overflow-y: auto; gap: 20px; padding: 14px; margin-bottom: 12px; }
#room-list .empty { color: var(--sub); padding: 18px 0; font-size: 18px; }
#room-list button.room {
  font: inherit; color: var(--ink); cursor: pointer; width: 100%; display: grid; grid-template-columns: 1fr auto auto; gap: 14px; align-items: center;
  text-align: left; font-size: 19px; padding: 12px 16px; border: 2px solid #5b2bd9; border-radius: 10px; background: #1a0638;
  transition: transform .08s, border-color .12s, box-shadow .12s;
}
#room-list button.room:hover { border-color: var(--p-pink); box-shadow: 0 0 12px var(--p-pink); transform: translateY(-2px); }
#room-list button.room.full { opacity: .5; cursor: default; transform: none; }
#room-list .rname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#room-list .rhost { font-size: 15px; color: var(--sub); }
#room-list .rcount { font-size: 16px; color: var(--p-cyan); border: 1px solid var(--p-cyan); border-radius: 8px; padding: 2px 10px; text-align: center; box-shadow: 0 0 6px #38f3ff88; }
.check { display: flex; align-items: center; gap: 8px; margin: 8px 0 28px; font-size: 19px; cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--p-pink); }

/* 로비 */
.room-title { font-size: 28px; margin-bottom: 18px; text-shadow: 0 0 10px #ff3df0aa; }
.lobby-hint { font-size: 15px; opacity: .95; }
.invite { display: flex; gap: 12px; margin: 28px 0 34px; width: 640px; max-width: 100%; }
.inv-code, .inv-link {
  font: inherit; color: var(--ink); cursor: pointer; border: 2px solid var(--p-cyan); border-radius: 14px; background: var(--p-panel);
  box-shadow: var(--card-sh); padding: 10px 16px; display: flex; flex-direction: column; align-items: center; gap: 9px;
  transition: transform .08s, box-shadow .12s, border-color .12s;
}
.inv-code:hover, .inv-link:hover { transform: translateY(-2px); border-color: var(--p-sun); box-shadow: 0 0 16px #ffe66d99; }
.inv-code:active, .inv-link:active { transform: translateY(3px); }
.inv-label { font-size: 14px; color: var(--sub); }
.inv-code b { font-family: var(--logo); font-weight: 900; font-style: italic; font-size: 46px; letter-spacing: 8px; line-height: 1.1; color: #fff; text-shadow: 0 0 4px var(--p-pink), 0 0 16px var(--p-pink); }
.inv-link { flex: 1; min-width: 0; }
#lobby-link-text { font-size: 20px; color: var(--p-cyan); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inv-copy { font-size: 15px; color: #fff; border: 1px solid var(--p-pink); border-radius: 8px; padding: 2px 14px; margin-top: 4px; box-shadow: 0 0 8px #ff2d9599; }
.copied .inv-copy, .inv-code.copied .inv-label { background: var(--p-pink); color: #fff; border-radius: 8px; padding: 2px 14px; }
/* 4칸 (2 × 2): 자리 색 네온 테두리 칸에 국기 · 이름, 연결 중 칸(깜빡임), 빈 칸은 점선(AI 가 채운다) */
#lobby-players { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 20px; width: 520px; max-width: 100%; }
#lobby-players .pl {
  font-size: 20px; line-height: 1.5; padding: 10px 14px; border-radius: 12px; background: var(--p-panel); color: #fff; border: 2px solid var(--c);
  box-shadow: 0 0 10px var(--c), inset 0 0 12px color-mix(in srgb, var(--c) 35%, transparent); text-shadow: 0 0 6px var(--c); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
#lobby-players .pl.me { outline: 2px dashed #fff; outline-offset: 3px; }
#lobby-players .pl.empty, #lobby-players .pl.pending { background: #14002c66; color: var(--sub); border: 2px dashed #7a3fd0; box-shadow: none; text-shadow: none; }
#lobby-players .pl.pending { color: #fff; animation: pl-pulse 1.2s ease-in-out infinite; }
@keyframes pl-pulse { 50% { opacity: .5; } }
#lobby-status { margin: 24px 0 14px; font-size: 18px; }

/* 결과: 순위표 (온라인) · 깊이 · 점수 · 내 최고 (혼자: .rrow.solo) */
.res-hero { font-size: 70px; line-height: 1.1; filter: drop-shadow(0 0 12px var(--p-pink)); }
.res-title { font-size: 44px; line-height: 1.3; }
#res-table { width: 460px; margin: 18px 0 26px; gap: 8px; line-height: 1.4; }
.rrow { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto auto auto; gap: 8px; align-items: center; width: 100%; color: var(--ink); font-size: 20px; padding: 6px 12px; border-radius: 8px; background: #1a0638; border-left: 4px solid var(--c, var(--p-cyan)); }
.rrow.solo { grid-template-columns: minmax(0, 1fr) auto; }
.rrow.win { background: #2d0a5a; outline: 2px solid var(--p-sun); box-shadow: 0 0 12px #ffe66d88; }
.rrow.me .rn::after { content: " ✦"; color: var(--p-pink); }
.rrow .rk { font-size: 22px; text-align: center; }
.rrow .rp { font-size: 15px; color: var(--sub); white-space: nowrap; }
.rrow .rn { text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rrow .rs { font-size: 14px; color: var(--sub); white-space: nowrap; }
.rrow .rv { font-size: 18px; color: var(--p-cyan); text-shadow: 0 0 6px #38f3ff88; white-space: nowrap; }
#res-hint { font-size: 18px; margin: -12px 0 14px; }
.res-row { display: flex; gap: 12px; justify-content: center; flex-wrap: nowrap; margin: 12px 0; }
.res-row .pill { margin: 0; font-size: 22px; padding: 14px 30px; }

/* 모달 */
.modal .card { animation: popin2 .25s cubic-bezier(.3, 1.5, .5, 1); }
#lang-list { display: flex; flex-wrap: wrap; gap: 16px; justify-content: center; margin-bottom: 6px; }
#lang-list .pill { margin: 0; }
.lang-opt.on { --bg: var(--p-sun); --sh: var(--yellow-d); }

/* 이용약관·개인정보처리방침: 타이틀 화면 오른쪽 아래 구석 */
.legal-links .ll { display: inline-block; white-space: nowrap; }
#title .legal-links { text-align: right; position: absolute; right: 14px; bottom: 10px; margin: 0; color: var(--p-lilac); font-size: 13px; line-height: 1.5; }
#title .privacy-link { color: var(--p-lilac); text-decoration: underline; }
#title .privacy-link:hover { color: #fff; }

/* 구석 버튼: 오른쪽 위 언어, 왼쪽 위 Gamepio 홈 · 계정 (포털 아래에서만) */
.corner { position: absolute; top: 14px; right: 14px; margin: 0; z-index: 3; }
.corner-l { position: absolute; top: 14px; left: 14px; z-index: 3; display: flex; gap: 8px; max-width: calc(100% - 180px); }
.corner-l .pill { margin: 0; white-space: nowrap; }
#account-btn { min-width: 0; overflow: hidden; text-overflow: ellipsis; }

/* 낮은 화면(1280×720 등): 타이틀·방 목록·로비가 스크롤 없이 */
@media (min-width: 641px) and (max-height: 799px) {
  #title { line-height: 1.5; } #title .logo { font-size: 72px; } #title .logo-ic { height: 56px; } #title .tagline { margin: 10px 0 14px; } #title .card { padding: 14px 20px; }
  #title .pill { margin: 8px 0; } #title .nin-input { margin-bottom: 8px; } #name-msg { line-height: 1.4; }
  #rooms h2 { margin-bottom: 18px; font-size: 38px; } #rooms > .pill.big { margin: 5px 0; font-size: 22px; padding: 10px 0; } #room-list { max-height: 24vh; }
  #lobby h2 { margin-bottom: 8px; } .room-title { margin-bottom: 6px; } .invite { margin: 12px 0 16px; } #lobby-players { gap: 10px; } #lobby .lobby-hint { line-height: 1.6; } #lobby-status { margin: 12px 0 8px; }
}
@media (max-width: 640px) {
  .logo { font-size: 52px; }
  .tagline { font-size: 17px; margin: 24px 0; }
  .nin h2 { font-size: 32px; }
  .link { font-size: 18px; padding: 10px 24px; min-height: 46px; }
  #room-list button.room { font-size: 15px; }
  .invite { flex-direction: column; }
  .inv-code b { font-size: 38px; }
  #lobby-link-text { font-size: 15px; }
  #lobby-players { gap: 10px; }
  #lobby-players .pl { font-size: 15px; padding: 8px 10px; }
  .res-title { font-size: 32px; }
  #res-table { width: 100%; }
  .rrow { font-size: 16px; grid-template-columns: 26px minmax(0, 1fr) auto auto auto; gap: 6px; padding: 5px 8px; }
  .rrow .rs { display: none; }
  .res-row { gap: 7px; } .res-row .pill { font-size: 17px; padding: 12px 18px; }
  .corner.pill, .corner-l .pill { font-size: 13px; padding: 7px 12px; } /* .pill.small 보다 구체적이어야 둘 다 같은 크기 */
  .corner { top: 10px; right: 10px; }
  .corner-l { top: 10px; left: 10px; max-width: calc(100% - 130px); }
  #title .logo-wrap { margin-top: 56px; }
  #rooms h2 { margin-top: 30px; } /* 왼쪽 위 포털 버튼 · 오른쪽 위 언어 버튼 아래로 */
  .hello.small { font-size: 18px; }
  #title .legal-links { text-align: center; position: static; margin-top: 4px; font-size: 12px; }
  /* 게임 화면: 깊이는 작게, 모드는 숨김, 순위 띠는 4칸이 한 줄에(칸: 순위 · 이름 / 깊이 / 막대) */
  #hud-depth { font-size: 50px; }
  #hud-score, #hud-combo { font-size: 13px; }
  #hud-best, #hud-time { font-size: 14px; padding: 1px 10px; }
  #racers { top: calc(max(10px, env(safe-area-inset-top)) + 92px); left: 6px; right: 6px; gap: 5px; }
  #racers li { flex: 1 1 0; grid-template-columns: auto minmax(0, 1fr); gap: 1px 4px; padding: 4px 6px 5px 4px; }
  #racers li.me { padding: 3px 5px 4px 3px; }
  #racers li::before { width: 17px; height: 17px; font-size: 11px; border-width: 1.5px; }
  #racers li[data-rank="1"]::before { font-size: 13px; }
  #racers .rn { font-size: 12px; }
  #racers .rv { grid-column: 1 / -1; font-size: 11px; line-height: 1.1; }
  #racers .rv b { font-size: 16px; }
  #racers .bar { height: 4px; margin-top: 2px; }
  #racers:not(.hidden) ~ #toast { top: calc(max(10px, env(safe-area-inset-top)) + 158px); }
  #hud-mode { display: none; }
  #hint, #wait { font-size: 13px; padding: 5px 12px; }
  #toast { top: 104px; }
  #ready b { font-size: 100px; }
}
