/* Layout: 搭乗券風の「旅程チケット」で条件を決め、その下にカテゴリ別チェックリスト。1カラム・最大880px */
/* ライトテーマ固定：白地＋ネイビーで落ち着いた信頼感。黄色はPR表示だけに使う */
:root {
  color-scheme: light;
  --bg: #F6F8FA;
  --surface: #FFFFFF;
  --ink: #1B2733;
  --muted: #5E6B78;
  --line: #E1E6EB;
  --accent: #1F4E79;
  --accent-soft: #EAF1F8;
  --tag: #FFE8A3;
  --tag-ink: #5C4300;
  --warn: #A9561B;
  --warn-soft: #FDF4EC;
  --ok: #2B7A4B;
  --ok-soft: #E8F3EC;
  --r-chip: 4px;
  --r-ctrl: 8px;
  --r-card: 12px;
  --shadow-ticket: 0 1px 2px rgba(27, 39, 51, .04), 0 4px 16px rgba(27, 39, 51, .05);
  --font-display: "Noto Sans JP", "Hiragino Sans", "Yu Gothic", system-ui, sans-serif;
  --font-body: "Noto Sans JP", "Hiragino Sans", "Yu Gothic", system-ui, sans-serif;
  --font-mono: "Roboto Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
/* iOSの横向きで文字が勝手に拡大されないように */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  background: var(--bg); color: var(--ink);
  font-family: var(--font-body); font-size: 15px; line-height: 1.8;
  font-feature-settings: "palt" 1; letter-spacing: .02em;
  -webkit-font-smoothing: antialiased;
}
.wrap {
  max-width: 880px; margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 28px 56px;
  display: grid; gap: 28px;
}
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.pr {
  font-size: 12px; color: var(--muted);
  /* 狭い画面では本文がPRバッジの右で折り返す（バッジだけ1行に残らない） */
  display: flex; gap: 8px; align-items: baseline;
}
.pr b { flex: none; }
.pr b {
  font-size: 11px; font-weight: 700; letter-spacing: .06em;
  background: var(--tag); color: var(--tag-ink); padding: 1px 7px; border-radius: var(--r-chip);
}
header h1 {
  font-family: var(--font-display); font-weight: 900;
  font-size: clamp(30px, 6vw, 42px); line-height: 1.3; margin: 4px 0 6px;
  text-wrap: balance; letter-spacing: .04em;
}
header p { margin: 0; color: var(--muted); max-width: 40em; font-size: 16px; line-height: 1.7; }

/* 旅程チケット */
.ticket {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow-ticket);
  display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  position: relative; overflow: hidden;
}
.ticket::before {
  content: ""; position: absolute; top: 0; bottom: 0; left: 58.33%;
  border-left: 2px dashed var(--line);
}
.ticket-main, .ticket-stub { padding: 20px 22px; display: grid; gap: 14px; align-content: start; min-width: 0; }
.ticket-stub { position: relative; }
/* 切り取り線のノッチ：チケットは overflow:hidden なので半円に切れる */
.ticket-stub::before, .ticket-stub::after {
  content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%;
  background: var(--bg); border: 1px solid var(--line); z-index: 1; left: -10px;
}
.ticket-stub::before { top: -9px; }
.ticket-stub::after { bottom: -9px; }
.label {
  font-size: 12px; font-weight: 700; letter-spacing: .08em; color: var(--muted);
}
.field { display: grid; gap: 4px; }
select {
  font: inherit; font-size: 17px; font-weight: 700; color: var(--ink);
  appearance: none; -webkit-appearance: none; line-height: 1.3;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%235E6B78' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 12px center / 12px 8px;
  border: 1px solid var(--line); border-radius: var(--r-ctrl);
  padding: 10px 36px 10px 12px; width: 100%;
}
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label {
  border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px;
  font-size: 14px; cursor: pointer; user-select: none; background: var(--surface);
}
.seg input:checked + label { background: var(--accent); border-color: var(--accent); color: var(--surface); }
.seg input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 2px; }
/* スマホ・タッチ端末では指で押しやすい高さ（約44px）に */
@media (max-width: 640px), (pointer: coarse) {
  .seg { gap: 8px; }
  .seg label { padding: 9px 16px; }
}

.route { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.route .code { font-family: var(--font-mono); font-weight: 600; font-size: 28px; letter-spacing: .04em; }
.route .arrow { color: var(--muted); }
.plugs { display: flex; gap: 10px; flex-wrap: wrap; }
.plug { display: grid; justify-items: center; gap: 2px; }
.plug svg { width: 46px; height: 46px; }
.plug svg .pins { color: var(--ink); }
.plug span { font-size: 12px; font-weight: 500; }
.volt { font-family: var(--font-mono); font-size: 22px; font-weight: 600; }
.volt small { font-family: var(--font-body); font-size: 12px; color: var(--muted); font-weight: 500; margin-left: 6px; }
.stub-note { font-size: 13px; color: var(--muted); margin: 0; }

.ticket-main { grid-template-rows: auto auto auto 1fr; }
.progress { display: grid; gap: 6px; align-self: end; padding-top: 14px; border-top: 1px dashed var(--line); }
.bar { height: 10px; background: var(--line); border-radius: 99px; overflow: hidden; border: 0; }
.bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .3s; }
.progress-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.progress-row .actions { display: flex; gap: 16px; }
/* ボタンが4つあるので、入りきらない幅では折り返す。.btn-text は上下に当たり判定を広げているので、行間はその分あけて重ならないように */
.progress-row .actions { flex-wrap: wrap; row-gap: 12px; }
@media (max-width: 640px), (pointer: coarse) { .progress-row .actions { row-gap: 20px; } }
.count { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-weight: 600; font-size: 18px; color: var(--ink); }
.btn-text {
  font: inherit; font-size: 13px; color: var(--accent); font-weight: 600; background: none; border: none;
  text-decoration: none; cursor: pointer;
  padding: 6px 0; margin: -6px 0; /* 見た目はそのまま、当たり判定だけ上下に広げる（35px） */
}
#reset { color: var(--muted); }
@media (hover: hover) { .btn-text:hover { text-decoration: underline; } }
/* スマホ・タッチ端末はさらに広げる */
@media (max-width: 640px), (pointer: coarse) {
  .btn-text { padding: 10px 0; margin: -10px 0; }
}

/* 出発までの準備 */
/* チケットの下の折りたたみ（既定は閉じる）。見出しは読み上げ用の h2（.vh）、時期は h3。中身は app.js の renderPlan() */
.plan { position: relative; min-width: 0; }
.plan-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); }
.plan-box > summary {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px;
  cursor: pointer; list-style: none; border-radius: calc(var(--r-card) - 1px);
  font-size: 17px; font-weight: 700; line-height: 1.5;
}
.plan-box > summary::-webkit-details-marker { display: none; }
.plan-box > summary:focus-visible { outline-offset: -2px; }
.plan-box[open] > summary { border-radius: calc(var(--r-card) - 1px) calc(var(--r-card) - 1px) 0 0; }
@media (hover: hover) { .plan-box > summary:hover { background: var(--bg); } }
/* 開閉の向きを示す山形（開くと上向き） */
.plan-box > summary::after {
  content: ""; flex: none; margin-left: auto; margin-right: 4px; width: 8px; height: 8px;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: translateY(-2px) rotate(45deg);
}
.plan-box[open] > summary::after { transform: translateY(2px) rotate(-135deg); }
.plan-ic {
  width: 30px; height: 30px; border-radius: var(--r-ctrl); background: var(--accent-soft);
  color: var(--accent); display: grid; place-items: center; flex: none;
}
.plan-ic svg { width: 18px; height: 18px; }
.plan-title { min-width: 0; }
.plan-n { font-size: 13px; font-weight: 500; color: var(--muted); font-variant-numeric: tabular-nums; }
.plan-body { border-top: 1px solid var(--line); padding: 16px 16px 14px; }
/* 時期ごとのタイムライン：丸印と縦線、その右に箇条書き */
.plan-step { position: relative; padding: 0 0 14px 24px; }
.plan-step::after {
  content: ""; position: absolute; left: 0; top: 7px; width: 12px; height: 12px;
  border: 2px solid var(--accent); border-radius: 50%; background: var(--surface);
}
.plan-step::before { content: ""; position: absolute; left: 5px; top: 19px; bottom: -7px; border-left: 2px solid var(--line); }
.plan-step:last-of-type::before { display: none; }
.plan-step h3 { margin: 0; font-size: 14px; line-height: 1.8; color: var(--accent); }
.plan-step ul { margin: 2px 0 0; padding-left: 1.2em; font-size: 14px; line-height: 1.7; }
.plan-step li { overflow-wrap: anywhere; }
.plan-step li + li { margin-top: 4px; }
.plan-step li::marker { color: var(--muted); }
.plan-step .note { margin-top: 8px; }
.plan-foot { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
/* 広い画面：時期を左、箇条書きを右に並べ、間に縦線 */
@media (min-width: 641px) {
  .plan-body { padding: 18px 22px 16px; }
  .plan-step { display: grid; grid-template-columns: 116px minmax(0, 1fr); column-gap: 36px; padding-left: 0; }
  .plan-step::after { left: 128px; }
  .plan-step::before { left: 133px; }
  .plan-step h3 { text-align: right; }
  .plan-step ul, .plan-step .note { grid-column: 2; }
  .plan-step ul { margin-top: 0; }
  .plan-foot { padding-left: 152px; }
}
/* 印刷：開いているときだけ、白黒の短い一覧として出す（閉じていれば何も出さない） */
@media print {
  .plan:has(> .plan-box:not([open])) { display: none; }
  .plan-box { border-color: #999999; break-inside: avoid; }
  .plan-box > summary { padding: 4px 8px; font-size: 11pt; }
  .plan-box > summary::after, .plan-ic { display: none; }
  .plan-body { padding: 4px 8px 6px; border-color: #CCCCCC; }
  .plan-step { padding-bottom: 4px; }
  .plan-step h3 { color: #000000; font-size: 9.5pt; line-height: 1.5; }
  .plan-step ul { font-size: 8.5pt; line-height: 1.5; }
  .plan-step li + li { margin-top: 0; }
  .plan-step::after { border-color: #000000; top: 4px; }
  .plan-step::before { border-color: #CCCCCC; top: 16px; bottom: -4px; }
  .plan-foot { font-size: 8pt; }
}

/* カテゴリ */
nav.cats {
  display: flex; gap: 6px; overflow-x: auto;
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5;
  background: var(--bg); padding-top: 8px; margin-top: -8px;
  border-bottom: 1px solid var(--line); padding-bottom: 8px;
}
nav.cats a {
  white-space: nowrap; text-decoration: none; color: var(--ink);
  border: 1px solid var(--line); background: var(--surface);
  border-radius: 999px; padding: 4px 12px; font-size: 13px;
}
nav.cats a .n { font-variant-numeric: tabular-nums; color: var(--muted); margin-left: 4px; font-size: 11px; font-weight: 500; }
nav.cats { overscroll-behavior-x: contain; }
@media (hover: hover) { nav.cats a:hover { border-color: var(--accent); color: var(--accent); } }
/* 広い画面：折り返して全部見せる（2行ぶんの高さに合わせて見出しの止まる位置を下げる） */
@media (min-width: 641px) {
  nav.cats { flex-wrap: wrap; overflow: visible; gap: 8px; }
}
@media (max-width: 640px), (pointer: coarse) {
  nav.cats a { padding: 10px 14px; }
}
/* スマホではナビの横スクロール領域を画面の端まで広げ、続きがあることを見せる */
@media (max-width: 640px) {
  nav.cats {
    margin-left: calc(-1 * max(16px, env(safe-area-inset-left, 0px)));
    margin-right: calc(-1 * max(16px, env(safe-area-inset-right, 0px)));
    padding-left: max(16px, env(safe-area-inset-left, 0px));
    padding-right: max(16px, env(safe-area-inset-right, 0px));
    scroll-padding-inline: max(16px, env(safe-area-inset-left, 0px));
  }
}
body::before {
  content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px);
  z-index: 10; background: var(--bg);
}

/* スティッキーなカテゴリナビ（スマホで約56px）＋ノッチの高さぶん、見出しを下げて止める */
#list { display: grid; gap: 28px; }
/* 広い画面ではカテゴリの間を少し広く。自分で追加した持ち物（#list の外）も同じ間隔に（main の gap 28px＋4px） */
@media (min-width: 641px) { #list { gap: 32px; } #cat-custom { margin-top: 4px; } }
/* app.js が描くまでリストの場所を画面の高さぶん確保し、下の Wh計算・FAQ・フッターが後から押し下げられる（CLS）のを画面の外で済ませる */
#list:empty { min-height: 100vh; }
section.cat { display: grid; gap: 10px; scroll-margin-top: calc(68px + env(safe-area-inset-top, 0px)); }
/* 見出しはカテゴリ・Wh計算・FAQ の3か所とも同じ作法（アイコンタイル＋19px） */
.sec-h { margin: 0; font-size: 19px; line-height: 1.5; display: flex; align-items: center; gap: 10px; text-wrap: balance; }
.sec-h .ic {
  width: 30px; height: 30px; border-radius: var(--r-ctrl); background: var(--accent-soft);
  color: var(--accent); display: grid; place-items: center; flex: none;
}
.sec-h .ic svg { width: 18px; height: 18px; }
.sec-h .sub { font-variant-numeric: tabular-nums; font-size: 12px; color: var(--muted); font-weight: 500; margin-left: auto; }

.items { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); overflow: hidden; }
.item.done { background: var(--bg); }
.item { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 12px; padding: 14px 16px; position: relative; }
.item + .item { border-top: 1px solid var(--line); }
.item input[type=checkbox] { width: 20px; height: 20px; margin: 3px 0 0; accent-color: var(--accent); cursor: pointer; }
.item-body { min-width: 0; display: grid; gap: 4px; }
.item-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px; }
/* 長い項目名は語の切れ目で折り返す（対応ブラウザのみ） */
.item-name { font-weight: 700; font-size: 16px; cursor: pointer; line-height: 1.6; word-break: auto-phrase; }
/* タッチ端末：チェックボックス周り（左上の約48×56px）をラベルの当たり判定にする */
@media (max-width: 640px), (pointer: coarse) {
  .item label.item-name::before {
    content: ""; position: absolute; left: 0; top: 0;
    width: calc(16px + 26px + 6px); height: 56px;
  }
}
.item.done .item-name { text-decoration: line-through; text-decoration-color: var(--muted); color: var(--muted); }
/* Safari・Firefox 用：app.js の phrase() が語ごとに包む。語の途中では折らず、1語が行より長いときだけ中で折る */
.ph { display: inline-block; max-width: 100%; }
.item.done .item-name .ph { text-decoration: inherit; text-decoration-color: inherit; }
.chip {
  font-size: 11px; font-weight: 700; padding: 0 7px; border-radius: var(--r-chip); line-height: 1.8;
  background: var(--accent-soft); color: var(--accent);
}
.chip.must { background: var(--tag); color: var(--tag-ink); }
.item-desc { margin: 0; font-size: 14px; color: var(--muted); }
.note {
  margin: 4px 0 0; font-size: 13px; line-height: 1.7;
  background: var(--warn-soft); color: var(--ink); border-left: 3px solid var(--warn);
  padding: 6px 10px; border-radius: 0 var(--r-ctrl) var(--r-ctrl) 0;
}
.note strong { color: var(--warn); }
.buy {
  justify-self: start; margin-top: 4px; font-size: 13px; font-weight: 700;
  text-decoration: none; color: var(--accent); border: 1px solid var(--accent);
  border-radius: var(--r-ctrl); padding: 2px 10px;
}
@media (hover: hover) { .buy:hover { background: var(--accent); color: var(--surface); } }

.custom-form { display: flex; gap: 8px; }
.custom-form input {
  flex: 1 1 auto; min-width: 0; font: inherit; font-size: 16px; color: var(--ink); /* 16px未満だと iOS が拡大する */
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-ctrl); padding: 9px 12px; line-height: 1.5;
}
.custom-form button {
  flex: none; font: inherit; font-size: 14px; font-weight: 700; color: var(--accent); cursor: pointer;
  background: var(--surface); border: 1px solid var(--accent); border-radius: var(--r-ctrl); padding: 0 14px; min-height: 44px;
}
@media (hover: hover) { .custom-form button:hover { background: var(--accent); color: var(--surface); } }
.custom-msg { margin: 0; font-size: 13px; line-height: 1.7; color: var(--warn); }
.custom-msg:empty { display: none; }
nav.cats a .n:empty { display: none; } /* 0件のピルに margin-left の空白を残さない */
.custom-hint { margin: 0; font-size: 13px; color: var(--muted); }
.custom .item { grid-template-columns: 26px minmax(0, 1fr) auto; }
.custom .item-name { overflow-wrap: anywhere; } /* phrase() を通さないので .ph の折り返し保険がない */
.del {
  width: 32px; height: 32px; margin: -3px -6px -3px 0; align-self: start; padding: 0; cursor: pointer;
  background: none; border: 0; border-radius: var(--r-ctrl); color: var(--muted); display: grid; place-items: center;
}
.del svg { width: 18px; height: 18px; }
@media (hover: hover) { .del:hover { background: var(--accent-soft); color: var(--accent); } }
@media (max-width: 640px), (pointer: coarse) { .del { width: 44px; height: 44px; margin: -9px -12px -9px 0; } }

.pv {
  margin-top: 6px; display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 14px; align-items: start;
  background: var(--bg); border: 0; border-radius: var(--r-ctrl); padding: 10px 12px;
}
.pv-art {
  width: 84px; height: 84px; border-radius: var(--r-ctrl); background: var(--surface);
  border: 0; margin-top: 2px; display: grid; place-items: center;
}
.pv-art svg { width: 60px; height: 60px; fill: none; stroke: var(--accent); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.pv-art svg .f { fill: var(--accent-soft); }
.pv-art svg .s { fill: var(--tag); }
.pv-art svg .d { fill: var(--accent); stroke: none; }
.pv-art svg .x { stroke: var(--warn); }
.pv-body { display: grid; gap: 6px; min-width: 0; }
.pv-title { font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: .08em; }
/* 選び方のポイントは箇条書き（ピルは押せるものだけに使う）。ドットは CSS の図形で描く */
.pv-points { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 2px 16px; }
.pv-points li {
  position: relative; padding: 0 0 0 12px; border: 0; background: none; border-radius: 0;
  font-size: 13px; line-height: 1.7; word-break: auto-phrase;
  max-width: 100%; overflow-wrap: anywhere;
}
.pv-points li::before { content: ""; position: absolute; left: 0; top: .72em; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.buys { display: flex; flex-wrap: wrap; gap: 6px 8px; margin-top: 6px; }
.buys .buy { margin-top: 0; }
/* おすすめ商品のカード（商品名・仕様・ボタン）。画像は出さない */
.picks-title { flex-basis: 100%; margin-top: 10px; }
.pick {
  display: grid; gap: 4px; align-content: start; flex: 1 1 220px; max-width: 340px; min-width: 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-ctrl); padding: 10px 12px;
}
.pick-name { margin: 0; font-size: 14px; font-weight: 700; line-height: 1.5; }
.pick-spec { margin: 0; font-size: 13px; line-height: 1.6; color: var(--muted); }
.pick .buy { justify-self: start; margin-top: 6px; }
.pv .buy { padding: 4px 14px; }
/* 塗りつぶしは厳選した商品の「Amazonで見る」だけ。検索リンクはアウトラインのまま */
.pv .pick .buy { background: var(--accent); color: #FFFFFF; border-color: var(--accent); }
@media (hover: hover) { .pv .pick .buy:hover { background: var(--ink); border-color: var(--ink); } }
@media (max-width: 640px), (pointer: coarse) {
  .buy, .pv .buy { padding-top: 10px; padding-bottom: 10px; }
}
/* 狭い画面：図は左上に小さく、その右に見出し。ポイントとボタンは下に横幅いっぱい */
@media (max-width: 480px) {
  .pv { grid-template-columns: 56px minmax(0, 1fr); gap: 8px 12px; align-items: center; padding: 12px; }
  .pv-art { margin-top: 0; }
  .pv-body { display: contents; }
  .pv-body > * { grid-column: 2; }
  .pv .pv-points { grid-column: 1 / -1; }
  .pv-art { width: 56px; height: 56px; }
  .pv-art svg { width: 42px; height: 42px; }
  .pv .buys { grid-column: 1 / -1; display: grid; gap: 6px; }
  .pick { max-width: none; }
  .pv .buy { justify-self: stretch; text-align: center; }
}

/* Wh 計算 */
.tool {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card);
  padding: 18px 20px; display: grid; gap: 12px;
}
/* 見出しはカードの外。#wh（ナビ・FAQ からの飛び先）はこの外側のかたまり */
.tool-sec { display: grid; gap: 10px; margin-top: 12px; scroll-margin-top: calc(68px + env(safe-area-inset-top, 0px)); }
.sec-h { word-break: auto-phrase; }
.tool-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; }
.tool input[type=number] {
  font: inherit; font-family: var(--font-mono); font-size: 18px; color: var(--ink);
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-ctrl);
  padding: 6px 10px; width: 9em;
}
.wh-out { display: flex; flex-wrap: wrap; align-items: baseline; gap: 12px; margin-top: 4px; }
.wh-num { font-family: var(--font-mono); font-size: 30px; font-weight: 600; font-variant-numeric: tabular-nums; }
.verdict { font-size: 14px; font-weight: 700; padding: 2px 10px; border-radius: var(--r-chip); }
.verdict.ok { background: var(--ok-soft); color: var(--ok); }
.verdict.warn { background: var(--warn-soft); color: var(--warn); }
.formula { font-size: 13px; color: var(--muted); margin: 0; }
/* 狭い画面：入力欄2つを縦積みにせず横に並べる */
@media (max-width: 480px) {
  .tool { padding: 16px; }
  .tool-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tool input[type=number] { width: 100%; }
}

/* よくある質問 */
/* カテゴリと同じく、見出しの下に白いカード。<details> で開閉（JSなし） */
.faq { display: grid; gap: 10px; margin-top: 12px; scroll-margin-top: calc(68px + env(safe-area-inset-top, 0px)); }
.faq-list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); }
.faq details + details { border-top: 1px solid var(--line); }
.faq summary {
  display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 10px 16px;
  font-weight: 700; font-size: 15px; line-height: 1.6; cursor: pointer;
  list-style: none; word-break: auto-phrase; text-wrap: balance;
}
.faq summary::-webkit-details-marker { display: none; }
/* 右端の開閉マーク（閉じているとき下向き、開くと上向き） */
.faq summary::after {
  content: ""; flex: none; margin-left: auto; width: 8px; height: 8px;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: translateY(-2px) rotate(45deg);
}
.faq details[open] > summary::after { transform: translateY(2px) rotate(-135deg); }
@media (hover: hover) { .faq summary:hover { color: var(--accent); } }
/* カードの角丸の内側にフォーカスの枠を描く */
.faq summary:focus-visible { outline-offset: -2px; border-radius: 10px; }
.faq-a { padding: 0 16px 14px; }
.faq-a p { margin: 0; font-size: 14px; line-height: 1.8; line-break: strict; } /* 小さい「ィ」などを行頭に置かない */
.faq-a p + p { margin-top: 6px; }
.faq-note { margin: 0; font-size: 12px; color: var(--muted); }
/* 追従するカテゴリナビの下にフォーカスが隠れないように（#list a などと同じ） */
.faq summary, .faq a { scroll-margin-top: 64px; }
@media print { .faq { display: none; } }

footer > p { font-size: 13px; }
footer { font-size: 12px; color: var(--muted); display: grid; gap: 6px; border-top: 1px solid var(--line); padding-top: 16px; }
footer p { margin: 0; }
.trust {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 12px 20px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); padding: 14px 16px;
  margin-bottom: 6px;
}
.trust p { color: var(--ink); font-size: 13px; }

/* タブレット幅（641〜760px）：右の半券を少し広げて、プラグ4種類（タイ等）が1行に収まるように */
@media (min-width: 641px) and (max-width: 760px) {
  .ticket { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); }
  .ticket::before { left: 54.55%; } /* 1.2 / 2.2 */
  .ticket-main, .ticket-stub { padding-inline: 18px; }
  .plugs { gap: 8px; }
}
@media (max-width: 640px) {
  .ticket { grid-template-columns: minmax(0, 1fr); }
  .ticket::before { display: none; }
  .ticket-stub { border-top: 2px dashed var(--line); }
  /* 破線は半券の上辺の border。ノッチは border の中心（padding box の外へ10px）に置き、左右の端に半円で出す */
  .ticket-stub::before { left: -9px; top: -11px; }
  .ticket-stub::after { left: auto; right: -9px; top: -11px; bottom: auto; }
}
@media (max-width: 480px) {
  .ticket-main, .ticket-stub { padding: 18px 16px; }
}
@media (prefers-reduced-motion: reduce) { .bar i { transition: none; } }

/* ---- a11y ---- */
/* 既存ルールは書き換えず、ここで上書き・追加する */
:root {
  --line-strong: #808C99; /* 白地で3.4:1・--bgで3.2:1（操作部品の境界線 WCAG 1.4.11） */
}
/* 画面には出さず、スクリーンリーダーだけが読むテキスト */
.vh {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}
/* スキップリンク：Tabで最初にフォーカスしたときだけ表示 */
.skip-link {
  position: absolute; top: 8px; left: 8px; z-index: 20;
  padding: 8px 14px; border-radius: var(--r-ctrl); background: var(--accent); color: var(--surface);
  font-size: 14px; font-weight: 700; text-decoration: none;
  transform: translateY(calc(-100% - 16px));
}
.skip-link:focus { transform: none; }
/* <main> を足しても .wrap の縦並び・間隔はそのまま */
main { display: grid; gap: inherit; min-width: 0; }
#list { scroll-margin-top: 64px; }
/* 追従するカテゴリナビの下にフォーカスが隠れないように */
#list a, #list input, .tool input, .tool a, .custom input, .custom button { scroll-margin-top: 64px; }
@media (min-width: 641px) {
  section.cat, .tool-sec, .faq { scroll-margin-top: calc(96px + env(safe-area-inset-top, 0px)); }
  #list { scroll-margin-top: 96px; }
  #list a, #list input, .tool input, .tool a, .custom input, .custom button, .faq summary, .faq a { scroll-margin-top: 96px; }
}
/* タッチ端末はナビのピルが大きく（padding 10px）、2行で約116pxになる */
@media (min-width: 641px) and (pointer: coarse) {
  section.cat, .tool-sec, .faq { scroll-margin-top: calc(120px + env(safe-area-inset-top, 0px)); }
  #list { scroll-margin-top: 120px; }
  #list a, #list input, .tool input, .tool a, .custom input, .custom button, .faq summary, .faq a { scroll-margin-top: 120px; }
}
/* カテゴリナビは横スクロール領域で外側のリングが欠けるので、内側に描く */
nav.cats a:focus-visible { outline-offset: -2px; }
/* 未選択のスマホ・条件ボタン、行き先の選択、Wh計算の入力欄の境界線を見分けられる濃さに */
.seg label, select, .tool input[type=number], .custom-form input { border-color: var(--line-strong); }
/* プラグ図は隣の「タイプA」の文字と同じ内容なので読み上げない（ラッパーで下の隙間が出ないように） */
.plug-fig { display: grid; }
/* Windowsのハイコントラスト等：背景色が消えても選択状態と進捗が分かるように */
@media (forced-colors: active) {
  .seg input:checked + label { forced-color-adjust: none; background: Highlight; color: HighlightText; border-color: Highlight; }
  .bar i { forced-color-adjust: none; background: Highlight; }
  .pv-points li::before { forced-color-adjust: none; background: CanvasText; }
  .bar { border: 1px solid CanvasText; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important; animation-iteration-count: 1 !important;
    transition-duration: .01ms !important; scroll-behavior: auto !important;
  }
}

/* ---- 印刷 ---- */
/* 紙のチェックリストとして：条件・電源の情報・持ち物を白黒で。商品の紹介・ナビ・操作ボタン・Wh計算は出さない */
@media print {
  @page { margin: 12mm; }
  body { background: #FFFFFF; color: #000000; font-size: 9.5pt; line-height: 1.5; }
  header h1 { font-size: 18pt; margin: 2px 0 4px; }
  body::before, .skip-link, nav.cats, .progress, .pv, .tool-sec, header > p, .sec-h .ic, .ticket-stub::before, .ticket-stub::after { display: none !important; }
  .wrap { max-width: none; padding: 0; gap: 14px; }
  .ticket { box-shadow: none; border-color: #999999; break-inside: avoid; }
  .seg input:not(:checked) + label { display: none; }
  .seg input:checked + label { background: none; color: #000000; border-color: #000000; }
  select { appearance: none; background: none; border-color: #999999; }
  .items { border-color: #999999; }
  .item { padding: 4px 8px; gap: 8px; break-inside: avoid; }
  .item-name { font-size: 10pt; }
  .item-desc, .note { font-size: 8.5pt; line-height: 1.5; }
  .note { margin-top: 2px; padding: 2px 8px; }
  section.cat { gap: 4px; }
  section.cat h2 { font-size: 11pt; }
  .item + .item { border-color: #CCCCCC; }
  .item-desc { color: #333333; }
  .chip.must { background: none; color: #000000; border: 1px solid #000000; }
  .note { background: none; border-left-color: #000000; }
  .note strong { color: #000000; }
  section.cat h2 { break-after: avoid; }
  .custom-form, .custom-hint, .custom-msg, .del { display: none !important; }
  #cat-custom.is-empty { display: none; }
  a { color: inherit; }
  footer { border-color: #999999; }
  .trust { border-color: #999999; }
}
