/* 예본 환자 앱 (PWA) 공통 스타일
 *
 * ── 뼈대: 체질팔레트 `8chejil-app/backend/static/app.css` ──────────
 * 조판·화면문법을 그대로 가져왔다. 두 앱이 같은 한의원 것으로 보여야 한다.
 * **색만 예본앱 남색 토큰으로 바꿨다**(체질팔레트는 크림+갈색, 이쪽은 로고 남색).
 *
 * ── 조판: Yebon3.0 시안 H (사이트·예본콜·체질팔레트와 같은 언어) ──
 *   · **카드 상자를 두지 않는다.** 테두리·그림자 없이 여백으로만 나눈다
 *   · 큰 제목 weight 500, 작은 라벨 600 + 넓은 자간
 *   · 본문 18px / 줄간격 1.75 / 자간 -0.004em. 글씨가 커질수록 자간을 좁힌다
 *   · 강조는 색이 아니라 굵기(+밑줄) — 색약·흑백에서 사라지지 않게
 *   · 버튼은 알약형
 *
 * ── 화면 흐름: 토스 (체질팔레트에서 승계) ─────────────────────────
 *   한 화면에 결정 하나 · 하단 고정 버튼 · 바텀시트 · 완료 화면
 */

@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/variable/pretendardvariable-dynamic-subset.min.css');

:root {
  /* ── 브랜드 (mobile/theme.ts 와 같은 값. 한쪽만 바꾸지 말 것) ── */
  --canvas:   #FEFEFC;   /* 바탕 — 사이트 --canvas '1/4 크림' */
  --surface:  #FFFFFF;
  --navy:     #000040;   /* 로고 실색 — 잉크·제목·채운 버튼 (19.4:1) */
  --navy-mid: #5C5C85;   /* 라벨·캡션·보조 (6.3:1) */
  --danger:   #A6453B;   /* 되돌리기 어려운 동작 전용 (5.9:1) */
  --ok:       #2E6B4F;

  /* 구분선. ⚠ 사이트·앱과 공유하는 값이라 여기서만 바꾸지 말 것.
   * 실측 1.96:1 — 체질팔레트가 세운 "구분선 2:1 이상" 기준에 아주 살짝 못 미친다.
   * 올리려면 #B8B5AF(2.03:1). 사이트·mobile/theme.ts 와 **같이** 바꿔야 한다. */
  --line:    #BBB8B2;
  --line-lt: #E5E3DF;   /* 표 안쪽 얕은 구분에만. 바깥 테두리로 쓰지 말 것 */

  --radius: 16px;
  --radius-sm: 10px;

  /* 하단 고정 버튼이 가리는 높이 */
  --cta-space: 104px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Pretendard Variable', 'Pretendard', -apple-system, BlinkMacSystemFont,
               system-ui, sans-serif;
  max-width: 560px;
  margin: 0 auto;
  padding: 22px 20px 60px;
  background: var(--canvas);
  color: var(--navy);
  /* 한의원 환자 연령대를 생각하면 16px 은 작다 (Yebon3.0 실측 결정) */
  font-size: 18px;
  line-height: 1.75;
  letter-spacing: -0.004em;
  -webkit-font-smoothing: antialiased;
}

/* 큰 글씨일수록 자간을 좁힌다. 음수 자간은 **큰 제목에만** */
h1 { font-size: 27px; font-weight: 500; line-height: 1.34; letter-spacing: -0.032em; }
h2 { font-size: 21px; font-weight: 500; line-height: 1.4;  letter-spacing: -0.026em; }
h3 { font-size: 16px; font-weight: 600; letter-spacing: -0.022em; }
a  { color: var(--navy); text-decoration: underline; text-underline-offset: 3px; }

/* 분류·구획 라벨 — 자간을 넓혀 작은 글씨의 위계를 만든다 */
.tag { font-size: 11.5px; font-weight: 600; letter-spacing: 0.16em; color: var(--navy-mid); }
.cap { font-size: 12.5px; color: var(--navy-mid); }
.sub { font-size: 15px; color: var(--navy-mid); line-height: 1.65; }

/* ══════════════════════════════════════════════
   화면 문법 — 한 화면에 결정 하나
   토스에서 배운 것: 큰 대화체 헤드라인을 왼쪽에 두고,
   실행 버튼은 엄지가 닿는 화면 아래에 고정한다.
   ══════════════════════════════════════════════ */

/* 상단 얇은 진행 바. "1 / 3" 같은 글자보다 조용하다. */
.progress-top { position: fixed; top: 0; left: 0; right: 0; height: 3px; background: var(--line-lt); z-index: 50; }
.progress-top i {
  display: block; height: 100%; width: 0; background: var(--navy);
  border-radius: 0 2px 2px 0; transition: width 0.32s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* 뒤로가기. 제목 없이 화살표만. */
.back {
  border: none; background: none; cursor: pointer;
  color: var(--navy-mid); font: inherit; font-size: 15px;
  padding: 6px 2px; margin-bottom: 14px;
}

.q-title { font-size: 27px; font-weight: 500; line-height: 1.34; letter-spacing: -0.032em; margin-bottom: 10px; }
.q-sub   { font-size: 15px; color: var(--navy-mid); line-height: 1.65; margin-bottom: 28px; }

/* 하단 고정 실행 버튼 */
.cta-fixed {
  position: fixed; left: 0; right: 0; bottom: 0;
  padding: 12px 20px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--canvas) 72%, rgba(254,254,252,0));
  z-index: 40;
}
.cta-fixed > * { max-width: 520px; margin: 0 auto; }
body.has-cta { padding-bottom: var(--cta-space); }

/* 채운 버튼은 화면당 하나 — 주 동작에만 */
.btn {
  display: block; width: 100%; border: none; border-radius: 9999px;
  background: var(--navy); color: #fff;
  padding: 16px; font: inherit; font-size: 17px; font-weight: 500;
  letter-spacing: -0.02em; cursor: pointer;
}
.btn:disabled { opacity: 0.4; }
.btn-ghost {
  display: block; width: 100%; border: none; background: none;
  color: var(--navy-mid); font: inherit; font-size: 15px; font-weight: 500;
  padding: 14px; cursor: pointer;
}

/* 큰 선택지 — 탭 영역을 넉넉히. 상자 대신 선으로 나눈다 */
.choice {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; gap: 10px;
  padding: 20px 2px;
  border: none; border-top: 1px solid var(--line);
  background: none; color: var(--navy);
  font: inherit; font-size: 18px; font-weight: 500;
  text-align: left; cursor: pointer;
}
.choice:last-of-type { border-bottom: 1px solid var(--line); }
.choice:active { opacity: 0.55; }
.choice::after { content: '›'; color: var(--navy-mid); font-size: 20px; line-height: 1; flex-shrink: 0; }
.choice.plain::after { content: none; }
.choice .c-sub { display: block; font-size: 13.5px; font-weight: 400; color: var(--navy-mid); margin-top: 3px; }

/* 입력칸도 상자 대신 밑줄 */
.field {
  width: 100%; border: none; border-bottom: 1.5px solid var(--line);
  background: none; color: var(--navy); font: inherit;
  padding: 12px 2px; font-size: 17px;
}
.field:focus { outline: none; border-bottom-color: var(--navy); border-bottom-width: 2.5px; }
.field.code { font-size: 26px; font-weight: 500; letter-spacing: 0.32em; text-align: left; }

/* 바텀시트 — 새 페이지로 넘기지 않고 아래에서 올린다 */
.sheet-dim {
  position: fixed; inset: 0; background: rgba(0,0,32,0.38);
  opacity: 0; pointer-events: none; transition: opacity 0.22s; z-index: 60;
}
.sheet-dim.on { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 61;
  background: var(--canvas); border-radius: 20px 20px 0 0;
  padding: 10px 20px calc(22px + env(safe-area-inset-bottom));
  max-height: 82vh; overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
  box-shadow: 0 -6px 28px rgba(0,0,32,0.16);
}
.sheet.on { transform: none; }
.sheet-grip { width: 36px; height: 4px; border-radius: 2px; background: var(--line); margin: 0 auto 16px; }

/* 완료 화면 — 해냈다는 감각을 준다.
 * 바로 넘겨버리면 방금 한 일이 남았다는 실감이 없다. */
.done { text-align: center; padding: 56px 0 12px; }
.done .mark {
  width: 76px; height: 76px; border-radius: 50%;
  background: var(--navy); color: #fff;
  font-size: 38px; line-height: 76px; margin: 0 auto 20px;
}

/* 안내 문구 — 선 하나로 본문과 떼어 놓는다 */
.notice {
  margin-top: 34px; padding-top: 16px; border-top: 1px solid var(--line);
  font-size: 12.5px; color: var(--navy-mid); line-height: 1.7;
}
.msg { margin-top: 20px; font-size: 15px; line-height: 1.7; }
.msg.bad { color: var(--danger); }

.hide { display: none !important; }
.grow { flex: 1; min-height: 20px; }

/* ══════════════════════════════════════════════
   홈 화면에 추가 배너 (체질팔레트에서 이식)
   ⚠ iOS 는 홈 화면에 추가해야만 푸시가 온다. 이 배너는 편의가 아니라 필수 경로다.
   ══════════════════════════════════════════════ */
.install-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
  padding: 12px 16px calc(14px + env(safe-area-inset-bottom));
  transform: translateY(110%);
  transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.install-bar.on { transform: none; }
.ib-body {
  max-width: 520px; margin: 0 auto;
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border-radius: 16px; padding: 12px 14px;
  box-shadow: 0 6px 24px rgba(0, 0, 32, 0.16);
}
.ib-icon img { width: 42px; height: 42px; border-radius: 10px; display: block; }
.ib-text { flex: 1; min-width: 0; }
.ib-text b { display: block; font-size: 14.5px; font-weight: 600; letter-spacing: -0.022em; }
.ib-text span { font-size: 12.5px; color: var(--navy-mid); line-height: 1.5; }
.ib-text span b { display: inline; font-weight: 600; color: var(--navy); }
.ib-go {
  border: none; background: var(--navy); color: #fff;
  padding: 0 16px; height: 38px; border-radius: 9999px;
  font: inherit; font-size: 14px; font-weight: 500; cursor: pointer;
  flex-shrink: 0; letter-spacing: -0.02em;
}
.ib-x { border: none; background: none; color: var(--navy-mid); font-size: 15px; cursor: pointer; padding: 4px 2px; flex-shrink: 0; }

/* ══════════════════════════════════════════════
   체크리스트 — 한 줄에서 하나만 켜진다
   토글 여러 개로 두면 두 개를 켤 수 있어 모순된 답이 남는다.
   ══════════════════════════════════════════════ */
.seg-label { font-size: 15px; font-weight: 600; color: var(--navy); margin: 22px 0 9px; }
.seg-label .sub { font-size: 13px; font-weight: 400; color: var(--navy-mid); margin-left: 6px; }
.seg { display: grid; gap: 6px; }
.seg-3 { grid-template-columns: repeat(3, 1fr); }
.seg-4 { grid-template-columns: repeat(4, 1fr); }
.seg button {
  font: inherit; font-size: 13.5px; padding: 11px 2px; cursor: pointer;
  border: 1px solid var(--line); border-radius: 10px;
  background: none; color: var(--navy-mid);
  transition: background .12s ease, color .12s ease, border-color .12s ease;
}
.seg button[aria-pressed="true"] {
  background: var(--navy); border-color: var(--navy); color: var(--canvas); font-weight: 500;
}
.field-line {
  width: 100%; font: inherit; font-size: 16px; color: var(--navy);
  background: none; border: none; border-bottom: 1px solid var(--line);
  padding: 10px 0; outline: none;
}
.field-line:focus { border-bottom-color: var(--navy); }
.field-line::placeholder { color: var(--navy-mid); opacity: .7; }
textarea.field-line { resize: none; line-height: 1.7; }

/* ── 치료 계획 ─────────────────────────────────────────
   라벨과 값을 선으로만 가른다(상자 없음). 팔레트는 내원한 날만 채운다. */
.plist { margin-top: 8px; border-top: 1px solid var(--line); }
.prow { display: flex; gap: 16px; align-items: baseline; padding: 15px 2px; border-bottom: 1px solid var(--line); }
.prow .cap { width: 76px; flex: none; }
.prow span:last-child { font-size: 17px; font-weight: 600; }

.pal-h { display: grid; grid-template-columns: repeat(7, 1fr); gap: 7px; margin-top: 10px; }
.pal-h span { text-align: center; font-size: 11.5px; color: var(--navy-mid); }
.pal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 7px; margin-top: 7px; }
.pal i { display: block; aspect-ratio: 1 / 1; border-radius: 6px; border: 1px solid var(--line); }
.pal i.on { background: var(--navy); border-color: var(--navy); }
.pal i.later { border-color: var(--line-lt); }        /* 아직 오지 않은 날 — 빠뜨린 날처럼 보이면 안 된다 */
.pal i.today { border-color: var(--navy); border-width: 2px; }
