/* ---------------------------------------------------------------- 지도 탭 (탐험) */
/* 색 토큰(--line, --toxic …)은 style.css 의 :root 를 쓴다 */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* 내용 칸 전체를 쓴다 (장비 탭과 같은 방식) */
.map {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: #0f110d;
}

/* 지도를 보여 주는 창. 끌어서 옮기므로 브라우저 기본 스크롤·확대는 끈다 */
.map-view {
  position: absolute;
  inset: 0;
  overflow: hidden;
  touch-action: none;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}

.map-view.is-dragging { cursor: grabbing; }
.map-view:focus-visible { outline: 2px solid var(--toxic); outline-offset: -2px; }

/* 지도 그림 그대로의 크기 (3000 x 2000, map/map.svg = 옛 단순 지도, 탐험지는 tools/map/simple_sites.py). 위치·배율은 JS 가 transform 으로 준다 */
.map-canvas {
  --inv-zoom: 1;
  position: absolute;
  left: 0;
  top: 0;
  width: 3000px;
  height: 2000px;
  transform-origin: 0 0;
  background: #141711 url("map/map.svg") 0 0 / 100% 100% no-repeat;
  will-change: transform;
}

.map-canvas.is-animating { transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.25, 1); }

/* 멀리 볼 때 탐험지 점 (JS 가 그린다). 누르기는 아래 지도가 받는다 */
.map-dots {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  .map-canvas.is-animating { transition: none; }
}

/* 정착지 표시 (버튼 아님). make_map.py 의 HOME 위치 */
.map-home {
  position: absolute;
  left: 35%;
  top: 54%;
  transform: translate(-50%, -50%) scale(var(--inv-zoom));
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px 4px 8px;
  border: 1px solid rgba(159, 204, 79, 0.6);
  border-radius: 999px;
  background: rgba(10, 11, 9, 0.85);
  color: var(--toxic);
  font-size: 0.85rem;
  font-weight: 700;
  white-space: nowrap;
  pointer-events: none;
}

.map-home-mark {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: var(--toxic);
  box-shadow: 0 0 0 3px rgba(159, 204, 79, 0.25);
}

/* 탐험지 버튼: 위치는 JS 가 --x / --y 로 준다 (DB map_x / map_y). 지도 배율과 상관없이 같은 크기 */
.map-site {
  --pin: var(--warn);
  --s: 1;
  position: absolute;
  left: var(--x);
  top: var(--y);
  transform: translate(-50%, -50%) scale(calc(var(--inv-zoom) * var(--s)));
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  padding: 4px 11px 4px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: rgba(14, 16, 12, 0.92);
  color: var(--text);
  font: 700 0.88rem var(--font);
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
  transition: border-color 0.15s, background-color 0.15s;
}

/* data-danger = 위험도 단계 (0 정리 완료 · 1 낮음 · 2 보통 · 3 높음 · 4 매우 높음 · 5 극도로 위험) */
.map-site[data-danger="0"],
.map-list-item[data-danger="0"] { --pin: #7fa6b8; }
.map-site[data-danger="1"],
.map-list-item[data-danger="1"] { --pin: var(--toxic); }
.map-site[data-danger="2"],
.map-list-item[data-danger="2"] { --pin: #c9c24a; }
.map-site[data-danger="3"],
.map-list-item[data-danger="3"] { --pin: var(--warn); }
.map-site[data-danger="4"],
.map-site[data-danger="5"],
.map-list-item[data-danger="4"],
.map-list-item[data-danger="5"] { --pin: var(--blood-hi); }

.map-site-dot {
  flex: none;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--pin);
}

.map-site:hover { border-color: var(--muted); background: rgba(24, 27, 20, 0.96); }

/* 탐험한 곳: 이름 뒤에 ✓ (자동 탐험 가능하면 "✓ 자동") */
.map-site-mark { color: var(--toxic); font-size: 0.75rem; }
/* 아이템을 떨어뜨린 곳: 이름 오른쪽 해골 */
.map-site-skull { color: #e86a5c; font-size: 0.85rem; line-height: 1; }
.map-list-name .map-site-skull { margin-left: 6px; }
.map-site:focus-visible { outline: 2px solid var(--toxic); outline-offset: 2px; }

.map-site.is-selected {
  --s: 1.08;
  z-index: 1;
  border-color: var(--blood-hi);
  background: var(--selected-bg);
}

/* 전체 지도: 이름은 숨기고 점만 (마우스를 올리면 이름). 빈 곳을 누르면 그곳으로 들어간다 */
.map-canvas.is-overview { cursor: zoom-in; }

.map-status {
  position: absolute;
  left: 50%;
  top: 60px;
  transform: translateX(-50%);
  margin: 0;
  padding: 6px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: rgba(10, 11, 9, 0.9);
  color: var(--muted);
  font-size: 0.88rem;
}

/* ---- 위쪽 버튼 (왼쪽: 전체 지도 · 탐험 리스트 / 오른쪽: 필터) */
.map-tools {
  position: absolute;
  top: 12px;
  z-index: 4;
  display: flex;
  gap: 6px;
}

.map-tools-left { left: 12px; }
.map-tools-right { right: 12px; }

.map-tool {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: rgba(14, 16, 12, 0.92);
  color: var(--text);
  font: 700 0.88rem var(--font);
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
}

.map-tool:hover { border-color: var(--muted); }
.map-tool:focus-visible { outline: 2px solid var(--toxic); outline-offset: 2px; }
.map-tool[aria-pressed="true"],
.map-tool[aria-expanded="true"] { border-color: var(--blood-hi); background: var(--selected-bg); }
.map-tool.is-active { border-color: var(--warn); }

.map-filter-count {
  min-width: 20px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--warn);
  color: #16140c;
  font-size: 0.75rem;
  text-align: center;
}

/* ---- 탐험 리스트 · 필터 창 (위쪽 버튼 아래. 탐험지 창에 가리지 않게 높이를 줄인다) */
.map-pop {
  position: absolute;
  top: 58px;
  z-index: 4;
  display: flex;
  flex-direction: column;
  max-height: calc(100% - 70px);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: rgba(14, 16, 12, 0.97);
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.55);
}

.map-filter { right: 12px; width: 320px; padding: 4px 14px 12px; overflow-y: auto; }

.map-pop-title {
  margin: 10px 0 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

/* ---- 탐험 리스트 화면: 지도 대신 패널 전체 (위쪽 버튼 줄 아래) */
.map-list {
  position: absolute;
  top: 56px;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--line-strong);
  background: var(--bg);
}

.map-list .map-list-top,
.map-list .map-list-items {
  width: 100%;
  max-width: 820px;
  margin-inline: auto;
}

.map-list-top {
  flex: none;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px 10px 14px;
  border-bottom: 1px solid var(--line);
}

.map-list .map-pop-title { margin: 0; font-size: 0.85rem; }
.map-list .map-pop-title b { color: var(--text); }
.map-list-sort { display: flex; gap: 4px; }
.map-list-sort .map-chip { padding: 3px 10px; font-size: 0.76rem; }

/* 분류 제목 줄 (목록을 내려도 위에 붙어 있다) */
.map-list-group {
  position: sticky;
  top: -6px;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  margin: 6px 0 2px;
  padding: 6px 9px 5px;
  border-bottom: 1px solid var(--line-strong);
  background: var(--sheet);
  color: var(--warn);
  font-size: 0.8rem;
  font-weight: 700;
}

.map-list-group:first-child { margin-top: 0; }
.map-list-group-count { color: var(--muted); font-weight: 400; }

.map-list-items {
  flex: 1 1 auto;
  min-height: 0;
  margin: 0;
  padding: 6px 8px 16px;
  overflow-y: auto;
  overscroll-behavior: contain;
  list-style: none;
}

.map-list-item {
  --pin: var(--warn);
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 9px;
  align-items: center;
  width: 100%;
  padding: 7px 9px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: none;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.map-list-item:hover { background: rgba(255, 255, 255, 0.05); }
.map-list-item:focus-visible { outline: 2px solid var(--toxic); outline-offset: -2px; }
.map-list-item.is-selected { border-color: var(--blood-hi); background: var(--selected-bg); }
.map-list-item .map-site-dot { grid-row: span 2; align-self: start; margin-top: 6px; }
.map-list-item + .map-list-item,
li + li > .map-list-item { margin-top: 1px; }

.map-list-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.map-list-name { font-weight: 700; font-size: 0.92rem; }
.map-list-time { flex: none; color: var(--text); font-size: 0.82rem; font-variant-numeric: tabular-nums; }

.map-list-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 3px 8px;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.76rem;
  font-variant-numeric: tabular-nums;
}

.map-list-tag {
  padding: 0 6px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  font-size: 0.72rem;
}

.map-list-tag.is-short { border-color: var(--blood-hi); color: var(--blood-hi); }
.map-list-tag.is-auto { border-color: var(--toxic); color: var(--toxic); }
.map-list-tag.is-shelter { border-color: var(--ivory); color: var(--ivory); }

/* 알아본 은신처 후보지: 이름 오른쪽에 집 (지금 은신처는 초록) */
.map-site-house { flex: none; width: 14px; height: 14px; fill: var(--ivory); }
.map-site-house.is-home { fill: var(--toxic); }
/* 은신처 이전하기 (탐험 시작 자리) */
.explore-go.is-move { border-color: var(--ivory); background: rgba(244, 245, 234, 0.08); color: var(--ivory); }
.explore-go.is-move:hover:not(:disabled) { border-color: #fff; background: rgba(244, 245, 234, 0.16); }
.map-list-tag.is-new { border-color: var(--warn); color: var(--warn); }
.map-list-empty { padding: 12px 8px; color: var(--muted); font-size: 0.88rem; }

.map-chips { display: flex; flex-wrap: wrap; gap: 6px; }

.map-chip {
  padding: 5px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: 700 0.82rem var(--font);
  cursor: pointer;
}

.map-chip:hover { color: var(--text); }
.map-chip:focus-visible { outline: 2px solid var(--toxic); outline-offset: 1px; }
.map-chip[aria-pressed="true"] { border-color: var(--blood-hi); background: var(--blood); color: #fff; }

.map-filter-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.map-filter-result { color: var(--muted); font-size: 0.8rem; }
.map-filter-foot .link-btn:disabled { opacity: 0.4; cursor: default; }

/* 폰: 버튼을 조금 작게, 목록·필터 창은 화면 폭에 맞춘다 */
@media (max-width: 640px) {
  .map-tools { top: 8px; gap: 4px; }
  .map-tools-left { left: 8px; }
  .map-tools-right { right: 8px; }
  .map-tool { min-height: 34px; padding: 0 10px; font-size: 0.82rem; }

  .map-pop {
    top: 50px;
    left: 8px;
    right: 8px;
    width: auto;
    max-height: calc(100% - 58px);
  }
}

/* ---- 탐험지 창: 지도 위에 떠 있는 큰 창 (사방 여백, 둥근 모서리). 아래에서 빠르게 올라온다 */
.explore-sheet {
  position: absolute;
  top: 34px;
  left: 48px;
  right: 44px;
  bottom: 30px;
  z-index: 5;
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); /* 왼쪽 60% · 오른쪽 40% */
  grid-template-rows: minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-top: 3px solid var(--blood);
  border-radius: 10px;
  background: rgba(14, 16, 12, 0.98);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
  transform: translateY(calc(100% + 40px)); /* 창 아래 여백까지 내려가 화면 밖으로 */
  opacity: 0.6;
  /* 닫힐 때: 조금 빠르게 내려간다 */
  transition:
    transform 0.26s cubic-bezier(0.4, 0, 1, 1),
    opacity 0.26s ease-in;
}

/* 열릴 때: 올라오는 게 보이도록 0.38초, 끝에서 부드럽게 멈춘다.
   (Windows "애니메이션 효과 끄기"여도 이 움직임은 보이게 둔다. 사용자가 요청한 움직임) */
.explore-sheet.is-open {
  transform: none;
  opacity: 1;
  transition:
    transform 0.38s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.2s ease-out;
}

/* 왼쪽 60%: 지역 · 건물 이름(종류) · 위험도 · 설명 / 아래쪽에 이동 시간 · 탐험 횟수 · 버튼 */
.explore-info,
.explore-gear {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
}

.explore-info { padding: 18px 22px 22px; }

.explore-kicker {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.explore-title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
  margin: 8px 0 10px;
}

.explore-name { font-size: 1.4rem; }
.explore-type { color: var(--muted); font-size: 0.84rem; font-weight: 600; }

/* 위험도: 다섯 개씩 묶은 빗금. 색은 단계별 */
.explore-danger {
  --tally: var(--warn);
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-size: 0.86rem;
}

.explore-danger-label { color: var(--muted); }
.explore-danger-text { color: var(--tally); font-weight: 700; }
.explore-tally { display: inline-flex; gap: 6px; }
.explore-tally svg { width: 30px; height: 20px; }
.explore-tally path { fill: none; stroke: var(--tally); stroke-width: 2.6; stroke-linecap: round; }
.explore-danger[data-danger="0"] { --tally: var(--muted); }
.explore-danger[data-danger="1"] { --tally: var(--toxic); }
.explore-danger[data-danger="2"] { --tally: #c9c24a; }
.explore-danger[data-danger="4"],
.explore-danger[data-danger="5"] { --tally: var(--blood-hi); }

.explore-desc {
  margin: 12px 0 0;
  color: #c9c6b8;
  font-size: 0.92rem;
  line-height: 1.55;
}

.explore-bottom { padding-top: 20px; } /* 설명 바로 아래 */
.explore-line { margin: 0 0 10px; font-size: 1.02rem; font-variant-numeric: tabular-nums; }
.explore-need-warn { margin-top: -4px; font-size: 0.92rem; color: var(--warn); }
.explore-need-warn[data-level="bad"] { color: #e5534b; }

.explore-short { margin: 0 0 10px; color: var(--blood-hi); font-size: 0.88rem; }
.explore-info .form-error:empty { display: none; }

.explore-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin-top: 6px;
}

/* 두 버튼이 남은 폭을 나눠 가진다 (창이 넓으면 넓게, 좁으면 좁게) */
.explore-go,
.explore-auto {
  flex: 1 1 0;
  width: auto;
  min-width: 0;
  min-height: 48px;
  border-width: 2px;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 700;
}

/* 탐험 시작: 주황 / 자동 탐험: 청록 */
.explore-go { border-color: var(--orange-dim); background: rgba(224, 137, 58, 0.16); color: var(--orange); }
.explore-go:hover:not(:disabled) { background: rgba(224, 137, 58, 0.28); border-color: var(--orange); }
.explore-auto { border-color: #3fb3a6; background: rgba(63, 179, 166, 0.12); color: #5fd0c2; }
.explore-auto:hover:not(:disabled) { background: rgba(63, 179, 166, 0.24); border-color: #5fd0c2; }
.explore-go:disabled,
.explore-auto:disabled { opacity: 0.4; cursor: not-allowed; }
.explore-show-map { font-size: 0.88rem; }

/* 오른쪽 40%: 장비 탭으로 · 닫기 + 외형 · 장비 · 인벤토리 (펼친 하나가 가운데를 채운다) */
.explore-gear { border-left: 1px solid var(--line-strong); padding: 10px 0 0; overflow: hidden; }

.explore-top {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 0 10px 6px;
}

.explore-to-gear {
  width: auto;
  min-height: 32px;
  padding: 0 12px;
  border: 2px solid var(--blood-hi);
  border-radius: 8px;
  background: var(--blood-hi); /* 붉은 바탕 · 검은 글씨 */
  color: #000;
  font-size: 0.88rem;
  font-weight: 700;
}
.explore-to-gear:hover { background: #d9463a; border-color: #d9463a; }

.explore-close {
  width: 32px;
  height: 32px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 0.95rem;
  cursor: pointer;
}

.explore-close:hover { color: var(--text); background: rgba(255, 255, 255, 0.07); }
.explore-close:focus-visible,
.explore-to-gear:focus-visible { outline: 2px solid var(--toxic); outline-offset: 1px; }

.explore-folds { display: flex; flex: 1; flex-direction: column; min-height: 0; }
.explore-mobile-tabs { display: none; }

/* 장비 칸: 장비 탭의 현재 장비 화면(.gear-left)을 옮겨 와 그대로 보인다. PC에서는 탭 없이 늘 오른쪽에 */
.explore-gear-host { flex: 1; min-height: 0; overflow-y: auto; }
.explore-gear-host > .gear-left { min-height: 100%; margin-bottom: 12px; overflow: visible; border-right: 0; }
/* 탐험지 창 안에서는 장착 칸의 "…" 버튼 · 모딩(스패너) 버튼을 없앤다 (칸을 누르면 장착할 아이템 목록, 모딩은 장비 탭에서만) */
.explore-gear-host .gear-slot .item-menu,
.explore-gear-host .mod-btn { display: none; }
.explore-gear-host .gear-slot { cursor: pointer; }
.explore-gear-host .gear-slot.is-picking { outline: 2px solid var(--orange); outline-offset: -2px; }

/* 장착할 아이템 목록 (탐험지 설명 자리) */
/* PC · 가로: 왼쪽 60%(탐험지 설명 자리)만 덮는 판. 목록이 오른쪽에서 밀려 들어온다 */
.explore-picker-wrap {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 3;
  width: 60%;
  overflow: hidden;
  pointer-events: none;
}
.explore-picker {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px 22px 22px;
  overflow-y: auto;
  background: var(--sheet);
  transform: translateX(100%);
  visibility: hidden;
  transition: transform 0.3s cubic-bezier(0.4, 0, 1, 1), visibility 0s 0.3s;
}
.explore-picker-wrap.is-open .explore-picker {
  transform: none;
  visibility: visible;
  pointer-events: auto;
  transition: transform 0.36s cubic-bezier(0.22, 1, 0.36, 1), visibility 0s;
}
/* 창고 칸 모양 (장비 탭 창고와 같은 .gear-storage-grid) */
.explore-picker-grid { grid-template-columns: repeat(auto-fill, 68px); gap: 8px; }
.explore-pick { cursor: pointer; }
.explore-pick:hover { border-color: var(--orange); }
.explore-pick:focus-visible { outline: 2px solid var(--toxic); outline-offset: 1px; }
/* 지금 장착한 장비 칸: 초록 테두리 + 왼쪽 위 "장착 중" (누르면 해제) */
.explore-pick.is-worn { border-color: var(--toxic); box-shadow: inset 0 0 0 1px var(--toxic); }
.worn-badge {
  position: absolute;
  z-index: 1;
  top: 2px;
  left: 3px;
  color: var(--toxic);
  font-size: 0.66rem;
  font-weight: 700;
  pointer-events: none;
}
.explore-picker-empty { margin: 0; }
.explore-picker-hint { margin: 0; font-size: 0.8rem; }

/* 폰 세로: 나란한 상단 탭 아래 두 패널을 좌우로 넘긴다. */
@media (max-width: 640px) {
  .explore-sheet {
    top: 12px;
    left: 8px;
    right: 8px;
    bottom: 12px;
    display: flex;
    flex-direction: column;
  }

  /* 공유 장비 화면을 탐험지 정보와 같은 크기의 패널로 놓는다. */
  .explore-gear,
  .explore-folds { display: contents; }
  .explore-top { position: absolute; top: 6px; right: 6px; z-index: 5; padding: 0; }
  .explore-to-gear { display: none; }
  /* 폰 세로: 장착할 아이템 목록은 창 아래에서 올라오는 판 */
  .explore-picker-wrap { top: 44px; width: 100%; }
  .explore-picker {
    inset: auto 0 0 0;
    max-height: 72%;
    border-top: 3px solid var(--blood);
    border-radius: 12px 12px 0 0;
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.6);
    transform: translateY(100%);
  }

  /* 서류철 탭(.folder-tab, style.css): 메뉴 탭을 90도 돌린 모양. 위만 둥글고, 고른 탭은 위로 커지며 아래 내용과 이어진다 */
  .explore-mobile-tabs {
    position: absolute;
    inset: 0 0 auto;
    z-index: 4;
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 44px;
    padding: 0 44px 0 8px;
    border-bottom: 1px solid var(--line-strong);
    background: #111310;
  }
  .explore-fold {
    --tab-join: var(--sheet);
    flex: 1;
    min-width: 0;
    height: 32px;
    margin: 0 0 -1px;
    border-radius: 14px 14px 0 0;
  }
  .explore-fold[aria-selected="true"] {
    height: 39px;
    border-bottom-color: var(--tab-join);
    box-shadow: inset 0 3px 0 var(--blood-hi);
  }

  /* 탐험지 · 장비 = 좌우로 넘기는 화면(.slide-panel, style.css). 탭 줄 아래를 같은 크기로 채우고 각자 세로로 내린다 */
  #explore-info { --i: 0; }
  #explore-fold-gear { --i: 1; }
  #explore-info.slide-panel,
  #explore-fold-gear.slide-panel {
    position: absolute;
    top: 44px;
    bottom: 0;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
  }
  .explore-info { padding: 0 16px; touch-action: pan-y; }

  .explore-info > :first-child { margin-top: 6px; }
  .explore-bottom { padding: 16px 0 14px; }
  .explore-go,
  .explore-auto { flex: 1 1 120px; min-width: 0; }
}

/* 탐험 리스트: 이름 찾기 · 더 보기 */
.map-list-search {
  flex: 1 1 160px;
  min-width: 0;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: rgba(14, 16, 12, 0.9);
  color: var(--text);
  font: inherit;
  font-size: 0.88rem;
}
.map-list-search:focus-visible { outline: 2px solid var(--toxic); outline-offset: 1px; }

/* 탐험지 창: 오른쪽 장착 칸에서 끌기 시작하면 열리는 장착할 아이템 목록이 장착 해제 자리 */
#explore-picker.drop-ok { box-shadow: inset 0 0 0 2px rgba(159, 204, 79, 0.45); }
/* 바탕은 불투명 그대로 두고(뒤의 탐험지 설명이 비치지 않게) 위에 연한 초록만 겹친다 */
#explore-picker.drop-hover { box-shadow: inset 0 0 0 2px var(--toxic); background-image: linear-gradient(rgba(159, 204, 79, 0.08), rgba(159, 204, 79, 0.08)); }

/* 다른 칸에 장착한 장비 (누르면 이 칸으로 옮김): 노란 글씨 */
.explore-pick.is-elsewhere { border-color: #b89a3a; }
.worn-badge.is-elsewhere { color: var(--yellow); }

/* ---------------------------------------------------------------- 직접 탐험 · 전투 창 (expedition.js) */
/* 탐험지 창 위에 뜨는 큰 창 (모딩 창과 같은 자리 · 움직임) */
.exp-sheet {
  position: absolute;
  top: 34px;
  left: 48px;
  right: 44px;
  bottom: 30px;
  z-index: 9;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-top: 3px solid var(--orange-dim);
  border-radius: 10px;
  background: var(--sheet);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
  transform: translateY(calc(100% + 40px));
  opacity: 0.6;
  transition: transform 0.26s cubic-bezier(0.4, 0, 1, 1), opacity 0.26s ease-in;
}
.exp-sheet.is-open {
  transform: none;
  opacity: 1;
  transition: transform 0.38s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.2s ease-out;
}
.exp-sheet.is-busy { cursor: progress; }
.exp-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px 16px;
  padding: 12px 18px 10px;
  border-bottom: 1px solid var(--line-strong);
}
.exp-head-text { min-width: 0; }
.exp-title { margin: 0; font-size: 1.15rem; }
.exp-stats { display: flex; align-items: center; gap: 14px; font-size: 0.85rem; }
.exp-step { color: var(--muted); font-variant-numeric: tabular-nums; }
.exp-wounds { display: inline-flex; gap: 10px; font-variant-numeric: tabular-nums; }
.exp-wounds:empty { display: none; }
.battle-ap-bar, .battle-hp {
  position: relative;
  display: inline-block;
  width: 110px;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}
.battle-ap-fill, .battle-hp-fill {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: inherit;
  background: var(--toxic);
  transition: width 0.25s ease;
}

.exp-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px 18px 18px;
  overflow-y: auto;
}
.exp-body[hidden] { display: none; }
.exp-log, .battle-log {
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 10px 12px;
  list-style: none;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.02);
  font-size: 0.88rem;
  line-height: 1.45;
}
.exp-log { flex: 1; min-height: 120px; align-content: start; overflow-y: auto; }
.exp-log .is-good, .battle-log .is-good { color: var(--toxic); }
.exp-log .is-bad, .battle-log .is-bad { color: #ff8a7a; }
.battle-log .is-turn { color: var(--muted); font-size: 0.78rem; }
/* 수색 화면: 왼쪽(기록 · 발견한 아이템 · 버튼) | 오른쪽(현재 장비 · 인벤토리) */
.exp-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 42%);
  grid-template-rows: minmax(0, 1fr); /* 두 열 모두 창 높이 안에서 각자 스크롤 */
  gap: 16px;
  overflow: hidden;
}
.exp-search-main { display: flex; flex-direction: column; gap: 12px; min-height: 0; overflow-y: auto; }
.exp-gear { min-height: 0; overflow-y: auto; border-left: 1px solid var(--line-strong); }
.exp-gear > .gear-left { min-height: 100%; overflow: visible; border-right: 0; }
.exp-found-head { display: flex; justify-content: flex-end; margin-bottom: 8px; }
.exp-take-all { width: auto; margin: 0; }
.exp-found-grid { grid-template-columns: repeat(auto-fill, 68px); gap: 8px; }
.exp-found-grid .cell.has-item { cursor: grab; user-select: none; -webkit-user-select: none; }
.exp-found-empty { margin: 0; }
.exp-found-zone { min-height: 76px; padding: 6px; border: 1px dashed transparent; border-radius: 6px; }
.exp-found-zone.drop-ok, .exp-found-zone.move-target { border-color: var(--toxic); }
.exp-found-zone.drop-hover, .exp-found-zone.move-target:hover { background: rgba(159, 204, 79, 0.12); cursor: pointer; }
.exp-actions { display: flex; gap: 10px; }
.exp-actions .btn { flex: 1; margin: 0; }
.exp-next { border-color: var(--orange-dim); background: rgba(224, 137, 58, 0.16); color: var(--orange); }
.exp-next:hover:not(:disabled) { background: rgba(224, 137, 58, 0.28); }
.exp-hunt { border-color: #b84a3a; background: rgba(184, 74, 58, 0.14); color: #e07a68; }
.exp-hunt:hover:not(:disabled) { background: rgba(184, 74, 58, 0.26); }

/* 전투 */
.battle-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.battle-encounter { margin: 0; font-weight: 700; }
/* 거리 고르기: 적 수 (좀비 빨강 · 레이더 주황, 있는 분류만) */
.battle-enemy-count { display: flex; flex: none; gap: 10px; font-weight: 700; }
.battle-enemy-kind { display: inline-flex; align-items: center; gap: 4px; color: #e5534b; }
.battle-enemy-kind.is-raider { color: var(--orange); }
.battle-enemy-icon { width: 20px; height: 20px; border: 1px solid currentColor; border-radius: 50%; object-fit: cover; object-position: top; }
/* 차례 · AP · 위치 줄: 전투 창(.exp-body)을 내려도 위에 붙어 있다. 위 · 옆 여백까지 덮어 뒤 내용이 비치지 않게 */
.battle-top {
  position: sticky;
  top: -14px; /* 창(.exp-body)의 위 여백까지 덮어 탐험지 정보 줄에 바로 붙는다 */
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: none;
  margin: -14px -18px 0;
  padding: 10px 18px 8px;
  border-bottom: 1px solid var(--line);
  background: var(--sheet);
}
.battle-top-main { display: flex; flex-direction: column; gap: 2px; }
.battle-top-main[hidden] { display: none; }
/* 거리 고르기: 위치 줄(고른 거리의 나와 적) · 거리 버튼 셋(고른 것 강조) · [전투 시작][후퇴] */
.battle-distance { display: grid; gap: 10px; }
.battle-distance-field { height: 66px; margin: 4px 14px 0; } /* 이름 아래 거리 한 줄만큼 높다 */
.battle-distance-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.battle-distance-btn { display: grid; gap: 4px; margin: 0; padding: 14px 8px; }
.battle-distance-btn span { color: var(--muted); font-size: 0.85rem; }
.battle-distance-btn[aria-pressed="true"] { border-color: var(--orange); box-shadow: inset 0 0 0 1px var(--orange); }
.battle-distance-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.battle-distance-actions .btn { margin: 0; }
.battle-main { display: flex; flex-direction: column; gap: 10px; }
.battle-main[hidden], .battle-distance[hidden] { display: none; }
/* 위치 줄: 나 · 적이 있는 구간만 보이는 한 줄 (위쪽 22px 에 선, 거리 눈금 없음). 선 위에 엄폐물, 선 아래에 ▲ 와 이름 (나 초록 · 좀비 빨강 · 레이더 주황) */
.battle-field {
  --line-y: 22px;
  position: relative;
  height: 54px;
  margin: 0 14px;
  overflow-x: clip; /* 확대하면 보이는 구간 밖의 표시는 잘린다 */
  touch-action: pan-y; /* 좌우 끌기 · 두 손가락 확대는 위치 줄이 받는다 (expedition.js fieldView) */
  cursor: zoom-in;
}
.battle-field.is-zoomed { cursor: grab; }
.battle-field::before { content: ""; position: absolute; left: 0; right: 0; top: var(--line-y); border-top: 2px solid var(--line-strong); }
.battle-mark {
  --mark: #e5534b;
  position: absolute;
  top: calc(var(--line-y) + 1px);
  display: grid;
  justify-items: center;
  color: var(--mark);
  line-height: 1;
  white-space: nowrap;
  transform: translateX(-50%);
  transition: left 0.3s ease;
}
.battle-mark-tri { font-size: 13px; }
.battle-mark-name { margin-top: 2px; font-size: 0.68rem; }
.battle-mark-dist { margin-top: 1px; font-size: 0.64rem; opacity: 0.85; }
.battle-mark.is-raider { --mark: var(--orange); }
.battle-mark.is-me { --mark: var(--toxic); z-index: 2; }
.battle-mark.is-target { z-index: 3; } /* 겹치면 대상이 맨 위 */
.battle-mark.is-target .battle-mark-name { font-weight: 700; text-decoration: underline; }
/* 엄폐물: 선 위의 갈색 ▼ (큰 것이 더 큼). 나 · 적 10m 안의 것만 */
.battle-cover { position: absolute; bottom: calc(100% - var(--line-y) + 1px); z-index: 0; color: #a0703c; font-size: 10px; line-height: 1; transform: translateX(-50%); pointer-events: none; }
.battle-cover-l { font-size: 15px; }
.battle-cover-btn { display: grid; justify-items: center; gap: 2px; }
.battle-move-ap { color: var(--muted); font-size: 0.72rem; font-variant-numeric: tabular-nums; }
.battle-attack-btn.is-takedown { border-color: #9fcc4f; background: rgba(159, 204, 79, 0.1); }
/* 적 칸: 좁은 칸을 한 줄로, 넘치면 좌우로 끌어서 넘긴다 (아래 탭 줄과 같은 방식) */
.battle-enemies {
  display: flex;
  gap: 6px;
  margin: 0;
  padding: 0 0 2px;
  list-style: none;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
  cursor: grab;
}
.battle-enemies::-webkit-scrollbar { display: none; }
.battle-enemies.is-dragging { cursor: grabbing; scroll-snap-type: none; }
.battle-enemies.is-dragging .battle-enemy-btn { pointer-events: none; }
.battle-enemy { flex: 0 0 128px; scroll-snap-align: start; }
.battle-enemy-btn {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 4px 8px;
  width: 100%;
  padding: 7px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.battle-enemy-btn .battle-hp { grid-column: 1 / -1; width: 100%; height: 6px; }
.battle-enemy-image { grid-column: 1 / -1; justify-self: center; width: 96px; height: 144px; object-fit: contain; }
.battle-hp-fill { background: #c8352a; }
.battle-enemy-name { font-weight: 700; font-size: 0.88rem; }
.battle-enemy-meta { color: var(--muted); font-size: 0.78rem; font-variant-numeric: tabular-nums; }
.battle-enemy.is-target .battle-enemy-btn { border-color: var(--orange); box-shadow: inset 0 0 0 1px var(--orange); }
.battle-enemy.is-dead .battle-enemy-btn { opacity: 0.4; cursor: default; }
.battle-ap { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; }
.battle-ap-label { font-weight: 700; }
.battle-ap-bar { flex: 1; width: auto; height: 10px; }
.battle-ap-fill { background: var(--orange); }
.battle-ap-text { font-variant-numeric: tabular-nums; }
.battle-weapons, .battle-move { display: flex; flex-wrap: wrap; gap: 6px; }
.battle-weapon, .battle-move-btn {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 7px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}
.battle-weapon { flex: 1 1 140px; text-align: left; }
.battle-weapon-name { font-weight: 700; font-size: 0.9rem; }
.battle-weapon-meta { color: var(--muted); font-size: 0.74rem; }
.battle-move-btn { flex: 1 1 60px; justify-items: center; align-content: center; font-size: 0.85rem; } /* 글씨 상하 가운데 */
.battle-weapon:hover:not(:disabled), .battle-move-btn:hover:not(:disabled) { border-color: var(--muted); }
.battle-weapon:disabled, .battle-move-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.battle-weapon[aria-pressed="true"] { border-color: var(--orange); box-shadow: inset 0 0 0 1px var(--orange); }
/* 대상 그림 + 부위 | 공격 방법 */
.battle-aim { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.battle-target { display: grid; justify-items: center; gap: 4px; min-width: 0; }
.battle-figure { position: relative; width: min(100%, 160px); aspect-ratio: 2 / 3; border-radius: 6px; overflow: hidden; background: rgba(255, 255, 255, 0.02); }
.battle-figure .hint { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; text-align: center; }
.battle-figure-image { width: 100%; height: 100%; object-fit: contain; user-select: none; pointer-events: none; }
/* 부위 히트 박스: 늘 옅은 점선으로 보이고, 고른 부위만 주황으로 강조 */
.battle-part-hit { position: absolute; padding: 0; border: 1px dashed rgba(230, 225, 205, 0.35); border-radius: 6px; background: transparent; cursor: crosshair; }
.battle-part-hit:hover:not(:disabled) { border-color: rgba(242, 166, 92, 0.6); background: rgba(242, 166, 92, 0.12); }
.battle-part-hit[aria-pressed="true"] { border-color: var(--orange); background: rgba(242, 166, 92, 0.22); }
.battle-part-hit:disabled { cursor: default; }
.battle-target-part { margin: 0; color: var(--muted); font-size: 0.8rem; }
.battle-attack { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.battle-attack-title { margin: 0; font-weight: 700; font-size: 0.9rem; }
.battle-attack-btn {
  display: grid;
  gap: 2px;
  padding: 9px 12px;
  border: 1px solid var(--orange);
  border-radius: 6px;
  background: rgba(242, 166, 92, 0.1);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.battle-attack-btn:hover:not(:disabled) { background: rgba(242, 166, 92, 0.2); }
.battle-attack-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.battle-attack-why { margin: 0; color: var(--muted); font-size: 0.78rem; }
.battle-log { max-height: 180px; overflow-y: auto; }
.battle-confirm-text { margin: 0 0 12px; line-height: 1.5; }
.battle-confirm-hide { display: flex; align-items: center; gap: 6px; margin-bottom: 12px; color: var(--muted); font-size: 0.85rem; }
.battle-confirm-hide input { width: auto; margin: 0; }

@media (max-width: 640px) {
  .exp-sheet { top: 8px; left: 6px; right: 6px; bottom: 8px; }
  .exp-head { padding: 10px 12px 8px; }
  .exp-body { padding: 10px 12px 14px; }
  .battle-top { top: -10px; margin: -10px -12px 0; padding: 8px 12px 8px; }
  .exp-search { display: flex; flex-direction: column; overflow-y: auto; }
  .exp-search > * { flex: none; } /* 줄어들어 겹치지 않게 */
  .exp-search-main, .exp-gear { overflow: visible; }
  /* 폰 세로: 위에 [기록 | 발견한 아이템] 두 칸, 그 아래 버튼, 맨 아래 장비 화면 */
  .exp-search-main { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: stretch; gap: 10px 8px; }
  .exp-search-main .exp-log { min-height: 170px; max-height: 240px; }
  .exp-found { display: flex; flex-direction: column; min-width: 0; padding: 8px; border: 1px solid var(--line); border-radius: 6px; }
  .exp-found .exp-found-zone { flex: 1; min-height: 0; padding: 2px; }
  .exp-search-main .form-error, .exp-search-main .exp-actions { grid-column: 1 / -1; }
  .exp-gear { border-left: 0; border-top: 1px solid var(--line-strong); }
  .exp-found-grid { grid-template-columns: repeat(auto-fill, minmax(56px, 1fr)); }
}
/* 부상 상태와 전투 부위·치료 선택: 작은 화면에서도 줄을 넘긴다. */
.battle-treatments { display: flex; flex-wrap: wrap; gap: 6px; }
.battle-treatment-btn { padding: 8px 10px; border: 1px solid var(--line, #555); border-radius: 5px; background: var(--bg, #161616); color: inherit; cursor: pointer; }
/* 전투 중 회복 아이템: 이름 · − 치료량 + · 사용 */
.battle-heal { display: flex; flex: 1 1 100%; align-items: center; gap: 6px; flex-wrap: wrap; }
.battle-heal-name { flex: 1 1 auto; font-size: 0.85rem; }
.battle-heal-amount { min-width: 3em; text-align: center; font-variant-numeric: tabular-nums; }
.battle-heal-step { width: 32px; height: 32px; border: 1px solid var(--line-strong); border-radius: 5px; background: var(--bg, #161616); color: inherit; cursor: pointer; }
.battle-heal-step:disabled { opacity: 0.5; cursor: default; }
.battle-treatment-btn:disabled { opacity: 0.5; cursor: default; }
.battle-treatments { margin: 8px 0; }
#treat-part { display: block; width: 100%; margin: 12px 0; padding: 8px; }
