/* ============================================================
   HausMatch App · Stylesheet
   Pearl canvas + slate ink; one dark screen for the match moment.
   ============================================================ */

html, body { margin: 0; padding: 0; }
body { background: var(--bg-1); }
* { box-sizing: border-box; }

/* --- Design canvas container overrides --- */
.dc-root, .dc-canvas, .dc-artboard-body { font-family: var(--font-sans); }

/* --- Generic reset for screens on pearl --- */
.screen {
  width: 100%;
  height: 100%;
  background: var(--bg-0);
  color: var(--fg-1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: var(--font-sans);
}

/* ============================================================
   APPBAR
   ============================================================ */
.hm-appbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 40px;
  border-bottom: 1px solid var(--line-1);
  background: var(--bg-0);
  flex-shrink: 0;
}
.hm-appbar-nav {
  display: flex;
  gap: 28px;
}
.hm-appbar-link {
  font-size: 13px;
  color: var(--fg-3);
  cursor: pointer;
  padding: 4px 0;
  border-bottom: 1px solid transparent;
  transition: color var(--dur-2) var(--ease-out);
  letter-spacing: -0.005em;
}
.hm-appbar-link:hover { color: var(--fg-1); }
.hm-appbar-link.is-current {
  color: var(--fg-1);
  border-bottom-color: var(--fg-1);
}
.hm-appbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.hm-icon-btn {
  width: 34px; height: 34px;
  border-radius: var(--radius-pill);
  background: transparent;
  border: 1px solid transparent;
  display: grid; place-items: center;
  cursor: pointer;
  color: var(--fg-2);
  transition: background var(--dur-2) var(--ease-out);
}
.hm-icon-btn:hover { background: var(--bg-2); color: var(--fg-1); }
.hm-icon-btn-lg {
  width: 40px; height: 40px;
  border-radius: var(--radius-pill);
  background: var(--bg-1);
  border: 1px solid var(--line-1);
  display: grid; place-items: center;
  cursor: pointer;
  color: var(--fg-1);
}
.hm-icon-btn-lg:hover { background: var(--bg-2); }
.hm-avatar {
  width: 32px; height: 32px;
  border-radius: var(--radius-pill);
  background: var(--slate-900);
  color: var(--pearl-00);
  display: grid; place-items: center;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

/* ============================================================
   BUTTONS / CHIPS
   ============================================================ */
.hm-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-sans);
  font-weight: 500;
  letter-spacing: -0.005em;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform var(--dur-2) var(--ease-out),
              background var(--dur-2) var(--ease-out),
              color var(--dur-2) var(--ease-out),
              border-color var(--dur-2) var(--ease-out);
  white-space: nowrap;
}
.hm-btn:active { transform: translateY(1px); }
.hm-btn-sm { font-size: 12px; padding: 6px 14px; }
.hm-btn-md { font-size: 13px; padding: 10px 18px; }
.hm-btn-lg { font-size: 14px; padding: 14px 26px; }
.hm-btn-primary {
  background: var(--slate-900);
  color: var(--pearl-00);
  border-color: var(--slate-900);
}
.hm-btn-primary:hover { background: var(--slate-800); border-color: var(--slate-800); }
.hm-btn-secondary {
  background: transparent;
  color: var(--fg-1);
  border-color: var(--line-2);
}
.hm-btn-secondary:hover { background: var(--bg-2); border-color: var(--fg-1); }
.hm-btn-ghost {
  background: transparent;
  color: var(--fg-2);
  border-color: transparent;
}
.hm-btn-ghost:hover { color: var(--fg-1); background: var(--bg-2); }

.hm-chip {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  letter-spacing: 0.005em;
  line-height: 1.3;
  background: var(--pearl-100);
  color: var(--fg-2);
  border: 1px solid var(--line-1);
}
.hm-chip-sage { background: var(--sage-100); color: var(--sage-600); border-color: transparent; }
.hm-chip-ochre { background: var(--ochre-100); color: var(--ochre-600); border-color: transparent; }
.hm-chip-clay { background: var(--clay-100); color: var(--clay-600); border-color: transparent; }

.hm-eyebrow {
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--fg-3);
  display: inline-block;
}
.hm-eyebrow.is-muted { color: var(--fg-4); }

/* ============================================================
   MATCH BADGE
   ============================================================ */
.hm-match-badge {
  position: relative;
  display: grid;
  place-items: center;
  background: rgba(253, 252, 249, 0.92);
  backdrop-filter: blur(8px);
  border-radius: var(--radius-pill);
}
.hm-match-badge-pct {
  position: absolute;
  inset: 0;
  display: grid; place-items: center;
  font-family: var(--font-serif-italic);
  font-style: italic;
  font-size: 16px;
  color: var(--slate-900);
  line-height: 1;
  padding-top: 1px;
}

/* ============================================================
   LISTING CARD
   ============================================================ */
.hm-listing {
  background: var(--bg-0);
  border: 1px solid var(--line-1);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: transform var(--dur-2) var(--ease-out),
              box-shadow var(--dur-2) var(--ease-out),
              border-color var(--dur-2) var(--ease-out);
  display: flex;
  flex-direction: column;
}
.hm-listing:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-2);
  border-color: var(--line-2);
}
.hm-listing-photo {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--pearl-100);
}
.hm-listing-photo img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 800ms var(--ease-out);
}
.hm-listing:hover .hm-listing-photo img { transform: scale(1.03); }
.hm-listing-match {
  position: absolute;
  top: 12px; left: 12px;
}
.hm-listing-save {
  position: absolute;
  top: 12px; right: 12px;
  width: 32px; height: 32px;
  border-radius: var(--radius-pill);
  background: rgba(253, 252, 249, 0.88);
  backdrop-filter: blur(8px);
  border: none;
  display: grid; place-items: center;
  color: var(--fg-2);
  cursor: pointer;
  transition: color var(--dur-2);
}
.hm-listing-save:hover { color: var(--clay-600); }
.hm-listing-body {
  padding: 16px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.hm-listing-price {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 400;
  letter-spacing: -0.015em;
  color: var(--fg-1);
  line-height: 1.1;
}
.hm-listing-addr {
  font-size: 12.5px;
  color: var(--fg-2);
  margin-top: 4px;
}
.hm-listing-hood { color: var(--fg-4); }
.hm-listing-specs {
  display: flex;
  gap: 14px;
  font-size: 11.5px;
  color: var(--fg-3);
}
.hm-listing-specs span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.hm-listing-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.hm-listing-rationale {
  font-size: 11.5px;
  color: var(--fg-3);
  padding-top: 10px;
  border-top: 1px solid var(--line-1);
  line-height: 1.5;
}
.hm-rationale-label {
  font-family: var(--font-sans);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--fg-4);
  margin-right: 8px;
}
.hm-rationale-text {
  font-family: var(--font-serif-italic);
  font-style: italic;
  font-size: 13px;
  color: var(--fg-2);
}

/* ============================================================
   SCREEN 1 · STYLE QUIZ
   ============================================================ */
.quiz-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 40px 80px 32px;
  overflow: auto;
}
.quiz-head {
  text-align: center;
  max-width: 640px;
  margin: 0 auto 28px;
}
.quiz-title {
  font-family: var(--font-display);
  font-size: 52px;
  font-weight: 400;
  line-height: 1.08;
  letter-spacing: -0.02em;
  margin: 10px 0 10px;
  color: var(--fg-1);
}
.quiz-sub {
  font-size: 14px;
  color: var(--fg-3);
  margin: 0;
}
.quiz-pair {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  min-height: 0;
}
.quiz-card {
  background: none;
  border: 1.5px solid var(--line-1);
  border-radius: var(--radius-xl);
  padding: 0;
  cursor: pointer;
  overflow: hidden;
  transition: border-color var(--dur-2), transform var(--dur-2);
  position: relative;
}
.quiz-card:hover { border-color: var(--fg-1); }
.quiz-card.is-picked {
  border-color: var(--sage-600);
  transform: scale(0.99);
}
.quiz-card-photo {
  position: relative;
  width: 100%;
  height: 100%;
}
.quiz-card-photo img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.quiz-card-letter {
  position: absolute;
  bottom: 18px; left: 20px;
  font-family: var(--font-display);
  font-size: 34px;
  color: var(--pearl-00);
  background: rgba(11, 12, 14, 0.4);
  backdrop-filter: blur(8px);
  width: 48px; height: 48px;
  display: grid; place-items: center;
  border-radius: var(--radius-pill);
  line-height: 1;
  padding-top: 2px;
}
.quiz-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 20px;
  border-top: 1px solid var(--line-1);
  margin-top: 24px;
}
.quiz-progress { display: flex; align-items: center; gap: 14px; }
.quiz-progress-bar { display: flex; gap: 6px; }
.quiz-progress-dot {
  width: 28px; height: 2px;
  background: var(--line-2);
  border-radius: 1px;
  transition: background var(--dur-2);
}
.quiz-progress-dot.is-past { background: var(--fg-1); }
.quiz-progress-dot.is-current { background: var(--sage-600); }
.quiz-actions { display: flex; gap: 8px; }
.quiz-skip {
  background: none;
  border: none;
  font-size: 12px;
  color: var(--fg-3);
  cursor: pointer;
  padding: 6px 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-sans);
}
.quiz-skip:hover { color: var(--fg-1); }
.quiz-skip:disabled { opacity: 0.4; cursor: default; }

/* ============================================================
   SCREEN 2 · UPLOAD
   ============================================================ */
.upload-main {
  flex: 1;
  padding: 56px 80px 40px;
  max-width: 1160px;
  width: 100%;
  margin: 0 auto;
  overflow: auto;
}
.upload-head {
  text-align: center;
  margin-bottom: 32px;
}
.upload-title {
  font-family: var(--font-display);
  font-size: 64px;
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin: 14px 0 16px;
  color: var(--fg-1);
  text-wrap: balance;
}
.upload-sub {
  font-size: 15px;
  color: var(--fg-3);
  max-width: 540px;
  margin: 0 auto;
  line-height: 1.55;
}
.upload-tabs {
  display: inline-flex;
  gap: 0;
  padding: 4px;
  background: var(--bg-1);
  border: 1px solid var(--line-1);
  border-radius: var(--radius-pill);
  margin: 0 auto 24px;
  display: flex;
  width: fit-content;
  margin-left: auto;
  margin-right: auto;
}
.upload-tab {
  background: none;
  border: none;
  font-size: 12.5px;
  color: var(--fg-3);
  padding: 8px 18px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  font-family: var(--font-sans);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background var(--dur-2), color var(--dur-2);
}
.upload-tab.is-active {
  background: var(--bg-0);
  color: var(--fg-1);
  box-shadow: var(--shadow-0);
}
.upload-dropzone {
  border: 1.5px dashed var(--line-2);
  border-radius: var(--radius-xl);
  padding: 48px;
  background: var(--bg-1);
  text-align: center;
  cursor: pointer;
  transition: border-color var(--dur-2), background var(--dur-2);
  max-width: 760px;
  margin: 0 auto;
}
.upload-dropzone:hover,
.upload-dropzone.is-hovering {
  border-color: var(--fg-1);
  background: var(--pearl-100);
}
.upload-icon {
  display: grid; place-items: center;
  width: 64px; height: 64px;
  margin: 0 auto 16px;
  border-radius: var(--radius-pill);
  background: var(--bg-0);
  color: var(--fg-2);
  border: 1px solid var(--line-1);
}
.upload-dropzone-title {
  font-family: var(--font-display);
  font-size: 26px;
  color: var(--fg-1);
  letter-spacing: -0.015em;
  margin-bottom: 8px;
}
.upload-dropzone-sub {
  font-size: 13px;
  color: var(--fg-3);
  margin-bottom: 32px;
}
.upload-browse {
  color: var(--fg-1);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.upload-sep { color: var(--fg-4); margin: 0 4px; }
.upload-examples {
  border-top: 1px solid var(--line-1);
  padding-top: 20px;
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.upload-example-row { display: flex; gap: 10px; }
.upload-example {
  width: 88px; height: 66px;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--line-1);
  background: var(--bg-2);
  cursor: pointer;
  padding: 0;
  transition: transform var(--dur-2), border-color var(--dur-2);
}
.upload-example img { width: 100%; height: 100%; object-fit: cover; display: block; }
.upload-example:hover { transform: scale(1.04); border-color: var(--fg-1); }

.upload-urlbox {
  max-width: 640px;
  margin: 0 auto;
}
.upload-url-input {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 8px 8px 18px;
  background: var(--bg-1);
  border: 1px solid var(--line-1);
  border-radius: var(--radius-pill);
  color: var(--fg-3);
}
.upload-url-input input {
  flex: 1;
  border: none;
  background: none;
  outline: none;
  font-size: 14px;
  padding: 10px 0;
  color: var(--fg-1);
  font-family: var(--font-sans);
}
.upload-url-hint {
  font-size: 12px;
  color: var(--fg-4);
  text-align: center;
  margin-top: 12px;
}

.upload-quiz-result {
  text-align: center;
  padding: 40px 20px;
  max-width: 640px;
  margin: 0 auto;
}
.upload-quiz-name {
  font-family: var(--font-display);
  font-size: 48px;
  margin: 16px 0 12px;
  line-height: 1.05;
}
.upload-quiz-name-plus {
  font-family: var(--font-sans);
  font-size: 24px;
  color: var(--fg-4);
  font-weight: 300;
  margin: 0 4px;
}
.upload-quiz-traits {
  font-size: 14px;
  color: var(--fg-3);
  margin-bottom: 28px;
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}
.upload-quiz-retake {
  display: block;
  margin-top: 16px;
  font-size: 12px;
  color: var(--fg-3);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.upload-trust {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 28px;
  padding: 40px 0 0;
  margin-top: 32px;
}
.upload-trust-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--fg-3);
}
.upload-trust-item .hm-mono {
  font-size: 10px;
  color: var(--fg-4);
  letter-spacing: 0.1em;
}
.upload-trust-divider {
  width: 1px;
  height: 14px;
  background: var(--line-2);
}

/* ============================================================
   SCREEN 3 · MATCHING (dark)
   ============================================================ */
.matching-screen {
  background: var(--slate-900);
  color: var(--pearl-00);
}
.matching-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 32px;
  border-bottom: 1px solid var(--line-dark);
}
.matching-cancel {
  background: none;
  border: 1px solid var(--line-dark);
  color: var(--slate-400);
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  font-size: 11.5px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-sans);
}
.matching-cancel:hover { color: var(--pearl-00); border-color: var(--slate-500); }
.matching-stage {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 40px;
  padding: 40px;
  overflow: hidden;
}
.matching-image-wrap {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--slate-800);
  min-height: 0;
}
.matching-image-wrap img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  filter: brightness(0.72) contrast(1.08);
}
.matching-scanline {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(180deg, rgba(255,255,255,0) 0%, rgba(227, 234, 228, 0.9) 50%, rgba(255,255,255,0) 100%);
  box-shadow: 0 0 24px rgba(227, 234, 228, 0.6);
  animation: matching-scan 2.2s var(--ease-in-out) infinite;
}
@keyframes matching-scan {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(100%); }
}
.matching-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, rgba(255,255,255,0.04) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,0.04) 1px, transparent 1px);
  background-size: 64px 64px;
  pointer-events: none;
}
.matching-annotations { position: absolute; inset: 0; pointer-events: none; }
.matching-anno {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 8px;
  opacity: 0;
  transform: translateX(-8px);
  transition: opacity 600ms var(--ease-out), transform 600ms var(--ease-out);
}
.phase-1 .matching-anno,
.phase-2 .matching-anno,
.phase-3 .matching-anno {
  opacity: 1;
  transform: translateX(0);
}
.phase-1 .anno-roof { transition-delay: 0ms; }
.phase-1 .anno-material { transition-delay: 180ms; }
.phase-1 .anno-threshold { transition-delay: 360ms; }
.phase-1 .anno-palette { transition-delay: 540ms; }

.anno-dot {
  width: 10px; height: 10px;
  border-radius: var(--radius-pill);
  background: var(--pearl-00);
  box-shadow: 0 0 0 4px rgba(253, 252, 249, 0.16), 0 0 20px rgba(253, 252, 249, 0.4);
  flex-shrink: 0;
}
.anno-line {
  width: 22px;
  height: 1px;
  background: rgba(253, 252, 249, 0.4);
}
.anno-label {
  font-family: var(--font-serif-italic);
  font-style: italic;
  font-size: 14px;
  color: var(--pearl-00);
  background: rgba(11, 12, 14, 0.6);
  backdrop-filter: blur(8px);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.matching-side {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
}
.matching-side-head .hm-eyebrow { color: var(--slate-400); }
.matching-dna {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--line-dark);
}
.matching-dna-row {
  padding: 14px 0;
  border-bottom: 1px solid var(--line-dark);
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 12px;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 400ms var(--ease-out), transform 400ms var(--ease-out);
}
.matching-dna-row.is-visible { opacity: 1; transform: translateY(0); }
.matching-dna-label {
  font-size: 10px;
  color: var(--slate-400);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.matching-dna-value {
  font-family: var(--font-serif-italic);
  font-style: italic;
  font-size: 15px;
  color: var(--pearl-00);
  line-height: 1.3;
}
.matching-status {
  margin-top: auto;
  padding: 20px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--line-dark);
  border-radius: var(--radius-md);
}
.matching-status-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.matching-status-dot {
  width: 8px; height: 8px;
  border-radius: var(--radius-pill);
  background: var(--sage-600);
  box-shadow: 0 0 12px var(--sage-600);
  animation: pulse 1.4s var(--ease-in-out) infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
.matching-status-text {
  font-size: 13px;
  color: var(--pearl-00);
  font-family: var(--font-sans);
}
.matching-status-text em {
  font-family: var(--font-serif-italic);
  font-style: italic;
  font-size: 16px;
  color: var(--pearl-00);
  padding: 0 2px;
}
.matching-progress {
  height: 2px;
  background: var(--line-dark);
  border-radius: 1px;
  overflow: hidden;
}
.matching-progress-fill {
  display: block;
  height: 100%;
  background: var(--pearl-00);
  transition: width 700ms var(--ease-in-out);
}

/* ============================================================
   SCREEN 4 · RESULTS
   ============================================================ */
.results-main {
  flex: 1;
  padding: 40px 56px 60px;
  max-width: 1360px;
  width: 100%;
  margin: 0 auto;
  overflow: auto;
}
.results-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 40px;
  align-items: end;
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line-1);
}
.results-title {
  font-family: var(--font-display);
  font-size: 52px;
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin: 8px 0 14px;
  color: var(--fg-1);
}
.results-sub {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--fg-3);
  flex-wrap: wrap;
}
.results-sub strong { color: var(--fg-1); font-weight: 500; }
.results-sub-dot { color: var(--fg-4); }
.results-refine {
  color: var(--fg-1);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  font-weight: 500;
}
.results-reference {
  text-align: right;
}
.results-reference-label { margin-bottom: 8px; }
.results-reference img {
  width: 200px;
  height: 140px;
  object-fit: cover;
  border-radius: var(--radius-md);
  border: 1px solid var(--line-1);
  display: block;
}

.results-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  padding: 10px 0;
}
.results-toolbar-left { display: flex; gap: 2px; background: var(--bg-1); border: 1px solid var(--line-1); border-radius: var(--radius-pill); padding: 4px; }
.results-view-btn {
  background: none;
  border: none;
  padding: 6px 14px;
  font-size: 12px;
  color: var(--fg-3);
  cursor: pointer;
  border-radius: var(--radius-pill);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-sans);
}
.results-view-btn.is-active {
  background: var(--bg-0);
  color: var(--fg-1);
  box-shadow: var(--shadow-0);
}
.results-toolbar-right { display: flex; align-items: center; gap: 20px; }
.results-filter-btn {
  background: none;
  border: 1px solid var(--line-2);
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  color: var(--fg-1);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-sans);
}
.results-filter-btn:hover { background: var(--bg-2); }

.results-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-bottom: 48px;
}

.results-nextbeat {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 40px;
  align-items: center;
  padding: 32px 40px;
  background: var(--bg-1);
  border-radius: var(--radius-xl);
  border: 1px solid var(--line-1);
}
.results-nextbeat-title {
  font-family: var(--font-display);
  font-size: 32px;
  line-height: 1.1;
  margin: 8px 0 8px;
  font-weight: 400;
  letter-spacing: -0.015em;
}
.results-nextbeat-sub { font-size: 13px; color: var(--fg-3); margin: 0; }
.results-nextbeat-actions { display: flex; gap: 10px; }

/* ============================================================
   SCREEN 5 · DETAIL
   ============================================================ */
.detail-main {
  flex: 1;
  padding: 24px 56px 60px;
  max-width: 1360px;
  width: 100%;
  margin: 0 auto;
  overflow: auto;
}
.detail-breadcrumb {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--fg-3);
  margin-bottom: 18px;
}
.detail-breadcrumb a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  color: var(--fg-2);
}
.detail-breadcrumb a:hover { color: var(--fg-1); }
.detail-bc-sep { color: var(--line-2); }
.detail-bc-item.is-current { color: var(--fg-1); }

.detail-gallery {
  display: grid;
  grid-template-columns: 1fr 140px;
  gap: 12px;
  margin-bottom: 36px;
}
.detail-hero-photo {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--pearl-100);
}
.detail-hero-photo img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.detail-hero-match {
  position: absolute;
  top: 20px; left: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(253, 252, 249, 0.92);
  backdrop-filter: blur(10px);
  border-radius: var(--radius-pill);
  padding: 6px 18px 6px 8px;
}
.detail-hero-match-sub {
  font-size: 11px;
  color: var(--fg-3);
  margin-top: 2px;
}
.detail-thumb-column {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.detail-thumb {
  aspect-ratio: 4 / 3;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 2px solid transparent;
  cursor: pointer;
  background: none;
  padding: 0;
  transition: border-color var(--dur-2);
}
.detail-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.detail-thumb.is-active { border-color: var(--fg-1); }
.detail-thumb.is-placeholder {
  background: var(--pearl-100);
  border: 1px solid var(--line-1);
  display: grid; place-items: center;
  color: var(--fg-4);
  font-size: 12px;
  font-family: var(--font-serif-italic);
  font-style: italic;
}

.detail-body {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 56px;
}
.detail-headline {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line-1);
  margin-bottom: 24px;
}
.detail-price {
  font-family: var(--font-display);
  font-size: 48px;
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1;
  margin-bottom: 10px;
}
.detail-addr-line1 { font-size: 15px; color: var(--fg-1); }
.detail-addr-line2 { font-size: 13px; color: var(--fg-3); margin-top: 2px; }
.detail-headline-actions { display: flex; gap: 8px; }

.detail-specs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 40px;
}
.detail-spec {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  background: var(--bg-1);
  border: 1px solid var(--line-1);
  border-radius: var(--radius-md);
  color: var(--fg-3);
}
.detail-spec-val {
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--fg-1);
  line-height: 1;
}
.detail-spec-lbl {
  font-size: 11px;
  color: var(--fg-3);
  margin-top: 4px;
}

.detail-section { margin-bottom: 36px; }
.detail-section .hm-eyebrow { margin-bottom: 14px; }
.detail-why {
  background: var(--bg-1);
  border: 1px solid var(--line-1);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
}
.detail-why-lead {
  font-family: var(--font-display);
  font-size: 22px;
  line-height: 1.25;
  margin-bottom: 20px;
  letter-spacing: -0.01em;
}
.detail-why-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.detail-why-list li {
  display: flex;
  gap: 14px;
  font-size: 13.5px;
  color: var(--fg-2);
  line-height: 1.55;
}
.detail-why-list strong { font-weight: 500; color: var(--fg-1); }
.detail-why-desc { color: var(--fg-3); }
.detail-why-dot {
  width: 6px; height: 6px;
  border-radius: var(--radius-pill);
  background: var(--sage-600);
  margin-top: 8px;
  flex-shrink: 0;
}

.detail-tags { display: flex; gap: 8px; flex-wrap: wrap; }
.detail-desc {
  font-size: 14.5px;
  line-height: 1.7;
  color: var(--fg-2);
  max-width: 620px;
}

.detail-sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: sticky;
  top: 20px;
  align-self: start;
}
.detail-agent {
  padding: 24px;
  background: var(--bg-0);
  border: 1px solid var(--line-1);
  border-radius: var(--radius-lg);
}
.detail-agent-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.detail-agent-avatar {
  width: 44px; height: 44px;
  border-radius: var(--radius-pill);
  background: var(--slate-900);
  color: var(--pearl-00);
  display: grid; place-items: center;
  font-size: 13px;
  font-weight: 500;
}
.detail-agent-name { font-size: 15px; font-weight: 500; color: var(--fg-1); }
.detail-agent-firm { font-size: 12px; color: var(--fg-3); margin-top: 2px; }
.detail-agent-sub { font-size: 13px; color: var(--fg-2); line-height: 1.55; margin: 0 0 18px; }
.detail-agent-actions { display: flex; flex-direction: column; gap: 8px; }
.detail-agent-actions .hm-btn { justify-content: center; }

.detail-more-card {
  padding: 20px;
  background: var(--bg-0);
  border: 1px solid var(--line-1);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: border-color var(--dur-2);
}
.detail-more-card:hover { border-color: var(--fg-1); }
.detail-more-thumbs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 14px;
}
.detail-more-thumbs img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: var(--radius-sm);
  display: block;
}
.detail-more-title {
  font-family: var(--font-display);
  font-size: 20px;
  line-height: 1.2;
  margin: 4px 0 10px;
}
.detail-more-link {
  font-size: 12px;
  color: var(--fg-1);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
}

.detail-disclaimer {
  padding: 0 4px;
  line-height: 1.5;
}

/* ============================================================
   MOBILE
   ============================================================ */
.m-frame {
  width: 390px;
  height: 820px;
  background: var(--slate-900);
  border-radius: 54px;
  padding: 10px;
  position: relative;
  box-shadow: var(--shadow-3);
  margin: 0 auto;
}
.m-frame-notch {
  position: absolute;
  top: 16px; left: 50%;
  transform: translateX(-50%);
  width: 120px; height: 32px;
  background: var(--slate-900);
  border-radius: 18px;
  z-index: 10;
  display: flex; align-items: center; justify-content: center;
  gap: 50px;
}
.m-frame-speaker {
  width: 54px; height: 5px;
  background: #000;
  border-radius: 3px;
}
.m-frame-camera {
  width: 8px; height: 8px;
  background: #111;
  border-radius: 50%;
}
.m-frame-screen {
  width: 100%; height: 100%;
  background: var(--bg-0);
  border-radius: 44px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
}
.m-statusbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 26px 6px;
  color: var(--slate-900);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-sans);
}
.m-time { padding-left: 8px; }
.m-status-right { display: flex; gap: 6px; align-items: center; }
.m-content { flex: 1; overflow: auto; padding-top: 8px; }
.m-home-indicator {
  position: absolute;
  bottom: 8px; left: 50%;
  transform: translateX(-50%);
  width: 120px; height: 4px;
  background: var(--slate-900);
  border-radius: 2px;
}

.m-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px 10px;
  border-bottom: 1px solid var(--line-1);
  background: var(--bg-0);
}
.m-topbar-btn {
  width: 32px; height: 32px;
  border: none;
  background: none;
  color: var(--fg-1);
  display: grid; place-items: center;
  cursor: pointer;
  border-radius: var(--radius-pill);
}
.m-topbar-title { font-size: 14px; font-weight: 500; }
.m-topbar-right { width: 32px; display: flex; justify-content: flex-end; }

/* --- Mobile Upload --- */
.m-upload { padding: 24px 20px; }
.m-upload-head { margin-bottom: 20px; }
.m-upload-title {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 400;
  line-height: 1.08;
  letter-spacing: -0.015em;
  margin: 6px 0 10px;
}
.m-upload-sub { font-size: 13px; color: var(--fg-3); margin: 0; }
.m-upload-dropzone {
  border: 1.5px dashed var(--line-2);
  border-radius: var(--radius-lg);
  padding: 36px 20px;
  background: var(--bg-1);
  text-align: center;
  color: var(--fg-3);
  margin-bottom: 14px;
}
.m-upload-dz-title { font-size: 14px; color: var(--fg-1); margin: 10px 0 4px; font-weight: 500; }
.m-upload-dz-sub { font-size: 11.5px; color: var(--fg-3); }
.m-upload-row { display: flex; gap: 8px; margin-bottom: 24px; }
.m-upload-chip {
  flex: 1;
  padding: 10px 12px;
  background: var(--bg-0);
  border: 1px solid var(--line-1);
  border-radius: var(--radius-pill);
  font-size: 12px;
  color: var(--fg-1);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: var(--font-sans);
}
.m-upload-examples { }
.m-upload-examples .hm-eyebrow { display: block; margin-bottom: 10px; }
.m-upload-ex-row { display: flex; gap: 8px; }
.m-upload-ex {
  flex: 1;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--line-1);
}
.m-upload-ex img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* --- Mobile Results --- */
.m-results { padding: 16px 16px 40px; }
.m-results-head { margin-bottom: 18px; }
.m-results-reference {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 10px;
  background: var(--bg-1);
  border-radius: var(--radius-md);
  border: 1px solid var(--line-1);
}
.m-results-reference img {
  width: 52px; height: 52px;
  object-fit: cover;
  border-radius: var(--radius-sm);
}
.m-results-ref-tag { font-size: 11.5px; color: var(--fg-2); margin-top: 2px; font-weight: 500; }
.m-results-title {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 400;
  line-height: 1.1;
  margin: 14px 0 0;
  letter-spacing: -0.01em;
}
.m-results-list { display: flex; flex-direction: column; gap: 14px; }
.m-listing {
  background: var(--bg-0);
  border: 1px solid var(--line-1);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.m-listing-photo {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--pearl-100);
}
.m-listing-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.m-listing-match { position: absolute; top: 8px; left: 8px; }
.m-listing-body { padding: 10px 14px 14px; }
.m-listing-price { font-family: var(--font-display); font-size: 20px; line-height: 1.1; }
.m-listing-addr { font-size: 12px; color: var(--fg-1); margin-top: 2px; }
.m-listing-hood { font-size: 10.5px; color: var(--fg-4); margin-top: 2px; }
.m-listing-rationale {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line-1);
  font-size: 11px;
  color: var(--fg-3);
  font-family: var(--font-serif-italic);
  font-style: italic;
  line-height: 1.45;
}
.m-listing-rationale span {
  font-family: var(--font-sans);
  font-style: normal;
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-4);
  margin-right: 6px;
  font-weight: 600;
}

/* --- Mobile Detail --- */
.m-detail-hero {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
}
.m-detail-hero img { width: 100%; height: 100%; object-fit: cover; display: block; }
.m-detail-back, .m-detail-save {
  position: absolute;
  top: 12px;
  width: 34px; height: 34px;
  border-radius: var(--radius-pill);
  background: rgba(253, 252, 249, 0.92);
  backdrop-filter: blur(8px);
  border: none;
  display: grid; place-items: center;
  cursor: pointer;
  color: var(--fg-1);
}
.m-detail-back { left: 12px; }
.m-detail-save { right: 12px; }
.m-detail-match {
  position: absolute;
  bottom: 12px; left: 12px;
}
.m-detail-body { padding: 18px 20px 24px; }
.m-detail-price { font-family: var(--font-display); font-size: 30px; line-height: 1; }
.m-detail-addr { font-size: 14px; color: var(--fg-1); margin-top: 8px; }
.m-detail-hood { font-size: 12px; color: var(--fg-3); margin-top: 2px; }
.m-detail-specs {
  display: flex;
  gap: 12px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line-1);
  font-size: 12px;
  color: var(--fg-2);
}
.m-detail-specs span { display: inline-flex; align-items: center; gap: 4px; }
.m-detail-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 14px; }
.m-detail-why {
  margin-top: 20px;
  padding: 16px;
  background: var(--bg-1);
  border-radius: var(--radius-md);
  border: 1px solid var(--line-1);
}
.m-detail-why .hm-eyebrow { display: block; margin-bottom: 10px; }
.m-detail-why ul {
  list-style: none;
  padding: 0; margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 12.5px;
  color: var(--fg-2);
}
.m-detail-why li { display: flex; align-items: center; gap: 10px; }
.m-why-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--sage-600); flex-shrink: 0; }
.m-detail-cta {
  width: 100%;
  margin-top: 20px;
  padding: 14px;
  background: var(--slate-900);
  color: var(--pearl-00);
  border: none;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-sans);
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

/* ==================== RESULTS · LIST VIEW ==================== */
.results-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 24px;
}
.results-list-row {
  display: grid;
  grid-template-columns: 220px 1fr 40px;
  gap: 24px;
  padding: 16px;
  border: 1px solid var(--line-1);
  border-radius: var(--radius-lg);
  background: var(--bg-0);
  cursor: pointer;
  transition: box-shadow 200ms var(--ease-out), border-color 200ms, transform 200ms var(--ease-out);
  align-items: center;
}
.results-list-row:hover {
  box-shadow: var(--shadow-2);
  border-color: var(--line-2);
  transform: translateY(-1px);
}
.results-list-photo {
  position: relative;
  aspect-ratio: 4/3;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--pearl-100);
}
.results-list-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.results-list-match {
  position: absolute;
  top: 8px;
  right: 8px;
}
.results-list-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
.results-list-row-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.results-list-price {
  font-family: var(--font-display);
  font-size: 28px;
  line-height: 1.1;
  color: var(--fg-1);
  margin: 0;
  letter-spacing: -0.01em;
}
.results-list-specs {
  font-size: 11px;
  color: var(--fg-3);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.results-list-loc {
  font-size: 14px;
  color: var(--fg-2);
  font-weight: 500;
}
.results-list-rationale {
  display: flex;
  gap: 10px;
  align-items: baseline;
  padding-top: 6px;
  border-top: 1px solid var(--line-1);
  margin-top: 4px;
}
.results-list-rationale-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg-4);
  flex-shrink: 0;
}
.results-list-rationale-text {
  font-family: var(--font-serif-italic);
  font-style: italic;
  font-size: 15px;
  color: var(--fg-2);
  line-height: 1.45;
}
.results-list-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.results-list-cta {
  color: var(--fg-3);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  transition: color 200ms, transform 200ms var(--ease-out);
}
.results-list-row:hover .results-list-cta {
  color: var(--fg-1);
  transform: translateX(4px);
}
@media (max-width: 720px) {
  .results-list-row { grid-template-columns: 1fr; gap: 12px; }
  .results-list-cta { display: none; }
}

/* ==================== RESULTS · MAP VIEW ==================== */
.results-map {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.results-map-canvas {
  position: relative;
  aspect-ratio: 16/9;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--line-1);
  background: var(--pearl-100);
}
.results-map-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.6) brightness(1.04) sepia(0.12);
}
.results-map-veil {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(253,252,249,0.38), rgba(253,252,249,0.18) 40%, rgba(253,252,249,0.38)),
    radial-gradient(circle at center, rgba(253,252,249,0) 40%, rgba(253,252,249,0.55) 100%);
  pointer-events: none;
}
.results-map-pin {
  position: absolute;
  transform: translate(-50%, -100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: transparent;
  border: 0;
  cursor: pointer;
  padding: 0;
}
.results-map-pin-dot {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--slate-900);
  color: var(--pearl-00);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--pearl-00);
  box-shadow: var(--shadow-2);
  transition: transform 180ms var(--ease-out), background 180ms;
}
.results-map-pin-dot::after {
  content: "";
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--slate-900);
}
.results-map-pin:hover .results-map-pin-dot {
  transform: scale(1.1);
  background: var(--sage-600);
}
.results-map-pin:hover .results-map-pin-dot::after {
  border-top-color: var(--sage-600);
}
.results-map-pin-label {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--pearl-00);
  color: var(--fg-1);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-2);
  border: 1px solid var(--line-1);
  font-size: 12px;
  line-height: 1.3;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.results-map-pin-label strong {
  font-family: var(--font-display);
  font-size: 14px;
  color: var(--fg-1);
}
.results-map-pin-label span {
  font-size: 11px;
  color: var(--fg-3);
}
.results-map-pin:hover .results-map-pin-label {
  opacity: 1;
}
.results-map-legend {
  font-size: 11px;
  color: var(--fg-3);
  letter-spacing: 0.08em;
  display: flex;
  align-items: center;
  gap: 8px;
}
.results-map-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--slate-900);
  border: 1.5px solid var(--pearl-00);
  display: inline-block;
}

/* ==================== RESULTS · TOAST ==================== */
.results-toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--slate-900);
  color: var(--pearl-00);
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow-3);
  z-index: 200;
  animation: toast-in 240ms var(--ease-out);
}
@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 8px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

/* ==================== FILTER PANEL ==================== */
.filter-scrim {
  position: fixed;
  inset: 0;
  background: rgba(11, 12, 14, 0.32);
  z-index: 150;
  animation: fade-in 240ms var(--ease-out);
}
@keyframes fade-in { from { opacity: 0 } to { opacity: 1 } }

.filter-panel {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  width: min(480px, 100vw);
  background: var(--bg-0);
  border-left: 1px solid var(--line-1);
  box-shadow: var(--shadow-3);
  z-index: 160;
  display: flex;
  flex-direction: column;
  animation: slide-in 320ms var(--ease-out);
}
@keyframes slide-in {
  from { transform: translateX(100%); }
  to   { transform: translateX(0); }
}
.filter-panel-head {
  padding: 28px 32px 20px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  border-bottom: 1px solid var(--line-1);
}
.filter-panel-title {
  font-family: var(--font-display);
  font-size: 32px;
  line-height: 1.05;
  margin: 8px 0 0;
  color: var(--fg-1);
  letter-spacing: -0.015em;
}
.filter-panel-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-2);
  border: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--fg-2);
  transition: background 160ms;
}
.filter-panel-close:hover { background: var(--pearl-200); color: var(--fg-1); }

.filter-section {
  padding: 24px 32px;
  border-bottom: 1px solid var(--line-1);
}
.filter-section:last-of-type { border-bottom: 0; }

.filter-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--fg-3);
  margin-bottom: 14px;
}

.filter-range {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.filter-range-bar {
  position: relative;
  height: 4px;
  background: var(--pearl-200);
  border-radius: 2px;
}
.filter-range-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  background: var(--slate-900);
  border-radius: 2px;
}
.filter-range-vals {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
}
.filter-range-vals input {
  width: 80px;
  padding: 10px 12px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  font: inherit;
  color: var(--fg-1);
  background: var(--bg-0);
  text-align: center;
}
.filter-range-vals input:focus {
  outline: 0;
  border-color: var(--fg-1);
  box-shadow: var(--ring-focus);
}
.filter-range-vals span { color: var(--fg-3); }

.filter-beds {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.filter-bed-btn {
  padding: 10px 18px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-pill);
  background: var(--bg-0);
  font: inherit;
  font-size: 14px;
  color: var(--fg-2);
  cursor: pointer;
  transition: all 160ms;
}
.filter-bed-btn:hover { border-color: var(--fg-3); color: var(--fg-1); }
.filter-bed-btn.is-active {
  background: var(--slate-900);
  color: var(--pearl-00);
  border-color: var(--slate-900);
}

.filter-styles {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.filter-style-chip {
  padding: 8px 14px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-pill);
  background: var(--bg-0);
  font: inherit;
  font-size: 13px;
  color: var(--fg-2);
  cursor: pointer;
  transition: all 160ms;
}
.filter-style-chip:hover { border-color: var(--fg-3); color: var(--fg-1); }
.filter-style-chip.is-active {
  background: var(--sage-100);
  color: var(--sage-600);
  border-color: var(--sage-600);
}

.filter-panel-foot {
  margin-top: auto;
  padding: 20px 32px;
  border-top: 1px solid var(--line-1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--bg-1);
}
.filter-clear {
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 13px;
  color: var(--fg-3);
  cursor: pointer;
  padding: 8px 4px;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.filter-clear:hover { color: var(--fg-1); }

/* ==================== RESULTS · LEAFLET MAP ==================== */
/* Override the canvas: Leaflet needs an explicit height + no aspect ratio */
.results-map .results-map-canvas {
  aspect-ratio: auto;
  height: 580px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--line-1);
  background: var(--pearl-100);
}
.results-map .leaflet-container {
  font-family: var(--font-sans);
  background: var(--pearl-50);
}
.results-map .leaflet-control-attribution {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.04em;
  background: rgba(253, 252, 249, 0.8);
}
.results-map .leaflet-control-zoom a {
  background: var(--pearl-00);
  color: var(--fg-1);
  border-color: var(--line-1);
  font-weight: 400;
}
.results-map .leaflet-control-zoom a:hover {
  background: var(--pearl-50);
}

/* Compass-style price pill (injected as HTML into L.divIcon) */
.hm-map-pill-icon { background: transparent; border: 0; overflow: visible; }
.hm-map-pill {
  position: relative;
  width: var(--pill-w, 72px);
  height: 30px;
  background: var(--slate-900);
  color: var(--pearl-00);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
  box-shadow: 0 4px 12px rgba(11, 12, 14, 0.22), 0 1px 2px rgba(11, 12, 14, 0.16);
  transition: background 180ms var(--ease-out), color 180ms var(--ease-out), transform 180ms var(--ease-out), box-shadow 180ms var(--ease-out);
  white-space: nowrap;
  cursor: pointer;
}
.hm-map-pill::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--slate-900);
  border-bottom: 0;
  transition: border-top-color 180ms var(--ease-out);
}
.hm-map-pill-label { line-height: 1; }
.hm-map-pill-match {
  position: absolute;
  top: -6px;
  right: -6px;
  background: var(--sage-600);
  color: var(--pearl-00);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 2px 5px;
  border-radius: 999px;
  border: 1.5px solid var(--pearl-00);
  line-height: 1;
  min-width: 20px;
  text-align: center;
}
/* Hover: invert to white pill with dark text — Compass "selected" look */
.hm-map-pill-icon:hover .hm-map-pill,
.leaflet-marker-icon:hover .hm-map-pill {
  background: var(--pearl-00);
  color: var(--slate-900);
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(11, 12, 14, 0.28), 0 2px 6px rgba(11, 12, 14, 0.18);
}
.hm-map-pill-icon:hover .hm-map-pill::after,
.leaflet-marker-icon:hover .hm-map-pill::after {
  border-top-color: var(--pearl-00);
}

/* Leaflet tooltip restyle */
.leaflet-tooltip.hm-map-tooltip {
  background: var(--pearl-00);
  color: var(--fg-1);
  border: 1px solid var(--line-1);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  box-shadow: var(--shadow-2);
  font-family: var(--font-sans);
  font-size: 12px;
  line-height: 1.4;
  white-space: normal;
  max-width: 220px;
}
.leaflet-tooltip.hm-map-tooltip strong {
  font-family: var(--font-display);
  font-size: 14px;
  color: var(--fg-1);
  display: block;
  margin-bottom: 2px;
}
.leaflet-tooltip.hm-map-tooltip .hm-map-tooltip-hood {
  color: var(--fg-3);
  font-size: 11px;
}
.leaflet-tooltip-top.hm-map-tooltip::before {
  border-top-color: var(--line-1);
}

/* AppBar · back arrow + book-a-call CTA (investor flow) */
.hm-appbar-back {
  font-family: var(--font-display);
  font-size: 18px;
  line-height: 1;
  color: var(--fg-3);
  transition: color 180ms, transform 220ms var(--ease-out);
  display: inline-block;
}
.hm-appbar a:hover .hm-appbar-back {
  color: var(--fg-1);
  transform: translateX(-3px);
}
.hm-appbar-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius-pill);
  background: var(--slate-900);
  color: var(--pearl-00);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: all 200ms var(--ease-out);
  white-space: nowrap;
  border: 1px solid var(--slate-900);
}
.hm-appbar-cta:hover {
  background: var(--slate-800);
  transform: translateY(-1px);
  box-shadow: var(--shadow-2);
}
.hm-appbar-cta-arrow {
  font-size: 14px;
  line-height: 1;
  transform: translateY(-1px);
  transition: transform 220ms var(--ease-out);
}
.hm-appbar-cta:hover .hm-appbar-cta-arrow {
  transform: translate(2px, -3px);
}

/* ============================================================
   MOBILE · viewport <= 640px
   Mobile variants (MobileUpload, MobileResults, MobileDetail) render
   directly without the .m-frame wrapper. Quiz + Matching use the
   desktop screens with responsive reflow.
   ============================================================ */
@media (max-width: 640px) {
  html, body { overflow-x: hidden; }

  /* Allow vertical scroll on desktop screens that fall back on mobile */
  .screen { overflow-y: auto; overflow-x: hidden; min-height: 100vh; }

  /* --- Desktop AppBar compression (visible only when a desktop screen renders) --- */
  .hm-appbar {
    padding: 12px 16px;
    flex-wrap: wrap;
    gap: 8px;
  }
  .hm-appbar-nav { gap: 16px; font-size: 12px; }
  .hm-appbar-link { font-size: 12px; }
  .hm-appbar-cta { padding: 7px 14px; font-size: 12px; }
  .hm-appbar-back { display: none; }

  /* --- Quiz: stack A/B cards vertically --- */
  .quiz-screen .quiz-main {
    padding: 24px 16px;
  }
  .quiz-screen .quiz-title { font-size: 32px; line-height: 1.1; }
  .quiz-screen .quiz-sub { font-size: 14px; }
  .quiz-pair {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .quiz-card-photo { aspect-ratio: 16 / 9; }
  .quiz-footer {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
    padding: 20px 0 0;
  }
  .quiz-progress { justify-content: space-between; }
  .quiz-actions { justify-content: space-between; }

  /* --- Matching screen: shrink and recenter --- */
  .matching-screen { padding: 24px 16px; }
  .matching-screen .matching-ref { max-width: 240px; }
  .matching-screen h2, .matching-screen .matching-title { font-size: 22px; }

  /* --- Mobile variant: render full-bleed, no frame --- */
  .m-upload, .m-results, .m-detail-body { padding-left: 20px; padding-right: 20px; }
  .m-topbar {
    padding: 14px 16px;
    position: sticky;
    top: 0;
    background: var(--bg-0);
    z-index: 20;
    border-bottom: 1px solid var(--line-1);
  }
  .m-detail-hero { aspect-ratio: 4 / 3; }
  .m-listing-photo { aspect-ratio: 4 / 3; }

  /* Landing-style body override: the app root should fill viewport with bg */
  body.hm-page { background: var(--bg-0); }
}

/* Tablet tuning (641–900): desktop screens still, tighter padding */
@media (min-width: 641px) and (max-width: 900px) {
  .upload-main, .results-main, .quiz-main {
    padding-left: 32px;
    padding-right: 32px;
  }
  .hm-appbar { padding: 14px 24px; }
}
