/* sphead-1116：スマホのヘッダーを小さくする（2026-11-16 春名さん「スマホのヘッダーを小さくしてほしい」）。
   スマホの縦（幅760px以下）と、スマホの横向き（高さ500px以下）だけ。パソコン・タブレットでは何も変わらない。
   いままで：ロゴの段とボタンの段の2段（高さ122〜146px。画面に貼り付いたまま）→ 1段（約48px）。
   消すのはロゴの下の小さな英字だけ。ボタン（情報の扱い・メニュー・終了する）は、どれも残す。 */
@media (max-width: 760px), (orientation: landscape) and (max-height: 500px) {
  html body header.site-header .header-inner {
    min-height: 0 !important; padding: 5px 0 !important; gap: 6px !important;
    flex-wrap: nowrap !important; align-items: center !important; justify-content: space-between !important;
  }
  html body header.site-header .logo { gap: 6px !important; min-width: 0 !important; flex: 0 1 auto !important; }
  html body header.site-header .logo-mark { width: 28px !important; height: 28px !important; flex: none !important; }
  html body header.site-header .logo-text {
    font-size: 15px !important; line-height: 1.25 !important; letter-spacing: .01em !important;
    white-space: nowrap !important; overflow: hidden; text-overflow: ellipsis; min-width: 0;
  }
  html body header.site-header .logo-text small { display: none !important; }
  html body header.site-header .logo-ai-badge { font-size: 10px !important; padding: 1px 5px !important; margin-left: 4px !important; vertical-align: 2px; }
  html body header.site-header .header-actions {
    flex-wrap: nowrap !important; gap: 6px !important; flex: none !important;
    margin: 0 0 0 auto !important; align-items: center !important;
  }
  html body header.site-header .as-open,
  html body header.site-header .home-brand,
  html body header.site-header .nav-toggle,
  html body header.site-header .nav-exit-btn {
    height: 36px !important; min-height: 0 !important; box-sizing: border-box !important;
    padding-top: 0 !important; padding-bottom: 0 !important; margin: 0 !important; line-height: 1 !important;
  }
  html body header.site-header .nav-toggle {
    padding-left: 9px !important; padding-right: 10px !important; font-size: 13px !important;
    gap: 6px !important; white-space: nowrap !important;
  }
  /* TOPへの丸いボタンがあるページ（文例集）は、ロゴの名前を切らないように少しだけ小さく */
  html body header.site-header .header-inner:has(.home-brand) .logo-text { font-size: 14.5px !important; letter-spacing: 0 !important; }
  html body header.site-header .nav-exit-btn {
    padding-left: 10px !important; padding-right: 10px !important; font-size: 13px !important; white-space: nowrap !important;
  }
  html body header.site-header .home-brand-mark { width: 22px !important; height: 22px !important; }
  /* TOPの「運営：」の一行（幅が広いときだけ出る）も、上下の余白をなくして小さく */
  html body header.site-header .header-note { margin-top: 0 !important; margin-bottom: 0 !important; font-size: 12px !important; line-height: 1.3 !important; white-space: nowrap !important; }
  html body header.site-header .hd-reach { padding-top: 3px !important; padding-bottom: 3px !important; margin-right: 0 !important; }
  /* メニューの窓は、小さくなったヘッダーのすぐ下から */
  html body .mobile-nav { top: 54px !important; max-height: calc(100vh - 64px) !important; max-height: calc(100dvh - 64px) !important; }
}
/* 丸いボタン（情報の扱い・TOPへ）は、縦でも横向きでも 36px の円に（名前は読み上げ用に残す） */
@media (max-width: 760px), (orientation: landscape) and (max-height: 500px) {
  html body header.site-header .as-open,
  html body header.site-header .home-brand { width: 36px !important; padding: 0 !important; gap: 0 !important; justify-content: center !important; }
  html body header.site-header .as-open span,
  html body header.site-header .home-brand-text {
    position: absolute !important; width: 1px !important; height: 1px !important; margin: -1px !important;
    overflow: hidden !important; clip: rect(0 0 0 0) !important; white-space: nowrap !important; border: 0 !important;
  }
}
@media (max-width: 760px) {
  /* AIの画面は〈終了する〉があるぶん狭いので、TOPへの丸いボタンは出さず（メニューの中にTOPがある）、メニューは三本線だけに */
  html body header.site-header .header-actions:has(.nav-exit-btn) .home-brand { display: none !important; }
  html body header.site-header .header-actions:has(.nav-exit-btn) .nav-toggle {
    width: 36px !important; padding: 0 !important; gap: 0 !important; font-size: 0 !important; justify-content: center !important;
  }
}
/* 幅のせまいスマホ（374px以下）：TOPへの丸いボタンは出さない（ロゴの名前を切らないため。メニューの中にTOPがある） */
@media (max-width: 374px) {
  html body header.site-header .home-brand { display: none !important; }
}
/* kaigyo-1118 */
/* 2026-11-18 スマホの中途半端な改行を減らす（春名さん「モバイル画面中途半端な改行が気になる。改行が多いとページが間延びするので適正な使用にしてほしい」）
   ・どのページも、見出しとボタンは行の長さをそろえる（text-wrap:balance。行は増えない）
   ・TOP（#today があるページ）の見出し・ボタン・カードの名前・短い説明は、さらに言葉の切れ目で折り返す（word-break:auto-phrase。対応していないブラウザは今までどおり）
   ・長い段落と、ほかのページの言葉の切れ目は今までどおり（言葉の切れ目で折ると1行ずつ増えて、ページが間延びするため。11/18 補助金の一覧の事業名で+1,300px）
   ・TOPの疾患・解説のカードは、スマホでは絵を少し小さくして、名前が1〜2行に収まるように */
@media (max-width:760px){
  body{line-break:strict}
  h1,h2,h3,h4,button,.btn{text-wrap:balance}
  html:has(#today) :is(h1,h2,h3,h4,button,.btn),.gl-text,.ut-t,.ut-h,.pk-line,.tt-card b,.tt-card small,.hero-credit,.grow-go,.tp-cards a,.today-grid b,.today-grid small{word-break:auto-phrase;text-wrap:balance}
  .stampbox-sub b,.gl-text b{word-break:auto-phrase}
  .tp-cards a{gap:6px;padding-right:6px}.tp-cards .tp-ic{width:28px;height:28px;flex:none}.tp-cards .tp-ic svg{width:22px;height:22px}
}

/* ---------- yokoall-1128：スマホの横向きで、絵とボタンが重ならないように ----------
   2026-11-28 春名さん「スマホの画面を横にしたときに、イラストが重なる修正して」。
   横向きのスマホ（高さ500px以下・指で押す端末）は、幅が700〜930pxあるので、パソコン・タブレット向けの並び（右に大きな絵）になる。
   でも高さは400pxほどしかなく、①文例の入口・TOPの「絵＋吹き出し＋カード」が詰まって重なる ②左下の案内係・右下のメモ板のボタンが、絵や文に大きくかぶる。
   → この向きだけ：大きな絵のまとまりは出さない（スマホの縦と同じ）／下の2つのボタンは、どのページでも小さく・すみへ。
   （文例のページの分は yoko.css にもある。こちらは全ページ用で、あとから読むので、こちらが効く） */
@media (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  /* 文例の入口（/bunrei/）：虫めがねの人・吹き出し・浮かぶカード */
  html body main .bh-hero > .bh-art { display: none !important; }
  html body main .bh-hero { grid-template-columns: auto minmax(0, 1fr) !important; }
  /* TOP：おまかせくださいの人と、お知らせの吹き出し */
  html body .hero .hero-illust { display: none !important; }
  html body .hero .hero-inner { grid-template-columns: 1fr !important; }
  /* 左下の案内係：顔の丸だけ（名前は読み上げ用に残す）。左下のすみへ。TOP のボタン（.toc-fab.an-fab）も同じ形に */
  html body #annaiFab.an-fab { left: 8px !important; bottom: 8px !important; padding: 3px !important; gap: 0 !important; }
  html body #annaiFab.an-fab .an-ava { --s: 40px; }
  html body #annaiFab.an-fab > span:not(.an-ava) {
    position: absolute !important; width: 1px !important; height: 1px !important; margin: -1px !important;
    overflow: hidden !important; clip: rect(0 0 0 0) !important; white-space: nowrap !important;
  }
  /* 右下のメモ板：小さく・すみへ。入れ物は右の360pxだけにする（幅760px以下では画面の幅いっぱいで、左下の案内係の上にかぶさっていた＝案内係を上に逃がすと、文例の入口の顔の絵と重なった） */
  html body .mb:not(.is-full) { right: 8px !important; bottom: 8px !important; left: auto !important; width: min(360px, calc(100vw - 16px)) !important; }
  html body .mb .mb-pill { padding: 5px 11px !important; font-size: 13px !important; min-height: 0 !important; }
  html body .mb .mb-pill .mb-n { font-size: 13px !important; }
}

/* ---------- crumbfix-1128：文例の入口（/bunrei/）のパンくず ----------
   はじめの部分の背景（方眼の面）が、上へ64pxはみ出す作りで、その上のパンくずと〈パソコンに送る〉の帯にかぶさっていた
   （パソコンではパンくずが見えず、タブレット・横向きのスマホでは「ケアマネ」だけ見えて切れていた）。パンくずと帯を手前に出す。位置は変えない。 */
main:has(.bh-hero) > .crumb, body:has(.bh-hero) .sp-strip { position: relative; z-index: 1; }
