/* 모바일 화면 v2 — 한 화면에서 위아래로 훑는 사건 보기 (2026-11-21 사용자 지시)
 *
 * 🔴 PC 콘솔(768px 이상)을 한 픽셀도 바꾸지 않는다.
 *    그 보장은 **선택자**가 한다 — 이 파일의 모든 규칙은 `.cc-m2` 안쪽이고,
 *    `.cc-m2` 는 주소에 `?m=v2` 가 있고 폭이 768 미만일 때만 그려진다(MobileV2.jsx).
 *    즉 PC 에서는 이 파일이 읽혀도 맞는 요소가 없다. 미디어 질의에 기대지 않는다 —
 *    기대면 `?m=v2` 없이 창을 좁힌 조사관의 기본 화면까지 바뀐다.
 *
 * 색·글꼴은 앱의 `--cc-*` 변수를 그대로 쓴다(사용자 지시 3). 아래 `--m2-*` 는
 * 그 변수에 이름만 붙인 것이고, 변수가 없는 환경을 위한 기본값이 뒤에 붙어 있다.
 */

.cc-m2 {
  /* 바탕·면 */
  --m2-bg: var(--cc-bg, #F3F6FB);
  --m2-card: var(--cc-panel-2, #ffffff);
  --m2-sunken: var(--cc-sunken, #F3F6FB);
  --m2-edge: var(--cc-edge, rgba(11, 33, 80, 0.10));
  /* 글자 */
  --m2-ink: var(--cc-ink, #0B2150);
  --m2-ink-2: var(--cc-ink-2, #44536E);
  --m2-ink-3: var(--cc-ink-3, #77849B);
  /* 강조 */
  --m2-blue: var(--cc-cyan, #1F5EFF);
  --m2-blue-soft: var(--cc-cyan-soft, #E6EEFF);
  --m2-red: var(--cc-red, #c12727);
  --m2-amber: var(--cc-amber, #b45e04);
  --m2-green: var(--cc-green, #1f8a3e);
  /* 치수 — 한 곳에서만 정한다 */
  --m2-radius: 28px;
  --m2-pad: 24px;
  --m2-safe-b: env(safe-area-inset-bottom, 0px);
  /* 저사양 휴대폰을 생각해 그림자는 한 겹만 쓴다(사용자 지시 3). */
  --m2-shadow: 0 2px 10px rgba(11, 33, 80, 0.08);

  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;              /* 가로 스크롤 금지 — 세로는 안쪽 .cc-m2-scroll 이 맡는다 */
  font-family: var(--font-sans, 'Malgun Gothic', '맑은 고딕', -apple-system, system-ui, sans-serif);
  color: var(--m2-ink);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

.cc-m2 *, .cc-m2 *::before, .cc-m2 *::after { box-sizing: border-box; }
.cc-m2 button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }

/* 첫 화면 — 지도가 배경이다. 이 층은 손가락을 통과시키고, 떠 있는 것들만 받는다. */
.cc-m2-home { position: absolute; inset: 0; pointer-events: none; }
.cc-m2-home > * { pointer-events: auto; }

/* 지도 위에 떠 있는 흰 원형 버튼 */
.cc-m2-fab {
  position: absolute;
  top: calc(12px + env(safe-area-inset-top, 0px));
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--m2-card);
  box-shadow: var(--m2-shadow);
  display: flex; align-items: center; justify-content: center;
  font-size: 19px; color: var(--m2-ink);
}
.cc-m2-fab-l { left: 14px; }
.cc-m2-fab-r { right: 14px; }
.cc-m2-fab:active { transform: scale(0.94); }

/* 아래에서 끌어올리는 시트 */
.cc-m2-sheet {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  background: var(--m2-card);
  border-radius: var(--m2-radius) var(--m2-radius) 0 0;
  box-shadow: 0 -2px 14px rgba(11, 33, 80, 0.10);
  padding: 10px 16px calc(16px + var(--m2-safe-b));
  max-height: 78dvh;
  display: flex; flex-direction: column;
  transition: transform 0.22s ease-out;
}
.cc-m2-grip {
  width: 44px; height: 5px; border-radius: 99px;
  background: var(--m2-edge);
  margin: 2px auto 12px;
  flex: none;
}
.cc-m2-sheet-head {
  display: flex; align-items: center; gap: 8px;
  font-size: 17px; font-weight: 800; letter-spacing: -0.01em;
  flex: none;
}
.cc-m2-sheet-head .cc-m2-caret { font-size: 13px; color: var(--m2-ink-3); }

/* 접힌 상태 — 최근 사건 칩이 가로로 흐른다 */
.cc-m2-chiprow {
  display: flex; gap: 8px;
  overflow-x: auto; overflow-y: hidden;
  margin-top: 12px; padding-bottom: 2px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.cc-m2-chiprow::-webkit-scrollbar { display: none; }
.cc-m2-chip {
  flex: none;
  padding: 9px 14px;
  border-radius: 99px;
  background: var(--m2-blue-soft);
  color: var(--m2-blue);
  font-size: 13px; font-weight: 700;
  white-space: nowrap;
}

/* 펼친 상태 — 세로 목록 */
.cc-m2-list { margin-top: 6px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.cc-m2-row {
  display: flex; align-items: center; gap: 12px;
  width: 100%;
  padding: 13px 2px;
  border-bottom: 1px solid var(--m2-edge);
  text-align: left;
}
.cc-m2-row:last-child { border-bottom: none; }
.cc-m2-row:active { background: var(--m2-sunken); }
.cc-m2-row-main { flex: 1; min-width: 0; }
.cc-m2-row-t {
  font-size: 15px; font-weight: 700; letter-spacing: -0.01em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cc-m2-row-s { font-size: 12.5px; color: var(--m2-ink-3); margin-top: 3px; }

/* 상태 알약칩 */
.cc-m2-pillchip {
  flex: none;
  padding: 5px 11px;
  border-radius: 99px;
  border: 1px solid var(--m2-blue);
  color: var(--m2-blue);
  font-size: 11.5px; font-weight: 700;
  white-space: nowrap;
}
.cc-m2-pillchip.is-done { border-color: var(--m2-green); color: var(--m2-green); }
.cc-m2-pillchip.is-run { border-color: var(--m2-amber); color: var(--m2-amber); }

/* ── 상세 화면 ───────────────────────────────────────────────────────── */
/* 지도는 뒤에 흐리게 남는다. backdrop-filter 가 없는 기기에서는 불투명 흰 바탕으로
   대체한다(@supports 아래) — 사용자 지시 3. */
.cc-m2-detail {
  position: absolute; inset: 0;
  background: var(--m2-bg);
  display: flex; flex-direction: column;
}
@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .cc-m2-detail {
    background: rgba(243, 246, 251, 0.92);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
  }
}

/* 스크롤은 이 한 곳에서만 일어난다(사용자 지시 3 — 카드 안에 따로 스크롤 영역을 만들지 않는다).
   예외는 가로로 넘기는 칩 줄뿐이고 그건 세로 스크롤을 가로채지 않는다. */
.cc-m2-scroll {
  flex: 1; min-height: 0;
  overflow-y: auto; overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 0 14px calc(28px + var(--m2-safe-b));
}

/* 스크롤 접힘 감지용 보초 — 화면에 보이지 않는다(IntersectionObserver 대상). */
.cc-m2-sentinel { height: 1px; margin: 0; padding: 0; }

/* 헤더 카드 — 펼친 상태 */
.cc-m2-hdr {
  position: sticky; top: 0; z-index: 3;
  margin: 0 -14px 14px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 14px 16px;
  background: var(--m2-bg);
  border-bottom: 1px solid transparent;
  transition: padding 0.18s ease-out, background 0.18s ease-out;
}
@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .cc-m2 .cc-m2-hdr.is-collapsed {
    background: rgba(243, 246, 251, 0.86);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
  }
}
.cc-m2-hdr.is-collapsed {
  padding-bottom: 8px;
  border-bottom-color: var(--m2-edge);
}
.cc-m2-hdr-top { display: flex; align-items: flex-start; gap: 12px; }
.cc-m2-back {
  flex: none;
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--m2-card);
  box-shadow: var(--m2-shadow);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px;
}
.cc-m2-hdr-name {
  flex: 1; min-width: 0;
  font-size: 21px; font-weight: 800; letter-spacing: -0.02em;
  line-height: 1.25;
  transition: font-size 0.18s ease-out;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cc-m2-hdr.is-collapsed .cc-m2-hdr-name { font-size: 16px; }

/* 접히면 사라지는 줄(주소·시각) — 높이를 0 으로 접는다. transform/opacity 위주. */
.cc-m2-hdr-sub {
  font-size: 13px; color: var(--m2-ink-2);
  margin: 10px 0 0 50px;
  max-height: 44px; opacity: 1;
  transform: translateY(0);
  overflow: hidden;
  transition: max-height 0.18s ease-out, opacity 0.14s ease-out, margin 0.18s ease-out, transform 0.18s ease-out;
}
.cc-m2-hdr.is-collapsed .cc-m2-hdr-sub {
  max-height: 0; opacity: 0; margin-top: 0;
  transform: translateY(-4px);
}
.cc-m2-dot { color: var(--m2-green); font-size: 10px; }

/* 알약 버튼 3개 — 접히면 글자가 사라지고 아이콘만 남는다 */
.cc-m2-pills {
  display: flex; gap: 8px;
  margin: 14px 0 0 0;
  transition: margin 0.18s ease-out;
}
.cc-m2-hdr.is-collapsed .cc-m2-pills { margin-top: 8px; }
.cc-m2-pill {
  flex: 1 1 0; min-width: 0;
  display: flex; align-items: center; justify-content: center; gap: 7px;
  height: 46px;
  border-radius: 14px;
  background: var(--m2-blue-soft);
  color: var(--m2-blue);
  font-size: 13px; font-weight: 700;
  transition: height 0.18s ease-out;
}
.cc-m2-hdr.is-collapsed .cc-m2-pill { height: 38px; }
.cc-m2-pill:active { filter: brightness(0.96); }
.cc-m2-pill-t {
  max-width: 7em; overflow: hidden; white-space: nowrap;
  opacity: 1;
  transition: max-width 0.18s ease-out, opacity 0.12s ease-out;
}
.cc-m2-hdr.is-collapsed .cc-m2-pill-t { max-width: 0; opacity: 0; }

/* 카드 */
.cc-m2-card {
  background: var(--m2-card);
  border-radius: var(--m2-radius);
  box-shadow: var(--m2-shadow);
  padding: var(--m2-pad);
  margin-bottom: 14px;
}
.cc-m2-card-head { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 14px; }
.cc-m2-card-head-main { flex: 1; min-width: 0; }
.cc-m2-card-t { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.3; }
.cc-m2-card-s { font-size: 12.5px; color: var(--m2-ink-3); margin-top: 4px; line-height: 1.5; }
.cc-m2-card-go {
  flex: none;
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--m2-sunken);
  color: var(--m2-ink-2);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
}

/* 큰 숫자 + 작은 단위 */
.cc-m2-big { font-size: 38px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.05; }
.cc-m2-unit { font-size: 14px; font-weight: 700; color: var(--m2-ink-3); margin-left: 3px; }

/* 2×2 수치 타일 */
.cc-m2-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cc-m2-tile {
  background: var(--m2-sunken);
  border-radius: 16px;
  padding: 13px 14px;
  min-width: 0;
}
.cc-m2-tile-k { font-size: 11.5px; color: var(--m2-ink-3); font-weight: 700; }
.cc-m2-tile-v { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; margin-top: 5px; }
.cc-m2-tile-v.is-off { font-size: 13px; font-weight: 700; color: var(--m2-ink-3); letter-spacing: 0; }
.cc-m2-tile-s { font-size: 11px; color: var(--m2-ink-3); margin-top: 3px; }

/* 아이콘 타일 + 이름 + 오른쪽 배지인 목록 행 */
.cc-m2-item {
  display: flex; align-items: center; gap: 12px;
  width: 100%;
  padding: 11px 0;
  border-bottom: 1px solid var(--m2-edge);
  text-align: left;
}
.cc-m2-item:last-child { border-bottom: none; }
.cc-m2-ico {
  flex: none;
  width: 38px; height: 38px; border-radius: 12px;
  background: var(--m2-blue-soft);
  color: var(--m2-blue);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 800;
}
.cc-m2-ico.is-top { background: var(--m2-blue); color: #fff; }
.cc-m2-item-main { flex: 1; min-width: 0; }
/* 🔴 `display: block` 이 있어야 두 줄로 쌓인다 — 안쪽이 span 이라 기본은 한 줄로 붙는다. */
.cc-m2-item-t {
  display: block;
  font-size: 14.5px; font-weight: 700;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cc-m2-item-s {
  display: block;
  font-size: 12px; color: var(--m2-ink-3); margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cc-m2-badge {
  flex: none;
  padding: 5px 10px; border-radius: 10px;
  background: var(--m2-sunken);
  font-size: 13px; font-weight: 800;
  font-variant-numeric: tabular-nums;
}

/* 미니 지도(SVG) — 손가락 스크롤을 가로채지 않는다(사용자 지시 3).
   누르면 전체 지도로 간다. */
.cc-m2-mini {
  display: block;
  width: 100%; height: 160px;
  border-radius: 18px;
  background: var(--m2-sunken);
  touch-action: pan-y;          /* 세로 스크롤은 페이지로 넘긴다 */
  overflow: hidden;
}
.cc-m2-mini svg { display: block; width: 100%; height: 100%; }
.cc-m2-minibtn {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 12px;
  padding: 9px 15px; border-radius: 99px;
  background: var(--m2-blue-soft); color: var(--m2-blue);
  font-size: 13px; font-weight: 700;
}

/* 압축 단계 막대 */
.cc-m2-bar { height: 8px; border-radius: 99px; background: var(--m2-blue); min-width: 6px; }
.cc-m2-bar-wrap { background: var(--m2-sunken); border-radius: 99px; overflow: hidden; margin-top: 6px; }

/* 맨 아래 주의 문구 — 법적 문구라 눈에 띄되 경보처럼 보이지 않게 한다 */
.cc-m2-notice {
  background: var(--m2-blue-soft);
  border-radius: 18px;
  padding: 16px 18px;
  font-size: 12.5px; line-height: 1.65;
  color: var(--m2-ink-2);
}

/* 값이 없을 때 */
.cc-m2-empty { font-size: 13px; color: var(--m2-ink-3); line-height: 1.6; }

@media (prefers-reduced-motion: reduce) {
  .cc-m2 * { transition: none !important; }
}
