/* ============================================================
   트레인 커넥션 · FaCer World — 아케이드 철도 테마
   ============================================================ */
:root {
  --bg: #070e1c; --bg2: #0f2240; --panel: #122a4a; --panel2: #1b3d66; --line: rgba(255,255,255,.12);
  --text: #f3f6fb; --muted: #9fb5cf; --accent: #ffd24a; --accent-dk: #c99a12; --accent2: #ff5d4a; --ok: #3ad17a; --blue: #2ea1ff; --rail: #b9bec6; --wood: #8a5a30;
  --radius: 14px;
  --font: 'Noto Sans KR', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-title: 'Black Han Sans', 'Noto Sans KR', sans-serif;
  --font-pixel: 'Press Start 2P', 'Noto Sans KR', monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); -webkit-tap-highlight-color: transparent; }
html { overflow-x: hidden; overflow-y: auto; }
body { overflow: visible; }
button, input, select { font-family: inherit; font-size: inherit; }
a { color: var(--accent); text-decoration: none; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
#app { height: 100%; }
.screen { display: none; height: 100%; flex-direction: column; position: relative;
  background:
    radial-gradient(1px 1px at 12% 18%, #fff8 0 50%, transparent 51%), radial-gradient(1px 1px at 37% 9%, #fff6 0 50%, transparent 51%), radial-gradient(1.5px 1.5px at 63% 22%, #fff7 0 50%, transparent 51%), radial-gradient(1px 1px at 88% 14%, #fff5 0 50%, transparent 51%), radial-gradient(1px 1px at 52% 46%, #fff4 0 50%, transparent 51%), radial-gradient(1.5px 1.5px at 22% 60%, #fff4 0 50%, transparent 51%), radial-gradient(1px 1px at 78% 70%, #fff4 0 50%, transparent 51%),
    radial-gradient(900px 500px at 50% -10%, #1b3d66 0%, var(--bg) 60%); }
.screen.active { display: flex; }
/* 스캔라인 (아케이드 느낌) */
.screen::after { content: ''; position: fixed; inset: 0; pointer-events: none; background: repeating-linear-gradient(0deg, rgba(0,0,0,.08) 0 1px, transparent 1px 3px); z-index: 0; }
.screen > * { position: relative; z-index: 1; }

/* ---------- 공통 버튼 (두툼한 아케이드 버튼) ---------- */
.btn { border: 0; border-radius: 10px; padding: 10px 18px; background: var(--panel2); color: var(--text); cursor: pointer; font-weight: 900; white-space: nowrap;
  box-shadow: 0 4px 0 #0b1a30, 0 6px 14px rgba(0,0,0,.35); transition: transform .06s, box-shadow .06s, filter .15s; letter-spacing: .2px; }
.btn:hover { filter: brightness(1.12); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #0b1a30; }
.btn.primary { background: linear-gradient(180deg, #ffe07a, var(--accent)); color: #2a2000; box-shadow: 0 4px 0 var(--accent-dk), 0 6px 14px rgba(0,0,0,.35); }
.btn.primary:active { box-shadow: 0 1px 0 var(--accent-dk); }
.btn.ghost { background: transparent; border: 2px solid var(--line); box-shadow: none; } .btn.ghost:hover { background: rgba(255,255,255,.06); } .btn.ghost:active { transform: translateY(1px); }
.btn.big { padding: 14px 26px; font-size: 1.1rem; } .btn.small { padding: 6px 12px; font-size: .9rem; box-shadow: 0 3px 0 #0b1a30; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; filter: none; }
.btn.ff.on { background: linear-gradient(180deg, #ff8a7a, var(--accent2)); color: #fff; box-shadow: 0 3px 0 #a3261a; }
.iconbtn { border: 0; background: transparent; color: var(--text); cursor: pointer; padding: 8px 10px; border-radius: 10px; font-size: 1.1rem; display: inline-flex; gap: 6px; align-items: center; }
.iconbtn span { font-size: .85rem; color: var(--muted); font-weight: 700; } .iconbtn:hover { background: rgba(255,255,255,.08); }
.chip { background: rgba(0,0,0,.35); border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; font-size: .92rem; white-space: nowrap; }
.chip b { color: var(--accent); } .chip.score b { color: #fff; } .chip.code { letter-spacing: 3px; font-family: var(--font-pixel); font-size: .75rem; }
input, select { background: rgba(0,0,0,.35); border: 2px solid var(--line); color: var(--text); border-radius: 10px; padding: 10px 12px; outline: none; }
input:focus, select:focus { border-color: var(--accent); }
select option { background: var(--panel); color: var(--text); }
.tier { font-style: normal; font-weight: 900; padding: 2px 9px; border-radius: 999px; font-size: .78rem; background: #7a5230; color: #fff; vertical-align: middle; }
.tier.bronze { background: #8a5a2b; } .tier.silver { background: #b7c3cf; color: #111; } .tier.gold { background: #e9b623; color: #211; }
.tier.platinum { background: #52c7b8; color: #052; } .tier.diamond { background: #5ea0ff; color: #012; } .tier.master { background: linear-gradient(90deg,#ff5d4a,#ffd24a,#3ad17a); color: #111; }

/* ---------- 상단바 ---------- */
.topbar, .playbar { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: linear-gradient(180deg, #0b1a30, #091426); border-bottom: 3px solid #1b3d66; box-shadow: 0 3px 0 #0b1a30; flex: 0 0 auto; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); }
.brand-mark { font-size: 1.8rem; filter: drop-shadow(0 2px 0 #000); }
.brand-text b { display: block; font-family: var(--font-title); font-weight: 400; font-size: 1.3rem; letter-spacing: 1px; color: var(--accent); text-shadow: 2px 2px 0 #7a4a00; }
.brand-text small { color: var(--muted); font-family: var(--font-pixel); font-size: .55rem; letter-spacing: 1px; }
.topbar-right { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.lang-select { padding: 6px 8px; font-size: .82rem; max-width: 130px; border-radius: 999px; background: rgba(0,0,0,.35); }
.userchip { display: flex; align-items: center; gap: 8px; border: 2px solid var(--line); background: rgba(0,0,0,.35); color: var(--text); border-radius: 999px; padding: 4px 14px 4px 4px; cursor: pointer; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: #222; display: grid; place-items: center; font-weight: 900; overflow: hidden; border: 2px solid #fff3; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.uinfo { text-align: left; line-height: 1.15; } .uinfo b { display: block; font-size: .95rem; } .uinfo small { color: var(--accent); font-size: .72rem; font-weight: 700; }

/* ---------- 로비 ---------- */
/* 로비는 안쪽 스크롤 없이 페이지 전체가 스크롤됨. 상단바와 오른쪽 칸(접속자·채팅)은 따라다님 */
#screen-lobby { height: auto; min-height: 100%; }
#screen-lobby .topbar { position: sticky; top: 0; z-index: 6; }
.lobby-body { flex: 1; display: grid; grid-template-columns: 1fr 320px; gap: 16px; padding: 16px; align-items: start; }
.lobby-main { min-width: 0; }
.lobby-side { position: sticky; top: 82px; height: calc(100vh - 98px); display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; min-height: 0; }
.lobby-side > section { min-height: 0; min-width: 0; }
.online-list { flex: 1; overflow-y: auto; padding: 8px 10px; display: flex; flex-direction: column; gap: 4px; min-height: 0; }
.online-row { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center; padding: 6px 8px; border-radius: 8px; }
.online-row:hover { background: rgba(255,255,255,.05); }
.online-row.me { background: rgba(255,210,74,.1); }
.online-row .ava { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 900; font-size: .8rem; background: #2b4a70; color: #fff; border: 2px solid #fff2; }
.online-row.me .ava { background: var(--accent); color: #222; }
.online-row .who { min-width: 0; line-height: 1.2; } .online-row .who b { display: block; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .online-row .who small { color: var(--muted); font-size: .72rem; }
.online-row .st { font-size: .7rem; font-weight: 900; padding: 2px 8px; border-radius: 999px; background: rgba(58,209,122,.18); color: var(--ok); white-space: nowrap; }
.online-row .st.play { background: rgba(255,93,74,.2); color: #ff9a8a; }
.hero { position: relative; border-radius: var(--radius); overflow: hidden; border: 3px solid #1b3d66; box-shadow: 0 10px 40px rgba(0,0,0,.5), inset 0 0 0 2px #0b1a30; margin-bottom: 14px; min-height: 230px; }
#lobby-scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.hero-text { position: relative; padding: 26px 28px 0; }
.title-logo { display: inline-flex; flex-direction: column; line-height: .95; }
.title-logo .t1, .title-logo .t2 { font-family: var(--font-title); font-weight: 400; letter-spacing: 2px; color: #fff; text-shadow: 3px 3px 0 #c8302a, 5px 5px 0 #4a0f0c, 0 0 24px rgba(255,210,74,.35); }
.title-logo .t1 { font-size: 2.6rem; } .title-logo .t2 { font-size: 2.6rem; color: var(--accent); }
.title-logo em { font-style: normal; font-family: var(--font-pixel); font-size: .7rem; letter-spacing: 3px; color: #ffe9a8; margin-top: 10px; text-shadow: 2px 2px 0 #000; }
.tagline { margin: 12px 0 0; color: #fff; font-weight: 700; text-shadow: 1px 1px 0 #000, 0 0 10px #000; max-width: 60%; }
.player-card { position: absolute; right: 18px; top: 18px; width: 230px; background: rgba(7,14,28,.82); border: 2px solid var(--accent); border-radius: 12px; padding: 12px 14px; box-shadow: 0 0 0 3px #0b1a30, 0 8px 24px rgba(0,0,0,.5); backdrop-filter: blur(2px); }
.pc-row { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.pc-label { font-family: var(--font-pixel); font-size: .6rem; color: var(--muted); letter-spacing: 1px; }
.pc-row b { color: var(--accent); font-size: 1.05rem; font-weight: 900; }
.pc-online { font-size: .75rem; color: var(--ok); margin-top: 8px; font-weight: 700; }
.expbar { position: relative; height: 10px; background: rgba(0,0,0,.5); border-radius: 999px; margin-top: 6px; overflow: hidden; border: 1px solid #000; }
.expbar i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: repeating-linear-gradient(90deg, var(--accent) 0 8px, #ffb13b 8px 16px); transition: width .4s; }
.expbar em { position: absolute; right: 6px; top: 0; line-height: 8px; font-size: .58rem; color: #fff; font-style: normal; font-weight: 900; text-shadow: 1px 1px 0 #000, -1px -1px 0 #000; }

.mode-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }
.mode-tabs button { position: relative; border: 3px solid #1b3d66; background: linear-gradient(180deg, #16325a, #0f2240); color: var(--text); border-radius: 14px; padding: 14px 16px 14px 70px; cursor: pointer; text-align: left; box-shadow: 0 5px 0 #0b1a30, 0 8px 20px rgba(0,0,0,.4); transition: transform .08s, box-shadow .08s, filter .15s; min-height: 78px; }
.mode-tabs button i { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); font-style: normal; font-size: 2rem; filter: drop-shadow(0 2px 0 #000); }
.mode-tabs button b { display: block; font-family: var(--font-title); font-weight: 400; font-size: 1.35rem; letter-spacing: 1px; }
.mode-tabs button small { color: var(--muted); font-weight: 700; }
.mode-tabs button:hover { filter: brightness(1.15); transform: translateY(-2px); }
.mode-tabs button:active { transform: translateY(3px); box-shadow: 0 2px 0 #0b1a30; }
.mode-tabs button.active { background: linear-gradient(180deg, #ffe07a, var(--accent)); color: #2a2000; border-color: #fff3c0; box-shadow: 0 5px 0 var(--accent-dk), 0 0 24px rgba(255,210,74,.45); }
.mode-tabs button.active small { color: #6b5300; }

.world-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.world-tabs button { border: 2px solid var(--line); background: rgba(0,0,0,.3); color: var(--text); border-radius: 999px; padding: 7px 14px; cursor: pointer; font-weight: 700; }
.world-tabs button.active { background: #fff; color: #222; border-color: #fff; box-shadow: 0 0 0 3px rgba(255,255,255,.25); } .world-tabs button:disabled { opacity: .4; cursor: not-allowed; }
.world-tabs button i { display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; border: 1px solid #0006; }

/* 역 지도 */
.stage-map { background: linear-gradient(180deg, color-mix(in srgb, var(--world, #7cb95a) 35%, #0f2240), #0f2240); border: 3px solid #1b3d66; border-radius: var(--radius); padding: 18px 14px 10px; box-shadow: inset 0 0 0 2px #0b1a30, 0 8px 24px rgba(0,0,0,.4); }
.map-row { position: relative; display: flex; justify-content: space-between; gap: 4px; padding: 6px 10px 2px; }
.map-row.rev { flex-direction: row-reverse; }
.map-row::before { content: ''; position: absolute; left: 32px; right: 32px; top: 34px; height: 18px; z-index: 0;
  background: repeating-linear-gradient(90deg, var(--wood) 0 7px, transparent 7px 18px) center/100% 18px no-repeat,
    linear-gradient(var(--rail), var(--rail)) 0 3px/100% 3px no-repeat, linear-gradient(var(--rail), var(--rail)) 0 12px/100% 3px no-repeat; }
.map-row:not(:last-child)::after { content: ''; position: absolute; top: 34px; width: 18px; height: 72px; z-index: 0; right: 24px;
  background: repeating-linear-gradient(180deg, var(--wood) 0 7px, transparent 7px 18px) center/18px 100% no-repeat,
    linear-gradient(var(--rail), var(--rail)) 3px 0/3px 100% no-repeat, linear-gradient(var(--rail), var(--rail)) 12px 0/3px 100% no-repeat; }
.map-row.rev:not(:last-child)::after { right: auto; left: 24px; }
.station { position: relative; z-index: 1; width: 78px; border: 0; background: transparent; color: var(--text); cursor: pointer; padding: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.station .dot { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; font-family: var(--font-title); font-size: 1.5rem; background: radial-gradient(circle at 35% 30%, #4b6f93, #1b3d66); border: 3px solid #0b1a30; box-shadow: 0 4px 0 #0b1a30, 0 6px 14px rgba(0,0,0,.4); transition: transform .08s; }
.station small { font-size: .68rem; color: #dbe6f3; font-weight: 700; text-shadow: 1px 1px 0 #000; white-space: nowrap; }
.station em { font-style: normal; font-size: .7rem; color: var(--accent); font-weight: 900; text-shadow: 1px 1px 0 #000; min-height: 1em; }
.station em.go { font-family: var(--font-pixel); font-size: .55rem; color: #fff; animation: blink 1s steps(2) infinite; }
.station:hover .dot { transform: translateY(-3px) scale(1.06); }
.station.cleared .dot { background: radial-gradient(circle at 35% 30%, #ffe88a, #d9a921); color: #3a2a00; border-color: #7a4a00; box-shadow: 0 4px 0 #7a4a00, 0 0 14px rgba(255,210,74,.5); }
.station.cleared .dot::after { content: '✔'; position: absolute; right: 6px; top: -4px; font-size: .8rem; color: var(--ok); background: #0b1a30; border-radius: 50%; width: 18px; height: 18px; display: grid; place-items: center; }
.station.next .dot { background: radial-gradient(circle at 35% 30%, #ff9a8a, #d8372f); border-color: #fff; box-shadow: 0 4px 0 #7a1a12, 0 0 0 4px rgba(255,255,255,.25), 0 0 22px rgba(255,93,74,.7); animation: pulse 1.4s ease-in-out infinite; }
.station.locked { cursor: not-allowed; } .station.locked .dot { background: #2a3444; color: #7f8a99; font-size: 1.1rem; box-shadow: 0 4px 0 #0b1a30; filter: saturate(.3); } .station.locked small { opacity: .5; }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); } }
@keyframes blink { to { opacity: .2; } }

/* 대합실 (협동·대전 로비) */
.lounge { border: 3px solid #1b3d66; border-radius: var(--radius); background: linear-gradient(180deg, #12301f, #0f2240 55%); box-shadow: inset 0 0 0 2px #0b1a30, 0 8px 24px rgba(0,0,0,.4); overflow: hidden; }
.lounge.versus { background: linear-gradient(180deg, #3a1518, #0f2240 55%); }
.lounge-head { display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-bottom: 2px dashed rgba(255,255,255,.14); flex-wrap: wrap; }
.lounge-icon { font-size: 2.4rem; width: 64px; height: 64px; display: grid; place-items: center; border-radius: 16px; background: rgba(0,0,0,.35); border: 2px solid rgba(255,255,255,.18); box-shadow: 0 4px 0 #0b1a30; flex: 0 0 auto; }
.lounge-title { flex: 1; min-width: 200px; }
.lounge-title h2 { margin: 0; font-family: var(--font-title); font-weight: 400; font-size: 1.6rem; letter-spacing: 1px; color: var(--accent); text-shadow: 2px 2px 0 #7a4a00; }
.lounge-title p { margin: 4px 0 0; color: #e6eef8; font-weight: 700; }
.lounge-rules { list-style: none; margin: 0; padding: 0; display: flex; gap: 6px; flex-wrap: wrap; }
.lounge-rules li { background: rgba(0,0,0,.4); border: 1px solid rgba(255,255,255,.16); border-radius: 999px; padding: 6px 12px; font-size: .82rem; font-weight: 700; white-space: nowrap; }
.lounge-actions { display: grid; grid-template-columns: 1fr 1fr 1.2fr; gap: 12px; padding: 16px 18px; }
.act { display: flex; align-items: center; gap: 12px; text-align: left; border: 0; border-radius: 14px; padding: 14px 16px; cursor: pointer; color: var(--text); background: linear-gradient(180deg, #24507f, #1b3d66); box-shadow: 0 5px 0 #0b1a30, 0 8px 18px rgba(0,0,0,.35); transition: transform .08s, box-shadow .08s, filter .15s; min-height: 72px; font: inherit; }
button.act:hover { filter: brightness(1.14); transform: translateY(-2px); } button.act:active { transform: translateY(3px); box-shadow: 0 2px 0 #0b1a30; }
.act > i { font-style: normal; font-size: 1.7rem; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; background: rgba(0,0,0,.28); flex: 0 0 auto; }
.act b { display: block; font-family: var(--font-title); font-weight: 400; font-size: 1.2rem; letter-spacing: .5px; }
.act small { display: block; color: var(--muted); font-weight: 700; font-size: .8rem; margin-top: 2px; }
.act.quick { background: linear-gradient(180deg, #ffe07a, var(--accent)); color: #2a2000; box-shadow: 0 5px 0 var(--accent-dk), 0 0 22px rgba(255,210,74,.35); } .act.quick small { color: #6b5300; } .act.quick > i { background: rgba(255,255,255,.45); }
button.act.quick:active { box-shadow: 0 2px 0 var(--accent-dk); }
.act.code { cursor: default; background: rgba(0,0,0,.35); border: 2px dashed rgba(255,255,255,.22); box-shadow: none; } .act.code > span { flex: 1; min-width: 0; }
.join-code { display: flex; gap: 6px; margin-top: 6px; } .join-code input { flex: 1; min-width: 0; width: auto; padding: 7px 10px; text-transform: uppercase; letter-spacing: 4px; text-align: center; font-family: var(--font-pixel); font-size: .78rem; }
.board { margin: 0 18px 18px; border: 2px solid #1b3d66; border-radius: 12px; background: #06101f; overflow: hidden; }
.board-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: #0b1a30; border-bottom: 2px solid #1b3d66; }
.board-head b { color: var(--accent); } .board-count { font-family: var(--font-pixel); font-size: .65rem; background: var(--accent); color: #2a2000; border-radius: 999px; padding: 4px 9px; }
.board-live { margin-left: auto; font-size: .75rem; color: var(--ok); font-weight: 700; display: inline-flex; align-items: center; gap: 6px; } .board-live i { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); animation: blink 1s steps(2) infinite; }
.board .room-list { padding: 10px; }
.empty { text-align: center; padding: 26px 16px 22px; } .empty-art { font-size: 3rem; filter: drop-shadow(0 4px 0 #000); animation: bob 2.4s ease-in-out infinite; }
.empty b { display: block; font-family: var(--font-title); font-weight: 400; font-size: 1.25rem; margin-top: 6px; } .empty p { margin: 4px 0 14px; color: var(--muted); }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
.room-list { display: grid; gap: 8px; }
.room-row { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center; border: 2px solid var(--line); background: rgba(0,0,0,.3); border-radius: 12px; padding: 10px 14px; }
.room-row b { font-size: 1.05rem; } .room-row .meta { color: var(--muted); font-size: .85rem; display: flex; gap: 10px; flex-wrap: wrap; margin-top: 2px; }
.room-row.playing { opacity: .55; }
.mode-badge { font-size: .72rem; padding: 2px 8px; border-radius: 999px; background: #1f6b43; color: #fff; vertical-align: 1px; margin-right: 4px; } .mode-badge.versus { background: #9c2520; }
.mode-tabs button em.badge { position: absolute; right: 10px; top: 8px; font-style: normal; font-size: .72rem; font-weight: 900; background: var(--accent2); color: #fff; padding: 2px 8px; border-radius: 999px; box-shadow: 0 2px 0 #7a1a12; animation: pulse 1.4s ease-in-out infinite; }
.ad-box { margin-top: 16px; min-height: 90px; display: flex; justify-content: center; }
.foot { display: flex; gap: 16px; padding: 18px 4px 8px; color: var(--muted); font-size: .85rem; flex-wrap: wrap; }

/* 채팅 (역 안내방송 전광판) */
.lobby-chat { background: #06101f; border: 3px solid #1b3d66; border-radius: var(--radius); display: flex; flex-direction: column; min-height: 0; box-shadow: inset 0 0 0 2px #0b1a30, 0 8px 24px rgba(0,0,0,.4); }
.chat-head { padding: 10px 14px; border-bottom: 2px solid #1b3d66; display: flex; justify-content: space-between; align-items: center; background: #0b1a30; }
.chat-head b { font-size: .9rem; color: var(--accent); }
.chat-log { flex: 1; overflow-y: auto; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; font-size: .9rem; min-height: 0; }
.chat-msg { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: baseline; }
.chat-msg b { color: var(--blue); } .chat-msg.me b { color: var(--accent); } .chat-msg span { word-break: break-word; } .chat-msg time { color: var(--muted); font-size: .72rem; }
.chat-msg.system { color: var(--muted); font-style: italic; grid-template-columns: 1fr; }
.chat-input { display: flex; gap: 6px; padding: 10px; border-top: 2px solid #1b3d66; } .chat-input input { flex: 1; min-width: 0; }

/* ---------- 방 ---------- */
.room-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr 320px; gap: 16px; padding: 16px; }
.room-main { overflow: auto; min-width: 0; }
.room-settings { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; background: rgba(0,0,0,.3); border: 2px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 14px; }
.room-settings label { display: flex; flex-direction: column; gap: 4px; font-size: .85rem; color: var(--muted); font-weight: 700; } .room-settings input { width: 180px; }
.room-settings p { width: 100%; margin: 0; font-size: .8rem; }
.room-settings.readonly input, .room-settings.readonly select { pointer-events: none; opacity: .7; }
.room-players { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin-bottom: 14px; }
.slot { border: 3px solid var(--line); border-radius: 12px; padding: 12px; min-height: 92px; display: flex; flex-direction: column; gap: 4px; background: rgba(0,0,0,.3); position: relative; box-shadow: 0 4px 0 #0b1a30; }
.slot.empty { justify-content: center; align-items: center; color: var(--muted); border-style: dashed; box-shadow: none; }
.slot b { font-size: 1.05rem; } .slot small { color: var(--muted); }
.slot .ready { position: absolute; right: 10px; top: 10px; font-size: .8rem; font-weight: 900; color: var(--ok); } .slot .host { color: var(--accent); }
.slot .kick { position: absolute; right: 8px; bottom: 8px; }
.room-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.room-explain { margin-top: 14px; color: var(--muted); font-size: .9rem; line-height: 1.5; }

/* ---------- 플레이 ---------- */
.play-title b { display: block; font-family: var(--font-title); font-weight: 400; font-size: 1.2rem; letter-spacing: 1px; color: var(--accent); text-shadow: 2px 2px 0 #7a4a00; } .play-title small { color: var(--muted); }
.play-right { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.hud .chip b { font-family: var(--font-pixel); font-size: .72rem; }
.play-body { flex: 1; min-height: 0; display: flex; gap: 14px; padding: 14px; }
.queue-col { flex: 0 0 170px; display: flex; flex-direction: column; align-items: center; gap: 8px; height: var(--board-h, auto); align-self: flex-start; min-height: 0; padding: 10px; background: #06101f; border: 3px solid #1b3d66; border-radius: var(--radius); box-shadow: inset 0 0 0 2px #0b1a30, 0 8px 24px rgba(0,0,0,.4); --q: clamp(38px, calc((var(--board-h, 600px) - 210px) / 5 - 6px), 76px); }
.pcard { width: 100%; display: grid; grid-template-columns: auto 1fr; gap: 6px 8px; align-items: center; padding: 8px; border-radius: 10px; background: rgba(255,210,74,.08); border: 1px solid rgba(255,210,74,.35); }
.pcard .avatar { width: 34px; height: 34px; }
.pcard-info { min-width: 0; line-height: 1.2; } .pcard-info b { display: block; font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .pcard-info small { display: block; color: var(--accent); font-size: .68rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pcard-stats { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; gap: 6px; white-space: nowrap; font-family: var(--font-pixel); font-size: .55rem; color: var(--muted); } .pcard-stats .tier { font-family: var(--font); }
.queue-title { font-family: var(--font-pixel); font-size: .55rem; color: var(--accent); letter-spacing: 1px; text-align: center; line-height: 1.6; }
.queue { display: flex; flex-direction: column; gap: 6px; background: rgba(0,0,0,.45); border-radius: 12px; padding: 8px; border: 3px solid #1b3d66; box-shadow: inset 0 0 0 2px #0b1a30; }
.queue canvas { width: var(--q, 72px); height: var(--q, 72px); border-radius: 10px; opacity: .55; transition: transform .15s, opacity .15s; }
.queue canvas:first-child { opacity: 1; transform: scale(1.08); box-shadow: 0 0 0 3px var(--accent), 0 0 16px rgba(255,210,74,.6); }
.queue-help { font-size: .72rem; text-align: center; }
.queue.shift canvas { animation: qslide .22s ease-out; }
@keyframes qslide { from { transform: translateY(78px); opacity: .4; } to { transform: translateY(0); opacity: 1; } }
.queue.shift canvas:first-child { animation: qpop .3s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes qpop { from { transform: translateY(78px) scale(.8); } to { transform: translateY(0) scale(1.08); } }
.hud .chip.warn { background: #7a1a12; border-color: var(--accent2); animation: hudpulse .5s ease-in-out infinite alternate; } .hud .chip.warn b { color: #fff; }
@keyframes hudpulse { from { transform: scale(1); } to { transform: scale(1.12); box-shadow: 0 0 14px rgba(255,93,74,.8); } }
.coop-players { width: 100%; display: flex; flex-direction: column; gap: 6px; font-size: .8rem; }
.coop-players div { display: flex; align-items: center; gap: 6px; } .coop-players i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.board-col { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.board-col { position: relative; }
.board-wrap { flex: 1; min-height: 0; position: relative; display: flex; align-items: flex-start; justify-content: center; }
#board { max-width: 100%; max-height: 100%; border-radius: 12px; border: 4px solid #0b1a30; box-shadow: 0 0 0 3px #1b3d66, 0 14px 40px rgba(0,0,0,.5); cursor: crosshair; touch-action: manipulation; }
.board-msg { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); background: rgba(0,0,0,.75); padding: 14px 24px; border-radius: 12px; font-family: var(--font-title); font-size: 1.6rem; letter-spacing: 1px; color: var(--accent); pointer-events: none; text-align: center; border: 2px solid var(--accent); text-shadow: 2px 2px 0 #000; }
.board-msg.intro { font-size: clamp(2.2rem, 7vw, 4.5rem); padding: 18px 40px; letter-spacing: 3px; border-width: 3px; background: rgba(0,0,0,.6); }
.board-msg.pop { animation: msgpop .5s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes msgpop { 0% { transform: translate(-50%, -50%) scale(.3); opacity: 0; } 100% { transform: translate(-50%, -50%) scale(1); opacity: 1; } }
.play-actions { display: flex; justify-content: center; font-size: .85rem; text-align: center; position: absolute; left: 0; right: 0; top: calc(var(--board-h, 100%) + 10px); }
/* 플레이 화면 오른쪽: (대전) 상대 미니 보드 + 채팅 */
.play-side { flex: 0 0 260px; display: flex; flex-direction: column; gap: 10px; min-height: 0; min-width: 0; height: var(--board-h, auto); align-self: flex-start; }
#ponline-box { flex: 0 0 34%; min-height: 96px; }
.minis-col { flex: 0 1 auto; max-height: 58%; display: flex; flex-direction: column; gap: 10px; overflow: auto; }
.play-chat { flex: 1; min-height: 150px; }
.play-chat .chat-log { font-size: .85rem; } .play-chat .chat-msg { grid-template-columns: auto 1fr; } .play-chat .chat-msg time { display: none; }
.play-chat .chat-input { padding: 8px; } .play-chat .chat-input input { padding: 8px 10px; }
.mini { background: rgba(0,0,0,.4); border: 3px solid #1b3d66; border-radius: 12px; padding: 8px; }
.mini .mini-head { display: flex; justify-content: space-between; align-items: center; font-size: .85rem; margin-bottom: 6px; } .mini .mini-head b { color: var(--accent); font-family: var(--font-pixel); font-size: .6rem; }
.mini canvas { width: 100%; aspect-ratio: 10 / 7; border-radius: 8px; display: block; }
.mini.done { opacity: .75; } .mini .status { font-size: .75rem; color: var(--muted); margin-top: 4px; }
.ad-rail { flex: 0 0 160px; }
.tutorial-box { position: absolute; left: 50%; bottom: 24px; transform: translateX(-50%); width: min(560px, calc(100% - 32px)); background: #fff8e6; color: #1d2b3a; border: 3px solid #7a4a00; border-radius: 14px; padding: 16px 18px; box-shadow: 0 6px 0 #7a4a00, 0 14px 40px rgba(0,0,0,.5); z-index: 5; }
.tutorial-box p { margin: 6px 0 12px; line-height: 1.5; font-size: 1.02rem; } .tut-step { font-family: var(--font-pixel); font-size: .55rem; color: #7a4a00; }
.tutorial-box .btn { background: #e9dcc3; color: #1d2b3a; box-shadow: 0 3px 0 #b9a583; } .tutorial-box .btn.primary { background: linear-gradient(180deg, #ffe07a, var(--accent)); box-shadow: 0 3px 0 var(--accent-dk); }
#screen-play { position: relative; }

/* ---------- 모달 ---------- */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.65); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 16px; }
.modal-card { background: var(--panel); border: 3px solid #1b3d66; border-radius: 16px; padding: 20px; width: min(640px, 100%); max-height: 90vh; overflow: auto; position: relative; box-shadow: inset 0 0 0 2px #0b1a30, 0 0 0 3px #0b1a30, 0 20px 60px rgba(0,0,0,.6); }
.modal-card.small { width: min(420px, 100%); }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; } .modal-head h2 { margin: 0; font-family: var(--font-title); font-weight: 400; letter-spacing: 1px; color: var(--accent); text-shadow: 2px 2px 0 #7a4a00; }
.close { border: 0; background: transparent; color: var(--muted); font-size: 1.6rem; cursor: pointer; line-height: 1; }
.modal-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.modal-card.result { text-align: center; } .modal-card.result h2 { font-family: var(--font-title); font-weight: 400; font-size: 2.2rem; margin: 6px 0; color: var(--accent); text-shadow: 3px 3px 0 #7a4a00; letter-spacing: 1px; } .result-sub { color: var(--muted); margin: 0 0 12px; }
.result-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.result-stats div { background: rgba(0,0,0,.35); border: 2px solid #1b3d66; border-radius: 12px; padding: 12px; } .result-stats small { color: var(--muted); display: block; font-family: var(--font-pixel); font-size: .5rem; letter-spacing: 1px; margin-bottom: 6px; } .result-stats b { font-size: 1.4rem; color: var(--accent); font-weight: 900; }
.modal-card.result .modal-actions { justify-content: center; }
.field { display: flex; flex-direction: column; gap: 4px; margin: 10px 0; color: var(--muted); font-size: .9rem; font-weight: 700; } .field.check { flex-direction: row; align-items: center; gap: 8px; }
#nick-input { width: 100%; margin-top: 8px; }
.pair { display: flex; gap: 6px; flex-wrap: wrap; } .pair select { flex: 1; min-width: 0; }
.rank-tabs { display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.rank-tabs button { border: 2px solid var(--line); background: transparent; color: var(--text); border-radius: 999px; padding: 6px 12px; cursor: pointer; font-weight: 700; } .rank-tabs button.active { background: #fff; color: #222; }
.rank-body table { width: 100%; border-collapse: collapse; font-size: .92rem; } .rank-body td, .rank-body th { padding: 7px 8px; border-bottom: 1px solid var(--line); text-align: left; }
.rank-body th { font-family: var(--font-pixel); font-size: .5rem; color: var(--muted); letter-spacing: 1px; }
.rank-body td.r, .rank-body th.r { text-align: right; } .rank-body tr.me td { background: rgba(255,210,74,.12); color: var(--accent); }
.rank-body tr.first td { font-weight: 900; }
.help-body ol { padding-left: 20px; line-height: 1.6; } .help-body li { margin-bottom: 6px; }
.confetti { position: absolute; inset: 0; pointer-events: none; overflow: hidden; border-radius: 16px; }
.confetti i { position: absolute; top: -10px; width: 8px; height: 14px; border-radius: 2px; animation: fall 1.8s linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); opacity: 0; } }
.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: #fff8e6; color: #1d2b3a; padding: 10px 18px; border-radius: 999px; font-weight: 900; z-index: 100; border: 2px solid #7a4a00; box-shadow: 0 4px 0 #7a4a00, 0 8px 30px rgba(0,0,0,.4); max-width: 90vw; text-align: center; }

/* ---------- 광고 자리 ---------- */
.ad-side { display: none; position: fixed; top: 10px; width: 300px; height: 1050px; max-height: calc(100vh - 20px); overflow: hidden; z-index: 20; background: rgba(0,0,0,.25); border: 1px dashed rgba(255,255,255,.12); border-radius: 8px; }
.ad-side.left { left: 10px; } .ad-side.right { right: 10px; }
.ad-side .ad-ph, .ad-mobile .ad-ph { width: 100%; height: 100%; display: grid; place-items: center; color: rgba(255,255,255,.25); font-family: var(--font-pixel); font-size: .6rem; letter-spacing: 1px; }
.ad-mobile { display: none; justify-content: center; align-items: center; background: rgba(0,0,0,.35); border-bottom: 1px solid var(--line); }
.ad-mobile.top { min-height: 100px; } .ad-mobile.bottom { min-height: 50px; border-bottom: 0; border-top: 1px solid var(--line); }
@media (min-width: 1640px) {
  .ad-side { display: block; }
  #app { padding: 0 320px; }
}

/* ---------- 반응형 ---------- */
@media (max-width: 1000px) {
  .room-body { grid-template-columns: 1fr; grid-template-rows: 1fr 240px; }
  .lobby-body { grid-template-columns: 1fr; }
  .lobby-side { position: static; height: auto; grid-template-rows: 200px 300px; }
  .lobby-chat { min-height: 200px; }
  .mode-tabs button b { font-size: 1.1rem; }
  .station { width: 60px; } .station .dot { width: 46px; height: 46px; font-size: 1.2rem; } .station small { font-size: .6rem; }
  .map-row::before { top: 29px; } .map-row:not(:last-child)::after { top: 29px; height: 66px; }
}
@media (max-width: 760px) {
  .screen { min-height: 100%; height: auto; }
  .ad-mobile { display: flex; }
  .lounge-actions { grid-template-columns: 1fr; padding: 12px; } .lounge-head { padding: 12px; } .lounge-rules { display: none; } .board { margin: 0 12px 12px; }
  .topbar, .playbar { padding: 8px 10px; gap: 8px; }
  .topbar .iconbtn, .playbar .iconbtn { padding: 6px; }
  .topbar .iconbtn span, .playbar .iconbtn span { display: none; }
  .brand-mark { font-size: 1.4rem; } .brand-text b { font-size: 1rem; white-space: nowrap; } .brand-text small { display: none; }
  .userchip { padding: 2px 8px 2px 2px; } .avatar { width: 26px; height: 26px; font-size: .8rem; }
  .uinfo b { font-size: .85rem; white-space: nowrap; max-width: 80px; overflow: hidden; text-overflow: ellipsis; } .uinfo small { display: none; }
  .hero { min-height: 0; } .hero-text { padding: 16px 16px 0; } .title-logo .t1, .title-logo .t2 { font-size: 1.9rem; } .tagline { max-width: 100%; font-size: .85rem; margin-bottom: 12px; }
  .player-card { position: static; width: 100%; margin: 10px 0 0; border-radius: 0; border-width: 2px 0 0; }
  .mode-tabs { grid-template-columns: 1fr; gap: 8px; } .mode-tabs button { min-height: 60px; padding: 10px 12px 10px 60px; } .mode-tabs button i { font-size: 1.6rem; }
  .stage-map { padding: 10px 4px 6px; }
  .map-row { flex-wrap: wrap; justify-content: flex-start; gap: 2px; padding: 4px 2px; } .map-row.rev { flex-direction: row; }
  .map-row::before, .map-row::after { display: none; }
  .station { width: 20%; } .station .dot { width: 44px; height: 44px; font-size: 1.1rem; } .station small { display: none; }
  .play-title b { font-size: 1rem; white-space: nowrap; } .play-title small { display: none; }
  .play-right { gap: 4px; }
  .play-body { flex-direction: column; padding: 8px; gap: 8px; }
  .queue-col { flex: 0 0 auto; flex-direction: row; align-items: center; width: 100%; justify-content: center; height: auto; padding: 6px; --q: 46px; }
  .pcard { width: auto; } .pcard-stats { display: none; }
  .play-actions { position: static; }
  .queue { flex-direction: row-reverse; } .queue-help { display: none; } .queue-title { writing-mode: vertical-rl; }
  .coop-players { display: none !important; }
  .board-col { order: -1; flex: 0 0 auto; } .board-wrap { flex: 0 0 auto; height: calc((100vw - 16px) * 0.7); min-height: 0; }
  .play-side { flex: 0 0 auto; height: auto; } .play-chat { flex: 0 0 220px; } #ponline-box { flex: 0 0 150px; }
  .minis-col { flex: 0 0 auto; max-height: none; flex-direction: row; overflow-x: auto; } .mini { flex: 0 0 150px; }
  .play-right .chip { padding: 4px 8px; font-size: .8rem; }
  .play-tip { display: none; }
  .tutorial-box { bottom: 8px; }
  .lobby-body { padding: 10px; gap: 10px; }
}
