/* 신환 모바일 문진 — 환자 화면(본 구현). 화면 시안 prototype/style.css 를 그대로 옮기고, 바꾼 곳에 「본 구현」이라고 적었다.
   색 : 병원 태블릿 시안의 남색 · 파랑을 그대로 씀. 강조색은 고른 항목과 주 버튼에만.
   글자 : rem 단위 — 휴대폰 글자 크기 설정을 따라 커짐. 바깥 글꼴 · 그림을 불러오지 않는다. */
:root {
  color-scheme: light;
  --ink: #16202E;        /* 본문 글자 */
  --navy: #0B2E5C;       /* 질문 · 주 버튼 */
  --blue: #0059B3;       /* 고른 항목 */
  --blue-tint: #E6F0FB;  /* 고른 항목 바탕 */
  --muted: #55637A;      /* 안내 글 */
  --line: #8593A6;       /* 선택지 테두리 — 흰 바탕과 3:1 넘게 */
  --paper: #F5F7FA;      /* 바탕 */
  --white: #FFFFFF;
  --warn: #B3261E;       /* 빠진 답 안내 */
  --focus: #FFB000;
  --pad: 16px;
  --nav-h: 84px;
}
* { box-sizing: border-box; }
html { font-size: 100%; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: "Pretendard", "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", system-ui, sans-serif;
  line-height: 1.45; word-break: keep-all; overflow-wrap: anywhere;
}
button { font: inherit; color: inherit; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* 위쪽 : 병원명 · 진행 */
.top { position: sticky; top: 0; z-index: 5; background: var(--white); border-bottom: 1px solid #DDE3EB; }
.top-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 12px var(--pad) 10px; }
.brand { margin: 0; font-size: 0.9375rem; color: var(--muted); min-width: 0; }
.brand strong { color: var(--navy); font-weight: 700; margin-right: 4px; }
.step { margin: 0; font-size: 1rem; font-weight: 700; color: var(--navy); white-space: nowrap; }
.step small { font-size: 0.875rem; font-weight: 500; color: var(--muted); }
.bar { height: 4px; background: #DDE3EB; }
.bar i { display: block; height: 100%; width: 0; background: var(--blue); }

/* 본문 */
main { max-width: 560px; margin: 0 auto; padding: 22px var(--pad) calc(var(--nav-h) + 28px + env(safe-area-inset-bottom)); outline: none; }
h1 { margin: 0 0 6px; font-size: 1.625rem; line-height: 1.3; font-weight: 700; color: var(--navy); letter-spacing: -0.01em; }
.hint { margin: 0 0 18px; font-size: 1.0625rem; color: var(--muted); }
.note { margin: 16px 0 0; font-size: 1rem; color: var(--muted); }
.note.above { margin: -8px 0 16px; }    /* 본 구현 : 시안의 바로 적은 style(쪽 화면의 「모르겠으면 비워 두셔도」)을 이름으로 */
.note.before { margin: 0 0 16px; }      /* 본 구현 : 시안의 바로 적은 style(점수 화면의 설명)을 이름으로 */
.alert { margin: 0 0 14px; padding: 10px 12px; font-size: 1.0625rem; font-weight: 700; color: var(--warn); background: #FCEEEC; border-left: 4px solid var(--warn); }
.alert + .note.server { margin: -6px 0 14px; }   /* 본 구현 : 모르는 결과일 때 서버가 준 글 */
.group-label { margin: 18px 0 8px; font-size: 1rem; font-weight: 700; color: var(--muted); }
.group-label:first-of-type { margin-top: 0; }

/* 선택지 : 한 줄에 하나 */
.opts { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.opt {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 60px; padding: 10px 14px;
  text-align: left; font-size: 1.1875rem; font-weight: 600; line-height: 1.3;
  background: var(--white); border: 1px solid var(--line); border-radius: 10px; cursor: pointer;
}
.opt .mark { flex: none; width: 26px; height: 26px; border: 2px solid #8A97A8; background: var(--white); display: grid; place-items: center; }
.opt[data-kind="single"] .mark { border-radius: 50%; }
.opt[data-kind="multi"] .mark { border-radius: 6px; }
.opt .mark svg { width: 16px; height: 16px; opacity: 0; }
.opt .txt small { display: block; margin-top: 2px; font-size: 0.9375rem; font-weight: 500; color: var(--muted); }
.opt[aria-pressed="true"] { background: var(--blue-tint); border-color: var(--blue); box-shadow: inset 0 0 0 1px var(--blue); color: var(--navy); font-weight: 700; }
.opt[aria-pressed="true"] .mark { background: var(--blue); border-color: var(--blue); }
.opt[aria-pressed="true"] .mark svg { opacity: 1; }
.opt.apart { margin-top: 8px; }

/* 적는 칸 : 「기타」를 고르면 그 아래에, 10번은 목록 끝에(늘 보임). 안 적어도 된다.
   본 구현 : 알림을 칸 이름과 입력 칸 사이에 두려고 label 을 감싸는 div 로 바꿈(모양은 같다) */
.write { display: block; margin: 8px 0 4px; }
.opts + .write { margin-top: 18px; }
.write span { display: block; margin-bottom: 6px; font-size: 1.0625rem; font-weight: 600; color: var(--navy); }
.write small { font-size: 0.9375rem; font-weight: 500; color: var(--muted); white-space: nowrap; }
.write .alert { margin: 0 0 8px; }
.write input {
  display: block; width: 100%; min-height: 56px; padding: 10px 14px;
  font: inherit; font-size: 1.1875rem; color: var(--ink);
  background: var(--white); border: 1px solid var(--line); border-radius: 10px;
}
.write input[aria-invalid="true"] { border-color: var(--warn); box-shadow: inset 0 0 0 1px var(--warn); }   /* 본 구현 */
.write input:focus { outline: 3px solid var(--focus); outline-offset: 2px; border-color: var(--blue); }

/* 1번 : 아픈 곳 — 그림이 구분에 도움이 되므로 작은 칸 2열 */
.parts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.part {
  position: relative; display: flex; align-items: center; gap: 10px; min-height: 84px; padding: 8px 10px;
  text-align: left; font-size: 1.1875rem; font-weight: 600;
  background: var(--white); border: 1px solid var(--line); border-radius: 10px; cursor: pointer;
}
.part .fig { flex: none; width: 34px; height: 68px; }
.part .txt { min-width: 0; }                                                                     /* 본 구현 */
.part .txt small { display: block; margin-top: 2px; font-size: 0.9375rem; font-weight: 500; color: var(--muted); }   /* 본 구현 : 곳의 desc(1판에는 없음) */
.fig .b { fill: #CBD3DE; }
.fig .on { fill: var(--blue); }
.part .mark { position: absolute; top: 8px; right: 8px; width: 24px; height: 24px; border: 2px solid #8A97A8; border-radius: 6px; background: var(--white); display: grid; place-items: center; }
.part .mark svg { width: 15px; height: 15px; opacity: 0; }
.part[aria-pressed="true"] { background: var(--blue-tint); border-color: var(--blue); box-shadow: inset 0 0 0 1px var(--blue); color: var(--navy); font-weight: 700; }
.part[aria-pressed="true"] .mark { background: var(--blue); border-color: var(--blue); }
.part[aria-pressed="true"] .mark svg { opacity: 1; }

/* 1번의 둘째 화면 : 곳마다 한 줄 */
.side-row { padding: 14px 0; border-top: 1px solid #DDE3EB; }
.side-row:first-of-type { border-top: 0; padding-top: 0; }
.side-row.missing .side-name { color: var(--warn); }
.side-name { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; font-size: 1.1875rem; font-weight: 700; color: var(--navy); }
.side-name .fig { width: 18px; height: 36px; }
.seg { display: grid; grid-template-columns: repeat(auto-fit, minmax(4.4rem, 1fr)); gap: 6px; }
.seg button {
  min-height: 56px; padding: 6px 2px; font-size: 1.125rem; font-weight: 600; text-align: center;
  background: var(--white); border: 1px solid var(--line); border-radius: 10px; cursor: pointer;
}
.seg button .ck { display: none; width: 14px; height: 14px; margin-right: 3px; vertical-align: -1px; }
.seg button[aria-pressed="true"] { background: var(--blue); border-color: var(--blue); color: var(--white); font-weight: 700; }
.seg button[aria-pressed="true"] .ck { display: inline-block; }

/* 4번 : 0~10점 — 구간마다 한 줄. 색은 모양표(src/look.ts)가 --c 로 넣는다. 표에 없으면 회색 띠(본 구현) */
.pain { display: grid; gap: 8px; }
/* 폭이 좁거나 글자를 키우면 구간 문구가 위로, 숫자가 아래 줄로 내려간다 */
.band { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding-left: 10px; border-left: 6px solid var(--c, var(--line)); }
.band-label { flex: 0 0 6.25rem; font-size: 1.0625rem; font-weight: 700; line-height: 1.25; }
.nums { flex: 1 1 10rem; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.num {
  position: relative; min-height: 58px; font-size: 1.5rem; font-weight: 700; text-align: center;
  background: var(--white); border: 1px solid var(--line); border-radius: 10px; cursor: pointer;
}
.num .ck { display: none; position: absolute; top: 5px; right: 5px; width: 14px; height: 14px; }
.num[aria-pressed="true"] { background: var(--navy); border-color: var(--navy); color: var(--white); }
.num[aria-pressed="true"] .ck { display: block; }
.picked { margin: 16px 0 0; min-height: 1.6em; font-size: 1.25rem; font-weight: 700; color: var(--navy); }

/* 마지막 확인 : 줄 목록 */
.review { margin: 0; padding: 0; list-style: none; border-top: 1px solid #DDE3EB; }
.review button {
  display: grid; grid-template-columns: 5.25rem 1fr auto; align-items: start; gap: 10px; width: 100%; min-height: 60px; padding: 14px 2px;
  text-align: left; background: none; border: 0; border-bottom: 1px solid #DDE3EB; cursor: pointer;
}
.review button[disabled] { cursor: default; }                                                    /* 본 구현 : 보내는 중 */
.review .k { font-size: 1rem; color: var(--muted); padding-top: 2px; }
.review .v { font-size: 1.1875rem; font-weight: 700; line-height: 1.35; }
.review .v .it { display: inline-block; }
.review .v .it.none { font-weight: 500; color: var(--muted); }
.review .e { font-size: 1rem; font-weight: 700; color: var(--blue); padding-top: 2px; white-space: nowrap; }

/* 시작 · 완료 · 안내 */
.lead { margin: 0 0 14px; font-size: 1.75rem; line-height: 1.3; font-weight: 700; color: var(--navy); }
.plain { margin: 0 0 26px; padding: 0; list-style: none; font-size: 1.125rem; }
.plain li { padding: 6px 0; }
.who { padding-top: 22px; border-top: 1px solid #DDE3EB; }
.who p { margin: 0; font-size: 1.0625rem; color: var(--muted); }
.who .name { margin: 4px 0 6px; font-size: 2rem; font-weight: 700; color: var(--navy); }
.stack { display: grid; gap: 10px; margin-top: 22px; }
.done { padding-top: 12vh; text-align: center; }
.done .tick { width: 84px; height: 84px; margin: 0 auto 22px; border-radius: 50%; background: var(--blue); display: grid; place-items: center; }
.done .tick svg { width: 44px; height: 44px; }
.done h1 { font-size: 1.75rem; margin-bottom: 14px; }
.done p { margin: 0 0 10px; font-size: 1.1875rem; }
.done p.sub { color: var(--muted); font-size: 1.0625rem; }
.done p.trace { margin-top: 18px; color: var(--muted); font-size: 1.0625rem; letter-spacing: 0.04em; }   /* 본 구현 : 추적 번호 */
/* 본 구현 : 스크립트가 돌지 않을 때(오래된 휴대폰 등)만 남는 글. 10초 뒤에 보인다. 스크립트가 돌면 첫 화면으로 바뀌어 사라진다 */
.fallback { visibility: hidden; animation: mi-fallback 0s linear 10s forwards; }
@keyframes mi-fallback { to { visibility: visible; } }

/* 동의 화면 : 항목마다 카드 하나(제목 · 한 줄 요약 · 누르는 칸 · 자세히 보기). 누르는 칸은 .opt[data-kind="multi"] 모양 그대로 */
.card { margin: 0 0 12px; padding: 16px 14px 4px; background: var(--white); border: 1px solid #DDE3EB; border-radius: 12px; }
.card h2 { margin: 0 0 4px; font-size: 1.25rem; line-height: 1.35; font-weight: 700; color: var(--navy); }
.card .summary { margin: 0 0 12px; font-size: 1.0625rem; }
.card .alert { margin: 0 0 8px; }
.toggle {
  display: inline-flex; align-items: center; gap: 6px; min-width: 44px; min-height: 48px; margin-top: 4px; padding: 8px 2px;
  font-size: 1.0625rem; font-weight: 700; color: var(--blue); text-align: left;
  background: none; border: 0; cursor: pointer; text-decoration: underline; text-underline-offset: 3px;
}
.toggle svg { flex: none; width: 16px; height: 16px; transform: rotate(90deg); }         /* 펼침 전 : 아래 */
.toggle[aria-expanded="true"] svg { transform: rotate(-90deg); }                          /* 펼친 뒤 : 위 */
/* 「자세히 보기」의 표 : 칸 이름 | 내용. 폭이 좁거나 글자를 키우면 칸 이름이 위로, 내용이 아래 줄로 내려간다(가로로 넘치지 않게) */
.detail { margin: 0 0 10px; }
.rows, .rows tbody { display: block; width: 100%; }
.rows tr { display: flex; flex-wrap: wrap; gap: 2px 12px; padding: 10px 0; border-top: 1px solid #DDE3EB; }
.rows th { flex: 1 0 6.5rem; min-width: 0; padding: 0; text-align: left; font-size: 1rem; font-weight: 700; color: var(--navy); }
.rows td { flex: 999 1 10rem; min-width: 0; padding: 0; font-size: 1.0625rem; }

/* 버튼 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 60px; padding: 10px 18px;
  font-size: 1.25rem; font-weight: 700; border-radius: 12px; cursor: pointer; border: 1px solid transparent;
}
.btn.primary { background: var(--navy); color: var(--white); }
.btn.second { background: var(--white); color: var(--ink); border-color: #8A97A8; }
.btn[disabled] { opacity: 0.6; cursor: default; }
.btn svg { width: 18px; height: 18px; flex: none; }

/* 아래쪽 고정 : 이전 · 다음 */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; background: var(--white); border-top: 1px solid #DDE3EB;
  padding: 12px var(--pad) calc(12px + env(safe-area-inset-bottom));
}
.nav:empty { display: none; }
.nav-in { max-width: 528px; margin: 0 auto; display: grid; grid-template-columns: minmax(112px, 0.45fr) 1fr; gap: 10px; }
.nav-in.one { grid-template-columns: 1fr; }
.nav .btn { width: 100%; padding-left: 10px; padding-right: 10px; line-height: 1.25; }
.nav .btn[data-act="prev"] { white-space: nowrap; }

/* 아래에 선택지가 더 있을 때만 보이는 알림 */
.more {
  position: fixed; left: 0; right: 0; bottom: var(--nav-h); z-index: 5; margin: 0; padding: 14px 0 8px; text-align: center;
  font-size: 0.9375rem; font-weight: 700; color: var(--navy); pointer-events: none;
  background: linear-gradient(to bottom, rgba(245, 247, 250, 0), var(--paper) 55%);
}
.more[hidden] { display: none; }
.more.low { padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px)); }   /* 아래 버튼 줄이 없는 동의 화면 : 아이폰 홈 막대에 가리지 않게 */

@media (min-width: 420px) { :root { --pad: 20px; } }
