/* PHASEBREAK — 네온 사이버 UI */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --cyan: #00e5ff; --mag: #ff2d95; --gold: #ffcf4d; --green: #4dff9d; --red: #ff4455;
  --panel: rgba(8, 12, 26, 0.82);
}
html, body { width: 100%; height: 100%; overflow: hidden; background: #04050c; }
body {
  font-family: "Segoe UI", "Malgun Gothic", sans-serif;
  color: #dfe8ff; user-select: none;
}
#gl { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.hidden { display: none !important; }
button { cursor: pointer; font-family: inherit; }

/* ============ 로비 ============ */
.screen { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 30; }
#s-lobby { background: radial-gradient(ellipse at 50% 30%, rgba(20, 10, 60, 0.55), rgba(2, 3, 10, 0.92)); backdrop-filter: blur(3px); }
.lobby-box {
  width: min(680px, 94vw); max-height: 94vh; overflow-y: auto;
  background: var(--panel); border: 1px solid rgba(0, 229, 255, 0.35);
  clip-path: polygon(18px 0, 100% 0, 100% calc(100% - 18px), calc(100% - 18px) 100%, 0 100%, 0 18px);
  padding: 34px 42px 26px; text-align: center;
  box-shadow: 0 0 60px rgba(0, 229, 255, 0.12), inset 0 0 80px rgba(0, 40, 80, 0.25);
}
.logo-top { font-size: 11px; letter-spacing: 6px; color: var(--mag); font-weight: 700; }
.logo {
  font-size: clamp(44px, 9vw, 74px); font-weight: 900; letter-spacing: 2px; line-height: 1.05; font-style: italic;
  background: linear-gradient(100deg, #fff 10%, var(--cyan) 45%, var(--mag) 90%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 22px rgba(0, 229, 255, 0.45));
  animation: logoFlicker 4s infinite;
}
.logo span { font-weight: 300; }
@keyframes logoFlicker { 0%, 93%, 100% { opacity: 1; } 94% { opacity: 0.6; transform: translateX(1px);} 95% { opacity: 1;} 97% { opacity: 0.75;} 98% { opacity: 1;} }
.logo-sub { margin-top: 6px; font-size: 13.5px; color: #9fb4e8; }
.pitch { margin: 20px auto 6px; text-align: left; font-size: 13.5px; line-height: 2; color: #c7d6ff; width: fit-content; max-width: 100%; }
.pitch b { color: var(--cyan); }
.field { margin-top: 14px; display: flex; align-items: center; justify-content: center; gap: 12px; }
.field label { font-size: 12px; letter-spacing: 2px; color: #8fa3d8; }
#nickname, #room-input {
  background: rgba(0, 20, 40, 0.6); border: 1px solid rgba(0, 229, 255, 0.4); color: #fff;
  padding: 9px 14px; font-size: 15px; width: 200px; outline: none; text-align: center; letter-spacing: 1px;
}
#nickname:focus, #room-input:focus { border-color: var(--cyan); box-shadow: 0 0 14px rgba(0, 229, 255, 0.35); }
#colors { display: flex; gap: 8px; }
.swatch { width: 26px; height: 26px; border: 2px solid transparent; border-radius: 4px; transform: skewX(-8deg); }
.swatch.sel { border-color: #fff; box-shadow: 0 0 12px currentColor; transform: skewX(-8deg) scale(1.15); }
.lobby-btns { margin-top: 20px; }
button.big {
  display: block; width: 100%; margin-top: 10px; padding: 15px; font-size: 17px; font-weight: 800; letter-spacing: 1px;
  border: 1px solid; background: transparent; color: #fff; position: relative; transition: all 0.15s;
  clip-path: polygon(12px 0, 100% 0, 100% calc(100% - 12px), calc(100% - 12px) 100%, 0 100%, 0 12px);
}
button.big.cyan { border-color: var(--cyan); background: linear-gradient(100deg, rgba(0, 229, 255, 0.16), rgba(0, 229, 255, 0.03)); text-shadow: 0 0 12px var(--cyan); }
button.big.cyan:hover { background: rgba(0, 229, 255, 0.3); box-shadow: 0 0 26px rgba(0, 229, 255, 0.4); transform: translateY(-1px); }
.code-row { margin-top: 10px; display: flex; gap: 8px; justify-content: center; }
.code-row button { background: rgba(255, 45, 149, 0.1); border: 1px solid rgba(255, 45, 149, 0.5); color: #ffb8d9; padding: 9px 12px; font-size: 13px; }
.code-row button:hover { background: rgba(255, 45, 149, 0.28); }
.code-row #room-input { width: 110px; }
.publine { margin-top: 14px; font-size: 13px; color: var(--gold); animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { opacity: 0.55; } }
.err { color: var(--red); font-size: 13px; margin-top: 8px; min-height: 18px; }
.lobby-foot { margin-top: 12px; display: flex; gap: 10px; justify-content: center; align-items: center; }
.mini { background: rgba(120, 140, 200, 0.12); border: 1px solid rgba(120, 140, 200, 0.35); color: #aebadd; padding: 6px 12px; font-size: 12px; }
.mini:hover { background: rgba(120, 140, 200, 0.25); }
.best { font-size: 12px; color: var(--gold); }

/* ============ HUD ============ */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
#hud > * { pointer-events: none; }
#hud-tl { position: absolute; top: 16px; left: 18px; width: 300px; }
#hp-bar { width: 260px; height: 20px; background: rgba(0, 0, 0, 0.55); border: 1px solid rgba(0, 229, 255, 0.5); transform: skewX(-12deg); position: relative; overflow: hidden; }
#hp-fill { height: 100%; width: 100%; background: linear-gradient(90deg, #00ffc8, var(--cyan)); box-shadow: 0 0 14px rgba(0, 229, 255, 0.7); transition: width 0.15s; }
#hp-fill.low { background: linear-gradient(90deg, #ff2244, #ff7755); animation: pulse 0.5s infinite; }
#hp-txt { position: absolute; inset: 0; text-align: center; font-size: 12px; font-weight: 700; line-height: 20px; color: #fff; text-shadow: 0 0 4px #000; transform: skewX(12deg); }
#hud-sub { margin-top: 6px; font-size: 14px; text-shadow: 0 0 6px #000; }
#stats-icons { font-size: 12px; color: #cfe0ff; letter-spacing: 1px; }
#players-panel { margin-top: 10px; background: var(--panel); border-left: 3px solid var(--mag); padding: 8px 10px; width: 230px; }
.pp-row { margin: 4px 0; }
.pp-row.down .pp-name { animation: pulse 0.7s infinite; }
.pp-name { font-size: 12px; font-weight: 700; }
.pp-hp { height: 5px; background: rgba(255, 255, 255, 0.12); margin-top: 2px; }
.pp-hp div { height: 100%; background: linear-gradient(90deg, #00ffc8, var(--cyan)); transition: width 0.2s; }

#hud-tc { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); text-align: center; width: 380px; }
#sector-label { font-size: 12px; letter-spacing: 5px; color: var(--gold); font-weight: 800; }
#phase-label { font-size: 16px; font-weight: 800; letter-spacing: 1px; text-shadow: 0 0 12px var(--cyan); }
#prog { margin: 6px auto 0; width: 260px; height: 8px; background: rgba(0, 0, 0, 0.5); border: 1px solid rgba(255, 255, 255, 0.25); transform: skewX(-12deg); position: relative; }
#prog-fill { height: 100%; background: linear-gradient(90deg, var(--cyan), var(--mag)); transition: width 0.2s; }
#prog-txt { position: absolute; top: 10px; left: 0; right: 0; font-size: 11px; color: #b9c8f2; transform: skewX(12deg); }
#boss-bar { margin: 22px auto 0; width: 380px; height: 16px; background: rgba(40, 0, 10, 0.7); border: 1px solid var(--red); position: relative; }
#boss-fill { height: 100%; width: 100%; background: linear-gradient(90deg, #ff2244, #ff8833); box-shadow: 0 0 18px rgba(255, 40, 60, 0.8); transition: width 0.2s; }
#boss-bar span { position: absolute; inset: 0; text-align: center; font-size: 11px; font-weight: 800; letter-spacing: 3px; line-height: 16px; color: #fff; text-shadow: 0 0 4px #000; }

#hud-tr { position: absolute; top: 16px; right: 18px; text-align: right; }
#mode-badge { display: inline-block; font-size: 12px; font-weight: 900; letter-spacing: 2px; padding: 3px 12px; transform: skewX(-12deg); }
#mode-badge.single { border: 1px solid var(--cyan); color: var(--cyan); }
#mode-badge.coop { border: 1px solid var(--mag); color: #fff; background: rgba(255, 45, 149, 0.35); box-shadow: 0 0 16px rgba(255, 45, 149, 0.5); animation: pulse 1.2s infinite; }
#score { font-size: 34px; font-weight: 900; font-style: italic; text-shadow: 0 0 16px rgba(0, 229, 255, 0.6); }
#room-tag { font-size: 11px; color: #8fa3d8; letter-spacing: 1px; }
#combo-box { margin-top: 8px; }
#combo-mult { font-size: 24px; font-weight: 900; color: var(--gold); text-shadow: 0 0 14px rgba(255, 207, 77, 0.7); font-style: italic; }
#combo-bar { width: 120px; height: 5px; background: rgba(0, 0, 0, 0.5); margin-left: auto; margin-top: 3px; }
#combo-fill { height: 100%; background: var(--gold); }

#feed { position: absolute; left: 18px; bottom: 120px; font-size: 13px; color: #cfe0ff; text-shadow: 0 0 6px #000; }
#feed div { margin-top: 4px; animation: feedIn 0.25s; }
@keyframes feedIn { from { opacity: 0; transform: translateX(-14px); } }
#prompt { position: absolute; left: 50%; bottom: 26%; transform: translateX(-50%); font-size: 17px; font-weight: 800; color: var(--green); text-shadow: 0 0 12px rgba(77, 255, 157, 0.7); animation: pulse 1s infinite; }
#key-hint { position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%); font-size: 11px; color: rgba(170, 190, 240, 0.5); letter-spacing: 1px; white-space: nowrap; }

/* 배너 */
.banner-wrap { position: absolute; top: 30%; left: 0; right: 0; text-align: center; opacity: 0; pointer-events: none; }
.banner-wrap.show { animation: bannerSlam 2.6s forwards; }
@keyframes bannerSlam {
  0% { opacity: 0; transform: scale(2.6); filter: blur(8px); }
  9% { opacity: 1; transform: scale(1); filter: blur(0); }
  13% { transform: scale(1.04); }
  16% { transform: scale(1); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: scale(0.96); }
}
#banner-main { font-size: clamp(34px, 6vw, 56px); font-weight: 900; font-style: italic; letter-spacing: 4px;
  background: linear-gradient(100deg, #fff, var(--cyan)); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 26px rgba(0, 229, 255, 0.55)); }
#banner-sub { font-size: clamp(18px, 3vw, 28px); font-weight: 800; letter-spacing: 6px; color: #fff; text-shadow: 0 0 18px var(--mag); }
#banner-small { font-size: 13px; color: #b9c8f2; margin-top: 4px; letter-spacing: 1px; }
.banner-wrap.danger #banner-main { background: linear-gradient(100deg, #fff, var(--red)); -webkit-background-clip: text; background-clip: text; filter: drop-shadow(0 0 26px rgba(255, 68, 85, 0.6)); }
.banner-wrap.coop #banner-main { background: linear-gradient(100deg, #fff, var(--mag)); -webkit-background-clip: text; background-clip: text; filter: drop-shadow(0 0 26px rgba(255, 45, 149, 0.65)); }
.banner-wrap.sector #banner-main { background: linear-gradient(100deg, #fff, var(--gold)); -webkit-background-clip: text; background-clip: text; filter: drop-shadow(0 0 26px rgba(255, 207, 77, 0.6)); }

/* 플로팅 텍스트 */
#floaters { position: fixed; inset: 0; pointer-events: none; z-index: 12; }
.floater { position: absolute; left: 0; top: 0; font-size: 15px; font-weight: 900; color: #fff; text-shadow: 0 0 8px #000; white-space: nowrap; }
.floater.crit { color: var(--gold); font-size: 19px; text-shadow: 0 0 12px rgba(255, 207, 77, 0.8); }
.floater.bonus { color: var(--cyan); font-size: 22px; font-style: italic; }
.floater.combo { color: var(--mag); font-size: 20px; font-style: italic; }
.floater.heal { color: var(--green); }
.floater.od { color: var(--gold); font-size: 18px; }

/* ============ 카드 ============ */
#cards { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 20; background: radial-gradient(ellipse, rgba(4, 6, 16, 0.25), rgba(4, 6, 16, 0.78)); }
.cards-title { font-size: 22px; font-weight: 900; letter-spacing: 6px; color: #fff; text-shadow: 0 0 18px var(--cyan); margin-bottom: 22px; }
#card-timer { color: var(--gold); font-style: italic; margin-left: 10px; }
.cards-row { display: flex; gap: 22px; }
.card {
  width: 190px; padding: 22px 16px 18px; text-align: center; cursor: pointer; position: relative;
  background: linear-gradient(160deg, rgba(14, 22, 48, 0.95), rgba(6, 10, 24, 0.95));
  border: 1px solid rgba(0, 229, 255, 0.45);
  clip-path: polygon(14px 0, 100% 0, 100% calc(100% - 14px), calc(100% - 14px) 100%, 0 100%, 0 14px);
  transition: all 0.14s; animation: cardIn 0.35s backwards;
}
.card:nth-child(2) { animation-delay: 0.08s; }
.card:nth-child(3) { animation-delay: 0.16s; }
@keyframes cardIn { from { opacity: 0; transform: translateY(34px) scale(0.9); } }
.card:hover { transform: translateY(-8px) scale(1.05); border-color: var(--gold); box-shadow: 0 0 34px rgba(255, 207, 77, 0.35); }
.c-key { position: absolute; top: 8px; left: 12px; font-size: 12px; color: #6d7fae; border: 1px solid #46557e; width: 18px; height: 18px; line-height: 17px; }
.c-icon { font-size: 44px; filter: drop-shadow(0 0 12px rgba(0, 229, 255, 0.5)); }
.c-name { font-size: 17px; font-weight: 900; margin-top: 10px; color: #fff; }
.c-desc { font-size: 12.5px; color: #a9bbe8; margin-top: 6px; line-height: 1.5; }
.c-lv { font-size: 11px; color: var(--gold); margin-top: 10px; letter-spacing: 1px; }

/* ============ 게임오버 ============ */
#over { background: radial-gradient(ellipse, rgba(60, 0, 16, 0.45), rgba(3, 3, 8, 0.9)); z-index: 25; }
.over-box { text-align: center; animation: cardIn 0.5s; }
.over-box h2 { font-size: clamp(36px, 7vw, 60px); font-weight: 900; font-style: italic; letter-spacing: 8px; color: var(--red); text-shadow: 0 0 30px rgba(255, 68, 85, 0.7); }
#over-score { font-size: clamp(48px, 9vw, 84px); font-weight: 900; font-style: italic; color: #fff; text-shadow: 0 0 30px var(--cyan); margin: 10px 0 4px; }
#over-best { color: var(--gold); font-size: 15px; margin-bottom: 14px; }
#over-stats { display: flex; gap: 26px; justify-content: center; font-size: 14px; color: #a9bbe8; margin-bottom: 26px; }
#over-stats b { color: #fff; font-size: 17px; }
.over-box .big { width: 320px; margin: 0 auto; }
.over-hint { margin-top: 10px; font-size: 12px; color: #7d8fc0; }

/* ============ 채팅 ============ */
#chat-box { position: absolute; left: 18px; bottom: 34px; width: 300px; pointer-events: auto; }
#chat-log { font-size: 12.5px; text-shadow: 0 0 4px #000; max-height: 140px; overflow: hidden; }
#chat-log div { margin-top: 3px; }
#chat-input { width: 100%; background: rgba(0, 10, 26, 0.6); border: 1px solid rgba(0, 229, 255, 0.25); color: #fff; padding: 5px 9px; font-size: 12.5px; outline: none; margin-top: 5px; opacity: 0.45; }
#chat-input:focus { opacity: 1; border-color: var(--cyan); }

/* ============ 도움말 ============ */
#help { position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; background: rgba(2, 3, 10, 0.8); }
.help-box { width: min(620px, 92vw); max-height: 88vh; overflow-y: auto; background: var(--panel); border: 1px solid rgba(0, 229, 255, 0.4); padding: 28px 34px; }
.help-box h2 { font-size: 20px; letter-spacing: 2px; margin-bottom: 14px; color: var(--cyan); }
.help-box table { width: 100%; font-size: 13.5px; border-collapse: collapse; }
.help-box td { padding: 5px 8px; border-bottom: 1px solid rgba(120, 140, 200, 0.15); }
.help-box td:first-child { color: var(--gold); font-weight: 700; white-space: nowrap; width: 140px; }
.help-rules { font-size: 13px; color: #b4c4ee; line-height: 1.7; margin-top: 14px; }
.help-rules b { color: var(--cyan); }
.help-box .mini { margin-top: 14px; }

@media (max-width: 760px) {
  .cards-row { flex-direction: column; gap: 10px; }
  .card { width: 260px; padding: 12px; }
  #hud-tc { width: 240px; }
  #boss-bar { width: 240px; }
  #chat-box { width: 200px; }
}
