/* PM(닥터원 측정평가) 결과지와 같은 모양의 A4 한 장.
   앱이 pdf 로 그리는 것을 HTML 로 옮긴 것이다 — 색·배치·차례를 맞춘다
   (`lib/features/report/alignment_page.dart`, `report_pdf.dart`).

   **폭을 794px 로 박는다.** 앱 결과지가 A4 한 장에 꽉 찬 배치라, 폰 폭에
   맞춰 늘였다 줄였다 하면 칸이 무너진다. 종이 한 장을 그대로 두고 화면
   폭에 맞게 통째로 줄여 보여 준다(확대는 두 손가락으로). 사용자 결정:
   "A4 그대로 나와도 돼, 대신 확대나 저장이 되면". */

.sheet {
  --ink: #1A1C1E;
  --muted: #5F6368;
  --line: #D5DBDC;
  --accent: #E5673F;
  --accent-bg: #FBEDE7;
  --band: #22344F;
  --risk: #E1251B;

  width: 794px;
  min-height: 1123px;
  box-sizing: border-box;
  padding: 26px 30px 24px;
  background: #fff;
  color: var(--ink);
  font-size: 12.7px;
  line-height: 1.45;
  transform-origin: top left;
}

/* 화면 폭에 맞춰 통째로 줄인다. 줄인 만큼 높이도 줄어야 아래가 비지 않는다. */
.sheet-wrap { overflow: hidden; }

/* ---- 머리글 띠 ---- */
.sheet .band {
  display: flex; align-items: center; gap: 14px;
  background: var(--band); color: #fff;
  border-radius: 12px;
  padding: 15px 20px;
}
.sheet .band img { height: 34px; display: block; }
.sheet .band h1 { margin: 0; font-size: 22px; font-weight: 800; letter-spacing: -.4px; }
.sheet .band .sub { font-size: 10.5px; color: #AFC0D4; margin-top: 2px; }
.sheet .band .sub b { color: #E3EAF2; font-weight: 700; margin-right: 6px; }
.sheet .band .code { margin-left: auto; text-align: right; }
.sheet .band .code small { display: block; font-size: 9.5px; color: #AFC0D4; }
.sheet .band .code b { font-size: 21px; font-weight: 800; color: var(--accent); }

/* ---- 정보 줄 + 점수 ---- */
.sheet .info {
  display: flex; align-items: stretch; gap: 14px;
  margin-top: 10px;
}
.sheet .info .facts {
  flex: 1; min-width: 0;
  display: flex; align-items: center; gap: 22px;
  background: #F4F6F8; border-radius: 10px; padding: 12px 18px;
}
.sheet .info .facts div { min-width: 0; }
.sheet .info .facts div small { display: block; font-size: 9.5px; color: var(--muted); white-space: nowrap; }
.sheet .info .facts div b { font-size: 14px; font-weight: 700; white-space: nowrap; }

.sheet .scorebox {
  flex: none; width: 376px;
  display: flex; align-items: center; gap: 12px;
  background: var(--accent-bg); border-radius: 10px; padding: 12px 15px;
}
.sheet .scorebox .n { flex: none; font-size: 34px; font-weight: 800; color: var(--accent); line-height: 1; }
.sheet .scorebox .n span { font-size: 12px; font-weight: 700; }
/* min-width 를 0 으로 풀어야 줄어든다. flex 칸은 기본값이 auto 라, 글이 길면
   줄지 않고 옆 칸을 밀어낸다 — 그래서 점수 설명이 세로로 섰다. */
.sheet .scorebox .t { flex: 1; min-width: 0; font-size: 10.5px; line-height: 1.5; }
.sheet .scorebox .t b { display: block; font-size: 11.5px; }
.sheet .scorebox .t .dim { color: var(--muted); font-size: 9.5px; }

/* 직전 대비와 최근 추이. 점수 **바로 옆**에 둔다 — 다시 오는 사람에게 가장
   궁금한 것이 "저번보다 나아졌나"라서 숫자에서 눈을 떼지 않고 읽혀야 한다. */
.sheet .scorebox .trend { flex: none; width: 96px; text-align: right; }
.sheet .scorebox .spark { display: flex; align-items: center; gap: 4px; justify-content: flex-end; }
.sheet .scorebox .spark small { font-size: 8.5px; color: var(--muted); white-space: nowrap; }
.sheet .scorebox .delta { margin-top: 2px; font-size: 9px; color: var(--muted); line-height: 1.4; }
.sheet .scorebox .delta b { font-weight: 800; color: var(--ink); }
.sheet .scorebox .delta b.up { color: #1B6B3A; }
.sheet .scorebox .delta b.down { color: var(--risk); }

/* ---- 카드 ---- */
.sheet .card2 {
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  padding: 13px 15px;
  box-sizing: border-box;
}
.sheet .card2 > h2 {
  display: flex; align-items: center; gap: 7px;
  margin: 0 0 10px; font-size: 14px; font-weight: 800;
}
.sheet .card2 > h2::before {
  content: ''; width: 4px; height: 15px; border-radius: 2px; background: var(--accent);
}

.sheet .row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 11px; }
.sheet .row2 { display: grid; grid-template-columns: 1.55fr 1fr; gap: 12px; margin-top: 11px; }

/* ---- 방향 카드 ---- */
.sheet .shot { width: 100%; border-radius: 8px; display: block; background: #1A2230; }
.sheet .shotwrap { display: flex; justify-content: center; }
.sheet .shotwrap canvas { max-height: 268px; width: auto; }

.sheet .mrow {
  display: grid; grid-template-columns: 1fr auto 52px 36px;
  align-items: center; gap: 5px;
  padding: 5px 0;
  border-top: 1px solid #EEF1F3;
  font-size: 10.5px;
}
.sheet .mrow:first-of-type { border-top: 0; }
/* 이름이 길면 줄을 바꾸지 않고 한 줄에 눌러 담는다. 두 줄이 되면 줄 높이가
   들쭉날쭉해져 세 카드의 지표 줄이 서로 어긋난다. */
.sheet .mrow .nm {
  color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sheet .mrow .vl { font-weight: 700; text-align: right; }
.sheet .mrow .vl em { font-style: normal; font-weight: 400; font-size: 10px; color: var(--muted); }

/* 작은 띠 게이지 — 네 칸에 표시자 하나 */
.sheet .g { position: relative; height: 9px; border-radius: 3px; overflow: hidden; display: flex; }
.sheet .g i { flex: 1; }
.sheet .g i:nth-child(1) { background: #CFE9D8; }
.sheet .g i:nth-child(2) { background: #EAF4EC; }
.sheet .g i:nth-child(3) { background: #FBEFD3; }
.sheet .g i:nth-child(4) { background: #FBE0DC; }
.sheet .g u {
  position: absolute; top: -2px; width: 3px; height: 13px; border-radius: 2px;
  background: var(--ink); transform: translateX(-1.5px);
}

.sheet .bdg {
  text-align: center; font-size: 9.5px; font-weight: 700;
  border-radius: 9px; padding: 2px 0;
}
.sheet .bdg.keep { background: #DCF0E3; color: #1B6B3A; }
.sheet .bdg.watch { background: #FBEFD3; color: #8A6100; }
.sheet .bdg.risk { background: #FDECEC; color: #8C1D18; }
.sheet .bdg.none { background: #EFF1F3; color: #6B7684; }

/* ---- 부위별 ---- */
.sheet .reg { display: grid; grid-template-columns: 48px 1fr 30px; align-items: center; gap: 9px; margin: 9px 0; font-size: 11.5px; }
.sheet .reg .bar { height: 11px; border-radius: 6px; background: #EDEFF2; overflow: hidden; }
.sheet .reg .bar i { display: block; height: 100%; border-radius: 6px; }
.sheet .reg b { text-align: right; font-size: 13px; font-weight: 800; }

/* ---- 먼저 볼 부위 ---- */
.sheet .first { display: flex; gap: 9px; margin: 11px 0; }
.sheet .first .no {
  flex: none; width: 19px; height: 19px; border-radius: 50%;
  background: var(--accent); color: #fff;
  font-size: 11px; font-weight: 800; text-align: center; line-height: 19px;
}
.sheet .first b { display: block; font-size: 12px; font-weight: 700; }
.sheet .first small { color: var(--muted); font-size: 10px; }

/* ---- 근육 지도 ---- */
.sheet .mapbox { display: flex; justify-content: center; }
.sheet .mapbox canvas { max-width: 100%; height: auto; }
.sheet .maplegend { display: flex; justify-content: center; gap: 14px; margin-top: 6px; font-size: 9.5px; color: var(--muted); }
.sheet .maplegend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 4px; }

/* ---- 근육 목록 ---- */
.sheet .mus { font-size: 11px; line-height: 1.7; }
.sheet .mus .lab { font-weight: 800; margin-right: 5px; }
.sheet .mus .lab.t { color: var(--risk); }
.sheet .mus .lab.w { color: #1D4ED8; }

/* ---- 할 운동 ---- */
.sheet .exr { display: grid; grid-template-columns: 46px 1fr; gap: 9px; align-items: center; margin: 9px 0; }
.sheet .exr .tag { font-size: 9.5px; font-weight: 700; color: var(--accent); white-space: nowrap; }
.sheet .exr b { display: block; font-size: 12px; }
.sheet .exr small { color: var(--muted); font-size: 10px; }

.sheet .foot { margin-top: 10px; font-size: 9px; color: var(--muted); line-height: 1.6; }

@media print {
  @page { size: A4 portrait; margin: 0; }
  body { background: #fff; }
  .sheet { transform: none !important; box-shadow: none; }
  .sheet-wrap { height: auto !important; }
}
