/* ==========================================================
   결 (GYEOL) — 디자인 토큰
   톤: 종이, 여백, 낮은 채도. 스와이프 앱이 아니라 편지에 가깝게.
   ========================================================== */
:root {
  --bone: #faf7f2;
  --paper: #ffffff;
  --ink: #17150f;
  --ink-soft: #4a453c;
  --muted: #857c6e;
  --line: #e6dfd3;
  --line-soft: #f0ebe2;
  --clay: #8c5a44;
  --clay-soft: #f3e7e0;
  --pine: #3f5d4b;
  --pine-soft: #e6ede8;
  --alert: #a3453b;

  --serif: "Nanum Myeongjo", "Noto Serif KR", ui-serif, Georgia, serif;
  --sans: "Pretendard", "Noto Sans KR", -apple-system, BlinkMacSystemFont,
    "Apple SD Gothic Neo", system-ui, sans-serif;

  --radius: 18px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; margin: 0; padding: 0; }

html, body {
  background: var(--bone);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  /* 한국어는 어절 중간에서 끊기면 읽기 나쁘다 */
  word-break: keep-all;
  overflow-wrap: anywhere;
  overscroll-behavior-y: none;
  line-height: 1.5;
}

body { padding-top: var(--safe-t); }

.serif { font-family: var(--serif); }

/* ---------- 레이아웃 ---------- */
.screen { display: none; min-height: 100dvh; }
.screen.on { display: block; }
.wrap { max-width: 560px; margin: 0 auto; padding: 0 20px; }
.pad-nav { padding-bottom: calc(76px + var(--safe-b)); }

/* ---------- 타이포 ---------- */
h1.title { font-family: var(--serif); font-size: 26px; font-weight: 700; line-height: 1.35; }
h2.sub { font-family: var(--serif); font-size: 19px; font-weight: 700; }
.label {
  display: block; font-size: 12.5px; font-weight: 600; color: var(--muted);
  letter-spacing: 0.02em; margin-bottom: 7px;
}
.note { font-size: 13px; line-height: 1.8; color: var(--muted); }
.hairline { height: 1px; background: var(--line); }

/* ---------- 카드 ---------- */
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

/* ---------- 버튼 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 0; border-radius: 999px; font-family: var(--sans);
  font-weight: 600; font-size: 15px; padding: 14px 22px;
  transition: opacity .15s ease, transform .1s ease; cursor: pointer;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .45; }
.btn-primary { background: var(--ink); color: var(--bone); }
.btn-clay { background: var(--clay); color: #fff; }
.btn-ghost { background: transparent; color: var(--ink-soft); border: 1px solid var(--line); }
.btn-full { width: 100%; }

/* ---------- 입력 ---------- */
.field {
  width: 100%; background: var(--paper); border: 1px solid var(--line);
  border-radius: 12px; padding: 13px 14px; font-size: 16px; /* 16px 미만이면 iOS가 확대한다 */
  font-family: var(--sans); color: var(--ink); outline: none;
}
.field:focus { border-color: var(--clay); }
.field::placeholder { color: #b3aa9c; }
textarea.field { resize: none; line-height: 1.7; }

/* ---------- 칩 ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 4px; border-radius: 999px;
  padding: 5px 11px; font-size: 12.5px; font-weight: 600; line-height: 1.2; white-space: nowrap;
}
.chip-tier { background: var(--clay-soft); color: var(--clay); }
.chip-verified { background: var(--pine-soft); color: var(--pine); }
.chip-plain { background: var(--line-soft); color: var(--ink-soft); }
.chip-alert { background: #f6e4e2; color: var(--alert); }

.pick {
  border: 1px solid var(--line); background: var(--paper); color: var(--ink-soft);
  padding: 9px 15px; border-radius: 999px; font-size: 14px;
  font-family: var(--sans); cursor: pointer;
}
.pick[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: var(--bone); }

.row { display: flex; gap: 8px; }
.wrap-row { display: flex; flex-wrap: wrap; gap: 8px; }
.grow { flex: 1; }

/* ---------- 하단 탭 ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  background: rgba(250,247,242,.94); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  padding-bottom: var(--safe-b);
}
.tabbar-inner { max-width: 560px; margin: 0 auto; display: grid; grid-template-columns: repeat(4,1fr); }
.tab {
  background: none; border: 0; padding: 11px 0 9px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  font-family: var(--serif); font-size: 15px; color: var(--muted);
}
.tab[aria-current="true"] { color: var(--ink); font-weight: 700; }
.tab .bar { height: 2px; width: 20px; border-radius: 2px; background: transparent; }
.tab[aria-current="true"] .bar { background: var(--ink); }
.tab .dot {
  position: absolute; margin-left: 30px; margin-top: -2px;
  width: 7px; height: 7px; border-radius: 50%; background: var(--clay);
}

/* ---------- 애니메이션 ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.rise { animation: rise .45s cubic-bezier(.22,1,.36,1) both; }

/* ---------- 토스트 ---------- */
#toast {
  position: fixed; left: 50%; bottom: calc(92px + var(--safe-b)); transform: translateX(-50%);
  background: var(--ink); color: var(--bone); padding: 12px 18px; border-radius: 999px;
  font-size: 14px; z-index: 90; opacity: 0; pointer-events: none; transition: opacity .2s;
  max-width: calc(100% - 40px); text-align: center;
}
#toast.on { opacity: 1; }

/* ---------- 가림 처리된 사진 ---------- */
.masked { position: relative; overflow: hidden; }
.masked > img { filter: blur(22px); transform: scale(1.1); }
.masked .mask-label {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 8px;
  color: #fff; font-size: 13px; text-shadow: 0 1px 4px rgba(0,0,0,.4);
}
