* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0c0a14; color: #fff; font-family: 'Noto Sans KR', system-ui, sans-serif; user-select: none; -webkit-user-select: none; touch-action: none; }
canvas#game { position: fixed; inset: 0; width: 100vw; height: 100vh; image-rendering: pixelated; display: block; }
.hide { display: none !important; }
button { font-family: inherit; cursor: pointer; color: #fff; }
button:disabled { opacity: .45; cursor: default; }
.dim { opacity: .65; font-size: 11px; }
.row { display: flex; gap: 8px; }

#touch { position: fixed; inset: 0; }
#joy { position: fixed; width: 112px; height: 112px; margin: -56px 0 0 -56px; border-radius: 50%; border: 2px solid rgba(255,255,255,.28); background: radial-gradient(circle, rgba(255,255,255,.08) 0 40%, rgba(10,8,20,.35) 70%); box-shadow: 0 0 0 6px rgba(255,255,255,.05), inset 0 0 18px rgba(0,0,0,.4); pointer-events: none; opacity: 0; transition: opacity .12s; }
#joy::before { content: ''; position: absolute; inset: 10px; border-radius: 50%; border: 1px dashed rgba(255,255,255,.18); }
#joy.on { opacity: 1; }
#joy i { position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff, #d8d2f0 45%, #8a82b0); box-shadow: 0 3px 8px rgba(0,0,0,.5), 0 0 12px rgba(255,230,128,.35); transform: translate(-50%,-50%); }

/* ---------- 전투 HUD ---------- */
:root { --panel: linear-gradient(180deg, rgba(26,22,44,.9), rgba(10,9,20,.84)); --edge: rgba(255,255,255,.14); --gold: #ffd76a; }
#hud { position: fixed; inset: 0; pointer-events: none; padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
#hud button, #hud .pi, #hud #mini, #hud #bigmap { pointer-events: auto; }
#hud kbd { font-family: inherit; }
html:not(.kbd) body.touch #hud kbd { display: none; }   /* 터치 기기라도 실제 키보드를 누르면(html.kbd) 단축키를 보인다 */
.ico { width: 1em; height: 1em; display: block; flex: 0 0 auto; }

#vign { position: absolute; inset: 0; box-shadow: inset 0 0 90px 10px rgba(255,20,20,.55); opacity: 0; transition: opacity .3s; }
#vign.on { animation: vign 1s ease-in-out infinite; }
@keyframes vign { 50% { opacity: 1; } 0%, 100% { opacity: .35; } }

/* 스테이지·목표 */
#topL { position: absolute; left: 8px; top: 8px; width: min(250px, 30vw); background: var(--panel); border: 1px solid var(--edge); border-left: 3px solid var(--gold); border-radius: 4px 12px 12px 4px; padding: 6px 10px 7px; box-shadow: 0 4px 14px rgba(0,0,0,.35); }
#topL .sth { display: flex; align-items: center; gap: 6px; white-space: nowrap; overflow: hidden; }
#topL .sth em { font-style: normal; font-family: 'Black Han Sans', sans-serif; font-size: 12px; color: #201a08; background: linear-gradient(#ffe89a, #e8b040); padding: 0 6px; border-radius: 4px; }
#topL .sth b { font-weight: 900; font-size: 13px; text-overflow: ellipsis; overflow: hidden; text-shadow: 0 1px 2px #000; }
#topL .obj { display: flex; justify-content: space-between; gap: 6px; margin-top: 4px; font-size: 10.5px; font-weight: 700; color: #e8e2ff; }
#topL .obj .ocnt { color: var(--gold); font-weight: 900; font-variant-numeric: tabular-nums; }
#topL .obar { height: 5px; margin-top: 3px; background: rgba(0,0,0,.6); border-radius: 3px; overflow: hidden; box-shadow: inset 0 0 0 1px rgba(255,255,255,.08); }
#topL .obar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #ff9a40, #ffd76a); transition: width .3s; }
#topL .zones { display: flex; gap: 3px; margin-top: 5px; }
#topL .zones i { flex: 1; height: 3px; border-radius: 2px; background: rgba(255,255,255,.15); }
#topL .zones i.done { background: #6ae08a; }
#topL .zones i.cur { background: var(--gold); box-shadow: 0 0 6px var(--gold); }
#topL .synl { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 5px; }
#topL .synl i { font-style: normal; font-size: 9px; font-weight: 900; padding: 1px 6px; border-radius: 8px; background: rgba(0,0,0,.5); border: 1px solid var(--c); color: var(--c); }

/* 파티 */
#party { position: absolute; top: 7px; left: 50%; transform: translateX(-50%); display: flex; gap: 4px; }
.pi { position: relative; width: 46px; height: 58px; border-radius: 8px; background: linear-gradient(180deg, color-mix(in srgb, var(--c) 40%, #1a1630), #0e0c18); border: 2px solid rgba(255,255,255,.18); box-shadow: 0 3px 8px rgba(0,0,0,.45); overflow: hidden; cursor: pointer; transition: transform .12s, border-color .12s; }
.pi .pf { position: absolute; left: 0; right: 0; top: 0; height: 44px; overflow: hidden; }
.pi img { width: 44px; height: 44px; image-rendering: pixelated; display: block; margin: 0 auto; }
.pi .m { position: absolute; left: 2px; top: 2px; width: 15px; height: 15px; border-radius: 50%; background: rgba(8,6,16,.8); display: grid; place-items: center; font-size: 10px; color: #fff; box-shadow: 0 0 0 1px rgba(255,255,255,.25); }
.pi .m[data-m="charge"] { color: #ff8a6a; } .pi .m[data-m="hold"] { color: #8ad8ff; } .pi .m[data-m="retreat"] { color: #6ab8ff; background: #10264a; } .pi .m[data-m="dead"] { display: none; }
.pi kbd { position: absolute; right: 3px; top: 1px; font-size: 9px; font-weight: 900; opacity: .7; text-shadow: 0 1px 2px #000; }
.pi .bar { position: absolute; left: 3px; right: 3px; bottom: 7px; height: 5px; background: rgba(0,0,0,.8); border-radius: 2px; overflow: hidden; }
.pi .ug { position: absolute; left: 3px; right: 3px; bottom: 2px; height: 3px; background: rgba(0,0,0,.8); border-radius: 2px; overflow: hidden; }
.pi .bar i, .pi .ug i { display: block; height: 100%; transition: width .15s; }
.pi .ug i { background: linear-gradient(90deg, #c08a20, #ffd84a); }
.pi.ready { border-color: #ffd84a; }
.pi.ready .ug i { background: #fff; box-shadow: 0 0 6px #ffd84a; animation: blink .4s infinite alternate; }
@keyframes blink { to { background: #ffd84a; } }
.pi.ctrl { border-color: #fff; box-shadow: 0 0 0 2px var(--gold), 0 0 14px rgba(255,215,106,.6); transform: translateY(3px) scale(1.06); }
.pi.ret { border-color: #6ab8ff; }
.pi.ret img { filter: saturate(.6) brightness(.8); }
.pi.low:not(.dead) { animation: lowp .8s infinite; }
@keyframes lowp { 50% { border-color: #ff4a3a; } }
.pi.hit .pf { animation: hitf .25s; }
@keyframes hitf { 0% { background: rgba(255,60,60,.8); } 100% { background: transparent; } }
.pi.dead { filter: grayscale(1) brightness(.4); }
.pi.dead::before { content: '\2715'; position: absolute; inset: 0 0 12px; display: grid; place-items: center; font-size: 26px; font-weight: 900; color: #ff5a5a; z-index: 2; }

/* 보스 */
#bossbar { position: absolute; top: 72px; left: 50%; transform: translateX(-50%); width: min(460px, 56vw); display: none; }
#bossbar.on { display: block; animation: bossIn .5s cubic-bezier(.2,.9,.3,1.2); }
@keyframes bossIn { from { opacity: 0; transform: translate(-50%, -10px) scaleX(.6); } }
#bossbar .bn { display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 12px; font-weight: 900; color: #ffd0c4; text-shadow: 0 1px 3px #000; letter-spacing: 2px; }
#bossbar .bn .ico { color: #ff5040; font-size: 15px; }
#bossbar .bn small { color: #ffb0a0; opacity: .8; letter-spacing: 0; }
#bossbar .bb { position: relative; height: 10px; margin-top: 2px; background: #1a0406; border: 1px solid #ff6a50; border-radius: 2px; box-shadow: 0 0 10px rgba(255,40,20,.45), inset 0 0 0 1px #000; overflow: hidden; clip-path: polygon(6px 0, 100% 0, calc(100% - 6px) 100%, 0 100%); }
#bossbar .bb i { position: absolute; left: 0; top: 0; bottom: 0; }
#bossbar .bb .lag { background: #fff2d0; }
#bossbar .bb .cur { background: linear-gradient(#ff7a50, #d81a10 60%, #9a0a08); transition: width .1s; }
#bossbar .bb .ph { position: absolute; top: 0; bottom: 0; width: 2px; background: rgba(0,0,0,.8); box-shadow: 0 0 0 1px rgba(255,220,120,.6); }

/* 미니맵 */
#mini { position: absolute; right: 8px; top: 8px; width: min(176px, 22vw); aspect-ratio: 16 / 10.5; border-radius: 10px; border: 2px solid rgba(255,255,255,.22); box-shadow: 0 0 0 1px #000, 0 4px 14px rgba(0,0,0,.5); overflow: hidden; background: rgba(6,8,18,.8); cursor: pointer; }
#mini canvas { width: 100%; height: 100%; display: block; }
#mini .mlab { position: absolute; left: 0; bottom: 0; font-size: 9px; font-weight: 900; padding: 1px 6px; background: rgba(0,0,0,.65); border-top-right-radius: 6px; color: var(--gold); }
#mini::after { content: '\2922'; position: absolute; right: 4px; top: 1px; font-size: 11px; opacity: .6; }
#bigmap { position: absolute; inset: 0; background: rgba(4,4,12,.78); backdrop-filter: blur(2px); display: none; flex-direction: column; padding: 12px 16px 16px; z-index: 5; }
#bigmap.on { display: flex; animation: fadeIn .18s; }
@keyframes fadeIn { from { opacity: 0; } }
#bigmap .bmh { display: flex; align-items: center; gap: 8px; font-size: 16px; }
#bigmap .bmh b { font-family: 'Black Han Sans', sans-serif; font-weight: 400; font-size: 20px; }
#bigmap .bmh small { margin-left: auto; opacity: .6; font-size: 11px; }
#bigmap canvas { flex: 1; width: 100%; min-height: 0; }

/* 시스템 버튼 */
#sys { position: absolute; right: 8px; top: calc(8px + min(176px, 22vw) * 10.5 / 16 + 6px); display: flex; gap: 4px; }
#sys button { display: flex; align-items: center; gap: 3px; height: 26px; padding: 0 7px; background: var(--panel); border: 1px solid var(--edge); border-radius: 7px; font-size: 10px; font-weight: 900; box-shadow: 0 2px 6px rgba(0,0,0,.4); }
#sys button .ico { font-size: 12px; }
#sys button.sq { width: 28px; justify-content: center; padding: 0; }
#sys button.on { background: linear-gradient(#fff2b0, #ffc840); color: #2a1a04; border-color: #fff; }
#sys button[data-a="auto"].on .ico { animation: spin 1.6s linear infinite; }
#sys button.lockd { opacity: .4; }
#sys button:active { transform: scale(.94); }

#chain { position: absolute; right: 12px; top: calc(8px + min(176px, 22vw) * 10.5 / 16 + 40px); text-align: right; opacity: 0; transition: opacity .2s; }
#chain.on { opacity: 1; }
#chain b { display: block; font-family: 'Black Han Sans', sans-serif; font-weight: 400; font-size: 26px; font-style: italic; color: #ffd84a; text-shadow: 2px 2px 0 #000, 0 0 12px #ff8a20; animation: chainPop .3s; }
#chain small { font-size: 10px; font-weight: 700; text-shadow: 0 1px 2px #000; }
@keyframes chainPop { from { transform: scale(1.6); } }

/* 조작 캐릭터 */
#leader { position: absolute; left: 10px; bottom: 10px; display: flex; align-items: center; gap: 8px; }
#leader .lp { width: 54px; height: 54px; border-radius: 50%; overflow: hidden; border: 3px solid var(--c); background: radial-gradient(circle, color-mix(in srgb, var(--c) 45%, #15121f), #0c0a14); box-shadow: 0 0 0 2px #000, 0 0 12px color-mix(in srgb, var(--c) 60%, transparent); }
#leader .lp img { width: 100%; height: 100%; image-rendering: pixelated; }
#leader .li { width: 170px; }
#leader .ln { display: flex; align-items: baseline; gap: 6px; text-shadow: 0 1px 3px #000; }
#leader .ln b { font-size: 15px; font-weight: 900; }
#leader .ln small { font-size: 10px; opacity: .8; }
#leader .lhp { position: relative; height: 12px; margin-top: 2px; background: rgba(0,0,0,.75); border-radius: 3px; overflow: hidden; box-shadow: 0 0 0 1px rgba(255,255,255,.15); }
#leader .lhp i { position: absolute; left: 0; top: 0; bottom: 0; }
#leader .lhp .lag { background: #ffe6c0; }
#leader .lhp .cur { background: linear-gradient(#8aff8a, #2eb846); transition: width .1s; }
#leader.low .lhp .cur { background: linear-gradient(#ff9a8a, #e0302a); }
#leader .lhp span { position: absolute; inset: 0; font-size: 9px; font-weight: 900; line-height: 12px; text-align: center; text-shadow: 0 0 2px #000, 0 0 2px #000; font-variant-numeric: tabular-nums; }
#leader .lug { height: 4px; margin-top: 2px; background: rgba(0,0,0,.75); border-radius: 2px; overflow: hidden; }
#leader .lug i { display: block; height: 100%; background: linear-gradient(90deg, #c08a20, #ffd84a); }

/* 작전 */
#cmds { position: absolute; right: 232px; bottom: 12px; display: flex; background: var(--panel); border: 1px solid var(--edge); border-radius: 10px; padding: 3px; box-shadow: 0 4px 12px rgba(0,0,0,.45); }
#cmds button { position: relative; width: 50px; height: 44px; background: transparent; border: 0; border-radius: 7px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-weight: 900; font-size: 10px; color: #cfc8e8; }
#cmds button .ico { font-size: 17px; }
#cmds button kbd { position: absolute; right: 3px; top: 1px; font-size: 8px; opacity: .45; }
#cmds button.on { background: linear-gradient(#fff2b0, #ffc840); color: #2a1a04; box-shadow: 0 0 10px rgba(255,200,64,.5); }
#cmds button[data-m="retreat"] { color: #8ac8ff; }
#cmds button[data-m="retreat"].on { background: linear-gradient(#b8e0ff, #4a90e0); color: #04142a; }
#cmds button:active { transform: scale(.92); }

/* 스킬 */
#skills { position: absolute; right: 14px; bottom: 12px; width: 212px; height: 150px; --c: #fff; }
.sb { position: absolute; border-radius: 50%; border: 3px solid var(--c, #fff); background: radial-gradient(circle at 50% 35%, color-mix(in srgb, var(--c) 55%, #1a1630), #0e0c18 75%); overflow: hidden; padding: 0; box-shadow: 0 0 0 2px #000, 0 4px 10px rgba(0,0,0,.5); }
.sb .ic { position: absolute; inset: 0; display: grid; place-items: center; font-size: 26px; color: #fff; filter: drop-shadow(0 0 4px color-mix(in srgb, var(--c) 80%, transparent)); }
.sb .cd { position: absolute; inset: 0; z-index: 1; border-radius: 50%; }
.sb .cdn { position: absolute; inset: 0; z-index: 2; display: grid; place-items: center; font-size: 18px; font-weight: 900; text-shadow: 0 0 3px #000, 0 0 3px #000; font-variant-numeric: tabular-nums; }
.sb .nm { position: absolute; left: 50%; bottom: 4px; transform: translateX(-50%); z-index: 3; white-space: nowrap; font-size: 9px; font-weight: 900; text-shadow: 0 0 3px #000, 0 0 3px #000, 0 0 3px #000; }
.sb kbd { position: absolute; left: 50%; top: 3px; transform: translateX(-50%); font-size: 8px; opacity: .55; z-index: 3; }
.sb.s1, .sb.s2 { width: 64px; height: 64px; }
.sb.s1 { right: 116px; bottom: 0; }
.sb.s2 { right: 90px; bottom: 74px; }
.sb:not(.ready):not(.ult) .ic { opacity: .45; filter: grayscale(.6); }
.sb.ready { animation: sbReady .6s; }
@keyframes sbReady { 30% { box-shadow: 0 0 0 2px #000, 0 0 22px var(--c); transform: scale(1.08); } }
.sb.ult { right: 0; bottom: 0; width: 106px; height: 106px; border-color: #ffd84a; border-width: 4px; }
.sb.ult .uimg { position: absolute; inset: 0; overflow: hidden; border-radius: 50%; }
.sb.ult .uimg img { position: absolute; left: 50%; top: -4%; width: 150%; transform: translateX(-50%); }
.sb.ult .g { position: absolute; inset: 0; border-radius: 50%; mix-blend-mode: multiply; }
.sb.ult .nm { font-size: 11px; bottom: 10px; }
.sb.ult .rdy { position: absolute; left: 0; right: 0; top: 30%; z-index: 3; font-family: 'Black Han Sans', sans-serif; font-weight: 400; font-size: 16px; font-style: italic; letter-spacing: 1px; color: #fff6c0; text-shadow: 0 0 6px #ff9a20, 2px 2px 0 #000; opacity: 0; }
.sb.ult.ready { box-shadow: 0 0 0 2px #000, 0 0 22px #ffd84a, 0 0 6px #fff inset; animation: pulse 0.8s infinite; }
.sb.ult.ready .g { background: none !important; }
.sb.ult.ready .rdy { opacity: 1; animation: rdy .8s infinite; }
.sb.ult.ready::after { content: ''; position: absolute; inset: -40%; background: conic-gradient(from 0deg, transparent 0 70%, rgba(255,255,255,.5) 80%, transparent 90%); animation: spin 1.4s linear infinite; z-index: 2; mix-blend-mode: overlay; }
@keyframes rdy { 50% { transform: scale(1.1); } }
@keyframes pulse { 50% { box-shadow: 0 0 0 2px #000, 0 0 36px #ffd84a, 0 0 10px #fff inset; } }
@keyframes spin { to { transform: rotate(360deg); } }
.sb:active { transform: scale(.93); }
.sb.deny { animation: deny .3s; }
@keyframes deny { 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }

/* 알림 */
#toast { position: absolute; top: 96px; left: 50%; transform: translateX(-50%); font-weight: 900; font-size: 14px; padding: 4px 18px; background: linear-gradient(90deg, transparent, rgba(0,0,0,.7) 20%, rgba(0,0,0,.7) 80%, transparent); text-shadow: 0 2px 4px #000; opacity: 0; white-space: nowrap; }
#toast.on { animation: toast 2.2s forwards; }
@keyframes toast { 0% { opacity: 0; transform: translate(-50%, 8px); } 10%, 78% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; } }

#banner { position: absolute; left: 0; top: 36%; display: flex; align-items: center; gap: 6px; background: linear-gradient(90deg, color-mix(in srgb, var(--c) 85%, #000) 0%, color-mix(in srgb, var(--c) 55%, transparent) 60%, transparent); padding: 3px 80px 3px 8px; opacity: 0; font-weight: 900; font-size: 14px; text-shadow: 0 1px 3px #000; border-top: 1px solid rgba(255,255,255,.4); border-bottom: 1px solid rgba(255,255,255,.4); }
#banner .bi { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: rgba(0,0,0,.45); font-size: 15px; }
#banner small { display: block; font-size: 9px; opacity: .85; }
#banner img { width: 32px; height: 32px; image-rendering: pixelated; }
#banner.ult { font-size: 16px; border-color: #ffd84a; }
#banner.enemy { left: auto; right: 0; flex-direction: row-reverse; text-align: right; padding: 3px 8px 3px 80px; background: linear-gradient(270deg, #8a1020 0%, rgba(138,16,32,.6) 60%, transparent); }
#banner.on { animation: banner 1.4s forwards; }
#banner.enemy.on { animation: bannerR 1.4s forwards; }
@keyframes banner { 0% { opacity: 0; transform: translateX(-60px); } 15%, 70% { opacity: 1; transform: none; } 100% { opacity: 0; } }
@keyframes bannerR { 0% { opacity: 0; transform: translateX(60px); } 15%, 70% { opacity: 1; transform: none; } 100% { opacity: 0; } }

#wave { position: absolute; left: 0; right: 0; top: 28%; text-align: center; opacity: 0; pointer-events: none; padding: 8px 0 10px; z-index: 0; }
#wave i { position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(10,6,24,.75) 25%, rgba(10,6,24,.75) 75%, transparent); border-top: 1px solid rgba(255,215,106,.5); border-bottom: 1px solid rgba(255,215,106,.5); z-index: -1; }
#wave b { display: block; font-family: 'Black Han Sans', sans-serif; font-weight: 400; font-size: clamp(28px, 9vh, 56px); font-style: italic; letter-spacing: 4px; color: #fff; text-shadow: 3px 3px 0 #000, 0 0 20px #8a60ff; }
#wave small { font-weight: 900; letter-spacing: 3px; text-shadow: 0 2px 3px #000; color: var(--gold); }
#wave.boss i { background: linear-gradient(90deg, transparent, rgba(60,0,0,.8) 25%, rgba(60,0,0,.8) 75%, transparent); border-color: #ff4030; }
#wave.boss b { color: #ff5040; text-shadow: 3px 3px 0 #000, 0 0 24px #ff2010; }
#wave.on { animation: wave 2s forwards; }
@keyframes wave { 0% { opacity: 0; transform: scaleY(0); } 10% { opacity: 1; transform: none; } 82% { opacity: 1; } 100% { opacity: 0; } }

/* ---------- 컷인 (투명 일러스트를 우측 하단에, 원본 연출 유지) ---------- */
.ci-layer { position: fixed; right: max(16px, env(safe-area-inset-right)); bottom: calc(222px + env(safe-area-inset-bottom)); width: min(500px, 42vw); height: min(360px, 40vh); display: none; overflow: visible; border: 0; border-radius: 0; background: none; box-shadow: none; --c: #ff5a8a; --c2: #ff5a8a; pointer-events: none; }
.ci-layer.show { display: block; }
/* Transparent diagonal color and speed accents leave the original cut-in art visible. */
.ci-band, .ci-lines { position: absolute; inset: 0; pointer-events: none; }
.ci-band { z-index: 0; }
.ci-band i { position: absolute; left: 4%; width: 88%; height: 13%; transform: rotate(-17deg) skewX(-25deg); transform-origin: 50% 50%; background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--c) 48%, transparent) 25%, color-mix(in srgb, var(--c) 72%, transparent) 55%, transparent); opacity: 0; animation: ciBand .34s ease-out forwards; }
.ci-band i:nth-child(1) { top: 19%; }
.ci-band i:nth-child(2) { top: 43%; animation-delay: .035s; }
.ci-band i:nth-child(3) { top: 67%; animation-delay: .07s; }
.ci-lines { z-index: 2; }
.ci-lines i { position: absolute; left: 8%; top: 50%; width: 78%; height: 2px; transform-origin: 0 50%; background: linear-gradient(90deg, transparent, var(--c) 45%, #fff, transparent); opacity: 0; animation: ciSpeed .34s steps(6, end) both; }
.ci-lines i:nth-child(1) { --angle: -61deg; }
.ci-lines i:nth-child(2) { --angle: -38deg; top: 46%; }
.ci-lines i:nth-child(3) { --angle: -15deg; top: 42%; }
.ci-lines i:nth-child(4) { --angle: 17deg; top: 54%; }
.ci-lines i:nth-child(5) { --angle: 39deg; top: 58%; }
.ci-lines i:nth-child(6) { --angle: 62deg; }
.ci-flash { position: absolute; z-index: 4; left: 8%; right: 8%; top: 48%; height: 2px; background: #fffbd6; pointer-events: none; animation: flash .14s ease-out forwards; }
.ci-por { position: absolute; z-index: 1; right: 0; bottom: 0; height: 100%; width: auto; max-width: 76%; object-fit: contain; object-position: bottom right; filter: drop-shadow(0 0 8px #0009) drop-shadow(-3px 0 0 #fffd); animation: porIn .3s cubic-bezier(.15,.9,.25,1.15) both, drift 1.6s linear; }
.ci-por.p2 { display: none; }
.ci-text { position: absolute; z-index: 2; left: 0; bottom: 7%; max-width: 76%; animation: textIn .28s .06s cubic-bezier(.2,.9,.3,1) both; }
.ci-who { font-size: 12px; font-weight: 900; letter-spacing: 2px; text-shadow: 0 2px 2px #000, 0 0 5px #000; }
.ci-name { margin-top: 4px; font-family: 'Black Han Sans', 'Noto Sans KR', sans-serif; font-size: clamp(23px, 2.5vw, 36px); line-height: 1.12; font-style: italic; word-break: keep-all; overflow-wrap: anywhere; text-shadow: 2px 2px 0 #000, -1px -1px 0 var(--c); transform-origin: 0 60%; animation: ciNameSlam .22s .055s cubic-bezier(.15,.9,.2,1) both; }
.ci-line { margin-top: 6px; font-size: 13px; line-height: 1.4; font-weight: 700; word-break: keep-all; text-shadow: 0 2px 3px #000, 0 0 6px #000; }
.ci-chain { margin-bottom: 2px; font-family: 'Black Han Sans', sans-serif; font-size: 24px; line-height: 1.1; font-style: italic; color: #ffd84a; text-shadow: 2px 2px 0 #000, 0 0 14px #ff8a20; animation: textIn .3s .12s both; }
.ci-chain:empty { display: none; }
.ci-layer.out { /* Opacity follows each independent real-time clock. */ }
.ci-layer.enemy .ci-name { color: #ffd0c0; }
.ci-layer.link .ci-por.p1 { right: 0; z-index: 1; }
.ci-layer.link .ci-por.p2 { display: block; right: 28%; height: 96%; animation-delay: .08s; filter: drop-shadow(0 0 8px #0009) drop-shadow(-3px 0 0 #fffd) brightness(.95); }
.ci-layer.link .ci-text { max-width: 84%; }
.ci-layer.link .ci-name { color: #fff6c0; }
/* Two-tone, bounded duet framing: never resize into a full-screen art overlay. */
.ci-duo-frame { display: none; }
.ci-layer.link { width: min(540px, 44vw); }
.ci-layer.link .ci-duo-frame { display: block; position: absolute; inset: 2% 2% 28%; border-top: 2px solid var(--c); border-bottom: 2px solid var(--c2); z-index: 2; }
.ci-duo-frame span { position: absolute; width: 24px; height: 20px; border-left: 3px solid var(--c); left: 0; top: 0; }
.ci-duo-frame span + span { left: auto; top: auto; right: 0; bottom: 0; border-left: 0; border-right: 3px solid var(--c2); }
.ci-layer.link .ci-band i:nth-child(2) { background: linear-gradient(90deg, transparent, var(--c) 30%, var(--c2) 70%, transparent); }
.ci-layer.link .ci-band i:nth-child(3) { background: linear-gradient(90deg, transparent, var(--c2), transparent); }
.ci-layer.link .ci-por { height: 72%; bottom: 28%; width: 50%; max-width: 50%; object-position: center bottom; }
.ci-layer.link .ci-por.p2 { right: 50%; height: 72%; }
.ci-layer.link.duo-art .ci-por.p1 { inset: 2% 2% 28%; width: 96%; max-width: 96%; height: 70%; object-fit: contain; object-position: center; filter: none; animation: ciDuoIn .22s steps(6, end) both; }
.ci-layer.link.duo-art .ci-por.p2 { display: none; }
.ci-layer.link .ci-text { left: 3%; right: 3%; bottom: 0; max-width: 94%; padding: 6px 9px; border-left: 3px solid var(--c); background: linear-gradient(90deg, #111827ed, #111827ad 80%, transparent); }
.ci-layer.link .ci-who { letter-spacing: 1px; font-size: 11px; }
.ci-layer.link .ci-name { font-size: clamp(20px, 2.3vw, 30px); }
.ci-layer.link .ci-line { font-size: 11px; margin-top: 3px; }
.ci-layer[data-rarity="SR"]:not(.link) .ci-band i:nth-child(3) { display: none; }
.ci-layer[data-rarity="SSR"] .ci-name { border-bottom: 2px solid color-mix(in srgb, var(--c) 75%, transparent); padding-bottom: 4px; }
@keyframes ciDuoIn { from { opacity: .3; transform: translateX(12px); } to { opacity: 1; transform: none; } }
@keyframes ciOut { to { transform: translateX(18px); opacity: 0; } }
@keyframes porIn { from { transform: translateX(35%); opacity: 0; } }
@keyframes drift { to { margin-right: -2%; } }
@keyframes textIn { from { transform: translateX(-40%); opacity: 0; } }
@keyframes flash { to { opacity: 0; } }
@keyframes ciBand { 0% { opacity: 0; translate: -25% 0; } 45% { opacity: .8; } 100% { opacity: .28; translate: 0 0; } }
@keyframes ciSpeed { 0% { opacity: 0; transform: rotate(var(--angle)) scaleX(0); } 35% { opacity: .9; } 100% { opacity: 0; transform: rotate(var(--angle)) scaleX(1.5); } }
@keyframes ciNameSlam { 0% { opacity: 0; transform: translateX(-18px) scale(1.18); } 65% { opacity: 1; transform: translateX(0) scale(.98); } 100% { transform: scale(1); } }
@media (max-height: 600px) {
  /* 짧은 가로 화면에서는 스킬 조작부 왼쪽으로 조금 옮겨 인물이 보이게 한다. */
  .ci-layer { right: calc(112px + env(safe-area-inset-right)); bottom: calc(72px + env(safe-area-inset-bottom)); width: min(360px, 43vw); height: min(240px, 48vh); }
  .ci-text { bottom: 0; max-width: 88%; }
  .ci-who { font-size: 10px; letter-spacing: 1px; }
  .ci-name { font-size: clamp(20px, 3vw, 27px); }
  .ci-line { font-size: 10px; margin-top: 4px; }
  .ci-chain { font-size: 18px; }
  .ci-layer.link { width: min(360px, 43vw); }
  .ci-layer.link .ci-name { font-size: clamp(17px, 2.6vw, 24px); }
  .ci-layer.link .ci-who, .ci-layer.link .ci-line { font-size: 9px; }
  .ci-layer.link .ci-text { padding: 3px 6px; }
  /* 투명 컷인과 겹치는 조작 버튼은 항상 위에서 보이고 동작한다. */
  #hud { z-index: 2; }
  .ci-layer { z-index: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .ci-por, .ci-text, .ci-chain, .ci-name, .ci-band i, .ci-lines i, .ci-flash { animation: none; }
  .ci-lines, .ci-flash { display: none; }
  .ci-band i { opacity: .28; }
  .ci-layer.link.duo-art .ci-por.p1, .ci-layer.out { animation: none; }
}

/* ---------- 로딩 / 타이틀 ---------- */
#loading { position: fixed; inset: 0; display: grid; place-items: center; background: #0c0a14; z-index: 50; }
#loading h3 { letter-spacing: 6px; font-weight: 900; margin: 0 0 8px; text-align: center; }
#loading .lb { width: 200px; height: 6px; background: #2a2440; }
#loading .lb b { display: block; height: 100%; width: 0; background: #ffe680; }

#title { position: fixed; inset: 0; z-index: 40; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4vh; background: radial-gradient(ellipse at 50% 35%, #3a2a5a 0%, #150f24 60%, #08060e 100%); cursor: pointer; }
.logo { text-align: center; }
.logo small { letter-spacing: 6px; font-size: 11px; color: #ffe680; }
.logo h1 { margin: 0; font-family: 'Black Han Sans', sans-serif; font-weight: 400; font-size: clamp(40px, 15vh, 110px); background: linear-gradient(#fff, #ffe680 60%, #e8a040); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 4px 0 #402060); line-height: 1.1; }
.logo p { margin: 0; font-size: 14px; opacity: .8; letter-spacing: 4px; }
.tap { font-weight: 900; letter-spacing: 4px; animation: tap 1.2s infinite; }
@keyframes tap { 50% { opacity: .3; } }
.help { font-size: 10px; opacity: .55; text-align: center; line-height: 1.6; }

/* ---------- 메뉴 공통 ---------- */
.menu { position: fixed; inset: 0; z-index: 20; background: radial-gradient(ellipse at 30% 20%, #2e2250 0%, #150f24 55%, #08060e 100%); display: flex; flex-direction: column; padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
.mtop { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: linear-gradient(rgba(0,0,0,.55), transparent); flex: 0 0 auto; z-index: 2; }
.mtop .back { background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.3); border-radius: 8px; width: 38px; height: 30px; font-size: 14px; }
.mtop .mt { flex: 1; font-family: 'Black Han Sans', sans-serif; font-weight: 400; font-size: 20px; letter-spacing: 1px; }
.mtop .cur { background: rgba(0,0,0,.5); border: 1px solid rgba(255,255,255,.2); border-radius: 14px; padding: 3px 12px; font-size: 12px; font-weight: 900; }
.menu button { border-radius: 10px; }
#mtoast { position: fixed; left: 50%; bottom: 16%; transform: translateX(-50%); z-index: 60; background: rgba(0,0,0,.8); padding: 6px 16px; border-radius: 16px; font-weight: 700; font-size: 13px; opacity: 0; pointer-events: none; }
#mtoast.on { animation: toast 1.8s forwards; }

/* 히로인 카드 */
.hc { position: relative; width: 88px; height: 118px; border-radius: 8px; overflow: hidden; border: 2px solid var(--c); background: linear-gradient(180deg, color-mix(in srgb, var(--c) 35%, #111), #0d0b14); cursor: pointer; flex: 0 0 auto; }
.hc img { position: absolute; left: 50%; top: 2%; height: 150%; transform: translateX(-50%); }
.hc b { position: absolute; left: 0; right: 0; bottom: 0; padding: 12px 2px 3px; background: linear-gradient(transparent, rgba(0,0,0,.92)); text-align: center; font-size: 12px; }
.hc .rar { position: absolute; left: 3px; top: 2px; font-size: 10px; font-weight: 900; font-style: italic; text-shadow: 0 1px 2px #000; }
.hc.r-SSR { border-color: #ffd84a; box-shadow: 0 0 8px rgba(255,216,74,.5); } .hc.r-SSR .rar { color: #ffd84a; }
.hc.r-SR .rar { color: #d0a0ff; } .hc.r-R .rar { color: #8ad8ff; }
.hc .lv { position: absolute; right: 3px; top: 2px; font-size: 10px; font-weight: 900; background: rgba(0,0,0,.6); padding: 0 4px; border-radius: 4px; }
.hc .stars { position: absolute; left: 0; right: 0; bottom: 20px; text-align: center; font-size: 9px; color: #ffd84a; text-shadow: 0 1px 2px #000; }
.hc.none img { filter: brightness(0) opacity(.6); }
.hc.none { border-color: #3a3450; box-shadow: none; }
.hc.in { opacity: .45; }
.hc.lead::after { content: '조작'; position: absolute; right: 3px; bottom: 22px; font-size: 9px; font-weight: 900; background: #ffe680; color: #201a10; padding: 0 4px; border-radius: 4px; }
.hc.empty { display: grid; place-items: center; font-size: 28px; color: #5a5070; border: 2px dashed #3a3450; background: rgba(0,0,0,.3); cursor: default; }

.stars i, .sst i { font-style: normal; opacity: .25; }

/* 로비 */
.lobby { position: relative; flex: 1; display: flex; align-items: stretch; overflow: hidden; }
.lob-art { position: absolute; left: 6%; bottom: -8%; height: 118%; filter: drop-shadow(0 0 24px color-mix(in srgb, var(--c) 60%, transparent)); animation: artIn .5s cubic-bezier(.2,.9,.3,1.1); cursor: pointer; }
@keyframes artIn { from { transform: translateX(-20%); opacity: 0; } }
.lob-talk { position: absolute; left: 4%; bottom: 5%; max-width: 44%; background: rgba(0,0,0,.7); border-left: 3px solid var(--c); padding: 6px 12px; font-size: 13px; }
.lob-talk b { color: var(--c); margin-right: 6px; }
.lob-menu { margin-left: auto; width: min(340px, 42vw); display: flex; flex-direction: column; justify-content: center; gap: 8px; padding: 12px 20px; z-index: 1; }
.lob-menu > button, .lob-menu > .row { flex: 0 0 auto; }
.lob-menu > .big { min-height: 22vh; flex: 0 0 auto; }
.lob-menu > .summon { min-height: 14vh; }
.hd h2 .shard { font-size: 11px; font-family: 'Noto Sans KR'; opacity: .7; margin-left: 6px; }
.lob-menu button { background: linear-gradient(135deg, rgba(60,48,96,.92), rgba(24,18,40,.92)); border: 2px solid rgba(255,255,255,.25); padding: 10px 14px; font-weight: 900; font-size: 18px; text-align: left; flex: 1; }
.lob-menu .row button { flex: 1; }
.lob-menu button small { display: block; font-size: 11px; font-weight: 700; opacity: .75; }
.lob-menu .big { font-family: 'Black Han Sans', sans-serif; font-weight: 400; font-size: 34px; background: linear-gradient(135deg, #ffe680, #e8a040); color: #2a1a08; border-color: #fff; box-shadow: 0 0 20px rgba(255,200,64,.45); flex: 1.4; }
.lob-menu .big small { color: #5a3a10; opacity: 1; font-family: 'Noto Sans KR'; }
.lob-menu .summon { background: linear-gradient(135deg, #b060ff, #5020a0); border-color: #e0c0ff; }
.lob-menu .small { font-size: 12px; flex: 0 0 auto; padding: 6px 12px; text-align: center; }

/* 스테이지 */
.stages { flex: 1; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; padding: 8px 14px 14px; overflow-y: auto; align-content: start; }
.st { text-align: left; background: linear-gradient(135deg, rgba(60,48,96,.9), rgba(20,16,32,.9)); border: 2px solid rgba(255,255,255,.2); padding: 8px 12px; display: flex; flex-direction: column; gap: 2px; }
.st em { font-style: normal; font-weight: 900; color: #ffe680; font-size: 12px; }
.st b { font-size: 16px; }
.st .sst { color: #ffd84a; font-size: 14px; letter-spacing: 2px; }
.st small { font-size: 11px; opacity: .7; }
.st.boss { border-color: #ff5040; background: linear-gradient(135deg, rgba(110,20,20,.9), rgba(30,10,16,.9)); }
.st.endless { border-color: #b060ff; background: linear-gradient(135deg, rgba(80,30,130,.9), rgba(20,10,40,.9)); }
.st.endless .sst { font-size: 12px; letter-spacing: 0; color: #e0c0ff; }

/* 출격 준비 / 편성 */
.prep, .form { flex: 1; display: flex; flex-direction: column; gap: 8px; padding: 6px 14px 12px; min-height: 0; }
.pp-party, .slots { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.pp-info { display: flex; flex-direction: column; gap: 6px; align-items: center; }
.pp-info p { margin: 0; font-size: 13px; }
.pp-info .row button, .settings button { padding: 8px 22px; font-weight: 900; font-size: 15px; background: #2a2440; border: 2px solid #fff; }
.pp-info .row .go { font-family: 'Black Han Sans', sans-serif; font-weight: 400; font-size: 22px; background: linear-gradient(#fff6c0, #ffc840); color: #201a10; padding: 6px 40px; }
.syns { display: flex; flex-wrap: wrap; gap: 5px; justify-content: center; }
.syn { border: 1px solid #3a3450; border-radius: 8px; padding: 3px 8px; background: rgba(0,0,0,.35); font-size: 11px; opacity: .6; }
.syn b { display: block; font-size: 12px; color: var(--c); }
.syn b i { font-style: normal; opacity: .8; }
.syn.on { opacity: 1; border-color: var(--c); box-shadow: 0 0 8px color-mix(in srgb, var(--c) 40%, transparent); }
.form-bot { flex: 1; display: flex; gap: 10px; min-height: 0; }
.pool { flex: 1; display: flex; flex-wrap: wrap; gap: 6px; overflow-y: auto; align-content: flex-start; }
.pool .hc, .slots .hc { width: 76px; height: 100px; }
.form-side { width: 36%; display: flex; flex-direction: column; gap: 6px; }
.form-side .syns { justify-content: flex-start; }
.form-side p { margin: 0; font-size: 13px; }

/* 히로인 목록 / 상세 */
.hgrid { flex: 1; display: flex; flex-wrap: wrap; gap: 8px; padding: 8px 14px; overflow-y: auto; align-content: flex-start; justify-content: center; }
.hd { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) 220px minmax(0, 2fr); grid-template-rows: minmax(0, 1fr); gap: 8px; padding: 8px; min-height: 0; position: relative; }
.hd-art { width: 100%; height: 100%; min-width: 0; min-height: 0; margin: 0; object-fit: contain; filter: drop-shadow(0 0 20px color-mix(in srgb, var(--c) 50%, transparent)); cursor: pointer; }
.hd-art.none { filter: brightness(0) opacity(.5); }
.hd-stage { width: 220px; height: 170px; max-width: 100%; align-self: center; background: #101d2b; border: 12px solid #536878; border-radius: 0; }
.hd-info { min-width: 0; overflow-y: auto; overflow-wrap: anywhere; touch-action: pan-y; padding: 4px 16px 12px 8px; }
.hd-head { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.rar { font-weight: 900; font-style: italic; }
.rar.r-SSR { color: #ffd84a; } .rar.r-SR { color: #d0a0ff; } .rar.r-R { color: #8ad8ff; }
.hd h2 { margin: 0; font-family: 'Black Han Sans', sans-serif; font-weight: 400; font-size: 30px; }
.hd h2 .stars { font-size: 16px; color: #ffd84a; font-family: 'Noto Sans KR'; }
.hd .bio { font-size: 12px; opacity: .85; margin: 2px 0 6px; }
.hd table { font-size: 12px; border-collapse: collapse; margin-bottom: 6px; }
.hd th { color: var(--c); text-align: left; padding: 1px 6px 1px 0; }
.hd td { padding: 1px 14px 1px 0; }
.sk, .lk { border-top: 1px solid rgba(255,255,255,.15); padding: 5px 0; font-size: 12px; display: grid; grid-template-columns: 54px 1fr; column-gap: 8px; }
.sk[data-slot] { cursor: pointer; }
.sk em, .lk em { grid-row: span 3; font-style: normal; font-weight: 900; font-size: 10px; color: #201a10; background: var(--c); border-radius: 6px; text-align: center; align-self: start; padding: 2px 0; }
.lk em { background: #ffd84a; }
.sk b, .lk b { font-size: 13px; }
.sk small { opacity: .6; }
.sk > :not(em) { grid-column: 2; min-width: 0; }
.sk em { grid-row: 1 / span 4; }
.sk-passive em { grid-row: 1 / span 2; }
.sk-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 4px 8px; }
.sk-level { color: var(--c); font-size: 11px; white-space: nowrap; }
.sk .nbtn.sk-up { height: auto; min-height: 34px; padding: 3px 7px; font-size: 11px; line-height: 1.4; }
.sk .sk-up small { display: block; font-size: 10px; line-height: 1.5; opacity: 1; }
.sk .sk-effect { color: #ffe2a0; opacity: 1; }
.lvup { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.lvup span { font-weight: 900; }
.lvup button { background: linear-gradient(#fff6c0, #ffc840); color: #201a10; border: 2px solid #fff; font-weight: 900; padding: 6px 16px; }

/* 소환 */
.gacha { flex: 1; display: flex; position: relative; overflow: hidden; background: radial-gradient(ellipse at 30% 60%, color-mix(in srgb, var(--c) 45%, transparent), transparent 60%); }
.g-art { height: 118%; margin: -6% 0 0 4%; filter: drop-shadow(0 0 30px var(--c)); }
.g-info { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 6px; padding: 12px 20px; }
.g-info small { letter-spacing: 6px; color: #ffd84a; font-weight: 900; }
.g-info h2 { margin: 0; font-family: 'Black Han Sans', sans-serif; font-weight: 400; font-size: 32px; }
.g-info p { margin: 0; font-size: 13px; }
.g-info .row { margin-top: 8px; }
.pull { flex: 1; padding: 10px; font-weight: 900; font-size: 17px; background: linear-gradient(135deg, #8a50e0, #40208a); border: 2px solid #e0c0ff; }
.pull.ten { background: linear-gradient(135deg, #ffd84a, #e08a20); color: #2a1a08; border-color: #fff; }
.pull small { display: block; font-size: 12px; }
.g-open { position: absolute; inset: 0; z-index: 10; display: grid; place-items: center; background: #05030a; cursor: pointer; overflow: hidden; }
.g-orb { width: 40px; height: 40px; border-radius: 50%; background: #fff; animation: orb 1.3s ease-in forwards; }
.g-open.r-R .g-orb { box-shadow: 0 0 60px 30px #8ad8ff; }
.g-open.r-SR .g-orb { box-shadow: 0 0 80px 40px #d0a0ff; }
.g-open.r-SSR .g-orb { box-shadow: 0 0 120px 60px #ffd84a; background: #fff6c0; }
@keyframes orb { 0% { transform: scale(.2); } 70% { transform: scale(1.2); } 100% { transform: scale(30); opacity: 1; } }
.g-open.feat { background: radial-gradient(ellipse at 40% 50%, color-mix(in srgb, var(--c) 55%, #000), #05030a 70%); }
.g-open.feat img { position: absolute; left: 8%; bottom: -8%; height: 118%; animation: artIn .5s cubic-bezier(.2,.9,.3,1.1); filter: drop-shadow(0 0 24px var(--c)); }
.g-open.feat.r-SSR::before { content: ''; position: absolute; inset: 0; background: repeating-conic-gradient(from 0deg at 35% 50%, rgba(255,216,74,.18) 0 8deg, transparent 8deg 20deg); animation: spin 12s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.g-name { position: absolute; right: 8%; top: 50%; transform: translateY(-50%); text-align: right; animation: textIn .4s .2s both; }
.g-name .rar { font-size: 26px; display: block; }
.g-name b { display: block; font-family: 'Black Han Sans', sans-serif; font-weight: 400; font-size: clamp(40px, 14vh, 90px); text-shadow: 3px 3px 0 #000, 0 0 20px var(--c); }
.g-name small { font-size: 16px; font-weight: 900; }
.g-name em { display: block; font-style: normal; font-weight: 900; font-size: 22px; color: #ffd84a; animation: tap .6s infinite; }
.g-open.grid { background: radial-gradient(ellipse, #2a1a50, #05030a); cursor: default; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 14px; }
.g-cards { display: grid; grid-template-columns: repeat(5, 84px); gap: 8px; }
.gc { position: relative; height: 104px; border-radius: 8px; overflow: hidden; border: 2px solid #8ad8ff; background: linear-gradient(#2a3a5a, #0d0b14); animation: cardIn .35s both; }
.gc.r-SR { border-color: #d0a0ff; background: linear-gradient(#4a2a6a, #0d0b14); }
.gc.r-SSR { border-color: #ffd84a; background: linear-gradient(#6a5020, #0d0b14); box-shadow: 0 0 14px #ffd84a; }
.gc img { position: absolute; left: 50%; top: 2%; height: 150%; transform: translateX(-50%); }
.gc .rar { position: absolute; left: 3px; top: 1px; font-size: 11px; font-weight: 900; font-style: italic; text-shadow: 0 1px 2px #000; }
.gc b { position: absolute; left: 0; right: 0; bottom: 12px; text-align: center; font-size: 12px; text-shadow: 0 1px 2px #000; }
.gc small { position: absolute; left: 0; right: 0; bottom: 0; text-align: center; font-size: 10px; font-weight: 900; background: rgba(0,0,0,.75); color: #ffd84a; }
@keyframes cardIn { from { transform: rotateY(90deg) scale(.8); opacity: 0; } }
.g-open .ok { padding: 8px 40px; font-weight: 900; font-size: 16px; background: #2a2440; border: 2px solid #fff; }

/* 설정 */
.settings { flex: 1; display: flex; flex-direction: column; gap: 14px; padding: 20px 40px; max-width: 500px; }
.settings label { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-weight: 700; }
.settings input { width: 60%; }
.settings .danger { align-self: flex-start; border-color: #ff5a5a; color: #ff9a9a; font-size: 13px; }

/* 결과 */
.res { flex: 1; display: flex; position: relative; overflow: hidden; background: radial-gradient(ellipse at 25% 60%, color-mix(in srgb, var(--c) 40%, transparent), transparent 60%); }
.res-art { height: 115%; margin: -3% 0 0 2%; animation: artIn .6s cubic-bezier(.2,.9,.3,1.1); filter: drop-shadow(0 0 20px var(--c)); }
.res.lose .res-art { filter: grayscale(.6) brightness(.7); }
.res-box { flex: 1; text-align: center; overflow-y: auto; padding: 10px 16px; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.res-box h1 { margin: 0; font-family: 'Black Han Sans', sans-serif; font-weight: 400; font-size: clamp(34px, 11vh, 70px); letter-spacing: 6px; }
.res.win h1 { color: #ffe680; text-shadow: 0 0 20px #ffa040; }
.res.lose h1 { color: #8a9ab0; }
.res.end h1 { color: #e0c0ff; text-shadow: 0 0 20px #8a40ff; }
.res-stars span { font-size: 34px; color: #3a3450; display: inline-block; }
.res-stars span.on { color: #ffd84a; text-shadow: 0 0 12px #ffa040; animation: starIn .4s both; }
@keyframes starIn { from { transform: scale(3); opacity: 0; } }
.mvpl { margin: 0; font-size: 13px; }
.mvpl small { color: var(--c); font-weight: 900; letter-spacing: 2px; }
.res-box table { border-collapse: collapse; font-size: 12px; }
.res-box th, .res-box td { padding: 1px 10px; }
.res-box td:first-child { display: flex; align-items: center; gap: 4px; text-align: left; }
.res-box td img { width: 20px; height: 20px; image-rendering: pixelated; }
.res-box tr.dead { opacity: .45; }
.res-box p { margin: 2px; }
.rw { display: flex; gap: 10px; font-weight: 900; font-size: 16px; }
.rw span { background: rgba(0,0,0,.5); border: 1px solid rgba(255,255,255,.25); border-radius: 14px; padding: 2px 12px; }
.res-box .row button { padding: 8px 24px; font-weight: 900; font-size: 15px; background: #2a2440; border: 2px solid #fff; }

#pause { position: fixed; inset: 0; z-index: 25; background: radial-gradient(ellipse at center, rgba(20,14,40,.55), rgba(0,0,0,.8)); backdrop-filter: blur(3px); display: grid; place-items: center; animation: fadeIn .15s; }
.pbox { position: relative; display: flex; flex-direction: column; gap: 9px; text-align: center; min-width: 260px; padding: 18px 26px 22px; background: linear-gradient(180deg, rgba(34,28,58,.96), rgba(14,12,26,.96)); border: 1px solid rgba(255,255,255,.18); border-top: 3px solid #ffd76a; border-radius: 14px; box-shadow: 0 16px 40px rgba(0,0,0,.6), inset 0 1px 0 rgba(255,255,255,.08); }
.pbox h2 { margin: 0 0 6px; font-family: 'Black Han Sans', sans-serif; font-weight: 400; font-size: 30px; letter-spacing: 10px; color: #ffe89a; text-shadow: 0 2px 0 #000, 0 0 16px rgba(255,200,64,.4); }
.pbox button { font-size: 15px; font-weight: 900; padding: 10px 40px; border-radius: 10px; border: 1px solid rgba(255,255,255,.25); background: linear-gradient(180deg, #3a3060, #221c3a); box-shadow: 0 3px 0 #0c0a18; transition: transform .08s; }
.pbox button:hover { border-color: #ffd76a; }
.pbox button:active { transform: translateY(2px); box-shadow: 0 1px 0 #0c0a18; }
.pbox #resume { background: linear-gradient(180deg, #fff2b0, #ffc840); color: #2a1a04; border-color: #fff; }
.pbox #quit { color: #ffb0a8; }

#rotate { display: none; position: fixed; inset: 0; z-index: 100; background: #0c0a14; place-items: center; font-size: 18px; font-weight: 700; }
@media (orientation: portrait) and (max-width: 700px) { #rotate { display: grid; } }
@media (max-height: 420px) {
  .pi { width: 40px; height: 50px; } .pi .pf { height: 38px; } .pi img { width: 38px; height: 38px; }
  #skills { transform: scale(.82); transform-origin: right bottom; }
  #cmds { right: 190px; } #cmds button { width: 44px; height: 38px; }
  #leader .lp { width: 44px; height: 44px; } #leader .li { width: 140px; }
  #bossbar { top: 62px; }
  #topL .synl { display: none; }
  .hc { width: 72px; height: 96px; }
  .pool .hc, .slots .hc { width: 64px; height: 84px; }
  .g-cards { grid-template-columns: repeat(5, 70px); } .gc { height: 88px; }
}

/* ---------- v2 메뉴 ---------- */
.mtop .acc { display: flex; align-items: center; gap: 5px; font-size: 12px; }
.mtop .acc i { display: block; width: 70px; height: 5px; background: #000; border-radius: 3px; overflow: hidden; }
.mtop .acc u { display: block; height: 100%; background: #8ad8ff; }
.badge { font-style: normal; background: #ff3a4a; color: #fff; border-radius: 9px; font-size: 10px; padding: 0 6px; margin-left: 5px; vertical-align: top; }
.lob-menu .row.sm button { font-size: 13px; padding: 7px 8px; text-align: center; }
.story { flex: 1; display: flex; flex-direction: column; min-height: 0; background: radial-gradient(ellipse at 80% 0%, color-mix(in srgb, var(--c) 30%, transparent), transparent 60%); }
.ctabs { display: flex; gap: 5px; padding: 4px 14px; }
.ctab { background: rgba(0,0,0,.4); border: 2px solid #3a3450; padding: 5px 14px; font-weight: 900; }
.ctab.on { border-color: var(--c); color: var(--c); box-shadow: 0 0 8px color-mix(in srgb, var(--c) 50%, transparent); }
.diff { margin-left: auto; background: #2a2440; border: 2px solid #8ad8ff; padding: 5px 14px; font-weight: 900; }
.diff.hard { border-color: #ff4040; color: #ff8080; background: #3a1018; }
.chead { padding: 2px 16px 4px; }
.chead b { font-family: 'Black Han Sans', sans-serif; font-weight: 400; font-size: 22px; color: var(--c); margin-right: 10px; }
.chead span { font-size: 12px; opacity: .8; }
.dgs { flex: 1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 8px 14px 14px; }
.dg { border: 2px solid var(--c); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 6px; background: linear-gradient(160deg, color-mix(in srgb, var(--c) 25%, #15121f), #0d0b14); }
.dg b { font-family: 'Black Han Sans', sans-serif; font-weight: 400; font-size: 22px; color: var(--c); }
.dg > span { font-size: 12px; opacity: .85; }
.dg small { font-size: 11px; font-weight: 700; }
.dg em { font-style: normal; opacity: .7; font-size: 12px; margin-top: auto; }
.dg.lock { opacity: .55; }
.tiers { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: auto; }
.tier { background: rgba(0,0,0,.45); border: 2px solid var(--c); padding: 7px 4px; font-weight: 900; font-size: 14px; }
.tier small { display: block; font-size: 10px; font-weight: 700; opacity: .8; }
.tier.go { grid-column: span 2; font-size: 17px; }
.pp-info .ok { color: #6aff8a; } .pp-info .warn { color: #ff8a6a; }
.hc.lockd { flex-direction: column; font-size: 20px; } .hc.lockd small { font-size: 9px; }
.grow { border-top: 1px solid rgba(255,255,255,.15); padding: 6px 0; display: flex; flex-direction: column; gap: 5px; }
.grow .lvl { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.grow .lvl b { font-size: 15px; }
.grow .lvl i { flex: 1; max-width: 160px; height: 6px; background: #000; border-radius: 3px; overflow: hidden; }
.grow .lvl u { display: block; height: 100%; background: linear-gradient(90deg, #6aff8a, #d0ffb0); }
.grow .lvl small { opacity: .7; }
.grow .row button { background: #2a2440; border: 2px solid var(--c); font-weight: 900; font-size: 12px; padding: 5px 10px; }
.grow .row button small { display: block; font-size: 9px; opacity: .7; }
.inv { padding: 4px 16px 8px; font-size: 11px; opacity: .75; }
.missions { flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 4px 14px 12px; min-height: 0; }
.mcol { overflow-y: auto; display: flex; flex-direction: column; gap: 5px; }
.mcol h3 { margin: 2px 0; font-size: 15px; } .mcol h3 small { font-size: 10px; opacity: .6; font-weight: 400; }
.ms { display: grid; grid-template-columns: 1fr 70px 64px; grid-template-rows: auto auto; column-gap: 8px; align-items: center; background: rgba(0,0,0,.35); border: 1px solid #3a3450; border-radius: 8px; padding: 5px 8px; font-size: 12px; }
.ms b { grid-column: 1; } .ms i { grid-column: 1; grid-row: 2; height: 4px; background: #000; border-radius: 2px; overflow: hidden; }
.ms u { display: block; height: 100%; background: #ffd84a; }
.ms span { grid-column: 2; grid-row: span 2; font-size: 11px; opacity: .8; text-align: right; }
.ms button { grid-column: 3; grid-row: span 2; background: #2a2440; border: 2px solid #5a5070; font-weight: 900; font-size: 11px; padding: 4px 0; }
.ms.ready { border-color: #ffd84a; } .ms.ready button { background: linear-gradient(#fff6c0, #ffc840); color: #201a10; border-color: #fff; }
.ms.got { opacity: .5; }
.shop { flex: 1; display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; padding: 6px 14px; align-content: start; }
.si { background: linear-gradient(160deg, #2a2440, #15121f); border: 2px solid #5a5070; border-radius: 10px; padding: 10px; display: flex; flex-direction: column; gap: 3px; }
.si b { font-size: 15px; } .si span { font-size: 11px; opacity: .8; } .si small { font-size: 10px; opacity: .6; }
.si button { margin-top: 6px; background: linear-gradient(#fff6c0, #ffc840); color: #201a10; border: 2px solid #fff; font-weight: 900; padding: 6px; }
.res-box em.up { font-style: normal; color: #6aff8a; font-size: 10px; margin-left: 3px; }
.rw .hl { border-color: #ffd84a; color: #ffe680; }
@media (max-height: 420px) { .dgs { gap: 6px; } .dg { padding: 8px; } .dg b { font-size: 17px; } .missions { grid-template-columns: 1fr 1fr; } }

/* =====================================================================
   v3 스킨: Codex 그래픽 에셋(assets/ui) — 버튼·패널·프레임·배경
   ===================================================================== */
:root { --ink: #0c0a1a; --navy: #141a3a; --gold2: #f5d27a; }
.gbtn, .nbtn { position: relative; border: 0; background: none; color: #2a1804; font-weight: 900; cursor: pointer; padding: 0 30px; height: 44px; min-width: 150px; font-size: 16px; letter-spacing: 1px;
  border-style: solid; border-width: 0 26px; border-image: url(assets/ui/btn_gold.png) 0 100 fill / 0 26px stretch; text-shadow: 0 1px 0 rgba(255,255,255,.5); filter: drop-shadow(0 3px 4px rgba(0,0,0,.5)); transition: transform .08s, filter .15s; }
.nbtn { color: #eef0ff; text-shadow: 0 1px 2px #000; border-image-source: url(assets/ui/btn_navy.png); }
.gbtn:hover, .nbtn:hover { filter: drop-shadow(0 3px 4px rgba(0,0,0,.5)) brightness(1.12); }
.gbtn:active, .nbtn:active { transform: translateY(2px) scale(.98); }
.gbtn:disabled, .nbtn:disabled { filter: grayscale(.8) brightness(.6); cursor: default; }
.gbtn.sm, .nbtn.sm { height: 34px; min-width: 96px; font-size: 13px; padding: 0 12px; border-width: 0 20px; border-image-width: 0 20px; }
.nbtn small, .gbtn small { display: block; font-size: 10px; font-weight: 700; opacity: .8; line-height: 1; }
.skin-panel { border: 26px solid transparent; border-image: url(assets/ui/panel.png) 90 / 26px stretch; background: linear-gradient(180deg, rgba(22,20,48,.94), rgba(10,9,24,.94)); background-clip: padding-box; }

/* ---------- 로그인(타이틀) ---------- */
#title { background: #05040c; overflow: hidden; gap: 0; justify-content: flex-start; }
#title .t-bg { position: absolute; inset: -4%; background: url(assets/ui/title_bg.jpg) center/cover; animation: tbg 30s ease-in-out infinite alternate; }
@keyframes tbg { to { transform: scale(1.08) translate(-1.5%, 1%); } }
#title .t-glow { position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 30%, rgba(255,240,200,.25), transparent 55%), linear-gradient(transparent 55%, rgba(4,4,16,.85)); }
#title .t-motes { position: absolute; inset: 0; background-image: radial-gradient(2px 2px at 20% 30%, #fff8, transparent), radial-gradient(2px 2px at 70% 60%, #ffe6a0aa, transparent), radial-gradient(1.5px 1.5px at 40% 80%, #fff8, transparent), radial-gradient(2px 2px at 85% 20%, #fffa, transparent), radial-gradient(1.5px 1.5px at 10% 70%, #ffe6a0, transparent); background-size: 300px 300px; animation: motes 18s linear infinite; opacity: .8; }
@keyframes motes { to { background-position: 0 -300px, 60px -300px, -40px -300px, 20px -300px, 0 -300px; } }
#title .logo { position: relative; margin-top: 4vh; display: flex; flex-direction: column; align-items: center; animation: logoIn 1.1s cubic-bezier(.2,.9,.3,1.1) both; }
@keyframes logoIn { from { opacity: 0; transform: translateY(-20px) scale(.9); filter: blur(6px); } }
#title .crest { height: min(40vh, 300px); filter: drop-shadow(0 6px 18px rgba(0,0,0,.6)) drop-shadow(0 0 30px rgba(255,220,140,.35)); }
#title .logo h1 { margin-top: -9vh; font-size: clamp(40px, 13vh, 96px); background: linear-gradient(#ffffff 10%, #fff2c0 45%, #f0b848 70%, #b87820); -webkit-background-clip: text; background-clip: text; filter: drop-shadow(0 3px 0 #3a1c5a) drop-shadow(0 0 1px #3a1c5a) drop-shadow(0 6px 10px rgba(0,0,0,.7)); letter-spacing: 4px; }
#title .logo small { margin-top: .5vh; font-weight: 900; letter-spacing: 5px; font-size: 11px; color: #fff6d8; text-shadow: 0 1px 4px #000, 0 0 10px rgba(255,200,100,.7); }
#title .t-login { position: absolute; left: 50%; bottom: 13vh; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 10px; animation: fadeUp .8s .5s both; }
@keyframes fadeUp { from { opacity: 0; transform: translate(-50%, 16px); } }
#title .t-server { display: flex; align-items: center; gap: 8px; padding: 4px 14px; border-radius: 16px; background: rgba(6,8,24,.7); border: 1px solid rgba(255,230,160,.35); font-size: 12px; }
#title .t-server i { width: 8px; height: 8px; border-radius: 50%; background: #5aff8a; box-shadow: 0 0 6px #5aff8a; }
#title .t-server span { opacity: .7; } #title .t-server em { font-style: normal; color: #5aff8a; font-weight: 900; font-size: 11px; }
#title .t-start { height: 54px; min-width: 240px; font-size: 20px; font-family: 'Black Han Sans', sans-serif; font-weight: 400; letter-spacing: 6px; color: #2a1804; border: 0; border-style: solid; border-width: 0 30px; border-image: url(assets/ui/btn_gold.png) 0 100 fill / 0 30px stretch; background: none; filter: drop-shadow(0 4px 8px rgba(0,0,0,.6)) drop-shadow(0 0 14px rgba(255,200,80,.45)); animation: startGlow 1.6s ease-in-out infinite; }
@keyframes startGlow { 50% { filter: drop-shadow(0 4px 8px rgba(0,0,0,.6)) drop-shadow(0 0 26px rgba(255,220,120,.8)); } }
#title .tap { font-size: 12px; letter-spacing: 6px; color: #fff; text-shadow: 0 1px 4px #000; }
#title .t-links { position: absolute; right: 14px; top: 12px; display: flex; gap: 6px; }
#title .t-links button { background: rgba(6,8,24,.6); border: 1px solid rgba(255,255,255,.25); border-radius: 14px; padding: 4px 12px; font-size: 11px; font-weight: 700; }
#title .t-ver { position: absolute; left: 12px; bottom: 8px; font-size: 10px; opacity: .6; }
#title .help { position: absolute; left: 50%; bottom: 4vh; transform: translateX(-50%); width: min(720px, 92vw); padding: 8px 14px; background: rgba(0,0,0,.7); border-radius: 10px; opacity: .9; font-size: 11px; }
#title.out { animation: tout .45s forwards; }
@keyframes tout { to { opacity: 0; filter: brightness(2); } }

/* ---------- 로비·결과 배경 ---------- */
.menu.scr-lobby { background: url(assets/ui/lobby_bg.jpg) center/cover; }
.menu.scr-lobby::before { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(8,6,20,.15), rgba(8,6,20,.25) 45%, rgba(8,6,20,.8)); pointer-events: none; }
.menu.scr-result { background: url(assets/ui/result_bg.jpg) center/cover; }
.menu.scr-result .res-box { background: linear-gradient(90deg, transparent, rgba(8,6,24,.78) 12%); }
.lob-menu button:not(.big):not(.summon) { border: 22px solid transparent; border-image: url(assets/ui/btn_square.png) 70 / 18px stretch; background: rgba(16,20,56,.55); background-clip: padding-box; padding: 2px 6px; }
.lob-menu .row.sm button { border-width: 14px; border-image-width: 14px; padding: 0; }
.mtop { background: linear-gradient(rgba(6,6,18,.85), rgba(6,6,18,.2)); border-bottom: 1px solid rgba(245,210,122,.25); }
.mtop .back { border: 0; background: url(assets/ui/btn_square.png) center/100% 100%; width: 36px; height: 36px; color: #ffe8a0; }
.mtop .cur { background: rgba(6,8,24,.75); border-color: rgba(245,210,122,.45); }

/* ---------- 전투 HUD 스킨 ---------- */
.sb::before { content: ''; position: absolute; inset: -9%; background: url(assets/ui/ring_skill.png) center/100% 100% no-repeat; z-index: 4; pointer-events: none; }
.sb { overflow: visible; border-color: transparent; }
.sb .cd, .sb .ic, .sb .cdn { border-radius: 50%; overflow: hidden; }
.sb.s1 .ic, .sb.s2 .ic { background: radial-gradient(circle at 50% 35%, color-mix(in srgb, var(--c) 55%, #1a1630), #0e0c18 75%); }
.sb.s1, .sb.s2 { background: none; box-shadow: none; }
.sb.ult { border: 0; background: #0e0c18; }
.sb.ult::before { inset: -20% -24% -16%; background-image: url(assets/ui/ring_ult.png); }
.sb.ult.ready::after { border-radius: 50%; }
#mini { border: 0; box-shadow: 0 4px 14px rgba(0,0,0,.5); overflow: visible; background: none; }
#mini canvas { border-radius: 6px; background: rgba(6,8,18,.85); }
#mini::before { content: ''; position: absolute; inset: -7% -5%; background: url(assets/ui/mini_frame.png) center/100% 100% no-repeat; pointer-events: none; z-index: 2; }
#mini::after { z-index: 3; right: 8px; top: 4px; }
#mini .mlab { z-index: 3; left: 4px; bottom: 2px; border-radius: 4px; }
#bossbar .bb { clip-path: none; border: 0; box-shadow: none; background: #1a0406; height: 9px; margin: 6px 14px 0 34px; border-radius: 3px; overflow: hidden; }
#bossbar::after { content: ''; position: absolute; left: -4%; right: -2%; top: 8px; height: 36px; background: url(assets/ui/bar_frame.png) center/100% 100% no-repeat; pointer-events: none; }
#bossbar { padding-bottom: 8px; }
#banner { background: url(assets/ui/ribbon.png) left center/100% 100% no-repeat; padding: 6px 90px 8px 26px; border: 0; }
#banner.enemy { background: url(assets/ui/ribbon.png) left center/100% 100% no-repeat; transform-origin: right; filter: hue-rotate(140deg) saturate(1.4); }
#cmds { border: 0; background: none; box-shadow: none; gap: 3px; }
#cmds button { background: url(assets/ui/btn_square.png) center/100% 100% no-repeat; width: 50px; height: 50px; color: #e8e4ff; padding-top: 4px; }
#cmds button.on { background: url(assets/ui/btn_square.png) center/100% 100% no-repeat; color: #ffe07a; box-shadow: none; filter: drop-shadow(0 0 8px rgba(255,210,90,.9)) brightness(1.2); }
#cmds button[data-m="retreat"].on { background: url(assets/ui/btn_square.png) center/100% 100% no-repeat; color: #9ad8ff; filter: drop-shadow(0 0 8px rgba(120,190,255,.9)); }
#topL { border: 18px solid transparent; border-image: url(assets/ui/panel.png) 90 / 18px stretch; background: linear-gradient(180deg, rgba(22,20,48,.9), rgba(10,9,24,.88)); background-clip: padding-box; padding: 0 2px; border-radius: 0; box-shadow: none; }
#sys button { border: 0; background: url(assets/ui/btn_navy.png) center/100% 100% no-repeat; padding: 0 12px; height: 28px; box-shadow: none; }
#sys button.on { background: url(assets/ui/btn_gold.png) center/100% 100% no-repeat; }
#sys button.sq { background: url(assets/ui/btn_square.png) center/100% 100% no-repeat; width: 30px; height: 30px; }
.pbox { border: 30px solid transparent; border-image: url(assets/ui/panel.png) 90 / 30px stretch; background: linear-gradient(180deg, rgba(34,28,58,.97), rgba(14,12,26,.97)); background-clip: padding-box; border-radius: 0; box-shadow: 0 16px 40px rgba(0,0,0,.6); padding: 6px 18px 12px; }
.pbox button { border: 0; border-style: solid; border-width: 0 26px; border-image: url(assets/ui/btn_navy.png) 0 100 fill / 0 26px stretch; background: none; box-shadow: none; border-radius: 0; height: 44px; }
.pbox #resume { border-image-source: url(assets/ui/btn_gold.png); background: none; }

/* ---------- 파티(최대 12명): 왼쪽 레이드 프레임 ---------- */
#party { left: 8px; top: auto; bottom: 76px; transform: none; display: grid; grid-auto-flow: column; grid-template-rows: repeat(var(--rows, 4), auto); gap: 3px; }
.pi { width: 38px; height: 46px; border-radius: 6px; }
.pi .pf { height: 34px; }
.pi img { width: 34px; height: 34px; }
.pi .m { width: 13px; height: 13px; font-size: 8px; left: 1px; top: 1px; }
.pi kbd { font-size: 8px; }
.pi .bar { bottom: 6px; height: 4px; left: 2px; right: 2px; }
.pi .ug { height: 3px; left: 2px; right: 2px; }
.pi.ctrl { transform: scale(1.06); }
.pi .uq { position: absolute; inset: 0; display: none; place-items: center; font-family: 'Black Han Sans', sans-serif; font-size: 11px; color: #fff6c0; text-shadow: 0 0 4px #ff9a20, 1px 1px 0 #000; background: radial-gradient(circle, rgba(255,210,90,.45), transparent 70%); z-index: 3; animation: rdy .8s infinite; }
.pi.ready .uq { display: grid; }
.pi .cls { position: absolute; right: 1px; top: 12px; width: 12px; height: 12px; font-size: 9px; color: var(--cc); filter: drop-shadow(0 0 1px #000) drop-shadow(0 0 1px #000); }
body.touch #party { bottom: 70px; }
#leader { bottom: 8px; }

/* 스킬 알림 목록(여러 명이 동시에 스킬을 쓸 때) */
#feed { position: absolute; left: 50%; top: 104px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 3px; pointer-events: none; }
#feed .fd { display: flex; align-items: center; gap: 5px; padding: 2px 34px 3px 8px; min-width: 160px; background: url(assets/ui/ribbon.png) center/100% 100% no-repeat; font-size: 11px; font-weight: 900; text-shadow: 0 1px 2px #000; animation: fdIn .25s cubic-bezier(.2,.9,.3,1.2) both, fdOut .4s 2s forwards; }
#feed .fd img { width: 20px; height: 20px; image-rendering: pixelated; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 1px #000; }
#feed .fd .ico { font-size: 12px; color: var(--c); }
#feed .fd small { color: var(--c); font-size: 9px; margin-right: 2px; }
#feed .fd.ult { font-size: 12px; filter: drop-shadow(0 0 6px rgba(255,210,90,.6)); }
@keyframes fdIn { from { opacity: 0; transform: translateY(-8px) scaleX(.6); } }
@keyframes fdOut { to { opacity: 0; transform: translateY(-4px); } }

/* ---------- 월드맵 ---------- */
.menu.scr-world { background: #0a1a24; }
.wm { position: relative; flex: 1; overflow: hidden; touch-action: none; cursor: grab; }
.wm-map { position: absolute; left: 0; top: 0; transform-origin: 0 0; will-change: transform; }
.wm-map.glide { transition: transform .5s cubic-bezier(.2,.8,.3,1); }
.wm-img { position: absolute; inset: 0; width: 100%; height: 100%; user-select: none; -webkit-user-drag: none; pointer-events: none; }
.wm-img.none { background: radial-gradient(ellipse, #3a6a3a, #1a2a3a); }
.wm-roads { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.wm-roads path { fill: none; stroke: #fff3c8; stroke-width: 6; stroke-dasharray: 2 14; stroke-linecap: round; filter: drop-shadow(0 0 3px rgba(0,0,0,.9)); opacity: .95; }
.fog { position: absolute; top: 0; bottom: 0; backdrop-filter: blur(6px) grayscale(.7) brightness(.55); -webkit-backdrop-filter: blur(6px) grayscale(.7) brightness(.55); background: linear-gradient(90deg, rgba(20,24,40,.2), rgba(20,24,40,.55) 8%, rgba(20,24,40,.55)); mask-image: linear-gradient(90deg, transparent, #000 6%); -webkit-mask-image: linear-gradient(90deg, transparent, #000 6%); display: grid; place-items: center; pointer-events: none; }
.fog span { font-family: 'Black Han Sans', sans-serif; font-size: 22px; color: rgba(255,255,255,.55); letter-spacing: 3px; text-shadow: 0 2px 6px #000; }
.fog span::before { content: '??? · '; }
.wn { position: absolute; transform: translate(-50%, -78%); border: 0; background: none; padding: 0; display: flex; flex-direction: column; align-items: center; cursor: pointer; z-index: 2; }
.wn .ni { width: 46px; height: 46px; background: center/contain no-repeat; filter: drop-shadow(0 3px 3px rgba(0,0,0,.7)); transition: transform .15s; }
.wn .ni.i0 { background-image: url(assets/ui/icon_town.png); width: 64px; height: 56px; }
.wn .ni.i1 { background-image: url(assets/ui/icon_battle.png); width: 38px; height: 38px; }
.wn .ni.i2 { background-image: url(assets/ui/icon_dungeon.png); width: 56px; height: 50px; }
.wn .ni.i3 { background-image: url(assets/ui/icon_boss.png); width: 54px; height: 58px; }
.wn .ni.i4 { background-image: url(assets/ui/icon_tower.png); width: 44px; height: 64px; }
.wn b { margin-top: -4px; font-size: 10px; font-weight: 900; white-space: nowrap; padding: 1px 7px; border-radius: 8px; background: rgba(8,8,24,.82); border: 1px solid rgba(245,210,122,.5); color: #fff; text-shadow: 0 1px 2px #000; }
.wn.t-boss b { border-color: #ff5a4a; color: #ffb0a0; }
.wn.t-town b, .wn.t-dungeon b, .wn.t-tower b { font-size: 11px; color: #ffe8a0; }
.wn .ns { font-size: 9px; letter-spacing: -1px; text-shadow: 0 1px 2px #000; }
.wn .ns i { font-style: normal; color: rgba(255,255,255,.3); } .wn .ns i.on { color: #ffd84a; }
.wn em { position: absolute; top: -6px; right: -4px; width: 18px; height: 18px; border-radius: 50%; background: #ff3a3a; color: #fff; font-style: normal; font-weight: 900; font-size: 12px; display: grid; place-items: center; box-shadow: 0 0 0 2px #fff, 0 0 10px #ff3a3a; animation: bob .9s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-4px); } }
.wn.clr .ni.i1 { filter: drop-shadow(0 3px 3px rgba(0,0,0,.7)) saturate(.5) brightness(.85); }
.wn.next .ni { animation: nodePulse 1.2s ease-in-out infinite; }
@keyframes nodePulse { 50% { transform: scale(1.12); filter: drop-shadow(0 0 10px rgba(255,220,120,.9)); } }
.wn.sel .ni { transform: scale(1.2); filter: drop-shadow(0 0 12px #fff); }
.wn.fresh { animation: fresh .9s cubic-bezier(.2,.9,.3,1.4) both; }
@keyframes fresh { from { transform: translate(-50%, -78%) scale(0); } }
.wm-me { position: absolute; width: 48px; height: 48px; transform: translate(-50%, -96%); z-index: 3; pointer-events: none; }
.wm-me canvas { width: 48px; height: 48px; image-rendering: pixelated; filter: drop-shadow(0 0 1px #000) drop-shadow(0 2px 2px rgba(0,0,0,.6)); }
.wm-me i { position: absolute; left: 50%; bottom: -3px; width: 30px; height: 10px; transform: translateX(-50%); border-radius: 50%; border: 2px solid #ffe680; box-shadow: 0 0 8px #ffe680; animation: ring 1s ease-in-out infinite; }
@keyframes ring { 50% { transform: translateX(-50%) scale(1.25); opacity: .6; } }
.wm-side { position: absolute; left: 10px; top: 8px; display: flex; gap: 8px; align-items: center; z-index: 4; }
.wm-region { padding: 4px 14px; background: rgba(6,8,24,.8); border: 1px solid rgba(245,210,122,.45); border-radius: 8px; }
.wm-region small { display: block; font-size: 9px; opacity: .7; }
.wm-region b { font-family: 'Black Han Sans', sans-serif; font-weight: 400; font-size: 16px; color: var(--c); }
.wm-side .diff { margin: 0; }
.wm-nav { position: absolute; left: 10px; bottom: 10px; display: flex; gap: 6px; z-index: 4; }
.wm-nav button { width: 58px; height: 58px; border: 0; background: url(assets/ui/btn_square.png) center/100% 100% no-repeat; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 10px; font-weight: 900; color: #ffe8a0; filter: drop-shadow(0 3px 4px rgba(0,0,0,.6)); }
.wm-nav .ico { font-size: 18px; }
.wm-panel { position: absolute; right: 10px; top: 50%; width: min(300px, 40vw); max-height: 92%; overflow-y: auto; transform: translate(120%, -50%); transition: transform .3s cubic-bezier(.2,.9,.3,1); z-index: 5;
  border: 26px solid transparent; border-image: url(assets/ui/panel.png) 90 / 26px stretch; background: linear-gradient(180deg, rgba(22,20,48,.96), rgba(10,9,24,.96)); background-clip: padding-box; display: flex; flex-direction: column; gap: 8px; align-items: stretch; padding: 0 2px; }
.wm-panel.on { transform: translate(0, -50%); }
.wm-panel .x { position: absolute; right: -14px; top: -14px; width: 26px; height: 26px; border: 0; border-radius: 50%; background: #2a2444; display: grid; place-items: center; font-size: 14px; box-shadow: 0 0 0 1px rgba(245,210,122,.6); }
.np-h em { display: inline-block; font-style: normal; font-weight: 900; font-size: 10px; padding: 1px 8px; border-radius: 6px; background: linear-gradient(#ffe89a, #e8b040); color: #2a1804; }
.np-h em.tg-boss { background: linear-gradient(#ff8a7a, #c02020); color: #fff; }
.np-h em.tg-town { background: linear-gradient(#b0f0b0, #3a9a4a); color: #0a2a0a; }
.np-h em.tg-dungeon, .np-h em.tg-tower { background: linear-gradient(#e0c0ff, #7a40c0); color: #fff; }
.np-h b { display: block; font-family: 'Black Han Sans', sans-serif; font-weight: 400; font-size: 21px; margin-top: 2px; }
.np-h small { font-size: 11px; opacity: .7; }
.np-b { font-size: 12px; display: flex; flex-direction: column; gap: 5px; }
.np-b p { margin: 0; line-height: 1.45; }
.np-row { display: grid; grid-template-columns: auto 1fr auto 1fr; gap: 2px 8px; align-items: baseline; }
.np-row span { opacity: .65; font-size: 11px; } .np-row b { font-size: 14px; }
.np-stars { list-style: none; margin: 2px 0; padding: 0; display: flex; flex-direction: column; gap: 1px; font-size: 11px; }
.np-stars li { opacity: .5; } .np-stars li.on { opacity: 1; color: #ffd84a; }
.np-rw { color: #ffe8a0; font-size: 11px; }
.np-tiers { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 2px; }
.np-tiers .nbtn { min-width: 0; height: 40px; font-size: 13px; padding: 0 4px; border-width: 0 18px; border-image-width: 0 18px; }
.wm-panel .gbtn { align-self: center; }
.ok { color: #7aff9a; } .warn { color: #ff9a7a; }
.discover { position: absolute; left: 50%; top: 40%; transform: translate(-50%, -50%); z-index: 20; text-align: center; pointer-events: none; padding: 14px 80px; animation: disc 2.6s forwards; }
.discover i { position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(10,6,30,.85) 20%, rgba(10,6,30,.85) 80%, transparent); border-top: 2px solid #ffd76a; border-bottom: 2px solid #ffd76a; z-index: -1; }
.discover b { display: block; font-family: 'Black Han Sans', sans-serif; font-weight: 400; font-size: 34px; font-style: italic; letter-spacing: 4px; color: #ffe89a; text-shadow: 0 0 16px #ff9a20, 2px 2px 0 #000; }
.discover span { font-weight: 900; font-size: 15px; text-shadow: 0 1px 3px #000; }
.discover.t-dungeon b, .discover.t-tower b { color: #e0b8ff; text-shadow: 0 0 16px #a040ff, 2px 2px 0 #000; }
@keyframes disc { 0% { opacity: 0; transform: translate(-50%, -50%) scale(1.6); } 12% { opacity: 1; transform: translate(-50%, -50%) scale(1); } 80% { opacity: 1; } 100% { opacity: 0; } }

/* ---------- 마을 ---------- */
.tw { position: relative; flex: 1; overflow: hidden; }
.tw-bg { position: absolute; inset: 0; background: var(--bg) center/cover, #1a2030; animation: tbg 40s ease-in-out infinite alternate; }
.tw::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(6,6,16,.05) 30%, rgba(6,6,16,.75) 62%); pointer-events: none; }
.tw-npc { position: absolute; left: 2%; bottom: -2%; height: 96%; z-index: 1; filter: drop-shadow(0 0 20px rgba(0,0,0,.6)); animation: artIn .45s cubic-bezier(.2,.9,.3,1.1); }
.tw-talk { position: absolute; left: 2%; bottom: 3%; width: min(46%, 440px); z-index: 2; border: 20px solid transparent; border-image: url(assets/ui/panel.png) 90 / 20px stretch; background: linear-gradient(180deg, rgba(22,20,48,.94), rgba(10,9,24,.94)); background-clip: padding-box; padding: 0 4px; min-height: 60px; }
.tw-talk b { display: inline-block; margin-top: -30px; padding: 2px 12px; border-radius: 8px; background: linear-gradient(#ffe89a, #e8b040); color: #2a1804; font-size: 12px; }
.tw-talk p { margin: 4px 0 0; font-size: 13px; line-height: 1.5; min-height: 2.9em; }
.tw-facs { position: absolute; right: 12px; top: 8px; z-index: 3; display: flex; gap: 5px; }
.tf { width: 64px; height: 64px; border: 0; background: url(assets/ui/btn_square.png) center/100% 100% no-repeat; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 10px; color: #ffe8a0; filter: drop-shadow(0 3px 4px rgba(0,0,0,.6)); padding-top: 3px; }
.tf .ico { font-size: 18px; }
.tf b { font-size: 12px; } .tf small { font-size: 8px; opacity: .75; }
.tf.on { filter: drop-shadow(0 0 10px rgba(255,210,90,.9)) brightness(1.2); }
.tw-body { position: absolute; right: 12px; top: 80px; bottom: 10px; width: min(360px, 44vw); z-index: 3; overflow-y: auto; border: 22px solid transparent; border-image: url(assets/ui/panel.png) 90 / 22px stretch; background: linear-gradient(180deg, rgba(22,20,48,.94), rgba(10,9,24,.94)); background-clip: padding-box; padding: 0 4px; display: flex; flex-direction: column; gap: 6px; }
.tw-body h4 { margin: 0 0 2px; display: flex; align-items: center; gap: 6px; font-size: 15px; color: #ffe8a0; }
.tw-body h4 small { font-size: 10px; color: #cfc8e8; font-weight: 400; }
.tq { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 8px; border-radius: 8px; background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.08); }
.tq b { display: block; font-size: 13px; } .tq small { font-size: 10px; opacity: .75; }
.tq.ready { border-color: #ffd76a; box-shadow: inset 0 0 12px rgba(255,210,90,.2); }
.tq.got { opacity: .5; }
.tq .th { display: grid; grid-template-columns: 26px 1fr; column-gap: 6px; align-items: center; }
.tq .th img { grid-row: span 2; width: 26px; height: 26px; image-rendering: pixelated; }
.tq.smith-skills { display: grid; gap: 6px; }
.smith-skill-buttons { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
.smith-skill-buttons .nbtn { min-width: 0; height: auto; min-height: 64px; padding: 5px 3px; white-space: normal; overflow-wrap: anywhere; line-height: 1.4; }
.smith-skill-buttons span { display: block; font-size: 10px; }
.smith-skill-buttons b { margin: 3px 0; font-size: 11px; }
.tarmy { display: flex; align-items: center; gap: 4px; }
.tarmy i { width: 18px; height: 22px; background: rgba(255,255,255,.1); clip-path: polygon(50% 0, 100% 25%, 100% 70%, 50% 100%, 0 70%, 0 25%); }
.tarmy i.on { background: linear-gradient(#9ad8ff, #3a7ae0); }
.tarmy b { margin-left: 6px; font-size: 16px; }
.tw-body p { margin: 0; font-size: 11px; }
.tw-join { display: flex; gap: 8px; align-items: center; }
.tw-join img { height: 150px; filter: drop-shadow(0 0 12px var(--c)); }
.tw-join small { color: var(--c); font-weight: 900; letter-spacing: 2px; }
.tw-join b { display: block; font-family: 'Black Han Sans', sans-serif; font-weight: 400; font-size: 20px; }
.tw-join p { font-size: 12px; margin: 4px 0 8px; }
@media (max-height: 420px) {
  .tw-body { top: 74px; } .tf { width: 56px; height: 56px; }
  .wn .ni.i0 { width: 52px; height: 46px; } .wn .ni.i3 { width: 44px; height: 48px; }
  #title .crest { height: 34vh; }
}

/* ---------- 직업 표시 · 편성 필터 ---------- */
.hc .hcl { position: absolute; left: 0; right: 0; bottom: 17px; display: flex; align-items: center; justify-content: center; gap: 2px; font-size: 8px; font-weight: 900; color: var(--cc); text-shadow: 0 1px 2px #000, 0 0 2px #000; z-index: 2; }
.hc .hcl .ico { font-size: 9px; }
.hc .hcl i { font-style: normal; color: #fff; opacity: .8; margin-left: 2px; }
.hc .stars { bottom: 27px; }
.hc { border-style: solid; }
.clsbar { display: flex; flex-wrap: wrap; gap: 4px; }
.clsbar button { display: flex; align-items: center; gap: 3px; padding: 3px 9px; font-size: 11px; font-weight: 900; border-radius: 12px; background: rgba(6,8,24,.7); border: 1px solid rgba(255,255,255,.18); color: var(--cc); }
.clsbar button .ico { font-size: 12px; }
.clsbar button.on { background: color-mix(in srgb, var(--cc) 30%, #0c0a1a); border-color: var(--cc); box-shadow: 0 0 8px color-mix(in srgb, var(--cc) 50%, transparent); }
.clssum { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; padding: 6px 8px; border-radius: 8px; background: rgba(6,8,24,.6); border: 1px solid rgba(245,210,122,.3); }
.clssum > b { color: #ffe8a0; font-size: 12px; }
.clssum span { display: flex; align-items: center; gap: 2px; font-size: 12px; font-weight: 900; color: var(--cc); opacity: .35; }
.clssum span.on { opacity: 1; }
.clssum p { width: 100%; margin: 2px 0 0; }
.slots { gap: 4px; }
.slots .hc { width: 60px; height: 80px; }
.slots .hc .hcl { font-size: 7px; }
.slots .hc b { font-size: 10px; }
.hd-cls { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin: 4px 0; padding: 4px 10px; border-left: 3px solid var(--cc); background: linear-gradient(90deg, color-mix(in srgb, var(--cc) 22%, transparent), transparent); font-size: 12px; }
.hd-cls .ico { color: var(--cc); font-size: 15px; } .hd-cls b { color: var(--cc); }
.hd-cls em { font-style: normal; font-size: 10px; padding: 1px 6px; border-radius: 6px; background: #3a2a60; color: #d8c0ff; }
.menu.scr-formation { background: radial-gradient(ellipse at 30% 20%, #2e2250 0%, #150f24 55%, #08060e 100%); }
.lob-menu .big { border: 16px solid transparent; border-image: url(assets/ui/panel.png) 90 / 16px stretch; background: linear-gradient(135deg, #fff2b0, #f0b848 60%, #c07a20); background-clip: padding-box; box-shadow: 0 0 24px rgba(255,200,64,.45); }
.lob-menu .summon { border: 16px solid transparent; border-image: url(assets/ui/panel.png) 90 / 16px stretch; background: linear-gradient(135deg, #c080ff, #5020a0); background-clip: padding-box; }
.wm-panel { overflow-x: hidden; }

/* =====================================================================
   프레임 정밀 맞춤 — 값은 에셋을 픽셀로 잰 것 (tools/process_ui.py 로 다시 만들면 다시 잴 것)
   panel 512x507: 금테 10~19px, 모서리 장식 ~104px → 안쪽을 채운 panel_fill.png 한 장으로 쓴다
   btn_gold 768x232: 끝 장식 100px(높이의 0.43) / btn_navy 768x198: 86px(0.43)
   ring_skill 384x381: 구멍 (50,48)-(334,332) / ring_ult 508x512: 구멍 (86,99)-(422,425)
   mini_frame 640x399: 창 (21,46)-(610,378) / bar_frame 1024x141: 홈 (131,55)-(891,101)
   ===================================================================== */
.skin-panel, #topL, .pbox, .tw-talk, .tw-body, .wm-panel {
  border-image: url(assets/ui/panel_fill.png) 104 fill / var(--pb, 22px) stretch; border-width: var(--pb, 22px); background: none !important; }
#topL { --pb: 18px; }
.pbox { --pb: 28px; }
.tw-talk { --pb: 20px; }
.wm-panel { --pb: 24px; }

/* 버튼: 끝 장식 폭 = 높이 × 0.43 (높이마다 비율 유지) */
.gbtn, .nbtn, .pbox button, #title .t-start {
  --h: 44px; height: var(--h); border-style: solid; border-width: 0 calc(var(--h) * .43);
  border-image: url(assets/ui/btn_gold.png) 0 100 fill / 0 calc(var(--h) * .43) stretch; background: none; }
.nbtn, .pbox button { border-image: url(assets/ui/btn_navy.png) 0 86 fill / 0 calc(var(--h) * .43) stretch; }
.pbox #resume { border-image: url(assets/ui/btn_gold.png) 0 100 fill / 0 calc(var(--h) * .43) stretch; }
.gbtn.sm, .nbtn.sm { --h: 34px; border-image-width: 0 calc(var(--h) * .43); border-width: 0 calc(var(--h) * .43); }
.np-tiers .nbtn { --h: 40px; border-width: 0 calc(var(--h) * .43); border-image-width: 0 calc(var(--h) * .43); }
#title .t-start { --h: 54px; }
#sys button:not(.sq) { --h: 28px; height: var(--h); border-style: solid; border-width: 0 calc(var(--h) * .43); padding: 0 3px;
  border-image: url(assets/ui/btn_navy.png) 0 86 fill / 0 calc(var(--h) * .43) stretch; background: none; }
#sys button.on:not(.sq) { border-image: url(assets/ui/btn_gold.png) 0 100 fill / 0 calc(var(--h) * .43) stretch; background: none; }

/* 스킬 링: 버튼 원 = 링의 구멍 */
.sb { border: 0 !important; }
.sb::before { inset: -16.9% -17.6% -17.25% -17.6%; }
.sb .ic, .sb .cd, .sb .cdn, .sb.ult .uimg, .sb.ult .g { inset: 0; border-radius: 50%; }
.sb.ult::before { inset: -30.4% -25.6% -26.7% -25.6%; }
#skills { width: 250px; height: 210px; right: 12px; bottom: 8px; }
.sb.ult { right: 30px; bottom: 30px; width: 92px; height: 92px; }
.sb.s1 { right: 160px; bottom: 26px; width: 62px; height: 62px; }
.sb.s2 { right: 118px; bottom: 132px; width: 62px; height: 62px; }
.sb.ult .nm { bottom: 8px; }
#cmds { right: 262px; }

/* 미니맵: 상자 = 프레임의 창 */
#mini { --mw: min(176px, 22vw); width: var(--mw); aspect-ratio: 589 / 332; top: calc(8px + var(--mw) * .078); right: calc(8px + var(--mw) * .051); }
#mini::before { inset: -13.86% -5.09% -6.33% -3.57%; }
#mini canvas { border-radius: 2px; }
#sys { top: calc(18px + min(176px, 22vw) * .642); }
#chain { top: calc(52px + min(176px, 22vw) * .642); }

/* 보스 체력: 막대 = 프레임의 홈 */
#bossbar { width: min(330px, 40vw); top: 74px; padding: 0; }
#bossbar::after { content: none; }
#bossbar .bbw { position: relative; margin-top: 14px; }
#bossbar .bb { margin: 0; height: auto; aspect-ratio: 760 / 46; border-radius: 1px; box-shadow: inset 0 0 0 1px #000; }
#bossbar .bbw::after { content: ''; position: absolute; top: -119.6%; bottom: -87%; left: -17.24%; right: -17.5%; background: url(assets/ui/bar_frame.png) center/100% 100% no-repeat; pointer-events: none; }
#bossbar .bn { margin-left: 8%; }
@media (max-height: 420px) {
  #skills { transform: scale(.8); transform-origin: right bottom; }
  #cmds { right: 214px; }
}

/* =====================================================================
   로비 v3 (lobby.js)
   ===================================================================== */
.menu.scr-lobby { background: #070612; padding: 0; }
.menu.scr-lobby::before { content: none; }
.lb { position: relative; flex: 1; overflow: hidden; --px: 0; --py: 0; padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
.lb-bg { position: absolute; inset: -5%; background: url(assets/ui/lobby_bg.jpg) center/cover; transform: translate(calc(var(--px) * -18px), calc(var(--py) * -10px)) scale(1.04); transition: transform .6s ease-out; filter: saturate(1.05); }
.lb-motes { position: absolute; inset: 0; background-image: radial-gradient(2px 2px at 20% 30%, #fff9, transparent), radial-gradient(2px 2px at 70% 60%, #ffe6a0aa, transparent), radial-gradient(1.5px 1.5px at 40% 80%, #fffa, transparent), radial-gradient(2px 2px at 85% 20%, #fffc, transparent), radial-gradient(1.5px 1.5px at 10% 70%, #ffe6a0, transparent); background-size: 340px 300px; animation: motes 22s linear infinite; opacity: .7; pointer-events: none; }
.lb-shade { position: absolute; inset: 0; pointer-events: none; background:
  linear-gradient(90deg, rgba(6,5,16,.72) 0%, rgba(6,5,16,.15) 24%, transparent 40%, transparent 58%, rgba(6,5,16,.55) 78%, rgba(6,5,16,.8) 100%),
  linear-gradient(rgba(6,5,16,.55), transparent 16%, transparent 76%, rgba(6,5,16,.85)); }

/* 캐릭터 */
.lb-char { position: absolute; left: 50%; bottom: -14%; height: 118%; transform: translateX(-56%) translate(calc(var(--px) * 10px), 0); cursor: pointer; z-index: 1; transition: transform .6s ease-out; }
.lb-char::before { content: ''; position: absolute; left: 10%; right: 10%; bottom: 8%; height: 40%; background: radial-gradient(ellipse at 50% 100%, color-mix(in srgb, var(--c) 45%, transparent), transparent 70%); filter: blur(6px); z-index: -1; }
.lb-art { height: 100%; display: block; filter: drop-shadow(0 0 20px rgba(0,0,0,.45)) drop-shadow(-3px 0 0 rgba(255,255,255,.55)); transform-origin: 50% 100%; animation: breathe 4.2s ease-in-out infinite, artIn .6s cubic-bezier(.2,.9,.3,1.1) both; user-select: none; -webkit-user-drag: none; }
@keyframes breathe { 50% { transform: scaleY(1.008) translateY(-.6%); } }
.lb-char.poke .lb-art { animation: poke .45s cubic-bezier(.3,1.6,.5,1), breathe 4.2s 0.45s ease-in-out infinite; }
@keyframes poke { 30% { transform: scale(1.02, .985) translateY(1%); } 60% { transform: scale(.992, 1.012) translateY(-1.5%); } }
.lb-tap { position: absolute; width: 10px; height: 10px; margin: -5px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 10px #fff, 0 0 20px var(--c); animation: tapfx .6s ease-out forwards; pointer-events: none; }
@keyframes tapfx { to { transform: scale(6); opacity: 0; } }
.lb-bubble { position: absolute; left: 50%; top: 20%; transform: translate(4%, 8px); z-index: 3; max-width: min(300px, 32vw); padding: 8px 14px 9px; border-radius: 14px; background: linear-gradient(#fffdf6, #f3ead6); color: #2a2030; box-shadow: 0 0 0 2px #c8a050, 0 0 0 4px #3a2a1a, 0 8px 18px rgba(0,0,0,.45); opacity: 0; pointer-events: none; transition: opacity .2s, transform .25s cubic-bezier(.2,1.4,.4,1); }
.lb-bubble::after { content: ''; position: absolute; left: 16px; bottom: -9px; border: 8px solid transparent; border-top-color: #f3ead6; border-bottom: 0; filter: drop-shadow(0 2px 0 #c8a050); }
.lb-bubble.on { opacity: 1; transform: translate(4%, 0); }
.lb-bubble b { display: block; font-size: 11px; color: color-mix(in srgb, var(--c) 70%, #000); }
.lb-bubble p { margin: 1px 0 0; font-size: 13px; font-weight: 700; line-height: 1.45; min-height: 1.4em; }

/* 위: 프로필 · 재화 */
.lb-top { position: absolute; left: 0; right: 0; top: 0; z-index: 4; display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; animation: slideDown .5s .05s both; }
@keyframes slideDown { from { opacity: 0; transform: translateY(-14px); } }
.lb-prof { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.lb-av { position: relative; width: 46px; height: 46px; }
.lb-av img { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 50%; image-rendering: pixelated; background: radial-gradient(circle, color-mix(in srgb, var(--c) 50%, #15121f), #0c0a14); }
.lb-av::after { content: ''; position: absolute; inset: -16.9% -17.6% -17.25% -17.6%; background: url(assets/ui/ring_skill.png) center/100% 100% no-repeat; }
.lb-pi { display: flex; flex-direction: column; gap: 2px; padding: 3px 12px 4px 18px; margin-left: 2px; background: linear-gradient(90deg, rgba(6,8,24,.85), rgba(6,8,24,.4)); border-radius: 0 12px 12px 0; }
.lb-pi b { font-size: 13px; text-shadow: 0 1px 2px #000; } .lb-pi b em { font-style: normal; color: #ffe07a; margin-left: 3px; }
.lb-pi i { display: block; width: 110px; height: 4px; background: #000; border-radius: 2px; overflow: hidden; box-shadow: 0 0 0 1px rgba(255,255,255,.12); }
.lb-pi u { display: block; height: 100%; background: linear-gradient(90deg, #5ac8ff, #c8f0ff); }
.lb-pi small { font-size: 10px; color: #ffe8a0; font-weight: 700; }
.lb-cur { display: flex; align-items: center; gap: 8px; }
.pill { display: flex; align-items: center; gap: 5px; height: 28px; padding: 0 3px 0 4px; border-radius: 14px; background: linear-gradient(rgba(6,8,24,.88), rgba(14,16,40,.88)); box-shadow: 0 0 0 1px rgba(245,210,122,.55), inset 0 1px 0 rgba(255,255,255,.08); }
.pill .cur-ic { width: 22px; height: 22px; margin-left: -8px; filter: drop-shadow(0 1px 2px #000); }
.pill b { min-width: 58px; font-size: 13px; font-variant-numeric: tabular-nums; text-align: right; }
.pill button { width: 21px; height: 21px; border-radius: 50%; border: 0; padding: 0; font-weight: 900; font-size: 15px; line-height: 21px; color: #2a1804; background: radial-gradient(circle at 40% 30%, #fff6c0, #e8b040); box-shadow: 0 0 0 1px #6a4a10; }
.sqb { width: 32px; height: 32px; border: 0; padding: 0; display: grid; place-items: center; font-size: 15px; color: #ffe8a0; background: url(assets/ui/btn_square.png) center/100% 100% no-repeat; filter: drop-shadow(0 2px 3px rgba(0,0,0,.6)); }
.sqb[data-go="settings"] { background: url(assets/ui/nav_settings.png) center/contain no-repeat; filter: drop-shadow(0 2px 3px rgba(0,0,0,.7)); }
.sqb[data-go="settings"] .ico { display: none; }

/* 왼쪽: 배너 · 미션 */
.lb-left { position: absolute; left: 12px; top: 66px; z-index: 3; width: min(250px, 30vw); display: flex; flex-direction: column; gap: 8px; animation: slideRight .55s .15s both; }
@keyframes slideRight { from { opacity: 0; transform: translateX(-20px); } }
.lb-ban { position: relative; aspect-ratio: 25 / 11.5; border-style: solid; border-width: 14px; border-image: url(assets/ui/panel_fill.png) 104 fill / 14px stretch; }
.bn { position: absolute; inset: 0; border: 0; padding: 0; overflow: hidden; border-radius: 3px; opacity: 0; transform: translateX(10px); transition: opacity .45s, transform .45s; pointer-events: none; text-align: left; background: #111; }
.bn.on { opacity: 1; transform: none; pointer-events: auto; }
.bn-t { position: absolute; left: 0; right: 0; bottom: 0; padding: 14px 8px 5px; background: linear-gradient(transparent, rgba(0,0,0,.85)); }
.bn-t em { display: inline-block; font-style: normal; font-size: 9px; font-weight: 900; letter-spacing: 1px; padding: 0 6px; border-radius: 4px; background: linear-gradient(#ffe89a, #e8b040); color: #2a1804; }
.bn-t b { display: block; font-family: 'Black Han Sans', sans-serif; font-weight: 400; font-size: 17px; line-height: 1.1; text-shadow: 0 2px 3px #000; }
.bn-t small { font-size: 9.5px; opacity: .9; }
.bn-pick { background: radial-gradient(ellipse at 70% 40%, color-mix(in srgb, var(--c) 70%, #fff), color-mix(in srgb, var(--c) 40%, #10081a) 60%, #0a0612); }
.bn-pick::before { content: ''; position: absolute; inset: 0; background: repeating-conic-gradient(from 0deg at 70% 45%, rgba(255,255,255,.14) 0 6deg, transparent 6deg 18deg); animation: spin 18s linear infinite; }
.bn-art { position: absolute; right: -6%; top: -4%; height: 190%; filter: drop-shadow(0 0 8px rgba(0,0,0,.6)); }
.bn-pick .bn-t em { background: linear-gradient(#ffb0d0, #ff4a8a); color: #fff; }
.bn-map { position: absolute; inset: 0; background: url(assets/ui/world_map.jpg) no-repeat; background-size: 320%; transition: background-position 1s; }
.bn-dg { background: radial-gradient(ellipse at 75% 45%, #6a4a20, #1a1008 70%); }
.bn-ic { position: absolute; right: 6%; top: 8%; height: 72%; filter: drop-shadow(0 0 10px rgba(255,200,80,.6)); animation: bob 2.4s ease-in-out infinite; }
.bn-dots { position: absolute; right: 2px; top: -9px; display: flex; gap: 4px; z-index: 2; }
.bn-dots i { width: 7px; height: 7px; border-radius: 50%; background: rgba(255,255,255,.35); box-shadow: 0 0 0 1px rgba(0,0,0,.6); cursor: pointer; }
.bn-dots i.on { background: #ffe07a; box-shadow: 0 0 6px #ffe07a; }
.lb-mis { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 0 4px; text-align: left; border-style: solid; border-width: 12px; border-image: url(assets/ui/panel_fill.png) 104 fill / 12px stretch; background: none; }
.mi-h { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.mi-h .ico { color: #ffe07a; } .mi-h em { margin-left: auto; font-style: normal; font-weight: 900; color: #ffe07a; }
.mi-bar { display: block; height: 5px; background: #000; border-radius: 3px; overflow: hidden; }
.mi-bar u { display: block; height: 100%; background: linear-gradient(90deg, #ff9a40, #ffd76a); }
.lb-mis .badge, .nb .badge { position: absolute; right: -6px; top: -8px; margin: 0; }

/* 오른쪽: 모험 · 던전 · 마을 */
.lb-right { position: absolute; right: 12px; top: 60px; bottom: 84px; z-index: 3; width: min(300px, 36vw); display: flex; flex-direction: column; gap: 8px; animation: slideLeft .55s .2s both; }
@keyframes slideLeft { from { opacity: 0; transform: translateX(24px); } }
.lb-adv { position: relative; flex: 1; min-height: 0; padding: 0; text-align: left; overflow: visible; border-style: solid; border-width: 22px; border-image: url(assets/ui/panel.png) 104 / 22px stretch; background: none; filter: drop-shadow(0 6px 12px rgba(0,0,0,.5)); transition: transform .12s; }
.lb-adv:active { transform: scale(.98); }
.adv-map { position: absolute; inset: -18px; z-index: -1; border-radius: 3px; background: url(assets/ui/world_map.jpg) no-repeat; background-size: 260%; }
.adv-map::after { content: ''; position: absolute; inset: 0; background: linear-gradient(rgba(6,8,24,.05), rgba(6,8,24,.25) 40%, rgba(6,8,24,.9)); }
.lb-adv::before { content: ''; position: absolute; inset: -18px; border-radius: 3px; background: linear-gradient(115deg, transparent 30%, rgba(255,255,255,.28) 45%, transparent 60%); background-size: 250% 100%; animation: sheen 3.6s ease-in-out infinite; pointer-events: none; }
@keyframes sheen { 0% { background-position: 120% 0; } 60%, 100% { background-position: -60% 0; } }
.adv-t { position: absolute; left: -4px; right: -4px; bottom: -6px; display: flex; flex-direction: column; }
.adv-t em { font-style: normal; font-size: 11px; font-weight: 900; color: #ffe07a; text-shadow: 0 1px 2px #000; }
.adv-t b { font-family: 'Black Han Sans', sans-serif; font-weight: 400; font-size: clamp(28px, 9vh, 40px); line-height: 1; letter-spacing: 2px; text-shadow: 0 3px 0 #1a1030, 0 0 16px rgba(255,210,100,.5); background: linear-gradient(#fff, #ffe89a 60%, #f0b040); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 2px 2px rgba(0,0,0,.8)); }
.adv-t small { font-size: 11px; color: #e8e2ff; text-shadow: 0 1px 2px #000; } .adv-t strong { color: #fff; }
.adv-prog { display: flex; gap: 3px; margin-top: 4px; }
.adv-prog i { flex: 1; height: 4px; border-radius: 2px; background: rgba(255,255,255,.2); }
.adv-prog i.on { background: #6ae08a; } .adv-prog i.cur { background: #ffe07a; box-shadow: 0 0 6px #ffe07a; animation: blink .6s infinite alternate; }
.adv-go { position: absolute; right: -6px; top: -8px; display: flex; align-items: center; gap: 2px; padding: 3px 10px 3px 12px; font-family: 'Black Han Sans', sans-serif; font-weight: 400; font-size: 15px; color: #2a1804; background: linear-gradient(#fff2b0, #ffc840); border-radius: 12px 4px 12px 12px; box-shadow: 0 0 0 1px #6a4a10, 0 0 12px rgba(255,200,64,.7); animation: goPulse 1.4s ease-in-out infinite; }
@keyframes goPulse { 50% { box-shadow: 0 0 0 1px #6a4a10, 0 0 22px rgba(255,220,120,1); } }
.lb-sub { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.lb-card { position: relative; display: flex; align-items: center; gap: 4px; height: 58px; padding: 0 2px; text-align: left; border-style: solid; border-width: 12px; border-image: url(assets/ui/panel_fill.png) 104 fill / 12px stretch; background: none; transition: transform .12s; }
.lb-card:active { transform: scale(.96); }
.lb-card img { height: 40px; margin: -8px -2px -8px -6px; filter: drop-shadow(0 2px 3px rgba(0,0,0,.7)); }
.lb-card b { display: block; font-size: 13px; } .lb-card small { display: block; font-size: 9px; opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 84px; }
.lb-card.lock { filter: grayscale(.8) brightness(.7); }

/* 아래: 메뉴 바 */
.lb-nav { position: absolute; left: 50%; bottom: 0; transform: translateX(-50%); z-index: 4; display: flex; align-items: flex-end; gap: 4px; padding: 0 18px 6px; animation: slideUp .5s .25s both; }
.lb-nav::before { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 52px; background: linear-gradient(rgba(14,12,34,.2), rgba(8,8,24,.94) 40%); border-top: 1px solid rgba(245,210,122,.5); border-radius: 22px 22px 0 0; box-shadow: 0 -4px 14px rgba(0,0,0,.4); z-index: -1; }
@keyframes slideUp { from { opacity: 0; transform: translate(-50%, 18px); } }
.nb { position: relative; width: 70px; border: 0; background: none; padding: 0; display: flex; flex-direction: column; align-items: center; color: #fff; }
.nbi { position: relative; width: 52px; height: 52px; display: grid; place-items: center; transition: transform .15s; }
.nbi img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 3px 3px rgba(0,0,0,.7)); }
.nbi .ico { display: none; font-size: 26px; color: #ffe07a; }
.nbi.svg img { display: none; } .nbi.svg .ico { display: block; }
.nb b { margin-top: -4px; font-size: 11px; font-weight: 900; text-shadow: 0 1px 2px #000, 0 0 4px #000; }
.nb small { position: absolute; top: -12px; white-space: nowrap; font-size: 8px; font-weight: 900; padding: 0 5px; border-radius: 6px; background: linear-gradient(#ffb0d0, #ff4a8a); box-shadow: 0 0 0 1px #5a0a2a; }
.nb:hover .nbi { transform: translateY(-3px); }
.nb:active .nbi { transform: scale(.92); }
.nb.big { width: 88px; }
.nb.big .nbi { width: 74px; height: 74px; margin-top: -18px; }
.nb.big .nbi::before { content: ''; position: absolute; inset: 8%; border-radius: 50%; background: radial-gradient(circle, rgba(200,140,255,.7), transparent 70%); animation: pulse2 2s ease-in-out infinite; z-index: -1; }
@keyframes pulse2 { 50% { transform: scale(1.25); opacity: .6; } }
.nb.big b { color: #f0d8ff; font-size: 12px; }

@media (max-height: 420px) {
  .lb-left { top: 58px; width: min(230px, 29vw); }
  .lb-right { top: 56px; bottom: 76px; }
  .lb-top { padding: 6px 10px; }
  .lb-av { width: 40px; height: 40px; }
  .nbi { width: 46px; height: 46px; } .nb { width: 62px; }
  .nb.big .nbi { width: 64px; height: 64px; }
}
@media (max-width: 720px) { .lb-left { display: none; } .lb-char { transform: translateX(-72%); } }

/* 마을 시설 버튼 글씨 넘침 */
.tf { padding-top: 8px; } .tf small { white-space: nowrap; font-size: 7.5px; max-width: 58px; overflow: hidden; text-overflow: ellipsis; }

/* ---- QOL: 튜토리얼·결과·재고 없는 버튼 ---- */
.menu button[aria-disabled="true"] { filter: grayscale(.8) brightness(.6); cursor: pointer; }
.menu button[data-buy-empty] { filter: none; border-color: #e8c060; }
.menu button[data-buy-empty] small { color: #ffd98a; }
.menu .hc { -webkit-touch-callout: none; }
.res .res-tap { margin: 6px 0 0; text-align: center; font-size: 13px; color: #ffe8a0; letter-spacing: 1px; animation: resTapBlink 1.4s ease-in-out infinite; }
@keyframes resTapBlink { 50% { opacity: .35; } }
.res.tap-continue { cursor: pointer; }
.mtop .hd-nav { display: inline-flex; align-items: center; gap: 4px; margin-right: 8px; }
.mtop .hd-nav button { min-width: 34px; height: 30px; padding: 0 8px; font-size: 18px; line-height: 1; color: #ffe8a0; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.3); border-radius: 6px; cursor: pointer; }
.mtop .hd-nav small { min-width: 34px; text-align: center; font-size: 11px; color: #c8d4e4; }
