:root {
  --bg: #f3f4f6;
  --card: #ffffff;
  --ink: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --accent: #2563eb;
  --accent-soft: #dbeafe;
  --star: #f59e0b;
  --star-off: #d1d5db;
  --win: #ecfdf5;
  --win-ink: #047857;
  --warn: #b45309;
  --bar: #1f2937;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --card: #1a1d23;
    --ink: #e5e7eb;
    --muted: #9ca3af;
    --line: #2a2f38;
    --accent: #60a5fa;
    --accent-soft: #1e293b;
    --star-off: #3f4651;
    --win: #0f2a22;
    --win-ink: #6ee7b7;
    --warn: #fbbf24;
    --bar: #111318;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Hiragino Sans", "Noto Sans JP", sans-serif;
  font-size: 16px;
  line-height: 1.6;
  /* 下のタブバー分の余白 */
  padding-bottom: calc(64px + env(safe-area-inset-bottom));
}
a { color: var(--accent); }
[hidden] { display: none !important; }

/* ---------- 上部（タイトル） ---------- */
.sticky-top { position: sticky; top: 0; z-index: 10; }
/* カテゴリボタン（「総合点に反映する項目」パネルの中） */
.catbar { margin-top: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.cat-btns { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 6px; }
.cat-btn {
  min-height: 44px; padding: 6px 4px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--bg); color: var(--ink);
  font: inherit; font-size: 15px; font-weight: 700; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.cat-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.cat-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.cat-status {
  display: flex; align-items: center; gap: 8px; justify-content: center;
  font-size: 12px; color: var(--muted); margin-top: 5px;
}
.cat-status .mode {
  font-weight: 700; color: var(--accent); padding: 0 8px; border-radius: 999px;
  border: 1px solid var(--accent);
}
.cat-status .mode.custom { background: var(--warn); border-color: var(--warn); color: #fff; }
.items-title .mode-name { color: var(--accent); }
.items-title .mode-name.custom { color: var(--warn); }
.topbar {
  background: var(--bar); color: #fff;
  padding: 12px 16px;
  padding-top: calc(12px + env(safe-area-inset-top));
}
.topbar .brand { color: #fff; text-decoration: none; font-weight: 700; font-size: 17px; display: inline-flex; align-items: center; gap: 8px; }
.brand-icon { width: 32px; height: 32px; flex: none; color: #fff; fill: #fff; --bg: var(--bar); }
.brand-icon .cut { fill: var(--bar); }
.brand-icon .cut-line { stroke: var(--bar); }
.brand-text { display: flex; align-items: baseline; flex-wrap: wrap; gap: 0 8px; line-height: 1.25; }
.brand-text small { font-size: 11px; font-weight: 400; color: #cbd5e1; }

main { max-width: 560px; margin: 0 auto; padding: 16px; }
.loading, .error { color: var(--muted); text-align: center; padding: 32px 0; }

h1 { font-size: 20px; margin: 4px 0 12px; }
h2 { font-size: 16px; margin: 0 0 8px; }
small { display: block; font-size: 11px; color: var(--muted); font-weight: 400; }

.card {
  display: block;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 12px;
  color: inherit;
  text-decoration: none;
}
a.card:active { transform: scale(.99); }
.maker { color: var(--muted); font-size: 13px; }
.name { font-size: 17px; font-weight: 700; margin: 2px 0 6px; }
.meta { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; font-size: 14px; margin: 0; }
.meta dt { color: var(--muted); }
.meta dd { margin: 0; }
.overall { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-top: 8px; }
.score { font-weight: 700; font-variant-numeric: tabular-nums; }
.score.big { font-size: 22px; }
.note { color: var(--muted); font-size: 12px; margin: 8px 0 0; }
.note.warn { color: var(--warn); }
.badge {
  display: inline-block; padding: 1px 10px; border-radius: 999px;
  background: var(--bg); border: 1px solid var(--line);
  color: var(--muted); font-size: 13px; font-weight: 700;
}

/* ---------- 一覧 ---------- */
.card.tire { display: grid; grid-template-columns: 2.2em 1fr; gap: 10px; }
.rank {
  font-size: 22px; font-weight: 800; color: var(--accent);
  text-align: center; line-height: 1.2; padding-top: 14px;
  font-variant-numeric: tabular-nums;
}
.card.unrated .rank { color: var(--muted); }
.card.unrated .name, .card.unrated .meta { opacity: .75; }

/* 一覧の並び順 */
.sort-btns { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: -4px 0 8px; }
.sort-btn {
  min-height: 44px; padding: 6px 4px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink); font: inherit; font-size: 14px; font-weight: 700; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.sort-btn.active { background: var(--ink); border-color: var(--ink); color: var(--card); }
.sort-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.meta dd.sorted { font-weight: 700; color: var(--accent); }

/* ---------- 星（小数は部分的に塗る） ---------- */
.stars {
  position: relative; display: inline-block;
  font-size: 18px; line-height: 1; letter-spacing: 2px;
  color: var(--star-off); white-space: nowrap;
}
.stars::before { content: "★★★★★"; }
.stars .fill { position: absolute; inset: 0 auto 0 0; overflow: hidden; color: var(--star); }
.stars .fill::before { content: "★★★★★"; }

/* ---------- 折りたたみパネル（絞り込み・重み 共通） ---------- */
.panel { padding: 0; overflow: hidden; margin-bottom: 8px; }
.panel summary {
  display: flex; align-items: center; gap: 10px;
  min-height: 56px; padding: 8px 16px;
  cursor: pointer; list-style: none; user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.panel summary::-webkit-details-marker { display: none; }
.panel summary:active { background: var(--bg); }
.panel summary:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.panel-title { flex: 1; font-weight: 700; font-size: 16px; line-height: 1.3; }
.panel-title small { margin-top: 2px; }
/* 見出しの頭の小さな絵。形は SVG で描き、色は --accent で塗る（どのスマホでも同じ見た目になる） */
.items-title::before, .filter-title::before {
  content: ""; display: inline-block; width: 18px; height: 18px;
  margin-right: 6px; vertical-align: -3px; background: var(--accent);
  -webkit-mask: var(--icon) center / contain no-repeat; mask: var(--icon) center / contain no-repeat;
}
/* 絞り込み: じょうご（漏斗） */
.filter-title::before {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3.5 4.5h17a1 1 0 0 1 .78 1.63L14.5 14.6V20a1 1 0 0 1-.55.9l-3 1.5A1 1 0 0 1 9.5 21.5v-6.9L2.72 6.13A1 1 0 0 1 3.5 4.5z'/%3E%3C/svg%3E");
}
/* 総合点に反映する項目: スライダー（つまみの付いた横線3本） */
.items-title::before {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cg stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='M3 6h18M3 12h18M3 18h18'/%3E%3C/g%3E%3Ccircle cx='8' cy='6' r='3'/%3E%3Ccircle cx='16' cy='12' r='3'/%3E%3Ccircle cx='10' cy='18' r='3'/%3E%3C/svg%3E");
}
/* 開閉の矢印 */
.panel summary::after {
  content: ""; width: 10px; height: 10px; flex: none;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: rotate(45deg); margin: -4px 4px 0 0; transition: transform .15s;
}
.panel[open] summary::after { transform: rotate(-135deg); margin-top: 4px; }
.panel[open] summary { border-bottom: 1px solid var(--line); }
/* 閉じていても分かる「重み調整中」「絞り込み中」 */
.panel-state {
  flex: none; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px;
  background: var(--accent); color: #fff;
}
.panel > :not(summary) { margin-left: 16px; margin-right: 16px; }
.panel > .note:first-of-type { margin-top: 12px; }
.panel > .btn { margin: 12px 16px 16px; width: calc(100% - 32px); min-height: 48px; }
.btn:disabled { opacity: .4; cursor: default; }

/* 絞り込み */
.filter-row { padding: 8px 0; border-bottom: 1px solid var(--line); }
.filter-row label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.filter-row select { min-height: 48px; font-size: 16px; }
.filter-banner {
  display: flex; align-items: center; gap: 12px;
  background: var(--accent-soft); border: 1px solid var(--accent);
  border-radius: 12px; padding: 10px 12px; margin-bottom: 12px;
}
.filter-banner .banner-body { flex: 1; min-width: 0; }
.filter-banner strong { color: var(--accent); font-size: 14px; }
.filter-banner .note { margin: 2px 0 0; }
.conds { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px; }
.conds li { font-size: 13px; background: var(--card); border-radius: 6px; padding: 1px 8px; }
.conds li span { color: var(--muted); font-size: 11px; margin-right: 4px; }
.btn.small { width: auto; flex: none; margin: 0; min-height: 44px; min-width: 64px; padding: 8px 14px; }

/* 総合点に反映する項目 */
.bulk { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.bulk .btn { margin: 0; min-height: 44px; padding: 8px; font-size: 15px; }
.item-rows { margin-top: 8px; }
.item-row {
  display: grid; grid-template-columns: 1fr auto;
  align-items: center; gap: 0 8px;
  border-bottom: 1px solid var(--line);
}
.item-row .check {
  display: flex; align-items: center; gap: 10px;
  min-height: 48px; font-size: 15px; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.item-row .check input { width: 22px; height: 22px; margin: 0; accent-color: var(--accent); flex: none; }
.weight-val { font-size: 13px; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.weight-val b { color: var(--ink); font-size: 15px; }
.item-row .slider { grid-column: 1 / -1; margin-top: -6px; padding: 0 0 4px 32px; }
.item-row.unchecked .check span { color: var(--muted); }
.item-row .check { padding: 6px 0; }
.item-row .check .desc { margin-top: 1px; line-height: 1.45; font-size: 12px; }
.item-row .check input { align-self: flex-start; margin-top: 2px; }
.item-help { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 4px; }
.item-help summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; font-size: 14px; font-weight: 700; color: var(--accent); }
.item-help dl { margin: 0 0 4px; display: grid; gap: 2px 0; font-size: 13px; }
.item-help dt { font-weight: 700; margin-top: 6px; }
.item-help dd { margin: 0; color: var(--muted); }
.item-help dt.sub, .item-help dd.sub { padding-left: 1em; }
.item-help dt.sub { font-weight: 400; margin-top: 2px; }

/* 縦横の内訳 */
/* 内訳（総合点には直接使わない）: 少し小さく、ただし値ははっきり読める濃さ */
.rating-row.sub, .rating-row.child { padding: 4px 0 4px 0.8em; border-bottom-style: dashed; }
.rating-row.sub .label, .rating-row.child .label { font-size: 13px; }
.rating-row.sub .bar { height: 6px; }
.rating-row.sub .bar > span { background: var(--accent); opacity: .55; }
.rating-row.sub .num { font-size: 14px; }
.compare tr.sub th[scope="row"], .compare tr.child th[scope="row"] { padding-left: 1em; font-size: 12px; }
.compare tr.sub td { font-size: 13px; padding-top: 5px; padding-bottom: 5px; }
.compare tr.sub td small { display: block; font-size: 10px; }
.mini .parts { font-size: 11px; }

/* 一覧カードのグリップ */
.grip-lines { list-style: none; margin: 6px 0 0; padding: 6px 0 0; border-top: 1px dashed var(--line); display: grid; gap: 2px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.grip-lines li { display: flex; flex-wrap: wrap; gap: 2px 10px; }
.grip-lines .parts { display: inline-flex; gap: 8px; }
.grip-lines .used { color: var(--ink); font-weight: 700; }

/* 縦横を別々に計算する切り替え */
.item-group { border-bottom: 1px solid var(--line); }
.item-group .item-row:last-child { border-bottom: 0; }
.group-head { font-weight: 700; font-size: 15px; padding-top: 10px; }
.split-toggle {
  display: flex; align-items: flex-start; gap: 10px; padding: 8px 0 10px 32px; cursor: pointer;
  font-size: 14px; font-weight: 700; color: var(--accent); -webkit-tap-highlight-color: transparent;
}
.split-toggle input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--accent); flex: none; }
.split-toggle small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; line-height: 1.45; margin-top: 1px; }
.item-row.child { padding-left: 20px; border-bottom: 1px dashed var(--line); }
.tag.mode { font-weight: 400; color: var(--muted); }
.item-row.off .weight-val b { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* スライダー本体: 指で触りやすいよう、つまみ28px・タッチ領域40px */
.item-row input[type=range] {
  width: 100%; height: 40px; margin: 0; display: block;
  -webkit-appearance: none; appearance: none; background: transparent; cursor: pointer;
  touch-action: pan-y; /* 縦スクロールは邪魔しない */
}
.item-row input[type=range]::-webkit-slider-runnable-track {
  height: 6px; border-radius: 3px; background: var(--star-off);
}
.item-row input[type=range]::-moz-range-track { height: 6px; border-radius: 3px; background: var(--star-off); }
.item-row input[type=range]::-moz-range-progress { height: 6px; border-radius: 3px; background: var(--accent); }
.item-row input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 28px; height: 28px; margin-top: -11px; border-radius: 50%;
  background: var(--card); border: 3px solid var(--accent); box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
.item-row input[type=range]::-moz-range-thumb {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--card); border: 3px solid var(--accent); box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
.item-row input[type=range]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.item-row.off input[type=range]::-webkit-slider-thumb { border-color: var(--muted); }
.item-row.off input[type=range]::-moz-range-thumb { border-color: var(--muted); }
.compare .na { font-size: 12px; color: var(--muted); }
.compare .dot { color: var(--accent); font-size: 10px; margin-right: 3px; vertical-align: 1px; }

/* 計算に使っている項目（一覧・比較） */
.used-items {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  margin-bottom: 12px; font-size: 14px;
}
.used-items summary { padding: 10px 14px; cursor: pointer; min-height: 44px; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.used-items summary b { color: var(--accent); }
.used-items .used-chips, .used-items .note { margin-left: 14px; margin-right: 14px; }
.used-items .note { margin-bottom: 12px; }
.used-chips { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.used-chips li {
  font-size: 13px; padding: 2px 10px; border-radius: 999px;
  border: 1px dashed var(--line); color: var(--muted);
}
.used-chips li.on { border: 1px solid var(--accent); background: var(--accent-soft); color: var(--ink); font-weight: 700; }
.used-chips li b { margin-left: 3px; color: var(--accent); }

/* 詳細: カテゴリ見出しごとの評価 */
.rating-group + .rating-group { margin-top: 12px; }
.rating-group h3 {
  font-size: 13px; margin: 8px 0 0; padding: 4px 8px; border-radius: 6px;
  background: var(--bg); color: var(--muted);
}

/* ---------- 詳細 ---------- */
.rating-row {
  display: grid; grid-template-columns: 9.5em 1fr 1.8em;
  align-items: center; gap: 8px;
  padding: 7px 0; border-bottom: 1px solid var(--line);
}
.rating-row:last-child { border-bottom: 0; }
.rating-row .label { font-size: 14px; line-height: 1.35; }
.rating-row .num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; }
.rating-row.off { opacity: .45; }
.bar { height: 8px; border-radius: 4px; background: var(--star-off); overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--star); border-radius: 4px; }

.comment { white-space: pre-wrap; margin: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.chips li { border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; font-size: 13px; }
.others { display: grid; gap: 6px; }
.others .other {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px;
  text-decoration: none; color: inherit; padding: 6px 0;
}
.others .other > span:first-child { min-width: 5em; font-weight: 700; color: var(--accent); }

.btn {
  display: block; width: 100%; text-align: center;
  padding: 12px; border-radius: 10px; border: 0;
  background: var(--accent); color: #fff; font: inherit; font-weight: 700;
  text-decoration: none; margin-top: 8px; cursor: pointer;
}
.btn.ghost { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
.back { display: inline-block; margin-bottom: 8px; font-size: 14px; text-decoration: none; }

/* ---------- 比較 ---------- */
.pickers { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.pickers label { font-size: 12px; color: var(--muted); }
select {
  width: 100%; padding: 10px 8px; font: inherit; font-size: 15px;
  border-radius: 8px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink);
}
.compare { width: 100%; border-collapse: collapse; background: var(--card); border-radius: 12px; overflow: hidden; table-layout: fixed; }
.compare th, .compare td { padding: 9px 6px; border-bottom: 1px solid var(--line); text-align: center; font-size: 14px; vertical-align: middle; }
.compare th[scope="row"] { text-align: left; color: var(--muted); font-weight: 400; width: 34%; line-height: 1.35; }
.compare tr.total th[scope="row"] { color: var(--ink); font-weight: 700; }
.compare tr.total td { font-size: 16px; font-weight: 700; }
.compare tr.off td, .compare tr.off th { opacity: .45; }
.compare td.win { background: var(--win); color: var(--win-ink); font-weight: 700; }
.compare td.pre { white-space: pre-line; }
.compare .stars { font-size: 12px; letter-spacing: 0; display: block; margin: 2px auto 0; width: max-content; }

/* ---------- レビュー・算出元 ---------- */
.basis { font-size: 12px; color: var(--muted); margin-top: 2px; }
.lead { color: var(--muted); font-size: 13px; margin: -6px 0 12px; }
.review { border-top: 1px solid var(--line); padding: 12px 0; }
.review:first-of-type { border-top: 0; padding-top: 4px; }
.cond { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-size: 13px; font-weight: 700; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 1px 8px; }
.usage { font-size: 13px; color: var(--muted); margin: 4px 0; }
.mini { list-style: none; margin: 6px 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 12px; color: var(--muted); }
.mini b { color: var(--ink); }
.mini li.off { opacity: .5; }
.review .comment { font-size: 15px; }
.others .other small { flex-basis: 100%; }
.compare tr.basis-row td { font-size: 12px; color: var(--muted); }

/* ---------- レビュー入力フォーム ---------- */
.form-sec { display: grid; gap: 4px; }
.form-sec h2 { margin-bottom: 4px; }
.field { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px; font-size: 14px; font-weight: 700; margin-top: 8px; }
.field > input, .field > select, .field > textarea { flex: 1 1 100%; }
.field em { font-style: normal; font-size: 11px; font-weight: 700; color: var(--warn); margin-left: 6px; }
.field .opt { font-size: 11px; font-weight: 400; color: var(--muted); margin-left: 6px; }
.field input, .field textarea, .field select {
  width: 100%; min-height: 48px; padding: 10px 12px; font: inherit; font-size: 16px; font-weight: 400;
  border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--ink);
}
.field textarea { min-height: 120px; resize: vertical; line-height: 1.6; }
.field [aria-invalid="true"] { border-color: var(--warn); box-shadow: 0 0 0 1px var(--warn); }
.field input:focus-visible, .field textarea:focus-visible, .field select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.hint { font-size: 12px; color: var(--muted); margin: 2px 0 0; }
.price-input { flex: 1 1 100%; display: flex; align-items: center; gap: 8px; }
.price-input input { flex: 1; min-width: 0; min-height: 48px; padding: 10px 12px; font: inherit; font-size: 16px; font-weight: 400; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--ink); }
.price-input input[aria-invalid="true"] { border-color: var(--warn); box-shadow: 0 0 0 1px var(--warn); }
.price-input > span { font-weight: 400; }
.price-field.off { color: var(--muted); }
.price-input input:disabled { background: var(--bg); color: var(--muted); cursor: not-allowed; }
.form-errors {
  border: 1px solid var(--warn); border-radius: 12px; padding: 10px 14px; margin-bottom: 12px;
  background: var(--card); color: var(--ink); font-size: 14px;
}
.form-errors strong { color: var(--warn); }
.form-errors ul { margin: 6px 0 0; padding-left: 1.2em; }
.form-errors a { color: var(--accent); }

fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { padding: 0; font-weight: 700; font-size: 14px; }
.uses, .mode-switch { margin-top: 4px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.use-opts, .mode-opts { display: grid; gap: 8px; margin-top: 8px; }
.use-opts { grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); }
.mode-opts { grid-template-columns: 1fr 1fr; }
.use-opt, .mode-opt, .rate-opt { position: relative; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.use-opt input, .mode-opt input, .rate-opt input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.use-opt span, .mode-opt span, .rate-opt span {
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  min-height: 44px; padding: 6px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--bg); color: var(--ink); font-weight: 700; font-size: 15px;
}
.mode-opt span { min-height: 64px; }
.mode-opt small { font-weight: 400; color: var(--muted); font-size: 11px; line-height: 1.4; margin-top: 2px; }
.use-opt input:checked + span, .mode-opt input:checked + span, .rate-opt input:checked + span {
  background: var(--accent); border-color: var(--accent); color: #fff;
}
.mode-opt input:checked + span small { color: #fff; }
.rate-opt.none input:checked + span { background: var(--muted); border-color: var(--muted); }
.use-opt input:focus-visible + span, .mode-opt input:focus-visible + span, .rate-opt input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.rate { padding: 10px 0; border-bottom: 1px solid var(--line); }
.rate legend small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; line-height: 1.45; margin-top: 1px; }
.rate-opts { display: grid; grid-template-columns: repeat(5, 1fr) 1.5fr; gap: 6px; margin-top: 8px; }
.rate-opt span { font-variant-numeric: tabular-nums; }
.rate-opt.none span { font-size: 13px; font-weight: 400; }
.rate-group { padding: 10px 0 4px; border-bottom: 1px solid var(--line); }
.rate-group-head { font-weight: 700; font-size: 14px; }
.rate-group-head small { display: block; font-weight: 400; }
.rate-group .rate { padding-left: 12px; border-bottom-style: dashed; }
.rate-group .rate:last-of-type { border-bottom: 0; }
.rate-group .calc { margin: 2px 0 6px 12px; }
.more { margin-top: 8px; }
.more summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; font-weight: 700; font-size: 14px; color: var(--accent); }
.json {
  width: 100%; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; line-height: 1.5;
  padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--ink);
  resize: vertical; white-space: pre; overflow-x: auto;
}
#rf-result code { font-size: 12px; background: var(--bg); padding: 0 4px; border-radius: 4px; }
.btn.danger { border-color: var(--warn); color: var(--warn); }

/* ---------- タイヤサイズ（トレッド幅・扁平率・インチ） ---------- */
.size-filter legend, .range-filter legend { font-size: 13px; color: var(--muted); font-weight: 400; margin-bottom: 4px; }
.size-selects { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; align-items: end; }
.size-selects label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 2px; white-space: nowrap; }
.size-selects select { min-height: 48px; padding: 8px 4px; font-size: 16px; }

/* ---------- レビュー入力: タイヤサイズの＋−ボタン ---------- */
.size-input { margin-top: 8px; }
.size-input legend { display: flex; align-items: baseline; gap: 6px; width: 100%; font-size: 14px; font-weight: 700; margin-bottom: 4px; }
.size-input legend em { font-style: normal; font-size: 11px; color: var(--warn); }
.size-now { margin-left: auto; font-size: 18px; color: var(--accent); font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.size-now.empty { font-size: 13px; font-weight: 400; color: var(--muted); letter-spacing: 0; }
.stepper { display: grid; grid-template-columns: 1fr 48px 4.2em 48px; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.stepper-label { font-size: 14px; color: var(--muted); }
.stepper .step-btn { width: 48px; height: 48px; font-size: 22px; }
.stepper .step-btn:disabled { opacity: .35; cursor: default; }
.stepper-val { text-align: center; font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------- レビュー入力: 必須項目と任意項目 ---------- */
.req-sec h2 { margin-bottom: 0; }
.req-h { display: flex; align-items: baseline; gap: 6px; }
.req-h em { font-style: normal; font-size: 11px; font-weight: 700; color: var(--warn); }
.size-toggle { display: flex; align-items: flex-start; gap: 10px; padding: 6px 0; cursor: pointer; font-size: 15px; font-weight: 700; }
.size-toggle input { width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--accent); flex: none; }
.size-toggle small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; margin-top: 1px; }
.opt-sec { padding: 0; overflow: hidden; }
.opt-sec summary {
  display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 8px 16px;
  cursor: pointer; list-style: none; -webkit-tap-highlight-color: transparent;
}
.opt-sec summary::-webkit-details-marker { display: none; }
.opt-sec summary::after {
  content: ""; width: 10px; height: 10px; flex: none;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: rotate(45deg); margin: -4px 4px 0 0; transition: transform .15s;
}
.opt-sec[open] summary::after { transform: rotate(-135deg); margin-top: 4px; }
.opt-sec[open] summary { border-bottom: 1px solid var(--line); }
.opt-sec summary:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.opt-title { flex: 1; font-weight: 700; font-size: 16px; line-height: 1.3; }
.opt-title small { margin-top: 2px; }
.opt-count { flex: none; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.opt-body { padding: 4px 16px 16px; }

/* いたずら対策の見えない欄 */
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.form-done { display: grid; gap: 8px; text-align: center; }
.form-done h1 { margin-bottom: 0; }

/* ---------- 範囲スライダー（購入価格・書いた時期） ---------- */
.range-filter legend { font-size: 13px; color: var(--muted); font-weight: 400; margin-bottom: 4px; }
.range-slider { margin-top: 6px; }
.range-slider-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 14px; }
.range-slider-head label { color: var(--muted); }
.range-val { font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 700; }
.range-slider.set .range-val { color: var(--accent); }
.range-slider-row { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; gap: 6px; }
.step-btn {
  width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--bg);
  color: var(--ink); font: inherit; font-size: 20px; line-height: 1; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.step-btn:active { background: var(--accent-soft); }
.range-slider input[type=range] {
  width: 100%; height: 40px; margin: 0; -webkit-appearance: none; appearance: none; background: transparent; cursor: pointer; touch-action: pan-y;
}
.range-slider input[type=range]::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: var(--star-off); }
.range-slider input[type=range]::-moz-range-track { height: 6px; border-radius: 3px; background: var(--star-off); }
.range-slider input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 28px; height: 28px; margin-top: -11px; border-radius: 50%;
  background: var(--card); border: 3px solid var(--muted); box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
.range-slider input[type=range]::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%; background: var(--card); border: 3px solid var(--muted); }
.range-slider.set input[type=range]::-webkit-slider-thumb { border-color: var(--accent); }
.range-slider.set input[type=range]::-moz-range-thumb { border-color: var(--accent); }
.range-slider input[type=range]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* ---------- 下部 ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  background: var(--card); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a {
  text-align: center; padding: 14px 0; text-decoration: none;
  color: var(--muted); font-weight: 700; font-size: 15px;
}
.tabbar a.active { color: var(--accent); }

.ad-notice {
  max-width: 560px; margin: 0 auto; padding: 8px 16px 16px;
  text-align: center; color: var(--muted); font-size: 12px;
}
.ad-notice p { margin: 0 0 4px; }
.ad-notice p:empty { display: none; }
.ad-notice a { color: var(--muted); }
/* 「このタイヤを探す」の見出しに付ける「広告」の札 */
.ad-label {
  display: inline-block; vertical-align: 2px; margin-left: 4px; padding: 0 6px;
  border: 1px solid var(--muted); border-radius: 4px;
  color: var(--muted); font-size: 11px; font-weight: 400; line-height: 1.6;
}
.card.shop .btn:first-of-type { margin-top: 4px; }

/* ---------- プライバシーポリシー（privacy.html） ---------- */
body.plain { padding-bottom: calc(24px + env(safe-area-inset-bottom)); } /* 下のタブバーがないページ */
.policy .card p { margin: 0 0 8px; }
.policy .card p:last-child, .policy .card ul:last-child { margin-bottom: 0; }
.policy h3 { font-size: 14px; margin: 12px 0 4px; }
.policy ul { margin: 0 0 8px; padding-left: 1.3em; }
.policy li + li { margin-top: 4px; }
.policy .card { overflow-wrap: anywhere; }
