/* 車種の比較 — 比較ボタン・画面の下の比較トレイ（js/compare_tray.js）・比較表（自由比較 /car/compare/ と 2 車種の比較ページ） */

/* ---- 比較ボタン（カードの写真の右上・車種ページの見出し） ---- */
.cmp-btn { display: inline-flex; align-items: center; gap: 5px; height: 30px; padding: 0 10px 0 8px; border: 1px solid var(--line); border-radius: 999px;
  background: rgba(255,255,255,.94); color: var(--g); font: inherit; font-size: .74rem; font-weight: 800; cursor: pointer; box-shadow: 0 2px 6px rgba(16,36,43,.14); }
.cmp-btn:hover { border-color: var(--g); }
.cmp-btn:focus-visible { outline: 3px solid var(--brand); outline-offset: 1px; }
.cmp-btn-ic { width: 14px; height: 14px; border: 2px solid currentColor; border-radius: 4px; position: relative; flex: 0 0 auto; }
.cmp-btn[aria-pressed="true"] { background: var(--g); border-color: var(--g); color: #fff; }
.cmp-btn[aria-pressed="true"] .cmp-btn-ic::after { content: ""; position: absolute; left: 3px; top: 0; width: 4px; height: 7px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.cs-card { position: relative; }
.cs-card > .cmp-btn { position: absolute; right: 8px; top: 8px; z-index: 2; }
.cs-tbl .cmp-btn { height: 26px; font-size: .7rem; box-shadow: none; }
.cmp-btn--lg { height: 36px; padding: 0 14px 0 12px; font-size: .85rem; box-shadow: none; }

/* ---- 比較トレイ ---- */
.cmp-tray { position: fixed; left: 0; right: 0; bottom: 0; z-index: 900; transform: translateY(110%); visibility: hidden; transition: transform .22s ease-out, visibility 0s .22s;
  background: rgba(255,255,255,.97); border-top: 1px solid var(--line); box-shadow: 0 -10px 30px -18px rgba(16,36,43,.5); padding-bottom: env(safe-area-inset-bottom); }
.cmp-tray.is-on { transform: none; visibility: visible; transition: transform .22s ease-out; }
body.has-cmp-tray { padding-bottom: 86px; }
.cmp-tray-in { max-width: 1340px; margin: 0 auto; padding: 10px 32px; display: flex; align-items: center; gap: 14px; position: relative; }
.cmp-tray-list { display: flex; gap: 8px; list-style: none; margin: 0; padding: 0; flex: 1; min-width: 0; overflow-x: auto; }
.cmp-tray-list li { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; max-width: 230px; padding: 5px 6px 5px 5px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.cmp-tray-ph { width: 54px; height: 36px; border-radius: 6px; overflow: hidden; background: var(--soft); flex: 0 0 auto; }
.cmp-tray-ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cmp-tray-nm { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.cmp-tray-nm small { font-size: .66rem; color: var(--mute); }
.cmp-tray-nm b { font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmp-tray-x { width: 24px; height: 24px; border: 0; border-radius: 50%; background: var(--soft); color: var(--mute); cursor: pointer; font-size: .9rem; flex: 0 0 auto; }
.cmp-tray-x:hover { background: var(--line); color: var(--ink); }
.cmp-tray-act { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.cmp-tray-n { font-size: .8rem; color: var(--mute); font-variant-numeric: tabular-nums; }
.cmp-tray-go { display: inline-flex; align-items: center; height: 42px; padding: 0 18px; border-radius: 10px; text-decoration: none; color: #fff; }
.cmp-tray-go:hover { color: #fff; text-decoration: none; }
.cmp-tray-go[aria-disabled="true"] { background: var(--line); color: var(--mute); cursor: default; }
.cmp-tray-clear { border: 0; background: none; color: var(--mute); font: inherit; font-size: .8rem; text-decoration: underline; cursor: pointer; }
.cmp-tray-msg { position: absolute; left: 32px; bottom: 100%; margin: 0 0 8px; font-size: .8rem; font-weight: 700; color: var(--s-ink); }
.cmp-tray-msg:empty { display: none; }
@media (max-width: 760px) {
  body.has-cmp-tray { padding-bottom: 120px; }
  .cmp-tray-in { flex-wrap: wrap; padding: 8px 14px; gap: 8px; }
  .cmp-tray-list li { max-width: 170px; }
  .cmp-tray-nm small { display: none; }
  .cmp-tray-ph { width: 40px; height: 28px; }
  .cmp-tray-act { width: 100%; }
  .cmp-tray-go { flex: 1; justify-content: center; height: 40px; }
  .cmp-tray-msg { left: 14px; }
}

/* ---- 比較表 ---- */
.cmp-wrap h1 small { display: block; font-size: .95rem; color: var(--mute); font-weight: 600; margin-top: 4px; }
.cmp-empty { padding: 20px 22px; border: 1px dashed var(--line); border-radius: 14px; background: var(--card); margin: 0 0 16px; }
.cmp-empty p { margin: 0 0 10px; }
.cmp-empty .cs-btn { display: inline-block; text-decoration: none; }
.cmp-add { position: relative; max-width: 640px; margin: 0 0 14px; }
.cmp-add-in { display: flex; align-items: center; gap: 10px; font-size: .85rem; font-weight: 700; }
.cmp-add-in input { flex: 1; min-width: 0; height: 42px; font: inherit; font-size: .95rem; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.cmp-add-list { top: 48px; left: 0; right: auto; width: 100%; max-width: 420px; }
.cmp-adds { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 8px 0 0; font-size: .8rem; color: var(--mute); }
.cmp-adds a { padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px; background: #fff; text-decoration: none; font-weight: 700; }
.cmp-bar { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; margin: 0 0 8px; }
.cmp-diff { display: inline-flex; gap: 6px; align-items: center; font-size: .86rem; font-weight: 700; cursor: pointer; }
.cmp-legend { font-size: .78rem; color: var(--mute); }
/* 横にも縦にもこの枠の中でスクロールさせ、車種名の行と項目の列を固定する（golfscale は外枠が横スクロールだけで見出しが止まらなかった） */
.cmp-scroll { overflow: auto; max-height: calc(100vh - 110px); border: 1px solid var(--line); border-radius: 12px; background: var(--card); margin: 0 0 10px; }
.cmp-grid { border-collapse: separate; border-spacing: 0; width: 100%; table-layout: fixed; min-width: calc(150px + var(--n, 2) * 170px); font-size: .86rem; }
.cmp-grid th, .cmp-grid td { padding: 9px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.cmp-grid td { font-variant-numeric: tabular-nums; border-left: 1px solid var(--line); }
.cmp-grid thead th { position: sticky; top: 0; z-index: 2; background: var(--card); vertical-align: bottom; }
.cmp-grid th[scope="row"], .cmp-corner { position: sticky; left: 0; z-index: 1; background: var(--soft); width: 150px; min-width: 130px; font-size: .78rem; color: var(--mute); font-weight: 700; }
.cmp-corner { z-index: 3 !important; }
.cmp-grid tr.diff td { color: var(--ink); font-weight: 700; }
.cmp-grid tr.same td { color: var(--mute); }
.only-diff .cmp-grid tr.same, .cmp-scroll.only-diff tr.same { display: none; }
.cmp-more { font-size: .84rem; font-weight: 700; }
.cmp-group th { position: sticky; left: 0; background: var(--tint) !important; color: var(--g) !important; font-size: .8rem !important; }
.cmp-group th span { position: sticky; left: 12px; }
.cmp-h { min-width: 160px; position: relative; }
.cmp-h-a { display: flex; flex-direction: column; gap: 2px; color: inherit; text-decoration: none; }
.cmp-h-a:hover b { color: var(--g); text-decoration: underline; }
.cmp-h-a small { font-size: .7rem; color: var(--mute); font-weight: 600; }
.cmp-h-a b { font-size: .95rem; color: var(--ink); }
.cmp-ph { display: block; aspect-ratio: 3 / 2; border-radius: 8px; overflow: hidden; background: var(--soft); margin-bottom: 6px; max-width: 280px; }
.cmp-ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cmp-ph span { display: flex; height: 100%; align-items: center; justify-content: center; font-size: .72rem; color: var(--mute); }
.cmp-rm { position: absolute; right: 8px; top: 8px; z-index: 1; width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; background: rgba(255,255,255,.92); border: 1px solid var(--line); color: var(--mute); text-decoration: none; font-size: .9rem; }
.cmp-rm:hover { color: var(--s-ink); border-color: var(--s); text-decoration: none; }
.cmp-yes { color: var(--y-deep); }
.cmp-unk { color: var(--mute); font-weight: 500; }
.cmp-grid td.mark { text-align: center; }
@media (max-width: 760px) {
  .cmp-grid { min-width: calc(110px + var(--n, 2) * 140px); font-size: .8rem; }
  .cmp-grid th[scope="row"], .cmp-corner { width: 110px; min-width: 100px; }
  .cmp-h { min-width: 130px; }
  .cmp-grid th, .cmp-grid td { padding: 8px; }
}
