* {
  box-sizing: border-box;
}

/* 🔍 전역 가독성 — 앱 전체 약 15% 확대 (글자·간격 비례 ↑, 본문 기준 +2pt 이상) */
#mri-app {
  zoom: 1.15;
}
@media (max-width: 640px) {
  #mri-app { zoom: 1.06; }   /* 모바일은 가로 넘침 방지 위해 완만하게 */
}
@media print {
  #mri-app { zoom: 1; }      /* 인쇄/PDF는 원래 크기 유지 */
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg-page);
  color: var(--text);
  font-family: "Pretendard", "Apple SD Gothic Neo", "Noto Sans KR", system-ui, sans-serif;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font-family: inherit;
}

#mri-app {
  min-height: 100vh;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

h2 {
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

h3 {
  font-weight: 650;
  letter-spacing: -0.015em;
}

h4 {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-secondary);
  letter-spacing: -0.01em;
}

::selection {
  background: rgba(220, 38, 38, .12);
  color: var(--text);
}

/* ───────── PDF 인쇄 모드 (📄 PDF 다운로드 클릭 시) ───────── */
@media print {
  /* 항상 인쇄 시 숨길 요소 */
  .no-print { display: none !important; }
  .print-only { display: block !important; }

  body { background: #fff !important; }
  .card { box-shadow: none !important; page-break-inside: avoid; }
}

/* AI 보고서만 인쇄하는 모드 (download-ai-pdf 버튼 클릭) */
body.print-ai-mode {
  /* 화면에선 변화 없음 — print 미디어 쿼리만 적용 */
}
@media print {
  body.print-ai-mode > *:not(#mri-app) { display: none !important; }
  body.print-ai-mode #mri-app > *:not(.report-wrap),
  body.print-ai-mode .report-wrap > *:not(#ai-report-section):not(.report-hero) {
    display: none !important;
  }
  body.print-ai-mode .report-hero {
    border: none !important;
    background: #fff !important;
    margin-bottom: 0 !important;
  }
  body.print-ai-mode #ai-report-section {
    border: none !important;
    background: #fff !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  body.print-ai-mode .ai-summary-content {
    font-size: 12pt !important;
    line-height: 1.7 !important;
  }
  body.print-ai-mode h1 { font-size: 18pt !important; page-break-before: always; }
  body.print-ai-mode h1:first-of-type { page-break-before: avoid; }
  body.print-ai-mode h2 { font-size: 14pt !important; }
  body.print-ai-mode h3 { font-size: 12pt !important; }
  body.print-ai-mode table { page-break-inside: avoid; }

  @page {
    size: A4;
    margin: 18mm 16mm 20mm 16mm;
  }
}
