/* 印刷・PDF書き出し
   ・用語の詳細パネルが開いているときは、そのパネルだけを印刷する
   ・それ以外は、いま開いているタブの内容(レッスン・コラム記事・進行の詳細など)を印刷する
   ・楽譜の「ページめくり」を書き出すときの印刷は style.css(#rollOverlay.show)が受け持つ */
@media print{
  @page{ margin:14mm; }

  /* 夜の配色でも、紙には白地で出す */
  body.theme-dark{
    --bg:#fff; --side:#f6f6f7; --surface:#fff; --surface-2:#f5f5f7; --hover:#f0f0f2;
    --line:#d4d4d8; --line2:#b8b8bd; --text:#1d1d1f; --sub:#4a4a4f; --faint:#8e8e93;
    --accent:#1a73e8; --accent-2:#1558b0; --accent-bg:#e8f0fe;
    --fn-t:#2e7d4f; --fn-s:#b26a00; --fn-d:#d23b2a; --fn-x:#5566b8;
    --ok:#1e8e3e; --ok-bg:#e6f4ea; --ng:#d93025; --ng-bg:#fce8e6;
    --key-white:#fff; --key-edge:#c7c7cc; --key-black:#2c2c2e; --key-on:#cfe0fc; --key-on-black:#1a73e8; --mark:#fff2b3;
  }
  html, body{ height:auto !important; background:#fff !important; color:#1d1d1f; font-size:11pt; }
  a{ color:inherit; text-decoration:none; }

  /* 画面の操作部品は紙に出さない */
  .sidebar, .player, .toast, .skip-link, #siteFooter, #rollOverlay:not(.show), #detailOverlay:not(.show){ display:none !important; }
  .detail-close, .detail-topbar, .detail-actions, .detail-nav,
  .back-btn, .lesson-nav, .phase-stepper, .col-actions, .col-pn, .lesson-print,
  .visual-play, .fig-play, .f-play, .f-play-t, .row-play, .rhythm-play, .compare-play, .text-link-btn,
  [data-print]{ display:none !important; }

  /* 今開いているタブの内容を、ページいっぱいに流す */
  .app{ display:block !important; height:auto !important; padding:0 !important; }
  .main-scroll{ overflow:visible !important; height:auto !important; }
  main{ max-width:none !important; padding:0 !important; }
  .fig-body{ overflow:visible; }
  svg{ max-width:100%; }

  /* 用語の詳細パネルが開いているときは、そのパネルだけ */
  body:has(#detailOverlay.show) > .app{ display:none !important; }
  #detailOverlay.show{ position:static !important; inset:auto; background:none !important; opacity:1; visibility:visible; display:block; }
  #detailOverlay.show .detail-paper{
    position:static !important; width:auto !important; max-width:none; overflow:visible !important;
    padding:0 !important; border:0 !important; box-shadow:none !important; transform:none !important; background:#fff;
  }

  /* 改ページの位置 */
  .fig, .lesson-card h3, .term-title, h3, h4, table, blockquote{ break-inside:avoid; page-break-inside:avoid; }
  h3, h4{ break-after:avoid; page-break-after:avoid; }
  .lesson-card, .col-article{ border:0 !important; box-shadow:none !important; padding:0 !important; }
}
