@media print {
  * {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  body {
    font-size: 11pt;
    line-height: 1.5;
    color: #000;
    background: #fff;
    margin: 0;
    padding: 0;
  }

  /* Hide UI elements not needed for print */
  #form-screen,
  #polling-screen,
  .tab-nav,
  .export-bar,
  .peraichi-panel,
  .tab-content:not(.active),
  button,
  .spinner,
  .copy-btn,
  .app-header {
    display: none !important;
  }

  /* ===================================================================
     MODE 1 (default): full report print — all tabs, one after another
     =================================================================== */
  #report-screen {
    display: block !important;
  }

  #peraichi-print-view {
    display: none !important;
  }

  .tab-panel {
    display: block !important;
    page-break-after: always;
  }

  .tab-panel:last-child {
    page-break-after: avoid;
  }

  h1, h2, h3 {
    page-break-after: avoid;
  }

  table {
    page-break-inside: avoid;
    border-collapse: collapse;
    width: 100%;
    font-size: 9pt;
  }

  th, td {
    border: 1px solid #333;
    padding: 4pt 6pt;
    text-align: left;
    vertical-align: top;
  }

  th {
    background-color: #eef2ff !important;
    color: #1d4ed8 !important;
  }

  .badge-fact {
    background: #1a6e1a !important;
    color: #fff !important;
    padding: 1pt 4pt;
    border-radius: 3pt;
  }

  .badge-assumption {
    background: #7a5c00 !important;
    color: #fff !important;
    padding: 1pt 4pt;
    border-radius: 3pt;
  }

  .badge-sales-intel {
    background: #92400e !important;
    color: #fff !important;
    padding: 1pt 4pt;
    border-radius: 3pt;
  }

  .score-bar-wrap {
    display: none;
  }

  .score-value {
    font-weight: bold;
  }

  .accordion-content {
    display: block !important;
    max-height: none !important;
  }

  pre {
    white-space: pre-wrap;
    word-break: break-all;
    font-size: 8pt;
    border: 1px solid #ccc;
    padding: 6pt;
  }

  .report-title {
    font-size: 18pt;
    font-weight: bold;
    text-align: center;
    margin-bottom: 12pt;
  }

  .section-header {
    font-size: 14pt;
    font-weight: bold;
    margin-top: 18pt;
    margin-bottom: 6pt;
    border-bottom: 2pt solid #1d4ed8;
    page-break-after: avoid;
  }

  @page {
    margin: 15mm 12mm;
  }

  @page :first {
    margin-top: 20mm;
  }
}

/* NOTE: the peraichi (1-page) view's styling now lives in the always-on
   <style> block in index.html (not scoped to @media print or a body class).
   html2canvas — used by the "ペライチPDF" button to rasterize the view before
   handing it to jsPDF — renders the DOM with normal screen rules and never
   evaluates print media queries, so print-only CSS was invisible to it and
   produced an unstyled plain-text capture. See index.html's
   "PERAICHI PRINT VIEW" style comment for the full explanation. */

