    * { box-sizing: border-box; }
    body {
      margin: 0;
      font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
      font-size: 17px;
      background: #f2f2f7;
      color: #111;
      line-height: 1.5;
      -webkit-text-size-adjust: 100%;
      text-size-adjust: 100%;
      -webkit-print-color-adjust: exact;
      print-color-adjust: exact;
    }
    .preview-page {
      max-width: 820px;
      margin: 0 auto;
      padding: 16px;
      display: flex;
      flex-direction: column;
      gap: 14px;
    }
    .card {
      background: #fff;
      border: 1px solid rgba(60, 60, 67, 0.2);
      border-radius: 14px;
      padding: 14px 12px;
      margin: 0;
      display: flex;
      flex-direction: column;
      gap: 8px;
    }
    .section-hero {
      margin: 0;
      display: flex;
      flex-direction: column;
      gap: 10px;
    }
    .card.card-h2 {
      padding: 14px 12px;
      gap: 8px;
      box-shadow: 0 4px 10px rgba(0, 0, 0, 0.14);
    }
    @media (prefers-color-scheme: dark) {
      .card.card-h2 {
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.32);
      }
      .heading-1 .title {
        color: #f2f2f7;
        -webkit-text-stroke-color: #000000;
      }
    }
    .segment { padding: 0; margin: 0; }
    .segment.embed { padding: 0; }
    .heading-1 { margin: 0; padding: 10px 0 8px; }
    .heading-1 .title {
      font-size: 34px;
      font-weight: 800;
      line-height: 1.15;
      margin: 0;
      color: #1c1c1e;
      -webkit-text-stroke: 2.5px #ffffff;
      paint-order: stroke fill;
      -webkit-print-color-adjust: exact;
      print-color-adjust: exact;
    }
    /* 見出しの下の罫線は、カード枠と同じ濃さ。印刷ではカード枠を外すので、
       紙の上ではこの罫線だけがセクションの切れ目になる（＝残す）。 */
    .heading-2 {
      display: block;
      margin: 0;
      padding: 4px 0 6px;
      border-bottom: 1px solid rgba(60, 60, 67, 0.2);
      -webkit-print-color-adjust: exact;
      print-color-adjust: exact;
    }
    /* 画面プレビューと同じ「素の太字」。装飾は持たない。
       折りたたみのシェブロンは画面だけの操作なので書き出しには出さない。 */
    .heading-2 .title {
      font-size: 28px;
      font-weight: 700;
      line-height: 1.25;
      margin: 0;
      color: #1d1d1f;
    }
    .heading-3 {
      display: block;
      margin: 0;
      padding: 10px 0 5px;
      border-bottom: 1px solid rgba(60, 60, 67, 0.2);
      -webkit-print-color-adjust: exact;
      print-color-adjust: exact;
    }
    .heading-3 .title {
      font-size: 20px;
      font-weight: 700;
      line-height: 1.3;
      margin: 0;
      color: #1d1d1f;
    }
    @media (prefers-color-scheme: dark) {
      .heading-3 .title {
        color: #f5f5f7;
      }
      .heading-2,
      .heading-3 {
        border-bottom-color: rgba(255, 255, 255, 0.18);
      }
    }
    .heading-n {
      font-size: 20px;
      font-weight: 600;
      margin: 0;
    }
    .keep-with-next {
      display: flex;
      flex-direction: column;
      gap: 8px;
      margin: 0;
    }
    .list-item {
      display: flex;
      align-items: baseline;
      gap: 8px;
      margin: 0;
    }
    .list-item .list-marker {
      flex-shrink: 0;
      color: rgba(60, 60, 67, 0.7);
    }
    .list-item .list-marker.bullet {
      width: 5px;
      height: 5px;
      border-radius: 50%;
      background: rgba(60, 60, 67, 0.6);
      margin-top: 0.55em;
    }
    .list-item .list-marker.ordered {
      min-width: 20px;
      text-align: right;
      font-variant-numeric: tabular-nums;
    }
    .list-item .list-marker.task {
      width: 16px;
      height: 16px;
      margin-top: 0.15em;
      accent-color: rgba(60, 60, 67, 0.85);
    }
    .list-item.task-checked .paragraph {
      color: rgba(60, 60, 67, 0.55);
      text-decoration: line-through;
    }
    .blockquote {
      margin: 0;
      padding: 8px 12px;
      border-left: 4px solid rgba(120, 120, 128, 0.45);
      color: rgba(60, 60, 67, 0.85);
    }
    .thematic-break {
      border: 0;
      border-top: 1px solid rgba(60, 60, 67, 0.25);
      margin: 8px 0;
    }
    .table-wrap {
      overflow-x: auto;
      border-radius: 8px;
      border: 1.5px solid rgba(60, 60, 67, 0.44);
      background: #fff;
      box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
      max-width: 100%;
      display: inline-block;
    }
    @media (prefers-color-scheme: dark) {
      .table-wrap {
        border-color: rgba(255, 255, 255, 0.44);
        background: rgba(28, 28, 30, 0.92);
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.32);
      }
    }
    table.data-table {
      border-collapse: collapse;
      width: max-content;
      max-width: 100%;
      font-size: 15px;
      table-layout: auto;
    }
    table.data-table td {
      border: 1px solid rgba(60, 60, 67, 0.30);
      padding: 8px 10px;
      text-align: left;
      vertical-align: top;
      white-space: pre-wrap;
      word-break: break-word;
    }
    table.data-table th {
      border: 1px solid rgba(60, 60, 67, 0.30);
      padding: 8px 10px;
      text-align: left;
      vertical-align: top;
      white-space: pre-wrap;
      word-break: break-word;
      font-weight: 600;
      background: rgba(120, 120, 128, 0.12);
    }
    @media (prefers-color-scheme: dark) {
      table.data-table td {
        border-color: rgba(255, 255, 255, 0.30);
      }
      table.data-table th {
        border-color: rgba(255, 255, 255, 0.30);
        background: rgba(120, 120, 128, 0.18);
      }
    }
    .code-block-shell {
      background: rgba(120, 120, 128, 0.12);
      border-radius: 8px;
      overflow: hidden;
      margin: 0;
      border: 0.5px solid rgba(0, 0, 0, 0.10);
    }
    @media (prefers-color-scheme: dark) {
      .code-block-shell {
        border-color: rgba(255, 255, 255, 0.18);
      }
    }
    .code-block-toolbar {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      padding: 6px 10px;
      background: rgba(120, 120, 128, 0.06);
      border-bottom: 0.5px solid rgba(0, 0, 0, 0.10);
    }
    @media (prefers-color-scheme: dark) {
      .code-block-toolbar {
        background: rgba(255, 255, 255, 0.06);
        border-bottom-color: rgba(255, 255, 255, 0.18);
      }
    }
    .code-block-lang {
      font-size: 11px;
      font-weight: 600;
      text-transform: lowercase;
      color: rgba(60, 60, 67, 0.7);
    }
    .code-copy-btn {
      font: 12px -apple-system, BlinkMacSystemFont, sans-serif;
      font-weight: 500;
      color: rgba(60, 60, 67, 0.7);
      background: transparent;
      border: 0;
      padding: 0;
      cursor: pointer;
    }
    .code-block {
      background: transparent;
      border-radius: 0;
      padding: 10px;
      overflow-x: auto;
      margin: 0;
      border: 0;
    }
    .code-block code {
      font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
      font-size: 15px;
      white-space: pre-wrap;
      word-break: break-word;
    }
    .paragraph { margin: 0; line-height: 1.4; font-size: 17px; }
    /* 段落内の改行（ソフトブレイク）は折り返し（line-height）より広めに間隔を空け、
       「折り返しただけ」と「改行した」を見分けられるようにする（本文の約0.6行分）。 */
    .soft-break-line { display: block; margin-top: 0.84em; }
    .list-item { font-size: 17px; }
    .blockquote { font-size: 17px; }
    .embed-url {
      display: block;
      padding: 8px;
      border-radius: 8px;
      word-break: break-all;
      color: #0a58ca;
      text-decoration: none;
    }
    .embed-preview {
      border-radius: 8px;
      overflow: hidden;
      margin-top: 8px;
    }
    .embed-preview iframe {
      width: 100%;
      border: 0;
      display: block;
    }
    .embed-youtube { aspect-ratio: 16 / 9; }
    .embed-youtube iframe { height: 100%; min-height: 200px; }
    .embed-iframe iframe { height: 240px; }
    .embed-map iframe { height: 260px; }
    figure.mermaid-block {
      margin: 8px 0;
      padding: 10px 8px;
      border-radius: 8px;
      overflow-x: auto;
      border: 0.5px solid rgba(0, 0, 0, 0.10);
      background: rgba(120, 120, 128, 0.12);
    }
    @media (prefers-color-scheme: dark) {
      figure.mermaid-block {
        border-color: rgba(255, 255, 255, 0.18);
        background: rgba(120, 120, 128, 0.18);
      }
    }
    figure.mermaid-block img.mermaid-image {
      display: block;
      width: 100%;
      height: auto;
    }
    figure.mermaid-block .mermaid-message {
      margin: 0;
      font-size: 14px;
      line-height: 1.45;
      color: rgba(60, 60, 67, 0.72);
    }
    @media (prefers-color-scheme: dark) {
      figure.mermaid-block .mermaid-message {
        color: rgba(235, 235, 245, 0.72);
      }
    }
    figure.image-block {
      margin: 4px 0;
      border-radius: 10px;
      overflow: hidden;
      border: 1px solid rgba(0, 0, 0, 0.14);
      box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
    }
    @media (prefers-color-scheme: dark) {
      figure.image-block {
        border-color: rgba(255, 255, 255, 0.22);
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.32);
      }
    }
    figure.image-block img,
    figure.image-block video {
      max-width: 100%;
      height: auto;
      display: block;
    }
    figure.image-block .embed-preview {
      max-width: 100%;
      display: block;
      border-radius: 0;
      overflow: hidden;
      margin: 0;
    }
    figure.image-block .embed-preview iframe {
      width: 100%;
      border: 0;
      display: block;
    }
    figure.image-block figcaption {
      font-size: 12px;
      margin: 0;
      padding: 6px 12px;
      background: rgba(0, 0, 0, 0.04);
      border-top: 1px solid rgba(0, 0, 0, 0.14);
    }
    @media (prefers-color-scheme: dark) {
      figure.image-block figcaption {
        background: rgba(255, 255, 255, 0.06);
        border-top-color: rgba(255, 255, 255, 0.22);
      }
    }
    figure.image-block a { color: #0a58ca; word-break: break-all; }
    a { color: #0a58ca; }
    /* ダークモード: 明るさ前提の値をまとめて反転する。
       個別の要素だけ暗い色に差し替えて本文色を据え置いていたため、
       暗い背景に暗い文字（#111）が乗って表が読めなくなっていた。 */
    @media (prefers-color-scheme: dark) {
      body {
        background: #000;
        color: #f2f2f7;
      }
      .card {
        background: rgba(28, 28, 30, 0.92);
        border-color: rgba(255, 255, 255, 0.18);
      }
      .heading-2 .title {
        color: #f5f5f7;
      }
      .list-item .list-marker { color: rgba(235, 235, 245, 0.60); }
      .list-item .list-marker.bullet { background: rgba(235, 235, 245, 0.50); }
      .list-item .list-marker.task { accent-color: rgba(235, 235, 245, 0.85); }
      .list-item.task-checked .paragraph { color: rgba(235, 235, 245, 0.45); }
      .blockquote {
        border-left-color: rgba(235, 235, 245, 0.35);
        color: rgba(235, 235, 245, 0.75);
      }
      .thematic-break { border-top-color: rgba(235, 235, 245, 0.25); }
      .code-block-lang,
      .code-copy-btn { color: rgba(235, 235, 245, 0.60); }
      figure.mermaid-block .mermaid-message { color: rgba(235, 235, 245, 0.62); }
      figure.image-block figcaption { background: rgba(255, 255, 255, 0.06); }
      .embed-url,
      figure.image-block a,
      a { color: #0a84ff; }
    }

    /* 画面用の白フチ（-webkit-text-stroke: 2.5px #fff）は、印刷では paint-order が
       無視されて白が文字を塗り潰す。`none` は shorthand として無効で打ち消せない。 */
    html.pdf-export .heading-1 .title,
    html.static-export .heading-1 .title {
      color: #1c1c1e;
      -webkit-text-fill-color: #1c1c1e;
      -webkit-text-stroke-width: 0;
      -webkit-text-stroke-color: transparent;
      paint-order: normal;
    }
    html.static-export {
      color-scheme: light only;
    }
    html.static-export,
    html.static-export body {
      background: #fff;
      color: #111;
    }

    @media print {
      @page { size: A4; margin: 0; }
      html, body {
        background: #fff;
        height: auto;
        overflow: visible;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
      }
      .heading-2,
      .heading-3 {
        display: block !important;
      }
      .heading-2 .title,
      .heading-3 .title,
      .heading-1 {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
      }
      /* 画面用の flex + gap は印刷の改ページと相性が悪い。カードがページを跨ぐと
         次の子が前の子の残りに重なる（文字の重なり）、行の途中で切れる。
         印刷ではブロック組版に戻し、gap 相当は隣接マージンで再現する。 */
      .preview-page,
      .card,
      .section-hero {
        display: block;
      }
      .preview-page { max-width: none; padding: 0; }
      .preview-page > * + * { margin-top: 14px; }
      .card > * + * { margin-top: 8px; }
      .section-hero > * + * { margin-top: 10px; }
      .keep-with-next {
        display: block;
        break-inside: avoid;
        page-break-inside: avoid;
      }
      .keep-with-next > * + * { margin-top: 8px; }
      /* カード枠は印刷では外す。`.card.card-h2` の影は `.card` より詳細度が高いので
         一緒に打ち消さないと、見出しの上に影だけ残る。 */
      .card,
      .card.card-h2 {
        break-inside: auto;
        page-break-inside: auto;
        box-shadow: none !important;
        border: none;
        border-radius: 0;
        background: transparent;
        padding: 0;
      }
      *, *::before, *::after { box-shadow: none !important; }
      /* ダークモードのまま印刷すると、紙は白・H1 はほぼ白でタイトルが消える。 */
      .heading-1 .title {
        color: #1c1c1e !important;
        -webkit-text-fill-color: #1c1c1e !important;
        -webkit-text-stroke-width: 0 !important;
        -webkit-text-stroke-color: transparent !important;
        paint-order: normal;
      }
      /* ダークモードのまま印刷しても紙で読めるよう、文字色だけ戻す。
         装飾を持たなくなったので、背景の強制は要らない。 */
      .heading-2 .title,
      .heading-3 .title {
        color: #1d1d1f !important;
      }
      /* 罫線も同じ理由で戻す。ダークの白い線は紙では消える。 */
      .heading-2,
      .heading-3 {
        border-bottom-color: rgba(60, 60, 67, 0.2) !important;
      }
      /* WebKit は break-after: avoid を実装していない。見出し単体の keep-together と
         `.keep-with-next`（見出し＋直後 1 ブロック）で孤立を防ぐ。 */
      .heading-1, .heading-2, .heading-3, .heading-n {
        break-after: avoid;
        page-break-after: avoid;
        break-inside: avoid;
        page-break-inside: avoid;
      }
      /* 段落・引用の孤立行（オーファン/ウィドウ）を最低2行に抑える。 */
      .paragraph, .blockquote { orphans: 2; widows: 2; }
      /* 表全体への break-inside: avoid は、残り領域に収まらない表を WebKit が
         強制分割するときに行の途中（文字の半分）で切る。PDF 出力時は JS で
         各行を .table-row-block（div）へ分解する。div なら avoid が効く。
         画面表示は横スクロール前提で幅が広がるが、印刷では横スクロールできない
         ため本文カラム幅の固定レイアウトにする。 */
      .table-wrap {
        break-inside: auto;
        page-break-inside: auto;
        display: block;
        overflow: visible;
        max-width: 100%;
        box-shadow: none;
        border: none;
        border-radius: 0;
        background: transparent;
      }
      .table-row-block {
        break-inside: avoid;
        page-break-inside: avoid;
      }
      .table-row-head {
        break-after: avoid;
        page-break-after: avoid;
      }
      .table-row-block + .table-row-block { margin-top: -1px; }
      /* 見出し＋先頭行をカード直下の avoid 箱へ出したあと、残りの行と枠線を繋ぐ。 */
      .keep-with-next:has(> .table-row-block) + .segment { margin-top: -1px; }
      .table-row-block table.data-table + table.data-table { margin-top: -1px; }
      .table-row-block table.data-table {
        display: table;
        width: 100%;
        table-layout: fixed;
        border-collapse: collapse;
      }
      .table-row-block table.data-table thead { display: table-header-group; }
      .table-row-block table.data-table tbody { display: table-row-group; }
      .table-row-block table.data-table tr { display: table-row; }
      .table-row-block table.data-table td,
      .table-row-block table.data-table th { display: table-cell; }
      /* JS 分解が無い経路（HTML をブラウザから印刷）向けの保険。 */
      .table-wrap:not(.table-wrap-print) table.data-table {
        table-layout: fixed;
        width: 100%;
      }
      .table-wrap:not(.table-wrap-print) table.data-table thead,
      .table-wrap:not(.table-wrap-print) table.data-table tbody { display: contents; }
      .table-wrap:not(.table-wrap-print) table.data-table thead tr {
        break-after: avoid;
        page-break-after: avoid;
      }
      .table-wrap:not(.table-wrap-print) table.data-table tr {
        display: table;
        width: 100%;
        table-layout: fixed;
        border-collapse: collapse;
        break-inside: avoid;
        page-break-inside: avoid;
      }
      .table-wrap:not(.table-wrap-print) table.data-table td,
      .table-wrap:not(.table-wrap-print) table.data-table th { display: table-cell; }
      .code-block-shell,
      figure.mermaid-block,
      figure.image-block { break-inside: avoid; page-break-inside: avoid; }
      img, svg, pre, .code-block-shell, figure {
        max-width: 100%;
      }
    }
