* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Noto Sans JP", sans-serif;
  color: #222;
  line-height: 1.8;
  background: #fff;
}
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
a { color: #0b5cad; }
/* Mission 13: 記事本文の長いURL（出典リスト等）がスマホ幅ではみ出さないよう折り返す */
article a, article li { overflow-wrap: anywhere; }
.site-header { border-bottom: 2px solid #0b5cad; padding: 12px 0; }
.site-name { font-size: 1.25rem; font-weight: 700; margin: 0; }
.site-name a { color: #222; text-decoration: none; }
.site-nav { margin-top: 4px; }
.site-nav a { margin-right: 16px; font-size: 0.95rem; }
main { padding: 24px 0 40px; }
h1 { font-size: 1.6rem; line-height: 1.4; border-bottom: 1px solid #ddd; padding-bottom: 8px; }
h2 { font-size: 1.25rem; margin-top: 2em; border-left: 4px solid #0b5cad; padding-left: 8px; }
h3 { font-size: 1.05rem; margin-top: 1.5em; }
blockquote {
  margin: 16px 0; padding: 12px 16px;
  background: #f4f7fa; border: 1px solid #d5e0ea; border-radius: 4px;
}
.conditions {
  background: #f7f7f7; border: 1px solid #ddd; border-radius: 4px;
  padding: 12px 20px; margin: 20px 0;
}
.conditions h2 { border: none; padding: 0; margin: 0 0 8px; font-size: 1.05rem; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.compare {
  border-collapse: collapse; width: 100%; min-width: 880px; font-size: 0.9rem;
}
table.compare th, table.compare td {
  border: 1px solid #ccc; padding: 8px; vertical-align: top; text-align: left;
}
table.compare thead th { background: #eef3f8; white-space: nowrap; }
table.compare td.num { text-align: right; white-space: nowrap; }
table.compare td.total { font-weight: 700; }
table.compare td.carrier { font-weight: 700; white-space: nowrap; }
table.compare td.note { font-size: 0.8rem; min-width: 180px; }
table.compare .sub { color: #555; font-size: 0.8rem; }
.fineprint { font-size: 0.85rem; color: #444; }
.poc-unimplemented { color: #666; }
.site-footer {
  border-top: 1px solid #ddd; background: #fafafa;
  padding: 16px 0 32px; font-size: 0.85rem; color: #444;
}
@media (max-width: 640px) {
  h1 { font-size: 1.35rem; }
  main { padding: 16px 0 32px; }
}

/* ==== Mission 18（デザイン改善 Phase 1）ここから ==== */

/* ヘッダーナビの操作性改善（全ページ共通のヘッダーに対する変更）。
   リンクをフレックス化し、タップ領域（最小高さ44px）と余白を確保する。
   折り返し時も各リンクが独立したタップ領域として読めるようにする。 */
.site-nav { display: flex; flex-wrap: wrap; gap: 2px 6px; margin-top: 6px; }
.site-nav a {
  display: inline-flex; align-items: center; min-height: 44px;
  padding: 6px 10px; margin-right: 0; border-radius: 6px; text-decoration: none;
}
.site-nav a:hover { background: #f4f7fa; text-decoration: underline; }

/* トップページ専用部品。すべて .home 配下に限定し、他ページの
   見た目には影響させない。 */
.home section { margin-top: 40px; }
.home h2 {
  border-left: none; padding-left: 0;
  border-bottom: 2px solid #0b5cad; padding-bottom: 8px; margin-top: 0;
}
.home .hero h1 {
  border-bottom: none; padding-bottom: 0;
  font-size: 1.85rem; line-height: 1.5; margin: 8px 0 16px;
}
.home .hero h1 .accent { color: #0b5cad; }
.home .hero .lead { color: #444; max-width: 820px; }
.home .hero-points {
  list-style: none; margin: 20px 0 0; padding: 16px 20px;
  background: #f4f7fa; border: 1px solid #d5e0ea; border-radius: 8px;
}
.home .hero-points li { position: relative; padding-left: 26px; font-weight: 600; margin: 6px 0; }
.home .hero-points li::before {
  content: ""; position: absolute; left: 2px; top: .55em;
  width: 12px; height: 12px; border-radius: 50%; background: #0b5cad;
  box-shadow: inset 0 0 0 3.5px #fff; outline: 1.5px solid #0b5cad;
}
.home .note-box {
  margin: 24px 0 0; padding: 12px 16px;
  background: #f4f7fa; border: 1px solid #d5e0ea; border-radius: 4px;
  font-size: .95rem;
}
.home .note-box p { margin: 0 0 8px; }
.home .note-box p:last-child { margin-bottom: 0; }
.home .section-lead { color: #444; font-size: .95rem; }

/* 使用量カード（Mission 23 でトップ／比較一覧の共通部品に一般化） */
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 20px; }
.card {
  display: flex; flex-direction: column;
  background: #fff; border: 1px solid #cfd9e2; border-radius: 10px;
  padding: 20px 18px 16px; text-decoration: none; color: #222;
}
.card:hover { border-color: #0b5cad; }
.card:focus-visible { outline: 3px solid #0b5cad; outline-offset: 2px; }
.card-usage { font-size: 1.25rem; font-weight: 700; line-height: 1.4; margin: 0; }
.card-use { font-size: .85rem; color: #555; margin: 4px 0 0; }
.card-cheapest { margin: 16px 0 0; font-size: .8rem; font-weight: 700; color: #0b5cad; letter-spacing: .04em; }
.card-plan { font-size: .98rem; font-weight: 700; line-height: 1.55; margin: 2px 0 0; }
.card-total-label { font-size: .8rem; color: #555; margin: 14px 0 0; }
.card-total {
  font-size: 2rem; font-weight: 800; line-height: 1.25; margin: 0;
  white-space: nowrap; font-variant-numeric: tabular-nums;
}
.card-total small { font-size: 1rem; font-weight: 700; }
.card-monthly { font-size: .92rem; color: #444; margin: 4px 0 0; font-variant-numeric: tabular-nums; }
.card-breakdown {
  font-size: .82rem; color: #555; line-height: 1.7;
  border-top: 1px solid #e3eaf1; margin: 14px 0 0; padding-top: 10px;
  font-variant-numeric: tabular-nums;
}
.card-note {
  font-size: .9rem; color: #444; line-height: 1.75;
  background: #f4f7fa; border: 1px solid #d5e0ea; border-radius: 6px;
  margin: 12px 0 0; padding: 10px 12px;
}
.card-link { margin-top: auto; padding-top: 16px; font-size: .92rem; font-weight: 700; color: #0b5cad; }
.card-link::after { content: " →"; }

/* 比較条件ボックス（比較ページの .conditions とは別部品） */
.home .cond-box { border: 1px solid #cfd9e2; border-radius: 10px; padding: 4px 20px; margin-top: 20px; }
.home .cond-box dl { margin: 0; }
.home .cond-box .row {
  display: grid; grid-template-columns: 150px 1fr; gap: 4px 16px;
  padding: 12px 0; border-bottom: 1px solid #e3eaf1;
}
.home .cond-box .row:last-of-type { border-bottom: none; }
.home .cond-box dt { font-weight: 700; font-size: .92rem; }
.home .cond-box dd { margin: 0; font-size: .92rem; color: #444; font-variant-numeric: tabular-nums; }
.home .cond-foot { font-size: .92rem; color: #444; margin: 0; padding: 12px 0 14px; }

/* 計算式。項（.f-term）を inline-block + nowrap にし、改行は
   項と項の間（演算子の位置）でのみ起きるようにする。 */
.home .formula {
  background: #eef4fa; border: 1px solid #cfd9e2; border-radius: 10px;
  text-align: center; padding: 24px 16px; margin: 20px 0 0;
  font-size: 1.15rem; font-weight: 700; line-height: 1.9;
  font-variant-numeric: tabular-nums;
}
.home .formula .f-op { color: #0b5cad; padding: 0 .1em; }
.home .formula .f-term, .home .formula .f-head { display: inline-block; white-space: nowrap; }
.home .formula-note { font-size: .92rem; color: #444; margin: 12px 0 0; }
.home .detail-link { font-size: .95rem; }
.home .companies { font-weight: 600; line-height: 2; }

@media (max-width: 640px) {
  .site-nav a { padding: 6px 8px; font-size: .9rem; }
  .home section { margin-top: 32px; }
  .home .hero h1 { font-size: 1.5rem; }
  .cards { grid-template-columns: 1fr; gap: 14px; }
  .card-total { font-size: 1.9rem; }
  .home .cond-box { padding: 2px 16px; }
  .home .cond-box .row { grid-template-columns: 1fr; gap: 2px; padding: 10px 0; }
  .home .formula { font-size: 1.02rem; padding: 18px 10px; line-height: 2; }
}

/* ==== Mission 23（デザイン改善 Phase 2・標準案）ここから ====
   Phase 1（トップページのみ）で作った体裁を全ページへ広げ、
   比較表の読みやすさを改善する。色は青系のまま、装飾は増やさず、
   強調は地色と文字サイズだけに限る（バッジ・星評価等は使わない）。 */

/* --- 見出しの統一（課題C） ---
   h2 はトップページの様式（青の下線2px・左ボーダーなし）に全ページで統一。
   h1 はトップのヒーローに合わせ、下線を持たない体裁に統一する。 */
h2 {
  border-left: none; padding-left: 0;
  border-bottom: 2px solid #0b5cad; padding-bottom: 8px;
}
h1 { border-bottom: none; }

/* --- 条件ボックスの統一（課題D） ---
   比較ページの .conditions を、トップの .cond-box と同じ
   白地・枠・角丸の見た目に寄せる。 */
.conditions {
  background: #fff; border: 1px solid #cfd9e2; border-radius: 10px;
  padding: 16px 20px;
}

/* --- 比較表以外の表の体裁（課題D） ---
   運営者情報ページや計算方法ページ内の表にも、比較表と同じ
   罫線・余白・見出し行の地色を与える。 */
table:not(.compare) {
  border-collapse: collapse; width: 100%; font-size: .92rem; margin: 16px 0;
}
table:not(.compare) th, table:not(.compare) td {
  border: 1px solid #ccc; padding: 8px; text-align: left; vertical-align: top;
}
table:not(.compare) thead th { background: #eef3f8; }

/* --- 計算式ボックスの共通化（課題D・F） ---
   トップページの .formula と同じ体裁を、計算方法ページでも使う。 */
.formula {
  background: #eef4fa; border: 1px solid #cfd9e2; border-radius: 10px;
  text-align: center; padding: 24px 16px; margin: 20px 0;
  font-size: 1.15rem; font-weight: 700; line-height: 1.9;
  font-variant-numeric: tabular-nums;
}
.formula .f-op { color: #0b5cad; padding: 0 .1em; }
.formula .f-term, .formula .f-head { display: inline-block; white-space: nowrap; }

/* --- 目次（課題F：計算方法ページ） --- */
.toc {
  background: #f4f7fa; border: 1px solid #d5e0ea; border-radius: 8px;
  padding: 12px 20px; margin: 20px 0; font-size: .95rem;
}
.toc .toc-title { font-weight: 700; margin: 0 0 6px; }
.toc ul { margin: 6px 0; padding-left: 22px; }
.toc > nav > ul { margin: 0; }

/* --- スクロールヒント（課題A） ---
   スマホ幅でのみ表示し、表が横スクロールできることを案内する。 */
.scroll-hint { display: none; }

/* --- 比較表の読みやすさ改善（課題A・B） --- */
table.compare {
  min-width: 1020px; table-layout: fixed;
  font-size: .86rem; font-variant-numeric: tabular-nums;
}
/* 列幅の配分：PC（表示領域1,048px）では全11列が画面内に収まるようにする。
   幅は先頭行（見出し行）のセルから決まる（table-layout: fixed）。 */
table.compare th:nth-child(1) { width: 4%; }   /* 順位 */
table.compare th:nth-child(2) { width: 9%; }   /* 通信会社 */
table.compare th:nth-child(3) { width: 10%; }  /* プラン */
table.compare th:nth-child(4) { width: 6%; }   /* 容量 */
table.compare th:nth-child(5) { width: 8%; }   /* 初期費用（SIM発行料） */
table.compare th:nth-child(6) { width: 11%; }  /* 月額基本料金 */
table.compare th:nth-child(7) { width: 11%; }  /* 通話条件 */
table.compare th:nth-child(8) { width: 10%; }  /* 12か月総額 */
table.compare th:nth-child(9) { width: 8%; }   /* 総額の月平均 */
table.compare th:nth-child(10) { width: 16%; } /* 注意事項 */
table.compare th:nth-child(11) { width: 7%; }  /* 公式サイト */
table.compare th, table.compare td { overflow-wrap: break-word; padding: 7px 8px; }
table.compare thead th {
  white-space: normal;
  position: sticky; top: 0; z-index: 3;
}
table.compare td.num { white-space: normal; }
table.compare td.carrier { white-space: normal; }
/* 順位・通信会社の2列を左端に固定し、横スクロール時も行の主語を見失わないようにする */
table.compare th:first-child, table.compare td:first-child {
  position: sticky; left: 0; z-index: 2; background: #fff; text-align: center;
}
table.compare th:nth-child(2), table.compare td:nth-child(2) {
  position: sticky; left: 42px; z-index: 2; background: #fff;
  box-shadow: 1px 0 0 #ccc;
}
table.compare thead th:first-child, table.compare thead th:nth-child(2) {
  background: #eef3f8; z-index: 4;
}
/* ゼブラ（固定列も同じ地色にする） */
table.compare tbody tr:nth-child(even) { background: #f7fafc; }
table.compare tbody tr:nth-child(even) td:first-child,
table.compare tbody tr:nth-child(even) td:nth-child(2) { background: #f7fafc; }
/* 「12か月総額」「総額の月平均」の列：地色と文字サイズだけで静かに強調する */
table.compare td.total {
  font-size: 1.02rem; background: #eef4fa; white-space: nowrap;
}
table.compare td.monthly { font-size: 1rem; background: #eef4fa; }
table.compare tbody tr:nth-child(even) td.total,
table.compare tbody tr:nth-child(even) td.monthly { background: #e4eef7; }
/* 注意事項列：行間を詰め、行の高さの伸びを抑える */
table.compare td.note { line-height: 1.65; }

/* PC幅では表が画面内に収まるため、包み要素の横スクロールを無効化し、
   見出し行の固定（縦スクロール時）がページスクロールに対して効くようにする */
@media (min-width: 1100px) {
  .table-wrap { overflow-x: visible; }
}

@media (max-width: 640px) {
  .scroll-hint {
    display: block; font-size: .82rem; color: #555;
    margin: 12px 0 6px;
  }
  table.compare { font-size: .84rem; }
  .formula { font-size: 1.02rem; padding: 18px 10px; line-height: 2; }
}

/* ==== Mission 23 ここまで ==== */

/* Mission 6 (hikari): 2枚カード用レイアウト追加 */
.cards.two { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 640px) {
  .cards.two { grid-template-columns: 1fr; }
}

/* ==== Mission 7（hikari）: 比較表の列幅を光回線の列構成に合わせて再配分 ====
   土台の Mission 23 の列幅は sumaho の列（プラン／容量／通話条件…）前提のため、
   光回線の列では「総額の月平均」が狭すぎて数値が途中で改行し、
   「条件付きキャッシュバック」が狭く「提携有無」が広すぎる問題があった。
   列の意味に合わせて幅を再配分する（合計100%）。金額・順位・データは不変。 */
table.compare th:nth-child(1) { width: 4%; }   /* 順位 */
table.compare th:nth-child(2) { width: 10%; }  /* 事業者 */
table.compare th:nth-child(3) { width: 10%; }  /* 24か月総額 */
table.compare th:nth-child(4) { width: 9%; }   /* 総額の月平均 */
table.compare th:nth-child(5) { width: 10%; }  /* 月額料金 */
table.compare th:nth-child(6) { width: 12%; }  /* 工事費（割引の扱い） */
table.compare th:nth-child(7) { width: 8%; }   /* 契約期間 */
table.compare th:nth-child(8) { width: 10%; }  /* 提供エリア */
table.compare th:nth-child(9) { width: 12%; }  /* 条件付きキャッシュバック */
table.compare th:nth-child(10) { width: 7%; }  /* 提携有無 */
table.compare th:nth-child(11) { width: 8%; }  /* 公式サイト */
/* 月平均の数値が小数点の途中で改行しないようにする */
table.compare td.monthly { white-space: nowrap; font-size: .95rem; }
/* 公式サイト列（見出し・リンク）が単語の途中で改行しないようにする */
table.compare th:last-child, table.compare td:last-child { white-space: nowrap; }
