:root {
  --text: #1f2937;
  --text-strong: #111827;
  --muted: #6b7280;

  --line: #dbe2db;
  --line-strong: #cfd8cf;

  --bg-page: #f4f1ec;
  --bg-panel: #ffffff;
  --bg-soft: #faf9f6;
  --bg-soft-2: #f6f7f4;
  --bg-head: #edf3ee;

  --radius-xl: 20px;
  --radius-lg: 16px;
  --radius-md: 14px;
  --radius-sm: 10px;

  --shadow-soft: 0 8px 24px rgba(15, 23, 42, 0.06);
  --shadow-soft-sm: 0 4px 14px rgba(15, 23, 42, 0.05);

  --compare-child: #2f8f63;
  --compare-child-bg: #edf7f1;
  --compare-child-line: #cfe8d7;

  --compare-elder: #b8761f;
  --compare-elder-bg: #fff4e8;
  --compare-elder-line: #f0d4ae;

  --compare-women: #8f51d9;
  --compare-women-bg: #f5efff;
  --compare-women-line: #dcc8ff;

  --compare-price: #2f72d8;
  --compare-price-bg: #edf4ff;
  --compare-price-line: #cfe0ff;

  --compare-good: #2a8a59;
  --compare-good-bg: #edf8f1;

  --compare-part: #b8791e;
  --compare-part-bg: #fff4e1;

  --compare-none: #8c95a3;
  --compare-none-bg: #f2f4f7;

  /* 4自治体カラー（Google Trends風） */
  --slot-0: #4285f4;
  --slot-0-bg: #eef4ff;
  --slot-0-line: #cfe0ff;

  --slot-1: #ea4335;
  --slot-1-bg: #fff0ef;
  --slot-1-line: #ffd3ce;

  --slot-2: #c58a00;
  --slot-2-bg: #fff8e6;
  --slot-2-line: #f6dfa0;

  --slot-3: #34a853;
  --slot-3-bg: #eef9f1;
  --slot-3-line: #cfe8d7;

  --mobile-accordion-top: 88px;
  --safe-bottom: max(16px, env(safe-area-inset-bottom));
}

html,
body {
  background: var(--bg-page);
}

body {
  color: var(--text);
}

* {
  box-sizing: border-box;
}

.compare-page {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 10px calc(90px + var(--safe-bottom));
}

/* =========================================
   Hero
========================================= */
.compare-hero {
  padding: 12px 0 10px;
}

.compare-hero-inner {
  background: linear-gradient(180deg, #ffffff 0%, #fbfaf7 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  padding: 14px 14px 12px;
  box-shadow: var(--shadow-soft-sm);
}

.hero-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.compare-hero-title-block {
  min-width: 0;
}

.hero-title {
  margin: 0;
  font-size: 28px;
  line-height: 1.1;
  color: var(--text-strong);
}

.hero-sub {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.compare-hero-copy {
  margin: 10px 0 0;
  color: #4b5563;
  font-size: 13px;
  line-height: 1.7;
}

.hero-menu-btn,
.hero-link-btn {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #1f2937;
  text-decoration: none;
  cursor: pointer;
  flex: 0 0 42px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.hero-menu-btn:hover,
.hero-link-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
}

.hero-menu-btn:active,
.hero-link-btn:active {
  transform: translateY(0);
}

/* =========================================
   Sticky toolbar
========================================= */
.compare-toolbar-shell {
  position: sticky;
  top: 0;
  z-index: 40;
  padding: 8px 0 12px;
  background:
    linear-gradient(
      180deg,
      rgba(244, 241, 236, 0.98) 0%,
      rgba(244, 241, 236, 0.94) 70%,
      rgba(244, 241, 236, 0) 100%
    );
  backdrop-filter: blur(10px);
}

.compare-toolbar {
  border: 1px solid rgba(207, 216, 207, 0.9);
  background: rgba(255, 255, 255, 0.92);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-soft);
  padding: 12px;
}

.toolbar-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.toolbar-pills {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.toolbar-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 8px 12px;
  border-radius: 999px;
  background: #ffffff;
  border: 1px solid #e3e7e2;
  color: #55606f;
  font-size: 12px;
  box-shadow: var(--shadow-soft-sm);
}

.toolbar-pill strong {
  color: var(--text-strong);
  font-size: 13px;
}

.toolbar-pill-muted {
  background: #fafaf8;
}

.primary-btn,
.ghost-btn,
.icon-btn,
.theme-tab {
  font: inherit;
  cursor: pointer;
  border: 1px solid #d6ddd6;
  background: #fff;
  color: var(--text);
  transition:
    transform 0.15s ease,
    background 0.15s ease,
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.primary-btn {
  min-height: 42px;
  padding: 0 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  background: #8c8b8b;
  border-color: #8c8b8b;
  color: #fff;
}

.primary-btn:hover {
  transform: translateY(-1px);
  background: #1f2937;
}

.ghost-btn {
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  color: #5f6876;
}

.ghost-btn:hover,
.theme-tab:hover,
.icon-btn:hover {
  background: #f7f8f6;
}

.selected-rail-block {
  margin-top: 12px;
  padding: 12px;
  border-radius: var(--radius-lg);
  background: var(--bg-soft);
  border: 1px solid #e3e8e3;
}

.selected-rail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.selected-rail-title {
  margin: 0;
  font-size: 15px;
  color: var(--text-strong);
  font-weight: 800;
}

.selected-rail-sub {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

.selected-chip-rail-wrap {
  position: relative;
}

.selected-chip-rail {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 2px 48px 6px 0;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
}

.selected-chip-rail::-webkit-scrollbar {
  height: 6px;
}

.selected-chip-rail::-webkit-scrollbar-thumb {
  background: #cfd6cf;
  border-radius: 999px;
}

.selected-chip-rail-fade {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 6px;
  width: 56px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 6px;
  background: linear-gradient(90deg, rgba(250, 249, 246, 0) 0%, rgba(250, 249, 246, 0.92) 48%, rgba(250, 249, 246, 1) 100%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.18s ease;
}

.selected-chip-rail-wrap.has-overflow .selected-chip-rail-fade {
  opacity: 1;
}

.selected-chip-rail-wrap.at-end .selected-chip-rail-fade {
  opacity: 0;
}

.selected-chip-rail-arrow {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border: 1px solid #d7ded7;
  color: #6d7685;
  font-size: 12px;
  font-weight: 900;
  box-shadow: var(--shadow-soft-sm);
}

.selected-rail-scroll-note {
  margin: 6px 2px 0;
  font-size: 11px;
  color: #7b8494;
  line-height: 1.5;
}

.selected-chip {
  flex: 0 0 auto;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px 8px 8px;
  border-radius: 999px;
  border: 1px solid #d6ddd6;
  background: #fff;
  color: #111827;
  font-size: 13px;
  font-weight: 800;
  box-shadow: var(--shadow-soft-sm);
  scroll-snap-align: start;
}

.selected-chip.is-empty {
  border-style: dashed;
  color: var(--muted);
  font-weight: 700;
}

.selected-chip-remove {
  color: #7b8494;
  font-size: 14px;
  line-height: 1;
}

.selected-chip[data-slot="0"] {
  border-color: var(--slot-0-line);
  background: linear-gradient(180deg, #ffffff 0%, var(--slot-0-bg) 100%);
}

.selected-chip[data-slot="1"] {
  border-color: var(--slot-1-line);
  background: linear-gradient(180deg, #ffffff 0%, var(--slot-1-bg) 100%);
}

.selected-chip[data-slot="2"] {
  border-color: var(--slot-2-line);
  background: linear-gradient(180deg, #ffffff 0%, var(--slot-2-bg) 100%);
}

.selected-chip[data-slot="3"] {
  border-color: var(--slot-3-line);
  background: linear-gradient(180deg, #ffffff 0%, var(--slot-3-bg) 100%);
}

.selected-chip[data-slot="0"] .selected-chip-remove { color: var(--slot-0); }
.selected-chip[data-slot="1"] .selected-chip-remove { color: var(--slot-1); }
.selected-chip[data-slot="2"] .selected-chip-remove { color: var(--slot-2); }
.selected-chip[data-slot="3"] .selected-chip-remove { color: var(--slot-3); }

.slot-badge {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 900;
  flex: 0 0 24px;
}

.slot-0 { background: var(--slot-0); }
.slot-1 { background: var(--slot-1); }
.slot-2 { background: var(--slot-2); }
.slot-3 { background: var(--slot-3); }

.text-0 { color: var(--slot-0); }
.text-1 { color: var(--slot-1); }
.text-2 { color: var(--slot-2); }
.text-3 { color: var(--slot-3); }

.fill-0 { background: linear-gradient(90deg, #4285f4 0%, #77a7f7 100%); }
.fill-1 { background: linear-gradient(90deg, #ea4335 0%, #f07b72 100%); }
.fill-2 { background: linear-gradient(90deg, #d9a300 0%, #f4c542 100%); }
.fill-3 { background: linear-gradient(90deg, #34a853 0%, #6dcc84 100%); }

/* =========================================
   Theme tabs
========================================= */
.theme-switcher {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.theme-tab {
  min-width: 0;
  min-height: 56px;
  padding: 10px 12px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: flex-start;
  text-align: left;
  background: #fff;
  box-shadow: none;
}

.theme-tab-icon {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #f4f5f7;
  font-size: 16px;
  flex: 0 0 34px;
}

.theme-tab-label {
  min-width: 0;
  font-size: 13px;
  line-height: 1.2;
  color: var(--text-strong);
  font-weight: 900;
  white-space: nowrap;
}

.theme-tab.is-active {
  background: #fff;
}

.theme-tab.is-active[data-theme="child"] {
  background: var(--compare-child-bg);
  border-color: var(--compare-child-line);
  box-shadow: inset 0 0 0 1px rgba(47, 143, 99, 0.05);
}

.theme-tab.is-active[data-theme="child"] .theme-tab-icon {
  background: #dff3e7;
}

.theme-tab.is-active[data-theme="elder"] {
  background: var(--compare-elder-bg);
  border-color: var(--compare-elder-line);
  box-shadow: inset 0 0 0 1px rgba(184, 118, 31, 0.05);
}

.theme-tab.is-active[data-theme="elder"] .theme-tab-icon {
  background: #fee9cf;
}

.theme-tab.is-active[data-theme="women"] {
  background: var(--compare-women-bg);
  border-color: var(--compare-women-line);
  box-shadow: inset 0 0 0 1px rgba(143, 81, 217, 0.05);
}

.theme-tab.is-active[data-theme="women"] .theme-tab-icon {
  background: #eadcff;
}

.theme-tab.is-active[data-theme="price"] {
  background: var(--compare-price-bg);
  border-color: var(--compare-price-line);
  box-shadow: inset 0 0 0 1px rgba(47, 114, 216, 0.05);
}

.theme-tab.is-active[data-theme="price"] .theme-tab-icon {
  background: #dfeaff;
}

/* =========================================
   Main
========================================= */
.compare-main {
  margin-top: 2px;
}

.compare-panel,
.compare-score-card,
.compare-table-card,
.compare-mobile-card,
.compare-detail-card,
.compare-empty {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft-sm);
}

.compare-empty {
  padding: 28px 20px;
  text-align: center;
}

.compare-empty h3 {
  margin: 0 0 10px;
  font-size: 19px;
  color: var(--text-strong);
}

.compare-empty p {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.8;
}

.compare-empty .primary-btn {
  margin-top: 16px;
}

/* =========================================
   Score cards
========================================= */
.score-grid {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}

.compare-score-card {
  padding: 14px;
  display: flex;
  gap: 12px;
  align-items: center;
  position: relative;
  overflow: hidden;
}

.compare-score-card[data-slot="0"] {
  border-color: var(--slot-0-line);
  background: linear-gradient(180deg, #ffffff 0%, var(--slot-0-bg) 100%);
}

.compare-score-card[data-slot="1"] {
  border-color: var(--slot-1-line);
  background: linear-gradient(180deg, #ffffff 0%, var(--slot-1-bg) 100%);
}

.compare-score-card[data-slot="2"] {
  border-color: var(--slot-2-line);
  background: linear-gradient(180deg, #ffffff 0%, var(--slot-2-bg) 100%);
}

.compare-score-card[data-slot="3"] {
  border-color: var(--slot-3-line);
  background: linear-gradient(180deg, #ffffff 0%, var(--slot-3-bg) 100%);
}

.compare-score-card.is-top::after {
  content: "TOP";
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #111827;
  color: #fff;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

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

.score-pref {
  margin: 0;
  font-size: 16px;
  line-height: 1.25;
  font-weight: 900;
}

.score-region {
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
}

.score-number-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.score-number {
  font-size: clamp(24px, 6vw, 30px);
  line-height: 1;
  font-weight: 900;
  letter-spacing: -0.02em;
}

.score-denom,
.score-rank {
  font-size: 12px;
  color: #667085;
  font-weight: 700;
}

.score-bar {
  margin-top: 10px;
  height: 6px;
  border-radius: 999px;
  background: #e7ebe7;
  overflow: hidden;
}

.score-bar > span {
  display: block;
  height: 100%;
  border-radius: 999px;
}

.score-highlight {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #fafaf8;
  border: 1px solid #e7ece7;
}

.compare-score-card[data-slot="0"] .score-highlight {
  background: rgba(66, 133, 244, 0.08);
  border-color: rgba(66, 133, 244, 0.16);
}

.compare-score-card[data-slot="1"] .score-highlight {
  background: rgba(234, 67, 53, 0.08);
  border-color: rgba(234, 67, 53, 0.16);
}

.compare-score-card[data-slot="2"] .score-highlight {
  background: rgba(213, 163, 0, 0.09);
  border-color: rgba(213, 163, 0, 0.18);
}

.compare-score-card[data-slot="3"] .score-highlight {
  background: rgba(52, 168, 83, 0.08);
  border-color: rgba(52, 168, 83, 0.16);
}

.score-highlight-label {
  display: block;
  font-size: 11px;
  color: #667085;
  font-weight: 800;
}

.score-highlight strong {
  display: block;
  margin-top: 4px;
  font-size: 15px;
  color: var(--text-strong);
  line-height: 1.35;
}

/* =========================================
   Desktop compare table
========================================= */
.compare-table-card {
  margin-bottom: 16px;
  overflow: hidden;
}

.table-card-head {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: #fafaf8;
}

.table-card-head h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 900;
  color: var(--text-strong);
}

.table-card-head p {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
}

.compare-table-scroll {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  background: #fff;
}

.compare-table {
  width: 100%;
  min-width: 880px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12px;
}

.compare-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 12px 12px;
  background: #f3f5f2;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid #e6ebe6;
  text-align: left;
  font-size: 12px;
  color: #4f5b69;
  font-weight: 900;
  white-space: nowrap;
}

.compare-table thead th:first-child {
  position: sticky;
  left: 0;
  z-index: 4;
  min-width: 160px;
  background: #eef2ee;
}

.compare-table thead th:last-child {
  border-right: none;
}

.compare-table tbody td {
  padding: 12px;
  vertical-align: top;
  background: #fff;
  border-bottom: 1px solid #e8ede8;
  border-right: 1px solid #eef2ee;
}

.compare-table tbody td:last-child {
  border-right: none;
}

.compare-table tbody td.row-label {
  position: sticky;
  left: 0;
  z-index: 1;
  background: #f8faf8;
  font-size: 12px;
  font-weight: 900;
  color: #5c6777;
  white-space: nowrap;
}

.cell-title {
  margin-top: 8px;
  font-size: 12px;
  line-height: 1.65;
  color: #1f2937;
  font-weight: 800;
}

.cell-sub {
  margin-top: 4px;
  font-size: 11px;
  line-height: 1.65;
  color: #6b7280;
}

/* =========================================
   Mobile compare cards
========================================= */
.compare-mobile-section {
  display: none;
  margin-bottom: 16px;
}

.compare-mobile-list {
  display: grid;
  gap: 10px;
}

.compare-mobile-card {
  overflow: visible;
  background: #fff;
}

.compare-mobile-card summary {
  list-style: none;
  cursor: pointer;
  padding: 14px;
  background: #fff;
  border-radius: inherit;
  transition: box-shadow 0.15s ease, background 0.15s ease;
}

.compare-mobile-card summary::-webkit-details-marker {
  display: none;
}

.compare-mobile-card[open] > summary {
  position: sticky;
  top: var(--mobile-accordion-top);
  z-index: 8;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid #edf1ed;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
}

.compare-mobile-summary-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.compare-mobile-row-label {
  margin: 0;
  font-size: 15px;
  line-height: 1.35;
  color: var(--text-strong);
  font-weight: 900;
}

.compare-mobile-summary-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.count-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 28px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  border: 1px solid transparent;
}

.count-chip.good {
  color: var(--compare-good);
  background: var(--compare-good-bg);
}

.count-chip.part {
  color: var(--compare-part);
  background: var(--compare-part-bg);
}

.count-chip.none {
  color: var(--compare-none);
  background: var(--compare-none-bg);
}

.compare-mobile-chevron {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: #f5f7f5;
  border: 1px solid #e2e7e2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #657184;
  font-size: 14px;
  flex: 0 0 28px;
  transition: transform 0.18s ease;
}

.compare-mobile-card[open] .compare-mobile-chevron {
  transform: rotate(180deg);
}

.compare-mobile-body {
  padding: 0 14px 14px;
  background: #fcfcfa;
}

.mobile-pref-item {
  padding: 12px 0;
  border-bottom: 1px solid #e8ece8;
  scroll-margin-top: calc(var(--mobile-accordion-top) + 16px);
}

.mobile-pref-item:last-child {
  border-bottom: none;
}

.mobile-pref-item[data-slot="0"] {
  border-left: 4px solid var(--slot-0);
  padding-left: 10px;
}

.mobile-pref-item[data-slot="1"] {
  border-left: 4px solid var(--slot-1);
  padding-left: 10px;
}

.mobile-pref-item[data-slot="2"] {
  border-left: 4px solid var(--slot-2);
  padding-left: 10px;
}

.mobile-pref-item[data-slot="3"] {
  border-left: 4px solid var(--slot-3);
  padding-left: 10px;
}

.mobile-pref-top {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.mobile-pref-name {
  font-size: 13px;
  font-weight: 900;
  color: var(--text-strong);
}

.mobile-pref-body {
  margin-top: 8px;
  padding-left: 32px;
}

.mobile-pref-title {
  font-size: 13px;
  line-height: 1.65;
  color: #1f2937;
  font-weight: 800;
}

.mobile-pref-sub {
  margin-top: 4px;
  font-size: 12px;
  line-height: 1.65;
  color: #6b7280;
}

.mobile-compare-head {
  margin-bottom: 10px;
  padding: 0 2px;
}

.mobile-compare-head h3 {
  margin: 0;
  font-size: 16px;
  color: var(--text-strong);
  font-weight: 900;
}

.mobile-compare-head p {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
}

/* =========================================
   Detail cards
========================================= */
.detail-grid {
  display: grid;
  gap: 14px;
  margin-bottom: 16px;
}

.compare-detail-card {
  overflow: hidden;
}

.compare-detail-card[data-slot="0"] {
  border-color: var(--slot-0-line);
}

.compare-detail-card[data-slot="1"] {
  border-color: var(--slot-1-line);
}

.compare-detail-card[data-slot="2"] {
  border-color: var(--slot-2-line);
}

.compare-detail-card[data-slot="3"] {
  border-color: var(--slot-3-line);
}

.detail-head {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line-strong);
  background: var(--bg-head);
  display: flex;
  gap: 14px;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
}

.compare-detail-card[data-slot="0"] .detail-head {
  background: linear-gradient(180deg, #ffffff 0%, var(--slot-0-bg) 100%);
  border-bottom-color: var(--slot-0-line);
}

.compare-detail-card[data-slot="1"] .detail-head {
  background: linear-gradient(180deg, #ffffff 0%, var(--slot-1-bg) 100%);
  border-bottom-color: var(--slot-1-line);
}

.compare-detail-card[data-slot="2"] .detail-head {
  background: linear-gradient(180deg, #ffffff 0%, var(--slot-2-bg) 100%);
  border-bottom-color: var(--slot-2-line);
}

.compare-detail-card[data-slot="3"] .detail-head {
  background: linear-gradient(180deg, #ffffff 0%, var(--slot-3-bg) 100%);
  border-bottom-color: var(--slot-3-line);
}

.detail-pref-wrap {
  display: flex;
  gap: 10px;
  align-items: center;
  min-width: 0;
}

.detail-pref-name {
  margin: 0;
  font-size: 16px;
  line-height: 1.2;
  font-weight: 900;
}

.detail-pref-region {
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
}

.detail-budget {
  min-width: 160px;
  text-align: right;
}

.detail-budget .label {
  display: block;
  font-size: 11px;
  color: #5e6675;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.detail-budget strong {
  display: block;
  margin-top: 4px;
  font-size: clamp(20px, 3vw, 26px);
  line-height: 1.15;
  font-weight: 900;
  letter-spacing: -0.02em;
}

.compare-detail-card[data-slot="0"] .detail-budget strong { color: var(--slot-0); }
.compare-detail-card[data-slot="1"] .detail-budget strong { color: var(--slot-1); }
.compare-detail-card[data-slot="2"] .detail-budget strong { color: var(--slot-2); }
.compare-detail-card[data-slot="3"] .detail-budget strong { color: var(--slot-3); }

.detail-body {
  padding: 8px 16px 14px;
}

.detail-row {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) fit-content(240px);
  gap: 10px;
  align-items: start;
  padding: 12px 0;
  border-bottom: 1px solid #e7ece7;
}

.detail-row:last-child {
  border-bottom: none;
}

.detail-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  margin-top: 10px;
}

.detail-text {
  min-width: 0;
  font-size: 13px;
  line-height: 1.75;
  color: #1f2937;
  font-weight: 700;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.detail-amt {
  min-width: 0;
  max-width: 240px;
  justify-self: end;
  text-align: right;
  font-size: clamp(14px, 1.5vw, 18px);
  line-height: 1.35;
  font-weight: 900;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
  padding: 6px 10px;
  border-radius: 12px;
  letter-spacing: 0;
}

.detail-amt.text-0 {
  color: var(--slot-0);
  background: rgba(66, 133, 244, 0.08);
  border: 1px solid rgba(66, 133, 244, 0.18);
}

.detail-amt.text-1 {
  color: var(--slot-1);
  background: rgba(234, 67, 53, 0.08);
  border: 1px solid rgba(234, 67, 53, 0.18);
}

.detail-amt.text-2 {
  color: var(--slot-2);
  background: rgba(213, 163, 0, 0.09);
  border: 1px solid rgba(213, 163, 0, 0.2);
}

.detail-amt.text-3 {
  color: var(--slot-3);
  background: rgba(52, 168, 83, 0.08);
  border: 1px solid rgba(52, 168, 83, 0.18);
}

.detail-more {
  margin-top: 10px;
  border-top: 1px dashed #d9dfd9;
  padding-top: 10px;
}

.detail-more summary {
  list-style: none;
  cursor: pointer;
  color: #356b5a;
  font-size: 13px;
  font-weight: 900;
}

.detail-more summary::-webkit-details-marker {
  display: none;
}

.detail-more summary::after {
  content: "＋";
  margin-left: 8px;
  color: #6b7280;
}

.detail-more[open] summary::after {
  content: "−";
}

/* =========================================
   Legend / badges / note
========================================= */
.compare-legend {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.legend-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid #dde3e8;
  font-size: 12px;
  color: #5d6877;
}

.legend-badge,
.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 10px;
  line-height: 1;
  font-weight: 900;
  white-space: nowrap;
}

.legend-badge.good,
.status-badge.good {
  background: var(--compare-good-bg);
  color: var(--compare-good);
}

.legend-badge.part,
.status-badge.part {
  background: var(--compare-part-bg);
  color: var(--compare-part);
}

.legend-badge.none,
.status-badge.none {
  background: var(--compare-none-bg);
  color: var(--compare-none);
}

.compare-help {
  display: grid;
  gap: 10px;
  margin-top: 6px;
}

.help-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: var(--shadow-soft-sm);
  overflow: hidden;
}

.help-card summary {
  list-style: none;
  cursor: pointer;
  padding: 14px 16px;
  font-size: 14px;
  font-weight: 900;
  color: var(--text-strong);
}

.help-card summary::-webkit-details-marker {
  display: none;
}

.help-card summary::after {
  content: "＋";
  float: right;
  color: #7d8797;
}

.help-card[open] summary::after {
  content: "−";
}

.help-card-body {
  padding: 0 16px 16px;
  border-top: 1px solid #edf1ed;
}

.help-list {
  margin: 12px 0 0;
  padding-left: 18px;
  color: #4b5563;
  font-size: 13px;
  line-height: 1.8;
}

.compare-note {
  margin: 12px 0 0;
  color: #55606f;
  font-size: 13px;
  line-height: 1.9;
}

/* =========================================
   Modal
========================================= */
.compare-modal {
  width: min(96vw, 980px);
  max-width: 980px;
  border: none;
  padding: 0;
  background: transparent;
}

.compare-modal::backdrop {
  background: rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(4px);
}

.compare-modal-card {
  background: #fff;
  border-radius: 22px;
  overflow: hidden;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.18);
  border: 1px solid rgba(220, 227, 220, 0.95);
}

.compare-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 18px 14px;
  border-bottom: 1px solid #e8ede8;
  background: #fbfcfa;
}

.compare-modal-head h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
  color: var(--text-strong);
}

.compare-modal-head p {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  font-size: 20px;
  color: #5e6675;
}

.compare-modal-body {
  padding: 16px 18px 18px;
  max-height: min(78vh, 860px);
  overflow: auto;
}

.dialog-selection-summary {
  margin-bottom: 14px;
  padding: 12px;
  border-radius: 14px;
  background: #fafaf8;
  border: 1px solid #e5eae5;
  font-size: 13px;
  color: #55606f;
  line-height: 1.7;
}

.pref-filter-row {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) 220px auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
}

.soft-input,
.soft-select {
  width: 100%;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 14px;
  border: 1px solid #d6ddd6;
  background: #fff;
  color: var(--text-strong);
  font: inherit;
  outline: none;
}

.soft-input:focus,
.soft-select:focus {
  border-color: rgba(47, 143, 99, 0.45);
  box-shadow: 0 0 0 4px rgba(47, 143, 99, 0.08);
}

.modal-clear-btn {
  min-width: 110px;
}

.pref-section + .pref-section {
  margin-top: 16px;
}

.pref-section-label {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.06em;
  color: #7a8492;
  text-transform: uppercase;
}

.pref-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.pref-card {
  border: 1px solid #d8ded8;
  border-radius: 16px;
  background: #fff;
  padding: 12px;
  text-align: left;
  font: inherit;
  color: var(--text-strong);
  box-shadow: var(--shadow-soft-sm);
  cursor: pointer;
}

.pref-card:hover {
  background: #f9fbf8;
}

.pref-card.is-selected[data-slot="0"] {
  border-color: var(--slot-0-line);
  background: var(--slot-0-bg);
}

.pref-card.is-selected[data-slot="1"] {
  border-color: var(--slot-1-line);
  background: var(--slot-1-bg);
}

.pref-card.is-selected[data-slot="2"] {
  border-color: var(--slot-2-line);
  background: var(--slot-2-bg);
}

.pref-card.is-selected[data-slot="3"] {
  border-color: var(--slot-3-line);
  background: var(--slot-3-bg);
}

.pref-card.is-disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.pref-card.is-coming {
  cursor: default;
  opacity: 0.78;
  background: #fafafa;
}

.pref-card-top {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pref-card-name {
  margin: 0;
  font-size: 14px;
  line-height: 1.2;
  font-weight: 900;
  color: var(--text-strong);
}

.pref-card-region {
  margin-top: 2px;
  font-size: 11px;
  color: var(--muted);
}

.pref-card-note {
  margin-top: 8px;
  font-size: 11px;
  color: #667085;
  line-height: 1.6;
}

.pref-card-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #b8c0cd;
  flex: 0 0 10px;
}

.pref-no-result {
  padding: 14px;
  border-radius: 14px;
  background: #fafaf8;
  color: var(--muted);
  font-size: 13px;
  border: 1px dashed #d4dad4;
}

/* =========================================
   Floating button
========================================= */
.floating-pref-btn {
  position: fixed;
  right: 14px;
  bottom: calc(14px + var(--safe-bottom));
  z-index: 45;
  min-height: 48px;
  padding: 0 16px;
  border: none;
  border-radius: 999px;
  background: #111827;
  color: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 900;
  box-shadow: 0 14px 32px rgba(17, 24, 39, 0.25);
  cursor: pointer;
}

/* =========================================
   Utilities / notices
========================================= */
.partial-load-note {
  margin-bottom: 14px;
  padding: 14px 16px;
  border-radius: var(--radius-lg);
  background: #fffaf3;
  border: 1px solid #f4ddb3;
  color: #7a5a1a;
  font-size: 13px;
  line-height: 1.8;
  box-shadow: var(--shadow-soft-sm);
}

/* =========================================
   Responsive
========================================= */
@media (min-width: 861px) {
  .theme-switcher {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .theme-tab {
    min-height: 58px;
  }

  .theme-tab-label {
    font-size: 14px;
  }

  .score-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .detail-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .floating-pref-btn {
    display: none;
  }

  .selected-rail-scroll-note {
    display: none;
  }
}

@media (max-width: 1080px) {
  .detail-row {
    grid-template-columns: 12px minmax(0, 1fr);
  }

  .detail-amt {
    grid-column: 2;
    justify-self: start;
    text-align: left;
    margin-top: 4px;
    max-width: 100%;
  }
}

@media (min-width: 1100px) {
  .score-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .compare-table-card {
    display: none;
  }

  .compare-mobile-section {
    display: block;
  }

  .score-grid,
  .detail-grid {
    grid-template-columns: 1fr !important;
  }

  .pref-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .pref-filter-row {
    grid-template-columns: 1fr 1fr;
  }

  .modal-clear-btn {
    grid-column: 1 / -1;
    width: fit-content;
  }
}

@media (max-width: 640px) {
  .compare-page {
    padding: 0 8px calc(92px + var(--safe-bottom));
  }

  .compare-hero-inner,
  .compare-toolbar {
    border-radius: 18px;
  }

  .hero-title {
    font-size: 25px;
  }

  .hero-sub {
    font-size: 12px;
  }

  .compare-hero-copy {
    font-size: 12px;
    line-height: 1.7;
  }

  .toolbar-topline {
    align-items: flex-start;
  }

  .selected-rail-head {
    align-items: stretch;
    flex-direction: column;
  }

  .selected-rail-head .primary-btn {
    width: 100%;
  }

  .theme-tab {
    min-height: 54px;
    padding: 9px 10px;
  }

  .theme-tab-icon {
    width: 32px;
    height: 32px;
    flex-basis: 32px;
  }

  .theme-tab-label {
    font-size: 12.5px;
  }

  .score-highlight strong {
    font-size: 14px;
  }

  .detail-head {
    padding: 12px 14px;
  }

  .detail-budget {
    text-align: left;
    min-width: 0;
  }

  .detail-budget strong {
    font-size: clamp(18px, 6vw, 24px);
  }

  .detail-body {
    padding: 8px 14px 14px;
  }

  .detail-row {
    grid-template-columns: 12px 1fr;
  }

  .detail-amt {
    grid-column: 2;
    justify-self: start;
    text-align: left;
    padding-left: 10px;
    margin-top: 4px;
    width: fit-content;
    max-width: 100%;
  }

  .compare-modal-card {
    border-radius: 18px;
  }

  .compare-modal-head {
    padding: 16px 16px 12px;
  }

  .compare-modal-body {
    padding: 14px 16px 16px;
  }

  .pref-grid {
    grid-template-columns: 1fr;
  }

  .pref-filter-row {
    grid-template-columns: 1fr;
  }

  .floating-pref-btn {
    left: 12px;
    right: 12px;
    width: auto;
    justify-content: center;
  }
}

@media (max-width: 420px) {
  .toolbar-pill {
    padding: 7px 10px;
  }

  .selected-chip {
    min-height: 40px;
    padding: 8px 10px 8px 8px;
  }

  .compare-mobile-body {
    padding: 0 12px 12px;
  }

  .compare-mobile-card summary {
    padding: 12px;
  }

  .theme-tab {
    gap: 8px;
  }

  .theme-tab-label {
    font-size: 12px;
  }
}