:root {
  --bg: #f4efe8;
  --panel: #fffdfa;
  --ink: #1d2733;
  --ink-soft: #5c6875;
  --ink-faint: #8b949f;
  --line: #ddd4c8;
  --line-soft: #ebe3d8;
  --brand: #b0432f;
  --brand-soft: #f6e6e1;
  --accent: #2f6b62;
  /* 製品の色分け。Claude Code=オレンジ系 / Codex=グリーン系 */
  --claude-bg: #fdf4ee;
  --claude-line: #e8cdb8;
  --claude-ink: #a2542a;
  --codex-bg: #eef6f1;
  --codex-line: #c2ddcd;
  --codex-ink: #237050;
  --shadow: 0 1px 2px rgba(29, 39, 51, .06);
  --sans: "Hiragino Sans", "Yu Gothic UI", "Yu Gothic", Meiryo, system-ui, sans-serif;
  --topbar-h: 168px;
}

* { box-sizing: border-box; }

html { scroll-padding-top: calc(var(--topbar-h) + 12px); }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.75;
  /* 日本語が変な位置で折れないように。未対応ブラウザは無視される */
  word-break: auto-phrase;
  text-wrap: pretty;
  -webkit-text-size-adjust: 100%;
}

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- topbar : 検索は常に画面上に残す ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 2px 10px rgba(29, 39, 51, .05);
}

.topbar__inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 12px 20px 14px;
}

.topbar__title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.topbar__mark {
  display: grid;
  place-items: center;
  width: 30px; height: 30px;
  flex: none;
  background: var(--brand);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .04em;
}

.topbar__title strong { display: block; font-size: 16px; line-height: 1.3; }
.topbar__title small { display: block; color: var(--ink-faint); font-size: 12px; }

.search__label {
  display: block;
  font-size: 13px;
  color: var(--ink-soft);
  margin-bottom: 6px;
}

.search__box {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--panel);
  border: 2px solid var(--ink);
  border-radius: 8px;
}

.search__icon {
  width: 19px; height: 19px;
  margin: 0 8px 0 11px;
  flex: none;
  fill: none;
  stroke: var(--ink-soft);
  stroke-width: 2;
  stroke-linecap: round;
}

#q {
  flex: 1;
  min-width: 0;
  border: 0;
  background: none;
  padding: 11px 8px 11px 0;
  font: inherit;
  font-size: 16px; /* iOSの自動ズーム防止 */
  color: inherit;
}

#q:focus { outline: none; }
.search__box:focus-within { box-shadow: 0 0 0 3px var(--brand-soft); }
#q::-webkit-search-cancel-button { display: none; }

.search__clear {
  flex: none;
  margin-right: 6px;
  width: 30px; height: 30px;
  border: 0;
  border-radius: 50%;
  background: var(--line-soft);
  color: var(--ink-soft);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 9px;
}

.chip {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 7px 16px;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.chip__n { color: var(--ink-faint); font-size: 11px; margin-left: 5px; }

.chip.is-on {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.chip.is-on .chip__n { color: rgba(255, 255, 255, .65); }

/* ---------- lede ---------- */

main { max-width: 1180px; margin: 0 auto; padding: 0 20px 56px; }

.lede { padding: 30px 0 22px; }

.lede h1 {
  margin: 0 0 14px;
  font-size: 32px;
  line-height: 1.4;
  letter-spacing: .01em;
}

.lede__sub {
  margin: 0 0 20px;
  max-width: 40em;
  font-size: 17px;
  color: var(--ink-soft);
}

.lede__sub b { color: var(--ink); font-weight: 700; }

/* 語のまとまりの途中で折らない */
.nb { white-space: nowrap; }

@media (max-width: 560px) {
  .lede__sub br { display: none; }
}

/* 冒頭は、手順（左）と関連リンク（右）の2列にする。
   広い画面で右側が空いていたので、そこに置く */
.lede__cols {
  display: grid;
  grid-template-columns: minmax(0, 46em) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

@media (max-width: 1000px) {
  .lede__cols { grid-template-columns: minmax(0, 1fr); }
}

.links__title {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--ink-faint);
  letter-spacing: .04em;
}

.linkcard {
  display: block;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px 18px;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow);
}

.linkcard:hover { border-color: var(--codex-line); background: var(--codex-bg); }

.linkcard__name {
  display: block;
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 4px;
}

.linkcard__desc {
  display: block;
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink-soft);
}

.linkcard__go {
  display: block;
  margin-top: 10px;
  font-size: 13px;
  font-weight: 700;
  color: var(--codex-ink);
}

@media print { .links { display: none; } }

/* 「聞く」で何が起きるかを、手順として言い切る */
.howto {
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 5px solid var(--accent);
  border-radius: 0 10px 10px 0;
  padding: 18px 22px 16px;
}

.howto__title {
  margin: 0 0 12px;
  font-size: 17px;
  line-height: 1.4;
}

.howto__steps {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 9px;
}

.howto__steps li {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  font-size: 16px;
}

.howto__n {
  flex: none;
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  margin-top: 2px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}

.howto__body { color: var(--ink-soft); }
.howto__body b { color: var(--ink); font-weight: 700; }

.howto__note {
  margin: 14px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
  font-size: 15px;
  color: var(--ink-soft);
}

.is-claude { color: var(--claude-ink); }
.is-codex  { color: var(--codex-ink); }

.inline-copy {
  display: inline-block;
  border: 1px solid var(--ink);
  border-radius: 5px;
  padding: 1px 9px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  background: var(--bg);
}

/* ---------- results ---------- */

.results__count {
  margin: 0 0 10px;
  color: var(--ink-soft);
  font-size: 14px;
}

.results__count strong {
  font-size: 24px;
  color: var(--brand);
  margin-right: 2px;
}

.results__note {
  margin: 0 0 10px;
  padding: 8px 12px;
  background: var(--brand-soft);
  border-radius: 6px;
  font-size: 13px;
  color: #8a3625;
}

/* overflow を付けるとスクロール文脈ができて thead の position:sticky が壊れるので付けない */
.table-wrap {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
}

.grid {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}

.grid thead th {
  position: sticky;
  top: var(--topbar-h);
  z-index: 5;
  background: #efe8de;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-soft);
  letter-spacing: .02em;
  padding: 12px 16px;
  white-space: nowrap;
}

.grid td {
  border-bottom: 1px solid var(--line);
  padding: 15px 16px;
  vertical-align: top;
}

/* 1行おきにうっすら沈める。列の色分けの上から均一にかかるので、
   オレンジ列でもグリーン列でも同じ強さの縞になる */
.grid tbody tr:nth-of-type(even):not(.sect) td {
  box-shadow: inset 0 0 0 9999px rgba(29, 39, 51, .028);
}

.grid tbody tr:last-child td { border-bottom: 0; }
.grid tbody tr:hover { background: #fbf7f1; }

.c-name { width: 22%; }
.c-sum  { width: 22%; }
.c-call { width: 28%; }

/* 縦罫線。どこまでが同じ製品の話か、目で追えるようにする */
.grid th + th,
.grid td + td { border-left: 1px solid var(--line); }

.grid th.c-claude, .grid td.call--claude { background: var(--claude-bg); border-left-color: var(--claude-line); }
.grid th.c-codex,  .grid td.call--codex  { background: var(--codex-bg);  border-left-color: var(--codex-line); }
.grid th.c-claude { color: var(--claude-ink); }
.grid th.c-codex  { color: var(--codex-ink); }

.call--claude code { background: #f7e3d4; color: var(--claude-ink); }
.call--codex  code { background: #dcece3; color: var(--codex-ink); }
.call--claude .ask:hover { border-color: var(--claude-ink); color: var(--claude-ink); }
.call--codex  .ask:hover { border-color: var(--codex-ink); color: var(--codex-ink); }

.grid tbody tr:hover td.call--claude { background: #fbeee3; }
.grid tbody tr:hover td.call--codex  { background: #e6f1ea; }

/* 段階の区切り */
.sect td {
  background: #f0e9df;
  border-top: 1px solid var(--line);
  padding: 11px 16px;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: .04em;
}

.sect .sect__hint { font-weight: 400; font-size: 13px; color: var(--ink-faint); margin-left: 10px; }

.name {
  font-weight: 700;
  font-size: 17px;
  line-height: 1.45;
  color: var(--ink);
}


.call { line-height: 1.6; font-size: 15px; }

.call code {
  display: inline-block;
  margin-right: 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 14px;
  font-weight: 700;
  background: #eef2f1;
  color: var(--accent);
  border-radius: 5px;
  padding: 2px 8px;
  margin-bottom: 3px;
}

.call .entry { display: block; }
.call .sc { display: block; font-size: 13px; color: var(--ink-faint); margin-top: 4px; }

/* 根拠の状態。読む人が「どこまで確かか」を判断できるようにする */
.call .src {
  display: inline-block;
  margin-top: 6px;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.6;
}

.call .src--demo { background: #eef2f1; color: var(--accent); }
.call .src--none { background: #fbe7e2; color: #a33a22; }

/* 補足メモ。公式に載っていない実機確認や、注意点を小さく添える */
.call .note {
  display: block;
  margin-top: 6px;
  padding-left: 9px;
  border-left: 2px solid var(--line);
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-faint);
}
.call .none { color: var(--ink-faint); }

.sum {
  color: #45505d;
  font-size: 15px;
  line-height: 1.65;
}

.ask {
  display: block;
  margin: 6px 0 0 auto;
  border: 1px solid var(--line);
  background: var(--bg);
  border-radius: 6px;
  padding: 6px 14px;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  background: var(--panel);
  color: var(--ink-soft);
  cursor: pointer;
  white-space: nowrap;
}

.ask:hover { border-color: var(--accent); color: var(--accent); }

mark { background: #ffe9a8; color: inherit; border-radius: 2px; padding: 0 1px; }

/* ---------- empty ---------- */

.empty {
  margin-top: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 26px 20px;
  text-align: center;
}

.empty__title { margin: 0 0 6px; font-weight: 700; }
.empty__body { margin: 0 0 16px; color: var(--ink-soft); font-size: 14px; }

.btn {
  border: 0;
  background: var(--ink);
  color: #fff;
  border-radius: 7px;
  padding: 10px 20px;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}

/* ---------- foot ---------- */

.foot-note {
  margin-top: 34px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 13px;
}

.foot-note h2 { margin: 0 0 8px; font-size: 13px; color: var(--ink); }
.foot-note ul { margin: 0; padding-left: 1.2em; }

.site-foot {
  border-top: 1px solid var(--line);
  padding: 16px 20px 30px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  justify-content: space-between;
  max-width: 1180px;
  margin: 0 auto;
  color: var(--ink-faint);
  font-size: 12px;
}

/* ---------- toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13px;
  z-index: 60;
  box-shadow: 0 6px 20px rgba(29, 39, 51, .22);
}

/* ---------- 狭い画面：表を積み上げカードにする ---------- */

@media (max-width: 860px) {
  :root { --topbar-h: 0px; }

  .topbar { position: static; }
  .topbar__inner { padding: 10px 14px 12px; }
  main { padding: 0 14px 44px; }

  .lede { padding: 20px 0 16px; }
  .lede h1 { font-size: 20px; }

  .table-wrap { background: none; border: 0; border-radius: 0; box-shadow: none; overflow: visible; }
  .grid, .grid tbody, .grid tr, .grid td { display: block; width: auto; }
  .grid thead { display: none; }

  .grid tbody tr {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 9px;
    padding: 12px 14px;
    margin-bottom: 9px;
    box-shadow: var(--shadow);
  }

  .grid tbody tr:hover { background: var(--panel); }
  .grid td { border: 0; padding: 0; }

  .grid td.cell-sum {
    margin-top: 7px;
    padding-top: 7px;
    border-top: 1px dashed var(--line-soft);
  }

  /* 縦罫線の代わりに、製品ごとの帯で区別する */
  .grid td.cell-call {
    margin-top: 8px;
    padding: 8px 10px;
    border-radius: 7px;
    border-left: 3px solid;
  }

  .grid td.call--claude { background: var(--claude-bg); border-left-color: var(--claude-line); }
  .grid td.call--codex  { background: var(--codex-bg);  border-left-color: var(--codex-line); }
  .grid td.call--claude::before { color: var(--claude-ink); }
  .grid td.call--codex::before  { color: var(--codex-ink); }

  /* 狭い画面では見出しを値の左へ寄せ、1行にまとめて縦を詰める */
  .grid td[data-label]::before {
    content: attr(data-label);
    display: inline-block;
    min-width: 6.2em;
    font-size: 11px;
    color: var(--ink-faint);
  }

  .grid td.cell-sum { display: flex; gap: 8px; align-items: baseline; }
  .grid td.cell-call { display: block; }
  .grid td.cell-call::before { display: block; min-width: 0; margin-bottom: 2px; font-weight: 700; }
  .grid td.cell-name::before { display: block; margin-bottom: 1px; }

  .grid td.cell-act { margin-top: 9px; }
  .ask { width: 100%; margin-top: 8px; padding: 9px; }

  .grid tr.sect {
    background: none;
    border: 0;
    box-shadow: none;
    padding: 14px 2px 4px;
    margin: 0;
  }

  .sect td { background: none; border: 0; padding: 0; }
}

/* ---------- 印刷：当日の手元資料にできるように ---------- */

@media print {
  :root { --topbar-h: 0px; }
  .topbar, .lede__ask, .c-act, .cell-act, .empty, .site-foot, .toast { display: none !important; }
  body { background: #fff; font-size: 10pt; }
  main { max-width: none; padding: 0; }
  .table-wrap { border: 0; box-shadow: none; }
  .grid thead th { position: static; background: #eee; }
  .grid tbody tr { page-break-inside: avoid; }
  .lede h1 { font-size: 16pt; }
}

/* ---------- 自動コピーが使えない環境の逃げ道 ---------- */

.fallback {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 20px;
  max-width: 560px;
  width: calc(100% - 32px);
  background: var(--panel);
  color: var(--ink);
}

.fallback::backdrop { background: rgba(29, 39, 51, .45); }
.fallback__title { margin: 0 0 10px; font-size: 14px; font-weight: 700; }

.fallback textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  font: inherit;
  font-size: 13px;
  line-height: 1.6;
  resize: vertical;
  background: var(--bg);
  color: inherit;
}

.fallback .btn { margin-top: 12px; }

/* ---------- 狭い画面で検索へ戻る ---------- */

.to-search {
  position: fixed;
  right: 14px;
  bottom: 16px;
  z-index: 40;
  display: none;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  background: var(--ink);
  color: #fff;
  border-radius: 999px;
  padding: 10px 16px;
  font: inherit;
  font-size: 13px;
  box-shadow: 0 6px 18px rgba(29, 39, 51, .25);
  cursor: pointer;
}

@media (max-width: 860px) {
  .to-search.is-shown { display: inline-flex; }
}

@media print { .to-search { display: none !important; } }
