* { margin: 0; padding: 0; box-sizing: border-box; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #0d1117; font-family: -apple-system, 'Apple SD Gothic Neo', 'Noto Sans KR', sans-serif; color: #e6edf3; }
canvas#game { display: block; width: 100vw; height: 100vh; }

.hidden { display: none !important; }
.overlay { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 10px; background: radial-gradient(ellipse at center, #16202e 0%, #0a0e14 100%); z-index: 20; }
.panel { text-align: center; padding: 32px 40px; background: rgba(22, 30, 42, .92); border: 1px solid #2e3d52; border-radius: 16px; box-shadow: 0 12px 48px rgba(0,0,0,.5); max-width: 92vw; max-height: 94vh; max-height: 94dvh; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.panel.wide { width: 880px; }
.panel h1 { font-size: 34px; margin-bottom: 6px; }
.panel h2 { font-size: 26px; margin-bottom: 4px; }
.panel .sub { color: #8ea3bd; margin-bottom: 20px; }
.panel .hint { color: #667a94; font-size: 13px; margin: 8px 0 14px; }
#nameInput { font-size: 20px; padding: 12px 18px; border-radius: 10px; border: 2px solid #3b5068; background: #0d1420; color: #fff; text-align: center; outline: none; width: 300px; -webkit-user-select: text; user-select: text; }
#nameInput:focus { border-color: #58a6ff; }

.grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-bottom: 14px; }
.champ-card { padding: 12px 6px 10px; border: 2px solid #2e3d52; border-radius: 12px; background: #121a26; cursor: pointer; transition: transform .08s; }
.champ-card .emoji { font-size: 34px; }
.champ-card .cname { font-weight: 700; margin-top: 4px; font-size: 15px; }
.champ-card .crole { font-size: 11px; color: #8ea3bd; }
.champ-card.sel { border-color: #58a6ff; background: #17263c; transform: scale(1.06); box-shadow: 0 0 18px rgba(88,166,255,.35); }
.detail-wrap { display: flex; gap: 12px; align-items: stretch; }
#champPreview { width: 130px; height: 150px; flex: 0 0 130px; background: linear-gradient(#141c2a, #0d1420); border: 1px solid #263346; border-radius: 10px; image-rendering: pixelated; }
.detail { flex: 1; min-height: 118px; text-align: left; background: #101724; border: 1px solid #263346; border-radius: 10px; padding: 12px 16px; font-size: 13px; line-height: 1.55; }
.champ-card .cvwrap { height: 42px; display: flex; align-items: flex-end; justify-content: center; }
.champ-card canvas.cv { image-rendering: pixelated; }
.detail b { color: #58a6ff; }
.detail .skill-line span { color: #ffd23f; font-weight: 700; margin-right: 6px; }

/* ---------- 로그인 (데이터 분석 플랫폼 위장) ---------- */
.overlay.corp { background: linear-gradient(160deg, #eef2f7 0%, #dfe7f0 60%, #d4dfeb 100%); }
.corp-card { background: #fff; color: #24303f; border-radius: 14px; padding: 36px 42px; width: 400px; max-width: 92vw; max-height: 94vh; max-height: 94dvh; overflow-y: auto; -webkit-overflow-scrolling: touch; box-shadow: 0 10px 40px rgba(30,60,100,.14); border: 1px solid #dbe3ec; text-align: center; }
.corp-card.wide-card { width: 620px; }
.corp-logo { font-size: 26px; font-weight: 800; color: #1f5eff; letter-spacing: -0.5px; }
.corp-tag { font-size: 12.5px; color: #6b7a8c; margin: 6px 0 14px; }
.corp-metrics { display: flex; justify-content: center; gap: 14px; font-size: 11.5px; color: #7a8899; background: #f4f7fa; border: 1px solid #e3eaf2; border-radius: 8px; padding: 8px 10px; margin-bottom: 18px; }
.corp-metrics b { color: #1f5eff; }
.corp-tabs { display: flex; gap: 6px; margin-bottom: 14px; }
.corp-tabs button { flex: 1; padding: 9px 0; border: 1px solid #d5dee8; background: #f2f5f9; color: #5c6b7d; border-radius: 8px; font-size: 13.5px; font-weight: 600; cursor: pointer; }
.corp-tabs button.on { background: #1f5eff; border-color: #1f5eff; color: #fff; }
.corp-card form { display: flex; flex-direction: column; gap: 10px; }
.corp-card input { padding: 11px 14px; border: 1.5px solid #d5dee8; border-radius: 8px; font-size: 14.5px; outline: none; background: #fbfcfe; color: #24303f; -webkit-user-select: text; user-select: text; }
.corp-card input:focus { border-color: #1f5eff; }
.corp-btn { padding: 11px 0; background: #1f5eff; color: #fff; border: none; border-radius: 8px; font-size: 15px; font-weight: 700; cursor: pointer; }
.corp-btn:active { background: #1748c4; }
.corp-note { font-size: 11.5px; color: #8a97a8; text-align: left; }
.corp-msg { min-height: 20px; font-size: 13px; margin-top: 12px; color: #d64545; }
.corp-msg.ok { color: #1d9e55; }
.corp-footer { margin-top: 18px; font-size: 10.5px; color: #a5b1c0; border-top: 1px solid #edf1f6; padding-top: 12px; }
#adminList { text-align: left; max-height: 55vh; overflow-y: auto; }
.admin-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid #e3eaf2; border-radius: 9px; margin-bottom: 8px; font-size: 14px; }
.admin-row.sel { border-color: #1f5eff; background: #f0f5ff; }
.admin-row .st { font-size: 11.5px; padding: 2px 9px; border-radius: 10px; font-weight: 700; }
.admin-row .st.pending { background: #fff3d6; color: #9a6b00; }
.admin-row .st.approved { background: #dcf5e6; color: #1d7a44; }
.admin-row .st.rejected { background: #fde3e3; color: #b03030; }
.admin-row .grow { flex: 1; }
.admin-row .nt { color: #8a97a8; font-size: 12px; }
.admin-row button { padding: 5px 12px; border-radius: 7px; border: 1px solid #d5dee8; background: #fff; cursor: pointer; font-size: 12.5px; }
.admin-row button.ok { background: #1d9e55; border-color: #1d9e55; color: #fff; }
.admin-row button.no { background: #d64545; border-color: #d64545; color: #fff; }
.err { color: #ff8a8a; font-size: 13px; min-height: 18px; margin-top: 8px; }
.menu-btns { display: flex; gap: 10px; justify-content: center; margin-top: 14px; flex-wrap: wrap; }
.mbtn { padding: 12px 22px; font-size: 15px; font-weight: 700; border: none; border-radius: 10px; background: #3576cc; color: #fff; cursor: pointer; min-width: 120px; -webkit-tap-highlight-color: transparent; }
.mbtn:active { background: #2a5ea8; }
.mbtn.ghost { background: #1c2740; color: #aebfd4; border: 1.5px solid #33465f; }
.mbtn.ghost:active { background: #26344f; }
.mbtn.go { background: #d9a300; color: #1a1500; }
.setting-chip { cursor: pointer; -webkit-tap-highlight-color: transparent; }
.setting-chip:active { background: #22344f; }
.mode-item, .champ-card { -webkit-tap-highlight-color: transparent; }
#codeInput { font-size: 30px; padding: 12px 18px; border-radius: 10px; border: 2px solid #3b5068; background: #0d1420; color: #fff; text-align: center; outline: none; width: 240px; -webkit-user-select: text; user-select: text; }
#codeInput:focus { border-color: #58a6ff; }
.code-badge { background: #ffd23f; color: #1a1a0a; font-family: monospace; font-size: 22px; letter-spacing: 5px; padding: 3px 14px; border-radius: 8px; margin-left: 10px; vertical-align: middle; }
#lobbyStory { position: relative; text-align: left; background: linear-gradient(160deg, #241a2e, #1a1522); border: 1px solid #4a3a2e; border-left: 3px solid #c9a24a; border-radius: 10px; padding: 12px 16px 12px 18px; margin: 10px 0 2px; }
#lobbyStory .story-title { color: #e8c34a; font-weight: 800; font-size: 14px; letter-spacing: .5px; margin-bottom: 5px; }
#lobbyStory .story-body { color: #cbb8d4; font-size: 12.5px; line-height: 1.7; }
#lobbyStory .story-body b { color: #ff9ab0; }
#lobbyStory .story-body em { color: #8fd0ff; font-style: normal; }
#lobbyStory .story-toggle { position: absolute; top: 10px; right: 12px; font-size: 11px; color: #8a7aa0; cursor: pointer; }
#lobbyTeams { display: flex; gap: 14px; margin: 14px 0; }
.lobby-team { flex: 1; background: #101724; border: 1px solid #263346; border-radius: 10px; padding: 10px 14px; min-height: 130px; text-align: left; }
.lobby-team h3 { font-size: 14px; margin-bottom: 8px; }
.lobby-team.blue h3 { color: #7db9ff; } .lobby-team.red h3 { color: #ff8a8a; }
.lobby-player { font-size: 14px; padding: 4px 0; }
.lobby-player .em { font-size: 18px; margin-right: 6px; }
.lobby-empty { color: #4a5a70; font-size: 13px; padding: 4px 0; }
#lobbySettings { display: flex; gap: 10px; justify-content: center; margin-bottom: 6px; flex-wrap: wrap; }
.setting-chip { background: #16233a; border: 1.5px solid #33465f; border-radius: 9px; padding: 8px 14px; font-size: 13.5px; }
.setting-chip b { color: #ffd23f; margin-right: 6px; }
#menuList { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.mode-item { text-align: left; padding: 14px 18px; border: 2px solid #2e3d52; border-radius: 12px; background: #121a26; font-weight: 700; cursor: pointer; }
.mode-item span { display: block; font-weight: 400; font-size: 12px; color: #8ea3bd; margin-top: 3px; }
.mode-item.sel { border-color: #58a6ff; background: #17263c; box-shadow: 0 0 18px rgba(88,166,255,.35); }

#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
#hud > * { pointer-events: none; }

#bottomBar { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); display: flex; align-items: center; gap: 12px; background: rgba(13,18,26,.85); border: 1px solid #2e3d52; border-radius: 14px; padding: 10px 16px; }
#portrait { font-size: 40px; width: 56px; height: 56px; display: flex; align-items: center; justify-content: center; background: #101724; border-radius: 10px; border: 1px solid #2e3d52; position: relative; }
#portrait .lv { position: absolute; right: -5px; bottom: -5px; background: #ffd23f; color: #000; font-size: 11px; font-weight: 800; border-radius: 8px; padding: 1px 5px; }
#barsWrap { display: flex; flex-direction: column; gap: 5px; width: 190px; }
.bar { position: relative; height: 16px; border-radius: 5px; background: #1a2330; overflow: hidden; border: 1px solid #2e3d52; }
.bar div { height: 100%; transition: width .15s; }
#hpFill { background: linear-gradient(#4cd167, #2ea84c); }
#mpFill { background: linear-gradient(#58a6ff, #3576cc); }
.bar.xpbar { height: 6px; }
#xpFill { background: linear-gradient(#ffd76a, #d9a83f); }
.bar span { position: absolute; inset: 0; text-align: center; font-size: 10.5px; line-height: 15px; font-weight: 700; text-shadow: 0 1px 2px #000; }
#skillBar { display: flex; gap: 7px; }
.skill { position: relative; width: 52px; height: 52px; border-radius: 9px; background: #16233a; border: 1.5px solid #33465f; display: flex; flex-direction: column; align-items: center; justify-content: center; overflow: hidden; }
.skill .key { position: absolute; top: 2px; left: 5px; font-size: 10px; font-weight: 800; color: #ffd23f; }
.skill .sname { font-size: 9.5px; color: #aebfd4; margin-top: 16px; text-align: center; line-height: 1.1; }
.skill .cdmask { position: absolute; inset: 0; background: rgba(5,8,12,.78); display: flex; align-items: center; justify-content: center; font-size: 17px; font-weight: 800; color: #fff; }
.skill.nomana { border-color: #7a3a3a; }
.skill.nomana .sname { color: #d98c8c; }
.skill.spell { background: #1d2433; }
#statsMini { font-size: 12px; color: #aebfd4; text-align: center; min-width: 62px; }
#statsMini b { color: #fff; font-size: 15px; }

#chatLog { position: absolute; left: 12px; bottom: 96px; width: 320px; max-height: 180px; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; font-size: 12.5px; line-height: 1.5; }
#chatLog .line { text-shadow: 0 1px 2px #000; opacity: .95; }
#chatLog .blue { color: #7db9ff; } #chatLog .red { color: #ff8a8a; } #chatLog .sys { color: #c9b458; }
#chatInputWrap { position: absolute; left: 12px; bottom: 66px; display: flex; gap: 6px; align-items: center; background: rgba(13,18,26,.9); border: 1px solid #3b5068; border-radius: 8px; padding: 6px 10px; pointer-events: auto !important; }
#chatInputWrap span { font-size: 12px; color: #8ea3bd; }
#chatInput { background: transparent; border: none; outline: none; color: #fff; font-size: 14px; width: 260px; -webkit-user-select: text; user-select: text; }

#killFeed { position: absolute; right: 12px; top: 14px; display: flex; flex-direction: column; gap: 4px; align-items: flex-end; font-size: 12.5px; }
#killFeed .line { background: rgba(13,18,26,.8); border: 1px solid #2e3d52; border-radius: 7px; padding: 4px 10px; }
#announce { position: absolute; top: 44px; left: 50%; transform: translateX(-50%); font-size: 15px; font-weight: 700; text-shadow: 0 2px 4px #000; }
#killBanner { position: absolute; top: 44%; left: 50%; transform: translate(-50%,-50%); text-align: center; text-shadow: 0 3px 14px #000, 0 0 30px rgba(0,0,0,.6); pointer-events: none; }
#killBanner .kb-main { font-size: 34px; font-weight: 800; letter-spacing: .5px; }
#killBanner .kb-sub { font-size: 40px; font-weight: 900; margin-top: 4px; }
#centerMsg { position: absolute; top: 34%; left: 50%; transform: translate(-50%, -50%); font-size: 44px; font-weight: 900; text-shadow: 0 3px 12px #000; text-align: center; }

#scoreboard { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); background: rgba(10,14,20,.93); border: 1px solid #2e3d52; border-radius: 14px; padding: 18px 26px; min-width: 460px; }
#scoreboard h3 { margin: 6px 0; font-size: 14px; }
#scoreboard table { width: 100%; border-collapse: collapse; font-size: 13px; }
#scoreboard td { padding: 3px 10px; }
#scoreboard .blue h3 { color: #7db9ff; } #scoreboard .red h3 { color: #ff8a8a; }

/* 상시 미니 스코어보드 */
#miniScore { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); display: flex; gap: 10px; align-items: center; background: rgba(13,18,26,.82); border: 1px solid #2e3d52; border-radius: 10px; padding: 5px 14px; font-size: 14px; font-weight: 800; }
#miniScore .blue { color: #7db9ff; } #miniScore .red { color: #ff8a8a; }
#miniScore .tw { font-size: 11px; font-weight: 400; color: #8ea3bd; }
#miniScore .clock { color: #d8e2ee; font-size: 12.5px; font-weight: 600; margin: 0 2px; }
/* 자동공격 토글 배지 */
#atkToggle { font-size: 11.5px; font-weight: 700; padding: 6px 9px; border-radius: 8px; background: #16233a; border: 1.5px solid #33465f; color: #9fd48a; min-width: 46px; text-align: center; }
#atkToggle.off { color: #d98c8c; border-color: #7a3a3a; }
/* 나가기 다이얼로그 */
#exitDialog { position: absolute; top: 40%; left: 50%; transform: translate(-50%, -50%); background: rgba(10,14,20,.96); border: 1.5px solid #b8860b; border-radius: 14px; padding: 22px 34px; text-align: center; }
#exitDialog h4 { font-size: 17px; margin-bottom: 6px; }
#exitDialog p { font-size: 12.5px; color: #8ea3bd; margin-bottom: 12px; }
#exitDialog kbd { background: #1d2942; border: 1px solid #3b5068; border-radius: 5px; padding: 1px 8px; font-weight: 700; font-size: 12px; }
/* 성장 선택 패널 (스킬 포인트 / 강화) */
#choicePanel { position: absolute; left: 50%; bottom: 104px; transform: translateX(-50%); background: rgba(13,18,26,.93); border: 1.5px solid #b8860b; border-radius: 12px; padding: 10px 14px; width: max-content; min-width: 0; max-width: min(640px, calc(100vw - 16px)); max-height: calc(100dvh - 150px); overflow-y: auto; box-sizing: border-box; }
.choice-row { flex-wrap: wrap; }
.choice-row .cdesc { width: 100%; font-size: 11.5px; color: #8ea3bd; padding-left: 36px; line-height: 1.45; }
#choicePanel h4 { font-size: 13px; color: #ffd23f; margin-bottom: 7px; text-align: center; }
.choice-row { display: flex; align-items: center; gap: 9px; padding: 5px 8px; border-radius: 8px; font-size: 13px; }
.choice-row .ck { background: #ffd23f; color: #1a1a0a; font-weight: 800; border-radius: 5px; padding: 1px 8px; font-size: 12px; }
.choice-row .cn { font-weight: 700; min-width: 90px; }
.choice-row .cd2 { color: #8ea3bd; font-size: 12px; }
.choice-row.off { opacity: .35; }
#buffBadge { position: absolute; top: 78px; left: 50%; transform: translateX(-50%); font-size: 14px; font-weight: 800; background: rgba(13,18,26,.85); border: 1.5px solid #ffd23f; color: #ffd23f; border-radius: 9px; padding: 4px 14px; }
#buffBadge.enemy { border-color: #ff6b6b; color: #ff8a8a; }
.skill .pips { position: absolute; bottom: 2px; left: 0; right: 0; text-align: center; font-size: 7px; letter-spacing: 1px; color: #ffd23f; }
#champInfo { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); background: rgba(10,14,20,.95); border: 1px solid #2e3d52; border-radius: 14px; padding: 20px 28px; font-size: 13.5px; line-height: 1.8; min-width: 460px; max-width: 620px; }
#champInfo h3 { margin-bottom: 8px; color: #ffd23f; }
#champInfo .sk { color: #ffd23f; font-weight: 800; margin-right: 6px; }
#champInfo .lvv { color: #8ea3bd; font-size: 12px; }
#champInfo .ups { margin-top: 8px; padding-top: 8px; border-top: 1px solid #263346; font-size: 12.5px; color: #aebfd4; }
#helpPanel { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); background: rgba(10,14,20,.95); border: 1px solid #2e3d52; border-radius: 14px; padding: 20px 28px; font-size: 13.5px; line-height: 1.9; min-width: 420px; }
#helpPanel h3 { margin-bottom: 8px; color: #58a6ff; }
#helpPanel kbd { background: #1d2942; border: 1px solid #3b5068; border-radius: 5px; padding: 1px 7px; font-weight: 700; font-size: 12px; margin-right: 4px; }

/* ---------- 터치 조작 UI ---------- */
#touchControls { position: fixed; inset: 0; z-index: 12; pointer-events: none; }
/* 메뉴/핑휠은 오버레이 전체가 상호작용 대상 (부모 none을 풀어줘야 .mbtn/.pw-btn 탭이 먹힘) */
#touchMenu, #pingWheel { pointer-events: auto; }
#touchControls .tbtn { pointer-events: auto; -webkit-tap-highlight-color: transparent; user-select: none; touch-action: none; border: none; color: #fff; font-weight: 800; }
#touchJoy { position: absolute; left: 26px; bottom: 30px; width: 132px; height: 132px; border-radius: 50%; background: rgba(20,28,40,.4); border: 2px solid rgba(140,170,210,.35); pointer-events: auto; touch-action: none; }
#touchJoyThumb { position: absolute; left: 50%; top: 50%; width: 56px; height: 56px; margin: -28px 0 0 -28px; border-radius: 50%; background: rgba(120,160,220,.6); border: 2px solid rgba(200,220,255,.7); }
#touchSkills { position: absolute; right: 18px; bottom: 22px; display: flex; flex-direction: column; align-items: flex-end; gap: 11px; }
.ts-row { display: flex; gap: 11px; align-items: center; }
.tbtn.tskill { width: 68px; height: 68px; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #3a68b8, #1f3a72); border: 2px solid #6b93d8; position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 0; }
.tbtn.tskill[data-key="R"] { background: radial-gradient(circle at 40% 35%, #8a4fd0, #431f7a); border-color: #d9a527; } /* 궁극기 강조 */
.tbtn.tskill.pressed { background: radial-gradient(circle at 40% 35%, #ffd23f, #c98a00); }
.tbtn.tskill.cooling { border-color: #3a4a66; } /* 쿨다운 어둡기는 .tcd 오버레이가 담당 (filter는 ＋배지까지 회색화) */
.tbtn.tskill.nomana { border-color: #c0506a; }
.tbtn.tskill > * { pointer-events: none; }
.tbtn.tskill .tk { position: absolute; top: 3px; left: 8px; font-size: 12px; font-weight: 800; color: #ffe08a; text-shadow: 0 1px 2px #000; }
.tbtn.tskill .tn { font-size: 10px; line-height: 1.05; text-align: center; padding: 0 3px; color: #fff; text-shadow: 0 1px 2px #000; margin-top: 3px; }
.tbtn.tskill .tp { position: absolute; bottom: 5px; left: 0; right: 0; text-align: center; font-size: 7px; letter-spacing: .5px; color: #ffd23f; }
.tbtn.tskill .tcd { position: absolute; inset: 0; border-radius: 50%; background: rgba(5,8,14,.72); display: flex; align-items: center; justify-content: center; font-size: 21px; font-weight: 800; color: #fff; }
.tbtn.tskill .tcd.hidden { display: none; }
/* 스킬 레벨업 ＋ 배지 (와일드리프트식) — 탭하면 해당 스킬 레벨업 */
.tbtn.tskill .tup { position: absolute; top: -9px; right: -7px; width: 30px; height: 30px; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #ffe27a, #d99a00); color: #3a2800; font-size: 19px; font-weight: 800; display: flex; align-items: center; justify-content: center; pointer-events: auto; border: 2px solid #fff3c4; box-shadow: 0 2px 8px rgba(0,0,0,.55); animation: tup-pulse 1s ease-in-out infinite; z-index: 2; }
.tbtn.tskill .tup.hidden { display: none; }
/* 오른쪽으로 튀어나온 ＋배지가 옆 버튼에 가려지지 않게 — 앞 버튼이 위로 */
.ts-skills .tbtn:nth-child(1) { z-index: 6; }
.ts-skills .tbtn:nth-child(2) { z-index: 5; }
.ts-skills .tbtn:nth-child(3) { z-index: 4; }
.ts-skills .tbtn:nth-child(4) { z-index: 3; }
@keyframes tup-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.18); } }
.tbtn.tsum { width: 54px; height: 54px; border-radius: 14px; font-size: 13px; background: #2a3550; border: 2px solid #46567a; position: relative; overflow: hidden; }
.tbtn.tsum.cooling { filter: grayscale(.45) brightness(.82); }
.tbtn.tsum > * { pointer-events: none; }
.tbtn.tsum .tsn { font-size: 12px; }
.tbtn.tsum .tcd { position: absolute; inset: 0; border-radius: 14px; background: rgba(5,8,14,.72); display: flex; align-items: center; justify-content: center; font-size: 17px; font-weight: 800; color: #fff; }
.tbtn.tsum .tcd.hidden { display: none; }
.tbtn.tact { width: 50px; height: 50px; border-radius: 50%; font-size: 20px; background: rgba(30,40,58,.85); border: 2px solid #46567a; }
.tbtn.tact.on { border-color: #7dd98a; }
#touchTop { position: absolute; right: 16px; top: 14px; display: flex; gap: 8px; }
.tbtn.tmini { pointer-events: auto; width: 44px; height: 44px; border-radius: 12px; font-size: 18px; background: rgba(20,28,40,.8); border: 1.5px solid #46567a; }
#touchPingWheel { position: absolute; inset: 0; z-index: 13; display: none; }

#hud.rhythm > *:not(#touchControls) { display: none !important; }
/* 터치 모드 보스전: 조작 버튼 전부 숨김 — 캔버스 레인 탭 패드로 연주 */
body.touch-mode #hud.rhythm #touchControls { display: none !important; }

/* ---------- 조작 모드 / 세이프에어리어 / 반응형 ---------- */
.menu-ctrl { margin-top: 14px; text-align: center; }
.ctrl-btn { display: inline-block; padding: 9px 16px; border-radius: 10px; background: #16233a; border: 1.5px solid #33465f; color: #cdd6ea; font-size: 13px; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.ctrl-btn b { color: #ffd23f; }
/* 세이프에어리어 (노치/홈 인디케이터) */
#touchJoy { left: calc(26px + env(safe-area-inset-left)); bottom: calc(30px + env(safe-area-inset-bottom)); }
#touchSkills { right: calc(18px + env(safe-area-inset-right)); bottom: calc(22px + env(safe-area-inset-bottom)); }
/* 좌우 반전 레이아웃 — 스킬 왼쪽, 조이스틱 오른쪽 (≡ 메뉴에서 전환) */
#touchControls.swap #touchJoy { left: auto; right: calc(26px + env(safe-area-inset-right)); }
#touchControls.swap #touchSkills { right: auto; left: calc(18px + env(safe-area-inset-left)); align-items: flex-start; }
#touchTop { right: calc(16px + env(safe-area-inset-right)); top: calc(14px + env(safe-area-inset-top)); }
/* 터치 핑 휠 */
#pingWheel { position: fixed; inset: 0; z-index: 14; background: rgba(0,0,0,.35); display: flex; align-items: center; justify-content: center; }
#pingWheel .pw-inner { position: relative; width: 220px; height: 220px; }
#pingWheel .pw-btn { position: absolute; width: 74px; height: 74px; margin: -37px 0 0 -37px; border-radius: 50%; border: 2px solid #fff; background: rgba(20,28,40,.95); color: #fff; font-size: 26px; display: flex; align-items: center; justify-content: center; }
#pingWheel .pw-cancel { position: absolute; left: 50%; top: 50%; width: 60px; height: 60px; margin: -30px 0 0 -30px; border-radius: 50%; background: rgba(40,20,20,.9); border: 1.5px solid #7a3a3a; color: #ddd; font-size: 22px; }
/* 좁은 화면 (폰) — 패널/버튼 축소 */
@media (max-width: 760px) {
  .panel { padding: 20px 18px; }
  .panel h1 { font-size: 26px; } .panel h2 { font-size: 21px; }
  .grid { grid-template-columns: repeat(5, 1fr); gap: 6px; }
  .champ-card .cname { font-size: 13px; } .champ-card .crole { font-size: 10px; }
  .detail-wrap { flex-direction: column; } #champPreview { align-self: center; }
  #bottomBar { transform: translateX(-50%) scale(.82); transform-origin: bottom center; }
}
@media (max-height: 460px) {
  .tbtn.tskill { width: 58px; height: 58px; font-size: 19px; }
  #touchJoy { width: 116px; height: 116px; }
}

/* ---------- 세로모드 회전 안내 ---------- */
#rotateNotice { position: fixed; inset: 0; z-index: 100; background: radial-gradient(ellipse at center, #16202e, #0a0e14); display: flex; align-items: center; justify-content: center; text-align: center; padding: 24px; }
#rotateNotice .rot-icon { font-size: 64px; animation: rot-spin 2.2s ease-in-out infinite; }
#rotateNotice .rot-title { font-size: 26px; font-weight: 800; color: #ffd23f; margin-top: 14px; }
#rotateNotice .rot-sub { font-size: 14px; color: #8ea3bd; margin-top: 8px; line-height: 1.6; }
@keyframes rot-spin { 0%,55%{ transform: rotate(0deg);} 75%,100%{ transform: rotate(-90deg);} }

/* 짧은 화면(가로 폰) — 메뉴 세로 압축 */
@media (max-height: 500px) {
  .panel { padding: 14px 20px; }
  .panel h1 { font-size: 22px; margin-bottom: 3px; } .panel h2 { font-size: 19px; }
  .panel .sub { margin-bottom: 10px; } .panel .hint { margin: 5px 0 9px; }
  #lobbyStory { padding: 8px 12px; margin: 6px 0; } #lobbyStory .story-body { font-size: 11.5px; line-height: 1.5; }
  #lobbyTeams { margin: 8px 0; } .lobby-team { min-height: auto; padding: 8px 12px; }
  .menu-btns { margin-top: 10px; } .mbtn { padding: 10px 18px; }
  .grid { gap: 5px; } .champ-card { padding: 7px 4px 6px; }
  .detail { min-height: auto; padding: 8px 12px; font-size: 12px; line-height: 1.4; }
  .mode-item { padding: 10px 14px; }
}

#choicePanel, #exitDialog { pointer-events: auto; }
.choice-row { cursor: pointer; -webkit-tap-highlight-color: transparent; }
.choice-row:active { background: #26344f; }

/* 터치 모드: HUD 스킬바 숨기고 터치 버튼이 스킬 표시 역할 */
body.touch-mode #skillBar { display: none; }
/* 터치 모드: HUD 바 슬림화 — K/D는 📊, 자동공격은 ⚔️ 버튼과 중복 */
body.touch-mode #statsMini, body.touch-mode #atkToggle { display: none; }
/* HUD 바를 스킬 반대쪽으로 살짝 이동해 버튼과 안 겹치게 */
body.touch-mode #bottomBar { left: 45%; }
body.touch-mode.swap-layout #bottomBar { left: 55%; }
/* 킬 피드가 우상단 미니 버튼(≡📊…)과 겹치지 않게 아래로 */
body.touch-mode #killFeed { top: 68px; }
/* 좁은 화면에선 HUD 바 추가 축소 */
@media (max-width: 860px) {
  body.touch-mode #bottomBar { transform: translateX(-50%) scale(.8); transform-origin: bottom center; }
}

/* 터치 선택창 — 카드형 버튼 (눌리는 입체감으로 상호작용 강조) */
#choicePanel.touch { max-width: min(720px, calc(100vw - 24px)); }
.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.choice-grid.up3 { grid-template-columns: repeat(3, 1fr); }
.choice-card { background: linear-gradient(#2b3c5e, #1c2942); border: 1.5px solid #5b82c4; border-radius: 13px; padding: 10px 12px 9px; cursor: pointer; -webkit-tap-highlight-color: transparent; user-select: none; box-shadow: 0 3px 0 #0c1424, 0 5px 12px rgba(0,0,0,.35); }
.choice-card:active { transform: translateY(2px); box-shadow: 0 1px 0 #0c1424; border-color: #ffd23f; background: linear-gradient(#3a5078, #263856); }
.choice-card.off { opacity: .38; box-shadow: none; cursor: default; border-color: #33465f; }
.choice-card .cc-top { display: flex; align-items: center; gap: 7px; }
.choice-card .ck { background: #ffd23f; color: #1a1a0a; font-weight: 800; border-radius: 6px; padding: 2px 9px; font-size: 13px; }
.choice-card .cn { font-weight: 700; font-size: 13.5px; }
.choice-card .clv { margin-left: auto; font-size: 11px; color: #9fc1ef; font-weight: 700; white-space: nowrap; }
.choice-card .cc-desc { margin-top: 6px; font-size: 11.5px; color: #aebfd4; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.choice-card .cc-p { margin-top: 5px; font-size: 11px; font-weight: 700; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.choice-card.up { text-align: center; }
.choice-card .cc-emoji { font-size: 26px; }
.choice-card .cc-name { font-weight: 800; font-size: 13px; margin-top: 3px; color: #ffe9a8; }

/* 선택창 — 좁은 화면에서 이름이 폭을 강제하지 않도록 */
.choice-row .cn { min-width: 0; }
/* 터치 모드: 스킬 버튼과 겹치지 않게 위로 올림 */
body.touch-mode #choicePanel { bottom: 200px; }
/* 짧은 화면(가로 폰): 조이스틱/스킬 버튼을 피해 상단 중앙에 배치 */
@media (max-height: 500px) {
  #choicePanel { bottom: 8px; }
  body.touch-mode #choicePanel {
    top: 60px; bottom: auto; left: 50%; transform: translateX(-50%);
    max-width: min(560px, calc(100vw - 130px)); max-height: calc(100dvh - 72px);
  }
  .choice-row .cdesc { padding-left: 30px; }
}

/* 인게임 터치 메뉴 */
#touchMenu { position: fixed; inset: 0; z-index: 15; background: rgba(0,0,0,.5); display: flex; align-items: center; justify-content: center; }
#touchMenu .tm-box { background: rgba(18,26,40,.98); border: 1px solid #33465f; border-radius: 14px; padding: 18px 20px; display: flex; flex-direction: column; gap: 10px; min-width: 220px; }
#touchMenu .tm-title { text-align: center; font-weight: 800; color: #ffd23f; margin-bottom: 4px; }
#touchMenu .mbtn { min-width: 200px; }
