:root {
  /* Defaults mirror config.json palette; app.js overwrites these at runtime
     so palette changes only ever require editing config.json. */
  --yellow: #F6B93B;
  --yellowd: #E09A1E;
  --orange: #F58E4E;
  --oranged: #E0703A;
  --cream: #FFFBF3;
  --card: #FFFFFF;
  --ink: #5b4a37;
  --mut: #a3927c;
  --line: #f0e6d4;
  --good: #67B26F;
  --ok: #F0A93B;
  --weak: #EB7C6A;

  --bg: var(--cream);
  --surface: var(--card);
  --surface-soft: #FBF1DE;
  --text: var(--ink);
  --text-soft: var(--mut);
  --border: var(--line);
  --shadow: 0 6px 18px rgba(91, 74, 55, 0.10);
  --shadow-lg: 0 -8px 28px rgba(91, 74, 55, 0.20);

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

:root[data-theme="dark"] {
  --bg: #211a12;
  --surface: #2c2318;
  --surface-soft: #362b1c;
  --text: #f6ecd9;
  --text-soft: #c2ac8c;
  --border: rgba(246, 236, 217, 0.12);
  --shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 -8px 28px rgba(0, 0, 0, 0.5);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #211a12;
    --surface: #2c2318;
    --surface-soft: #362b1c;
    --text: #f6ecd9;
    --text-soft: #c2ac8c;
    --border: rgba(246, 236, 217, 0.12);
    --shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 -8px 28px rgba(0, 0, 0, 0.5);
  }
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
  overscroll-behavior: none;
}

body {
  margin: 0;
  font-family: "M PLUS Rounded 1c", "Zen Maru Gothic", "Hiragino Maru Gothic ProN", "Rounded Mplus 1c", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100dvh;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

#app {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
}

/* ---------- Header ---------- */
.app-header {
  flex: 0 0 auto;
  padding: 12px 16px 6px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-logo {
  font-size: 1.8rem;
  line-height: 1;
}

.brand-text h1 {
  margin: 0;
  font-size: 1.08rem;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.brand-text p {
  margin: 1px 0 0;
  font-size: 0.72rem;
  color: var(--text-soft);
  font-weight: 500;
}

/* ---------- Header actions (search / favorites) ---------- */
.header-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.icon-btn {
  position: relative;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--surface);
  font-size: 1.05rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.12s ease, border-color 0.15s ease;
}

.icon-btn:active { transform: scale(0.94); }

.favorites-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  min-width: 16px;
  height: 16px;
  padding: 0 3px;
  border-radius: 999px;
  background: var(--oranged);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 800;
  line-height: 16px;
  text-align: center;
}

#favorites-btn.has-items { border-color: var(--oranged); }

/* ---------- Zone tabs ---------- */
.zone-tabs {
  flex: 0 0 auto;
  display: flex;
  gap: 6px;
  padding: 0 16px 8px;
}

.zone-tab {
  flex: 1 1 0;
  padding: 7px 4px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text-soft);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.zone-tab.is-active {
  background: var(--oranged);
  border-color: var(--oranged);
  color: #fff;
}

/* ---------- Chip row ---------- */
.chip-row {
  flex: 0 0 auto;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 4px 16px 10px;
  scrollbar-width: none;
}

.chip-row::-webkit-scrollbar {
  display: none;
}

.chip {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.12s ease, background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.chip:active {
  transform: scale(0.96);
}

.chip .chip-icon {
  font-size: 1.05rem;
}

.chip.is-on {
  background: var(--chip-color, var(--orange));
  border-color: var(--chip-color, var(--orange));
  color: #fff;
}

/* ---------- Segment control ---------- */
/* ---------- 基準バー（何で並べているかを一行で端的に） ---------- */
.criteria-bar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 5px;
  margin: 0 16px 8px;
  padding: 6px 12px;
  font-size: 0.76rem;
  background: var(--surface-soft);
  border-radius: 999px;
  white-space: nowrap;
  overflow: hidden;
}
.criteria-bar .cb-icon { font-weight: 800; color: var(--orange); flex: 0 0 auto; }
.criteria-bar .cb-zone { font-weight: 800; color: var(--text); flex: 0 0 auto; }
.criteria-bar .cb-sep { opacity: 0.45; flex: 0 0 auto; }
.criteria-bar .cb-keys { font-weight: 800; color: var(--orange); overflow: hidden; text-overflow: ellipsis; }
.criteria-bar .cb-tail { color: var(--text-soft); flex: 0 0 auto; }

.segment {
  flex: 0 0 auto;
  display: flex;
  gap: 4px;
  margin: 0 16px 10px;
  padding: 4px;
  background: var(--surface-soft);
  border-radius: 16px;
}

.segment-btn {
  flex: 1;
  padding: 9px 0;
  border: none;
  border-radius: 12px;
  background: transparent;
  color: var(--text-soft);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.segment-btn.is-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

/* ---------- Main view area ---------- */
.view-area {
  flex: 1 1 auto;
  min-height: 0;
  position: relative;
  padding: 0 16px;
}

.view {
  display: none;
  height: 100%;
  min-height: 0;
}

.view.is-active {
  display: block;
}

#view-map.is-active {
  display: flex;
  flex-direction: column;
}

/* ---------- List ---------- */
.list-body {
  list-style: none;
  margin: 0;
  padding: 2px 2px 14px;
  height: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.m-card {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 60px;
  background: var(--surface);
  border-radius: 18px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: transform 0.12s ease, border-color 0.15s ease;
}

.m-card:active {
  transform: scale(0.98);
}

/* 首位だけ淡いグリーンのリングで控えめに強調（黄オレンジの氾濫をやめる） */
.m-card.is-top {
  border-color: #9AD9BC;
  background: linear-gradient(135deg, rgba(92, 184, 139, 0.12), var(--surface) 55%);
}

/* ---------- 順位マーク（主役・やさしい階調／赤なし＝非攻撃的） ---------- */
.rank-mark {
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1;
  background: var(--rank-bg, var(--surface-soft));
  color: var(--rank-fg, var(--text-soft));
}
.rank-mark b { font-size: 1.55rem; font-weight: 800; }
.rank-mark i { font-size: 0.58rem; font-style: normal; opacity: 0.78; margin-top: 2px; }
.rank-hi  { --rank-bg: #DDF1E6; --rank-fg: #1F7A55; } /* 上位=ミント */
.rank-mid { --rank-bg: #FBEFD0; --rank-fg: #B0801A; } /* 中位=ゴールド */
.rank-lo  { --rank-bg: #FCE4D6; --rank-fg: #C56A3D; } /* 下位=ピーチ（赤ではない） */
.rank-mark--xl { width: 66px; height: 66px; border-radius: 18px; }
.rank-mark--xl b { font-size: 2.1rem; }
.rank-mark--xl i { font-size: 0.72rem; }

.star-mark { color: #EBB23C; font-size: 1rem; letter-spacing: 1px; white-space: nowrap; }
.star-mark--xl { font-size: 1.6rem; }

.m-main {
  flex: 1 1 auto;
  min-width: 0;
}

.m-name {
  display: block;
  font-size: 1.24rem;
  font-weight: 800;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.m-sub {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 5px;
}

.m-zone {
  font-size: 0.74rem;
  color: var(--text-soft);
  flex: 0 0 auto;
}

.m-score {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-soft);
  background: var(--surface-soft);
  padding: 1px 9px;
  border-radius: 999px;
  flex: 0 0 auto;
}

.m-empty {
  padding: 24px 16px;
  color: var(--text-soft);
  text-align: center;
  font-size: 0.9rem;
}

/* 指数チップ（検索結果・比較表で S/A/B の代わりに相対指数を出す） */
.score-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 800;
  background: var(--surface-soft);
  color: var(--ink);
}
.score-chip--strong { background: #DDF1E6; color: #1F7A55; }

.m-chevron {
  flex: 0 0 auto;
  color: var(--text-soft);
  font-size: 1.3rem;
}

/* ---------- Map ---------- */
#view-map {
  gap: 8px;
  padding-bottom: 10px;
}

#map {
  flex: 1 1 auto;
  min-height: 0;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: var(--shadow);
  background: var(--surface-soft);
}

.leaflet-container {
  background: var(--surface-soft);
  font-family: inherit;
}

.map-legend {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.68rem;
  color: var(--text-soft);
  font-weight: 600;
  padding: 2px 4px;
}

.legend-bar {
  flex: 1 1 auto;
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--legend-from, #eee), var(--legend-to, #333));
}

.zone-tooltip {
  font-weight: 800;
  font-size: 0.72rem;
  padding: 2px 8px;
  font-family: inherit;
}

/* ---------- Footer ---------- */
.app-footer {
  flex: 0 0 auto;
  text-align: center;
  padding: 4px 12px 8px;
}

.app-footer p {
  margin: 0;
  font-size: 0.62rem;
  color: var(--text-soft);
}

/* ---------- Bottom sheet ---------- */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(60, 45, 25, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
  z-index: 40;
}

.sheet-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}

.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 82dvh;
  background: var(--surface);
  border-radius: 24px 24px 0 0;
  box-shadow: var(--shadow-lg);
  transform: translateY(100%);
  transition: transform 0.26s cubic-bezier(0.32, 0.72, 0.35, 1);
  z-index: 50;
  display: flex;
  flex-direction: column;
  padding-bottom: calc(var(--safe-bottom) + 10px);
}

.sheet.is-open {
  transform: translateY(0);
}

.sheet-grab {
  flex: 0 0 auto;
  display: flex;
  justify-content: center;
  padding: 10px 0 6px;
  cursor: grab;
  touch-action: none;
}

.sheet-grab span {
  width: 42px;
  height: 5px;
  border-radius: 999px;
  background: var(--border);
}

.sheet-content {
  overflow-y: auto;
  padding: 0 20px 8px;
  -webkit-overflow-scrolling: touch;
}

.sheet-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 2px;
}

.sheet-title {
  font-size: 1.2rem;
  font-weight: 800;
  margin: 0;
}

.sheet-rank {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-soft);
  background: var(--surface-soft);
  border-radius: 999px;
  padding: 4px 10px;
  white-space: nowrap;
}

.sheet-grade-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 4px 0 8px;
}

.sheet-radar {
  display: flex;
  justify-content: center;
  padding: 4px 0 6px;
}

.sheet-details {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 6px 0 18px;
}

.detail-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 14px;
  background: var(--surface-soft);
}

.detail-icon { font-size: 1rem; flex: 0 0 auto; }

.detail-label {
  font-size: 0.84rem;
  font-weight: 700;
  flex: 0 0 auto;
  width: 5.6em;
}

.detail-meter {
  flex: 1 1 auto;
  min-width: 40px;
  height: 8px;
  border-radius: 999px;
  background: rgba(120, 120, 120, 0.16);
  overflow: hidden;
}
.detail-meter-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #7CC7A0, #EBC15A);
  transition: width 0.4s ease;
}

.detail-raw {
  flex: 0 0 auto;
  max-width: 42%;
  min-width: 0;
  font-size: 0.74rem;
  color: var(--text-soft);
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- グレードバッジ（S/A+/A/B+/B/C+/C） ----------
   トーン: S=最も濃いオレンジ→C=最も薄いクリーム系。優劣ではなく「グレード帯」として直感的な濃淡順。 */
.grade-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  border-radius: 999px;
  line-height: 1;
  flex: 0 0 auto;
}

.grade-badge--lg { min-width: 34px; height: 34px; padding: 0 6px; font-size: 0.86rem; }
.grade-badge--xl { min-width: 52px; height: 52px; padding: 0 10px; font-size: 1.3rem; }
.grade-badge--sm { min-width: 0; height: auto; padding: 2px 8px; font-size: 0.66rem; }

.grade-S  { background: #E0703A; color: #fff; box-shadow: 0 0 0 2px rgba(224,112,58,0.25); }
.grade-Ap { background: #F58E4E; color: #fff; }
.grade-A  { background: #F6B93B; color: #fff; }
.grade-Bp { background: #F0A93B; color: #fff; }
.grade-B  { background: #f3dfae; color: #6b5233; }
.grade-Cp { background: #e7d8bf; color: #6b5233; }
.grade-C  { background: #ddccb2; color: #6b5233; }

:root[data-theme="dark"] .grade-B,
:root[data-theme="dark"] .grade-Cp,
:root[data-theme="dark"] .grade-C {
  color: #2b2013;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .grade-B,
  :root:not([data-theme="light"]) .grade-Cp,
  :root:not([data-theme="light"]) .grade-C {
    color: #2b2013;
  }
}

.sendout-row {
  display: flex;
  gap: 8px;
  padding-bottom: 4px;
}

.sendout-btn {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 11px 4px;
  border-radius: 16px;
  background: var(--surface-soft);
  color: var(--text);
  text-decoration: none;
  font-size: 0.78rem;
  font-weight: 700;
  text-align: center;
  transition: transform 0.12s ease;
}

.sendout-btn:active {
  transform: scale(0.96);
}

.sendout-btn .sendout-sub {
  font-size: 0.62rem;
  font-weight: 500;
  color: var(--text-soft);
}

/* ---------- Small screens ---------- */
@media (max-height: 640px) {
  .brand-text h1 { font-size: 0.95rem; }
  .brand-text p { font-size: 0.66rem; }
  .m-card { padding: 10px 12px; min-height: 52px; gap: 10px; }
  .rank-mark { width: 42px; height: 42px; }
  .rank-mark b { font-size: 1.35rem; }
  .m-name { font-size: 1.14rem; }
  .criteria-bar { margin-bottom: 6px; padding: 5px 11px; font-size: 0.72rem; }
}

/* --- brand assets (logo + mascot) --- */
.brand-logo-img{width:38px;height:38px;border-radius:12px;object-fit:cover;flex:none;box-shadow:0 2px 6px rgba(224,112,58,.18)}
.app-footer{display:flex;align-items:center;gap:8px;justify-content:center}
.footer-mascot{width:26px;height:26px;border-radius:50%;object-fit:cover;flex:none}

/* --- 地図: 空白を"海"に見せてバグ感を消す --- */
.leaflet-container{background:#dceef3 !important}
@media (prefers-color-scheme:dark){.leaflet-container{background:#1a2a30 !important}}
#map{border-radius:14px;overflow:hidden}

/* --- B: チップ右端フェード（横スクロール合図） --- */
.chip-row{-webkit-mask-image:linear-gradient(90deg,#000 86%,transparent);mask-image:linear-gradient(90deg,#000 86%,transparent)}

/* --- B: 初回オンボーディング（シーサーの吹き出し） --- */
.onboard{position:fixed;inset:0;background:rgba(60,45,30,.42);display:flex;align-items:center;justify-content:center;z-index:9999;padding:24px}
.onboard[hidden]{display:none}
.onboard-card{background:#fff;border-radius:22px;max-width:330px;width:100%;padding:22px 20px 18px;text-align:center;box-shadow:0 12px 40px rgba(60,45,30,.28)}
.onboard-card img{width:96px;height:96px;object-fit:contain;margin-top:-58px}
.onboard-card h3{font-size:18px;font-weight:800;margin:6px 0 4px;color:#5b4a37}
.onboard-steps{text-align:left;font-size:14px;line-height:1.9;color:#6b5945;margin:10px 4px 4px}
.onboard-steps b{color:#e0703a}
.onboard-btn{margin-top:16px;width:100%;border:0;background:#F6B93B;color:#fff;font-weight:800;font-size:15px;padding:13px;border-radius:14px;cursor:pointer;font-family:inherit}
@media (prefers-color-scheme:dark){.onboard-card{background:#22292e;color:#e7eef0}.onboard-card h3{color:#e7eef0}.onboard-steps{color:#c8d2d6}}

/* ================= v2: お気に入り☆ ================= */
.fav-star {
  flex: 0 0 auto;
  background: none;
  border: none;
  padding: 4px;
  color: var(--text-soft);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.12s ease, color 0.15s ease;
}
.fav-star:active { transform: scale(0.9); }
.fav-star.is-active { color: var(--oranged); }
.fav-star--sm .fav-star-icon { width: 17px; height: 17px; }
.fav-star--md .fav-star-icon { width: 20px; height: 20px; }
.fav-star--lg .fav-star-icon { width: 24px; height: 24px; }
.fav-star-icon { display: block; }

/* ================= v2: レーダーチャート（radar.js/IjuRadar） =================
   優劣ではなく形を見せるため塗りは低透明度・線は細め。詳細シート・比較オーバーレイの両方で使う。 */
.radar-wrap { display: flex; flex-direction: column; align-items: center; gap: 6px; }

.radar-svg {
  width: 100%;
  max-width: 220px;
  height: auto;
  overflow: visible;
  transform: scale(1);
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.4s ease;
  opacity: 1;
}

.radar-svg.radar-anim-start { transform: scale(0.35); opacity: 0; }

.radar-grid { fill: none; stroke: var(--border); stroke-width: 1; }
.radar-spoke { stroke: var(--border); stroke-width: 1; }
.radar-axis-label { font-size: 10.5px; font-weight: 700; fill: var(--text-soft); }
.radar-series { stroke-width: 2; stroke-linejoin: round; }
.radar-series--dashed { stroke-dasharray: 4 3; }
.radar-dot { stroke: var(--surface); stroke-width: 1.2; }
.radar-dot--ghost { opacity: 0.5; }

.radar-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 12px; margin-top: 2px; }
.radar-legend-item { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--text-soft); }
.radar-legend-swatch { width: 10px; height: 10px; border-radius: 3px; border: 2px solid; flex: 0 0 auto; }
.radar-legend-swatch--dashed { border-radius: 999px; border-style: dashed; }

.radar-caption {
  margin: 2px 0 0;
  font-size: 11px;
  line-height: 1.5;
  color: var(--text-soft);
  text-align: center;
  max-width: 240px;
}

/* ================= v2: 検索パネル ================= */
.search-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(60, 45, 25, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 60;
}
.search-backdrop.is-open { opacity: 1; pointer-events: auto; }

.search-panel {
  position: fixed;
  left: 12px;
  right: 12px;
  top: calc(var(--safe-top) + 10px);
  max-height: 70dvh;
  background: var(--surface);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  z-index: 70;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.search-panel.is-open { opacity: 1; transform: translateY(0); pointer-events: auto; }

.search-panel-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}

.search-panel-icon { font-size: 1rem; flex: 0 0 auto; }

#search-input {
  flex: 1 1 auto;
  min-width: 0;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--text);
  outline: none;
}

.search-results {
  list-style: none;
  margin: 0;
  padding: 6px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.search-result {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 10px;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.12s ease;
}
.search-result:active { background: var(--surface-soft); }
.search-result-name { font-weight: 700; font-size: 0.9rem; }
.search-result-zone { font-size: 0.68rem; color: var(--text-soft); margin-right: auto; }
.search-empty { padding: 16px; text-align: center; font-size: 0.8rem; color: var(--text-soft); }

/* ================= v2: お気に入り比較オーバーレイ ================= */
.compare-scrim {
  position: fixed;
  inset: 0;
  background: rgba(60, 45, 25, 0.4);
  z-index: 80;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}

.compare-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
}

.compare-overlay.is-visible { opacity: 1; transform: translateY(0); }
/* 閉じている間は完全に非表示＝タップ横取り防止（[hidden]がdisplay:flexに負けるバグの修正） */
.compare-overlay[hidden], .compare-scrim[hidden] { display: none !important; }

.compare-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.compare-head h2 { flex: 1 1 auto; margin: 0; font-size: 1.05rem; font-weight: 800; }

.compare-body {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 18px calc(20px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.compare-empty {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px;
}
.compare-empty p { font-size: 0.95rem; color: var(--text-soft); margin: 0; }

.compare-radar-section {
  display: flex;
  justify-content: center;
  padding: 4px 0 8px;
  border-bottom: 1px solid var(--border);
}
.compare-radar { display: flex; flex-direction: column; align-items: center; }
.compare-radar-note { margin: 4px 0 0; font-size: 0.68rem; color: var(--text-soft); }

.compare-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
}

.compare-table { border-collapse: separate; border-spacing: 0; font-size: 0.82rem; width: 100%; }

.compare-table th, .compare-table td {
  padding: 9px 10px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.compare-table tbody tr:last-child th, .compare-table tbody tr:last-child td { border-bottom: none; }

.compare-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--surface);
}

.ct-rowlabel-col {
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--surface-soft);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-soft);
  border-right: 1px solid var(--border);
}
.compare-table thead .ct-rowlabel-col { z-index: 4; }

.ct-col { min-width: 108px; white-space: normal; }

.ct-remove-star {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 8px 3px 6px;
  margin: 0 0 6px;
  color: var(--oranged);
  font-size: 0.66rem;
  font-weight: 700;
  cursor: pointer;
}
.ct-remove-star .fav-star-icon { width: 12px; height: 12px; }

.ct-name-link {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 2px 0;
  font: inherit;
  font-weight: 800;
  color: var(--text);
  cursor: pointer;
}

.ct-raw {
  display: block;
  margin-top: 3px;
  font-size: 0.64rem;
  color: var(--text-soft);
  white-space: normal;
}

.ct-empty { color: var(--text-soft); }

.compare-note {
  margin: 0;
  font-size: 0.68rem;
  line-height: 1.6;
  color: var(--text-soft);
}

/* ================= v2: 3秒アンドゥトースト ================= */
.compare-toast {
  position: fixed;
  left: 50%;
  bottom: calc(20px + var(--safe-bottom));
  transform: translate(-50%, 12px);
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--ink);
  color: #fff;
  border-radius: 999px;
  padding: 10px 10px 10px 16px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transition: opacity 0.18s ease, transform 0.18s ease;
  max-width: calc(100vw - 32px);
}
.compare-toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.compare-toast-text { font-size: 0.82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.compare-toast-undo {
  flex: 0 0 auto;
  background: rgba(255, 255, 255, 0.16);
  border: none;
  color: #fff;
  font-size: 0.76rem;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
}
