/* 生成AI料金台帳 — 帳簿の罫線・緑の帯・締めの赤い二重線。設計は research/DESIGN.md */
:root {
  --paper: #f5f8f4;
  --sheet: #ffffff;
  --ink: #10231c;
  --muted: #56675f;
  --rule: #cbdcd0;
  --rule-strong: #93b49e;
  --band: #ebf4ed;
  --green: #1d6b4a;
  --green-deep: #134d35;
  --green-soft: #d6eadc;
  --red: #c4302b;
  --api: #8cc19e;
  --track: #e3eee6;
  --radius: 4px;
  --measure: 70ch;
  --jp: "Zen Kaku Gothic New", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
  --num: "Barlow Condensed", "Zen Kaku Gothic New", "Hiragino Sans", sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--jp);
  font-size: 16px;
  line-height: 1.85;
  font-feature-settings: "palt" 0;
  font-variant-numeric: tabular-nums;
}
a { color: var(--green); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--green-deep); text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--green); outline-offset: 2px; border-radius: 2px; }
img { max-width: 100%; height: auto; }
button { font: inherit; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 24px; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 12px; top: 12px; background: var(--sheet); padding: 8px 12px; z-index: 10; }
.fig { font-family: var(--num); font-variant-numeric: tabular-nums lining-nums; letter-spacing: 0; }
.cur { font-size: .72em; font-weight: 500; margin-right: .06em; vertical-align: .08em; }

/* ---------- header ---------- */
.masthead { background: var(--sheet); border-bottom: 1px solid var(--rule); }
.masthead .wrap { display: flex; align-items: center; gap: 12px 32px; min-height: 68px; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; flex: none; }
.brand svg { width: 34px; height: 34px; flex: none; }
.brand b { display: block; font-size: 18px; font-weight: 900; letter-spacing: .02em; line-height: 1.2; }
.brand small { display: block; font-size: 11px; color: var(--muted); letter-spacing: .06em; line-height: 1.3; }
.brand:hover { color: var(--ink); }
.nav { display: flex; align-items: center; gap: 2px; margin: 0 0 0 auto; padding: 0; list-style: none; font-size: 15px; font-weight: 500; }
.nav a { display: block; color: var(--ink); text-decoration: none; padding: 6px 11px; border-radius: var(--radius); white-space: nowrap; }
.nav a:hover { background: var(--band); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--ink); color: #fff; }
.nav .sep { width: 1px; height: 20px; background: var(--rule); margin: 0 8px; }

main { padding: 28px 0 72px; }
.crumbs { font-size: 13px; color: var(--muted); margin: 0 0 18px; }
.crumbs a { color: var(--muted); }

/* ---------- type ---------- */
h1 { font-size: clamp(28px, 4.4vw, 46px); font-weight: 900; line-height: 1.28; letter-spacing: -.01em; margin: 0 0 16px; word-break: auto-phrase; text-wrap: balance; }
h2 { font-size: 24px; font-weight: 900; line-height: 1.45; margin: 48px 0 12px; letter-spacing: .01em; word-break: auto-phrase; }
h3 .meta { font-weight: 400; }
h3 { font-size: 18px; font-weight: 700; margin: 32px 0 10px; word-break: auto-phrase; }
p, ul, ol { max-width: var(--measure); }
.lead { font-size: 17px; line-height: 1.9; max-width: 40em; }
.meta { color: var(--muted); font-size: 14px; }
.lead, .evidence li, td, th { overflow-wrap: anywhere; }
.sec-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 16px; margin: 72px 0 16px; padding-top: 20px; border-top: 1px solid var(--rule-strong); }
.sec-head h2 { margin: 0; }
.sec-head .meta { margin: 0; }
.sec-head .more-link { margin-left: auto; font-size: 14px; font-weight: 500; }

/* ---------- buttons & chips ---------- */
.btns { display: flex; flex-wrap: wrap; gap: 10px; margin: 24px 0 0; }
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 11px 20px; border-radius: var(--radius); font-weight: 700; font-size: 15px; text-decoration: none; border: 1.5px solid var(--green); color: var(--green); background: var(--sheet); }
.btn:hover { background: var(--band); color: var(--green-deep); }
.btn.primary { background: var(--green); color: #fff; }
.btn.primary:hover { background: var(--green-deep); border-color: var(--green-deep); color: #fff; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border: 1px solid var(--rule-strong); border-radius: 999px; font-size: 13px; font-weight: 500; color: var(--green-deep); background: var(--sheet); text-decoration: none; white-space: nowrap; }
a.chip:hover { background: var(--band); }
.filter { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.filter button { display: inline-flex; align-items: baseline; gap: 8px; padding: 3px 13px; border: 1px solid var(--rule-strong); border-radius: 999px; background: var(--sheet); color: var(--ink); cursor: pointer; font-size: 14px; font-weight: 500; }
.filter button span { font-family: var(--num); font-size: 15px; color: var(--muted); }
.filter button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.filter button[aria-pressed="true"] span { color: #b8d6c1; }
.filter:not(.ready) { display: none; }

/* ---------- hero ---------- */
.hero { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 40px 56px; align-items: start; padding: 20px 0 8px; }
.hero h1 { font-size: clamp(32px, 5vw, 54px); line-height: 1.22; margin-bottom: 20px; }
.hero .stamp { display: flex; flex-wrap: wrap; gap: 6px 20px; margin: 28px 0 0; padding: 0; list-style: none; font-size: 14px; color: var(--muted); max-width: none; }
.hero .stamp b { color: var(--ink); font-weight: 700; }
.hero .stamp .fig { font-size: 18px; color: var(--ink); font-weight: 600; }

/* 計算伝票 */
.slip { background: var(--sheet); border: 1px solid var(--rule-strong); border-radius: var(--radius); box-shadow: 0 1px 0 var(--rule), 0 12px 32px -18px rgba(16, 35, 28, .35); }
.slip header { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 16px 20px 12px; border-bottom: 1px solid var(--rule-strong); }
.slip header h2 { margin: 0; font-size: 16px; font-weight: 700; letter-spacing: .02em; }
.slip header span { font-size: 12px; color: var(--muted); }
.slip ol { list-style: none; margin: 0; padding: 0; max-width: none; }
.slip li { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 0 12px; align-items: center; padding: 11px 20px; border-bottom: 1px solid var(--rule); }
.slip li:nth-child(even) { background: var(--band); }
.slip li:last-child { border-bottom: 0; }
.slip .rank { font-family: var(--num); font-size: 20px; font-weight: 600; color: var(--muted); }
.slip .who { line-height: 1.4; min-width: 0; }
.slip .who a { font-weight: 700; color: var(--ink); text-decoration: none; }
.slip .who a:hover { text-decoration: underline; }
.slip .who small { display: block; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slip .yen { font-family: var(--num); font-size: 26px; font-weight: 600; line-height: 1; white-space: nowrap; text-align: right; }
.slip .yen small { font-family: var(--jp); font-size: 12px; font-weight: 400; color: var(--muted); margin-left: 2px; }
.slip li.top { padding-top: 16px; padding-bottom: 16px; }
.slip li.top .rank { color: var(--red); }
.slip li.top .yen { font-size: 44px; font-weight: 700; }
.slip footer { padding: 12px 20px 16px; border-top: 1px solid var(--rule-strong); font-size: 12px; color: var(--muted); line-height: 1.7; }
.slip footer a { font-weight: 700; font-size: 14px; }
/* 締めの二重線（答えの数字の下にだけ引く） */
.closed { display: inline-block; padding-bottom: 4px; border-bottom: 4px double var(--red); }

/* ---------- 分野の帳 ---------- */
.book { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); margin: 0; padding: 0; list-style: none; background: var(--sheet); border: 1px solid var(--rule-strong); border-radius: var(--radius); max-width: none; }
.book li + li { border-left: 1px solid var(--rule); }
.book a { display: flex; flex-direction: column; height: 100%; padding: 18px 20px 20px; color: var(--ink); text-decoration: none; }
.book a:hover { background: var(--band); }
.book .name { font-size: 17px; font-weight: 900; }
.book .count { font-size: 13px; color: var(--muted); }
.book .low { margin-top: auto; padding-top: 18px; }
.book .low .fig { font-size: 32px; font-weight: 600; line-height: 1; }
.book .low small { font-size: 12px; color: var(--muted); }
.book .low .by { display: block; font-size: 12px; color: var(--muted); margin-top: 4px; line-height: 1.5; }

/* ---------- ranking meter ---------- */
.legend { font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 20px; margin: 0 0 10px; max-width: none; }
.legend b { display: inline-block; width: 22px; height: 10px; vertical-align: middle; margin-right: 6px; background: var(--green); border-radius: 1px; }
.legend b.api { background: var(--api); }
.meter { list-style: none; margin: 0 0 8px; padding: 0; background: var(--sheet); border: 1px solid var(--rule-strong); border-radius: var(--radius); max-width: none; overflow: hidden; }
.meter li { display: grid; grid-template-columns: 34px minmax(0, 20em) minmax(0, 1fr) 7.2em; gap: 4px 16px; align-items: center; padding: 10px 18px 10px 12px; border-bottom: 1px solid var(--rule); }
.meter li:nth-child(even of :not([hidden])) { background: var(--band); }
.meter li:last-child { border-bottom: 0; }
.meter .rank { font-family: var(--num); font-size: 18px; font-weight: 600; color: var(--muted); text-align: right; }
.meter .who { font-size: 14px; line-height: 1.45; overflow-wrap: anywhere; }
.meter .who a { font-weight: 700; color: var(--ink); }
.meter .who .model { margin-left: 4px; }
.meter .who .how { display: block; color: var(--muted); font-size: 12px; }
.meter .bar { height: 10px; background: var(--track); border-radius: 999px; position: relative; }
.meter .bar i { position: absolute; inset: 0 auto 0 0; background: var(--green); border-radius: 999px; }
.meter .bar.api i { background: var(--api); }
.meter .yen { text-align: right; white-space: nowrap; font-family: var(--num); font-size: 22px; font-weight: 600; line-height: 1.1; }
.meter .yen small { font-family: var(--jp); font-size: 12px; font-weight: 400; color: var(--muted); margin-left: 2px; }
.meter li.first .rank { color: var(--red); }
.js .meter.collapsed li.extra { display: none; }
.more { display: none; margin: 10px 0 0; padding: 8px 18px; border: 1px solid var(--rule-strong); border-radius: var(--radius); background: var(--sheet); color: var(--green); font-weight: 700; font-size: 14px; cursor: pointer; }
.js .more { display: inline-block; }
.js .more[hidden], .meter li[hidden] { display: none; }
.more:hover { background: var(--band); }

/* ---------- tables ---------- */
.table-scroll { overflow-x: auto; margin: 12px 0; border: 1px solid var(--rule-strong); border-radius: var(--radius); background: var(--sheet); }
table { border-collapse: collapse; width: 100%; font-size: 14px; line-height: 1.6; }
th, td { text-align: left; vertical-align: top; padding: 12px 14px; border-bottom: 1px solid var(--rule); }
thead th { background: var(--sheet); font-size: 13px; font-weight: 700; color: var(--muted); white-space: nowrap; border-bottom: 1.5px solid var(--rule-strong); }
tbody tr:nth-child(even) { background: var(--band); }
tbody tr:last-child td, tbody tr:last-child th { border-bottom: 0; }
tbody th[scope="row"] { font-weight: 700; min-width: 8.5em; overflow-wrap: break-word; }
tbody th[scope="row"] a { color: var(--ink); }
td.num, th.num { text-align: right; white-space: nowrap; }
td.num { font-family: var(--num); font-size: 18px; font-weight: 600; line-height: 1.3; }
td.num .sub { font-family: var(--jp); }
td .sub, th .sub { display: block; color: var(--muted); font-size: 12px; font-weight: 400; }
.tag { display: inline-block; font-size: 12px; line-height: 1.6; padding: 0 7px; border: 1px solid var(--rule-strong); border-radius: 3px; color: var(--muted); background: var(--sheet); white-space: nowrap; }
.tag.ok { color: var(--green-deep); border-color: #8fc2a0; }
.tag.no { color: #8a1f1b; border-color: #e1aaa6; }
.kind { display: inline-block; font-size: 11px; line-height: 1.5; padding: 0 6px; border-radius: 3px; margin-right: 6px; font-weight: 700; }
.kind.plan { background: var(--green); color: #fff; }
.kind.api { background: var(--api); color: var(--ink); }
.new { background: var(--green-soft); color: var(--green-deep); padding: 1px 7px; border-radius: 3px; font-size: 12px; font-weight: 700; white-space: nowrap; margin-right: 6px; }

/* ---------- service / facts ---------- */
.page-head { margin: 0 0 8px; }
.page-head .chip { margin-bottom: 14px; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); margin: 28px 0; background: var(--sheet); border: 1px solid var(--rule-strong); border-radius: var(--radius); overflow: hidden; max-width: none; }
.facts div { padding: 16px 20px 18px; border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); margin-right: -1px; margin-bottom: -1px; }
.facts dt { font-size: 13px; color: var(--muted); }
.facts dd { margin: 6px 0 0; font-size: 20px; font-weight: 700; line-height: 1.35; }
.facts dd small { display: block; font-size: 12px; font-weight: 400; color: var(--muted); margin-top: 6px; }
.facts dd .fig { font-size: 30px; font-weight: 600; line-height: 1; }
.facts .key { background: var(--band); }
.facts .key dd .fig { font-size: 40px; font-weight: 700; }

.evidence { margin: 12px 0; padding: 0; list-style: none; }
.evidence li { background: var(--sheet); border: 1px solid var(--rule); border-left: 3px solid var(--rule-strong); padding: 10px 16px; margin: 0 0 10px; font-size: 14px; border-radius: 0 var(--radius) var(--radius) 0; }
.evidence q { quotes: "“" "”"; font-style: normal; }
.evidence .src { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.sources { padding-left: 1.2em; font-size: 14px; }
.sources li { margin-bottom: 4px; overflow-wrap: anywhere; }
.note { background: var(--sheet); border: 1px solid var(--rule); border-left: 4px solid var(--red); padding: 12px 18px; border-radius: var(--radius); font-size: 14px; max-width: var(--measure); }
.note ul { margin: 0; padding-left: 1.2em; }
.related { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; max-width: none; }

/* ---------- changes ---------- */
.changes { list-style: none; padding: 0; margin: 12px 0; max-width: none; border-top: 1px solid var(--rule-strong); }
.changes li { display: grid; grid-template-columns: 9em minmax(0, 1fr); gap: 4px 20px; padding: 12px 0; border-bottom: 1px solid var(--rule); font-size: 15px; line-height: 1.7; }
.changes time { color: var(--muted); font-size: 14px; }

/* ---------- rules (台帳の決まりごと) ---------- */
.rules { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; margin: 0; padding: 0; list-style: none; max-width: none; border-top: 1px solid var(--rule-strong); }
.rules li { padding: 18px 24px 8px 0; }
.rules li + li { padding-left: 24px; border-left: 1px solid var(--rule); }
.rules b { display: block; font-size: 17px; font-weight: 900; margin-bottom: 6px; }
.rules p { font-size: 14px; color: var(--muted); margin: 0; }

/* ---------- lists of links (比較一覧など) ---------- */
.cats { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); margin: 16px 0 0; padding: 0; list-style: none; max-width: none; background: var(--sheet); border: 1px solid var(--rule-strong); border-radius: var(--radius); overflow: hidden; }
.cats li { border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); margin-right: -1px; margin-bottom: -1px; }
.cats a { display: block; padding: 16px 20px; text-decoration: none; color: var(--ink); height: 100%; }
.cats a:hover { background: var(--band); }
.cats strong { display: block; font-size: 16px; font-weight: 700; }
.cats span { font-size: 13px; color: var(--muted); }

/* ---------- compare ---------- */
.versus { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: stretch; margin: 28px 0; background: var(--sheet); border: 1px solid var(--rule-strong); border-radius: var(--radius); max-width: none; }
.versus > div { padding: 18px 22px; }
.versus .vs { display: flex; align-items: center; padding: 0 4px; font-size: 13px; color: var(--muted); border-left: 1px solid var(--rule); border-right: 1px solid var(--rule); }
.versus h2 { margin: 0 0 8px; font-size: 18px; }
.versus .fig { font-size: 36px; font-weight: 600; line-height: 1.05; }
.versus small { display: block; font-size: 12px; color: var(--muted); }
.versus .win .fig { font-weight: 700; }

/* ---------- estimator ---------- */
.estimator { display: flex; flex-wrap: wrap; gap: 16px 32px; align-items: end; margin: 24px 0 10px; padding: 20px 24px; background: var(--sheet); border: 1px solid var(--rule-strong); border-radius: var(--radius); }
.estimator label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 700; color: var(--muted); }
.estimator select, .estimator input { font: inherit; font-size: 18px; color: var(--ink); padding: 8px 12px; border: 1.5px solid var(--rule-strong); border-radius: var(--radius); background: #fff; min-width: 11em; }
.estimator input { width: 6em; min-width: 0; font-family: var(--num); font-size: 26px; font-weight: 600; padding: 4px 12px; }
.estimator label:has(input) { flex-direction: row; align-items: center; gap: 10px; }
.estimator #est-suffix { font-size: 18px; color: var(--ink); }

.aff { margin: 0 0 20px; padding: 14px 18px; background: var(--sheet); border: 1px solid var(--rule-strong); border-radius: var(--radius); max-width: none; }
.aff a { font-weight: 700; }
.aff .pr { display: inline-block; font-size: 12px; padding: 0 6px; border: 1px solid var(--muted); border-radius: 3px; color: var(--muted); margin-right: 4px; }
.aff .sub { display: block; font-size: 12px; color: var(--muted); margin-top: 4px; }

.ad-slot { margin: 40px 0; min-height: 100px; }
.ad-slot:empty { display: none; }

/* ---------- footer ---------- */
footer { border-top: 1px solid var(--rule-strong); background: var(--sheet); font-size: 14px; color: var(--muted); }
footer .wrap { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 20px 56px; padding-top: 36px; padding-bottom: 40px; }
footer .brand b { font-size: 16px; }
footer ul { list-style: none; padding: 0; margin: 0 0 14px; display: flex; flex-wrap: wrap; gap: 6px 22px; }
footer ul a { color: var(--ink); }
footer p { margin: 0 0 8px; font-size: 13px; }
footer p.about { margin-top: 14px; max-width: 24em; }

.consent { position: fixed; left: 12px; right: 12px; bottom: 12px; max-width: 560px; margin: 0 auto; background: var(--sheet); border: 1px solid var(--ink); border-radius: var(--radius); padding: 14px 18px; font-size: 14px; z-index: 20; box-shadow: 0 10px 30px rgba(16, 35, 28, .2); }
.consent[hidden] { display: none; }
.consent .btns { display: flex; gap: 8px; margin-top: 10px; }
.consent button { font: inherit; padding: 6px 16px; border-radius: var(--radius); border: 1.5px solid var(--ink); background: var(--sheet); color: var(--ink); cursor: pointer; font-weight: 700; }
.consent button.yes { background: var(--ink); color: #fff; }

/* ---------- responsive ---------- */
@media (max-width: 1000px) {
  .masthead .wrap { flex-wrap: wrap; padding-top: 12px; padding-bottom: 0; }
  .nav { margin: 0 -24px; padding: 0 24px 8px; width: calc(100% + 48px); overflow-x: auto; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .hero { grid-template-columns: minmax(0, 1fr); }
  .book { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .book li + li { border-left: 0; }
  .book li { border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); margin-right: -1px; margin-bottom: -1px; }
  footer .wrap { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 720px) {
  .wrap { padding: 0 16px; }
  .nav { margin: 0 -16px; padding: 0 16px 8px; width: calc(100% + 32px); }
  main { padding-top: 20px; }
  h2 { font-size: 21px; }
  .sec-head { margin-top: 56px; }
  .book { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .book .low .fig { font-size: 26px; }
  .rules { grid-template-columns: minmax(0, 1fr); }
  .rules li + li { padding-left: 0; border-left: 0; border-top: 1px solid var(--rule); }
  .slip li { padding-left: 14px; padding-right: 14px; }
  .slip li.top .yen { font-size: 36px; }
  .meter li { grid-template-columns: 26px minmax(0, 1fr) auto; padding-left: 8px; padding-right: 12px; }
  .meter .bar { grid-column: 2 / -1; order: 3; }
  .changes li { grid-template-columns: 1fr; gap: 0; }
  .versus { grid-template-columns: minmax(0, 1fr); }
  .versus .vs { border: 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); padding: 4px 22px; }
  table.stack thead { display: none; }
  table.stack, table.stack tbody, table.stack tr, table.stack td, table.stack th { display: block; width: 100%; }
  table.stack tr { border-bottom: 1px solid var(--rule); padding: 10px 0; }
  table.stack td, table.stack th { border: 0; padding: 3px 14px; text-align: left; }
  table.stack td[data-label]::before { content: attr(data-label); display: block; font-family: var(--jp); font-size: 12px; font-weight: 400; color: var(--muted); }
  td.num { white-space: normal; }
  .estimator { padding: 16px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
@media print { .masthead .nav, .consent, .ad-slot, .filter, .more { display: none !important; } }
