/* 회색 와이어프레임. 판정 범위만 강조색을 쓴다. */
@font-face { font-family: 'Pretendard'; src: url('fonts/Pretendard-Regular.ttf') format('truetype'); font-weight: 400; }
@font-face { font-family: 'Pretendard'; src: url('fonts/Pretendard-SemiBold.ttf') format('truetype'); font-weight: 600; }
@font-face { font-family: 'Pretendard'; src: url('fonts/Pretendard-Bold.ttf') format('truetype'); font-weight: 700; }

:root {
  --bg: #e6e6e6; --panel: #f6f6f6; --line: #9a9a9a; --line-soft: #c4c4c4; --ink: #2b2b2b; --ink-soft: #6b6b6b;
  --hit: #e0603a; --white: #ffffff;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font: 13px/1.45 'Pretendard', system-ui, sans-serif; overflow: hidden; }
button { font: inherit; color: var(--ink); background: var(--panel); border: 1px solid var(--line); padding: 4px 8px; cursor: pointer; }
button:hover { background: #ececec; }
button.on { background: var(--ink); color: var(--white); }
button:disabled { color: #aaa; border-color: var(--line-soft); cursor: default; }
.panel { background: var(--panel); border: 1px solid var(--line); }
.muted { color: var(--ink-soft); }
.temp { border-style: dashed !important; }
.tag { display: inline-block; border: 1px solid var(--line); padding: 0 5px; font-size: 11px; margin-left: 4px; }
.tag.temp { border-style: dashed; }

#boot-error, #boot-wait { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 16px; }
#boot-error[hidden], #boot-wait[hidden] { display: none; }

.screen[hidden] { display: none !important; }

/* 시작 · 설정 · 돌파 설정 */
.menu-screen { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; }
.menu-box { width: min(640px, 92vw); padding: 28px 32px; background: var(--panel); border: 1px solid var(--line); }
.menu-box h1 { font-size: 22px; margin: 0 0 18px; font-weight: 700; }
.menu-box h2 { font-size: 16px; margin: 0 0 14px; font-weight: 700; }
.menu-buttons { display: flex; flex-direction: column; gap: 8px; width: 220px; }
.menu-buttons button { padding: 10px; text-align: left; }
.form-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line-soft); }
.form-row > label:first-child { width: 120px; color: var(--ink-soft); }
.chain-pick { display: flex; gap: 4px; }
.chain-pick button { width: 32px; }
.chain-list { margin: 10px 0 0; padding: 10px 12px; border: 1px solid var(--line-soft); max-height: 220px; overflow: auto; font-size: 12px; }
.chain-list li { margin-bottom: 6px; }

/* 전투 화면 */
#screen-battle { position: fixed; inset: 0; display: grid; grid-template-columns: 1fr 300px; grid-template-rows: 36px 1fr; }
#topbar { grid-column: 1 / 3; display: flex; align-items: center; gap: 14px; padding: 0 12px; border-bottom: 1px solid var(--line); background: var(--panel); white-space: nowrap; overflow: hidden; }
#topbar b { font-weight: 700; }
#stage { position: relative; overflow: hidden; container-type: inline-size; }
#canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#side { grid-row: 2 / 3; grid-column: 2; display: flex; flex-direction: column; border-left: 1px solid var(--line); min-height: 0; }
#devpanel { flex: 1 1 60%; overflow: auto; border: 0; border-bottom: 1px solid var(--line); padding: 8px; }
#log { flex: 1 1 40%; overflow: auto; border: 0; padding: 6px 8px; font-size: 12px; white-space: pre-wrap; }
/* HUD는 무대 위에 겹친다. 빈 곳은 클릭이 캔버스로 지나가게 (좌클릭 공격 · 휠 확대) */
#hud { position: absolute; inset: 0; pointer-events: none; z-index: 3; }

#cycleGuide { position: absolute; top: 8px; left: 8px; padding: 6px 8px; font-size: 12px; max-width: calc(100% - 16px); }
#cycleGuide ol { margin: 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 4px; }
#cycleGuide li { border: 1px solid var(--line-soft); padding: 1px 6px; background: var(--white); }
#cycleGuide li.now { border-color: var(--ink); background: var(--ink); color: var(--white); }
#cycleGuide li.done { color: var(--ink-soft); }

#floaters { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.dmg { position: absolute; transform: translate(-50%, -50%); font-weight: 700; font-size: 13px; color: var(--ink); text-shadow: 0 0 2px #fff, 0 0 2px #fff; white-space: nowrap; }
.dmg.temp { color: var(--ink-soft); font-style: italic; }
.tlabel { position: absolute; transform: translate(-50%, -100%); font-size: 11px; background: rgba(255,255,255,.85); border: 1px solid var(--line-soft); padding: 0 4px; white-space: nowrap; }

/* HUD — 인게임 배치 (2026-11-30, 11 설계). 실선 = 게임 자리 · 점선 = 프로토타입이 정한 자리 · 빈 칸 · 굵은 테두리 = 활성 */
#hudCenter { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 4px; }
.states { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; max-width: 520px; }
.states span { font-size: 11px; color: var(--ink-soft); background: rgba(255,255,255,.85); border: 1px dashed var(--line); padding: 0 6px; white-space: nowrap; }
.circuit { display: flex; align-items: center; gap: 4px; padding: 3px 8px; background: rgba(255,255,255,.7); border: 1px solid var(--line); border-radius: 12px; pointer-events: auto; }
.circuit .bars { display: flex; gap: 2px; }
.circuit .bars i { width: 5px; height: 11px; border: 1px solid var(--line); background: var(--white); transform: skewX(-12deg); }
.circuit .bars i.on { background: var(--ink); border-color: var(--ink); }
.circuit .stars b { font-size: 13px; color: var(--line-soft); font-weight: 400; }
.circuit .stars b.on { color: var(--ink); }
.circuit .heart { font-size: 14px; color: var(--ink-soft); margin: 0 2px; }
.circuit-nums { font-size: 11px; color: var(--ink-soft); background: rgba(255,255,255,.85); border: 1px dashed var(--line); padding: 0 6px; }
.vital { display: flex; align-items: center; gap: 6px; }
.concerto { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; background: var(--white); }
.concerto span { width: 24px; height: 24px; border-radius: 50%; background: var(--white); font-size: 10px; display: flex; align-items: center; justify-content: center; }
.concerto.full { border: 3px solid var(--ink); }
.vital .lv { font-size: 12px; font-weight: 700; background: rgba(255,255,255,.85); padding: 0 4px; }
.hp { position: relative; width: 220px; height: 12px; border: 1px solid var(--line); background: var(--white); }
.hp i { position: absolute; inset: 0; background: #b5b5b5; }
.hp span { position: absolute; inset: 0; font-size: 9px; line-height: 10px; text-align: center; color: var(--ink); }

/* 파티 (오른쪽 가운데) */
#hudParty { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; align-items: flex-end; gap: 8px; pointer-events: auto; }
.party { display: flex; align-items: center; gap: 6px; }
.party .pk { font-weight: 700; font-size: 12px; width: 18px; height: 18px; border: 1px solid var(--line); background: var(--white); display: inline-flex; align-items: center; justify-content: center; }
.party .pic { position: relative; width: 48px; height: 48px; border: 1px solid var(--line); background: var(--panel); overflow: hidden; display: flex; align-items: center; justify-content: center; }
.party .pic img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.party .ph { font-size: 10px; color: var(--ink-soft); text-align: center; }
.party .pn { order: -1; font-size: 11px; background: rgba(255,255,255,.85); padding: 0 4px; }
.party.active .pic { border: 3px solid var(--ink); box-shadow: 0 0 0 2px #fff; }
.party.off { opacity: .45; }
.party-hint { font-size: 10px; color: var(--ink-soft); background: rgba(255,255,255,.85); border: 1px dashed var(--line); padding: 0 4px; white-space: nowrap; }

/* 스킬 (오른쪽 아래) */
#hudRight { position: absolute; right: 12px; bottom: 10px; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.skills { display: flex; gap: 4px; align-items: flex-start; pointer-events: auto; }
.skillbox { width: 60px; display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; }
.skillbox .ic { position: relative; width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line); background: var(--white); display: flex; align-items: center; justify-content: center; }
.skillbox .k { font-weight: 700; font-size: 13px; }
.skillbox[data-slot="basic"] .k { font-size: 11px; }
.skillbox .nm { font-size: 10px; line-height: 1.25; background: rgba(255,255,255,.85); padding: 0 2px; max-width: 60px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.skillbox .sub { font-size: 10px; color: var(--ink-soft); background: rgba(255,255,255,.85); padding: 0 3px; white-space: nowrap; }
.skillbox[data-slot="basic"] { width: 66px; }
.skillbox .sub[hidden] { display: none; }
.skillbox.proto .ic { border-style: dashed; }
.skillbox.off { color: #aaa; }
.skillbox.off .ic { border-color: var(--line-soft); background: #f1f1f1; }
.skillbox.active .ic { border: 3px solid var(--ink); box-shadow: 0 0 0 2px #fff, 0 0 0 3px var(--ink); }
.hud-legend { font-size: 10px; color: var(--ink-soft); background: rgba(255,255,255,.85); padding: 0 4px; }

/* 무대가 좁을 때 (개발용 패널을 연 작은 창): 게이지를 왼쪽 아래로, 더 좁으면 HUD를 조금 줄임 — 스킬 칸과 안 겹치게 */
@container (max-width: 940px) {
  #hudCenter { left: 12px; transform: none; align-items: flex-start; }
  .states { justify-content: flex-start; max-width: 300px; }
}
@container (max-width: 760px) {
  #hudCenter, #hudRight, #hudParty { zoom: 0.8; }
  .states { max-width: 260px; }
}

/* 스태미나 (캐릭터 옆, 가득이 아닐 때만) — 최대치 · 회복 임시라 점선 */
.stamina { position: absolute; width: 64px; height: 64px; transform: translate(-50%, -50%); pointer-events: none; }
.stamina svg { width: 100%; height: 100%; }
.stamina path { fill: none; stroke-width: 3; stroke-linecap: round; }
.stamina .track { stroke: var(--line-soft); stroke-dasharray: 3 2; }
.stamina .fill { stroke: var(--ink); }
/* 엑소스트라이더 미리 읽는 중: [시작] 잠금 + 안내 줄 (PC 전용) */
body.exo-loading [data-go="battle"] { pointer-events: none; opacity: 0.45; }
.exo-status { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 50; padding: 6px 12px; font-size: 12px; color: var(--ink); background: rgba(255,255,255,.92); border: 1px dashed var(--line); }
.exo-status[hidden] { display: none; }
/* 넘쳐 흐르는 찬란한 빛 (메카 체공 게이지): 캐릭터 오른쪽 세로 막대, 점선 = 200 */
.radiant { position: absolute; width: 7px; height: 46px; transform: translate(-50%, -50%); border: 1px solid var(--line); background: rgba(255,255,255,.9); pointer-events: none; }
.radiant .fill { position: absolute; left: 0; right: 0; bottom: 0; background: var(--ink); }
.radiant .mark { position: absolute; left: -4px; right: -4px; bottom: 33.3%; border-top: 1px dashed var(--ink); }
.radiant.low .fill { background: var(--hit); }
.radiant.blink { animation: radiantBlink 0.6s steps(2) infinite; }
@keyframes radiantBlink { 50% { opacity: 0.3; } }
@media (prefers-reduced-motion: reduce) { .radiant.blink { animation: none; opacity: 0.6; } }

/* 개발용 패널 */
.dev-group { margin-bottom: 10px; }
.dev-group h3 { font-size: 12px; margin: 0 0 4px; color: var(--ink-soft); font-weight: 600; }
.dev-group .btns { display: flex; flex-wrap: wrap; gap: 4px; }
.dev-group button { padding: 2px 6px; font-size: 12px; }

/* ── UI 부품 (이름은 우디디자인랩 「UI 미니 사전」 기준) ───────────────────── */

/* 스피너 · 오류 화면 */
.spinner { width: 28px; height: 28px; border: 3px solid var(--line-soft); border-top-color: var(--ink); border-radius: 50%; animation: am-spin 0.8s linear infinite; }
@keyframes am-spin { to { transform: rotate(360deg); } }
#boot-wait { gap: 12px; }
.error-box { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 24px 28px; background: var(--panel); border: 1px solid var(--line); }
.busy { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 10px; background: rgba(255,255,255,0.6); z-index: 6; }
.busy[hidden] { display: none; }

/* 세그먼트 · 스위치 · 스테퍼 */
.seg { display: inline-flex; }
.seg button { margin: 0; }
.seg button + button { margin-left: -1px; }
.switch { position: relative; width: 36px; height: 20px; padding: 0; border-radius: 10px; background: var(--white); }
.switch i { position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--line); transition: left 0.12s; }
.switch.on { background: var(--ink); border-color: var(--ink); }
.switch.on i { left: 18px; background: var(--white); }
.sw-label { font-size: 12px; color: var(--ink-soft); min-width: 18px; }
.stepper { display: inline-flex; align-items: center; }
.stepper button { width: 28px; padding: 4px 0; }
.stepper .val { min-width: 34px; text-align: center; font-weight: 700; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 4px 0; background: var(--white); }

/* 잠김 상태 */
.chain-list li.locked { color: #9a9a9a; }
.chain-list li.locked b { font-weight: 600; }

/* 단계 표시 (추천 사이클) */
.steps { display: flex; align-items: center; flex-wrap: wrap; }
.step-num { width: 22px; height: 22px; border: 1px solid var(--line); border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; background: var(--white); }
.step-num.done { background: #b9b9b9; color: var(--white); border-color: #b9b9b9; }
.step-num.now { background: var(--ink); color: var(--white); border-color: var(--ink); }
.steps i.bar { width: 12px; height: 1px; background: var(--line); }
.step-label { margin-left: 10px; font-weight: 600; }

/* 스킬 박스: 원형 진행(쿨타임) · 뱃지 — 둥근 버튼 둘레에 */
.skillbox { position: relative; }
.skillbox .ring { position: absolute; inset: -5px; width: calc(100% + 10px); height: calc(100% + 10px); transform: rotate(-90deg); pointer-events: none; }
.skillbox .ring circle { fill: none; stroke-width: 1.6; }
.skillbox .ring .track { stroke: transparent; }
.skillbox .ring .fill { stroke: var(--ink); }
.skillbox .badge { position: absolute; top: -8px; right: -10px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; background: var(--ink); color: var(--white); font-size: 11px; line-height: 18px; text-align: center; }
.skillbox .badge[hidden] { display: none; }

/* 툴팁 */
#tooltip { position: fixed; z-index: 50; max-width: 320px; padding: 7px 10px; background: var(--white); border: 1px solid var(--ink); font-size: 12px; line-height: 1.6; box-shadow: 0 2px 8px rgba(0,0,0,0.15); pointer-events: none; }
#tooltip[hidden] { display: none; }

/* 토스트 */
#toasts { position: absolute; top: 64px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; z-index: 5; pointer-events: none; }
.toast { padding: 6px 14px; border-radius: 16px; background: #3a3a3a; color: var(--white); font-size: 13px; white-space: nowrap; }
.toast.error { background: var(--white); color: var(--ink); border: 1px solid var(--ink); }

/* 코치마크 */
.coach { position: fixed; inset: 0; z-index: 60; }
.coach-hole { position: fixed; border: 2px solid var(--white); border-radius: 4px; box-shadow: 0 0 0 9999px rgba(0,0,0,0.45); pointer-events: none; }
.coach-bubble { position: fixed; max-width: 300px; padding: 10px 12px; background: var(--white); border: 1px solid var(--ink); font-size: 13px; }

/* 드로어 · 상단 탭 (개발용 패널) */
#sideHead { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px 4px 8px; border-bottom: 1px solid var(--line); background: var(--panel); }
#sideHead b { font-size: 12px; }
#sideHead button { padding: 2px 8px; font-size: 12px; }
#screen-battle.drawer-closed { grid-template-columns: 1fr 34px; }
#screen-battle.drawer-closed #devpanel, #screen-battle.drawer-closed #log, #screen-battle.drawer-closed #sideHead b { display: none; }
#screen-battle.drawer-closed #sideHead { justify-content: center; padding: 4px 0; border-bottom: 0; }
.dev-tabs { display: flex; margin: -8px -8px 10px; border-bottom: 1px solid var(--line); }
.dev-tabs button { flex: 1; border: 0; border-bottom: 2px solid transparent; background: transparent; padding: 6px 2px; font-size: 12px; }
.dev-tabs button.on { background: transparent; color: var(--ink); border-bottom-color: var(--ink); font-weight: 700; }

/* ── 2026-11-29 인스타 학습 반영 (우디 · 강사 피드백) — 회색 와이어프레임 유지, 색 · 장식은 늘리지 않음 ── */

/* 버튼 위계: 눌러야 할 버튼 하나만 채움 (강사 「눌러야 할 버튼을 누르게」) */
button.primary { background: var(--ink); color: var(--white); border-color: var(--ink); font-weight: 700; }
button.primary:hover { background: #444; }
/* 버튼 상태: 눌림 · 포커스 (우디 「버튼 상태 9」) */
button:active:not(:disabled) { transform: translateY(1px); }
button:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* 화면 등장: 페이드 업 180ms 이즈 아웃 (너무 느리지도 빠르지도 않게) */
@keyframes am-enter { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes am-fade { from { opacity: 0; } to { opacity: 1; } }
.screen.enter .menu-box { animation: am-enter 0.18s ease-out; }
#screen-battle.enter #stage { animation: am-fade 0.22s ease-out; }

/* 토스트 등장: 아래서 쓱 (사라질 때는 hud.js가 흐리게) */
@keyframes am-toast-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.toast { animation: am-toast-in 0.16s ease-out; }
#tooltip:not([hidden]) { animation: am-fade 0.12s ease-out; }
.coach-bubble { animation: am-enter 0.18s ease-out; }

/* 피해 숫자 크기 = 스킬 단계 (평타 1 … 종결 5) */
.dmg.t2 { font-size: 15px; }
.dmg.t3 { font-size: 17px; }
.dmg.t4 { font-size: 20px; }
.dmg.t5 { font-size: 24px; }

/* 움직임 줄이기 설정을 켠 PC에서는 움직임을 끈다 */
@media (prefers-reduced-motion: reduce) {
  .screen.enter .menu-box, #screen-battle.enter #stage, .toast, #tooltip:not([hidden]), .coach-bubble { animation: none; }
  button:active:not(:disabled) { transform: none; }
}
