@font-face { font-family: 'BlackHan'; src: url('../fonts/BlackHanSans-Regular.ttf') format('truetype'); font-display: swap; }
@font-face { font-family: 'DoHyeon'; src: url('../fonts/DoHyeon-Regular.ttf') format('truetype'); font-display: swap; }
* { box-sizing: border-box; margin: 0; padding: 0; }
:root { --k: 1; }
html, body { height: 100%; background: #05070f; color: #eef; font-family: 'DoHyeon', 'Malgun Gothic', sans-serif; font-size: 18px; letter-spacing: .3px; overflow: hidden; user-select: none; -webkit-user-select: none; touch-action: none; }
.hidden { display: none !important; }
button { font: inherit; color: #eef; background: #232850; border: 1px solid #3c4485; border-radius: 12px; cursor: pointer; transition: transform .08s, background .15s; letter-spacing: .5px; }
button:hover { background: #2f3570; } button:active { transform: scale(.96); filter: brightness(1.2); }
button.primary { background: #ffb347; color: #2b1600; border-color: #ffd27a; }
button.primary:hover { background: #ffc46b; }
button:disabled { opacity: .45; cursor: default; }
h1, h2, #hudDist, .big, #banner, #hudParcels { font-family: 'BlackHan', 'DoHyeon', sans-serif; font-weight: 400; }

/* ================= 무대: 16:9 고정(960×540)을 화면에 맞춰 통째로 확대·축소 ================= */
#wrap { position: fixed; left: 50%; top: 50%; width: 960px; height: 540px; transform: translate(-50%, -50%); transform-origin: center; display: flex; align-items: center; justify-content: center; overflow: hidden; }
canvas { display: block; background: #0b1030; image-rendering: auto; }

/* 포털이 주입하는 #hud 폭(실제 픽셀)을 무대 기준으로 되돌림 — 빠지면 하트·거리·일시정지가 화면 밖으로 밀린다 */
#wrap #hud { width: 100%; }
#hud { position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 100%; display: flex; justify-content: space-between; padding: 12px 16px; pointer-events: none; font-weight: 700; text-shadow: 0 2px 4px #000; }
#hudDist { font-size: 30px; } #hudScore { font-size: max(18px, calc(14px / var(--k))); opacity: .85; }
.hud-r { display: flex; gap: 12px; align-items: center; align-self: flex-start; font-size: 18px; }
#hudItems { display: flex; gap: 6px; font-size: 15px; }
#hudItems span { background: rgba(0,0,0,.45); border-radius: 8px; padding: 2px 8px; }
/* 터치 영역은 실제 화면에서 44px 이상(무대 축소율 --k 보정) */
#pauseBtn { pointer-events: auto; min-width: 0; padding: 0; width: max(40px, calc(46px / var(--k))); height: max(40px, calc(46px / var(--k))); border-radius: 12px; border: 0; background: rgba(0,0,0,.5); color: #fff; font-size: max(16px, calc(16px / var(--k))); }

#banner { position: absolute; top: 118px; left: 50%; transform: translateX(-50%); font-size: 22px; letter-spacing: 3px; white-space: nowrap; color: #ffe3a3; text-shadow: 0 0 18px rgba(255,200,110,.7), 0 3px 6px #000; animation: fade 2s forwards; pointer-events: none; }
@keyframes fade { 0% { opacity: 0; transform: translate(-50%, 10px); } 15%, 75% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; } }
#popup { position: absolute; top: 72px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 2px; pointer-events: none; animation: pop 1.9s forwards; text-align: center; }
#popup b { font-family: 'BlackHan', sans-serif; font-weight: 400; font-size: 20px; color: #fff; letter-spacing: 1px; -webkit-text-stroke: 1px #2b1600; text-shadow: 0 4px 0 #b3541e, 0 0 20px rgba(255,160,60,.8); }
#popup span { font-size: max(12px, calc(13px / var(--k))); color: #ffe3a3; text-shadow: 0 2px 4px #000; }
#popup.skill b { font-size: 28px; color: #fff6c8; text-shadow: 0 4px 0 #7a2bd6, 0 0 30px rgba(170,110,255,.9); }
@keyframes pop { 0% { opacity: 0; transform: translate(-50%, 20px) scale(.6); } 12% { opacity: 1; transform: translate(-50%, 0) scale(1.08); } 20% { transform: translate(-50%, 0) scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -12px); } }
#gaugeWrap { position: absolute; bottom: 14px; right: 120px; width: 280px; height: 18px; border-radius: 10px; background: rgba(0,0,0,.55); border: 1px solid rgba(255,255,255,.25); overflow: hidden; pointer-events: none; }
#gaugeBar { height: 100%; width: 0; background: linear-gradient(90deg, #7a2bd6, #ff5ec8, #ffd24a); transition: width .15s; }
#gaugeWrap.full { box-shadow: 0 0 14px #ffd24a; animation: glow .6s infinite alternate; }
@keyframes glow { to { box-shadow: 0 0 26px #ff5ec8; } }
#gaugeTxt { position: absolute; inset: 0; text-align: center; font-size: 13px; line-height: 18px; text-shadow: 0 1px 2px #000; }
#hudHearts { margin-top: 4px; font-size: 20px; letter-spacing: 2px; }
#hudHearts .h { font-style: normal; display: inline-block; position: relative; }
#hudHearts .hh i { font-style: normal; }
#hudHearts .hh .l { position: absolute; left: 0; top: 0; clip-path: inset(0 50% 0 0); }
#hudBalls { display: flex; gap: 3px; margin-top: 6px; }
#hudBalls i { width: 14px; height: 14px; border-radius: 3px; background: rgba(255,255,255,.12); border: 1px solid rgba(255,220,120,.35); font-style: normal; font-size: 9px; line-height: 13px; text-align: center; color: #5a3d00; }
#hudBalls i.on { background: linear-gradient(#ffe27a, #e0a020); box-shadow: 0 0 6px #ffd24a; }
#hudFx { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; max-width: 360px; }
#hudFx span { font-size: 14px; background: rgba(0,0,0,.5); border: 1px solid rgba(255,255,255,.2); border-radius: 8px; padding: 1px 7px; }
#hudLetters { display: flex; gap: 3px; margin-top: 4px; align-items: center; }
#hudLetters i { font-style: normal; width: 24px; height: 24px; border-radius: 7px; background: rgba(0,0,0,.45); border: 1px solid rgba(255,255,255,.25); color: rgba(255,255,255,.6); text-shadow: none; display: flex; align-items: center; justify-content: center; font-size: 14px; font-family: 'BlackHan', sans-serif; }
#hudLetters i.on { background: linear-gradient(#ffe27a, #ff9a3a); color: #3a1600; border-color: #fff; box-shadow: 0 0 8px #ffd24a; }
#hudLetters span { font-size: 13px; margin-left: 4px; }
#warn { position: absolute; right: 14px; top: 45%; font-family: 'BlackHan', sans-serif; font-size: 56px; color: #ff4b4b; text-shadow: 0 0 16px #ff0000, 0 3px 0 #000; animation: blink .25s infinite alternate; pointer-events: none; }
@keyframes blink { to { opacity: .3; } }
#splat { position: absolute; inset: 0; pointer-events: none; background: radial-gradient(circle at 38% 42%, rgba(240,240,220,.85) 0 7%, transparent 8%), radial-gradient(circle at 44% 50%, rgba(230,235,210,.75) 0 4%, transparent 5%), radial-gradient(circle at 33% 52%, rgba(245,245,225,.8) 0 3%, transparent 4%); animation: fade2 2.2s forwards; }
@keyframes fade2 { 0%, 60% { opacity: 1; } 100% { opacity: 0; } }
#skillBtn { position: absolute; right: 16px; bottom: 16px; min-width: 0; width: 86px; height: 86px; border-radius: 50%; font-family: 'BlackHan', sans-serif; font-size: 17px; background: radial-gradient(#ffe27a, #e05ab8); color: #2b0030; border: 3px solid #fff; box-shadow: 0 0 20px #ff5ec8; animation: glow .6s infinite alternate; }
/* 스테이지 진행: 위 = 스테이지 전체, 아래 = 다음 휴게소까지(RC-04) */
#stageBar { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); width: 320px; text-align: center; font-size: max(14px, calc(13px / var(--k))); pointer-events: none; text-shadow: 0 2px 3px #000; }
#stageBar .bar { height: 5px; border-radius: 4px; background: rgba(255,255,255,.2); margin-top: 3px; overflow: hidden; position: relative; }
#stageBar .fill { height: 100%; background: linear-gradient(90deg, #6ee7c5, #ffd27a); }
#stageBar .tick { position: absolute; top: 0; width: 2px; height: 100%; background: rgba(0,0,0,.6); }
#stageNext { display: block; margin-top: 4px; font-weight: 400; color: #ffe3a3; font-size: max(15px, calc(14px / var(--k))); }
#stageBar .bar.sec { height: 8px; width: 70%; margin: 3px auto 0; border: 1px solid rgba(255,227,163,.5); }
#stageBar .bar.sec .fill { background: linear-gradient(90deg, #ffb347, #fff3a0); }
#warn.back { right: auto; left: 14px; }
#stageBar.rush #stageNext { color: #ff6b6b; animation: blink .35s infinite alternate; }
#stageBar.rush .fill { background: linear-gradient(90deg, #ff6b6b, #ffd27a); }
#combo { position: absolute; left: 18px; top: 236px; font-family: 'BlackHan', sans-serif; font-size: 17px; color: #ffd24a; text-shadow: 0 3px 0 #7a2bd6, 0 0 14px #ff5ec8; pointer-events: none; }
/* 우측 상단: 장비 + 자동 발동 아이템 */
#quick { position: absolute; right: 12px; top: 68px; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
#quickSlots { display: flex; gap: 6px; }
#quickSlots .slot { min-width: 0; width: 44px; height: 44px; padding: 4px; border-radius: 12px; background: rgba(0,0,0,.6); border: 2px solid rgba(120,200,255,.6); position: relative; }
#quickSlots .slot img { width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
#quickSlots .slot b { position: absolute; right: 3px; bottom: 0; font-size: 12px; color: #fff; text-shadow: 0 1px 2px #000; }
#quickSlots .slot.auto i { position: absolute; left: 2px; top: -2px; font-size: 9px; font-style: normal; color: #9fd4ff; }
#equip { display: flex; gap: 4px; pointer-events: none; }
#equip span { position: relative; width: 30px; height: 30px; padding: 2px; border-radius: 8px; background: rgba(40,60,90,.7); border: 1px solid rgba(120,200,255,.6); }
#equip img { width: 100%; height: 100%; object-fit: contain; }
em.emo { font-style: normal; display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; font-size: 24px; }
/* 좌측 하단: 달리며 주운 아이템 퀵슬롯 3칸 */
#bag { position: absolute; left: 14px; bottom: 12px; display: flex; gap: 8px; }
#bag .slot { min-width: 0; width: 100px; height: 100px; padding: 8px; border-radius: 16px; background: rgba(0,0,0,.55); border: 2px solid rgba(255,255,255,.3); position: relative; }
#bag .slot img, #bag .slot em { width: 100%; height: 100%; object-fit: contain; font-size: 52px; pointer-events: none; }
#bag .slot::after { content: attr(data-k); position: absolute; left: 7px; top: 3px; font-size: 14px; color: #ffe3a3; }
#bag .slot b { position: absolute; right: 7px; bottom: 3px; font-size: 18px; text-shadow: 0 1px 3px #000; }
#bag .slot.has { border-color: #ffd27a; box-shadow: 0 0 12px rgba(255,210,120,.5); }
/* 터치 눌림 표시(V2-06) — 화면 절반 영역이 살짝 밝아진다 */
.tz { position: absolute; top: 0; bottom: 0; width: 50%; pointer-events: none; transition: background .08s; }
#tzL { left: 0; } #tzR { right: 0; }
.tz span { position: absolute; left: 50%; top: 30%; transform: translateX(-50%); padding: 4px 12px; border-radius: 10px; border: 1px solid rgba(255,255,255,.18); color: rgba(255,255,255,.35); font-size: max(14px, calc(14px / var(--k))); }
.tz.on { background: rgba(255,255,255,.07); } .tz.on span { color: #fff; border-color: #ffd27a; background: rgba(255,210,120,.2); }
/* 3·2·1 카운트다운 · 상황 안내 · 조작 실습 */
#count { position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); font-family: 'BlackHan', sans-serif; font-size: 96px; color: #fff3a0; -webkit-text-stroke: 3px #7a3a00; text-shadow: 0 6px 0 #b3541e, 0 0 30px rgba(255,200,80,.8); pointer-events: none; z-index: 15; }
#count.tick { animation: cnt .6s ease-out; } #count.go { color: #6ee7c5; animation: cnt .45s ease-out; }
@keyframes cnt { 0% { transform: translate(-50%, -50%) scale(1.8); opacity: 0; } 30% { transform: translate(-50%, -50%) scale(1); opacity: 1; } 100% { transform: translate(-50%, -50%) scale(.9); opacity: .85; } }
#hint { position: absolute; left: 50%; bottom: 128px; transform: translateX(-50%); padding: 10px 22px; border-radius: 14px; background: rgba(10,14,40,.85); border: 2px solid #ffd27a; color: #fff; font-size: max(20px, calc(15px / var(--k))); white-space: nowrap; pointer-events: none; box-shadow: 0 0 18px rgba(255,210,120,.45); animation: hintp 1s ease-in-out infinite alternate; z-index: 14; }
@keyframes hintp { to { box-shadow: 0 0 30px rgba(255,210,120,.85); } }
#drill { pointer-events: none; position: absolute; left: 50%; top: 150px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 18px 12px; border-radius: 16px; background: rgba(10,14,40,.88); border: 2px solid #6ee7c5; box-shadow: 0 0 22px rgba(110,231,197,.45); z-index: 16; }
#drill small { color: #6ee7c5; font-size: max(14px, calc(13px / var(--k))); }
#drill b { font-weight: 400; font-size: max(22px, calc(16px / var(--k))); color: #fff; white-space: nowrap; }
#drill .dots { display: flex; gap: 6px; } #drill .dots i { width: 12px; height: 12px; border-radius: 50%; background: rgba(255,255,255,.2); } #drill .dots i.on { background: #6ee7c5; } #drill .dots i.now { background: #ffd27a; }
#drill.ok { border-color: #ffd27a; } #drill.ok b { color: #ffd27a; }
#drillSkip { pointer-events: auto; min-width: 0; padding: 0 16px; min-height: max(40px, calc(44px / var(--k))); font-size: max(15px, calc(14px / var(--k))); background: rgba(35,40,80,.9); }

/* 세로 화면이면 가로로 돌리라는 안내 */
#rotate { display: none; position: fixed; inset: 0; z-index: 50; background: #05070f; color: #ffd27a; font-size: 20px; text-align: center; align-items: center; justify-content: center; flex-direction: column; gap: 12px; }
@media (orientation: portrait) and (pointer: coarse) { #rotate { display: flex; } }

/* ================= 메뉴 층(#ui): 캔버스와 분리 — 1배 아래로 줄지 않음(V2-05·RC-02) =================
   상자 크기: 작은 폰 약 600×340 ~ 기본 960×540. 버튼 최소 44px, 본문 최소 14px */
#ui { position: fixed; left: 50%; top: 50%; width: 960px; height: 540px; transform: translate(-50%, -50%); transform-origin: center; display: flex; align-items: center; justify-content: center; pointer-events: none; z-index: 10; font-size: 16px; }
#ui > .screen { pointer-events: auto; }
#ui .screen { position: absolute; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 16px 22px; width: min(640px, calc(100% - 16px)); max-width: calc(100% - 16px); max-height: calc(100% - 12px); overflow: auto; touch-action: pan-y; overscroll-behavior: contain; background: rgba(8,10,28,.9); border: 1px solid rgba(160,170,255,.25); border-radius: 18px; backdrop-filter: blur(6px); box-shadow: 0 20px 60px rgba(0,0,0,.5); text-align: center; }
#ui .screen.full { inset: 0; width: 100%; height: 100%; max-width: none; max-height: none; border-radius: 0; padding: 12px 16px; gap: 8px; justify-content: flex-start; overflow: hidden; }
#ui button { min-width: 0; min-height: 44px; padding: 6px 14px; font-size: 17px; }
#ui h1 { font-size: 40px; letter-spacing: 3px; color: #ffd27a; text-shadow: 0 4px 0 #6b4424, 0 0 24px rgba(255,190,90,.45); line-height: 1.1; }
#ui h2 { font-size: 26px; color: #ffd27a; line-height: 1.15; }
#ui p, #ui td, #ui small, #ui span { font-size: 15px; }
#ui .dim { opacity: .75; }
#ui .help { font-size: 14px; opacity: .72; line-height: 1.5; }
#ui .meme { font-size: 17px; color: #ffe3a3; }
#ui .big { font-size: 40px; line-height: 1.1; } #ui .big b { font-weight: 400; }
#ui .new { color: #6ee7c5; font-weight: 800; font-size: 16px; }
#ui table { border-collapse: collapse; width: 100%; } #ui td { padding: 3px 6px; } #ui td:last-child { text-align: right; font-weight: 700; }
.row2, .row3 { display: flex; gap: 8px; width: 100%; } .row2 > button, .row3 > button { flex: 1; }
.row3 > button.icon { flex: 0 0 52px; padding: 0; font-size: 20px; }

/* 시작화면: 왼쪽 메뉴 + 오른쪽 챕터·스테이지 */
#title .tBody { display: flex; gap: 16px; width: 100%; height: 100%; align-items: stretch; }
.tLeft { width: 40%; min-width: 250px; max-width: 360px; display: flex; flex-direction: column; justify-content: center; gap: 8px; }
.tLeft .sub { opacity: .8; }
.tLeft .stats { display: flex; justify-content: center; gap: 14px; }
.tLeft .stats span, .tLeft .stats b { font-size: 16px; }
#contBtn { min-height: 54px; font-size: 21px; font-family: 'BlackHan', sans-serif; letter-spacing: 1px; }
.tRight { flex: 1; display: flex; flex-direction: column; gap: 8px; min-width: 0; min-height: 0; }
#chapTabs { display: flex; gap: 6px; }
#chapTabs button { flex: 1; padding: 4px 2px; white-space: nowrap; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 15px; line-height: 1.15; opacity: .65; }
#chapTabs button small { font-size: 14px; opacity: .85; }
#chapTabs button.on { opacity: 1; border-color: #ffd27a; color: #ffd27a; background: #3a3f8f; }
#stageGrid { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(4, 1fr); grid-auto-rows: minmax(44px, 1fr); gap: 6px; }
.stg { padding: 4px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; position: relative; overflow: hidden; }
.stg b { font-family: 'BlackHan', sans-serif; font-weight: 400; font-size: 24px; line-height: 1; }
#ui .stg small { font-size: 14px; line-height: 1.15; opacity: .9; }
.stg i { font-style: normal; font-size: 14px; }
.stg.done { border-color: #6ee7c5; } .stg.done i { color: #6ee7c5; }
.stg.open { border-color: #ffd27a; box-shadow: 0 0 12px rgba(255,210,120,.45); } .stg.open i { color: #ffd27a; }
.stg.lock { opacity: .4; }
.stg.cur { background: #3a3f8f; } .stg.cur::after { content: '▶'; position: absolute; top: 2px; right: 6px; font-size: 14px; color: #ff9fe0; }
/* 첫 방문: 메뉴를 가운데 하나로(RC-03) */
#title.fresh .tBody { justify-content: center; } #title.fresh .tLeft { width: min(420px, 100%); max-width: none; }
#title.fresh .tRight, #title.fresh .row3 > button:not(.icon), #title.fresh #tStats, #title.fresh #tMis, #title.fresh #tSpin { display: none; }
#title .freshNote { color: #6ee7c5; }

.misBox { width: 100%; background: rgba(255,255,255,.06); border-radius: 12px; padding: 6px 10px; text-align: left; display: flex; flex-direction: column; gap: 2px; }
#ui .misBox b, #ui .misBox span, #ui .misBox i { font-size: 14px; }
.misBox b { color: #ffd27a; font-weight: 400; } .misBox b small { color: #b9c2ff; font-size: 14px; }
.misBox .mis { display: flex; justify-content: space-between; gap: 8px; } .misBox .mis.done { color: #6ee7c5; } .misBox i { font-style: normal; opacity: .85; }
.spin { display: flex; gap: 10px; align-items: center; justify-content: center; width: 100%; } .spin:empty { display: none; }
#ui .spinBtn { padding: 6px 14px; background: linear-gradient(#ff9fe0, #b56bff); color: #fff; border: 0; font-size: 16px; }
#ui .spinOut { font-size: 15px; color: #ffd27a; }

/* 결과·클리어: 가로 2단 — 스크롤 없이 한 화면 */
#ui #result, #ui #clear { flex-direction: row; align-items: center; gap: 18px; width: min(800px, calc(100% - 16px)); }
#ui .rL, #ui .rR { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 7px; min-width: 0; }
#ui .rL > button, #ui .rR > button { width: 100%; }
.rBtns { display: flex; gap: 8px; width: 100%; } .rBtns button { flex: 1; }
#ui #rEvents { font-size: 14px; line-height: 1.3; font-weight: 400; }
.fameBig { font-size: 28px; font-family: 'BlackHan', sans-serif; color: #ffd27a; } .fameBig b { font-weight: 400; }
#ui .adBtn { background: #1f5c4d; border-color: #6ee7c5; color: #e8fff8; font-size: 15px; }

/* 설정 */
#settings { z-index: 25; width: min(600px, calc(100% - 16px)); }
.setGrid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: 100%; }
.vol { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 10px; border-radius: 12px; background: rgba(255,255,255,.05); }
#ui .vol span { width: 70px; text-align: left; font-size: 15px; }
.vol input { flex: 1; min-width: 0; accent-color: #ffd27a; height: 32px; }
#ui .opt { font-size: 15px; }
#setClose { width: min(260px, 100%); }
#ui #paused > button, #ui #confirmNew .row2 { width: 100%; }
#ui #title.fresh .sub { display: block; }
.eqSlot .plus { font-style: normal; font-size: 22px; line-height: 1; opacity: .6; }

/* 출석 */
#daily { z-index: 20; width: min(700px, calc(100% - 16px)); }
#dailyDays { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; width: 100%; }
.dday { background: rgba(255,255,255,.06); border: 2px solid transparent; border-radius: 10px; padding: 6px 2px; display: flex; flex-direction: column; align-items: center; gap: 3px; text-align: center; min-height: 80px; }
.dday b { font-family: 'BlackHan', sans-serif; font-weight: 400; font-size: 15px; }
#ui .dday span { font-size: 14px; line-height: 1.2; }
.dday.got { opacity: .45; } .dday.got::after { content: '✓'; color: #6ee7c5; }
.dday.now { border-color: #ffd27a; box-shadow: 0 0 14px rgba(255,210,120,.6); background: rgba(255,210,120,.15); }
#paused { width: min(520px, calc(100% - 16px)); }
#confirmNew { width: min(480px, calc(100% - 16px)); }

/* 상점(전체 화면) */
.shopHead { display: flex; align-items: center; gap: 12px; width: 100%; flex: none; }
#ui .shopHead h2 { margin: 0; font-size: 24px; white-space: nowrap; }
.shopHead span { flex: 1; text-align: left; }
.shopHead button { flex: none; }
#shopTabs { display: flex; gap: 6px; width: 100%; flex: none; }
#shopTabs button { flex: 1; padding: 4px; border-radius: 10px 10px 0 0; opacity: .6; }
#shopTabs button.on { opacity: 1; background: #3a3f8f; border-color: #ffd27a; color: #ffd27a; }
.shopBody { display: flex; gap: 10px; width: 100%; flex: 1; min-height: 0; }
#shopGrid { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); grid-auto-rows: 96px; gap: 6px; align-content: start; overflow: auto; touch-action: pan-y; }
#shopGrid.skins { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); grid-auto-rows: 176px; }
.sitem { padding: 4px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; position: relative; }
#ui .sitem span { font-size: 14px; line-height: 1.15; } #ui .sitem small { font-size: 14px; }
.sitem img, .sitem em.emo { width: 40px; height: 40px; object-fit: contain; font-size: 28px; }
#ui .sitem .own { position: absolute; top: 2px; right: 5px; font-size: 14px; color: #6ee7c5; font-style: normal; }
#ui .sitem .auto { position: absolute; top: 2px; left: 5px; font-size: 14px; font-style: normal; color: #ffd27a; }
.sitem.sel { border-color: #ffd27a; box-shadow: 0 0 10px rgba(255,210,120,.6); }
#shopInfo { width: 34%; max-width: 250px; min-width: 180px; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px; background: rgba(255,255,255,.06); border-radius: 14px; text-align: center; min-height: 0; }
#infoIcon { width: 64px; height: 64px; flex: none; } #infoIcon img, #infoIcon em { width: 100%; height: 100%; object-fit: contain; font-size: 44px; }
#ui #shopInfo .tag { color: #6ee7c5; font-size: 14px; } #infoName { font-size: 19px; font-weight: 400; }
#ui #infoDesc { font-size: 14px; line-height: 1.35; flex: 1; min-height: 0; overflow: auto; }
#shopInfo button { width: 100%; flex: none; }
.swatch { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px; background: rgba(255,255,255,.05); border: 2px solid transparent; border-radius: 12px; min-width: 0; }
.swatch.sel { border-color: #ffd27a; }
.swatch img { height: 56px; object-fit: contain; }
#ui .swatch span { font-size: 15px; } #ui .swatch small { font-size: 14px; line-height: 1.2; }
#shopGrid .swatch button { width: 100%; padding: 4px; font-size: 15px; }
.swatch.tier3, .swatch.tier4 { background: linear-gradient(160deg, rgba(120,80,255,.18), rgba(255,255,255,.04)); }
.swatch.tier5 { background: linear-gradient(160deg, rgba(80,160,255,.28), rgba(255,120,220,.12)); }
.swatch.tier6 { background: linear-gradient(160deg, rgba(255,210,80,.35), rgba(255,120,60,.15)); box-shadow: 0 0 14px rgba(255,210,80,.45); }

/* 장비창(전체 화면): 인형 + 머리·몸통·신발 / 공구 2칸 / 고르기 목록 */
.eqBody { display: flex; gap: 12px; width: 100%; flex: 1; min-height: 0; }
.doll { position: relative; flex: none; width: 250px; height: 100%; min-height: 260px; background: radial-gradient(circle at 50% 50%, rgba(255,210,120,.18), transparent 62%); border-radius: 16px; }
#dollImg { position: absolute; left: 42%; top: 50%; transform: translate(-50%, -50%); height: calc(100% - 180px); max-height: 200px; min-height: 70px; }
.eqSlot { width: 80px; height: 80px; padding: 3px; border-radius: 14px; background: rgba(0,0,0,.55); border: 2px dashed rgba(255,255,255,.35); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; }
.doll .eqSlot { position: absolute; }
.doll .eqSlot[data-slot=head] { left: 42%; top: 0; transform: translateX(-50%); }
.doll .eqSlot[data-slot=body] { right: 0; top: 50%; transform: translateY(-50%); }
.doll .eqSlot[data-slot=shoes] { left: 42%; bottom: 0; transform: translateX(-50%); }
.eqSlot img, .eqSlot em.emo { width: 44px; height: 44px; object-fit: contain; font-size: 30px; }
#ui .eqSlot small { font-size: 14px; line-height: 1.1; }
.eqSlot.sel { border: 2px solid #ffd27a; box-shadow: 0 0 14px rgba(255,210,120,.6); }
.eqTools { flex: none; display: flex; flex-direction: column; gap: 8px; align-items: center; justify-content: center; }
.eqTools b { font-weight: 400; color: #ffd27a; font-size: 15px; }
.eqPick { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: 6px; text-align: left; }
#pickTitle { font-weight: 400; color: #ffd27a; font-size: 17px; }
#pickList { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: 6px; touch-action: pan-y; }
.pick { display: flex; align-items: center; gap: 10px; text-align: left; padding: 6px 10px; flex: none; }
.pick img, .pick em.emo { width: 40px; height: 40px; flex: none; object-fit: contain; font-size: 28px; }
.pick span { flex: 1; display: flex; flex-direction: column; min-width: 0; }
#ui .pick span small { font-size: 14px; opacity: .8; line-height: 1.25; }
#ui .pick i { font-style: normal; font-size: 14px; color: #ffd27a; flex: none; } .pick.on { border-color: #6ee7c5; } #ui .pick.on i { color: #6ee7c5; }
#ui #pickDesc { font-size: 14px; }

/* 낮은 화면(폰 가로 등): 여백·제목을 줄여 한 화면에 */
@media (max-height: 460px) {
  #ui .screen { padding: 10px 14px; gap: 6px; }
  #ui .screen.full { padding: 8px 12px; gap: 6px; }
  #ui h1 { font-size: 28px; letter-spacing: 2px; }
  #ui h2 { font-size: 22px; }
  #ui .big { font-size: 32px; }
  .tLeft { gap: 6px; } .tLeft .sub { display: none; }
  #contBtn { min-height: 48px; font-size: 19px; }
  .fameBig { font-size: 22px; }
  .dday { min-height: 64px; }
  #infoIcon { width: 44px; height: 44px; }
  #shopInfo { gap: 3px; padding: 8px; }
  .doll { width: 220px; min-height: 0; }
  .eqSlot { width: 72px; height: 72px; }
  .eqSlot img, .eqSlot em.emo { width: 36px; height: 36px; font-size: 26px; }
  #dollImg { height: calc(100% - 160px); }
  #ui #helpTxt { display: none; }
}

/* 배달 준비 카드(V2-03) */
#prep { width: min(760px, calc(100% - 16px)); gap: 6px; }
#ui #prep h2 { font-size: 22px; }
#ui #prep #prepSub { font-size: 15px; color: #ffe3a3; margin-top: -4px; }
#ui #prep > button { width: 100%; }
.prepCols { display: flex; gap: 8px; width: 100%; min-height: 0; }
.prepBox { min-width: 0; background: rgba(255,255,255,.06); border-radius: 12px; padding: 6px 8px; display: flex; flex-direction: column; gap: 4px; text-align: left; }
.prepBox:first-child { flex: 0 0 30%; } .prepBox:last-child { flex: 1; }
.prepBox > b { font-weight: 400; color: #ffd27a; font-size: 15px; } #ui .prepBox > b small { font-size: 14px; color: #b9c2ff; }
.prepIcons { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 4px; }
.prepBox:first-child .prepIcons { grid-template-columns: 1fr; }
.pI { display: flex; align-items: center; gap: 6px; padding: 2px 6px 2px 2px; border-radius: 10px; background: rgba(0,0,0,.35); border: 1px solid rgba(255,255,255,.15); min-width: 0; }
.pI img, .pI em.emo { width: 30px; height: 30px; flex: none; object-fit: contain; font-size: 22px; }
.pI span { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
#ui .pI span, #ui .pI span small { font-size: 14px; } #ui .pI span small { color: #6ee7c5; white-space: nowrap; }
.pI.keep { opacity: .55; }
#ui .prepBox .none { font-size: 14px; opacity: .7; }
/* 사계절 노선도(V2-02): 챕터별 진행 막대 + 현재 스테이지의 휴게소 */
#chapTabs button .prog { display: block; width: 80%; height: 4px; border-radius: 3px; background: rgba(255,255,255,.18); overflow: hidden; margin-top: 2px; }
#chapTabs button .prog b { display: block; height: 100%; background: linear-gradient(90deg, #6ee7c5, #ffd27a); }
.stg .cps { display: flex; gap: 3px; } .stg .cps u { width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,.25); } .stg .cps u.on { background: #ffd27a; box-shadow: 0 0 6px #ffd27a; }
@media (max-height: 460px) { .prepBox { padding: 4px 6px; } .pI img, .pI em.emo { width: 26px; height: 26px; } #ui #prep .help { display: none; } }

/* 자동 사용 버튼: 필살기(3스테이지부터)·아이템(5스테이지부터, 좌측 중간) */
.autoBtn { position: absolute; min-width: 0; padding: 0 10px; min-height: max(38px, calc(44px / var(--k))); font-size: max(13px, calc(13px / var(--k))); border-radius: 12px; background: rgba(0,0,0,.55); border: 2px solid rgba(255,255,255,.25); color: #cfd3ff; display: flex; align-items: center; gap: 4px; }
.autoBtn.on { border-color: #6ee7c5; color: #fff; background: rgba(20,90,70,.75); box-shadow: 0 0 10px rgba(110,231,197,.5); }
.autoBtn.lock { opacity: .6; border-style: dashed; }
#autoSkill { right: 16px; bottom: max(110px, calc(110px + (44px / var(--k)) - 44px)); }
#autoItem { left: 14px; top: 53%; }

/* 상점 자동 구매(아이템 탭) */
#ui .autoBuy { width: 100%; flex: none; font-size: 15px; background: #232850; white-space: nowrap; }
#ui .autoBuy::after { content: ''; }
#ui .autoBuy.on { background: #1f5c4d; border-color: #6ee7c5; color: #e8fff8; }
#ui .sitem .ab { position: absolute; bottom: 2px; right: 5px; font-size: 14px; font-style: normal; color: #6ee7c5; }
