/* 마법학교 본체 화면 — magic.html 안 <style>을 그대로 옮김 (2026-11-01). 확장 기능은 magic-ext.css */
.wrap { max-width: 95%; margin: 0 auto; padding: 14px 16px 12px; } /* 게임 화면은 폭 95% (2026-09-15 사용자 지시 — 다른 페이지 90%) */
.top-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.page-title { font-size: 1.25rem; font-weight: 800; color: var(--text-main); }
.page-sub { font-size: 0.74rem; color: var(--text-dim); }
.market-closed { display: none; font-size: 0.76rem; color: #ffb26a; background: rgba(255,178,106,0.08); border: 1px solid rgba(255,178,106,0.3); border-radius: 8px; padding: 4px 12px; }
/* 첫걸음 길잡이 창(2026-11-01 예전 '개발 중' 안내 자리) + 11화 전 '다음 할 일' 줄 */
#first-steps { z-index: 1200; }
#first-steps .ov-box { width: min(480px, 100%); }
#first-steps .fs-title { font-size: 1.08rem; margin: 0 0 4px; color: var(--text-main); }
#first-steps .fs-lead { font-size: 0.86rem; color: var(--text-dim); margin: 0 0 10px; }
#first-steps .fs-steps { margin: 0 0 14px; padding-left: 1.3em; font-size: 0.9rem; line-height: 1.7; color: var(--text-main); }
#first-steps .fs-steps li + li { margin-top: 6px; }
#first-steps .fs-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; align-items: center; }
.next-todo { display: none; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 8px; padding: 8px 12px; background: var(--bg-card); border: 1px solid var(--border); border-left: 3px solid var(--brand); border-radius: 10px; font-size: 0.86rem; color: var(--text-main); }
.next-todo.on { display: flex; }
.next-todo .nt-label { font-weight: 800; color: var(--text-dim); font-size: 0.74rem; }
.next-todo .nt-text { flex: 1; min-width: 12em; }
.panel { background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; }
/* 빈 목록 안내는 공용 .empty-state 모양을 쓰고, 좁은 창 안에서만 여백·글자를 줄인다 */
.ov-body .empty-state, .chat-list .empty-state { padding: 22px 12px; font-size: 0.8rem; color: var(--text-dim); }
.data-table td.empty-state { white-space: normal; }
.section-label { font-size: 0.78rem; font-weight: 700; color: var(--text-sub); margin: 14px 0 8px; }
.emoji-glyph { font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif; }

/* 소개 화면 (로그인 전 방문자) */
.intro-box { background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; padding: 22px 20px 18px; margin: 14px 0; text-align: center; }
.intro-box h3 { font-size: 1.15rem; color: var(--text-main); margin: 12px 0 8px; }
.intro-box p { font-size: 0.86rem; color: var(--text-sub); line-height: 1.8; margin: 0 auto 14px; max-width: 760px; }
/* 주인공 3 + 사냥터 3 그림 띠 — 넓으면 한 줄 6장, 좁으면 3장씩 두 줄(4+2로 어긋나지 않게) */
.intro-hero { display: grid; grid-template-columns: repeat(6, minmax(0, 150px)); justify-content: center; align-items: end; gap: 8px; }
.intro-hero img { width: 100%; height: auto; aspect-ratio: 1; object-fit: contain; }
@media (max-width: 1100px) { .intro-hero { grid-template-columns: repeat(3, minmax(0, 150px)); } }
@media (max-width: 640px) { .intro-hero { gap: 4px; } .intro-box { padding: 16px 12px 14px; } }
.intro-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin: 6px 0 16px; text-align: left; }
.intro-card { background: rgba(255,255,255,0.03); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.intro-card .ic-l { font-size: 0.68rem; color: var(--text-dim); }
.intro-card .ic-v { font-size: 1rem; font-weight: 800; color: var(--text-main); margin: 2px 0; }
.intro-card .ic-d { font-size: 0.7rem; color: var(--text-dim); line-height: 1.5; }
.intro-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.intro-note { font-size: 0.74rem !important; color: var(--text-dim) !important; margin-top: 12px !important; }
/* 등장인물 창 */
.cast-group .cg-note { font-weight: 400; color: var(--text-dim); margin-left: 6px; }
.cast-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 8px; }
.cast-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); } /* 동료처럼 프로필이 붙어 글이 긴 그룹은 2열 고정 (2026-09-17) */
@media (max-width: 640px) { .cast-grid.two { grid-template-columns: 1fr; } }
.cast-card { display: flex; gap: 12px; align-items: flex-start; background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.cast-img { width: 96px; height: 112px; object-fit: contain; object-position: 50% 0; flex-shrink: 0; font-size: 3rem; display: flex; align-items: center; justify-content: center; }
/* 그림 누르면 크게 보기 (2026-09-17) — 그림 래퍼 + 오른쪽 아래 확대 아이콘 */
.cast-art { position: relative; flex-shrink: 0; cursor: zoom-in; border-radius: 8px; }
.cast-art:hover .cast-img { filter: brightness(1.08); }
.cast-zoom { position: absolute; right: 2px; bottom: 2px; width: 24px; height: 24px; border-radius: 6px; background: rgba(0,0,0,0.6); border: 1px solid var(--border-strong); color: var(--text-sub); display: flex; align-items: center; justify-content: center; pointer-events: none; }
.cast-art:hover .cast-zoom { color: var(--brand); border-color: var(--brand); }
.cast-zoom svg { width: 14px; height: 14px; }
.img-viewer { display: none; position: fixed; inset: 0; z-index: 1300; background: rgba(0,0,0,0.86); align-items: center; justify-content: center; padding: 16px; cursor: zoom-out; }
.img-viewer.open { display: flex; }
.img-viewer img { max-width: min(92vw, 900px); max-height: 82vh; object-fit: contain; image-rendering: auto; }
.iv-box { display: flex; flex-direction: column; align-items: center; gap: 10px; cursor: default; }
.iv-name { font-size: 0.95rem; font-weight: 800; color: var(--text-main); }
.iv-close { position: absolute; top: 14px; right: 14px; }
.cast-name { font-size: 0.9rem; font-weight: 800; color: var(--text-main); }
.cast-tag { font-size: 0.68rem; color: var(--brand, #f2c94c); margin: 2px 0 4px; }
.cast-desc { font-size: 0.74rem; color: var(--text-dim); line-height: 1.6; }
.login-box { background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; padding: 20px; text-align: center; margin: 14px 0; }
.login-box h3 { font-size: 1rem; color: var(--text-main); margin: 0 0 8px; }
.login-box p { font-size: 0.82rem; color: var(--text-dim); line-height: 1.7; margin: 0 0 14px; }
.elem-pick { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-bottom: 14px; }
.elem-card { width: 200px; max-width: 100%; text-align: left; background: transparent; border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; cursor: pointer; color: var(--text-sub); }
.elem-card:hover { border-color: var(--border-strong); }
.elem-card.on { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(242,201,76,0.2); }
.elem-card .ec-name { font-size: 0.95rem; font-weight: 800; color: var(--text-main); }
.elem-card .ec-desc { font-size: 0.72rem; color: var(--text-dim); margin-top: 4px; line-height: 1.6; }
.elem-card .ec-stat { font-size: 0.68rem; color: var(--text-dim); margin-top: 6px; }
.elem-card { font-family: inherit; }
/* 휴대폰: 속성 카드를 그림 왼쪽·설명 오른쪽 한 줄로 — 세 장이 세로로 쌓여 '입학하기'가 한참 아래였던 것 */
@media (max-width: 640px) {
    .elem-pick { gap: 8px; }
    .elem-card { width: 100%; display: flex; gap: 10px; align-items: center; padding: 8px 10px; }
    .elem-card .ec-img { width: 84px; height: 96px; margin: 0; flex-shrink: 0; border-radius: 8px; }
    .elem-card .ec-body { flex: 1; min-width: 0; }
    .elem-card .ec-desc { font-size: 0.74rem; }
}
.big-btn { background: var(--brand); border: 1px solid var(--brand); border-radius: 10px; color: var(--brand-ink); font-size: 0.88rem; font-weight: 800; padding: 11px 26px; cursor: pointer; }
.big-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.mini-btn { background: transparent; border: 1px solid var(--border-strong); border-radius: 8px; color: var(--text-sub); font-size: 0.74rem; padding: 6px 12px; cursor: pointer; }
.mini-btn:hover:not(:disabled) { color: var(--text-main); border-color: var(--brand); }
.mini-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.mini-btn.gold { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); font-weight: 800; }
.mini-btn.danger { border-color: rgba(255,120,120,0.45); color: #ff9a9a; }

.sum-bar { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.sum-card { flex: 1; min-width: 118px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; }
.sum-card .sc-label { font-size: 0.68rem; color: var(--text-dim); }
.sum-card .sc-value { font-size: clamp(0.86rem, 1.25vw + 0.1rem, 1rem); font-weight: 800; color: var(--text-main); font-variant-numeric: tabular-nums; margin-top: 2px; } /* 태블릿에서 '1,048 / 1,048'·큰 핀이 두 줄로 꺾여 칸이 높아지던 것 */
.sum-card .sc-note { font-size: 0.68rem; color: var(--text-dim); margin-top: 2px; }
@media (max-width: 1024px) { .sum-card .sc-note.sc-static { display: none; } } /* 핀·학점 설명은 물음표로 볼 수 있어 태블릿·휴대폰에서는 접는다(지도 자리 확보) */
/* 태블릿·세로가 낮은 화면(768px 노트북 등): 요약 칸 설명은 한 줄로(대기 이유가 앞에 오게 써 둠), 동료 줄 부가 설명은 접어 지도가 화면 안에 들어오게 */
@media (min-width: 641px) and (max-width: 1024px), (min-width: 641px) and (max-height: 820px) {
    .sum-card .sc-note { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .sum-comp .cp-sub { display: none; }
    .wrap .sum-bar { margin: 8px 0; }
    .wrap .sum-comps { margin: -2px 0 8px; }
}
/* 요약 바 아래 동료 줄 (2026-09-16 "상단 내 스탯 아래에 동료들 스탯/정보") */
.sum-comps { display: flex; flex-wrap: wrap; gap: 8px; margin: -4px 0 12px; }
.sum-comp { flex: 1; min-width: 200px; display: flex; gap: 10px; align-items: center; background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; cursor: pointer; }
.sum-comp:hover { border-color: var(--brand); }
.sum-comp.in-party { border-color: rgba(106,168,255,0.55); }
.sum-comp .cp-img { width: 40px; height: 46px; object-fit: cover; object-position: 50% 12%; flex-shrink: 0; border-radius: 6px; }
.sum-comp .cp-emoji { width: 40px; height: 46px; font-size: 1.6rem; text-align: center; line-height: 46px; flex-shrink: 0; }
.sum-comp .cp-main { flex: 1; min-width: 0; }
.sum-comp .cp-name { font-size: 0.8rem; font-weight: 800; color: var(--text-main); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sum-comp .cp-sub { font-size: 0.64rem; color: var(--text-dim); margin-top: 1px; }
.sum-comp .bar { height: 5px; margin-top: 3px; }
.sum-comp .bar.bond > span { background: #ff9ac9; }
.bond-chip { display: inline-block; font-size: 0.62rem; font-weight: 800; border-radius: 5px; padding: 1px 6px; border: 1px solid rgba(255,154,201,0.5); color: #ff9ac9; vertical-align: middle; }
.comp-bond { font-size: 0.72rem; color: var(--text-dim); margin-top: 6px; max-width: 260px; }
.comp-bond .bar { height: 5px; margin-top: 4px; } .comp-bond .bar > span { background: #ff9ac9; }
/* 동료 창 */
.bond-head { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.bond-portrait { width: 120px; height: 140px; object-fit: contain; object-position: 50% 0; flex-shrink: 0; font-size: 4rem; text-align: center; line-height: 140px; }
.bond-main { flex: 1; min-width: 220px; }
.bond-name { font-size: 1.1rem; font-weight: 800; color: var(--text-main); }
.bond-sub { font-size: 0.74rem; color: var(--text-dim); line-height: 1.6; margin-top: 4px; }
.bond-bar { height: 9px; margin-top: 8px; } .bond-bar > span { background: linear-gradient(90deg, #ff9ac9, #f2c94c); }
.bond-stages { display: flex; gap: 4px; margin-top: 6px; flex-wrap: wrap; }
.bond-stages span { font-size: 0.62rem; color: var(--text-dim); border: 1px solid var(--border); border-radius: 5px; padding: 1px 6px; }
.bond-stages span.on { color: #ff9ac9; border-color: rgba(255,154,201,0.5); font-weight: 800; }
.talk-box { background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; margin-top: 12px; display: flex; flex-direction: column; overflow: hidden; }
.talk-log { height: 300px; max-height: 45vh; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.talk-msg { max-width: 82%; font-size: 0.82rem; line-height: 1.55; padding: 8px 12px; border-radius: 12px; word-break: break-word; white-space: pre-wrap; }
.talk-msg.user { align-self: flex-end; background: rgba(106,168,255,0.16); color: var(--text-main); border-bottom-right-radius: 4px; }
.talk-msg.companion { align-self: flex-start; background: rgba(255,255,255,0.06); color: var(--text-main); border-bottom-left-radius: 4px; }
.talk-msg.companion.thinking { color: var(--text-dim); font-style: italic; }
.talk-msg .tm-who { display: block; font-size: 0.64rem; color: var(--text-dim); margin-bottom: 2px; }
.talk-note { font-size: 0.68rem; color: var(--text-dim); padding: 0 12px 8px; }
.talk-input-row { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--border); }
.talk-input { flex: 1; min-width: 0; background: var(--bg-input); border: 1px solid var(--border); border-radius: 8px; color: var(--text-main); padding: 8px 12px; font-size: 0.84rem; }
.gift-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.bond-events .row-card { padding: 8px 12px; }
@media (max-width: 640px) { .bond-portrait { width: 84px; height: 100px; line-height: 100px; font-size: 2.6rem; } .bond-head { gap: 10px; flex-wrap: nowrap; } .bond-main { min-width: 0; } .talk-log { height: 240px; } .sum-comp { min-width: calc(50% - 4px); } }
/* 휴대폰·태블릿 입력칸은 16px — 그보다 작으면 아이폰이 누를 때 화면을 확대한다 */
@media (pointer: coarse), (max-width: 640px) { .talk-input, .chat-input { font-size: 16px; } }
.bar { height: 7px; border-radius: 4px; background: rgba(255,255,255,0.06); overflow: hidden; margin-top: 5px; }
.bar > span { display: block; height: 100%; border-radius: 4px; background: var(--brand); transition: width 0.35s; }
.bar.hp > span { background: #6ee7a8; } .bar.mp > span { background: #6aa8ff; } .bar.exp > span { background: #c58cff; }

/* 탭은 공용 .tab-bar/.tab-btn 모양을 그대로 쓰고 간격만 이 페이지에 맞춘다 (마법 교실 속성 탭·도구점 종류 탭·전투 마법 탭) */
#class-tabs, #shop-tabs, #codex-tabs { gap: 6px; margin: 0 0 12px; }
.rk-ms { display: block; font-size: 0.66rem; color: var(--text-dim); white-space: nowrap; } /* 랭킹 레벨 칸 아래 숙련 단계 (2026-10-20) — 칸 폭을 넓히지 않게 줄을 내린다 */
#class-tabs .tab-btn, #shop-tabs .tab-btn, #codex-tabs .tab-btn { display: inline-flex; align-items: center; gap: 4px; }

.elem-chip { display: inline-block; font-size: 0.62rem; font-weight: 800; border-radius: 5px; padding: 1px 6px; border: 1px solid; vertical-align: middle; }
.elem-chip.fire { color: #ff8a65; border-color: rgba(255,138,101,0.5); }
.elem-chip.ice { color: #6ad4ff; border-color: rgba(106,212,255,0.5); }
.elem-chip.earth { color: #8bd17c; border-color: rgba(139,209,124,0.5); }
.elem-chip.none { color: #aaa; border-color: rgba(170,170,170,0.4); }
.elem-chip.light { color: #ffe9a8; border-color: rgba(255,233,168,0.5); } /* 빛·어둠 특별 수업 (2026-09-22 5장) */
.elem-chip.dark { color: #b39ddb; border-color: rgba(179,157,219,0.5); }
.state-chip { display: inline-block; font-size: 0.62rem; font-weight: 800; border-radius: 5px; padding: 1px 6px; border: 1px solid rgba(255,255,255,0.18); color: var(--text-dim); vertical-align: middle; }
.state-chip.ok { color: #6ee7a8; border-color: rgba(110,231,168,0.45); }
.state-chip.warn { color: #ffb26a; border-color: rgba(255,178,106,0.45); }
.state-chip.bad { color: #ff9a9a; border-color: rgba(255,154,154,0.45); }
.state-chip.good { color: #6aa8ff; border-color: rgba(106,168,255,0.45); }

/* 교장실 이야기 목록 — 장마다 접고 펼친다(지금 진행 중인 장만 펼쳐 둔다) */
details.chap > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 4px 0; margin: 10px 0 8px; user-select: none; }
details.chap > summary::-webkit-details-marker { display: none; }
details.chap > summary::before { content: "▸"; color: var(--text-dim); display: inline-block; width: 10px; transition: transform 0.15s; }
details.chap[open] > summary::before { transform: rotate(90deg); }
details.chap > summary:hover { color: var(--text-main); }
.chap-count { font-weight: 400; color: var(--text-dim); font-size: 0.72rem; }
.chap-desc { font-weight: 400; opacity: 0.7; }
@media (pointer: coarse) { details.chap > summary { min-height: 34px; } }
/* 목록형 카드 */
.row-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; margin-bottom: 8px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row-card.dim { opacity: 0.55; }
.row-card .rc-emoji { font-size: 1.5rem; flex-shrink: 0; }
.row-card .rc-main { flex: 1; min-width: 180px; }
.row-card .rc-title { font-size: 0.84rem; font-weight: 700; color: var(--text-main); }
.row-card .rc-sub { font-size: 0.72rem; color: var(--text-dim); margin-top: 2px; line-height: 1.6; }
.row-card .rc-right { margin-left: auto; display: flex; gap: 5px; flex-wrap: wrap; align-items: center; }
.row-card .rc-area > img { width: 100%; height: 100%; object-fit: contain; display: block; } /* 도감 자세히 보기 그림 — 원본 크기로 칸을 넘치던 것 */
.lack-txt, .side-note.lack-txt { color: var(--warn); } /* 버튼이 잠긴 이유(모자란 핀·빈사 등) */
.ench-tag { color: var(--brand); font-weight: 800; } /* 마법 부여 단계 +N */
/* 건강센터 카드 */
.hc-text { font-size: 0.76rem; color: var(--text-dim); line-height: 1.7; }
.hc-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.hc-why { font-size: 0.72rem; color: var(--text-dim); margin-top: 6px; line-height: 1.6; }
/* 결과 창 안의 작은 버튼(시련의 탑 '여기서 쉬기') */
.vn-text .mini-btn { font-size: 0.85rem; padding: 8px 16px; margin-top: 6px; }
.reward-box .rw-note { font-size: 0.8em; color: var(--text-dim); }

/* ── 사이 콘텐츠 8종 (2026-09-21) — 과제·의뢰·시련의 탑·연습 대련·도감·조합·마법 부여·별빛 샘 ── */
.q-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.q-row .q-main { flex: 1; min-width: 170px; }
.q-row .bar { height: 8px; }
.q-row .bar.done > span { background: #6ee7a8; }
.q-meta { font-size: 0.72rem; color: var(--text-dim); margin-top: 4px; }
.q-reward { font-size: 0.72rem; color: var(--brand); font-weight: 700; }
.side-note { font-size: 0.72rem; color: var(--text-dim); line-height: 1.7; margin: 8px 0 0; }
.side-stat { display: flex; gap: 14px; flex-wrap: wrap; font-size: 0.78rem; color: var(--text-sub); margin-bottom: 10px; }
.side-stat b { color: var(--text-main); font-size: 0.92rem; }
.codex-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; grid-auto-flow: row dense; }
.codex-detail { grid-column: 1 / -1; }
.codex-detail .row-card { margin: 0; border-color: var(--brand); }
.codex-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px; padding: 8px 6px; text-align: center; cursor: pointer; }
.codex-card.unseen { opacity: 0.4; cursor: default; }
.codex-card.unseen.near { opacity: 0.75; } /* 이미 갈 수 있는 사냥터에 사는 못 만난 몬스터 — 어디서 만나는지 글이 읽히게 (2026-10-20) */
.codex-card.on { border-color: var(--brand); }
.codex-card img { width: 46px; height: 46px; object-fit: contain; }
.codex-card .cx-name { font-size: 0.72rem; font-weight: 700; color: var(--text-main); margin-top: 4px; word-break: keep-all; }
.codex-card .cx-sub { font-size: 0.66rem; color: var(--text-dim); margin-top: 2px; }
.spring-pad { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; max-width: 320px; margin: 12px auto; }
.spring-pad button { height: 74px; border-radius: 14px; border: 2px solid var(--border-strong); font-size: 1.6rem; cursor: pointer; background: var(--bg-card); transition: transform 0.08s, filter 0.15s; }
.spring-pad button:disabled { cursor: default; }
.spring-pad button.lit { filter: brightness(2.1); transform: scale(1.04); }
.spring-pad button[data-c="0"] { border-color: #ff7a45; color: #ff7a45; }
.spring-pad button[data-c="1"] { border-color: #6ad4ff; color: #6ad4ff; }
.spring-pad button[data-c="2"] { border-color: #8bd17c; color: #8bd17c; }
.spring-pad button[data-c="3"] { border-color: #f2c94c; color: #f2c94c; }
.spring-seq { text-align: center; font-size: 0.8rem; color: var(--text-sub); min-height: 22px; }
.ench-slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.mat-chip { display: inline-flex; align-items: center; gap: 4px; background: rgba(255,255,255,0.05); border: 1px solid var(--border); border-radius: 999px; padding: 3px 10px; font-size: 0.72rem; color: var(--text-sub); }
.mat-chip img { width: 18px; height: 18px; object-fit: contain; }
.mat-chip.lack { border-color: rgba(255,120,120,0.5); color: #ff9a9a; }
.tower-next { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tower-next .tn-foe { display: inline-flex; align-items: center; gap: 4px; font-size: 0.74rem; color: var(--text-sub); }
.tower-next .tn-foe img { width: 28px; height: 28px; object-fit: contain; }
/* 신규 콘텐츠 3종 (2026-10-02) — 원정·현상 수배·칭호 */
.title-chip { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 8px; font-size: 0.64rem; font-weight: 800; color: var(--brand); border: 1px solid var(--brand); vertical-align: middle; white-space: nowrap; }
.bounty-stars { color: var(--brand); font-size: 0.9rem; letter-spacing: 1px; margin-right: 4px; }
.bounty-stars .off { color: var(--border-strong); }
.title-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
.title-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; min-width: 0; opacity: 0.6; }
.title-card.on { opacity: 1; }
.title-card.eq { border-color: var(--brand); }
.title-card .tc-group { font-size: 0.62rem; color: var(--text-dim); }
.title-card .tc-name { font-size: 0.84rem; font-weight: 800; color: var(--text-main); word-break: keep-all; }
.title-card .tc-desc { font-size: 0.7rem; color: var(--text-dim); line-height: 1.5; }
.title-card .bar { height: 6px; }
.title-card .mini-btn { align-self: flex-start; }
@media (max-width: 640px) { .title-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.badge-dot { display: inline-block; min-width: 16px; height: 16px; line-height: 16px; border-radius: 999px; background: var(--brand); color: var(--brand-ink); font-size: 0.64rem; font-weight: 800; text-align: center; padding: 0 4px; margin-left: 4px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }
.grid-2 > * { min-width: 0; }
/* 좁은 화면(휴대폰): 창이 화면 밖으로 밀리지 않게, 요약 바는 4칸으로 납작하게 (2026-09-15 고도화)
   2026-09-25: 지도(조작 패드 포함)가 첫 화면 안에 들어오도록 지도 위쪽을 줄인다 — 소개 한 줄·시즌 안내 문장·동료 줄 부가 설명을 숨김 */
@media (max-width: 640px) {
    .ov-overlay { padding: 8px; }
    .ov-box { max-height: 94vh; }
    .ov-body { padding: 10px 10px 14px; overflow-x: hidden; }
    .row-card { padding: 8px 10px; gap: 8px; }
    .row-card .rc-main { min-width: 0; flex-basis: 150px; }
    .row-card .rc-area { width: 72px; height: 72px; line-height: 72px; }
    .page-sub { display: none; }
    /* 요약 칸은 한 줄로 옆으로 밀어 보기 — 두 줄이던 것을 한 줄로 줄여 지도가 첫 화면에 들어오게 (중요한 레벨·체력·마나·핀이 앞) */
    .sum-bar { gap: 6px; margin: 8px -16px; padding: 0 16px 2px; flex-wrap: nowrap; overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: none; }
    .sum-bar::-webkit-scrollbar { display: none; }
    .sum-card { min-width: 0; flex: 0 0 auto; width: 30%; max-width: 124px; padding: 6px 8px; scroll-snap-align: start; }
    .sum-card .sc-value { font-size: 0.82rem; overflow-wrap: anywhere; }
    .sum-card .sc-note { display: none; }
    .sum-comps { gap: 6px; margin: -2px 0 8px; }
    .sum-comp { padding: 6px 8px; gap: 8px; }
    .sum-comp .cp-img, .sum-comp .cp-emoji { width: 32px; height: 38px; line-height: 38px; }
    .sum-comp .cp-sub { display: none; }
    .map-hint { display: none; }
    .map-head { gap: 6px; margin-bottom: 6px; }
    .map-panel { padding: 8px; }
}

/* 캐릭터 카드 */
.char-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.char-emoji { font-size: 2.6rem; }
.char-name { font-size: 1.05rem; font-weight: 800; color: var(--text-main); }
.char-sub { font-size: 0.74rem; color: var(--text-dim); margin-top: 3px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 6px; margin-top: 12px; }
.stat-box { background: rgba(255,255,255,0.03); border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; }
.stat-box .sb-l { font-size: 0.64rem; color: var(--text-dim); }
.stat-box .sb-v { font-size: 0.9rem; font-weight: 800; color: var(--text-main); font-variant-numeric: tabular-nums; }
.equip-row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.equip-slot { flex: 1; min-width: 140px; border: 1px dashed var(--border-strong); border-radius: 8px; padding: 6px 10px; font-size: 0.74rem; color: var(--text-sub); }
.equip-slot b { color: var(--text-main); }
.equip-slot .es-l { font-size: 0.64rem; color: var(--text-dim); }

.data-table { width: 100%; border-collapse: collapse; }
.data-table th { font-size: 0.74rem; color: var(--text-dim); text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.data-table td { font-size: 0.8rem; color: var(--text-sub); padding: 8px 10px; border-bottom: 1px solid rgba(255,255,255,0.04); font-variant-numeric: tabular-nums; white-space: nowrap; }
.data-table tr.rank-1 td { color: #ffd76a; }
.data-table tr.me td { color: var(--brand); font-weight: 700; }
.table-wrap { overflow-x: auto; }
/* 순위표 닉네임 칸 — 긴 닉네임·뱃지는 줄을 넘겨 레벨·점수가 휴대폰 화면 밖으로 밀리지 않게 (속성은 닉네임 옆 칩) */
.data-table td.rk-name { white-space: normal; min-width: 110px; word-break: break-all; }
.data-table td.rk-name .elem-chip { margin-left: 4px; }
@media (max-width: 640px) { .data-table th, .data-table td { padding: 7px 6px; } }

.guide-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; margin-bottom: 12px; }
.guide-card h3 { font-size: 0.92rem; color: var(--brand); margin: 0 0 8px; }
.guide-card p, .guide-card li { font-size: 0.8rem; color: var(--text-sub); line-height: 1.8; }
.guide-card ul { margin: 0; padding-left: 18px; }
.guide-toc { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.guide-card { scroll-margin-top: 8px; }
.guide-card b { color: var(--text-main); }

/* 시즌 */
@media (max-width: 640px) { .hbs-bar { flex-wrap: nowrap; } .hbs-bar .st-long { display: none; } .hbs-bar .st-short { display: inline; } .hbs-text { min-width: 0; } }
.season-badge { display: inline-block; margin-left: 6px; padding: 1px 6px; border-radius: 8px; font-size: 0.66rem; font-weight: 700; background: rgba(255,215,106,0.14); color: #ffd76a; border: 1px solid rgba(255,215,106,0.35); vertical-align: middle; white-space: nowrap; }

/* 결과 상자 (대화창 마지막 단계에 들어간다) */
.reward-box { background: rgba(110,231,168,0.06); border: 1px solid rgba(110,231,168,0.35); border-radius: 10px; padding: 10px 14px; margin-top: 6px; font-size: 0.82rem; color: var(--text-sub); line-height: 1.8; }
.reward-box.lose { background: rgba(255,154,154,0.06); border-color: rgba(255,154,154,0.35); }
.reward-box b { color: var(--text-main); }

/* 대화창 — 화면 한가운데 큰 창(초상 320px·큰 글씨), 프로필·이름·대사·다음 (2026-09-15 사용자 지시: 하단 → 중앙, 크기 5배) */
.vn-bar { display: none; position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(1300px, calc(100% - 24px)); min-height: min(640px, 82vh); max-height: 92vh; z-index: 1100;
    background: rgba(14,16,19,0.97); border: 1px solid var(--border-strong); border-radius: 22px; box-shadow: 0 20px 70px rgba(0,0,0,0.7); padding: 32px 36px; align-items: stretch; gap: 30px; }
.vn-bar.open { display: flex; }
.vn-portrait { width: 320px; height: 320px; align-self: center; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 8rem; }
.vn-portrait img { width: 100%; height: 100%; object-fit: contain; }
.vn-portrait img.icon { padding: 26px; }
.vn-main { flex: 1; min-width: 0; min-height: 0; cursor: pointer; display: flex; flex-direction: column; overflow-y: auto; }
.vn-backdrop { display: none; position: fixed; inset: 0; z-index: 1099; background: rgba(0,0,0,0.4); }
.vn-backdrop.open { display: block; }
.vn-head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.vn-name { font-size: 1.7rem; font-weight: 800; color: var(--brand); }
.vn-title { font-size: 1rem; color: var(--text-dim); }
.vn-step { margin-left: auto; font-size: 0.95rem; color: var(--text-dim); }
.vn-text { font-size: 1.6rem; color: var(--text-main); line-height: 1.8; margin-top: 18px; min-height: 200px; }
.vn-text .reward-box { font-size: 1.15rem; }
.vn-next { align-self: flex-end; flex-shrink: 0; background: var(--brand); border: 1px solid var(--brand); border-radius: 14px; color: var(--brand-ink); font-size: 1.25rem; font-weight: 800; padding: 16px 38px; cursor: pointer; }
@media (max-width: 900px) { .vn-bar { padding: 18px; gap: 16px; min-height: min(520px, 80vh); } .vn-portrait { width: 200px; height: 200px; } .vn-name { font-size: 1.3rem; } .vn-text { font-size: 1.2rem; min-height: 120px; } .vn-next { font-size: 1rem; padding: 12px 24px; } }
@media (max-width: 640px) { .vn-bar { flex-direction: column; padding: 14px; gap: 12px; min-height: 0; } .vn-portrait { width: 140px; height: 140px; } .vn-name { font-size: 1.1rem; } .vn-text { font-size: 1rem; min-height: 80px; } .vn-next { align-self: stretch; } }
/* 이야기 장면 그림 (2026-09-23) — story/ep<N>(화 시작)·ep<N>_end(화 끝)이 있으면 대화창 전체에 깔고, 초상·대사는 아래로 내려 장면 위에 얹는다.
   뒤 배경(vn-backdrop)에는 같은 그림을 흐리게 깔아 창 바깥도 장면 색으로 채운다. 그림이 없는 대화는 예전 모습 그대로 */
.vn-bar.scene { min-height: min(760px, 86vh); align-items: flex-end; background-color: #0b0c0f;
    background-image: linear-gradient(180deg, rgba(11,12,15,0) 34%, rgba(11,12,15,0.5) 58%, rgba(11,12,15,0.94) 100%), var(--vn-scene);
    background-size: cover; background-position: center 30%; background-repeat: no-repeat; }
.vn-bar.scene .vn-portrait { align-self: flex-end; }
.vn-bar.scene .vn-main { max-height: calc(92vh - 64px); background: rgba(11,12,15,0.72); border: 1px solid rgba(255,255,255,0.08); border-radius: 16px; padding: 18px 24px; backdrop-filter: blur(4px); }
.vn-bar.scene .vn-text { min-height: 150px; }
.vn-backdrop.scene { background: #000 var(--vn-scene) center / cover no-repeat; filter: blur(18px) brightness(0.45); transform: scale(1.08); animation: vnSceneIn 0.5s ease; }
@keyframes vnSceneIn { from { opacity: 0; } to { opacity: 1; } }
@media (max-width: 900px) { .vn-bar.scene { min-height: min(620px, 84vh); } }
@media (max-width: 640px) { .vn-bar.scene { align-items: stretch; justify-content: flex-end; min-height: 78vh; } .vn-bar.scene .vn-portrait { align-self: flex-start; } .vn-bar.scene .vn-main { flex: 0 1 auto; padding: 12px 14px; } .vn-bar.scene .vn-text { min-height: 80px; } }

/* 장소 창 (지도 위 오버레이 — 학교·교장실·마법 교실·도구점·가방·게시판·기록·도서관) */
.ov-overlay { display: none; position: fixed; inset: 0; z-index: 900; background: rgba(0,0,0,0.62); align-items: center; justify-content: center; padding: 16px; }
.ov-overlay.open { display: flex; }
.ov-box { background: var(--bg-main, #141414); border: 1px solid var(--border-strong); border-radius: 14px; width: min(1000px, 100%); min-width: 0; max-width: 100%; max-height: 88vh; display: flex; flex-direction: column; overflow: hidden; }
.ov-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.ov-title { font-size: 0.98rem; font-weight: 800; color: var(--text-main); }
.ov-sub { font-size: 0.72rem; color: var(--text-dim); }
.ov-close { margin-left: auto; font-size: 0.76rem; padding: 6px 12px; border-radius: 8px; border: 1px solid var(--border-strong); background: transparent; color: var(--text-sub); cursor: pointer; flex-shrink: 0; white-space: nowrap; }
/* 휴대폰: 제목·닫기는 한 줄, 부제는 그 아래 줄 (동료 창에서 '닫기'가 두 줄로 찌그러지던 것) */
@media (max-width: 640px) { .ov-head { flex-wrap: wrap; row-gap: 2px; padding: 10px 12px; } .ov-title { flex: 1 1 auto; min-width: 0; } .ov-sub { order: 3; flex-basis: 100%; } }
.ov-close:hover { color: var(--text-main); border-color: var(--brand); }
.ov-body { padding: 14px 16px 18px; overflow-y: auto; }
.pane { display: none; }
.pane.open { display: block; }
/* 전투 창 — 같은 오버레이, 대화창(1100) 아래·장소 창(900) 위 */
.bt-overlay { z-index: 950; background: rgba(0,0,0,0.72); }
.bt-box { overflow-y: auto; }
/* 전투 들어가는 화면 전환 (2026-10-26 2.5D 비주얼 강화) — 금빛 소용돌이가 화면을 덮고(in), 가운데 빛줄기가 갈라지며 전투 창이 열린다(out).
   돌아올 때(back)는 짧게 걷히고, 응답이 늦으면(lift) 지금 모습에서 옅어진다. 덮이는 동안(body.bt-warp-hold) 전투 창은 숨긴다.
   대화창(1100) 아래·전투 창(950) 위. 시간은 magic-page.js btWarp와 같은 값 */
.bt-warp { --bw-in: 0.46s; --bw-long: 0.56s; --bw-out: 0.32s; --bw-back: 0.28s; --bw-lift: 0.18s; --bw-ink: rgba(12,8,30,0.94); --bw-glow: rgba(242,201,76,0.5); --bw-core: #fff4c8;
    position: fixed; inset: 0; z-index: 1000; pointer-events: none; overflow: hidden; visibility: hidden; }
.bt-warp.boss { --bw-ink: rgba(32,6,10,0.95); --bw-glow: rgba(255,96,96,0.58); --bw-core: #ffd2c4; }
.bt-warp.in, .bt-warp.out, .bt-warp.back { visibility: visible; }
.bt-warp.in { pointer-events: auto; }
.bt-warp.lift { opacity: 0; transition: opacity var(--bw-lift) ease-out; pointer-events: none; }
.bt-warp::before { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 50% 50%, rgba(12,8,30,0.5) 0, var(--bw-ink) 70%); opacity: 0; }
.bt-warp .bw-swirl { position: absolute; left: 50%; top: 50%; width: 170vmax; height: 170vmax; margin: -85vmax 0 0 -85vmax; border-radius: 50%; opacity: 0;
    background: repeating-conic-gradient(from 0deg, transparent 0deg 9deg, var(--bw-glow) 13deg, transparent 18deg 30deg);
    -webkit-mask-image: radial-gradient(circle, transparent 0 5%, #000 16%, #000 38%, transparent 66%); mask-image: radial-gradient(circle, transparent 0 5%, #000 16%, #000 38%, transparent 66%); }
.bt-warp .bw-slit { position: absolute; left: 50%; top: 0; bottom: 0; width: 3px; margin-left: -1.5px; opacity: 0;
    background: linear-gradient(transparent, var(--bw-core) 28%, #fff 50%, var(--bw-core) 72%, transparent); box-shadow: 0 0 18px 6px var(--bw-glow); }
.bt-warp.in::before { animation: bwCoverIn var(--bw-in) ease-in forwards; }
.bt-warp.in .bw-swirl { animation: bwSwirlIn var(--bw-in) cubic-bezier(0.5, 0, 0.75, 0.4) forwards; }
.bt-warp.in .bw-slit { animation: bwSlitIn var(--bw-in) ease-in forwards; }
.bt-warp.in.long::before, .bt-warp.in.long .bw-swirl, .bt-warp.in.long .bw-slit { animation-duration: var(--bw-long); }
.bt-warp.out::before { animation: bwFadeOut var(--bw-out) ease-out forwards; }
.bt-warp.out .bw-swirl { animation: bwSwirlOut var(--bw-out) ease-out forwards; }
.bt-warp.out .bw-slit { animation: bwSlitOut var(--bw-out) cubic-bezier(0.2, 0.7, 0.3, 1) forwards; }
.bt-warp.back::before { animation: bwBack var(--bw-back) ease-out forwards; }
.bt-warp.back .bw-swirl { animation: bwSwirlBack var(--bw-back) ease-out forwards; }
@keyframes bwCoverIn { from { opacity: 0; backdrop-filter: blur(0); } to { opacity: 1; backdrop-filter: blur(6px); } }
@keyframes bwSwirlIn { from { opacity: 0; transform: scale(0.15) rotate(0deg); } to { opacity: 1; transform: scale(1) rotate(200deg); } }
@keyframes bwSlitIn { 0%, 55% { opacity: 0; transform: scaleY(0); } 100% { opacity: 1; transform: scaleY(1); } }
@keyframes bwFadeOut { from { opacity: 1; } to { opacity: 0; } }
@keyframes bwSwirlOut { from { opacity: 1; transform: scale(1) rotate(200deg); } to { opacity: 0; transform: scale(1.8) rotate(270deg); } }
@keyframes bwSlitOut { from { opacity: 1; transform: scaleX(1); } to { opacity: 0; transform: scaleX(260); } }
@keyframes bwBack { from { opacity: 0.7; } to { opacity: 0; } }
@keyframes bwSwirlBack { from { opacity: 0.55; transform: scale(1.1) rotate(0deg); } to { opacity: 0; transform: scale(0.4) rotate(-90deg); } }
@keyframes bwFadeIn { from { opacity: 0; } to { opacity: 1; } }
body.bt-warp-hold .bt-overlay { visibility: hidden; }
@media (prefers-reduced-motion: reduce) {
    .bt-warp { --bw-in: 0.14s; --bw-long: 0.14s; --bw-out: 0.16s; --bw-back: 0.16s; }
    .bt-warp .bw-swirl, .bt-warp .bw-slit { display: none; }
    .bt-warp.in::before { animation-name: bwFadeIn; }
    /* 전투 배너·숫자는 움직임 없이 나타났다 사라지기만 — 길이는 !important(공용 0.01ms 축소에 눌리면 안 보였다, 2026-10-29) */
    .bt-banner.bt-banner.on { animation-name: btFadeRM; animation-duration: 0.9s !important; } /* 클래스 겹쳐 쓰기 = 아래쪽 원래 규칙보다 우선 */
    .bt-banner.boss.on { animation-duration: 1.4s !important; }
    .u-pop.u-pop { animation-name: btFadeRM; animation-duration: 0.9s !important; }
}
@keyframes btFadeRM { 0% { opacity: 0; } 15%, 75% { opacity: 1; } 100% { opacity: 0; } }

/* 전투 */
.battle { display: none; background: var(--bg-card); padding: 14px 16px; }
.battle.show { display: block; }
.bt-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.bt-title { font-size: 0.95rem; font-weight: 800; color: var(--text-main); }
.bt-turn { font-size: 0.72rem; color: var(--text-dim); }
.bt-right { margin-left: auto; display: flex; gap: 6px; }
.bt-side { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px; }
.bt-vs { text-align: center; font-size: 0.7rem; color: var(--text-dim); margin: 8px 0; letter-spacing: 0.2em; }
.unit { position: relative; display: flex; gap: 8px; align-items: flex-start; border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; background: rgba(255,255,255,0.02); transition: border-color 0.2s, box-shadow 0.2s; }
.unit.enemy { border-color: rgba(255,154,154,0.25); }
.unit.actor { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(242,201,76,0.25); }
.unit.targetable { cursor: pointer; border-color: rgba(106,168,255,0.7); box-shadow: 0 0 0 2px rgba(106,168,255,0.2); }
.unit.targetable:hover { background: rgba(106,168,255,0.08); }
.unit.dead { opacity: 0.35; filter: grayscale(1); }
.unit.hit { animation: shake 0.35s; }
@keyframes shake { 0%,100% { transform: none; } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
/* ── 전투 연출 (2026-09-22 3장 "이펙트 고도화") — 맞은 카드는 직전 마법의 속성 색으로 번쩍, 치명타는 더 세게, 쓰러지면 회색으로 스러진다 ── */
.unit.hit-fire { animation: shake 0.35s, hitFire 0.5s; } .unit.hit-ice { animation: shake 0.35s, hitIce 0.5s; } .unit.hit-earth { animation: shake 0.35s, hitEarth 0.5s; } .unit.hit-none { animation: shake 0.35s, hitNone 0.4s; }
.unit.hit-light { animation: shake 0.35s, hitLight 0.5s; } .unit.hit-dark { animation: shake 0.35s, hitDark 0.5s; } /* 빛·어둠 (2026-09-22 5장) */
@keyframes hitLight { 0% { box-shadow: inset 0 0 0 40px rgba(255,233,168,0.6); } 100% { box-shadow: inset 0 0 0 0 rgba(255,233,168,0); } }
@keyframes hitDark { 0% { box-shadow: inset 0 0 0 40px rgba(120,90,180,0.6); } 100% { box-shadow: inset 0 0 0 0 rgba(120,90,180,0); } }
.unit.hit-crit { animation: shakeHard 0.45s, hitCrit 0.6s; }
@keyframes hitFire { 0% { box-shadow: inset 0 0 0 40px rgba(255,138,101,0.55); } 100% { box-shadow: inset 0 0 0 0 rgba(255,138,101,0); } }
@keyframes hitIce { 0% { box-shadow: inset 0 0 0 40px rgba(106,212,255,0.55); } 100% { box-shadow: inset 0 0 0 0 rgba(106,212,255,0); } }
@keyframes hitEarth { 0% { box-shadow: inset 0 0 0 40px rgba(139,209,124,0.55); } 100% { box-shadow: inset 0 0 0 0 rgba(139,209,124,0); } }
@keyframes hitNone { 0% { box-shadow: inset 0 0 0 40px rgba(255,255,255,0.35); } 100% { box-shadow: inset 0 0 0 0 rgba(255,255,255,0); } }
@keyframes hitCrit { 0% { box-shadow: inset 0 0 0 60px rgba(255,215,106,0.7); } 100% { box-shadow: inset 0 0 0 0 rgba(255,215,106,0); } }
@keyframes shakeHard { 0%,100% { transform: none; } 20% { transform: translate(-7px, 2px); } 40% { transform: translate(6px, -2px); } 60% { transform: translate(-5px, 1px); } 80% { transform: translate(4px, -1px); } }
.unit.dying { animation: dying 0.6s forwards; }
@keyframes dying { 0% { filter: none; opacity: 1; transform: none; } 100% { filter: grayscale(1); opacity: 0.35; transform: translateY(6px) scale(0.97); } }
.battle.boss { box-shadow: inset 0 0 90px rgba(255,80,80,0.18); }
.battle.boss .bt-title { color: #ff9a9a; }
.bt-banner { position: fixed; left: 50%; top: 42%; transform: translate(-50%, -50%) scale(0.85); z-index: 960; pointer-events: none; opacity: 0; font-weight: 900; font-size: 1.9rem; letter-spacing: 0.08em; color: #fff; text-shadow: 0 0 14px rgba(0,0,0,0.9), 0 0 30px currentColor; white-space: nowrap; transition: opacity 0.15s; }
.bt-banner.on { animation: bannerIn 0.9s ease-out forwards; }
.bt-banner.boss { font-size: 3.4rem; letter-spacing: 0.3em; color: #ff6a6a; }
.bt-banner.boss.on { animation: bannerIn 1.4s ease-out forwards; }
.bt-banner.el-fire { color: #ff8a65; } .bt-banner.el-ice { color: #6ad4ff; } .bt-banner.el-earth { color: #8bd17c; } .bt-banner.el-none { color: #ffd76a; }
.bt-banner.el-light { color: #ffe9a8; } .bt-banner.el-dark { color: #b39ddb; } /* 빛·어둠 (2026-09-22 5장) */
@keyframes bannerIn { 0% { opacity: 0; transform: translate(-50%, -50%) scale(0.7); } 18% { opacity: 1; transform: translate(-50%, -50%) scale(1.08); } 30% { transform: translate(-50%, -50%) scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -56%) scale(1); } }
/* 화면 전체 연출 층 — 대사 fx(flash·dark·stars) · body 흔들림(shake·quake) */
.fx-layer { position: fixed; inset: 0; z-index: 1150; pointer-events: none; opacity: 0; }
.fx-layer.fx-flash { background: #fff; } .fx-layer.fx-flash.on { animation: fxFlash 0.5s ease-out forwards; }
@keyframes fxFlash { 0% { opacity: 0; } 8% { opacity: 0.92; } 100% { opacity: 0; } }
.fx-layer.fx-dark { background: #000; } .fx-layer.fx-dark.on { animation: fxDark 0.9s ease-in-out forwards; }
@keyframes fxDark { 0% { opacity: 0; } 35% { opacity: 0.95; } 60% { opacity: 0.95; } 100% { opacity: 0; } }
.fx-layer.fx-quake { background: radial-gradient(ellipse at center, rgba(0,0,0,0) 55%, rgba(0,0,0,0.6) 100%); } .fx-layer.fx-quake.on { animation: fxFlash 0.8s ease-out forwards; }
.fx-layer.fx-stars.on { opacity: 1; }
.fx-layer.fx-stars i { position: absolute; top: -20px; width: 10px; height: 10px; border-radius: 50%; background: #ffe58a; box-shadow: 0 0 12px 4px rgba(255,229,138,0.8); transform: scale(var(--s, 1)); animation: starFall 1.5s ease-in forwards; }
@keyframes starFall { 0% { transform: translateY(0) scale(var(--s, 1)); opacity: 0; } 15% { opacity: 1; } 100% { transform: translateY(110vh) scale(calc(var(--s, 1) * 0.6)); opacity: 0.2; } }
body.fx-shake { animation: bodyShake 0.45s; } body.fx-quake { animation: bodyQuake 0.8s; }
@keyframes bodyShake { 0%,100% { transform: none; } 20% { transform: translate(-5px, 2px); } 40% { transform: translate(5px, -2px); } 60% { transform: translate(-3px, 1px); } 80% { transform: translate(3px, -1px); } }
@keyframes bodyQuake { 0%,100% { transform: none; } 10% { transform: translate(-9px, 4px); } 25% { transform: translate(8px, -5px); } 40% { transform: translate(-7px, 3px); } 55% { transform: translate(6px, -3px); } 70% { transform: translate(-4px, 2px); } 85% { transform: translate(3px, -1px); } }
.u-av { width: 46px; height: 54px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 1.7rem; line-height: 1; }
.u-av img { width: 100%; height: 100%; border-radius: 8px; }
.u-av img.photo { object-fit: cover; object-position: 50% 12%; }
.u-av img.icon { object-fit: contain; background: rgba(255,255,255,0.04); padding: 3px; }
.u-body { flex: 1; min-width: 0; }
.u-name { font-size: 0.8rem; font-weight: 800; color: var(--text-main); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.u-name small { font-weight: 400; color: var(--text-dim); margin-left: 4px; }
.u-bar { position: relative; height: 9px; border-radius: 4px; background: rgba(255,255,255,0.06); overflow: hidden; margin-top: 4px; }
.u-bar > span { display: block; height: 100%; transition: width 0.3s; }
.u-bar.hp > span { background: #6ee7a8; } .u-bar.mp > span { background: #6aa8ff; } .u-bar.gauge { height: 4px; } .u-bar.gauge > span { background: var(--brand); }
.u-bar > i { position: absolute; right: 4px; top: -1px; font-size: 0.56rem; font-style: normal; color: #fff; text-shadow: 0 0 2px #000; line-height: 10px; }
.u-status { margin-top: 4px; display: flex; gap: 3px; flex-wrap: wrap; min-height: 12px; }
.u-status .st { font-size: 0.6rem; border: 1px solid rgba(255,255,255,0.18); border-radius: 4px; padding: 0 4px; color: var(--text-dim); display: inline-flex; align-items: center; gap: 2px; }
.u-status .st.bad { color: #ff9a9a; border-color: rgba(255,154,154,0.45); } .u-status .st.good { color: #6aa8ff; border-color: rgba(106,168,255,0.45); }
.u-pop { position: absolute; left: 50%; top: 4px; transform: translateX(-50%); font-weight: 800; font-size: 0.92rem; pointer-events: none; white-space: nowrap; animation: popUp 0.9s ease-out forwards; text-shadow: 0 0 3px #000; z-index: 2; }
@keyframes popUp { 0% { opacity: 0; transform: translate(-50%, 8px); } 15% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -24px); } }
.u-pop.dmg { color: #ff9a9a; } .u-pop.crit { color: #ffd76a; font-size: 1.1rem; } .u-pop.heal { color: #6ee7a8; } .u-pop.mpv { color: #6aa8ff; } .u-pop.info { color: var(--text-sub); font-size: 0.72rem; }
.bt-actions { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 10px; min-height: 60px; }
.act-title { font-size: 0.82rem; font-weight: 800; color: var(--text-main); margin-bottom: 8px; }
.act-row { display: flex; gap: 6px; flex-wrap: wrap; }
.act-btn { background: transparent; border: 1px solid var(--border-strong); border-radius: 8px; color: var(--text-sub); font-size: 0.78rem; padding: 8px 14px; cursor: pointer; }
.act-btn:hover:not(:disabled) { color: var(--text-main); border-color: var(--brand); }
.act-btn.on { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); font-weight: 800; }
.act-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.act-sub { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.act-item { text-align: left; background: rgba(255,255,255,0.02); border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; cursor: pointer; color: var(--text-sub); min-width: 150px; }
.act-item:hover:not(:disabled) { border-color: var(--brand); color: var(--text-main); }
.act-item:disabled { opacity: 0.4; cursor: not-allowed; }
.act-item.on { border: 2px solid var(--brand); padding: 5px 9px; background: rgba(var(--brand-rgb), 0.12); color: var(--text-main); }
.act-item .ai-t { font-size: 0.78rem; font-weight: 700; color: var(--text-main); display: flex; align-items: center; gap: 5px; }
.act-item .ai-s { font-size: 0.66rem; color: var(--text-dim); margin-top: 1px; }
.act-hint { font-size: 0.72rem; color: #6aa8ff; margin-top: 8px; }
.act-sub .act-hint { flex-basis: 100%; margin-top: 0; } /* 아이템 목록 위 '쓴 소모품 N/5' 줄이 첫 물약 옆에 붙어 보이던 것 */
.act-wait { font-size: 0.76rem; color: var(--text-dim); padding: 8px 0; }
.bt-log { margin-top: 10px; max-height: 130px; overflow-y: auto; font-size: 0.72rem; color: var(--text-dim); line-height: 1.7; background: rgba(0,0,0,0.2); border-radius: 8px; padding: 8px 12px; }
.bt-log div:last-child { color: var(--text-sub); }
/* 휴대폰 2열 — minmax(0,…)이어야 긴 이름·상태 칩이 칸을 밀어 오른쪽 카드가 전투 창 밖으로 잘리지 않는다 (2026-09-25 390px에서 적 카드가 잘려 보이던 것) */
.unit { min-width: 0; }
@media (max-width: 640px) { .bt-side { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; } .u-av { width: 36px; height: 42px; font-size: 1.3rem; } .unit { padding: 6px 8px; gap: 6px; } .u-name { font-size: 0.76rem; }
    .u-bar.hp, .u-bar.mp { height: 12px; } .u-bar > i { font-size: 0.64rem; line-height: 12px; top: 0; } } /* 휴대폰은 막대 속 체력·마나 숫자(9px)가 너무 작아 막대를 조금 키운다 */

/* 탐험 지도 (기본 화면) — 캔버스 높이는 magic-map.js가 [13칸 높이, 화면 100%] 안에서 정한다 */
.map-panel { padding: 12px 14px; display: none; }
.map-panel.show { display: block; }
.map-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.map-name { font-size: 0.92rem; font-weight: 800; color: var(--text-main); }
.map-hint { font-size: 0.7rem; color: var(--text-dim); flex: 0 1 auto; min-width: 0; }
/* 기기별 문구 — 마우스 쪽·손가락 쪽 */
.only-touch { display: none; }
@media (pointer: coarse) { .only-pc { display: none; } .only-touch { display: inline; } li.only-touch { display: list-item; } }
.map-others { font-size: 0.7rem; color: #6aa8ff; }
.map-tools { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.map-sens { display: inline-flex; align-items: center; gap: 6px; font-size: 0.74rem; color: var(--text-sub); }
.map-sens input { width: clamp(56px, 6vw, 96px); accent-color: var(--brand); margin: 0; }
@media (pointer: coarse) { .map-sens { display: none; } }
.map-wrap { width: 100%; }
.map-wrap canvas { display: block; width: 100%; min-height: 240px; border-radius: 10px; border: 1px solid var(--border-strong); background: #0e1013; touch-action: none; outline: none; }
.map-wrap canvas:focus { border-color: var(--brand); }
.map-aim { display: none; position: absolute; left: 50%; top: 50%; width: 6px; height: 6px; margin: -3px 0 0 -3px; border-radius: 50%; background: rgba(255,250,235,0.7); box-shadow: 0 0 0 1.5px rgba(0,0,0,0.45); pointer-events: none; z-index: 2; } /* PC 마우스 시점 조준점 — 괴담 5레벨과 같은 모양 */
.map-wrap.mouse-look .map-aim { display: block; }
/* 조준점 옆 대상 이름 · 지도 위 한 줄 안내(시작·다가가면 할 수 있는 일) — 눌러도 지도에 닿게 pointer-events 없음 */
.map-aim-name { position: absolute; left: calc(50% + 14px); top: 50%; transform: translateY(-50%); z-index: 2; max-width: 45%; padding: 2px 8px; border-radius: 6px; background: rgba(10,14,20,0.72); color: #fff6d8; font-size: clamp(0.76rem, 1.5vmin, 1.5rem); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
.map-prompt { position: absolute; left: 50%; bottom: 12%; transform: translateX(-50%); z-index: 2; max-width: calc(100% - 24px); padding: 6px 14px; border-radius: 999px; background: rgba(10,14,20,0.8); border: 1px solid var(--border-strong); color: var(--text-main); font-size: clamp(0.82rem, 1.8vmin, 1.7rem); font-weight: 700; text-align: center; pointer-events: none; }
.map-aim-name[hidden], .map-prompt[hidden] { display: none; }
.map-hud { position: absolute; left: 10px; top: 10px; z-index: 2; width: clamp(150px, 22%, 40vmin); padding: 6px 10px; border-radius: 8px; background: rgba(10,14,20,0.72); color: var(--text-main); font-size: clamp(0.68rem, 1.3vmin, 1.3rem); pointer-events: none; }
.map-hud[hidden], .mh-todo[hidden] { display: none; }
.mh-row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; }
.mh-row .bar { margin-top: 0; height: 6px; }
.mh-todo { margin-top: 4px; color: #fff6d8; line-height: 1.35; }
.map-mini { position: absolute; top: 10px; right: 10px; z-index: 3; width: clamp(96px, 17%, 22vmin); min-height: 0; max-height: 34%; aspect-ratio: var(--mini-ratio, 1); border: 1px solid var(--border-strong); border-radius: 8px; background: rgba(10,14,20,0.72); pointer-events: none; }
.map-wrap canvas.map-mini { width: clamp(96px, 17%, 22vmin); min-height: 0; }
.map-wrap canvas.map-mini.big { top: 4%; left: 4%; right: auto; width: 92%; height: 92%; max-height: none; aspect-ratio: auto; pointer-events: auto; cursor: pointer; }
.magic-maint { padding: clamp(32px, 10vh, 96px) 16px; text-align: center; }
.magic-maint-title { font-size: clamp(1.1rem, 2.4vw, 1.5rem); font-weight: 700; color: var(--text); margin: 0 0 8px; }
body.maint-on .wrap > :not(.top-row, #magic-maint), body.maint-on :is(.chat-fab, .chat-panel) { display: none; }
/* 2.5D (2026-09-26) — 입체 그림은 밑 캔버스(.map-3d), 이름표·말풍선은 이 캔버스에 겹친다. z-index 없이 DOM 순서로 쌓아 조작 패드가 가려지지 않게 */
#map-canvas { position: relative; }
.map-wrap canvas.map-3d { position: absolute; left: 0; top: 0; pointer-events: none; }
.map-wrap canvas.map-on-3d { background: transparent; }
/* 플로팅 채팅 (zoo.html·dungeon.html 패턴, 2026-09-16) — 손가락 화면은 왼쪽 스틱·오른쪽 말 걸기 단추 위, 오른쪽에. 공용 규칙(style.css)과 같은 선택자라 뒤에 오는 이 값이 이긴다 */
@media (pointer: coarse) { body[data-hb-chat] .chat-fab { left: auto; right: 12px; bottom: 92px; } }
/* 터치 조작 — 가상 스틱 + 말 걸기 (2026-11-03, 예전 9칸 패드 대체) */
.map-wrap { position: relative; min-height: clamp(320px, 52vw, calc(100vh - var(--topbar-h, 0px) - 76px)); } /* 3인칭(2026-11-04) — PC·태블릿에서 16:9 안팎, 고정 바 아래에 도구 줄과 함께 화면 안에 다 들어오게. magic-map.js resize가 이 값을 지도 최소 높이로 읽는다 */
body.hb-immersive .map-wrap { min-height: 0; } /* 전체화면 높이는 magic-map.js resize가 도구 줄을 뺀 값으로 맞춘다 */
@media (max-width: 640px) { .map-wrap { min-height: clamp(320px, 118vw, calc(100vh - 120px)); } } /* 휴대폰 세로 — 가로보다 조금 길게(스틱·말 걸기 단추가 앞을 가리지 않게) */
.stick, .stick-act { display: none; position: absolute; bottom: 12px; touch-action: none; user-select: none; -webkit-user-select: none; }
.stick { left: 12px; width: clamp(104px, 30vw, 132px); aspect-ratio: 1; border-radius: 50%; background: rgba(14,16,19,0.55); border: 1px solid var(--border-strong); }
.stick-knob { position: absolute; left: 50%; top: 50%; width: 44%; aspect-ratio: 1; margin: -22% 0 0 -22%; border-radius: 50%; background: rgba(242,201,76,0.85); box-shadow: 0 2px 8px rgba(0,0,0,0.5); transition: transform 0.15s ease-out; }
.stick.on .stick-knob { transition: none; }
.stick-act { right: 12px; width: 64px; height: 64px; border-radius: 50%; background: rgba(14,16,19,0.82); border: 1px solid var(--border-strong); color: var(--text-main); font-size: 0.72rem; font-weight: 700; padding: 0; }
.stick-act:active { background: rgba(242,201,76,0.35); }
.stick-act.near { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); box-shadow: 0 0 0 3px rgba(242,201,76,0.35); } /* 곁에 건물·표식이 있을 때 */
/* 가로로 눕힌 휴대폰 — 지도부터, 요약은 그 아래 */
@media (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
    .wrap { display: flex; flex-direction: column; padding-top: 4px; }
    .map-panel { order: -1; padding: 4px 8px; }
    .map-head { flex-wrap: nowrap; margin-bottom: 4px; gap: 6px; }
    .map-head .map-hint { display: none; }
    .map-tools { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; min-width: 0; }
    .map-tools .mini-btn { flex-shrink: 0; }
    .map-wrap { min-height: calc(100vh - var(--topbar-h, 0px) - 52px); min-height: calc(100dvh - var(--topbar-h, 0px) - 52px); } /* 도구 줄이 상단 바 뒤로 숨지 않게 그 몫을 뺀다 */
    /* 전투 창 — 세로로 쌓으면 행동 단추가 잘려 적·아군을 나란히 */
    .battle.show { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 8px; padding: 8px 12px; }
    .bt-head, .bt-actions, .bt-log { grid-column: 1 / -1; }
    .bt-head { margin-bottom: 4px; }
    .bt-vs { display: none; }
    .bt-actions { margin-top: 6px; padding-top: 6px; }
}
@media (pointer: coarse) { .stick, .stick-act { display: block; } }
@media (prefers-reduced-motion: reduce) { .stick-knob { transition: none; } }
/* 입체 지도 준비 중 (2026-11-03) — 지도 캔버스 자리를 덮는 로딩 표시(문구는 공용 .empty-state) */
.map-loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; border-radius: 10px; background: #0e1013; }
.map-loading[hidden] { display: none; }
/* 지도 돌리기·기울이기 (2026-11-03) — 조작 패드와 같은 반투명 단추, 지도 오른쪽 위. 가운데 단추의 화살표가 북쪽을 가리킨다 */
/* 손가락 화면 — 작은 버튼도 누르기 쉽게 (공용 기준 34~38px) */
@media (pointer: coarse) {
    .mini-btn, .hbs-bar .hbs-open, .season-box .sx-close, .ov-close, .chat-close { min-height: 36px; }
    .act-btn { min-height: 40px; }
}

/* 그림 자산 — 사진(photo)·그림(raster)·아이콘(SVG) 모두 바탕 없이 투명 배경 그대로 (흰 액자 없음) */
.art-img { object-fit: contain; vertical-align: middle; }
.art-img.raster { object-fit: contain; }
.ico { width: 20px; height: 20px; vertical-align: -5px; }
.ico.photo { object-fit: cover; border-radius: 50%; }
.ico-sm { width: 18px; height: 18px; vertical-align: -4px; }
.ico-xs { width: 13px; height: 13px; vertical-align: -2px; }
.char-img { width: 120px; height: 120px; object-fit: cover; object-position: 50% 12%; border-radius: 14px; flex-shrink: 0; }
.ec-img { width: 100%; height: 150px; object-fit: cover; object-position: 50% 8%; display: block; margin-bottom: 8px; }
.rc-img { width: 44px; height: 52px; object-fit: cover; object-position: 50% 12%; flex-shrink: 0; }
.rc-emoji.art-img { width: 40px; height: 40px; }
.row-card .rc-area { width: 100px; height: 100px; flex-shrink: 0; font-size: 2.4rem; text-align: center; line-height: 100px; } /* 사냥터 카드의 장소 그림 */
.party-note { font-size: 0.74rem; color: var(--text-dim); margin-bottom: 8px; line-height: 1.6; }
.party-note b { color: var(--text-main); }
.comp-vitals { font-size: 0.72rem; color: var(--text-dim); margin-top: 6px; max-width: 260px; }
.comp-vitals .bar { height: 5px; margin-top: 4px; }
.spell-tabs { margin: 0 0 8px; gap: 4px; }
.spell-tabs .tab-btn { font-size: 0.72rem; padding: 4px 10px; }
.row-card.in-party { border-color: rgba(106,168,255,0.55); }
body[data-hb-chat] :is(.chat-fab, .chat-panel) { --chat-accent: #f2c94c; --chat-accent-ink: var(--brand-ink); } /* 채팅 단추·창 공용 규칙(style.css)에 넘기는 이 게임 색 */
