/* ==========================================================================
   AIツール実測ニュース｜まとめサイト
   - 組み替えは端末の種類ではなく「表示幅」で行う（固定帯の扱いだけは表示の高さも見る）
   - 320px〜1280px のどの幅でも横にはみ出さない（グリッドは min(100%, …) で縮む）
   - 固定帯は完全に不透明（半透明・ぼかし・フェードマスクは使わない）
   ========================================================================== */

:root {
  color-scheme: light dark;

  --paper: #f6f3eb;
  --surface: #ffffff;
  --tint: #efeadf;
  --ink: #1a1815;
  --ink-soft: #3b3731;
  --muted: #5e584d;
  --line: #dcd5c6;
  --line-strong: #b4ab98;

  --accent: #b93a1c;
  --accent-ink: #a3321a;
  --accent-soft: #fbe9e1;
  --accent-line: #ecc2b3;
  --on-accent: #ffffff;

  --green: #2e6a3e;
  --green-strong: #2e6a3e;
  --green-ink: #255634;
  --green-soft: #e6f1e8;
  --green-line: #b9d6c0;

  --amber-ink: #6f4b0c;
  --amber-soft: #f8edd3;
  --amber-line: #e3cc96;

  --blue-ink: #1f4d84;
  --blue-soft: #e2ebf6;
  --blue-line: #b7cbe6;

  --night: #1e1c18;
  --night-ink: #f4efe4;
  --night-muted: #d3cbbb;
  --night-line: #4a463e;

  /* フォーカスの枠。暗い面の上では明るい色に切り替える（どちらも背景との差 3:1 以上） */
  --focus: var(--accent);
  --focus-on-dark: #ff9b7b;
  /* 詳細表示の暗い背景（rgb(14 13 11 / .62)）を紙の色に重ねた色 */
  --dimmed-paper: rgb(102 100 96);

  --sans: "Noto Sans JP", system-ui, -apple-system, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Yu Gothic", Meiryo, sans-serif;
  --serif: "Noto Serif JP", "Hiragino Mincho ProN", "Yu Mincho", YuMincho, "IPAMincho", serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;

  --gutter: 16px;
  --radius: 14px;
  /* 固定帯の高さ。JS（layout.js）が実測値で上書きする。下は読み込み前の目安 */
  --bar-h: 113px;
  --sticky-h: 113px;
}

@media (min-width: 620px) {
  :root { --bar-h: 61px; --sticky-h: 61px; }
}
@media (min-width: 768px) {
  :root { --gutter: 24px; }
}
@media (min-width: 1100px) {
  :root { --gutter: 32px; }
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #131210;
    --surface: #1c1b18;
    --tint: #25231f;
    --ink: #f3eee3;
    --ink-soft: #ded7c8;
    --muted: #b8b0a0;
    --line: #36342e;
    --line-strong: #5a564b;

    --accent-ink: #ff9b7b;
    --accent-soft: #3a1d14;
    --accent-line: #7a3523;

    --green: #3f8a53;
    --green-strong: #2f6b40;
    --green-ink: #a7dcb3;
    --green-soft: #1a2c1f;
    --green-line: #34593e;

    --amber-ink: #f0cd84;
    --amber-soft: #33280f;
    --amber-line: #6a5420;

    --blue-ink: #a9c8f0;
    --blue-soft: #18263a;
    --blue-line: #33507a;

    --night: #24221e;
    --night-ink: #f4efe4;
    --night-muted: #cfc7b7;
    --night-line: #4d483f;

    --focus: var(--focus-on-dark);
    --dimmed-paper: rgb(16 15 13);
  }
}

/* ---------- 土台 ---------- */

*,
*::before,
*::after { box-sizing: border-box; }

html {
  /* 文字の自動拡大（端末の向きを変えたときなど）を切り、どの端末でも CSS で決めた大きさで表示する */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
/* 詳細を開いている間は背景を止める。スクロールバーが場所を取る環境でも、消えたバーの幅を空けたままにして背景を横にずらさない。
   空けた幅には暗くした背景と同じ色を塗る（そこだけ明るい筋が残らないように） */
html.is-reading {
  overflow: hidden;
  scrollbar-gutter: stable;
  background-color: var(--dimmed-paper);
}

/* ページ内の移動・Tab でのフォーカス移動の行き先を、固定帯の下に出す。
   付けるのは本文側の行き先だけ。帯の中の部品（入口・検索欄・固定したカテゴリ帯）に付けると、
   帯の中でフォーカスや入力位置が動くたびに、帯は止まったまま本文だけがずれてしまう */
main,
main [id],
main :is(a[href], button, input, select, textarea, summary, [tabindex]),
.site-footer :is(a[href], button),
html:not(.topics-pinned) .topics .chip {
  scroll-margin-top: calc(var(--sticky-h) + 12px);
}
/* カードは見出しのボタンにフォーカスが来る。カードの上端（根拠バッジと日付）まで帯の下に出す */
main .card .card__open { scroll-margin-top: calc(var(--sticky-h) + 64px); }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.75;
  overflow-wrap: anywhere;
  -webkit-font-smoothing: antialiased;
}

/* 万一はみ出す部品があっても、その帯の中で切り落とす（body に付けると画面全体が overflow:hidden 扱いに
   なって横へずらせてしまうので、各帯に付ける。clip はスクロール領域を作らないので sticky は保たれる） */
.utility,
.jumpbar,
.masthead,
.topics,
main,
.site-footer { overflow-x: clip; }

[hidden] { display: none !important; }

h1, h2, h3, h4 {
  margin: 0;
  line-height: 1.35;
  text-wrap: balance;
  word-break: auto-phrase;
}
p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; }
a { color: inherit; text-underline-offset: 3px; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled, input:disabled { cursor: not-allowed; opacity: .55; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* 本文へ移動：フォーカスしたときだけ、暗い案内帯の上に出る */
.skip-link {
  position: absolute;
  left: max(8px, env(safe-area-inset-left));
  top: calc(8px + env(safe-area-inset-top, 0px));
  z-index: 100;
  padding: 8px 14px;
  border-radius: 8px;
  background: var(--ink);
  color: var(--paper);
  font-weight: 800;
  /* ふだんは上端の安全領域の高さにかかわらず、画面の上へ完全に出しておく */
  transform: translateY(calc(-100% - 16px - env(safe-area-inset-top, 0px)));
  /* 枠は暗い面用の色にし、まわりを案内帯と同じ暗い色で縁取る（下の明るい帯にかかっても枠が見分けられる） */
  --focus: var(--focus-on-dark);
}
.skip-link:focus { transform: none; box-shadow: 0 0 0 8px var(--night); }

/* 横幅の器：左右の余白は、通常の余白と env(safe-area-inset-*) の広いほう
   （横向きで画面の欠けた部分が左右に来ても、文字がそこへかからない） */
.shell {
  width: 100%;
  max-width: 1200px;
  margin-inline: auto;
  padding-left: max(var(--gutter), env(safe-area-inset-left));
  padding-right: max(var(--gutter), env(safe-area-inset-right));
}

/* ---------- 上端の案内帯 ---------- */

.utility {
  /* 固定帯が上端の安全領域を塗る影（下の .jumpbar）より手前に描く */
  position: relative;
  z-index: 41;
  background: var(--night);
  color: var(--night-ink);
  font-size: .8125rem;
  line-height: 1.6;
  padding-top: env(safe-area-inset-top);
  --focus: var(--focus-on-dark);
}
.utility__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0 18px;
  padding-top: 4px;
  padding-bottom: 4px;
}
.utility__status { padding-block: 6px; }
.utility__status::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 8px;
  border-radius: 50%;
  background: #4fc773;
  vertical-align: .05em;
}
.utility__links { display: flex; flex-wrap: wrap; align-items: center; }
/* 押しやすさ：当たり判定の高さを取る（狭い幅は帯が高くなりすぎないよう 32px、広い幅はほかのボタンと同じ 44px） */
.utility__link {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  color: inherit;
}
@media (min-width: 600px) {
  .utility__link { min-height: 44px; }
}
.utility__sep { padding-inline: 6px; color: var(--night-muted); }

/* ---------- 題字 ---------- */

.masthead__inner {
  display: grid;
  gap: 18px;
  padding-top: 22px;
  padding-bottom: 20px;
}
@media (min-width: 900px) {
  .masthead__inner {
    grid-template-columns: minmax(0, 1fr) minmax(220px, 300px);
    align-items: end;
    padding-top: 34px;
    padding-bottom: 28px;
  }
}
.masthead__badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: .75rem;
  font-weight: 800;
  letter-spacing: .08em;
}
.masthead__title {
  margin-top: 12px;
  font-family: var(--serif);
  font-weight: 900;
  font-size: clamp(2.25rem, 7vw + 1rem, 4.5rem);
  line-height: 1.08;
  letter-spacing: .01em;
}
/* 2行の題字：「AIツール」／「実測ニュース」（行の中の色替えの部分は改行させない） */
.masthead__title > span { display: block; }
.masthead__accent { color: var(--accent-ink); }
.masthead__lead { margin-top: 12px; max-width: 46em; color: var(--ink-soft); }
.issue {
  display: grid;
  gap: 2px;
  padding-top: 10px;
  border-top: 4px solid var(--ink);
  color: var(--muted);
  font-size: .875rem;
  line-height: 1.6;
}
.issue__date { font-family: var(--mono); color: var(--ink); letter-spacing: .04em; }
.issue__status { font-family: var(--serif); font-size: 1.375rem; font-weight: 800; color: var(--ink); }

/* ---------- 固定帯（不透明） ---------- */

.jumpbar {
  position: sticky;
  /* 上端に安全領域（ノッチなど）がある表示ではその下に止め、上の隙間は影で同じ色に塗って本文を透かさない */
  top: env(safe-area-inset-top, 0px);
  z-index: 40;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 calc(-1 * env(safe-area-inset-top, 0px)) 0 0 var(--paper);
}
.jumpbar__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding-top: 8px;
  padding-bottom: 8px;
}
.jumpbar__entries {
  display: flex;
  gap: 8px;
  flex: 1 1 300px;
  min-width: 0;
}
.entry {
  flex: 1 1 0;
  min-width: 0;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  /* 幅 320px 前後でも、ラベルが1行に収まる左右の余白 */
  padding: 6px clamp(6px, 2.5vw, 12px);
  border: 1.5px solid transparent;
  border-radius: 999px;
  font-size: .875rem;
  font-weight: 800;
  line-height: 1.3;
  text-align: center;
  text-decoration: none;
  touch-action: manipulation;
}
.entry--conclusion { background: var(--accent); color: var(--on-accent); }
.entry--beginner { background: var(--green-soft); color: var(--green-ink); border-color: var(--green-line); }

.finder {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 999 1 280px;
  min-width: 0;
  margin: 0;
}
.finder__input {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  height: 44px;
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  /* iPhone でタップ時に拡大されないよう 16px 以上を保つ */
  font-size: max(16px, 1rem);
  -webkit-appearance: none;
  appearance: none;
  touch-action: manipulation;
}
.finder__input::placeholder { color: var(--muted); opacity: 1; }
.finder__count {
  flex: none;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  font-size: .875rem;
  font-weight: 800;
  white-space: nowrap;
  touch-action: manipulation;
}
.finder__count.is-filtered { background: var(--ink); border-color: var(--ink); color: var(--paper); }

/* ---------- カテゴリ帯 ---------- */

.topics {
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.topics .chips { padding-top: 10px; padding-bottom: 10px; }
/* チップが1段に収まり、画面の高さにも余裕があるときだけ（layout.js が判定）、固定帯の下に重ねて固定する */
.topics-pinned .topics {
  position: sticky;
  top: calc(env(safe-area-inset-top, 0px) + var(--bar-h) - 1px);
  z-index: 39;
}

/* チップは横スクロールにせず、折り返して全部を画面内に出す */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip {
  max-width: 100%;
  min-height: 44px;
  padding: 6px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-size: .875rem;
  font-weight: 700;
  line-height: 1.3;
  text-align: center;
  touch-action: manipulation;
}
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.chips--vendor .chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

/* ---------- 本文の共通 ---------- */

main { display: block; padding-top: 20px; padding-bottom: 56px; }
main:focus { outline: none; }

main > section,
main > .split { margin-top: 44px; }
main > section:first-of-type { margin-top: 0; }

.load-state {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  margin-bottom: 20px;
  padding: 14px 16px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--muted);
}
.load-state--error {
  border-style: solid;
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--ink);
}
.load-state--error p { flex: 1 1 260px; min-width: 0; }
.load-state__retry {
  min-height: 44px;
  padding: 6px 16px;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  background: var(--surface);
  font-size: .875rem;
  font-weight: 800;
}

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 6px 16px;
}
.section-head__text { flex: 1 1 420px; min-width: 0; }
.section-head__count {
  font-family: var(--mono);
  font-size: .8125rem;
  color: var(--muted);
}
.section-title {
  font-family: var(--serif);
  font-size: clamp(1.375rem, 1.6vw + 1rem, 1.875rem);
  font-weight: 800;
}
.section-lead { margin-top: 6px; color: var(--muted); font-size: .9375rem; }
.section-lead strong { color: var(--ink); }

.panel {
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.panel__title { font-size: 1.0625rem; font-weight: 800; }
.panel__lead { margin-top: 4px; color: var(--muted); font-size: .875rem; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  min-height: 44px;
  padding: 8px 16px;
  border: 1.5px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-size: .9375rem;
  font-weight: 800;
  line-height: 1.35;
  text-align: center;
  text-decoration: none;
  touch-action: manipulation;
}
.btn--primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn--night { background: transparent; border-color: var(--night-line); color: var(--night-ink); }
.btn--green { background: var(--surface); border-color: var(--green-line); color: var(--green-ink); }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border: 1px solid;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 800;
  letter-spacing: .03em;
  line-height: 1.5;
  white-space: nowrap;
}
.badge--measured { color: var(--accent-ink); background: var(--accent-soft); border-color: var(--accent-line); }
.badge--official { color: var(--blue-ink); background: var(--blue-soft); border-color: var(--blue-line); }
.badge--archive { color: var(--amber-ink); background: var(--amber-soft); border-color: var(--amber-line); }

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  list-style: none;
  color: var(--muted);
  font-size: .8125rem;
  line-height: 1.5;
}
.tags li {
  padding: 2px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
}
.tags .tags__plain { padding-inline: 2px; border: 0; background: none; }

.takeaway {
  padding: 10px 14px;
  border-left: 4px solid var(--accent);
  border-radius: 0 10px 10px 0;
  background: var(--tint);
  font-size: .9375rem;
  line-height: 1.7;
}
.takeaway__label { color: var(--accent-ink); font-size: .8125rem; font-weight: 800; }
.takeaway--green { border-left-color: var(--green); background: var(--green-soft); }
.takeaway--green .takeaway__label { color: var(--green-ink); }

/* ---------- 最新号（リード） ---------- */

.lead-story {
  display: grid;
  gap: 16px;
}
@media (min-width: 900px) {
  .lead-story { grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); }
}
.lead-story__main {
  position: relative;
  isolation: isolate;
  overflow: clip;
  min-width: 0;
  padding: clamp(20px, 4vw, 36px);
  border-radius: var(--radius);
  background: var(--night);
  color: var(--night-ink);
  --focus: var(--focus-on-dark);
}
/* 右下に大きく薄く置く飾りの文字（読み上げない・押せない） */
.lead-story__mark {
  position: absolute;
  z-index: -1;
  right: 5%;
  bottom: -.24em;
  font-family: var(--serif);
  font-size: clamp(5.5rem, 13vw, 10.5rem);
  font-weight: 900;
  line-height: 1;
  letter-spacing: -.03em;
  color: var(--night-ink);
  opacity: .065;
  pointer-events: none;
  user-select: none;
}
.lead-story__label { font-family: var(--mono); font-size: .75rem; letter-spacing: .06em; color: var(--night-muted); }
.lead-story__title {
  margin-top: 10px;
  font-family: var(--serif);
  font-size: clamp(1.5rem, 2.6vw + 1rem, 2.5rem);
  font-weight: 800;
}
.lead-story__lead { margin-top: 12px; color: var(--night-ink); }
.lead-story__note { margin-top: 14px; color: var(--night-muted); font-size: .8125rem; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }

.lead-story__side { display: grid; gap: 16px; align-content: start; min-width: 0; }
.stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 12px;
}
/* 読み上げ順は「項目名 → 数値」、見た目は数値を上に置く */
.stat { display: flex; flex-direction: column-reverse; justify-content: flex-end; min-width: 0; }
.stat__value { font-family: var(--serif); font-size: 2rem; font-weight: 800; line-height: 1.1; }
.stat__unit { margin-left: 2px; font-size: 1rem; }
.stat__label { margin-top: 2px; color: var(--muted); font-size: .8125rem; line-height: 1.5; }
/* 情報源の3本柱：番号は角の丸い札にする */
.source-list { display: grid; gap: 12px; margin-top: 12px; list-style: none; font-size: .875rem; line-height: 1.65; }
.source-list li { display: flex; align-items: flex-start; gap: 10px; }
.source-list__num {
  flex: none;
  min-width: 1.9em;
  padding: 1px 0;
  border: 1px solid var(--accent-line);
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-family: var(--mono);
  font-size: .8125rem;
  font-weight: 700;
  line-height: 1.5;
  text-align: center;
}

/* ---------- まず結論 ---------- */

.verdicts {
  padding: clamp(16px, 3vw, 28px);
  border: 1px solid var(--accent-line);
  border-radius: 18px;
  background: var(--accent-soft);
}
.verdicts__grid {
  display: grid;
  gap: 16px;
  margin-top: 16px;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
}
.verdict-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.verdict-card__kicker { color: var(--accent-ink); font-size: .8125rem; font-weight: 800; }
.verdict-card__title { font-family: var(--serif); font-size: 1.1875rem; font-weight: 800; }
.verdict-card__points { display: grid; gap: 6px; padding-left: 1.25em; font-size: .9375rem; }
.verdict-card__action { margin-top: auto; padding-top: 4px; }

.diagram {
  margin-top: 16px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.diagram__title { font-size: 1.0625rem; font-weight: 800; }
.diagram__lead { margin-top: 4px; color: var(--muted); font-size: .875rem; }
.flow { display: grid; gap: 10px; margin-top: 14px; }
@media (min-width: 640px) {
  .flow {
    grid-template-columns: minmax(0, 210px) auto minmax(0, 1fr);
    align-items: center;
  }
}
.flow__start {
  padding: 14px;
  border-radius: 12px;
  background: var(--ink);
  color: var(--paper);
  font-weight: 800;
  text-align: center;
  line-height: 1.5;
}
.flow__arrow { color: var(--muted); font-size: 1.25rem; font-weight: 900; text-align: center; line-height: 1; }
.flow__arrow::before { content: "↓"; }
@media (min-width: 640px) {
  .flow__arrow::before { content: "→"; }
}
.flow__branches { display: grid; gap: 10px; list-style: none; }
.branch { padding: 12px 14px; border: 1px solid; border-radius: 12px; font-size: .9375rem; line-height: 1.6; }
.branch__title { display: block; font-weight: 800; }
.branch--good { background: var(--green-soft); border-color: var(--green-line); }
.branch--good .branch__title { color: var(--green-ink); }
.branch--bad { background: var(--accent-soft); border-color: var(--accent-line); }
.branch--bad .branch__title { color: var(--accent-ink); }

/* 判断表：幅に余裕があれば表のまま。狭い幅では各行をカードに組み替え、セルの前に列名を出す */
.decide {
  width: 100%;
  margin-top: 16px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: .9375rem;
  line-height: 1.6;
}
.decide caption { margin-bottom: 6px; font-size: .875rem; font-weight: 800; text-align: left; }
.decide thead th {
  padding: 0 12px 8px 0;
  border-bottom: 2px solid var(--line-strong);
  color: var(--muted);
  font-size: .8125rem;
  text-align: start;
}
.decide tbody th,
.decide tbody td {
  padding: 12px 12px 12px 0;
  border-bottom: 1px solid var(--line);
  text-align: start;
  vertical-align: top;
}
.decide tbody th { width: 32%; font-weight: 800; }
.decide tbody tr:last-child > * { border-bottom: 0; }
@media (max-width: 600px) {
  .decide,
  .decide tbody { display: block; }
  .decide caption { display: block; }
  .decide thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
  .decide tbody tr {
    display: grid;
    gap: 6px;
    margin-top: 8px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-left: 4px solid var(--ink);
    border-radius: 10px;
    background: var(--paper);
  }
  /* 各セルは「列名 → 値」の縦並び（列名は疑似要素） */
  .decide tbody th,
  .decide tbody td {
    display: flex;
    flex-direction: column;
    gap: 2px;
    width: auto;
    padding: 0;
    border: 0;
  }
  .decide tbody th { font-size: 1rem; }
  /* 列名は見た目だけ（読み上げは表の列見出しが担うので、生成する文字には空の代替を付ける） */
  .decide tbody [data-label]::before {
    content: attr(data-label);
    content: attr(data-label) / "";
    color: var(--muted);
    font: 800 .75rem/1.4 var(--sans);
    letter-spacing: .02em;
  }
}

/* ---------- 初心者向けの棚 ---------- */

/* 枠は内側に描く線（中の見出し帯の背景より手前に出るので、角まで途切れない） */
.shelf {
  overflow: clip;
  border-radius: 18px;
  background: var(--surface);
  outline: 2px solid var(--green-line);
  outline-offset: -2px;
}
.shelf__head { padding: clamp(18px, 3vw, 28px); background: var(--green-soft); }
.shelf__kicker { color: var(--green-ink); font-size: .75rem; font-weight: 800; letter-spacing: .08em; }
.shelf__title { margin-top: 4px; font-family: var(--serif); font-size: clamp(1.375rem, 1.6vw + 1rem, 1.875rem); font-weight: 800; }
.shelf__lead { margin-top: 8px; color: var(--ink-soft); font-size: .9375rem; }
.shelf__body { padding: 4px clamp(16px, 3vw, 28px) clamp(18px, 3vw, 28px); }
.shelf__sub { margin: 24px 0 10px; font-size: 1.0625rem; font-weight: 800; }

.steps {
  display: grid;
  gap: 12px;
  list-style: none;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
}
.step { min-width: 0; padding: 14px; border: 1px solid var(--green-line); border-radius: 12px; }
.step__head { display: flex; align-items: center; gap: 10px; font-weight: 800; }
.step__num {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--green-strong);
  color: #ffffff;
  font-size: .875rem;
}
.step p { margin-top: 6px; font-size: .9375rem; }

.guides {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
}
.guide {
  display: flex;
  flex-flow: column nowrap;
  row-gap: 10px;
  min-width: 0;
  padding: 18px 16px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
}
.guide__level { color: var(--green-ink); font-size: .8125rem; font-weight: 800; }
.guide__title { font-family: var(--serif); font-size: 1.0625rem; font-weight: 800; }
.guide__text { font-size: .9375rem; }
.guide__action { margin-top: auto; padding-top: 4px; }

.prompt-box { padding: 16px; border: 1px solid var(--green-line); border-radius: 12px; background: var(--green-soft); font-size: .9375rem; }
.prompt-box__title { font-weight: 800; }
.prompt-box p + p,
.prompt-box ul + p { margin-top: 8px; }
.prompt-box__examples {
  display: grid;
  gap: 4px;
  margin-top: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--surface);
  list-style: none;
  font-weight: 700;
}

.glossary {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
}
.glossary__item { min-width: 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; }
.glossary dt { font-weight: 800; }
.glossary dd { margin-top: 2px; color: var(--ink-soft); font-size: .9375rem; }

/* 確認リスト：行頭のチェック印は線で描く */
.checklist { display: grid; gap: 8px; list-style: none; font-size: .9375rem; }
.checklist li { position: relative; padding-left: 30px; }
.checklist li::before {
  content: "";
  position: absolute;
  left: 8px;
  top: .38em;
  width: 7px;
  height: 12px;
  border: solid var(--green);
  border-width: 0 3px 3px 0;
  transform: rotate(40deg);
}
.shelf__note { margin-top: 20px; padding-top: 14px; border-top: 1px dashed var(--green-line); color: var(--muted); font-size: .875rem; }
.shelf__note a { color: var(--green-ink); font-weight: 800; }

/* ---------- 記事フィード ---------- */

/* カテゴリの選び直し（カテゴリ帯が固定されない画面だけに出す） */
.feed-category {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  margin-top: 14px;
}
.topics-pinned .feed-category { display: none; }
.feed-category__label { color: var(--muted); font-size: .8125rem; font-weight: 800; }
.feed-category__select {
  flex: 1 1 200px;
  min-width: 0;
  max-width: 340px;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font-size: max(16px, 1rem);
  font-weight: 700;
}
.feed .chips { margin-top: 12px; }

.feed-notice {
  margin-top: 12px;
  padding: 10px 14px;
  border: 1px solid var(--accent-line);
  border-radius: 12px;
  background: var(--accent-soft);
  font-size: .875rem;
}

/* 絞り込み結果のまとまり。キーボードで絞り込んだあとのフォーカス先になる */
.results { margin-top: 12px; border-radius: var(--radius); }
.results:focus { outline: none; }
.results:focus-visible { outline: 2px dashed var(--focus); outline-offset: 6px; }

.filter-state {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-bottom: 16px;
  padding: 10px 14px;
  border: 1px solid var(--amber-line);
  border-radius: 12px;
  background: var(--amber-soft);
}
.filter-state__text { flex: 1 1 260px; min-width: 0; font-size: .9375rem; font-weight: 700; }
/* 状態の文が数行になるときは、解除ボタンを下端にそろえる。背の低い画面で見出しを優先して
   状態表示の上側が固定帯の下に隠れても、ボタンは見出しのすぐ上に見えたまま押せる */
.filter-state__clear {
  align-self: flex-end;
  min-height: 44px;
  padding: 6px 16px;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  background: var(--surface);
  font-size: .875rem;
  font-weight: 800;
  touch-action: manipulation;
}

.cards {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
}
.card {
  /* カード全体を押せるようにする当たり判定（.card__open::after）の基準 */
  position: relative;
  display: flex;
  flex-flow: column nowrap;
  row-gap: 12px;
  min-width: 0;
  padding: 16px 18px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.card:hover { border-color: var(--line-strong); }
.card__meta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px; }
.card__date { font-family: var(--mono); font-size: .75rem; color: var(--muted); }
.card__title { font-family: var(--serif); font-size: 1.125rem; font-weight: 800; line-height: 1.45; }
.card__open {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
}
/* カードのどこを押しても開く（ボタンの当たり判定をカード全体に広げる） */
.card__open::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
}
@supports selector(:has(*)) {
  .card__open:focus-visible { outline: none; }
  .card:has(.card__open:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
}
.card__excerpt { color: var(--ink-soft); font-size: .9375rem; line-height: 1.7; }
.card__foot {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: .8125rem;
  font-weight: 700;
}
.card__go { color: var(--accent-ink); }
/* 記事が多いときの続き（一度に並べるのは先頭から30件まで） */
.feed-more {
  display: block;
  width: min(100%, 420px);
  min-height: 48px;
  margin: 20px auto 0;
  padding: 10px 20px;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  background: var(--surface);
  font-size: .9375rem;
  font-weight: 800;
  touch-action: manipulation;
}
.feed-empty {
  padding: 24px 18px;
  border-radius: var(--radius);
  background: var(--tint);
  color: var(--ink-soft);
  font-weight: 700;
  text-align: center;
}

/* ---------- 実測ラボ ---------- */

.lab-panel {
  margin-top: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.lab-panel__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 16px;
  row-gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--tint);
}
/* 題が伸びて、選択欄は右端に寄る（狭い幅では題の下に回る） */
.lab-panel__title { flex: 1 1 12rem; font-size: 1.0625rem; font-weight: 800; }
.pickers { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; min-width: 0; }
.picker { display: block; min-width: 0; }
.picker select {
  max-width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font-size: max(16px, 1rem);
  font-weight: 700;
}
.pickers__vs { color: var(--muted); font-weight: 900; }
.panes {
  display: grid;
  gap: 1px;
  background: var(--line);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
}
.pane { min-width: 0; padding: 18px; background: var(--surface); }
.pane__name { font-family: var(--serif); font-size: 1.25rem; font-weight: 800; }
.pane__role { margin-top: 2px; font-weight: 800; font-size: .9375rem; }
.pane__desc { margin-top: 4px; color: var(--muted); font-size: .875rem; }
.meters { display: grid; gap: 8px; margin-top: 12px; }
.meter {
  display: grid;
  grid-template-columns: minmax(0, 6.5em) minmax(0, 1fr) 2.5em;
  align-items: center;
  gap: 8px;
  font-size: .875rem;
}
.meter__track { height: 8px; overflow: hidden; border-radius: 999px; background: var(--tint); }
.meter__fill { display: block; height: 100%; border-radius: inherit; background: var(--ink); }
.pane--b .meter__fill { background: var(--accent); }
.meter__value { font-family: var(--mono); text-align: right; }
.lab-verdict { padding: 14px 18px; border-top: 1px solid var(--line); background: var(--paper); font-size: .9375rem; }
.lab-verdict strong { color: var(--accent-ink); }
.lab-note { margin-top: 8px; color: var(--muted); font-size: .8125rem; }

/* ---------- 共通テストの進み具合／タイムライン ---------- */

.split {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr));
}
.split > section { min-width: 0; }
.bench { display: grid; gap: 12px; margin-top: 14px; }
.bench__row {
  display: grid;
  grid-template-columns: minmax(0, 8.5em) minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px 10px;
  font-size: .875rem;
}
/* 進み具合の棒：角を少しだけ丸めた溝に、塗りを重ねる */
.bench__track {
  position: relative;
  height: 12px;
  border-radius: 4px;
  background: var(--tint);
  box-shadow: inset 0 0 0 1px var(--line);
}
.bench__fill { position: absolute; inset: 0 auto 0 0; border-radius: 4px; background: var(--accent); }
.bench__row--highlight .bench__fill { background: var(--ink); }
.bench__label { font-family: var(--mono); font-size: .75rem; text-align: right; }
@media (max-width: 520px) {
  .bench__row { grid-template-columns: minmax(0, 1fr) auto; }
  .bench__track { grid-column: 1 / -1; grid-row: 2; }
}
.bench__notes { display: grid; gap: 6px; margin-top: 14px; color: var(--muted); font-size: .8125rem; }
.bench__reading {
  margin-top: 14px;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--tint);
  font-size: .875rem;
}

.timeline-list {
  display: grid;
  gap: 14px;
  margin-top: 14px;
  margin-left: 6px;
  padding-left: 18px;
  border-left: 2px solid var(--line);
  list-style: none;
}
.timeline-list li { position: relative; }
.timeline-list li::before {
  content: "";
  position: absolute;
  left: -25px;
  top: .45em;
  width: 12px;
  height: 12px;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: var(--accent);
}
.timeline-list__date { font-family: var(--mono); color: var(--muted); font-size: .75rem; }
.timeline-list__title { display: block; font-weight: 800; }
.timeline-list p { color: var(--ink-soft); font-size: .875rem; }

/* ---------- 測り方／配信先／お知らせ ---------- */

.tiles {
  display: grid;
  gap: 14px;
  margin-top: 16px;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
}
.tile {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.tile__kicker { font-family: var(--mono); color: var(--accent-ink); font-size: .75rem; font-weight: 700; letter-spacing: .06em; }
.tile__title { font-size: 1.0625rem; font-weight: 800; }
.tile__text { color: var(--ink-soft); font-size: .9375rem; }
/* 当たり判定の高さ 44px は、上下の余白と行の高さで取る */
.tile__link {
  align-self: flex-start;
  margin-top: auto;
  padding-block: 11px;
  line-height: 22px;
  color: var(--accent-ink);
  font-weight: 800;
  text-underline-offset: 4px;
}
.tile__status { margin-top: auto; padding-top: 8px; color: var(--muted); font-size: .8125rem; font-weight: 800; }
.tile--pending { border-style: dashed; background: var(--paper); }
.notice__date { font-family: var(--mono); color: var(--muted); font-size: .75rem; }
.notice__title { font-family: var(--serif); font-size: 1.0625rem; font-weight: 800; line-height: 1.5; }

/* ---------- フッター ---------- */

.site-footer {
  border-top: 1px solid var(--line);
  background: var(--tint);
  padding-bottom: env(safe-area-inset-bottom);
}
.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px 24px;
  padding-top: 24px;
  padding-bottom: 28px;
  color: var(--muted);
  font-size: .8125rem;
}
.site-footer__inner > * { flex: 1 1 280px; min-width: 0; }
.site-footer__links a { display: inline-flex; align-items: center; min-height: 44px; color: var(--ink); font-weight: 700; }
.site-footer__sep { margin-inline: 2px; }

/* ---------- 記事の詳細（ダイアログ） ---------- */

.reader {
  /* 画面の左右に、余白か安全領域の広いほうを空けて中央に置く */
  width: min(46rem, 100% - 2 * max(12px, env(safe-area-inset-left, 0px), env(safe-area-inset-right, 0px)));
  max-width: none;
  max-height: calc(100vh - 2 * max(16px, env(safe-area-inset-top, 0px), env(safe-area-inset-bottom, 0px)));
  max-height: calc(100dvh - 2 * max(16px, env(safe-area-inset-top, 0px), env(safe-area-inset-bottom, 0px)));
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 2px 6px rgb(0 0 0 / .16), 0 22px 60px rgb(0 0 0 / .34);
}
.reader[open] { display: flex; flex-direction: column; }
.reader::backdrop { background: rgb(14 13 11 / .62); }
.reader__bar {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: flex-end;
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.reader__close {
  flex: none;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--surface);
  font-size: 1.25rem;
  line-height: 1;
}
.reader__scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 18px clamp(16px, 4vw, 28px) 24px;
}
/* 本文の入れ物にもフォーカスが来る（矢印・PageDown で読み進めるため）。枠は内側に描いて切れないようにする */
.reader__scroll:focus { outline: none; }
.reader__scroll:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; }
.reader__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.reader__facts { font-family: var(--mono); color: var(--muted); font-size: .75rem; }
.reader__title { margin-top: 10px; font-family: var(--serif); font-size: clamp(1.3125rem, 1.4vw + 1rem, 1.5rem); font-weight: 800; }
.reader__article .tags { margin-top: 10px; }
.reader__article .takeaway { margin-top: 16px; }
.reader__text { display: grid; gap: 1em; margin-top: 16px; color: var(--ink-soft); font-size: .9375rem; line-height: 1.85; }
.reader__evidence {
  display: grid;
  gap: 2px;
  margin-top: 18px;
  padding: 12px 14px 4px;
  border-radius: 12px;
  background: var(--tint);
  font-size: .875rem;
}
.reader__note { padding-bottom: 8px; }
/* 出典と note へのリンクは、行全体を押せる高さ 44px 以上の帯にする */
.reader__evidence a {
  display: block;
  padding-block: 12px;
  border-top: 1px solid var(--line);
  color: var(--accent-ink);
  font-weight: 700;
  line-height: 1.5;
  text-decoration-thickness: 1px;
}

.noscript { padding-top: 16px; padding-bottom: 16px; }
