/* 리셋 · 앱 셸 · 공통 프리미티브 */

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--app-bg);
  color: var(--text-strong);
  font-family: var(--font-body);
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}

/* color: inherit 은 필수 — button 은 색을 상속하지 않고 UA 기본값(buttontext=검정)을 씁니다.
   그러면 stroke="currentColor" 로 그린 아이콘이 다크 배경 위에서 검정으로 찍혀 안 보입니다. */
input, select, textarea, button { font-family: inherit; color: inherit; }

a { color: var(--link); text-decoration: none; }
a:hover { color: var(--accent-forecast); }

::-webkit-scrollbar { display: none; }
* { scrollbar-width: none; }

@keyframes riseIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes spin   { to { transform: rotate(360deg); } }
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ── 앱 셸 ── */
.app {
  max-width: var(--app-max-width);
  margin: 0 auto;
  min-height: 100vh;
  background: var(--app-bg);
  position: relative;
}

.page { padding-bottom: calc(var(--tabbar-height) + env(safe-area-inset-bottom)); min-height: 100vh; }

/* ── 탭별 상단 유틸리티 바 ── */
/* 헤더 높이는 탭마다 같아야 합니다(2026-08-26 확정).
   예전에는 padding + 내용물로 높이가 정해져서, `+ 트립 시작` 버튼(40px)이나
   시설 배지(32px)가 든 탭만 헤더가 두꺼워졌습니다(51 / 59 / 68 / 74px로 제각각).
   Marketplace 기준인 51px로 고정하고, 안의 요소는 그 안에서 가운데 정렬만 합니다.
   상태바 영역은 노치 기기 표준 방식을 따릅니다 — 그 줄엔 아무것도 그리지 않고,
   딱 env(safe-area-inset-top)만큼만 배경색으로 채워 자연스럽게 이어붙입니다.
   여백을 임의로 더 주지 않고 시스템이 알려주는 실제 값만 씁니다(값 없는 기기에선 0). */
.topbar {
  background: var(--surface-header);
  height: calc(var(--topbar-h) + env(safe-area-inset-top));
  box-sizing: border-box;
  padding: env(safe-area-inset-top) var(--pad-screen) 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.topbar__left  { display: flex; align-items: center; gap: 6px; min-width: 0; }
.topbar__title { font-size: 14.5px; font-weight: 700; color: var(--text-strong); letter-spacing: .3px; }
.topbar__right { display: flex; align-items: center; gap: 14px; color: var(--text-muted); }
.topbar__icon  { display: flex; background: none; border: none; padding: 0; color: inherit; cursor: pointer; }

/* 알림 아이콘은 기능이 없어 전부 뺐습니다(2026-08-26) — 스타일도 함께 지웁니다.
   알림을 실제로 만들 때 다시 세우면 됩니다. */

/* ── 하단 탭 바 ── */
/* 아이콘·라벨은 위쪽에 바짝 붙이고, 홈 인디케이터 몫은 그 아래 별도 영역(env)으로만
   내줍니다 — 예전엔 그 여유분(6px)을 안전영역과 상관없이 항상 깔아둬서 아이콘이
   필요 이상으로 아래로 처져 있었고, 그러면서도 실제 홈 인디케이터(노치 기기 약 34px)는
   전혀 못 피하고 있었습니다(--tabbar-height 참고). */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0;
  max-width: var(--app-max-width); margin: 0 auto;
  display: flex;
  background: var(--surface-header);
  border-top: 1px solid var(--line-10);
  padding: 3px 0 env(safe-area-inset-bottom);
  z-index: 50;
}
.tabbar__btn {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  background: none; border: none;
  font-size: 11px; letter-spacing: .2px; cursor: pointer; padding: 4px 0;
  color: var(--text-muted); font-weight: 500;
  min-height: 44px;
}
.tabbar__btn.is-active { color: var(--text-strong); font-weight: 700; }

/* ── 세그먼트 컨트롤 ── */
.segmented {
  display: flex; gap: 4px;
  background: rgba(255, 255, 255, .04);
  border-radius: var(--r-pill);
  padding: 4px;
}
.segmented__btn {
  flex: 1; padding: 9px 0; border: none; border-radius: var(--r-pill);
  font-size: 15px; font-weight: 700; cursor: pointer;
  background: transparent; color: var(--text-muted);
  min-height: 44px;
}
.segmented__btn.is-active { background: rgba(255, 255, 255, .10); color: var(--text-strong); }

/* ── 바텀시트 ── */
.sheet-overlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, .6);
  z-index: 100;
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet {
  width: 100%; max-width: var(--app-max-width);
  background: var(--surface-sheet);
  border-radius: var(--r-sheet);
  border: 1px solid var(--line-10); border-bottom: none;
  max-height: 86vh; display: flex; flex-direction: column;
}
/* 등장 애니메이션은 "새로 열릴 때"만 재생합니다.
   렌더는 화면을 통째로 다시 그리므로, 무조건 붙여두면 시트가 떠 있는 동안
   다른 상태가 바뀔 때마다 팝업이 아래에서 다시 올라옵니다. */
.sheet-overlay.is-entering { animation: fadeIn .16s ease; }
.sheet.is-entering { animation: sheetUp .22s cubic-bezier(.22, .8, .3, 1); }
.modal.is-entering { animation: riseIn .2s ease; }

.sheet__head {
  padding: 16px 18px 12px;
  display: flex; justify-content: space-between; align-items: center;
  border-bottom: 1px solid var(--line-10); flex-shrink: 0;
}
.sheet__title { font-size: 15.5px; font-weight: 700; color: var(--text-strong); }
.sheet__close { background: none; border: none; font-size: 17px; color: var(--text-sub); cursor: pointer; padding: 4px 8px; }
.sheet__body { padding: 16px 18px 24px; overflow-y: auto; }
.sheet__foot {
  padding: 14px 18px calc(14px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line-10); display: flex; gap: 10px; flex-shrink: 0;
}
/* 본문이 이미 선으로 끝나는 시트에서는 버튼 위 선을 지웁니다 — 선이 두 줄로 겹쳐 보입니다.
   본문 아래·버튼 위의 기본 여백도 걷어내, 마지막 문단이 자기 위아래 여백을
   직접 정할 수 있게 합니다(그러지 않으면 아래쪽만 38px로 벌어집니다). */
.sheet--noFootLine .sheet__body { padding-bottom: 0; }
.sheet--noFootLine .sheet__foot { border-top: none; padding-top: 0; }

/* 중앙 모달 (Pool 상세 — 스펙 §8 규격) */
.modal {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: calc(100% - 48px); max-width: 380px; max-height: 74vh; overflow-y: auto;
  background: var(--surface-card); border-radius: 18px; border: 1px solid var(--line-10);
  padding: 20px 18px; z-index: 101;
  display: flex; flex-direction: column; gap: 12px;
}

/* ── 토스트 ── */
.toast {
  position: fixed; bottom: calc(var(--tabbar-height) + env(safe-area-inset-bottom) + 18px); left: 50%;
  transform: translateX(-50%);
  background: rgba(28, 28, 30, .96);
  border: 1px solid var(--line-12);
  color: var(--text-strong);
  font-size: 14px; font-weight: 600;
  padding: 12px 18px; border-radius: 12px;
  z-index: 200; max-width: calc(var(--app-max-width) - 40px);
  text-align: center; line-height: 1.5;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .5);
  animation: toastIn .2s ease;
}
.toast.is-error { border-color: rgba(226, 104, 90, .5); color: #ffb9b0; }

/* ── 공통 카드/버튼 ── */
.card {
  background: var(--surface-header);
  border: 1px solid var(--line-10);
  border-radius: var(--r-mid);
  padding: 18px;
}

.btn-primary {
  width: 100%; padding: 14px; border: none; border-radius: 12px;
  font-size: 15.5px; font-weight: 700; cursor: pointer;
  background: var(--cta-grad); color: #fff;
  box-shadow: 0 4px 14px rgba(26, 138, 175, .35);
  min-height: 44px;
}
.btn-primary:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }

.btn-ghost {
  padding: 13px; border: 1.5px solid var(--line-10); border-radius: 12px;
  background: var(--surface-header); color: var(--text-strong);
  font-size: 15.5px; font-weight: 700; cursor: pointer; min-height: 44px;
}

/* Phase 1 전용 "준비 중" 인라인 배지 — README 스펙 그대로.
   Phase 2에서 기능이 켜지면 이 배지만 제거하면 됩니다(카드 레이아웃 유지). */
.pending-badge {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-mid-2);
  border-radius: var(--r-inline-badge);
  padding: 6px 10px;
  margin-top: 10px;
}
.pending-badge--pool   { background: rgba(255, 90, 69, .16); }
.pending-badge--market { background: rgba(240, 180, 0, .16); }

/* 탭 전체가 준비 중인 화면 (Pool/Market 상단 안내) */
.pending-banner {
  margin: 0 var(--pad-screen) 12px;
  background: rgba(255, 255, 255, .05);
  border: 1px dashed var(--line-12);
  border-radius: var(--r-mid);
  padding: 14px 16px;
  font-size: 13.5px; line-height: 1.6; color: var(--text-quiet);
}
.pending-banner b { color: var(--text-mid-2); font-weight: 700; }

.empty-state {
  text-align: center; padding: 40px 16px;
  color: var(--text-muted); font-size: 14.5px; line-height: 1.7;
}

/* 터치 타깃 최소 44px — 아이콘의 시각 크기는 그대로 두고 누를 수 있는 영역만 넓힙니다.
   (레이아웃에 영향을 주지 않도록 가상 요소로 확장) */
.tap44 { position: relative; }
.tap44::after {
  content: '';
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: 44px; height: 44px;
}

.topbar__icon,
.hero__star,
.board-add,
.field-head .kebab,
.duo-card__ins,
.spotsheet__fav,
.ppost__menu,
.sheet__close { position: relative; }
.topbar__icon::after,
.hero__star::after,
.board-add::after,
.field-head .kebab::after,
.duo-card__ins::after,
.spotsheet__fav::after,
.ppost__menu::after,
.sheet__close::after {
  content: '';
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: 44px; height: 44px;
}
/* 리스트 항목 전체가 이미 넓은 경우엔 세로만 보장 */
.duo-card__ins::after { width: 100%; }

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