/* 리스탠드 화면. 어르신용: 큰 글씨·고대비·큰 단추. TV 리모컨 초점은 굵은 주황 테두리. */
:root {
  --navy: #1B2559;
  --navy-2: #34437F;
  --orange: #FF6B4A;
  --peach: #FFB59E;
  --ink: #0E1230;
  --muted: #4A5170;
  --line: #C9CEE0;
  --bg: #F4F6FB;
  --card: #FFFFFF;
  --ok: #17803D;
  --ok-bg: #E3F5E9;
  --warn: #9A5B00;
  --warn-bg: #FFF1D6;
  --bad: #B3261E;
  --bad-bg: #FDE4E1;
  --focus: #FF6B4A;
  --radius: 16px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: "Pretendard", "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  font-size: 20px; line-height: 1.5; word-break: keep-all;
}
img { max-width: 100%; }
h1, h2, h3 { line-height: 1.3; margin: 0 0 .5em; letter-spacing: -0.02em; }
p { margin: 0 0 .8em; }
small { font-size: .8em; }
[hidden] { display: none !important; }

/* 가로 모드 전용: 세로이면 모든 화면을 덮는 안내판(js/core/orient.js) */
.rotate {
  position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 24px 20px;
  background: var(--navy); color: #fff; text-align: center; overflow-y: auto;
}
.rotate .rot-box { max-width: 520px; }
.rotate .rot-phone { width: min(160px, 38vw); height: auto; display: block; margin: 0 auto 18px; }
.rotate .rot-g { transform-origin: 60px 60px; animation: rot-turn 2.4s ease-in-out infinite; }
.rotate h1 { font-size: clamp(30px, 8vw, 44px); font-weight: 900; margin-bottom: 14px; }
.rotate p { font-size: clamp(19px, 5vw, 24px); color: #E3E7F7; }
.rotate .rot-lock { font-size: clamp(16px, 4.2vw, 19px); color: var(--peach); font-weight: 700; margin-top: 18px; }
@keyframes rot-turn { 0%, 20% { transform: rotate(0deg); } 55%, 85% { transform: rotate(-90deg); } 100% { transform: rotate(0deg); } }
@media (prefers-reduced-motion: reduce) { .rotate .rot-g { animation: none; transform: rotate(-90deg); } }

/* 초점: 마우스로 누를 때는 은은하게, 리모컨·키보드로 옮길 때는 굵게 */
:focus { outline: none; }
:focus-visible, body.kbd :focus {
  outline: 5px solid var(--focus); outline-offset: 3px; box-shadow: 0 0 0 9px rgba(255, 107, 74, .25);
}

/* 머리줄 */
.top {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); background: var(--navy); color: #fff;
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; }
.brand img { border-radius: 9px; display: block; }
.brand b { display: block; font-size: 22px; font-weight: 900; letter-spacing: -0.03em; line-height: 1.1; }
.brand small { display: block; font-size: 12px; color: var(--peach); font-weight: 700; font-style: italic; }
.top-r { display: flex; align-items: center; gap: 8px; }
.who { font-size: 15px; color: #DDE2F5; max-width: 34vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top .btn.ghost { color: #fff; border-color: rgba(255, 255, 255, .5); }
.local-banner { background: var(--warn-bg); color: var(--warn); text-align: center; font-size: 15px; font-weight: 700; padding: 4px 8px; }

main { max-width: 760px; margin: 0 auto; padding: 20px 16px 120px; }
main.wide { max-width: 1100px; }

/* 단추 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 56px; padding: 10px 22px;
  border-radius: 14px; border: 2px solid var(--navy); background: #fff; color: var(--navy);
  font: inherit; font-size: 21px; font-weight: 800; cursor: pointer; text-decoration: none; text-align: center;
}
.btn.primary { background: var(--navy); color: #fff; }
.btn.accent { background: var(--orange); border-color: var(--orange); color: #fff; }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.ghost { background: transparent; }
.btn.big { min-height: 72px; font-size: 25px; padding: 14px 26px; }
.btn.small { min-height: 40px; font-size: 15px; padding: 6px 12px; border-radius: 10px; }
.btn.block { display: flex; width: 100%; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn-row { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 18px; }
.btn-row > .btn { flex: 1 1 200px; }
.link { background: none; border: none; color: var(--navy-2); font: inherit; font-size: 17px; text-decoration: underline; cursor: pointer; padding: 6px; }

/* 카드·폼(담당자 화면) */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }
.card h2 { font-size: 24px; }
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-weight: 700; margin-bottom: 4px; font-size: 18px; }
.field input, .field select, .field textarea {
  width: 100%; min-height: 56px; padding: 10px 14px; border: 2px solid var(--line); border-radius: 12px;
  font: inherit; font-size: 21px; background: #fff; color: var(--ink);
}
.field input:focus { border-color: var(--navy); }
.check { display: flex; align-items: flex-start; gap: 12px; padding: 12px 4px; font-size: 19px; cursor: pointer; }
.check input { width: 28px; height: 28px; flex: none; margin-top: 2px; accent-color: var(--navy); }
.check em { font-style: normal; color: var(--bad); font-weight: 700; font-size: 15px; }
.hint { color: var(--muted); font-size: 16px; }
.err { color: var(--bad); font-weight: 700; }
.note-small { color: var(--muted); font-size: 13px; }
.tag { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: 14px; font-weight: 800; background: #E8EBF6; color: var(--navy); }
.tag.ok { background: var(--ok-bg); color: var(--ok); }
.tag.warn { background: var(--warn-bg); color: var(--warn); }
.tag.bad { background: var(--bad-bg); color: var(--bad); }

/* 목록 */
.list { list-style: none; margin: 0; padding: 0; }
.list li { margin-bottom: 10px; }
.row-btn {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px; text-align: left;
  padding: 16px 18px; border: 2px solid var(--line); border-radius: 14px; background: #fff; font: inherit; color: var(--ink); cursor: pointer;
}
.row-btn b { font-size: 22px; }
.row-btn small { display: block; color: var(--muted); font-size: 15px; }

/* 한 화면 한 질문 */
.q { min-height: calc(100vh - 220px); display: flex; flex-direction: column; }
.q .step { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 17px; font-weight: 700; margin-bottom: 8px; }
.q .bar { height: 10px; background: #DDE2F0; border-radius: 99px; overflow: hidden; margin-bottom: 22px; }
.q .bar i { display: block; height: 100%; background: var(--orange); border-radius: 99px; }
.q .group { display: inline-block; font-size: 17px; font-weight: 800; color: var(--navy-2); background: #E8EBF6; padding: 3px 12px; border-radius: 99px; margin-bottom: 10px; }
.q .lead { font-size: 22px; color: var(--muted); font-weight: 700; margin-bottom: 4px; }
.q h1 { font-size: clamp(30px, 6vw, 46px); font-weight: 900; color: var(--ink); margin-bottom: 10px; }
.q .help { font-size: 19px; color: var(--muted); margin-bottom: 16px; }
.opts { display: grid; gap: 12px; margin: 10px 0 18px; }
.opts.two { grid-template-columns: 1fr 1fr; }
.opt {
  display: flex; align-items: center; gap: 14px; min-height: 76px; padding: 12px 20px; border: 3px solid var(--line); border-radius: 16px;
  background: #fff; color: var(--ink); font: inherit; font-size: clamp(22px, 4.6vw, 30px); font-weight: 800; text-align: left; cursor: pointer;
}
.opt .n { flex: none; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: #E8EBF6; color: var(--navy); font-size: 22px; }
.opt.on { border-color: var(--navy); background: var(--navy); color: #fff; }
.opt.on .n { background: var(--orange); color: #fff; }
.opts.two .opt { justify-content: center; font-size: clamp(28px, 6vw, 40px); min-height: 110px; }
.num-in { display: flex; align-items: center; gap: 10px; margin: 10px 0 18px; flex-wrap: wrap; }
.num-in input {
  width: 9ch; min-height: 84px; font: inherit; font-size: 44px; font-weight: 900; text-align: center;
  border: 3px solid var(--navy); border-radius: 16px; color: var(--ink);
}
.num-in .unit { font-size: 30px; font-weight: 800; }
.num-in .btn { min-width: 76px; min-height: 76px; font-size: 26px; }
.text-in { width: 100%; min-height: 76px; font: inherit; font-size: 32px; padding: 10px 16px; border: 3px solid var(--navy); border-radius: 16px; margin: 10px 0 18px; }
.q .nav { margin-top: auto; display: flex; gap: 12px; padding-top: 12px; }
.q .nav .btn { flex: 1; }
.q .nav .btn.back { flex: 0 0 auto; }
.say { display: inline-flex; align-items: center; gap: 6px; }
.body-map { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.body-map .opt { justify-content: center; text-align: center; min-height: 64px; font-size: clamp(20px, 4.2vw, 26px); }
.body-map .opt[data-none] { grid-column: 1 / -1; }
/* 통증 부위 몸 그림: 그림 위에 큰 단추(리모컨 방향키로도 옮겨진다) */
.bodyfig { position: relative; width: min(300px, 78vw); aspect-ratio: 1 / 2; margin: 4px auto 14px; }
.bodyfig svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.bodyfig .sil { fill: #DCE1EF; stroke: #9AA3C4; stroke-width: 2; }
.bodyfig .hl { fill: transparent; }
.bodyfig .hl.on { fill: var(--orange); }
.bodyfig .spot {
  position: absolute; transform: translate(-50%, -50%); min-height: 52px; padding: 4px 8px; border-radius: 99px;
  border: 3px solid var(--navy); background: rgba(255, 255, 255, .86); color: var(--navy);
  font: inherit; font-size: clamp(19px, 4.4vw, 24px); font-weight: 900; cursor: pointer;
}
.bodyfig .spot.on { background: var(--orange); border-color: var(--orange); color: #fff; }

/* 안내·멈춤 화면 */
.notice { text-align: center; padding: 30px 10px; }
.notice .ico { width: 96px; height: 96px; margin: 0 auto 18px; border-radius: 50%; display: grid; place-items: center; font-size: 56px; font-weight: 900; }
.notice.stop .ico { background: var(--bad-bg); color: var(--bad); }
.notice.hold .ico { background: var(--warn-bg); color: var(--warn); }
.notice.ok .ico { background: var(--ok-bg); color: var(--ok); }
.notice h1 { font-size: clamp(28px, 5.6vw, 40px); font-weight: 900; }
.notice p { font-size: 23px; }
.reason { text-align: left; background: #fff; border-left: 6px solid var(--warn); border-radius: 10px; padding: 14px 18px; margin: 10px 0; font-size: 21px; }
.notice.stop .reason { border-left-color: var(--bad); }

/* 준비 안내(폰 세우기 등) */
.steps { counter-reset: s; list-style: none; padding: 0; margin: 0 0 16px; }
.steps li { position: relative; padding: 14px 14px 14px 64px; background: #fff; border: 1px solid var(--line); border-radius: 14px; margin-bottom: 10px; font-size: 21px; }
.steps li::before { counter-increment: s; content: counter(s); position: absolute; left: 14px; top: 14px; width: 38px; height: 38px; border-radius: 50%; background: var(--navy); color: #fff; display: grid; place-items: center; font-weight: 900; }
.steps li b { display: block; font-size: 23px; }
.tape { display: flex; align-items: flex-end; gap: 0; margin: 10px 0 4px; height: 54px; position: relative; }
.tape .line { position: absolute; left: 0; right: 0; bottom: 14px; height: 6px; background: var(--peach); border-radius: 3px; }
.tape .m { position: absolute; bottom: 0; transform: translateX(-50%); font-size: 15px; font-weight: 800; color: var(--navy); text-align: center; }
.tape .m::before { content: ""; display: block; width: 4px; height: 26px; background: var(--navy); margin: 0 auto 2px; }

/* 쉬기 */
.rest { text-align: center; padding: 40px 10px; }
.rest .clock { font-size: 120px; font-weight: 900; color: var(--navy); line-height: 1; margin: 20px 0; font-variant-numeric: tabular-nums; }

/* 카메라 화면(전체) — 가로 2단(10-30): 왼쪽 약 62% 영상·몸 선·안내 그림·큰 숫자 / 오른쪽 약 38%(최소 300px) [멈춤]·제목·상태·안내·단추.
   오른쪽 열 안에서만 세로로 스크롤하고, 단추 줄은 열 아래에 붙어 늘 보인다. */
.cam {
  position: fixed; inset: 0; z-index: 40; background: #000; color: #fff; overflow: hidden;
  display: grid; grid-template-columns: minmax(0, 1fr) max(300px, 38%); grid-template-rows: minmax(0, 1fr);
}
.cam.manual { grid-template-columns: minmax(0, 1fr) max(460px, 46%); } /* 직접 입력: 칸 2열이 들어가게 오른쪽 열을 넓힌다 */
.cam .cam-l { position: relative; min-width: 0; min-height: 0; overflow: hidden; padding-left: env(safe-area-inset-left); }
.cam .stage { position: absolute; inset: 0; display: grid; place-items: center; }
.cam video, .cam canvas.ov { position: absolute; max-width: 100%; max-height: 100%; width: 100%; height: 100%; object-fit: contain; }
.cam video.mirror, .cam canvas.ov.mirror { transform: scaleX(-1); }
.cam .guide { position: absolute; top: 6%; bottom: 6%; left: 50%; transform: translateX(-50%); height: 88%; opacity: .32; pointer-events: none; }
.cam .guide.okc { opacity: .5; filter: drop-shadow(0 0 10px #3DDC84); }
.cam .cam-r {
  display: flex; flex-direction: column; min-width: 0; min-height: 0; background: #12173A; border-left: 3px solid var(--orange);
  padding-top: env(safe-area-inset-top); padding-right: env(safe-area-inset-right); padding-bottom: env(safe-area-inset-bottom);
}
.cam .hud { flex: none; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 4px 10px; padding: 12px 14px 8px; border-bottom: 1px solid rgba(255,255,255,.12); }
.cam .hud .ttl b { display: block; font-size: clamp(22px, min(2.4vw, 5vh), 36px); font-weight: 900; line-height: 1.2; }
.cam .hud .ttl small { display: block; font-size: clamp(14px, min(1.3vw, 3.2vh), 19px); color: #DDE2F5; line-height: 1.35; }
.cam .hud-st { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.cam .hud .flip { color: #fff; border-color: #fff; }
.cam .stopbtn {
  min-width: 128px; min-height: 80px; border-radius: 18px; border: 4px solid #fff; background: var(--bad); color: #fff;
  font: inherit; font-size: 30px; font-weight: 900; cursor: pointer; flex: none;
}
.cam .chip { display: inline-block; padding: 4px 12px; border-radius: 99px; font-size: clamp(14px, min(1.3vw, 3.2vh), 18px); font-weight: 800; background: rgba(255,255,255,.15); }
.cam .chip.ok { background: #17803D; }
.cam .chip.no { background: #9A5B00; }
.cam .big-count { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); font-size: clamp(80px, min(20vw, 36vh), 240px); font-weight: 900; line-height: 1; text-shadow: 0 4px 30px rgba(0,0,0,.7); pointer-events: none; font-variant-numeric: tabular-nums; }
.cam .panel { flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 12px 14px 0; scroll-padding-bottom: 150px; } /* 초점 옮길 때 칸이 아래 고정 단추 줄에 가리지 않게 */
.cam .panel h2 { font-size: clamp(22px, min(2.4vw, 5.2vh), 36px); font-weight: 900; margin-bottom: 6px; }
.cam .panel p { font-size: clamp(17px, min(1.6vw, 4vh), 25px); margin-bottom: 8px; color: #EEF0FA; }
.cam .panel .safety { color: var(--peach); font-weight: 800; }
.cam .panel .rest-left { font-size: clamp(19px, min(1.8vw, 4.4vh), 28px); }
.cam .panel .btn-row { position: sticky; bottom: 0; margin-top: 10px; padding: 8px 0 14px; background: #12173A; gap: 10px; }
.cam .panel .btn-row > .btn { flex: 1 1 130px; }
.cam .panel .btn-row > .btn.primary { flex-basis: 100%; }
.cam .panel .btn { border-color: #fff; }
.cam .panel .btn.ghost { color: #fff; }
.cam .panel .btn.primary { background: var(--orange); border-color: var(--orange); }
.cam .panel .btn.big { font-size: clamp(19px, min(1.7vw, 4.2vh), 25px); min-height: clamp(52px, 9vh, 72px); padding: 8px 14px; }
.cam .panel .note-small { margin: 0 0 10px; }
.cam .mf { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; margin: 8px 0; }
.cam .mf-row { background: rgba(255,255,255,.07); border-radius: 12px; padding: 8px 10px; }
.cam .mf-row > span { display: block; font-size: clamp(18px, 3.6vw, 23px); font-weight: 800; margin-bottom: 4px; }
.cam .mf-row small { display: block; color: #C7CDEA; font-size: 15px; }
.cam .mf .num-in { margin: 0; flex-wrap: nowrap; }
.cam .mf .num-in input { font-size: 32px; min-height: 64px; flex: 1 1 0; width: 0; min-width: 0; text-align: center; }
.cam .mf .num-in .btn { min-height: 64px; min-width: 64px; background: #fff; color: var(--navy); }
.cam .mf-tg { display: flex; gap: 8px; flex-wrap: wrap; }
.cam .mf-tg .btn { min-height: 52px; font-size: 19px; background: transparent; color: #fff; border-color: #fff; }
.cam .mf-tg .btn.primary { background: var(--orange); border-color: var(--orange); }
.cam .meter { height: 14px; border-radius: 99px; background: rgba(255,255,255,.18); overflow: hidden; margin: 6px 0 4px; }
.cam .meter i { display: block; height: 100%; background: var(--orange); }
.cam .simtag { position: absolute; left: 14px; bottom: 14px; background: var(--warn); color: #fff; padding: 2px 10px; border-radius: 8px; font-size: 14px; font-weight: 800; }
/* 낮은 가로 화면(폰 가로 390px 안팎): 머리줄·멈춤·직접 입력 칸을 줄인다 */
@media (max-height: 500px) {
  .cam .hud { padding: 8px 12px 6px; }
  .cam .stopbtn { min-width: 104px; min-height: 58px; font-size: 24px; border-width: 3px; border-radius: 14px; }
  .cam .mf-row { padding: 6px 8px; }
  .cam .mf .num-in input { font-size: 26px; min-height: 50px; }
  .cam .mf .num-in .btn { min-height: 50px; min-width: 50px; }
  .cam .mf-tg .btn { min-height: 44px; font-size: 17px; }
}

/* 결과 화면 */
.res-head { display: grid; grid-template-columns: auto 1fr; gap: 18px; align-items: center; background: var(--navy); color: #fff; border-radius: 20px; padding: 22px; margin-bottom: 16px; }
.res-head .score { text-align: center; }
.res-head .score b { display: block; font-size: 86px; font-weight: 900; line-height: .95; letter-spacing: -0.05em; }
.res-head .score small { color: #C7CDEA; font-size: 16px; }
.res-head .grade { font-size: clamp(26px, 5vw, 36px); font-weight: 900; }
.res-head .grade small { display: block; font-size: 17px; color: var(--peach); font-weight: 700; }
.res-head .prov { display: inline-block; margin-top: 6px; font-size: 15px; background: rgba(255,255,255,.14); padding: 2px 10px; border-radius: 8px; }
.risk { display: flex; align-items: center; gap: 14px; border-radius: 16px; padding: 16px 18px; margin-bottom: 16px; border: 3px solid; }
.risk .dot { width: 44px; height: 44px; border-radius: 50%; flex: none; }
.risk b { font-size: 26px; }
.risk.low { background: var(--ok-bg); border-color: var(--ok); } .risk.low .dot { background: var(--ok); }
.risk.moderate { background: var(--warn-bg); border-color: #D48A00; } .risk.moderate .dot { background: #E09A00; }
.risk.high { background: var(--bad-bg); border-color: var(--bad); } .risk.high .dot { background: var(--bad); }
.risk ul { margin: 4px 0 0; padding-left: 20px; font-size: 17px; }
.metric { margin-bottom: 18px; }
.metric .mh { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.metric .mh b { font-size: 21px; }
.metric .mh span { font-size: 24px; font-weight: 900; color: var(--navy); }
.metric .sub { font-size: 16px; color: var(--muted); }
.sppb-bars { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 8px; }
.sppb-bars div { background: #EEF0F8; border-radius: 12px; padding: 10px; text-align: center; }
.sppb-bars i { display: flex; gap: 3px; height: 16px; margin: 6px 0; }
.sppb-bars i u { flex: 1; border-radius: 4px; background: #D3D8EA; }
.sppb-bars i u.on { background: var(--navy); }
.sppb-bars b { font-size: 22px; }
.sppb-bars small { display: block; font-size: 15px; color: var(--muted); }
.band-bar { position: relative; height: 26px; background: #E6E9F3; border-radius: 99px; margin: 34px 0 26px; }
.band-bar .z { position: absolute; top: 0; bottom: 0; background: #BFE6CB; border-radius: 99px; }
.band-bar .z.warn { background: #FFE2A8; }
.band-bar .z.bad { background: #F8C4BE; }
.band-bar .me { position: absolute; top: -8px; width: 6px; height: 42px; background: var(--ink); border-radius: 3px; transform: translateX(-50%); }
.band-bar .me::after { content: attr(data-l); position: absolute; top: -28px; left: 50%; transform: translateX(-50%); font-size: 14px; font-weight: 800; white-space: nowrap; }
.band-bar .tk { position: absolute; top: 28px; font-size: 13px; color: var(--muted); transform: translateX(-50%); }
.tasks h3 { font-size: 19px; color: var(--navy-2); margin: 14px 0 6px; }
.trow { display: grid; grid-template-columns: minmax(0, 11em) 1fr 3.2em; gap: 10px; align-items: center; font-size: 17px; margin-bottom: 6px; }
.trow i { height: 16px; background: #E6E9F3; border-radius: 99px; overflow: hidden; display: block; }
.trow i u { display: block; height: 100%; background: var(--navy-2); border-radius: 99px; }
.trow.top3 i u { background: var(--orange); }
.trow.top3 span { font-weight: 800; }
.trow b { text-align: right; font-variant-numeric: tabular-nums; }
.findings p { font-size: 21px; background: #fff; border-left: 6px solid var(--orange); padding: 10px 14px; border-radius: 8px; margin-bottom: 8px; }
.crit-note { color: var(--muted); font-size: 13px; margin-top: 4px; }
.flags { font-size: 15px; color: var(--warn); }

/* 운동 따라 하기 */
.ex-intro h1 { font-size: clamp(30px, 6vw, 44px); font-weight: 900; }
.ex-img { display: block; width: 100%; border-radius: 12px; border: 1px solid var(--line); background: #fff; }
.ex-demo { display: block; width: min(360px, 100%); margin: 10px auto; background: #fff; border: 1px solid var(--line); border-radius: 12px; }
.ex-steps { padding-left: 1.4em; font-size: 20px; }
.ex-steps li { margin-bottom: 6px; }
.safety-box { background: var(--warn-bg); color: var(--warn); border-radius: 10px; padding: 10px 14px; font-weight: 700; font-size: 18px; }
.metric-line { font-size: 21px; }
.cam .ex-fb { font-size: clamp(26px, 5.4vw, 40px); font-weight: 900; margin: 6px 0; }
.cam .ex-fb.count { color: #7CF0A6; }
.cam .ex-fb.fix { color: var(--peach); }
.rpe { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 12px 0; }
.rpe .opt { flex-direction: column; justify-content: center; align-items: center; text-align: center; min-height: 92px; gap: 2px; }
.rpe .opt b { font-size: 34px; line-height: 1; }
.rpe .opt small { font-size: 14px; font-weight: 700; color: var(--muted); }
@media (min-width: 700px) { .rpe { grid-template-columns: repeat(6, 1fr); } }

.week-goal { display: flex; gap: 8px; margin: 10px 0; }
.week-goal i { flex: 1; height: 26px; border-radius: 8px; background: #E6E9F3; border: 2px dashed transparent; }
.week-goal i.need { border-color: var(--line); }
.week-goal i.on { background: var(--orange); border-color: var(--orange); }
.wk { width: 100%; border-collapse: collapse; font-size: 17px; margin: 10px 0; }
.wk th, .wk td { padding: 6px 4px; border-bottom: 1px solid var(--line); text-align: right; }
.wk th:first-child, .wk td:first-child { text-align: left; }

/* 확인 창 */
.modal { position: fixed; inset: 0; z-index: 60; background: rgba(8, 10, 30, .62); display: grid; place-items: center; padding: 16px; }
.modal-sheet { background: #fff; color: var(--ink); border-radius: 20px; padding: 24px; max-width: 560px; width: 100%; }
.modal-sheet h2 { font-size: 28px; }
.modal-sheet p { font-size: 21px; }
.modal-actions { display: grid; gap: 10px; margin-top: 16px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 70; background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 12px; font-size: 18px; max-width: 90vw; }

/* TV(넓은 화면): 글자 더 크게 */
@media (min-width: 1200px) and (min-height: 650px) {
  body { font-size: 24px; }
  main { max-width: 1000px; }
  .q h1 { font-size: 54px; }
  .opt { font-size: 32px; min-height: 88px; }
}

@media (max-width: 520px) {
  .who { display: none; }
  /* 폰: −·칸·+ 한 줄, 칸이 남는 폭을 다 써서 '예: 1950'이 잘리지 않게 */
  .num-in { flex-wrap: nowrap; gap: 8px; }
  .num-in input { flex: 1 1 auto; width: auto; min-width: 0; font-size: 34px; padding: 0 6px; }
  .num-in .btn { min-width: 64px; min-height: 76px; padding: 6px; }
  .num-in .unit { font-size: 24px; flex: none; }
}
@media (max-width: 380px) {
  .num-in input { font-size: 28px; }
  .num-in .btn { min-width: 56px; }
}
@media (max-width: 420px) {
  .res-head { grid-template-columns: 1fr; text-align: center; }
  .trow { grid-template-columns: minmax(0, 8em) 1fr 3em; font-size: 15px; }
  .opts.two .opt { min-height: 90px; }
}

/* ===== 가로 모드 전용(10-30): 일반 화면 가로 맞춤 =====
   글자 크기는 vw 만이 아니라 vh 도 본다(390px 높이에서 제목이 46px까지 커지지 않게). */
main { padding: 16px max(16px, env(safe-area-inset-right)) 40px max(16px, env(safe-area-inset-left)); }
main:has(> .q), main:has(> .res-grid), main:has(> .ex-wrap) { max-width: 1240px; }
.chip:empty { display: none; }

/* 한 화면 한 질문: 왼쪽 질문·도움말 / 오른쪽 보기, 이전·다음은 아래 띠 */
.q {
  --chrome: 150px;
  min-height: calc(100vh - var(--chrome)); min-height: calc(100dvh - var(--chrome));
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); grid-template-rows: auto 1fr auto;
  grid-template-areas: "head head" "l r" "nav nav"; column-gap: clamp(16px, 3vw, 44px);
}
.q .q-head { grid-area: head; }
.q .q-l { grid-area: l; min-width: 0; align-self: center; }
.q .q-r { grid-area: r; min-width: 0; align-self: center; }
.q .nav { grid-area: nav; margin-top: 0; padding-top: 12px; }
.q h1 { font-size: clamp(26px, min(4vw, 7.5vh), 46px); }
.q .help { font-size: clamp(16px, min(1.9vw, 4.2vh), 20px); }
.q .q-r .opts, .q .q-r .num-in, .q .q-r .text-in { margin: 0; }
.q.q-many { grid-template-columns: minmax(0, .8fr) minmax(0, 1.3fr); }
.opts.many { grid-template-columns: 1fr 1fr; }
.opt { font-size: clamp(20px, min(2.6vw, 5.4vh), 30px); min-height: clamp(52px, 11vh, 76px); }
.opts.two .opt { font-size: clamp(26px, min(3.6vw, 8vh), 40px); min-height: clamp(64px, 17vh, 110px); }
/* 통증 몸 그림: 오른쪽 칸 안에서 그림 왼쪽(높이에 맞춤), 목록·없음 오른쪽 */
.q.q-body { grid-template-columns: minmax(0, .75fr) minmax(0, 1.25fr); }
.q-body .q-r { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 16px; align-items: center; }
.q-body .bodyfig { width: auto; height: min(600px, calc(100vh - 210px)); height: min(600px, calc(100dvh - 210px)); margin: 0; }
.body-map .opt { font-size: clamp(18px, min(2.2vw, 4.6vh), 26px); }

.notice h1 { font-size: clamp(26px, min(4.4vw, 8vh), 40px); }
.notice p { font-size: clamp(18px, min(2.4vw, 5vh), 23px); }
.ex-intro h1, .prep-h { font-size: clamp(26px, min(4vw, 7.5vh), 44px); font-weight: 900; }
.cam .ex-fb { font-size: clamp(22px, min(2.6vw, 6vh), 40px); }
.rest .clock { font-size: clamp(64px, min(14vw, 24vh), 120px); }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 10px; }
.steps li { margin-bottom: 0; }
main:has(> section > .steps) { max-width: 1240px; }

/* 결과: 왼쪽 점수·등급·낙상 위험(붙어 있음) / 오른쪽 SPPB·과제·소견 */
.res-grid { display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); gap: 16px; align-items: start; }
@media (min-height: 601px) { .res-grid .res-l, .ex-wrap .ex-l { position: sticky; top: 76px; } } /* 낮은 화면은 붙이지 않는다(왼쪽이 화면보다 길면 아래가 안 보임) */
.res-grid .res-l .btn-row { margin-top: 0; }
.res-grid .res-l .btn-row > .btn { flex: 1 1 100%; }
.res-head .score b { font-size: clamp(56px, min(7vw, 15vh), 86px); }
.res-head .grade { font-size: clamp(22px, min(2.8vw, 6vh), 36px); }

/* 운동 안내: 왼쪽 그림·시범 / 오른쪽 단계·양·주의·[시작] → 자세한 설명 */
.ex-wrap { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 20px; align-items: start; }
.ex-wrap .ex-l .ex-img { max-height: calc(100vh - 230px); object-fit: contain; }
.ex-wrap .ex-r .opts { margin-top: 0; }
.ex-demo { max-height: calc(100vh - 160px); width: auto; max-width: 100%; aspect-ratio: 360 / 400; }

/* 자각 강도 0~10: 6열 2줄(높이 안에) */
.q.q-rpe { display: block; min-height: 0; }
.rpe { grid-template-columns: repeat(6, 1fr); }
.ex-intro .opt { font-size: clamp(17px, min(1.9vw, 4.4vh), 24px); }
.rpe .opt { min-height: clamp(64px, 15vh, 92px); }

/* 확인 창: 높이가 넘치면 창 안에서 스크롤 */
.modal-sheet { max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); overflow-y: auto; }

/* 낮은 가로 화면(폰 가로 높이 500px 이하) */
@media (max-height: 500px) {
  .top { padding: 4px 12px; padding-top: max(4px, env(safe-area-inset-top)); }
  .brand img { width: 28px; height: 28px; }
  .brand b { font-size: 18px; }
  .brand small { font-size: 10px; }
  .top .btn.small { min-height: 34px; font-size: 14px; padding: 4px 10px; }
  .local-banner { font-size: 13px; padding: 1px 8px; }
  main { padding-top: 10px; padding-bottom: 24px; }
  .q { --chrome: 96px; }
  .q .step { font-size: 14px; margin-bottom: 4px; }
  .q .bar { height: 7px; margin-bottom: 8px; }
  .q .group { font-size: 14px; margin-bottom: 4px; padding: 1px 10px; }
  .q .lead { font-size: 17px; }
  .q h1 { margin-bottom: 6px; }
  .q .nav { padding-top: 8px; }
  .q .nav .btn { min-height: 48px; font-size: 19px; }
  .opts { gap: 8px; }
  .q .opts:not(.two):not(.body-map) { grid-template-columns: 1fr 1fr; }
  .q-many .opts:not(.two) { grid-template-columns: repeat(3, 1fr); }
  .ex-intro .opt { min-height: 46px; }
  .opt { padding: 6px 12px; gap: 10px; border-width: 2px; }
  .opt .n { width: 34px; height: 34px; font-size: 18px; }
  .num-in input { min-height: 64px; font-size: 34px; }
  .num-in .btn { min-width: 64px; min-height: 64px; }
  .text-in { min-height: 60px; font-size: 26px; }
  .q-body .bodyfig { height: calc(100vh - 196px); height: calc(100dvh - 196px); }
  .bodyfig .spot { display: none; } /* 그림이 작아 단추가 겹친다 — 옆 목록 단추로 고르고 그림은 칠만 */
  .body-map .opt { min-height: 50px; }
  .card { padding: 14px 16px; margin-bottom: 12px; }
  .notice { padding: 8px 10px; }
  .notice .ico { width: 56px; height: 56px; font-size: 32px; margin-bottom: 8px; }
  .btn.big { min-height: 56px; font-size: 21px; padding: 8px 18px; }
  .btn-row { margin-top: 12px; }
  .steps li { padding: 10px 12px 10px 56px; font-size: 18px; }
  .steps li b { font-size: 20px; }
  .steps li::before { left: 12px; top: 10px; width: 34px; height: 34px; }
  .rest { padding: 10px; }
  .rest .clock { margin: 8px 0; }
  .res-head { padding: 14px; gap: 12px; margin-bottom: 10px; }
  .risk { padding: 10px 12px; margin-bottom: 10px; }
  .ex-wrap .ex-l .ex-img { max-height: calc(100vh - 190px); }
  .modal-sheet { padding: 16px 18px; }
  .modal-sheet h2 { font-size: 24px; }
  .modal-sheet p { font-size: 18px; }
}
/* TV(넓고 높은 화면): 글자 더 크게(위 가로 맞춤 규칙보다 뒤에 둔다) */
@media (min-width: 1200px) and (min-height: 650px) {
  .q h1 { font-size: 54px; }
  .opt { font-size: 32px; min-height: 88px; }
  .opts.two .opt { font-size: 40px; min-height: 120px; }
}

@media print {
  .top, .local-banner, .no-print, .toast, .modal, .rotate { display: none !important; }
  body { background: #fff; }
  main { padding: 0; max-width: none; }
}
