:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --text: #111216;
  --muted: #69707d;
  --line: #dfe3ea;
  --line-strong: #c8ced9;
  --red: #d81018;
  --red-dark: #9e0710;
  --black: #09090b;
  --shadow: 0 24px 70px rgba(18, 21, 28, 0.12);
  --radius-xl: 32px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --focus: 0 0 0 4px rgba(216, 16, 24, 0.12);
}

[data-theme="dark"] {
  --bg: #07080a;
  --surface: #111318;
  --surface-2: #171a21;
  --text: #f5f6f8;
  --muted: #a4abb7;
  --line: #2a2f39;
  --line-strong: #3a404d;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.46);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; overflow-x: hidden; }
body {
  margin: 0;
  min-width: 320px;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 10% 0%, rgba(216, 16, 24, 0.08), transparent 28%),
    radial-gradient(circle at 90% 10%, rgba(9, 9, 11, 0.08), transparent 22%),
    var(--bg);
  color: var(--text);
  font-family: Montserrat, Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
button { cursor: pointer; }
img { max-width: 100%; display: block; }

.page-shell { width: min(100%, 1480px); margin: 0 auto; padding: 18px; }
.site-header {
  position: sticky;
  top: 12px;
  z-index: 50;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 18px;
  padding: 12px 14px;
  border: 1px solid color-mix(in srgb, var(--line), transparent 20%);
  border-radius: 24px;
  background: color-mix(in srgb, var(--surface), transparent 8%);
  backdrop-filter: blur(18px);
  box-shadow: 0 16px 50px rgba(12, 13, 16, 0.08);
}
.brand { display: inline-flex; align-items: center; gap: 12px; min-width: max-content; }
.brand-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--black) 0 58%, var(--red) 58% 100%);
  color: #fff;
  font-size: 17px;
  font-weight: 950;
  letter-spacing: -0.07em;
  box-shadow: 0 12px 28px rgba(216, 16, 24, 0.2);
}
.brand-text { display: grid; gap: 2px; }
.brand-text strong { font-weight: 950; letter-spacing: -0.04em; }
.brand-text small { color: var(--muted); font-size: 11px; font-weight: 700; }
.main-nav { display: flex; align-items: center; justify-content: center; gap: 8px; }
.main-nav a {
  padding: 11px 14px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
  transition: color .2s ease, background .2s ease, transform .2s ease;
}
.main-nav a:hover { color: var(--text); background: var(--surface-2); transform: translateY(-1px); }
.header-actions { display: flex; align-items: center; gap: 10px; }
.theme-toggle, .burger, .voice-btn {
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  border-radius: 16px;
}
.theme-toggle { width: 46px; height: 46px; display: grid; place-items: center; }
.theme-toggle svg, .voice-btn svg { width: 21px; fill: currentColor; }
.sell-btn, .primary-action, .secondary-action, .reset-action {
  min-height: 46px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 0 20px;
  font-weight: 900;
  border: 0;
  transition: transform .2s ease, box-shadow .2s ease, background .2s ease;
}
.sell-btn, .primary-action { background: linear-gradient(135deg, var(--red), var(--red-dark)); color: #fff; box-shadow: 0 14px 34px rgba(216, 16, 24, .22); }
.secondary-action, .reset-action { background: var(--surface-2); color: var(--text); border: 1px solid var(--line); }
.sell-btn:hover, .primary-action:hover, .secondary-action:hover, .reset-action:hover { transform: translateY(-2px); }
.burger { display: none; width: 46px; height: 46px; place-items: center; padding: 11px; }
.burger span { display: block; width: 20px; height: 2px; margin: 3px 0; background: currentColor; border-radius: 99px; }

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(330px, .75fr);
  gap: 22px;
  padding: clamp(30px, 6vw, 80px) 0 30px;
}
.hero-copy, .hero-panel, .filter-wrap, .catalog, .verified-section, .dealers {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}
.hero-copy { padding: clamp(28px, 5vw, 58px); }
.eyebrow {
  margin: 0 0 12px;
  color: var(--red);
  font-size: 12px;
  font-weight: 950;
  text-transform: uppercase;
  letter-spacing: .16em;
}
h1, h2, h3, p { margin-top: 0; }
h1 { max-width: 920px; margin-bottom: 20px; font-size: clamp(42px, 7vw, 78px); line-height: .92; letter-spacing: -.075em; }
h2 { margin-bottom: 12px; font-size: clamp(28px, 4vw, 46px); line-height: 1; letter-spacing: -.055em; }
p { color: var(--muted); line-height: 1.65; }
.hero-copy > p:not(.eyebrow) { max-width: 800px; font-size: 18px; }
.hero-actions, .filter-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 26px; }
.hero-panel { position: relative; overflow: hidden; display: grid; gap: 14px; padding: 22px; }
.hero-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(216, 16, 24, .12), transparent 40%), radial-gradient(circle at 100% 0%, rgba(216, 16, 24, .15), transparent 30%);
  pointer-events: none;
}
.metric, .hero-card-mini { position: relative; border: 1px solid var(--line); background: color-mix(in srgb, var(--surface-2), transparent 8%); border-radius: 24px; padding: 24px; }
.metric strong { display: block; font-size: 54px; line-height: .9; letter-spacing: -.07em; }
.metric span, .hero-card-mini small { color: var(--muted); font-weight: 700; }
.hero-card-mini span { width: 42px; height: 42px; display: grid; place-items: center; margin-bottom: 22px; border-radius: 14px; background: var(--black); color: #fff; font-weight: 950; }
.hero-card-mini.verified span { background: var(--red); }
.hero-card-mini strong { display: block; margin-bottom: 6px; font-size: 22px; }

.filter-wrap { padding: clamp(20px, 4vw, 34px); margin-top: 10px; scroll-margin-top: 110px; }
.section-title { max-width: 920px; margin-bottom: 22px; }
.section-title.compact { max-width: 720px; }
.filters { display: grid; gap: 16px; }
.search-line { display: grid; grid-template-columns: 1fr auto; gap: 12px; }
.field { display: grid; gap: 8px; min-width: 0; }
.field span { color: var(--muted); font-size: 12px; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; }
.field input, .field select {
  width: 100%;
  min-height: 50px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0 14px;
  background: var(--surface-2);
  color: var(--text);
  outline: none;
}
.field input:focus, .field select:focus { border-color: var(--red); box-shadow: var(--focus); }
.field select:disabled { opacity: .65; }
.voice-btn { width: 52px; height: 52px; align-self: end; display: grid; place-items: center; }
.filter-grid { display: grid; gap: 12px; }
.primary-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.advanced-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.advanced {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface-2);
  overflow: hidden;
}
.advanced summary {
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 18px;
  font-weight: 950;
  cursor: pointer;
}
.advanced summary::-webkit-details-marker { display: none; }
.advanced summary b { min-width: 30px; height: 30px; display: grid; place-items: center; border-radius: 999px; background: var(--red); color: #fff; font-size: 13px; }
.advanced .filter-grid, .advanced .check-row { padding: 0 18px 18px; }
.check-row { display: flex; flex-wrap: wrap; gap: 10px; }
.check-row label { display: inline-flex; align-items: center; gap: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--text); font-weight: 800; font-size: 14px; }
.check-row input { accent-color: var(--red); }

.catalog { margin-top: 22px; padding: clamp(20px, 4vw, 34px); scroll-margin-top: 110px; }
.catalog-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 14px; margin-bottom: 12px; }
.view-switch { display: inline-flex; border: 1px solid var(--line); background: var(--surface-2); border-radius: 999px; padding: 4px; }
.view-switch button { border: 0; background: transparent; color: var(--muted); border-radius: 999px; padding: 9px 14px; font-weight: 900; }
.view-switch button.active { background: var(--surface); color: var(--text); box-shadow: 0 8px 24px rgba(0,0,0,.08); }
.active-tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 18px; }
.active-tags button { border: 1px solid var(--line); border-radius: 999px; padding: 8px 12px; background: var(--surface-2); color: var(--text); font-size: 13px; font-weight: 850; }
.cars-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.cars-grid.list { grid-template-columns: 1fr; }
.car-card { position: relative; overflow: hidden; border: 1px solid var(--line); background: var(--surface-2); border-radius: 26px; transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease; }
.car-card:hover { transform: translateY(-4px); border-color: color-mix(in srgb, var(--red), var(--line) 65%); box-shadow: 0 24px 70px rgba(0,0,0,.12); }
.card-photo { position: relative; height: 220px; overflow: hidden; background: linear-gradient(135deg, #111, #30333a); }
.card-photo img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s ease; }
.car-card:hover .card-photo img { transform: scale(1.04); }
.verified-badge { position: absolute; left: 12px; top: 12px; z-index: 2; display: none; padding: 7px 10px; border-radius: 999px; background: var(--red); color: #fff; font-size: 11px; font-weight: 950; letter-spacing: .05em; }
.car-card.is-verified .verified-badge { display: inline-flex; }
.favorite { position: absolute; right: 12px; top: 12px; z-index: 3; width: 42px; height: 42px; border-radius: 50%; border: 1px solid rgba(255,255,255,.45); color: #fff; background: rgba(0,0,0,.28); backdrop-filter: blur(10px); font-size: 22px; }
.favorite.active { background: var(--red); border-color: var(--red); }
.card-body { padding: 18px; }
.card-title-line { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.card-title-line h3 { margin: 0; font-size: 20px; line-height: 1.1; letter-spacing: -.035em; }
.card-price { color: var(--red); font-size: 20px; white-space: nowrap; }
.card-subtitle { margin: 8px 0 14px; color: var(--muted); font-weight: 700; }
.specs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.specs span, .color-line span, .options-line span, .card-bottom span { border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 8px 9px; color: var(--text); font-size: 12px; font-weight: 800; }
.color-line, .options-line { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 9px; }
.options-line span { color: var(--muted); }
.card-bottom { display: flex; justify-content: space-between; gap: 8px; margin-top: 14px; }
.card-bottom span { background: transparent; color: var(--muted); border: 0; padding: 0; }
.cars-grid.list .car-card { display: grid; grid-template-columns: 320px 1fr; }
.cars-grid.list .card-photo { height: 100%; min-height: 230px; }
.empty-state { text-align: center; border: 1px dashed var(--line-strong); border-radius: 22px; padding: 40px; background: var(--surface-2); }
.empty-state strong { display: block; margin-bottom: 8px; font-size: 24px; }

.verified-section, .dealers { margin-top: 22px; padding: clamp(22px, 4vw, 38px); }
.verified-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: 18px; }
.verified-grid article { border: 1px solid var(--line); background: var(--surface-2); border-radius: 24px; padding: 22px; }
.verified-grid span { display: block; color: var(--red); font-weight: 950; margin-bottom: 16px; }
.verified-grid strong { display: block; font-size: 20px; margin-bottom: 8px; }
.dealers { display: flex; align-items: center; justify-content: space-between; gap: 22px; background: linear-gradient(135deg, var(--black), #1b1d22); color: #fff; }
.dealers p { color: rgba(255,255,255,.7); }
.dealers .eyebrow { color: #ffb5b8; }
.site-footer { display: flex; justify-content: space-between; align-items: center; gap: 18px; padding: 28px 6px 10px; color: var(--muted); }
.footer-links { display: flex; flex-wrap: wrap; gap: 12px; font-weight: 800; }
.footer-links a:hover { color: var(--red); }

@media (max-width: 1180px) {
  .primary-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .advanced-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .cars-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .page-shell { padding: 10px; }
  .site-header { grid-template-columns: auto auto 1fr; top: 8px; border-radius: 20px; }
  .burger { display: grid; order: 2; }
  .brand { order: 1; }
  .header-actions { order: 3; justify-content: flex-end; }
  .sell-btn { display: none; }
  .main-nav {
    position: fixed;
    inset: 78px 10px auto 10px;
    display: grid;
    gap: 8px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 24px;
    background: var(--surface);
    box-shadow: var(--shadow);
    transform: translateY(-12px);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease, transform .2s ease;
  }
  body.menu-open .main-nav { opacity: 1; pointer-events: auto; transform: translateY(0); }
  .main-nav a { background: var(--surface-2); text-align: center; }
  .hero { grid-template-columns: 1fr; padding-top: 22px; }
  h1 { font-size: clamp(38px, 11vw, 58px); }
  .primary-grid, .advanced-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cars-grid { grid-template-columns: 1fr; }
  .cars-grid.list .car-card { grid-template-columns: 1fr; }
  .cars-grid.list .card-photo { height: 220px; }
  .verified-grid { grid-template-columns: 1fr; }
  .dealers, .site-footer, .catalog-head { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 560px) {
  .brand-text small { display: none; }
  .brand-mark { width: 44px; height: 44px; }
  .site-header { gap: 8px; }
  .hero-copy, .hero-panel, .filter-wrap, .catalog, .verified-section, .dealers { border-radius: 22px; }
  .search-line { grid-template-columns: 1fr; }
  .voice-btn { width: 100%; }
  .primary-grid, .advanced-grid { grid-template-columns: 1fr; }
  .hero-actions, .filter-actions { flex-direction: column; }
  .primary-action, .secondary-action, .reset-action { width: 100%; }
  .card-title-line { flex-direction: column; }
  .specs { grid-template-columns: 1fr; }
  .check-row label { width: 100%; }
}
