/* STELLAR DRIFT — UI 스타일 */
:root {
  --cyan: #45f0ff; --pink: #ff4fd8; --gold: #ffd166; --green: #7dff6a;
  --red: #ff5c5c; --bg: #05060f; --panel: rgba(10, 14, 30, .88);
  --line: rgba(69, 240, 255, .25); --txt: #dfe8ff; --dim: #8892b0;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { width: 100%; height: 100%; overflow: hidden; background: var(--bg); }
body {
  font-family: 'Segoe UI', 'Malgun Gothic', system-ui, sans-serif;
  color: var(--txt); user-select: none;
}
#gl { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
button { font-family: inherit; cursor: pointer; border: 1px solid var(--line); background: rgba(20, 28, 55, .8); color: var(--txt); border-radius: 6px; padding: 10px 20px; font-size: 15px; letter-spacing: .06em; transition: all .15s; }
button:hover { border-color: var(--cyan); box-shadow: 0 0 14px rgba(69, 240, 255, .35); transform: translateY(-1px); }
button.cyan { background: linear-gradient(135deg, rgba(69, 240, 255, .18), rgba(69, 240, 255, .05)); border-color: rgba(69, 240, 255, .6); color: var(--cyan); }
button.pink { background: linear-gradient(135deg, rgba(255, 79, 216, .18), rgba(255, 79, 216, .05)); border-color: rgba(255, 79, 216, .6); color: var(--pink); }
button.pink:hover { border-color: var(--pink); box-shadow: 0 0 14px rgba(255, 79, 216, .35); }
button.big { font-size: 18px; padding: 14px 34px; font-weight: 700; }
button.mini { font-size: 12px; padding: 6px 12px; color: var(--dim); }
button:disabled { opacity: .35; cursor: default; transform: none; box-shadow: none; }
input { background: rgba(8, 12, 26, .9); border: 1px solid var(--line); color: var(--txt); border-radius: 6px; padding: 10px 14px; font-size: 15px; outline: none; font-family: inherit; }
input:focus { border-color: var(--cyan); box-shadow: 0 0 10px rgba(69, 240, 255, .25); }
.hidden { display: none !important; }
.hint { color: var(--dim); font-size: 12px; }
.center { text-align: center; margin-top: 18px; display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ---------- 스크린 공통 ---------- */
.screen { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 20; background: radial-gradient(ellipse at 50% 120%, rgba(20, 30, 80, .35), transparent 60%); overflow-y: auto; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 28px 34px; max-width: 720px; width: min(92vw, 720px); backdrop-filter: blur(8px); box-shadow: 0 0 60px rgba(0, 0, 0, .6), inset 0 0 40px rgba(69, 240, 255, .03); }
.panel.wide { max-width: 980px; width: min(94vw, 980px); }
.panel-head { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.panel-head h2 { font-size: 22px; letter-spacing: .12em; color: var(--cyan); }
h3 { letter-spacing: .1em; font-size: 15px; color: var(--txt); }

/* ---------- 타이틀 ---------- */
.title-box { text-align: center; padding: 30px; }
.logo-top { letter-spacing: .55em; font-size: 12px; color: var(--dim); margin-bottom: 8px; }
.logo { font-size: clamp(48px, 9vw, 92px); font-weight: 900; letter-spacing: .06em; line-height: 1; color: #fff; text-shadow: 0 0 30px rgba(69, 240, 255, .8), 0 0 90px rgba(69, 240, 255, .4); }
.logo span { background: linear-gradient(90deg, var(--cyan), var(--pink)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.logo-sub { margin: 12px 0 34px; color: var(--dim); letter-spacing: .25em; font-size: 13px; }
.field { margin: 14px auto; max-width: 380px; text-align: left; }
.field label { display: block; font-size: 11px; letter-spacing: .2em; color: var(--dim); margin-bottom: 6px; }
.field input { width: 100%; text-align: center; letter-spacing: .15em; font-size: 17px; }
#colors { display: flex; gap: 9px; justify-content: center; }
#colors .sw { width: 30px; height: 30px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; transition: all .15s; }
#colors .sw.sel { border-color: #fff; transform: scale(1.2); box-shadow: 0 0 12px currentColor; }
.title-btns { display: flex; gap: 16px; justify-content: center; margin: 30px 0 18px; flex-wrap: wrap; }
.title-foot { display: flex; gap: 14px; justify-content: center; align-items: center; }
.conn { font-size: 12px; color: var(--dim); }
.conn.ok { color: var(--green); }
.conn.bad { color: var(--red); }

/* ---------- 프롤로그/챕터 ---------- */
.prologue { font-size: 15px; line-height: 2; color: #b8c6f0; padding: 14px 20px; border-left: 2px solid var(--cyan); margin-bottom: 18px; background: rgba(69, 240, 255, .04); white-space: pre-line; }
.chapters { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 10px; margin-bottom: 20px; }
.ch-card { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; cursor: pointer; background: rgba(12, 18, 40, .7); transition: all .15s; position: relative; }
.ch-card:hover { border-color: var(--cyan); }
.ch-card.sel { border-color: var(--cyan); box-shadow: 0 0 16px rgba(69, 240, 255, .35); background: rgba(69, 240, 255, .08); }
.ch-card.lock { opacity: .38; cursor: default; filter: grayscale(.8); }
.ch-card .no { font-size: 10px; letter-spacing: .25em; color: var(--dim); }
.ch-card .tt { font-size: 14px; font-weight: 700; margin: 4px 0 2px; }
.ch-card .st { font-size: 11px; color: var(--dim); }
.ch-card .done { position: absolute; top: 8px; right: 10px; color: var(--gold); font-size: 13px; }

/* ---------- 방 목록 ---------- */
.rooms-box { border-top: 1px solid var(--line); padding-top: 14px; }
.rooms-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; flex-wrap: wrap; gap: 8px; }
.rooms-head > div { display: flex; gap: 8px; }
.rooms { display: flex; flex-direction: column; gap: 8px; max-height: 200px; overflow-y: auto; }
.room-row { display: flex; align-items: center; gap: 14px; border: 1px solid rgba(255, 255, 255, .08); border-radius: 8px; padding: 10px 14px; background: rgba(12, 18, 40, .6); }
.room-row .rid { color: var(--dim); font-size: 12px; min-width: 46px; }
.room-row .rname { flex: 1; font-size: 14px; }
.room-row .rst { font-size: 11px; color: var(--gold); }
.room-row .rn { font-size: 13px; color: var(--green); min-width: 44px; text-align: right; }
.rooms .empty { color: var(--dim); font-size: 13px; text-align: center; padding: 16px; }
.seg { display: flex; gap: 8px; }
.seg button { padding: 8px 18px; }
.seg button.sel { border-color: var(--pink); color: var(--pink); box-shadow: 0 0 10px rgba(255, 79, 216, .3); }

/* ---------- 브리핑 ---------- */
.brief-wrap { display: flex; gap: 18px; width: min(96vw, 1080px); align-items: stretch; flex-wrap: wrap; }
.brief-left { flex: 2.2; min-width: 480px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 26px 30px; backdrop-filter: blur(8px); display: flex; flex-direction: column; }
.brief-right { flex: 1; min-width: 260px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 20px; backdrop-filter: blur(8px); display: flex; flex-direction: column; }
.ch-no { letter-spacing: .4em; font-size: 11px; color: var(--pink); }
.brief-title h2 { font-size: 26px; margin: 4px 0; }
.ch-sub { color: var(--dim); font-size: 13px; margin-bottom: 16px; }
.dlg { flex: 1; background: rgba(5, 8, 20, .75); border: 1px solid rgba(255, 255, 255, .09); border-radius: 10px; padding: 18px 22px; margin-bottom: 16px; min-height: 190px; display: flex; flex-direction: column; cursor: pointer; }
.dlg-head { margin-bottom: 10px; }
#dlg-name { font-weight: 800; letter-spacing: .1em; font-size: 15px; }
#dlg-tag { color: var(--dim); font-size: 11px; margin-left: 10px; }
#dlg-text { flex: 1; line-height: 1.9; font-size: 15.5px; color: #e8eeff; }
.dlg-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; }
.brief-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
#brief-ch-nav { display: flex; gap: 6px; }
#brief-roster { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.ros-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; background: rgba(255, 255, 255, .04); font-size: 14px; }
.ros-dot { width: 12px; height: 12px; border-radius: 50%; box-shadow: 0 0 8px currentColor; }
.ros-lead { color: var(--gold); font-size: 11px; }
.chatbox { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
#brief-chat-log { height: 150px; overflow-y: auto; font-size: 13px; line-height: 1.7; background: rgba(5, 8, 20, .6); border-radius: 8px; padding: 10px; }
.chat-line b { color: var(--cyan); font-weight: 600; }
.chat-line.sys { color: var(--dim); font-style: italic; }

/* ---------- 결과/모달 ---------- */
.tbl { width: 100%; border-collapse: collapse; margin: 16px 0; font-size: 14px; }
.tbl td, .tbl th { padding: 9px 12px; border-bottom: 1px solid rgba(255, 255, 255, .08); text-align: left; }
.tbl th { color: var(--dim); font-size: 11px; letter-spacing: .15em; }
.tbl tr.me td { color: var(--cyan); }
.tbl tr.win td { color: var(--gold); }
.keys td:first-child { color: var(--cyan); width: 130px; letter-spacing: .05em; }
.modal { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; background: rgba(0, 0, 0, .55); }
#result-title { color: var(--cyan); letter-spacing: .15em; font-size: 26px; }
#result-title.fail { color: var(--red); }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; z-index: 10; pointer-events: none; font-size: 14px; }
#hud > * { position: absolute; }
#obj { top: 18px; left: 20px; background: rgba(5, 10, 25, .55); border-left: 3px solid var(--cyan); padding: 10px 16px; border-radius: 0 8px 8px 0; max-width: 360px; }
#obj-ch { font-size: 11px; letter-spacing: .2em; color: var(--dim); }
#obj-goal { font-size: 15px; font-weight: 700; color: #fff; margin: 3px 0; }
#obj-stage { font-size: 12px; color: var(--gold); }
#boss-wrap { top: 16px; left: 50%; transform: translateX(-50%); width: min(46vw, 560px); text-align: center; }
#boss-name { font-size: 12px; letter-spacing: .3em; color: var(--red); margin-bottom: 4px; text-shadow: 0 0 10px rgba(255, 92, 92, .8); }
.boss-bar { height: 10px; border: 1px solid rgba(255, 92, 92, .6); border-radius: 5px; overflow: hidden; background: rgba(0, 0, 0, .5); }
#boss-fill { height: 100%; width: 100%; background: linear-gradient(90deg, #ff2a2a, #ff8a5c); transition: width .25s; }
#score-hud { top: 18px; right: 20px; text-align: right; font-size: 14px; color: var(--gold); text-shadow: 0 0 8px rgba(0, 0, 0, .8); }
#roster-hud { top: 60px; right: 20px; display: flex; flex-direction: column; gap: 5px; align-items: flex-end; }
.rh-chip { display: flex; align-items: center; gap: 7px; font-size: 12px; background: rgba(5, 10, 25, .5); padding: 3px 9px; border-radius: 6px; }
.rh-hp { width: 54px; height: 5px; background: rgba(255, 255, 255, .12); border-radius: 3px; overflow: hidden; }
.rh-hp div { height: 100%; background: var(--green); }
.rh-chip.down { opacity: .45; }

#stat { left: 20px; bottom: 20px; width: 250px; }
.bar-row { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.bar-lab { font-size: 10px; letter-spacing: .12em; color: var(--dim); width: 42px; text-align: right; }
.bar { flex: 1; height: 9px; background: rgba(255, 255, 255, .08); border-radius: 5px; overflow: hidden; border: 1px solid rgba(255, 255, 255, .12); }
.bar div { height: 100%; transition: width .15s; }
#hp-fill { background: linear-gradient(90deg, #ff8a5c, #7dff6a); width: 100%; }
#sh-fill { background: linear-gradient(90deg, #2a6aff, #45f0ff); width: 100%; }
#bo-fill { background: linear-gradient(90deg, #ff4fd8, #ffd166); width: 100%; }
#hp-num, #sh-num { font-size: 11px; width: 28px; color: var(--dim); }
#buffs { display: flex; gap: 8px; margin-top: 8px; }
.buff { font-size: 11px; padding: 3px 8px; border-radius: 5px; border: 1px solid var(--gold); color: var(--gold); background: rgba(255, 209, 102, .1); }

#radar { right: 20px; bottom: 20px; border-radius: 50%; background: radial-gradient(circle, rgba(8, 16, 34, .78), rgba(8, 16, 34, .92)); border: 1px solid var(--line); box-shadow: 0 0 20px rgba(69, 240, 255, .15); }
#feed { right: 20px; bottom: 210px; display: flex; flex-direction: column-reverse; gap: 4px; align-items: flex-end; font-size: 12px; }
.feed-line { background: rgba(5, 10, 25, .55); padding: 3px 10px; border-radius: 5px; color: #c8d4f4; }
.feed-line b { color: var(--cyan); }
.feed-line.kill b { color: var(--red); }

#radio { bottom: 108px; left: 50%; transform: translateX(-50%); background: rgba(4, 8, 20, .72); border: 1px solid rgba(255, 255, 255, .12); border-radius: 8px; padding: 9px 20px; max-width: min(78vw, 760px); font-size: 15px; }
#radio-name { font-weight: 800; margin-right: 12px; letter-spacing: .08em; }
#banner { top: 26%; left: 50%; transform: translate(-50%, -50%); font-size: clamp(24px, 4vw, 42px); font-weight: 900; letter-spacing: .3em; color: #fff; text-shadow: 0 0 30px var(--cyan), 0 0 80px var(--cyan); text-align: center; animation: bannerIn .5s ease-out; }
#banner .small { display: block; font-size: 14px; letter-spacing: .35em; color: var(--gold); margin-top: 8px; }
@keyframes bannerIn { from { opacity: 0; transform: translate(-50%, -60%) scale(1.15); } }
#warn { top: 16%; left: 50%; transform: translateX(-50%); color: var(--red); font-weight: 800; letter-spacing: .2em; font-size: 18px; text-shadow: 0 0 16px rgba(255, 60, 60, .9); animation: blink .5s infinite alternate; }
@keyframes blink { to { opacity: .35; } }

#crosshair { width: 34px; height: 34px; }
#crosshair div { position: absolute; background: var(--cyan); box-shadow: 0 0 6px var(--cyan); }
#crosshair div:nth-child(1) { left: 0; top: 16px; width: 9px; height: 2px; }
#crosshair div:nth-child(2) { right: 0; top: 16px; width: 9px; height: 2px; }
#crosshair div:nth-child(3) { left: 16px; top: 0; width: 2px; height: 9px; }
#crosshair div:nth-child(4) { left: 16px; bottom: 0; width: 2px; height: 9px; }
#center-dot { left: 50%; top: 50%; width: 4px; height: 4px; margin: -2px; border-radius: 50%; background: rgba(255, 255, 255, .55); }
#lockbox { width: 54px; height: 54px; border: 2px solid var(--gold); border-radius: 4px; box-shadow: 0 0 12px rgba(255, 209, 102, .5); }
#lockbox.locked { border-color: var(--red); box-shadow: 0 0 14px rgba(255, 92, 92, .8); }
#lock-label { position: absolute; top: -20px; left: 50%; transform: translateX(-50%); font-size: 10px; letter-spacing: .2em; color: var(--gold); white-space: nowrap; }
#lockbox.locked #lock-label { color: var(--red); }
#hitmark { left: 50%; top: 50%; transform: translate(-50%, -50%); font-size: 26px; color: #fff; text-shadow: 0 0 8px var(--red); font-weight: 900; }

#vign { position: fixed; inset: 0; z-index: 9; pointer-events: none; box-shadow: inset 0 0 140px rgba(255, 30, 30, 0); transition: box-shadow .1s; }
#vign.low { box-shadow: inset 0 0 190px rgba(255, 30, 30, .5) !important; }

#chat-hud { left: 20px; bottom: 130px; width: 330px; pointer-events: auto; }
#chat-log2 { max-height: 150px; overflow-y: auto; font-size: 13px; line-height: 1.7; margin-bottom: 6px; text-shadow: 0 1px 3px #000; }
#chat-in2 { width: 100%; font-size: 13px; padding: 7px 12px; }

#respawn-ov { inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; background: radial-gradient(circle, rgba(60, 0, 0, .35), rgba(0, 0, 0, .55)); font-size: 22px; letter-spacing: .25em; }
#respawn-t { font-size: 64px; font-weight: 900; color: var(--red); text-shadow: 0 0 30px rgba(255, 60, 60, .8); }
#arena-board { inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; background: rgba(3, 5, 14, .8); }
#arena-board table { max-width: 480px; }
#arena-msg { letter-spacing: .2em; color: var(--gold); }
#pause-ov { inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(3, 5, 14, .72); pointer-events: auto; }

#toast { position: fixed; top: 70px; left: 50%; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; }
.toast-msg { background: rgba(10, 16, 36, .92); border: 1px solid var(--line); color: var(--txt); padding: 9px 22px; border-radius: 8px; font-size: 14px; animation: toastIn .25s ease-out; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } }

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-thumb { background: rgba(69, 240, 255, .25); border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }
