/* 색·글꼴은 목업과 같게(global-constraints). 모바일 우선, 1024px 이상은 왼쪽 메뉴 + 여러 단 */
:root {
  color-scheme: dark;
  --bg: #111315; --surface: #1a1d20; --line: #30353a; --text: #e6e3da; --muted: #a3a89f;
  --soft: #c9cdc5; --faint: #949991; /* 청록 바탕(--action-bg)에서도 4.85:1 */ --track: #22262a; --raised: #22262a; --btn-line: #3c4248;
  --nav: #15181a; --sheet: #1d2124; --link: #8fd3c7;
  --action: #4fb5a5; --action-ink: #0d1716; --action-bg: #15302c;
  --warn: #e3b341; --danger: #ef7a63; /* UX 16: #e5664f는 청록 바탕에서 4.26:1 → 모든 바탕에서 5:1 이상 */ --good: #8cc26a; --pmc: #6fa3d6; --scav: #b7b26a;
  /* 희귀도 5단계: 흔함 · 보통 · 드묾 · 희귀 · 매우 희귀 */
  --r0: #a3a89f; --r1: #8cc26a; --r2: #6fa3d6; --r3: #b9a6e8; --r4: #e8a24a;
  --cell: 48px;
  /* UI 개선 B: 성공 안내 · 팁 칸 · 가는 줄 · 도착 테두리 · 맞은 부위 반짝임 */
  --good-bg: #17261c; --good-line: #2f5a37; --good-ink: #a9d38c; --info-line: #2c4a44; --rule: #262a2e; --here-line: #355a52; --hit-bg: #45201b;
}
.r0 { --rc: var(--r0); } .r1 { --rc: var(--r1); } .r2 { --rc: var(--r2); } .r3 { --rc: var(--r3); } .r4 { --rc: var(--r4); }

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: 'Noto Sans KR', sans-serif; font-size: 14px; line-height: 1.5; }
button, input { font: inherit; color: inherit; }
button {
  cursor: pointer; min-height: 44px; padding: 0 12px; border-radius: 6px;
  border: 1px solid var(--btn-line); background: var(--raised); font-weight: 700; font-size: 13px;
}
button:focus-visible, input:focus-visible, summary:focus-visible { outline: 2px solid var(--action); outline-offset: 1px; } /* UX 26: summary도 */
input[type=text], input[type=search], input[type=number] {
  min-height: 44px; min-width: 0; padding: 0 10px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface);
}
h1 { margin: 0; font-family: 'Black Han Sans', sans-serif; font-weight: 400; font-size: 26px; line-height: 1.2; }
h2 { margin: 0; font-size: 14px; }
p { margin: 0; }
footer { color: var(--faint); font-size: 12px; line-height: 1.5; padding: 16px; }

/* 글자 */
.muted { color: var(--muted); } .soft { color: var(--soft); } .faint { color: var(--faint); }
.small { font-size: 13px; } .tiny { font-size: 12px; } /* UX 15: 확률 · 이유 · 시간이 들어가는 글은 12px 이상 */
.mono { font-family: 'JetBrains Mono', monospace; }
.right { text-align: right; } .accent { color: var(--link); }
.warn { color: var(--warn); } .danger { color: var(--danger); } .good { color: var(--good); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.label { font-size: 13px; font-weight: 700; color: var(--muted); letter-spacing: 0.06em; }

/* 틀 */
.screen { display: flex; flex-direction: column; gap: 18px; padding: 24px 16px 16px; max-width: 1180px; }
.group { display: flex; flex-direction: column; gap: 8px; }
.head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.head.left { justify-content: flex-start; align-items: center; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.row.gap { justify-content: flex-end; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.spacer { flex: 1; }
.card { display: flex; flex-direction: column; gap: 6px; padding: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; text-align: left; font-weight: 400; font-size: 14px; }
.card.row { flex-direction: row; }
.card.line { display: block; }
.panel { gap: 8px; border-radius: 8px; padding: 14px; }
.stat { display: flex; flex-direction: column; gap: 2px; padding: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; }
.stat .mono { font-size: 15px; font-weight: 600; }
.bar { height: 6px; background: var(--track); border-radius: 3px; overflow: hidden; }
.bar > div { height: 100%; background: var(--muted); }
.bar.pmc > div { background: var(--pmc); } .bar.warn > div { background: var(--warn); }
.job .bar { height: 4px; }
.note { position: sticky; top: 0; z-index: 20; padding: 10px 16px; background: #2a2119; border-bottom: 1px solid #5a4424; color: #f0c98a; font-size: 13px; }
.note:empty { padding: 0; border: 0; } /* 숨기지 않는다: 화면 읽기 프로그램이 늘 지켜보는 칸 */
.off { margin: 0; padding: 8px 16px; background: #2a2119; color: #f0c98a; font-size: 12px; }
h1[tabindex='-1']:focus { outline: none; }

/* 버튼 종류 */
.primary { background: var(--action); color: var(--action-ink); border: 0; font-size: 16px; min-height: 52px; }
.ghost { background: transparent; }
.link { background: transparent; border: 0; padding: 0; font-weight: 400; font-size: 14px; color: var(--soft); }
.small-btn { font-size: 12px; padding: 0 10px; }
.danger { border-color: var(--danger); }
button.danger { color: var(--danger); }
.sortie { display: flex; justify-content: space-between; align-items: center; min-height: 56px; padding: 0 16px; font-size: 13px; font-weight: 400; }
.sortie b { font-size: 17px; }
.scav { border: 1px solid #6f6c3a; background: #1c1d14; color: #d8d49a; min-height: 52px; }
.choice { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 12px 14px; min-height: 64px; text-align: left; font-weight: 400; border-color: var(--line); background: var(--surface); }
.choice b { font-size: 16px; }
.choice .row { width: 100%; }
.choice[aria-pressed=true] { border-color: var(--action); background: var(--action-bg); }
.back { width: 44px; padding: 0; border: 0; background: transparent; color: var(--soft); display: flex; align-items: center; justify-content: center; }

/* 메뉴: 모바일은 아래 5탭, 넓은 화면은 왼쪽 */
#app.has-nav { padding-bottom: 64px; }
#app.has-nav + footer { padding-bottom: 80px; }
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); height: 64px; border-top: 1px solid var(--line); background: var(--nav); }
.tabs button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border: 0; border-radius: 0; background: transparent; padding: 0; font-size: 12px; font-weight: 400; color: var(--muted); }
.tabs button[aria-current=page] { color: var(--action); }
.tabs .brand, .tabs .who { display: none; }

/* 시작 */
.start { max-width: 520px; min-height: calc(100vh - 80px); gap: 24px; padding-top: 44px; margin: 0 auto; }
.brand-block { display: flex; flex-direction: column; gap: 6px; }
.kicker { font-family: 'JetBrains Mono', monospace; font-size: 12px; letter-spacing: 0.12em; color: var(--muted); }
h1.big { font-size: 44px; line-height: 1.08; }
.continue { padding: 16px; }
.continue b { font-size: 16px; }
.continue .row { width: 100%; }

/* 창고 */
.search { display: flex; }
.search input { flex: 1; }
.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chip { flex: 0 0 auto; min-width: 44px; border-radius: 22px; font-size: 13px; background: var(--surface); }
.chip[aria-pressed=true], .seg button[aria-pressed=true] { border-color: var(--action); background: var(--action-bg); }
.seg { display: inline-flex; gap: 4px; }
.list { display: flex; flex-direction: column; gap: 4px; }
.item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; width: 100%; text-align: left; font-weight: 400; background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--rc, var(--line)); }
.item[aria-pressed=true] { border-color: var(--action); border-left-color: var(--rc, var(--action)); }
.item .size { flex: 0 0 34px; font-size: 12px; color: var(--muted); text-align: center; }
.item .mid { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.item .name { font-size: 13px; }
.item .price { font-size: 12px; color: var(--soft); white-space: nowrap; }
.tags { display: flex; gap: 5px; flex-wrap: wrap; }
.tag { font-size: 12px; padding: 0 5px; border-radius: 4px; background: var(--track); color: var(--soft); }
.tag.fir { background: #24331f; color: #a9d38c; } .tag.use { background: #33291a; color: #e8c374; }
b.name { font-size: 16px; color: var(--rc, var(--text)); }
.use { color: #e8c374; }
.hint { color: var(--link); }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }
.actions button { flex: 1 1 70px; white-space: nowrap; }
.slot { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12px; padding: 3px 0; border-bottom: 1px solid #262a2e; }
.slot > .muted { flex: 0 0 auto; white-space: nowrap; }
.slot .right { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.panel .row input { flex: 1; }
.stash-side { display: flex; flex-direction: column; gap: 12px; }
.detail.empty { display: none; }
.detail.sheet { position: fixed; left: 0; right: 0; bottom: 64px; z-index: 5; max-height: 60vh; overflow-y: auto; border-radius: 0; border: 0; border-top: 1px solid var(--btn-line); background: var(--sheet); box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.4); }
.grid-wrap { overflow-x: auto; }
.stash-grid { position: relative; background-color: var(--nav); background-image: linear-gradient(#262a2e 1px, transparent 1px), linear-gradient(90deg, #262a2e 1px, transparent 1px); background-size: var(--cell) var(--cell); border: 1px solid var(--line); }
.cell { position: absolute; min-height: 0; padding: 3px; display: flex; flex-direction: column; justify-content: space-between; align-items: stretch; text-align: left; border-radius: 3px; border: 1px solid var(--btn-line); border-left: 3px solid var(--rc, var(--btn-line)); background: #2b3035; font-size: 11px; line-height: 1.2; overflow: hidden; }
.cell .cn { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; word-break: break-all; }
.cell .cq { display: flex; justify-content: space-between; gap: 3px; }
.cell .fir { font-size: 10px; color: #a9d38c; }
.cell .mono { font-weight: 400; color: var(--soft); }
.cell.on { outline: 2px solid var(--warn); outline-offset: -2px; z-index: 1; }
.cell.dim { opacity: 0.25; }
.cell[data-cat=weapon] { background: #2b3540; } .cell[data-cat=ammo] { background: #283338; } .cell[data-cat=armor] { background: #2c3729; }
.cell[data-cat=med] { background: #3b2626; } .cell[data-cat=food] { background: #3a3322; } .cell[data-cat=barter] { background: #2e2a38; }
.cell[data-cat=key] { background: #3a3418; } .cell[data-cat=valuable] { background: #3a2e1c; } .cell[data-cat=quest] { background: #2a3330; }

/* 캐릭터 */
.parts { gap: 4px 12px; }
.part { display: flex; justify-content: space-between; font-size: 12px; padding: 3px 6px; border-radius: 4px; }
.part.ok { background: #1f2a24; } .part.ok .mono { color: #a9d38c; }
.part.hurt { background: #33291a; } .part.hurt .mono { color: #e8c374; }
.part.bad { background: #3a1d19; } .part.bad .mono { color: #f0a091; }
.tabbar { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); border-bottom: 1px solid var(--line); }
.tabbar button { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: transparent; color: var(--muted); }
.tabbar button[aria-selected=true] { border-bottom-color: var(--action); color: var(--text); }
.skill { padding: 10px 12px; gap: 5px; }
.skill .bar { height: 4px; }
.skill b { font-size: 14px; }

/* 넓은 화면 */
@media (min-width: 1024px) {
  #app.has-nav { padding: 0 0 0 220px; }
  #app.has-nav + footer { padding: 16px 24px 16px 244px; }
  .tabs { top: 0; right: auto; width: 220px; height: auto; display: flex; flex-direction: column; gap: 4px; padding: 20px 12px; border-top: 0; border-right: 1px solid var(--line); }
  .tabs .brand { display: block; font-family: 'Black Han Sans', sans-serif; font-size: 20px; padding: 0 10px 12px; }
  .tabs button { flex-direction: row; justify-content: flex-start; gap: 10px; min-height: 44px; padding: 0 12px; border-radius: 6px; font-size: 14px; font-weight: 700; color: var(--soft); }
  .tabs button[aria-current=page] { color: var(--action); background: var(--action-bg); }
  .tabs .who { display: block; margin-top: auto; padding: 12px 10px 0; font-size: 12px; line-height: 1.7; color: var(--muted); }
  .screen { padding: 20px 24px; }
  .stash { display: grid; grid-template-columns: minmax(0, 1fr) 360px; align-items: start; }
  .stash-main { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
  .stash-side { position: sticky; top: 20px; }
  .chips { flex-wrap: wrap; overflow: visible; }
  .detail.empty { display: flex; }
  .detail.sheet { position: static; max-height: none; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: none; }
}
@media (max-width: 1023px) {
  .stash-main { display: flex; flex-direction: column; gap: 8px; }
}

/* ── 레이드 공통 ── */
.bar.good > div { background: var(--good); } .bar.danger > div { background: var(--danger); }
.group.tight { gap: 2px; }
.mode-pmc { color: var(--pmc); } .mode-scav { color: var(--scav); }
.sticky-foot { position: sticky; bottom: 0; z-index: 4; display: flex; flex-direction: column; gap: 6px; margin: 0 -16px -16px; padding: 12px 16px 16px; background: var(--nav); border-top: 1px solid var(--line); }
.vital { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.parts7 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 3px; } /* 4칸 2줄: 부위 이름 12px가 390px에서도 한 줄에 */
.parts7 .part { flex-direction: column; align-items: center; gap: 0; padding: 3px 0; font-size: 12px; word-break: keep-all; text-align: center; }
.parts7 .part .mono { font-size: 12px; }
.part.dead { text-decoration: line-through; }
.chips-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.cond { padding: 1px 8px; border-radius: 10px; background: #3a1d19; color: #f0a091; }
.cond.frac { background: #3a2a19; color: #f0c891; }
.qmark { display: inline-block; min-width: 16px; padding: 0 3px; border-radius: 8px; background: var(--warn); color: #1a1406; font-size: 12px; font-weight: 700; text-align: center; line-height: 16px; }
.hot { background: #3a1d19; color: #f6c2b8; border-color: #6a3029; }
.combat-btns .hot { background: var(--danger); color: #1a0d0b; border: 0; font-size: 16px; min-height: 52px; }
.combat-btns .hot:disabled { opacity: 1; background: var(--raised); color: var(--danger); border: 1px dashed var(--danger); } /* 막힌 사격(과열 걸림 · 탄 없음): 이유 글이 읽히게(2.4:1 → 5:1 이상) */
button:disabled { cursor: default; opacity: 0.45; }

/* 레이드 위 */
.raid { gap: 12px; }
.raid-top { display: flex; flex-direction: column; gap: 6px; margin: -24px -16px 0; padding: 12px 16px 8px; background: var(--nav); border-bottom: 1px solid var(--line); }
.raid-top h1 { font-family: 'Noto Sans KR', sans-serif; font-weight: 700; font-size: 16px; }
.raid-top .clock { font-size: 14px; white-space: nowrap; }
.raid-cols { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.pane { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.pane.p-status { gap: 8px; }
.raid-tabs button { position: relative; font-size: 13px; font-weight: 700; }
.badge { margin-left: 4px; padding: 0 5px; border-radius: 8px; background: #3a1d19; color: #f0a091; font-size: 12px; }
h2.place { font-size: 18px; }

/* 현재 장소 */
.spot { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; }
.spot .mid, .need .mid { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.spot.done { background: transparent; }
.spot.exit { border-color: #355a52; }
.spot.quest { border-color: #5a4a1e; }
.spot .small-btn, .need .small-btn { flex: 0 0 auto; max-width: 52%; white-space: normal; line-height: 1.25; }
.event { display: flex; flex-direction: column; gap: 8px; padding: 12px; background: #1d1716; border: 1px solid #4a2a26; border-radius: 8px; }
.event p { font-size: 14px; line-height: 1.65; }
.event.wait { background: #15231f; border-color: #355a52; }
.ev-k { font-size: 12px; color: #f0a091; } .event.wait .ev-k { color: var(--link); }
.nearby { display: flex; flex-wrap: wrap; gap: 6px; }
.nearby .go { border-color: #355a52; background: #1f2a26; font-weight: 400; }
.log { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.log li { display: flex; gap: 8px; font-size: 12px; line-height: 1.55; color: var(--muted); }
.log li .mono { flex: 0 0 auto; }

/* 지도 판 */
.board { height: 300px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--nav); cursor: grab; }
.board-in { position: relative; }
.edges { position: absolute; left: 0; top: 0; pointer-events: none; }
.edge { stroke: #2f353a; } .edge.on { stroke: var(--action); }
.zl { position: absolute; font-size: 12px; color: var(--faint); white-space: nowrap; pointer-events: none; }
.pin { position: absolute; display: flex; flex-direction: column; }
.pin.stack { padding: 3px 0; border: 1px dashed #4a5056; border-radius: 8px; background: #181b1e; }
.chip-p { position: relative; width: 100%; min-height: 44px; height: 44px; padding: 0 4px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; border-radius: 6px; border: 1px solid var(--btn-line); background: #1f2326; font-weight: 400; }
.pin.stack .chip-p { border-radius: 0; border-width: 0 0 1px; background: transparent; }
.pin.stack .chip-p:last-child { border-bottom: 0; }
.chip-p .cn { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 700; line-height: 1.2; }
.chip-p .ct { font-size: 12px; line-height: 1.2; min-height: 14px; white-space: nowrap; }
.chip-p.cur { border: 2px solid var(--action); background: var(--action-bg); }
.chip-p.sel { outline: 2px solid var(--warn); outline-offset: -2px; }
.chip-p .q { position: absolute; top: -6px; right: -6px; }
.ct.ok, .ct.here { color: var(--link); } .ct.warn { color: var(--warn); } .ct.secret { color: var(--r3); } .ct.faint { color: var(--faint); } .ct.danger { color: #f0a091; } .ct.q { color: var(--warn); }
.legend { display: flex; flex-wrap: wrap; gap: 4px 10px; }
.sel-place { gap: 6px; }

/* 회복 · 소모품 · 퀘스트 */
.need { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: #1d1716; border: 1px solid #4a2a26; border-radius: 6px; }
.need .why { color: #c9b3ae; }
.okbox { padding: 12px; border-radius: 6px; background: #1f2a24; color: #a9d38c; font-size: 13px; }
.buffs { display: flex; flex-direction: column; gap: 4px; padding: 8px 12px; border-radius: 6px; background: #1f2a3a; color: #9cc3e8; font-size: 12px; }
.buffs.later { background: #2a2419; color: #f0c891; }
.stim { gap: 4px; }
.quest-line { display: flex; flex-direction: column; gap: 3px; padding: 8px 0; border-bottom: 1px solid #262a2e; font-size: 13px; }
.hint-box summary { cursor: pointer; min-height: 44px; padding: 13px 0; box-sizing: border-box; }
.hint-box p { overflow-wrap: anywhere; line-height: 1.6; }

/* 모바일: 고른 탭만 */
@media (max-width: 1023px) {
  .raid-cols > .col { display: contents; }
  .raid .pane:not(.p-status) { display: none; }
  .raid[data-tab=zone] .p-zone, .raid[data-tab=map] .p-map, .raid[data-tab=map] .p-quests,
  .raid[data-tab=heal] .p-heal, .raid[data-tab=use] .p-use, .raid[data-tab=use] .p-gear { display: flex; }
}

/* ── 출격 준비 ── */
.seg.mode { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; background: var(--surface); border-radius: 8px; }
.seg.mode button { border: 0; font-size: 15px; background: transparent; color: var(--soft); }
.seg.mode .mode-pmc[aria-pressed=true] { background: var(--pmc); color: #101214; }
.seg.mode .mode-scav[aria-pressed=true] { background: var(--scav); color: #101214; }
.map-card { width: 100%; min-height: 64px; gap: 6px; }
.map-card .row { width: 100%; }
.map-card[aria-pressed=true] { border-color: var(--action); background: var(--action-bg); }
.map-card .exits { display: flex; flex-direction: column; gap: 3px; margin-top: 4px; padding-top: 8px; border-top: 1px solid var(--line); color: var(--soft); }
.prep-cols { display: flex; flex-direction: column; gap: 18px; }
.raidprep .panel .row input { flex: 1; }
.primary.go-scav { background: var(--scav); }

/* ── 교전 ── */
.combat-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: -24px -16px 0; padding: 16px 16px 10px; background: #1d1414; border-bottom: 1px solid #4a2a26; }
.combat-top h1 { color: #f0a091; font-size: 22px; }
.combat-top > .mono { white-space: nowrap; }
.combat-top .small { color: #c9b3ae; }
.sides { align-items: start; }
.foe { gap: 3px; width: 100%; border-color: #4a2a26; }
.foe[aria-pressed=true] { border-color: var(--danger); background: #2a1715; }
.foe.out { background: transparent; border-style: dashed; color: var(--muted); } .foe.out .hurt-t, .foe.out .danger { color: var(--muted); }
.hurt-t { color: #f0a091; }
.me { gap: 4px; }
.me .parts7 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.combat-log li { font-size: 13px; color: var(--soft); }
.combat-ctl { position: sticky; bottom: 0; z-index: 4; display: flex; flex-direction: column; gap: 8px; margin: 0 -16px -16px; padding: 12px 16px 16px; border-top: 1px solid var(--line); background: var(--nav); }
.aims { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; }
.aims button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; min-height: 56px; padding: 2px; font-weight: 400; line-height: 1.3; }
.aims .pen { color: var(--muted); }
.aims button[aria-pressed=true] { border-color: var(--danger); background: #3a1d19; }
.combat-btns { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.combat-btns .wide { grid-column: span 3; }
.combat-btns .retreat { border-style: dashed; background: transparent; color: var(--soft); font-weight: 400; }
.big-t { font-family: 'Black Han Sans', sans-serif; font-size: 28px; }

/* ── 루팅 ── */
.loot-top { display: flex; flex-direction: column; gap: 8px; margin: -24px -16px 0; padding: 16px 16px 12px; background: var(--nav); border-bottom: 1px solid var(--line); }
.loot-top h1 { font-size: 22px; }
.boxes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 12px; }
.item.loot { border-left-width: 4px; }
.item.loot .actions { flex: 0 0 auto; flex-wrap: nowrap; }
.item.loot .actions button { flex: 0 0 auto; }
.item.loot .tags { color: var(--muted); gap: 4px 8px; }
.tier { font-weight: 700; color: var(--rc); }
.legend .tier { font-weight: 400; }

/* ── 결과 ── */
.big-title { font-size: 40px; line-height: 1; } .big-title.good { color: var(--good); } .big-title.warn { color: var(--warn); } .big-title.danger { color: var(--danger); }
.big-n { font-size: 15px; }
.res-row { display: flex; justify-content: space-between; gap: 8px; padding: 9px 12px; background: var(--surface); border-radius: 6px; font-size: 13px; }
.res-row .mono { white-space: nowrap; }
.after { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; font-size: 13px; line-height: 1.55; }

/* 넓은 화면: 레이드 3단, 출격 준비 2단 */
@media (min-width: 1024px) {
  .raid { max-width: none; } .combat, .loot-screen, .result { max-width: 980px; }
  .raid-top { margin: -20px -24px 0; padding: 14px 24px; }
  .raid-top h1 { font-family: 'Black Han Sans', sans-serif; font-weight: 400; font-size: 22px; }
  .raid-cols { display: grid; grid-template-columns: 300px minmax(0, 1fr) minmax(340px, 460px); grid-template-rows: auto 1fr; gap: 16px; align-items: start; }
  .raid-cols > .pane.p-status { grid-column: 1; grid-row: 1; padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
  .raid-cols > .col { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
  .raid-cols > .col-l { grid-column: 1; grid-row: 2; }
  .raid-cols > .col-m { grid-column: 2; grid-row: 1 / 3; }
  .raid-cols > .col-r { grid-column: 3; grid-row: 1 / 3; }
  .raid-cols .parts7 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .raid-tabs, .only-narrow { display: none; }
  .col .pane { padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
  .col .pane .spot { background: var(--nav); }
  .board { height: 420px; }
  .prep-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
  .sticky-foot { margin: 0 -24px -20px; padding: 12px 24px 16px; }
  .combat-top, .loot-top { margin: -20px -24px 0; padding: 16px 24px 12px; }
  .combat-ctl { margin: 0 -24px -20px; padding: 12px 24px 16px; }
}

/* ── 하이드아웃 · 상인 · 퀘스트 · 설정 ── */
.iname { color: var(--rc, var(--text)); }
textarea { font: inherit; color: inherit; width: 100%; padding: 8px 10px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface); font-size: 12px; line-height: 1.5; resize: vertical; overflow-wrap: anywhere; }
textarea:focus-visible, input[type=range]:focus-visible { outline: 2px solid var(--action); outline-offset: 1px; }

/* 하이드아웃 */
.area { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; text-align: left; font-weight: 400; background: var(--surface); border-color: var(--line); }
.area[aria-pressed=true] { border-color: var(--action); background: #16201e; }
.area .mid { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.area .mid b { font-size: 14px; }
.area .side { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; flex: 0 0 auto; }
.chip-s { padding: 1px 7px; border-radius: 9px; font-size: 12px; white-space: nowrap; }
.chip-s.ready { background: #15302c; color: var(--link); } .chip-s.short { background: #33291a; color: var(--warn); }
.chip-s.busy { background: #1f2a3a; color: #9cc3e8; } .chip-s.locked { background: var(--track); color: var(--faint); }
.reqs { display: flex; flex-direction: column; }
.req { display: flex; justify-content: space-between; gap: 8px; padding: 7px 0; border-bottom: 1px solid #262a2e; font-size: 13px; }
.req > .mono { white-space: nowrap; }
.req .tag { margin-left: 6px; }
.craft { display: flex; flex-direction: column; gap: 4px; padding: 10px 0; border-bottom: 1px solid #262a2e; }
.craft.on { padding: 12px; border: 1px solid #355a52; border-radius: 6px; background: #15231f; }
.craft .small-btn { align-self: flex-start; }
.hideout-main { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.hideout-side { display: flex; flex-direction: column; gap: 12px; }
.hideout .list { gap: 6px; }

/* 상인 */
h2.tname { font-size: 16px; }
.qty input { width: 96px; }
.trow { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; }
.trow .mid { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; font-size: 14px; overflow-wrap: anywhere; }
.trow .price { flex: 0 0 auto; font-size: 13px; white-space: nowrap; }
.trow .small-btn { flex: 0 0 auto; min-width: 56px; }
.trow.locked { background: transparent; border-style: dashed; } .trow.locked .iname { color: var(--muted); }
.trow.on { border-color: var(--action); background: #16201e; }

/* 퀘스트 */
.qcard { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.qcard.on { border-color: var(--action); }
.qhead { display: flex; flex-direction: column; align-items: stretch; gap: 4px; padding: 12px; border: 0; background: transparent; text-align: left; font-weight: 400; }
.qhead b { font-size: 15px; }
.qhead .mono { white-space: nowrap; }
.qbody { display: flex; flex-direction: column; gap: 8px; padding: 0 12px 12px; }
.obj { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; font-size: 13px; line-height: 1.55; }
.obj .mid { flex: 1; min-width: 0; }
.obj .give { flex-basis: 100%; }
.reward { display: flex; flex-direction: column; gap: 3px; padding: 10px; border-radius: 6px; background: var(--nav); font-size: 12px; }
.qhint { display: flex; flex-direction: column; gap: 4px; padding: 10px; border-radius: 6px; background: #15201e; border: 1px solid #2c4a44; font-size: 12px; line-height: 1.7; color: #b5e6dd; }
.qhint p { overflow-wrap: anywhere; }

.primary:disabled { background: var(--raised); color: var(--faint); opacity: 1; } /* 막힌 행동은 회색(목업) */

/* 설정 */
.settings button[aria-pressed=true] { border-color: var(--action); background: var(--action-bg); color: var(--link); }
.settings { max-width: 640px; }
.volume input { flex: 1; min-height: 44px; accent-color: var(--action); }
.confirm { border-color: var(--danger); background: #1d1716; }
.confirm .actions button { flex: 1 1 120px; }

@media (min-width: 1024px) {
  .hideout { display: grid; grid-template-columns: minmax(0, 1fr) 420px; align-items: start; }
  .hideout-side { position: sticky; top: 20px; max-height: calc(100vh - 40px); overflow-y: auto; }
  .trader, .quests { max-width: 900px; }
}
@media (max-width: 1023px) {
  .hideout .detail.sheet { max-height: 70vh; }
}

/* ── UI 개선 A: 공용 장치 · 온보딩 · 레이드 쪽 ── */
/* 용어 ⓘ: 보이는 단추는 작게, 누르는 칸은 44px(음수 여백으로 줄 높이는 그대로) */
.term-i { min-height: 0; min-width: 0; padding: 14px; margin: -14px -10px -14px -6px; border: 0; background: transparent; color: var(--link); vertical-align: middle; line-height: 0; }
.term-i[aria-expanded=true] { color: var(--warn); }
.term-def { display: block; margin: 6px 0 2px; padding: 8px 10px; border-radius: 6px; background: var(--action-bg); border: 1px solid var(--line); color: var(--soft); font-size: 13px; line-height: 1.6; font-weight: 400; text-align: left; white-space: normal; }
.term-def b { color: var(--text); }
/* 확인 대화 · "방금" 카드 · 단축키 표시 */
.confirm .lose { color: var(--warn); font-weight: 700; }
.recent { gap: 4px; padding: 10px 12px; border-color: var(--line); background: var(--action-bg); }
.recent .deltas { display: flex; flex-wrap: wrap; gap: 2px 10px; justify-content: flex-end; }
.recent p { line-height: 1.55; color: var(--soft); }
@media (hover: hover) and (pointer: fine) {
  [data-kbd]::after { content: attr(data-kbd); margin-left: 6px; padding: 0 4px; border: 1px solid currentColor; border-radius: 3px; font: 400 12px 'JetBrains Mono', monospace; opacity: 0.75; }
}
/* 용어집 · 시작 소개 · 다음 할 일 */
.glossary { max-width: 760px; }
.gloss { margin: 0; display: flex; flex-direction: column; gap: 8px; }
.gloss-row { padding: 10px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; }
.gloss dt { font-weight: 700; }
.gloss dd { margin: 2px 0 0; color: var(--soft); font-size: 13px; line-height: 1.6; }
.keys-list { margin: 0; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.keys-list dt { font-weight: 700; color: var(--muted); }
.keys-list dd { margin: 0; color: var(--soft); line-height: 1.6; }
.intro { margin: 8px 0 0; padding-left: 18px; color: var(--soft); font-size: 13px; line-height: 1.6; }
.next { gap: 4px; border-color: var(--line); background: var(--action-bg); }
.next .small-btn { align-self: flex-start; margin-top: 4px; }
/* 출격 준비 */
.kit-empty { border-color: var(--warn); }
.xline { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.xc { padding: 0 6px; border-radius: 4px; background: var(--track); color: var(--soft); font-size: 12px; }
.xside { margin-top: 6px; color: var(--muted); font-size: 12px; font-weight: 700; }
.primary.naked { background: var(--warn); color: var(--bg); }
/* 레이드: 첫 레이드 안내 · 내 탈출구 · 탈출 쪽 · 조건 부족 · 몸 상태 한 줄 · 지도 전체 보기 · 가는 길 */
.guide { gap: 8px; border-color: var(--warn); }
.guide .actions { flex-wrap: nowrap; }
.guide .actions button { flex: 0 0 auto; }
.steps { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.steps li { display: flex; gap: 8px; font-size: 13px; line-height: 1.55; color: var(--soft); }
.steps .mark { flex: 0 0 20px; height: 20px; margin-top: 1px; border-radius: 10px; border: 1px solid var(--btn-line); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px; }
.steps .done { color: var(--muted); }
.steps .done .mark { background: var(--good); border-color: var(--good); color: var(--bg); }
.steps .alert .mark { background: var(--danger); border-color: var(--danger); color: var(--bg); }
.steps .alert b { color: var(--danger); }
.my-exits { display: flex; flex-direction: column; gap: 4px; }
.xrow { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; align-items: center; width: 100%; text-align: left; font-weight: 400; border-color: var(--line); background: var(--action-bg); }
.xrow .xn { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; font-size: 13px; }
.xrow.shut { border-color: var(--line); background: transparent; }
.nearby .go.to-exit { border-color: var(--action); background: var(--action-bg); }
.xtag { color: var(--link); font-weight: 700; }
.spot.short { flex-wrap: wrap; }
.spot.short .mid { flex-basis: 100%; }
.spot.short .small-btn { max-width: none; }
.st-sum { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 12px; width: 100%; min-height: 44px; padding: 4px 12px; font-weight: 400; font-size: 13px; text-align: left; background: var(--surface); }
.st-sum .accent { margin-left: auto; }
.board.fit { cursor: default; }
.board.fit .board-in { zoom: var(--fit, 0.35); }
.edge.path { stroke: var(--warn); }
.chip-p.onway { border-color: var(--warn); }
.link.see { color: var(--link); font-size: 12px; padding: 0 4px; }
/* 교전: 이번 턴 · 관통 0% · 맞은 부위 반짝 */
.turn-now { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border-radius: 6px; background: var(--raised); border: 1px solid var(--danger); color: var(--text); }
.aims button.nopen { border-style: dashed; background: transparent; color: var(--faint); }
.aims button.nopen .pen { color: var(--danger); }
.part.hit { animation: hitflash 0.6s ease-out 3; }
@keyframes hitflash { 0%, 50% { background: var(--hit-bg); box-shadow: inset 0 0 0 2px var(--danger); } } /* 글자 색은 그대로(반짝이는 동안에도 대비 5:1 이상) */
@media (prefers-reduced-motion: reduce) { .part.hit { animation: none; outline: 2px solid var(--danger); outline-offset: -2px; } }
/* 결과: 이번 판 수익 · 펜스 팔기 */
.haul { gap: 2px; }
.res-row { align-items: center; flex-wrap: wrap; }
.res-row .mid { flex: 1; min-width: 0; }
.res-row .small-btn { flex: 0 0 auto; }
.res-row .confirm { flex-basis: 100%; }

/* 모바일 레이드: 위 머리는 붙박이(안내 칸 아래), 몸 상태는 한 줄로 접고, 탭 넷은 아래 붙박이(UX 13) */
@media (max-width: 1023px) {
  .raid-top { position: sticky; top: var(--note-h, 0px); z-index: 6; }
  .raid { padding-bottom: 76px; }
  .raid .pane.p-status:not(.open) { display: none; }
  .raid-tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; height: 60px; background: var(--nav); border-top: 1px solid var(--line); border-bottom: 0; }
  .raid-tabs button { border-bottom: 0; border-top: 2px solid transparent; }
  .raid-tabs button[aria-selected=true] { border-top-color: var(--action); }
  .board { height: max(280px, calc(100svh - 360px)); }
}
/* 넓은 화면: 지도 단을 넓히고 판 높이를 화면에 맞춘다. 교전은 가운데, 조작판은 오른쪽 단(UX 25) */
@media (min-width: 1024px) {
  .raid-cols { grid-template-columns: 300px minmax(0, 1fr) minmax(460px, 1fr); }
  .raid-top .st-sum { display: none; } /* 넓은 화면은 몸 상태가 왼쪽 단에 늘 펼쳐져 있다 */
  .board { height: max(420px, calc(100vh - 330px)); }
  .loot-screen, .result { margin: 0 auto; }
  .combat { max-width: 1180px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1fr) 460px; align-items: start; gap: 18px 20px; }
  .combat > .combat-top { grid-column: 1 / -1; }
  .combat > .sides { grid-column: 1; grid-row: 2; }
  .combat > .combat-log { grid-column: 1; grid-row: 3; }
  .combat > .combat-ctl { grid-column: 2; grid-row: 2 / span 2; position: sticky; top: 20px; bottom: auto; margin: 0; border: 1px solid var(--line); border-radius: 8px; padding: 14px; }
}

/* ── UI 개선 B: 은신처 쪽 화면 · 우편함 · 다듬기 ── */
/* 안내 칸 색(UX 11): 실패 · 경고는 주황(기본), 성공은 초록, 팁은 청록 */
.note.good { background: var(--good-bg); border-bottom-color: var(--good-line); color: var(--good-ink); }
.note.info { background: var(--action-bg); border-bottom-color: var(--info-line); color: var(--link); }
/* 은신처 머리 글 단추도 44px(UX 15 · 설정 › 34px) */
.head .link { min-width: 44px; }
/* 은신처: 우편함 들어가는 곳 · 넓은 화면 2단(UX 25) */
.mailbox { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 0 14px; font-weight: 400; text-align: left; background: var(--surface); border-color: var(--line); }
.mailbox b { font-size: 15px; }
.mailbox.has { border-color: var(--warn); }
.mail-badge { padding: 1px 8px; border-radius: 10px; background: var(--warn); color: var(--bg); font-size: 12px; font-weight: 700; }
.hub-main { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.hub-side { display: none; }
.hub-side .quest-line { gap: 2px; }
.hub-side .quest-line .link { text-align: left; min-height: 32px; }
/* 우편함 */
.mail { max-width: 760px; }
.mail-list { display: flex; flex-direction: column; gap: 8px; list-style: none; margin: 0; padding: 0; }
.mail-card h2 { font-size: 15px; }
.mail-card.here { border-color: var(--here-line); }
.mail-items { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.mail-card .small-btn { align-self: flex-start; }
/* 창고: 묶음 줄 · 묶음 도구 · 수리 · 프리셋 요약(UX 29 · 38) */
.item.grp .tags .grp-n { background: var(--action-bg); color: var(--link); }
.item.sub { margin-left: 18px; width: calc(100% - 18px); }
.tag.tag-cond { background: var(--track); color: var(--soft); }
.stack-tools, .repair-box { display: flex; flex-direction: column; gap: 6px; padding: 8px 0; border-top: 1px solid var(--rule); }
.stack-tools input { width: 88px; flex: 0 0 auto; }
.stack-tools .small-btn, .repair-box .small-btn { align-self: flex-start; }
.slot.preset .mid { display: flex; flex-direction: column; min-width: 0; }
@media (max-width: 1023px) { .stash-grid { --cell: 34px; } } /* 모바일: 10칸이 한 화면에(UX 29) */
/* 상인: 사기 개수 칸은 줄 안에 · 잠긴 줄 · 넓은 화면 2단 */
.buy-ctl { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.qty-in { width: 72px; }
.trow .why { color: var(--muted); }
/* 하이드아웃 재료 줄의 구하는 곳 */
.req .mid { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
/* 퀘스트: 상인 · 맵 거르기 · 힌트 덩어리 · 접힌 나오는 곳 */
.filters { display: flex; flex-direction: column; gap: 6px; }
.hint-item { display: flex; flex-direction: column; gap: 3px; padding-top: 6px; border-top: 1px solid var(--info-line); }
.found summary { cursor: pointer; min-height: 44px; padding: 12px 0; box-sizing: border-box; }
.found p { padding: 2px 0 2px 12px; line-height: 1.6; overflow-wrap: anywhere; }
.found p b { color: var(--text); }
.qhead .row.gap { flex-wrap: nowrap; }
@media (min-width: 1024px) {
  .hub { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 20px; align-items: start; max-width: 1240px; }
  .hub-side { display: flex; flex-direction: column; gap: 12px; position: sticky; top: 20px; }
  .trader { display: grid; grid-template-columns: 380px minmax(0, 1fr); gap: 16px 20px; align-items: start; max-width: 1240px; }
  .trader > .head { grid-column: 1 / -1; }
  .trader-side { display: flex; flex-direction: column; gap: 12px; position: sticky; top: 20px; }
  .trader-main { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
  .quests { max-width: 1240px; }
  .quests [role=tabpanel] { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; align-items: start; }
  .quests [role=tabpanel] > .qcard.on { grid-column: 1 / -1; }
  .quests [role=tabpanel] > p { grid-column: 1 / -1; }
}
/* 방금 카드의 색 줄(좋음 · 경고 · 나쁨)이 .recent p의 회색에 덮이지 않게 */
.recent p.good { color: var(--good); } .recent p.warn { color: var(--warn); } .recent p.danger { color: var(--danger); }
/* 막힌 작은 단추: 흐리게(opacity) 대신 점선 · 흐린 글 — 글이 "재료 부족"처럼 이유를 말한다(UX 16) */
.small-btn:disabled { opacity: 1; color: var(--faint); background: transparent; border-style: dashed; }
.sortie > span { margin-left: auto; } .sortie[data-kbd]::after { margin-left: 12px; }
/* 막힌 단추 전부(주 단추 · 사격 단추는 제 모양): 흐리게 대신 점선 · --faint 글 — "치료할 것 없음"처럼 이유를 읽을 수 있게(UX 16) */
button:disabled:not(.primary):not(.hot) { opacity: 1; color: var(--faint); background: transparent; border-style: dashed; }
.slot.preset .right { flex: 0 0 auto; flex-wrap: nowrap; } .slot .small-btn { white-space: nowrap; }
