/* ==== preflight — Tailwind 없이 쓰는 최소 리셋 (검토 E1) ====
   복사해 온 globals.css 범위에는 리셋이 없다(자매 앱은 Tailwind preflight 가 준다).
   [hidden] 이 없으면 .lightbox 의 display:flex 가 hidden 속성을 이겨 전면 오버레이가
   계속 떠 있다. box-sizing 이 없으면 편집기 인풋이 콘텐트 박스로 22px 넘친다. */
*, *::before, *::after { box-sizing: border-box; }
body, h1, h2, h3, h4, h5, p, figure, blockquote, ul, ol, dl, pre { margin: 0; }
ul, ol { padding: 0; }
button, input, textarea, select { font: inherit; color: inherit; }
img, video { max-width: 100%; display: block; }
[hidden] { display: none !important; }
body { -webkit-tap-highlight-color: transparent; word-break: keep-all; overflow-wrap: break-word; }
/* word-break: keep-all 은 한국어 제목이 음절 중간에서 꺾이는 것을 막고,
   overflow-wrap 은 참고 링크의 긴 URL 이 칼럼을 뚫지 않게 한다. */

:root {
  /* ── app-v2/app/globals.css :root 토큰 — 이름·값 그대로 (자매 앱 동기화) ── */
  --background: #f5f9fd;
  --foreground: #16324f;
  --card: #ffffff;
  --card-foreground: #16324f;
  --popover: #ffffff;
  --popover-foreground: #16324f;
  --primary: #2b7de0;
  --primary-foreground: #ffffff;
  --secondary: #e8f1fa;
  --secondary-foreground: #16324f;
  --muted: #e8f1fa;
  --muted-foreground: #587294;
  --accent: #dcebf9;
  --accent-foreground: #16324f;
  --destructive: #e05d55;
  --destructive-foreground: #ffffff;
  --border: #d3e2f2;
  --input: #d3e2f2;
  --ring: #2b7de0;
  --chart-1: #e05d55;
  --chart-2: #d9a03f;
  --chart-3: #2fae7d;
  --chart-4: #2b7de0;
  --chart-5: #8b7ae0;
  --radius: 0.375rem;
  --sidebar: #f5f9fd;
  --sidebar-foreground: #16324f;
  --sidebar-primary: #2b7de0;
  --sidebar-primary-foreground: #ffffff;
  --sidebar-accent: #e8f1fa;
  --sidebar-accent-foreground: #16324f;
  --sidebar-border: #d3e2f2;
  --sidebar-ring: #2b7de0;
  --urgent: #e05d55;
  --warning: #c98f2e;
  --success: #279e72;
  --neutral: #587294;
  --cyan-glow: #2fa3d8;
  --shadow-1: 0 1px 2px rgba(23, 50, 79, 0.06);
  --shadow-2: 0 4px 14px rgba(23, 50, 79, 0.08);
  --shadow-3: 0 12px 32px rgba(23, 50, 79, 0.12);
  --glow-primary: 0 0 12px rgba(43, 125, 224, 0.35);
  --glow-cyan: 0 0 10px rgba(63, 178, 227, 0.45);
  --dur-fast: 140ms;
  --dur: 220ms;
  --dur-slow: 420ms;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);

  /* ── 바닐라 전용 추가 (Tailwind @theme 가 만들어 주던 것) ── */
  --surface-raised: #ffffff;
  --font-sans: 'IBM Plex Sans KR', ui-sans-serif, -apple-system, 'Segoe UI', Roboto,
    'Hiragino Kaku Gothic ProN', 'Hiragino Sans', 'Yu Gothic UI', 'Noto Sans JP',
    'Apple SD Gothic Neo', 'Noto Sans KR', 'Malgun Gothic', sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  /* T8: 여행기 산문만 명조 — 크롬·메타·회계·편집기는 고딕을 유지한다 */
  --font-serif: 'Noto Serif KR', 'Apple Myungjo', Batang, Georgia, serif;

  /* 4.5:1 미달 토큰의 텍스트 전용 잉크 — "새 색 금지" 원칙의 문서화된 예외 (검토 E3).
     장식(점·막대·글로우)은 계속 원 토큰을 쓴다. */
  --success-ink: #1f7e5b;   /* 4.73:1 on #f5f9fd */
  --warning-ink: #956a22;   /* 4.55:1 */
  --primary-ink: #2770ca;   /* 4.66:1 */

  /* ── 타비타비만의 축: 사진 우선 레이아웃 ── */
  --col-read: 34rem;      /* 읽는 칼럼 (카니카니 장부는 32rem) */
  --col-wide: 48rem;      /* 사진이 칼럼을 벗어나는 폭 */
  --gutter: 1rem;
  --photo-shadow: 0 2px 14px rgba(43, 125, 224, 0.08), var(--shadow-1);
}

html { background: var(--background); }
body { color: var(--foreground); font-family: var(--font-sans); -webkit-font-smoothing: antialiased; }
/* body 에는 배경을 주지 않는다 — 고정된 .ambient(z-index:-2)가 비쳐야 한다. */

/* ==== layout ==== */
/* [hidden] 규칙은 맨 위 preflight 로 옮겼다. */

.wrap { max-width: var(--col-read); margin-inline: auto; padding-inline: var(--gutter); }

/* 장부 헤더 조각 — secHead() 가 한글 라벨을 .eyebrow 안에 넣으므로,
   되돌리지 않으면 모든 섹션 제목이 10.5px 모노 대문자로 눌린다. */
.sec-head { margin: 1.75rem 0 0.5rem; }
/* 검토 E4: 섹션 머리(0.9375rem)가 본문(1rem)보다 작지만 눈썹·굵기가 위계를 진다 */
.sec-label { margin-left: 0.5rem; font-family: var(--font-sans); font-size: 0.9375rem;
  font-weight: 600; letter-spacing: normal; text-transform: none; color: var(--foreground); }
/* 검토 E4: 텍스트 확대를 따라가도록 — 기본 크기에선 동일(10.5px) */
.eyebrow { font-size: 0.65625rem; }
.sec-count { font-size: 0.75rem; color: var(--muted-foreground); }
.card-count { margin-left: auto; color: var(--muted-foreground); font-size: 0.75rem; }
.trip-head { margin-bottom: 1.5rem; }
.bars { max-width: var(--col-read); margin-inline: auto; }
.period { margin-top: 0.25rem; }
.sources { max-width: var(--col-read); margin: 2rem auto 0; font-size: 0.8125rem;
  display: flex; gap: 0.375rem; align-items: center; }
.ledger { max-width: var(--col-read); margin-inline: auto; }
.led-head { display: flex; gap: 0.375rem; align-items: center; font-size: 0.8125rem; }
.led-day { color: var(--muted-foreground); font-size: 0.75rem; }
.led-amt, .led-payer { color: var(--muted-foreground); }
/* 검토 E4: 회계의 한글("2만"·"환전")이 mono 로 깨지지 않게 — 안전하게 sans */
.led-amt, .led-head .readout { font-family: var(--font-sans); }
.itin-body { min-width: 0; }
.itin-title { font-weight: 500; }
.days-editor { display: grid; }
/* 검토 D5·E5: sticky + 자매 앱과 크롬 폭 일치(col-read) */
.topbar { position: sticky; top: 0; z-index: 45; max-width: var(--col-read);
  margin-inline: auto; display: flex;
  align-items: baseline; justify-content: space-between;
  padding: max(0.75rem, env(safe-area-inset-top)) var(--gutter) 0.5rem;
  background: rgba(245, 249, 253, 0.92); backdrop-filter: blur(8px); }
.brand { font-weight: 600; letter-spacing: -0.01em;
  touch-action: manipulation; cursor: pointer; }
/* '저장 중…' 같은 한글 상태는 mono 로 흘리지 않는다 (검토 E4의 연장) */
.sync { font-family: var(--font-sans); }
/* 백엔드 미연결 배너 — 장부 문법: 상자가 아니라 헤어라인 한 줄 (4차 검토 B6) */
.banner { position: sticky; top: 0; z-index: 44; max-width: var(--col-wide);
  margin-inline: auto; padding: 0.375rem var(--gutter); font-size: 0.8125rem;
  color: var(--warning-ink); background: rgba(245, 249, 253, 0.92);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--border);
  display: flex; gap: 0.5rem; align-items: baseline; }
main { padding-bottom: 5.5rem; }

/* ==== 연대기 카드 — 사진이 곧 카드다(디박싱의 유일한 예외) ==== */
.cards { display: grid; gap: 2rem; }
.trip-card { display: block; color: inherit; text-decoration: none; }
.cover { border-radius: var(--radius); overflow: hidden; background: var(--muted);
  box-shadow: var(--photo-shadow); aspect-ratio: 3 / 2; }
.cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover-empty { width: 100%; height: 100%;
  background: linear-gradient(135deg, var(--muted), var(--accent)); }

/* T1-나: 빈 커버는 3:1 슬림 밴드 — NOT COMPILED 워터마크 + 모서리 브래킷(콘솔 문법) */
.cover-slim { aspect-ratio: 3 / 1; position: relative; }
.cover-wm { position: absolute; inset: 0; display: grid; place-content: center;
  background: linear-gradient(135deg, var(--secondary), var(--accent)); }
.cover-wm span { font-family: var(--font-mono); font-size: 0.65625rem; font-weight: 500;
  letter-spacing: 0.22em; color: rgba(43, 125, 224, 0.4); }
.brk { position: absolute; width: 14px; height: 14px;
  border-color: rgba(43, 125, 224, 0.5); border-style: solid; }
.brk-tl { top: 6px; left: 6px; border-width: 1.5px 0 0 1.5px; border-top-left-radius: 4px; }
.brk-br { bottom: 6px; right: 6px; border-width: 0 1.5px 1.5px 0; border-bottom-right-radius: 4px; }
.card-title { font-size: 1.125rem; font-weight: 600; margin-top: 0.5rem; }
.card-meta { color: var(--muted-foreground); font-size: 0.8125rem; margin-top: 0.25rem;
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.375rem; }
.dot { color: var(--border); }

/* 상태 배지 — 검토 E3: 11px 텍스트는 잉크 변형(-ink)을 쓴다. 장식은 원 토큰 유지. */
.st { margin-left: 0.5rem; font-family: var(--font-sans); letter-spacing: normal;
  text-transform: none; font-size: 0.6875rem; }
.st-done { color: var(--success-ink); }
.st-draft { color: var(--warning-ink); }
.st-empty { color: var(--neutral); }
.flag-warn { margin-left: 0.5rem; color: var(--warning-ink); font-size: 0.6875rem;
  font-family: var(--font-sans); letter-spacing: normal; text-transform: none; }

/* ==== 여행 상세 — 좁은 본문, 넓은 사진 ==== */
.trip { max-width: var(--col-wide); margin-inline: auto; padding-inline: var(--gutter); }
.trip-title { font-size: clamp(1.75rem, 5vw, 2.5rem); font-weight: 600;
  letter-spacing: -0.02em; line-height: 1.2; }
.trip-meta { color: var(--muted-foreground); font-size: 0.8125rem; margin-top: 0.5rem;
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.375rem; }
.cover-hero { aspect-ratio: 16 / 9; margin-bottom: 1rem; }
/* T8: 산문만 명조 — 크롬·메타·회계·편집기는 고딕/모노 유지 */
.prose { max-width: var(--col-read); margin-inline: auto;
  font-family: var(--font-serif); line-height: 1.85; }
.prose > * + * { margin-top: 1.25rem; }
.prose h2 { font-size: 1.25rem; font-weight: 600; }
.prose h3 { font-size: 1.0625rem; font-weight: 600; }
.prose blockquote { border-left: 2px solid var(--border); padding-left: 0.875rem;
  color: var(--muted-foreground); }
.prose hr { border: 0; border-top: 1px solid var(--border); }

/* 사진은 읽는 칼럼을 벗어난다 */
.figure { max-width: var(--col-wide); margin: 1.75rem auto; }
.figure img, .figure video { width: 100%; height: auto; display: block;
  border-radius: var(--radius); background: var(--muted); box-shadow: var(--photo-shadow); }
/* 검토 E4: 한글 캡션은 mono 로 흘리지 않는다 */
figcaption { font-family: var(--font-sans); font-size: 0.8125rem;
  color: var(--muted-foreground); margin-top: 0.5rem; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.5rem; margin: 1.5rem 0; }
.gallery .figure { margin: 0; }
.gallery img { aspect-ratio: 1 / 1; object-fit: cover; }
/* 영상의 재생 전 상태 — 어두운 무대 타일 위에 네이티브 재생 버튼 (4차 검토) */
.figure video { aspect-ratio: 16 / 9;
  background: linear-gradient(180deg, #14273d, #23405f); object-fit: contain; }
.gallery video { aspect-ratio: 1 / 1; }
/* 백엔드 미연결·로드 실패 자리표시자 (4차 검토 B6) */
.media-missing { aspect-ratio: 3 / 2; display: grid; place-content: center;
  background: linear-gradient(135deg, var(--muted), var(--accent));
  color: var(--muted-foreground); font-size: 0.8125rem; border-radius: var(--radius); }

/* 검토 E2: 폰에서 사진이 실제로 넓게 — 본문과 사진의 폭이 눈으로 다르다 */
@media (max-width: 48rem) {
  .figure, .cover-hero { margin-inline: calc(-1 * var(--gutter)); max-width: none; }
  .figure img, .figure video, .cover-hero img { border-radius: 0; }
  .figure figcaption { padding-inline: var(--gutter); }
  .gallery .figure { margin: 0; }            /* 격자는 계속 안쪽 */
  .gallery .figure img { border-radius: var(--radius); }
}
.figure--bleed { max-width: none; margin-inline: calc(50% - 50vw); }
.figure--bleed img { border-radius: 0; }

.day { margin-top: 2.5rem; }
.day-head { display: flex; align-items: baseline; justify-content: space-between;
  border-bottom: 1px solid var(--border); padding: 0.75rem 0 0.375rem;
  max-width: var(--col-read); margin-inline: auto; }
/* 검토 E4·F2: 날짜 머리는 h3 로 내려가고, 본문(1rem)보다 크게 */
.day-head h3 { font-size: 1.125rem; font-weight: 600; }

/* 검토 C1: 날짜 점프 바 — 137 화면짜리 여행의 내부 이동 수단 */
.jump { position: sticky; top: 2.5rem; z-index: 40; display: flex; gap: 0.25rem;
  overflow-x: auto; -webkit-overflow-scrolling: touch; padding: 0.5rem var(--gutter);
  margin-inline: calc(-1 * var(--gutter));
  background: rgba(245, 249, 253, 0.92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border); }
.jump a { flex: 0 0 auto; font-size: 0.8125rem; color: var(--muted-foreground);
  padding: 0.25rem 0.625rem; border-radius: 999px; text-decoration: none; }
.jump a:active { background: rgba(43, 125, 224, 0.1); color: var(--primary); }
/* 렌즈 활성 칩 — 수장고 분류 칩과 같은 문법 */
.jump a.on { background: rgba(43, 125, 224, 0.1); color: var(--primary-ink); }
html { scroll-behavior: smooth; }

/* 일정표 — 시간대 8단 (토오루 님 노션 규칙) */
.itinerary { max-width: var(--col-read); margin: 0.5rem auto; list-style: none; }
.itin-row { display: grid; grid-template-columns: 3.5rem 1fr; gap: 0.75rem;
  padding: 0.625rem 0.25rem; border-top: 1px solid rgba(211, 226, 242, 0.4);
  border-left: 3px solid transparent; }   /* 검토 E5: 색 띠 3px */
.itin-time { font-size: 0.75rem; color: var(--muted-foreground); }
.itin-memo { color: var(--muted-foreground); font-size: 0.8125rem; margin-top: 0.25rem; }
.tb-0 { border-left-color: #e05d55; }  .tb-1 { border-left-color: #d98a3f; }
.tb-2 { border-left-color: #a8921f; }   /* T2-나: 노랑만 어둡게 — 흰 바탕 시인성 */  .tb-3 { border-left-color: #2fae7d; }
.tb-4 { border-left-color: #2b7de0; }  .tb-5 { border-left-color: #8a6a4a; }
.tb-6 { border-left-color: #8b7ae0; }  .tb-7 { border-left-color: #587294; }

/* 회계 · 체크리스트 · 링크 — 전부 장부 문법(하드라인 행) */
.led-list, .checklist, .links, .idea-list { max-width: var(--col-read);
  margin: 0.5rem auto; list-style: none; }
.led-row { display: grid; grid-template-columns: 3.5rem 1fr auto auto; gap: 0.5rem;
  padding: 0.5rem 0.25rem; border-top: 1px solid rgba(211, 226, 242, 0.4); font-size: 0.875rem; }
.led-raw pre { white-space: pre-wrap; font-family: var(--font-mono); font-size: 0.75rem;
  color: var(--muted-foreground); }
.checklist li, .links li, .idea-list li { padding: 0.4375rem 0.25rem;
  border-top: 1px solid rgba(211, 226, 242, 0.4); font-size: 0.875rem; }

/* ==== 분석 ==== */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.5rem; margin: 0.75rem 0; }
.stat { display: flex; flex-direction: column; align-items: baseline; }
.stat-value { font-size: 1.5rem; font-weight: 600; }
.stat-unit { font-size: 0.75rem; color: var(--muted-foreground); }
.stat-label { font-size: 0.75rem; color: var(--muted-foreground); margin-top: 0.125rem; }
.bar-row { display: grid; grid-template-columns: 5rem 1fr 2.5rem; gap: 0.625rem;
  align-items: center; padding: 0.375rem 0.25rem; font-size: 0.8125rem; }
.bar-track { height: 1px; background: var(--border); position: relative; }
/* 카니카니의 1px 발광 진행선과 같은 문법 */
.bar-fill { position: absolute; inset: 0 auto 0 0; height: 1px;
  background: rgba(43, 125, 224, 0.7); box-shadow: var(--glow-primary); }
.bar-count { text-align: right; color: var(--muted-foreground); }

/* ==== 탭 · 토스트 · 버튼 · 라이트박스 ==== */
.tabs { position: fixed; inset: auto 0 0 0; z-index: 50; display: flex; gap: 0.25rem;
  justify-content: center; background: rgba(245, 249, 253, 0.9);
  border-top: 1px solid var(--border); backdrop-filter: blur(12px);
  padding: 0.5rem 0.5rem max(0.5rem, env(safe-area-inset-bottom)); }
.tab { border: 0; background: transparent; color: var(--muted-foreground);
  padding: 0.5rem 1.25rem; border-radius: 0.5rem; min-height: 44px;
  font-size: 0.875rem; cursor: pointer; }
.tab.active { color: var(--primary-ink); background: rgba(43, 125, 224, 0.1); }
.btn { background: var(--card); border: 1px solid var(--border); color: var(--foreground);
  border-radius: var(--radius); padding: 0.5rem 0.875rem; min-height: 44px;
  font-size: 0.875rem; cursor: pointer; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted-foreground);
  text-decoration: none; display: inline-flex; align-items: center; }
.trip-actions, .actions { display: flex; justify-content: space-between;
  align-items: center; margin: 0.5rem auto 1rem; }
.toast { position: fixed; left: 50%; bottom: 5rem; transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.95); border: 1px solid var(--border);
  border-radius: 999px; box-shadow: var(--shadow-2); backdrop-filter: blur(12px);
  padding: 0.5rem 1rem; font-size: 0.8125rem; z-index: 60; }
.empty, .muted { color: var(--muted-foreground); font-size: 0.875rem; }
/* 시각적으로만 숨기는 유틸 — 보조기술에는 읽힌다 (검토 F6) */
.vh { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%);
  white-space: nowrap; border: 0; }
/* 검토 C3: 연속 보기 — 스크롤 잠금, 좌우 내비, 로딩·실패 상태 */
.lightbox { position: fixed; inset: 0; z-index: 70; background: rgba(22, 50, 79, 0.92);
  display: flex; align-items: center; justify-content: center;
  touch-action: none; overscroll-behavior: contain; }
.lb-stage { position: relative; min-width: 40vw; min-height: 40vh;
  display: grid; place-content: center;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.06) 0%, transparent 70%); }
.lb-stage img, .lb-stage video { max-width: 96vw; max-height: min(88vh, 92dvh); display: block; }
.lb-stage.loading::after { content: '불러오는 중…'; position: absolute;
  color: rgba(255, 255, 255, 0.65); font-family: var(--font-mono); font-size: 0.75rem; }
.lb-error { color: rgba(255, 255, 255, 0.85); font-size: 0.8125rem; }
.lb-close { position: absolute; top: max(0.75rem, env(safe-area-inset-top)); right: 0.75rem;
  min-width: 44px; min-height: 44px; border: 0; border-radius: 999px;
  background: rgba(255, 255, 255, 0.9); font-size: 1rem; cursor: pointer; }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%);
  min-width: 44px; min-height: 44px; border: 0; border-radius: 999px;
  background: rgba(255, 255, 255, 0.85); font-size: 1.25rem; cursor: pointer; }
.lb-prev { left: 0.5rem; } .lb-next { right: 0.5rem; }
.lb-count { position: absolute; bottom: max(1rem, env(safe-area-inset-bottom));
  left: 50%; transform: translateX(-50%); color: rgba(255, 255, 255, 0.85);
  font-size: 0.75rem; }

@media (prefers-reduced-motion: reduce) {
  /* 사진 관련 동작도 전부 끈다(자매 앱의 집안 규칙) */
  .view-enter:not([hidden]), .lightbox { animation: none; transition: none; }
  html { scroll-behavior: auto; }
}

/* ==== editor ==== */
.editor { display: grid; gap: 1rem; }
.field { display: grid; gap: 0.375rem; }
/* 검토 E4: 16px 미만 인풋은 iOS 가 포커스 시 화면을 확대한다 */
.field input, .field textarea, .field select {
  font-family: inherit; font-size: 1rem; color: var(--foreground);
  background: var(--card); border: 1px solid var(--input);
  border-radius: var(--radius); padding: 0.625rem 0.75rem; width: 100%; }
/* 검토 E4: eyebrow 를 라벨로 쓰면 한글 지시문이 10.5px 대문자 mono 가 된다 */
.field > .eyebrow { font-family: var(--font-sans); font-size: 0.8125rem;
  letter-spacing: normal; text-transform: none; }
.field textarea { resize: vertical; line-height: 1.7; }
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none; border-color: var(--ring); box-shadow: var(--glow-primary); }
.field-inline { display: flex; align-items: center; gap: 0.5rem; font-size: 0.875rem; }
.day-editor { display: grid; gap: 0.625rem; padding: 1rem 0;
  border-top: 1px solid var(--border); }
.list-editor { display: grid; gap: 0.5rem; padding: 1rem 0; border-top: 1px solid var(--border); }
.list-row { display: flex; gap: 0.375rem; align-items: center; }
.list-row input[type="text"] { flex: 1; min-width: 0; }
.list-row input[type="checkbox"] { width: auto; flex: 0 0 auto; }

/* 검토 B2: 날짜별 미디어 스트립 — 헤어라인 행 + 44px 썸네일 + 캡션 인풋 */
.media-strip { display: grid; }
.media-row { display: flex; gap: 0.5rem; align-items: center; padding: 0.375rem 0;
  border-top: 1px solid rgba(211, 226, 242, 0.4); }
.media-row img, .media-row video { width: 44px; height: 44px; object-fit: cover;
  border-radius: var(--radius); background: var(--muted); flex: 0 0 auto; }
/* 캡션도 16px — iOS 확대 방지는 .field 만으로는 안 잡힌다 (4차 검토) */
.media-row input { flex: 1; min-width: 0; font-size: 1rem; color: var(--foreground);
  background: var(--card); border: 1px solid var(--input);
  border-radius: var(--radius); padding: 0.375rem 0.5rem; }
.media-row .btn { flex: 0 0 auto; }

/* ==== stage — 카니카니와 같은 무대 (app-v2 globals.css 이식) ==== */
html { background: var(--background); }
body { color: var(--foreground); font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased; }
/* body 에 배경을 주지 않는다 — 고정된 .ambient(z-index:-2)가 비쳐야 한다. */
body::before {
  content: '';
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    linear-gradient(rgba(43, 125, 224, 0.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(43, 125, 224, 0.028) 1px, transparent 1px);
  background-size: 30px 30px, 30px 30px;
}

.sec-head {
  display: flex;
  align-items: center;
  gap: 10px;
}
.sec-head .rule {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--border), rgba(211, 226, 242, 0));
}

.ambient {
  position: fixed;
  inset: 0;
  z-index: -2;
  overflow: hidden;
  pointer-events: none;
}

/* Base sky: white near the horizon rising into a clearer sky-blue. */
.ambient-sky {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(140% 85% at 50% 112%, #ffffff 0%, rgba(255, 255, 255, 0) 52%),
    linear-gradient(180deg, #a9d0f6 0%, #c9e2fb 34%, #e6f1fc 66%, #f5f9fd 100%);
}

/* Sun rays / god-rays fanning from the top, gently breathing. */
.ambient-rays {
  position: absolute;
  top: -30%;
  left: 50%;
  width: 160%;
  height: 90%;
  transform: translateX(-50%);
  background: repeating-conic-gradient(
    from 90deg at 50% 0%,
    rgba(255, 255, 255, 0.5) 0deg,
    rgba(255, 255, 255, 0) 3deg 9deg
  );
  mask-image: radial-gradient(70% 90% at 50% 0%, black, transparent 72%);
  opacity: 0.5;
  animation: rays-breathe 12s var(--ease) infinite;
}

/* Big soft light-clouds drifting in slow arcs. */
.ambient-cloud {
  position: absolute;
  border-radius: 50%;
  filter: blur(42px);
  opacity: 0.8;
  will-change: transform;
}
.ambient-cloud-a {
  top: -14%;
  left: -20%;
  width: 88%;
  height: 58%;
  background: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0) 70%);
  animation: cloud-a 34s var(--ease) infinite alternate;
}
.ambient-cloud-b {
  top: 16%;
  right: -24%;
  width: 82%;
  height: 56%;
  background: radial-gradient(circle at 50% 50%, rgba(140, 200, 250, 0.65), rgba(140, 200, 250, 0) 70%);
  animation: cloud-b 44s var(--ease) infinite alternate;
}
.ambient-cloud-c {
  top: 44%;
  left: -10%;
  width: 70%;
  height: 46%;
  background: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.75), rgba(255, 255, 255, 0) 72%);
  animation: cloud-c 52s var(--ease) infinite alternate;
}

/* Warm sun bloom high center — the light source of the stage. */
.ambient-sun {
  position: absolute;
  top: -30%;
  left: 50%;
  width: 130%;
  height: 66%;
  transform: translateX(-50%);
  background: radial-gradient(closest-side, rgba(255, 248, 230, 0.7), rgba(255, 248, 230, 0) 70%);
}

/* Floating sun motes / sea sparkle. */
.ambient-motes {
  position: absolute;
  inset: 0;
}
.mote {
  position: absolute;
  bottom: -6%;
  border-radius: 50%;
  background: rgba(96, 176, 240, 0.7);
  box-shadow: 0 0 8px rgba(96, 176, 240, 0.65);
  opacity: 0;
  animation-name: mote-float;
  animation-timing-function: ease-in-out;
  animation-iteration-count: infinite;
  will-change: transform, opacity;
}
.mote-bright {
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 0 11px rgba(180, 222, 255, 0.85);
}

/* Sea shimmer band along the bottom. */
.ambient-sea {
  position: absolute;
  inset: auto 0 0 0;
  height: 30%;
  background:
    linear-gradient(180deg, rgba(63, 178, 227, 0) 0%, rgba(63, 178, 227, 0.26) 100%);
  mask-image: linear-gradient(180deg, transparent, black 42%);
}
.ambient-sea::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.7) 50%, transparent 100%);
  opacity: 0.5;
  animation: sea-sheen 8s var(--ease) infinite;
}

@keyframes cloud-a {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(18%, 9%) scale(1.12); }
}
@keyframes cloud-b {
  from { transform: translate(0, 0) scale(1.08); }
  to { transform: translate(-16%, -7%) scale(1); }
}
@keyframes cloud-c {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(14%, -8%) scale(1.1); }
}
@keyframes rays-breathe {
  0%, 100% { opacity: 0.35; transform: translateX(-50%) scale(1); }
  50% { opacity: 0.6; transform: translateX(-50%) scale(1.04); }
}
@keyframes mote-float {
  0% { transform: translateY(0) translateX(0); opacity: 0; }
  12% { opacity: 0.9; }
  88% { opacity: 0.9; }
  100% { transform: translateY(-118vh) translateX(var(--drift, 0)); opacity: 0; }
}
@keyframes sea-sheen {
  0%, 100% { transform: translateX(-30%); }
  50% { transform: translateX(30%); }
}

@media (prefers-reduced-motion: reduce) {
  .ambient-cloud,
  .ambient-rays,
  .mote,
  .ambient-sea::before {
    animation: none;
  }
  .mote { opacity: 0.5; }
}

/* 라우트 전환 시 main.focus() 가 콘텐츠 전체에 외곽선을 두르지 않게.
   (키보드 포커스 표시는 개별 컨트롤의 :focus-visible 이 담당한다.) */
main:focus { outline: none; }

/* ==== loot — 유물대장 (스펙 2026-08-16 §3) ====
   박스 금지 원칙: 행도 카드도 테두리 없음 — 스캔 이미지의 그림자만 깊이를 만든다. */
.loot-list { list-style: none; max-width: var(--col-read); margin-inline: auto; display: grid; gap: 1.5rem; }
.loot-row { display: grid; grid-template-columns: 6rem 1fr; gap: 0.875rem; align-items: start; }
.loot-row-noscan { grid-template-columns: 1fr; }
.loot-scans { display: grid; gap: 0.375rem; }
.loot-scans .figure { margin: 0; }
.loot-scans img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover;
  border-radius: var(--radius); box-shadow: var(--photo-shadow); }
.loot-name { font-weight: 600; margin-top: 0.125rem; }
/* ★는 오커 잉크 — T2 의 '날짜 미확인'과 같은 계열, 새 색이 아니다 */
.loot-stars { color: var(--warning-ink); letter-spacing: 0.08em; font-size: 0.8125rem; white-space: nowrap; }
.loot-why { font-size: 0.875rem; margin-top: 0.125rem; }
.loot-sub, .loot-note { font-size: 0.8125rem; margin-top: 0.125rem;
  display: flex; gap: 0.375rem; align-items: center; }
.loot-refs { margin-top: 0.25rem; font-size: 0.8125rem; }
.loot-refs summary { color: var(--muted-foreground); cursor: pointer; }
.loot-refs a { overflow-wrap: anywhere; }

/* ==== vault — 수장고 탭 ==== */
/* 인라인로 둔다 — flex gap 이 "3 점"처럼 숫자와 단위를 벌려 놓는다 */
.vault-stats { font-size: 0.8125rem; max-width: var(--col-read); margin-inline: auto; }
.vault-stats .dot { margin-inline: 0.375rem; }
/* 분류 칩 행 — 점프 바 문법: 텍스트 칩, 활성만 옅은 면. 개수는 mono readout. */
.vault-kinds { display: flex; gap: 0.25rem; overflow-x: auto; -webkit-overflow-scrolling: touch;
  max-width: var(--col-read); margin: 0.625rem auto 0.25rem; padding-bottom: 0.25rem; }
.vault-kinds button { flex: 0 0 auto; border: 0; background: transparent; cursor: pointer;
  font-size: 0.8125rem; color: var(--muted-foreground); padding: 0.25rem 0.625rem;
  border-radius: 999px; min-height: 32px; }
.vault-kinds button .readout { font-size: 0.6875rem; color: var(--muted-foreground); }
.vault-kinds button.on { color: var(--primary-ink); background: rgba(43, 125, 224, 0.1); }
.vault-kinds button.on .readout { color: var(--primary-ink); }
/* 등급 구획 머리 — 섹션보다 한 급 아래(여백 좁게), h3 */
.sec-head-sub { margin: 1.25rem 0 0.375rem; }
.sec-head-sub h3 { margin: 0; font-size: inherit; }
.sec-head-sub .loot-stars { font-size: 0.75rem; }
/* 검색 — 기능상 불가피한 인풋 면. 16px(iOS 확대 방지). */
.vault-search-row { max-width: var(--col-read); margin: 0.625rem auto 0; }
.vault-search { width: 100%; border: 1px solid var(--input); border-radius: var(--radius);
  background: var(--surface-raised); padding: 0.5rem 0.75rem; font-size: 1rem; }
.vault-trips { margin-bottom: 0; }
.vault-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr));
  gap: 1rem 0.875rem; max-width: var(--col-wide); margin-inline: auto; }
.loot-card { min-width: 0; }
.loot-card img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover;
  border-radius: var(--radius); box-shadow: var(--photo-shadow); }
.loot-card .loot-name { font-size: 0.875rem; font-weight: 500; margin-top: 0.375rem; }
.loot-card .loot-trip { display: block; font-size: 0.75rem; text-decoration: none; margin-top: 0.125rem; }
.loot-card .media-missing { aspect-ratio: 3 / 4; }
