:root {
  color-scheme: dark;
  --bg: #0d1014;
  --bg-soft: #141922;
  --panel: rgba(18, 23, 31, 0.94);
  --panel-soft: rgba(24, 31, 41, 0.88);
  --line: rgba(255, 255, 255, 0.12);
  --text: #edf2f7;
  --muted: #96a4b5;
  --accent: #c23a2b;
  --accent-strong: #f06d43;
  --accent-soft: rgba(240, 109, 67, 0.14);
  --success: #75d29a;
  --warning: #f0c36b;
  --error: #ef8c8c;
  --shadow: 0 24px 64px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(240, 109, 67, 0.14), transparent 24%),
    radial-gradient(circle at top right, rgba(53, 119, 212, 0.12), transparent 22%),
    linear-gradient(180deg, #0f1319 0%, #0b0e13 100%);
}

a {
  color: inherit;
}

button,
input,
textarea {
  font: inherit;
}

.app-shell {
  width: min(1120px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2rem 0 3rem;
}

.hero-panel,
.panel-card,
.results-panel,
.listing-card {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.hero-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(260px, 0.75fr);
  gap: 1rem;
  padding: 1.4rem;
  border-radius: 28px;
}

.eyebrow {
  display: inline-flex;
  margin-bottom: 0.85rem;
  padding: 0.34rem 0.72rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: #ffccbd;
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

h1,
h2,
h3,
strong {
  font-family: Georgia, 'Times New Roman', serif;
}

h1,
h2,
h3,
p,
dl,
dd,
dt {
  margin: 0;
}

.hero-copy,
.helper-copy,
.hero-note p,
.status-box,
.listing-prices dt,
.session-pill {
  color: var(--muted);
}

.hero-panel h1 {
  font-size: clamp(2.6rem, 6vw, 4.7rem);
  line-height: 0.95;
}

.hero-note {
  padding: 1rem;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
}

.panel-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.85fr) minmax(0, 1.35fr);
  gap: 1rem;
  margin-top: 1rem;
}

.panel-card,
.results-panel {
  border-radius: 26px;
  padding: 1.2rem;
}

.panel-heading-row,
.results-header,
.action-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.9rem;
  align-items: end;
}

.stack-form {
  display: grid;
  gap: 0.9rem;
  margin-top: 1rem;
}

.field-block {
  display: grid;
  gap: 0.45rem;
}

.field-block span {
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.field-block input,
.field-block textarea {
  width: 100%;
  padding: 0.9rem 1rem;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
  color: var(--text);
}

.field-block textarea {
  resize: vertical;
  min-height: 6rem;
}

button,
.listing-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.9rem;
  padding: 0.78rem 1.15rem;
  border-radius: 999px;
  border: 0;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #fff;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.secondary-button {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
}

.session-pill {
  padding: 0.55rem 0.8rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.9rem;
}

.status-box {
  margin-top: 1rem;
  padding: 0.9rem 1rem;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
}

.status-box[data-tone='success'] {
  color: var(--success);
  border-color: rgba(117, 210, 154, 0.35);
  background: rgba(117, 210, 154, 0.08);
}

.status-box[data-tone='error'] {
  color: var(--error);
  border-color: rgba(239, 140, 140, 0.35);
  background: rgba(239, 140, 140, 0.08);
}

.results-panel {
  margin-top: 1rem;
}

.results-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(210px, 1fr));
  gap: 1rem;
  align-items: stretch;
}

.results-stats div,
.listing-prices div {
  display: grid;
  gap: 0.3rem;
}

.results-stats dd,
.listing-prices dd {
  font-size: 1.15rem;
  font-weight: 800;
}

.results-stat-highlight {
  display: inline-grid;
  justify-items: start;
  align-content: start;
  min-height: 112px;
  padding: 1rem 1.2rem 1.08rem;
  border-radius: 28px;
  border: 1px solid rgba(117, 210, 154, 0.42);
  background: linear-gradient(135deg, rgba(60, 156, 97, 0.95), rgba(117, 210, 154, 0.9));
  box-shadow: 0 14px 34px rgba(39, 114, 69, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.results-stat-highlight dt {
  color: rgba(236, 255, 244, 0.84);
}

.results-stat-secondary,
.results-stats > div:last-child {
  display: inline-grid;
  justify-items: start;
  align-content: start;
  min-height: 112px;
  padding: 1rem 1.2rem 1.08rem;
  border-radius: 28px;
  border: 1px solid rgba(142, 204, 255, 0.42);
  background: linear-gradient(135deg, rgba(74, 145, 212, 0.9), rgba(144, 212, 255, 0.78));
  box-shadow: 0 14px 34px rgba(50, 95, 146, 0.26), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.results-stat-secondary dt,
.results-stats > div:last-child dt {
  color: rgba(239, 249, 255, 0.82);
}

.results-stat-secondary dd,
.results-stats > div:last-child dd {
  color: #ffffff;
  font-size: clamp(1.35rem, 2.3vw, 1.8rem);
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 8px 20px rgba(33, 72, 112, 0.24);
}

#average-price {
  font-size: clamp(1.8rem, 3vw, 2.5rem);
  font-weight: 900;
  line-height: 1;
  color: #ffffff;
  text-shadow: 0 8px 22px rgba(28, 83, 49, 0.28);
}

#match-count {
  font-size: clamp(1.6rem, 2.7vw, 2.2rem);
}

.result-list {
  display: grid;
  gap: 0.9rem;
  margin-top: 1rem;
}

.listing-card {
  display: grid;
  grid-template-columns: auto 112px minmax(0, 1fr);
  gap: 1rem;
  padding: 1rem;
  border-radius: 22px;
}

.listing-rank {
  width: 2.7rem;
  height: 2.7rem;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-weight: 900;
  background: var(--accent-soft);
  color: #ffd6c9;
}

.listing-media {
  width: 112px;
  aspect-ratio: 1;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
}

.listing-media-link {
  display: block;
  transition: transform 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}

.listing-media-link:hover,
.listing-media-link:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(240, 109, 67, 0.45);
  box-shadow: 0 10px 28px rgba(240, 109, 67, 0.18);
}

.listing-media-empty {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.listing-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.listing-copy {
  display: grid;
  gap: 0.8rem;
}

.listing-copy h3 {
  font-size: 1.1rem;
  line-height: 1.35;
}

.listing-prices {
  display: grid;
  grid-template-columns: repeat(3, minmax(110px, 1fr));
  gap: 0.75rem;
}

.empty-state {
  padding: 1rem;
  border-radius: 18px;
  border: 1px dashed var(--line);
  color: var(--muted);
}

@media (max-width: 900px) {
  .hero-panel,
  .panel-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .app-shell {
    width: min(100% - 1rem, 100%);
    padding-top: 1rem;
  }

  .listing-card {
    grid-template-columns: 1fr;
  }

  .listing-media {
    width: 100%;
    max-width: 220px;
  }

  .results-stats,
  .listing-prices {
    grid-template-columns: 1fr;
  }

  .action-row {
    align-items: stretch;
  }

  .action-row button,
  .action-row .secondary-button,
  .listing-link {
    width: 100%;
  }
}