/* ============================================================
   全国 坪単価マップ — Modern UI
   ============================================================ */

:root {
  color-scheme: light;

  /* Light palette (greige bg + white surfaces) */
  --bg: #faf4ea;
  --bg-grad-1: #faf4ea;
  --bg-grad-2: #faf4ea;
  --surface: #ffffff;
  --surface-2: #f1ede5;
  --surface-hover: #faf8f3;
  --border: rgba(60, 50, 35, 0.12);
  --border-strong: rgba(60, 50, 35, 0.22);
  --text: #2a2520;
  --text-muted: #6e655a;
  --text-soft: #a39a8d;

  --accent: #4a5d70;
  --accent-hover: #344554;
  --accent-soft: rgba(74, 93, 112, 0.08);
  --accent-ring: rgba(74, 93, 112, 0.22);

  --danger: #b04a3e;
  --danger-bg: #f7ece8;
  --danger-border: #e6cdc4;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;

  --shadow-xs: 0 1px 2px rgba(60, 50, 35, 0.05);
  --shadow-sm: 0 2px 6px rgba(60, 50, 35, 0.05), 0 1px 2px rgba(60, 50, 35, 0.04);
  --shadow-md: 0 8px 24px -10px rgba(60, 50, 35, 0.14), 0 2px 6px rgba(60, 50, 35, 0.07);
  --shadow-lg: 0 18px 44px -18px rgba(60, 50, 35, 0.22), 0 4px 12px rgba(60, 50, 35, 0.08);

  --easing: cubic-bezier(0.4, 0, 0.2, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background:
    radial-gradient(ellipse at top, var(--bg-grad-1) 0%, var(--bg-grad-2) 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI",
               "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Meiryo",
               "Noto Sans JP", sans-serif;
  font-feature-settings: "palt" 1;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  min-height: 100vh;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s var(--easing);
}
a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* -------- Header -------- */
.site-header {
  padding: 3.25rem 1.25rem 2rem;
  text-align: center;
  background: transparent;
}
.site-header h1 {
  margin: 0;
  font-size: clamp(1.4rem, 3vw, 1.75rem);
  font-weight: 600;
  letter-spacing: -0.005em;
  color: var(--text);
}
.site-tagline {
  margin: 0.45rem 0 0;
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 400;
  letter-spacing: 0.01em;
}

/* -------- Main container -------- */
.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0.5rem 1.25rem 2rem;
}

/* -------- Controls (sticky search/filter bar) -------- */
.controls {
  position: sticky;
  top: 0.75rem;
  z-index: 10;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
  padding: 0.9rem 1rem;
  display: grid;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.search-form {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}
.search-form .search { flex: 1; min-width: 0; }
.search-button {
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0 1.4rem;
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent);
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s var(--easing), border-color 0.15s var(--easing);
}
.search-button:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}
.search-button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px var(--accent-ring);
}

.search {
  position: relative;
  display: block;
}
.search::before {
  content: "";
  position: absolute;
  left: 1rem;
  top: 50%;
  width: 18px;
  height: 18px;
  transform: translateY(-50%);
  background-color: var(--text-muted);
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='7'/><path d='m21 21-4.3-4.3'/></svg>") no-repeat center / contain;
          mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='7'/><path d='m21 21-4.3-4.3'/></svg>") no-repeat center / contain;
  pointer-events: none;
}
.search input {
  width: 100%;
  font: inherit;
  font-size: 1rem;
  padding: 0.75rem 1rem 0.75rem 2.6rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text);
  transition: border-color 0.15s var(--easing),
              background 0.15s var(--easing),
              box-shadow 0.15s var(--easing);
}
.search input::placeholder { color: var(--text-soft); }
.search input:hover { border-color: var(--border-strong); }
.search input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 4px var(--accent-ring);
}

.filters {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.filters label {
  display: flex;
  flex-direction: column;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
  gap: 0.3rem;
  flex: 1 1 180px;
  min-width: 0;
}
.filters select {
  font: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  padding: 0.55rem 2.2rem 0.55rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background-color: var(--surface);
  color: var(--text);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 0.7rem center;
  background-size: 16px;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  transition: border-color 0.15s var(--easing), box-shadow 0.15s var(--easing);
}
.filters select:hover { border-color: var(--border-strong); }
.filters select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-ring);
}

/* -------- Stats line -------- */
.stats {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  margin: 0 0.25rem 0.75rem;
  padding: 0;
}

/* -------- Help panel (項目の見方) -------- */
.help-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 1rem;
  overflow: hidden;
  transition: border-color 0.15s var(--easing);
}
.help-panel[open] {
  border-color: var(--border-strong);
}
.help-panel summary {
  cursor: pointer;
  list-style: none;
  padding: 0.7rem 1rem;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  user-select: none;
  width: 100%;
  box-sizing: border-box;
  transition: background 0.15s var(--easing);
}
.help-panel summary::-webkit-details-marker { display: none; }
.help-panel summary::after {
  content: "";
  width: 14px;
  height: 14px;
  margin-left: auto;
  background-color: var(--text-muted);
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>") no-repeat center / contain;
          mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>") no-repeat center / contain;
  transition: transform 0.2s var(--easing);
}
.help-panel[open] summary::after { transform: rotate(180deg); }
.help-panel summary:hover { background: var(--surface-hover); }
.help-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25em;
  height: 1.25em;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-style: normal;
  font-size: 0.9em;
  font-weight: 700;
}
.help-list {
  margin: 0;
  padding: 0.4rem 1rem 1rem;
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.45rem 1rem;
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
}
.help-list dt {
  font-weight: 700;
  color: var(--text);
  padding-top: 0.05rem;
  white-space: nowrap;
}
.help-list code {
  font-family: "SFMono-Regular", "Consolas", monospace;
  font-size: 0.85em;
  font-weight: 600;
  padding: 0.05em 0.35em;
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--text);
}
.help-list dd {
  margin: 0;
  color: var(--text-muted);
  line-height: 1.6;
}
.help-source {
  margin: 0 1rem 0.85rem;
  font-size: 0.75rem;
  color: var(--text-soft);
  line-height: 1.55;
}

@media (max-width: 520px) {
  .help-list {
    grid-template-columns: 1fr;
    gap: 0.15rem 0;
  }
  .help-list dt { padding-top: 0.6rem; }
  .help-list dt:first-of-type { padding-top: 0; }
}

/* -------- Results grid -------- */
.results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 0.85rem;
}

@keyframes fade-up {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 1.15rem 1.2rem;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.4rem 1rem;
  align-items: baseline;
  overflow: hidden;
  transition: transform 0.2s var(--easing),
              box-shadow 0.2s var(--easing),
              border-color 0.2s var(--easing),
              background 0.2s var(--easing);
  animation: fade-up 0.25s var(--easing) both;
}
.card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
  background: var(--surface-hover);
}

.card .location {
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.card .location::before {
  content: "";
  width: 12px;
  height: 12px;
  background-color: currentColor;
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'><path d='M20 10c0 7-8 12-8 12s-8-5-8-12a8 8 0 0 1 16 0Z'/><circle cx='12' cy='10' r='3'/></svg>") no-repeat center / contain;
          mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'><path d='M20 10c0 7-8 12-8 12s-8-5-8-12a8 8 0 0 1 16 0Z'/><circle cx='12' cy='10' r='3'/></svg>") no-repeat center / contain;
  opacity: 0.7;
  flex-shrink: 0;
}
.card .district {
  font-size: 1.18rem;
  font-weight: 700;
  letter-spacing: -0.005em;
  margin: 0.15rem 0 0;
  color: var(--text);
}

.card .price {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  white-space: nowrap;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.card .price .unit {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-left: 0.25rem;
}

.estimate-inputs {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding-top: 0.5rem;
  border-top: 1px dashed var(--border);
}
.estimate-inputs-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
  flex-shrink: 0;
}
.estimate-input {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
}
.estimate-input > span:first-child {
  color: var(--text-muted);
  font-size: 0.8rem;
}
.estimate-input input {
  font: inherit;
  font-variant-numeric: tabular-nums;
  width: 4.2rem;
  padding: 0.4rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  text-align: right;
  transition: border-color 0.15s var(--easing), box-shadow 0.15s var(--easing);
  appearance: textfield;
  -moz-appearance: textfield;
}
.estimate-input input::-webkit-outer-spin-button,
.estimate-input input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.estimate-input input:hover { border-color: var(--border-strong); }
.estimate-input input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-ring);
}
.estimate-input-unit {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.estimate-row-label small {
  display: block;
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: none;
  color: var(--text-soft);
  margin-top: 0.15rem;
}

.estimate-row {
  grid-column: 1 / -1;
  margin-top: 0.5rem;
  padding: 0.7rem 0.8rem;
  background: var(--surface-2);
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}
.estimate-row-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  text-transform: uppercase;
  flex-shrink: 0;
}
.estimate-chips {
  display: flex;
  gap: 0.4rem;
  flex: 1;
  flex-wrap: wrap;
}
.estimate-chip {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.3rem 0.6rem;
  min-width: 5.5rem;
  flex: 1;
}
.estimate-chip-label {
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}
.estimate-chip-value {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  margin-top: 0.1rem;
}

.card-footer {
  grid-column: 1 / -1;
  margin-top: 0.4rem;
  padding-top: 0.7rem;
  border-top: 1px dashed var(--border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 0.9rem;
}
.card .meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.85rem;
  font-variant-numeric: tabular-nums;
  flex: 1;
  min-width: 0;
  margin: 0;
}
.card .meta span {
  display: inline-flex;
  align-items: baseline;
}
.card .meta span::before {
  content: none;
  margin: 0;
}

.card-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}

.estimate-open-btn {
  font: inherit;
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  padding: 0.35rem 0.8rem;
  background: var(--surface);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 0.15s var(--easing),
              border-color 0.15s var(--easing),
              color 0.15s var(--easing);
}
.estimate-open-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.compare-toggle {
  font: inherit;
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  padding: 0.35rem 0.8rem;
  background: var(--surface);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 0.15s var(--easing),
              border-color 0.15s var(--easing),
              color 0.15s var(--easing);
}
.compare-toggle:hover:not([disabled]) {
  border-color: var(--accent);
  color: var(--accent);
}
.compare-toggle.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.compare-toggle.active:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.compare-toggle[disabled] { opacity: 0.4; cursor: not-allowed; }

/* -------- Empty / error states -------- */
.empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  font-size: 0.95rem;
}
.error {
  grid-column: 1 / -1;
  padding: 1rem 1.15rem;
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  border-radius: var(--radius);
  color: var(--danger);
  font-size: 0.92rem;
}

/* -------- Pager -------- */
.pager {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1.5rem;
}
.pager button {
  font: inherit;
  font-weight: 600;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.5rem 1.1rem;
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s var(--easing),
              border-color 0.15s var(--easing),
              transform 0.1s var(--easing),
              box-shadow 0.15s var(--easing);
}
.pager button:hover:not([disabled]) {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}
.pager button:active:not([disabled]) { transform: translateY(1px); }
.pager button[disabled] { opacity: 0.4; cursor: not-allowed; }
.pager .info {
  padding: 0.35rem 0.85rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

/* -------- Footer -------- */
.site-footer {
  max-width: 1080px;
  margin: 2rem auto 2.5rem;
  padding: 1.5rem 1.25rem 0;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.82rem;
  text-align: center;
}
.site-footer p { margin: 0.3rem 0; }

/* -------- Compare bar (fixed bottom) -------- */
.compare-bar {
  position: fixed;
  left: 50%;
  bottom: 1rem;
  transform: translateX(-50%);
  z-index: 50;
  width: min(1080px, calc(100% - 2rem));
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 0.85rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: wrap;
  animation: fade-up 0.2s var(--easing) both;
}
.compare-bar[hidden] { display: none; }
.compare-bar-info {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}
.compare-bar-info .compare-count {
  display: inline-block;
  min-width: 1.7em;
  padding: 0.15em 0.45em;
  background: var(--accent);
  color: #fff;
  border-radius: 999px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.compare-bar-label {
  font-weight: 500;
  color: var(--text-muted);
  font-size: 0.78rem;
}
.compare-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  flex: 1;
  min-width: 0;
}
.compare-chip {
  font: inherit;
  font-size: 0.78rem;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.3rem 0.75rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  max-width: 14rem;
  transition: border-color 0.15s var(--easing), color 0.15s var(--easing);
}
.compare-chip .chip-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.compare-chip .chip-x {
  font-size: 0.7rem;
  opacity: 0.55;
  flex-shrink: 0;
}
.compare-chip:hover {
  border-color: var(--danger);
  color: var(--danger);
}
.compare-chip:hover .chip-x { opacity: 1; }
.compare-bar-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  flex-shrink: 0;
}
.compare-clear {
  font: inherit;
  font-size: 0.8rem;
  background: transparent;
  color: var(--text-muted);
  border: 0;
  cursor: pointer;
  padding: 0.3rem 0.2rem;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.compare-clear:hover { color: var(--danger); }
.compare-open {
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 0.55rem 1.1rem;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s var(--easing), border-color 0.15s var(--easing);
}
.compare-open:hover:not([disabled]) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}
.compare-open[disabled] { opacity: 0.45; cursor: not-allowed; }

/* -------- Estimate dialog -------- */
.estimate-dialog {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 0;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-lg);
  max-width: min(560px, 95vw);
  width: 100%;
  max-height: 90vh;
  overflow: hidden;
}
.estimate-dialog::backdrop {
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.estimate-dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.2rem;
  border-bottom: 1px solid var(--border);
}
.estimate-dialog-header h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.005em;
}
.estimate-dialog-subtitle {
  margin: 0.15rem 0 0;
  color: var(--text-muted);
  font-size: 0.78rem;
}
.estimate-dialog-body {
  padding: 1rem 1.2rem 1.2rem;
  overflow: auto;
  max-height: calc(90vh - 80px);
}
.estimate-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: center;
  padding-bottom: 1rem;
  border-bottom: 1px dashed var(--border);
}
.estimate-form .estimate-input { margin: 0; }
.estimate-select {
  display: flex;
  flex-direction: column;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  gap: 0.3rem;
  flex: 1 1 220px;
  min-width: 200px;
}
.estimate-select select {
  font: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  padding: 0.5rem 2rem 0.5rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background-color: var(--surface);
  color: var(--text);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 0.6rem center;
  background-size: 14px;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}
.estimate-select select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-ring);
}

.estimate-breakdown {
  margin: 1rem 0 0;
  font-size: 0.88rem;
  font-variant-numeric: tabular-nums;
}
.estimate-breakdown .bd-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border);
}
.estimate-breakdown .bd-row dt {
  color: var(--text-muted);
  font-weight: 500;
  margin: 0;
}
.estimate-breakdown .bd-row dd {
  margin: 0;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  text-align: right;
}
.estimate-breakdown .bd-total {
  margin-top: 0.4rem;
  padding: 0.7rem 0.85rem;
  background: var(--accent-soft);
  border-radius: 10px;
  border: 0;
}
.estimate-breakdown .bd-total dt {
  font-weight: 700;
  color: var(--text);
  font-size: 0.92rem;
}
.estimate-breakdown .bd-total dt small {
  display: block;
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-top: 0.1rem;
}
.estimate-breakdown .bd-total dd { text-align: right; }
.estimate-breakdown .bd-total-yen {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: -0.01em;
}
.estimate-breakdown .bd-total dd small {
  display: block;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-top: 0.1rem;
}

.estimate-note {
  margin: 1rem 0 0;
  font-size: 0.72rem;
  color: var(--text-soft);
  line-height: 1.55;
}

/* -------- Compare dialog -------- */
.compare-dialog {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 0;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-lg);
  max-width: min(960px, 95vw);
  width: 100%;
  max-height: 90vh;
  overflow: hidden;
}
.compare-dialog::backdrop {
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.compare-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.2rem;
  border-bottom: 1px solid var(--border);
}
.compare-dialog-header h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.005em;
}
.dialog-close {
  font: inherit;
  background: transparent;
  border: 0;
  font-size: 1rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.3rem 0.55rem;
  border-radius: 8px;
  transition: background 0.15s var(--easing), color 0.15s var(--easing);
}
.dialog-close:hover { background: var(--surface-2); color: var(--text); }

.compare-table-wrapper {
  overflow: auto;
  max-height: calc(90vh - 60px);
}
.compare-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  font-variant-numeric: tabular-nums;
}
.compare-table th,
.compare-table td {
  padding: 0.7rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.compare-table thead th {
  background: var(--surface-2);
  font-weight: 700;
  position: sticky;
  top: 0;
  z-index: 1;
  min-width: 9rem;
}
.compare-table thead th small {
  display: block;
  font-weight: 500;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}
.compare-table tbody th {
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface);
  white-space: nowrap;
  position: sticky;
  left: 0;
  font-size: 0.82rem;
}
.compare-table td.highlight {
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
}

/* -------- Responsive -------- */
@media (max-width: 640px) {
  .site-header { padding: 2rem 1rem 1.5rem; }
  .container { padding: 0.25rem 0.85rem 1.5rem; }
  .controls {
    top: 0;
    border-radius: var(--radius);
    padding: 0.85rem 0.9rem;
  }
  .results { grid-template-columns: 1fr; }
  .card {
    grid-template-columns: 1fr;
    padding: 1rem;
  }
  .card .price { justify-self: start; font-size: 1.35rem; }
  .filters label { flex: 1 1 100%; }
  .search-button { padding: 0 1rem; font-size: 0.85rem; }
  .compare-bar {
    bottom: 0.5rem;
    width: calc(100% - 1rem);
    padding: 0.7rem 0.85rem;
  }
  .compare-bar-info { width: 100%; }
  .compare-chips { width: 100%; }
  .compare-bar-actions { width: 100%; justify-content: space-between; }
  .compare-table th,
  .compare-table td { padding: 0.55rem 0.7rem; font-size: 0.82rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

/* -------- Cookie consent banner -------- */
.cookie-banner {
  position: fixed;
  left: 50%;
  bottom: 1rem;
  transform: translateX(-50%);
  z-index: 100;
  width: min(640px, calc(100% - 2rem));
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 0.95rem 1.1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.8rem 1rem;
  animation: fade-up 0.2s var(--easing) both;
}
.cookie-banner[hidden] { display: none; }
.cookie-banner-text {
  margin: 0;
  flex: 1 1 280px;
  font-size: 0.82rem;
  color: var(--text);
  line-height: 1.55;
}
.cookie-banner-actions {
  display: inline-flex;
  gap: 0.5rem;
  flex-shrink: 0;
}
.cookie-banner-button {
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.45rem 1rem;
  border-radius: 999px;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  transition: background 0.15s var(--easing),
              border-color 0.15s var(--easing),
              color 0.15s var(--easing);
}
.cookie-banner-button-reject:hover {
  border-color: var(--border-strong);
  color: var(--text);
}
.cookie-banner-button-accept {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.cookie-banner-button-accept:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

@media (max-width: 520px) {
  .cookie-banner {
    bottom: 0.5rem;
    width: calc(100% - 1rem);
    padding: 0.85rem 0.95rem;
  }
  .cookie-banner-actions {
    width: 100%;
    justify-content: flex-end;
  }
}

/* -------- Legal article (disclaimer etc.) -------- */
.legal-article {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem 1.6rem;
  margin-top: 1rem;
}
.legal-article h1 {
  margin: 0 0 0.35rem;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.005em;
}
.legal-article h2 {
  margin: 1.75rem 0 0.6rem;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}
.legal-article h2:first-of-type { margin-top: 1.2rem; }
.legal-article p,
.legal-article ul {
  margin: 0 0 0.7rem;
  font-size: 0.92rem;
  line-height: 1.75;
  color: var(--text);
}
.legal-article ul { padding-left: 1.4rem; }
.legal-article li { margin-bottom: 0.25rem; }
.legal-article code {
  font-family: "SFMono-Regular", "Consolas", monospace;
  font-size: 0.86em;
  font-weight: 600;
  padding: 0.05em 0.4em;
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--text);
}
.legal-meta {
  margin: 0 0 1.4rem !important;
  color: var(--text-muted);
  font-size: 0.78rem !important;
}
.legal-back {
  text-align: center;
  margin: 1.5rem 0 0;
  font-size: 0.88rem;
}
@media (max-width: 520px) {
  .legal-article { padding: 1.3rem 1.1rem; }
  .legal-article h1 { font-size: 1.2rem; }
}

/* -------- Prefecture SSG pages (Phase 7a) -------- */
.site-breadcrumb {
  margin: 0 0 0.7rem;
  font-size: 0.82rem;
  color: var(--text-muted);
}
.site-breadcrumb a {
  color: var(--text-muted);
  text-decoration: none;
}
.site-breadcrumb a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.pref-summary {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem 1.4rem;
  margin: 0.5rem 0 1.5rem;
  font-size: 0.95rem;
  line-height: 1.8;
}
.pref-summary strong {
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.pref-search-cta {
  display: inline-block;
  margin-top: 0.7rem;
  padding: 0.5rem 1.1rem;
  background: var(--accent);
  color: #fff !important;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.88rem;
  text-decoration: none;
  transition: background 0.15s var(--easing);
}
.pref-search-cta:hover {
  background: var(--accent-hover);
  text-decoration: none;
}

.pref-section {
  margin: 1.8rem 0;
}
.pref-section h2 {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0 0 0.9rem;
  color: var(--text);
}
.pref-section-note {
  margin: 0.7rem 0 0;
  font-size: 0.78rem;
  color: var(--text-soft);
  line-height: 1.55;
}

.pref-top-list {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.2rem 1rem 2.4rem;
  margin: 0;
  font-size: 0.92rem;
}
.pref-top-list li {
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border);
  line-height: 1.55;
}
.pref-top-list li:last-child { border-bottom: 0; }
.pref-top-list strong {
  color: var(--text);
}
.pref-top-city {
  color: var(--text-muted);
  font-size: 0.85rem;
}
.pref-top-price {
  color: var(--accent);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.pref-top-meta {
  color: var(--text-soft);
  font-size: 0.78rem;
}

.pref-city-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.5rem;
}
.pref-city-list li {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.85rem;
  font-size: 0.88rem;
  line-height: 1.4;
  transition: border-color 0.15s var(--easing);
}
.pref-city-list li:hover {
  border-color: var(--accent);
}
.pref-city-list a {
  text-decoration: none;
}
.pref-city-list a strong {
  color: var(--text);
  display: block;
  margin-bottom: 0.15rem;
  font-size: 0.92rem;
}
.pref-city-list a:hover strong {
  color: var(--accent);
}

.pref-nav-section {
  background: var(--surface-2);
  border-radius: var(--radius);
  padding: 1rem 1.3rem;
}
.pref-nav-links {
  margin: 0;
  line-height: 2.2;
  font-size: 0.85rem;
}
.pref-nav-links a {
  color: var(--accent);
}

@media (max-width: 520px) {
  .pref-summary { padding: 1rem 1.1rem; }
  .pref-city-list { grid-template-columns: 1fr; }
}
