:root {
  --bg: #f4f1eb;
  --surface: #ffffff;
  --surface-soft: #fbfaf7;
  --text: #1e293b;
  --muted: #64748b;
  --border: #dde4ef;
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --shadow: 0 16px 40px rgba(15, 23, 42, 0.08);
  --radius-lg: 22px;
  --radius-md: 16px;
  --container: 1380px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: linear-gradient(180deg, #fcfbf8 0%, #f5f1ea 100%);
  color: var(--text);
  font-family: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
}

.container {
  width: min(var(--container), calc(100vw - 40px));
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(148, 163, 184, 0.16);
}

.header-inner {
  min-height: 84px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #0f172a 0%, #334155 100%);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.brand strong {
  display: block;
  font-size: 19px;
  letter-spacing: -0.02em;
}

.brand small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.nav {
  display: flex;
  align-items: center;
  gap: 28px;
  color: #334155;
  font-size: 15px;
  font-weight: 700;
}

.nav a:hover {
  color: var(--accent);
}

.marketplace {
  padding: 28px 0 44px;
}

.intro {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 20px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 12px;
}

h1 {
  margin: 0;
  font-size: 42px;
  line-height: 1.04;
  letter-spacing: -0.04em;
}

.intro-copy {
  max-width: 560px;
  margin: 0;
  color: var(--muted);
  font-size: 16px;
}

.controls {
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(221, 228, 239, 0.9);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 18px;
  display: grid;
  grid-template-columns: minmax(280px, 2.6fr) minmax(160px, 1fr) minmax(170px, 1fr) minmax(120px, .8fr) minmax(120px, .8fr) 58px;
  gap: 10px;
  align-items: center;
}

.controls input,
.controls select,
.controls button {
  width: 100%;
  min-width: 0;
  height: 48px;
  padding: 0 15px;
  border: 1px solid #d8dfeb;
  border-radius: 14px;
  background: #fff;
  color: #334155;
}

.controls input:focus,
.controls select:focus,
.controls button:focus {
  outline: none;
  border-color: #9bb8ff;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.12);
}

#resetFilters {
  padding: 0;
  display: grid;
  place-items: center;
  cursor: pointer;
  font-size: 26px;
  line-height: 1;
  color: #667085;
}

.result-meta {
  margin-top: 18px;
  margin-bottom: 14px;
  color: var(--muted);
  font-weight: 700;
}

.cards {
  display: grid;
  gap: 22px;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
}

.card {
  background: rgba(255, 255, 255, 0.92);
  border-radius: 22px;
  overflow: hidden;
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.08);
  display: flex;
  flex-direction: column;
}

.photo {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #eef2f7;
  overflow: hidden;
}

.photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-placeholder {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  color: #94a3b8;
  font-weight: 800;
  font-size: 44px;
}

.card-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  flex: 1;
}

.card h2 {
  margin: 0;
  font-size: 17px;
  line-height: 1.28;
  letter-spacing: -0.01em;
}

.meta {
  color: var(--muted);
  font-size: 13px;
}

.price {
  margin-top: 4px;
  font-size: 18px;
  font-weight: 800;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  padding: 5px 9px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #475569;
  font-size: 12px;
  font-weight: 700;
}

.more {
  margin-top: auto;
  display: block;
  width: 100%;
  min-height: 44px;
  border: 0;
  border-radius: 14px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}

.more:hover {
  background: var(--accent-dark);
}

.empty {
  grid-column: 1 / -1;
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.85);
  color: var(--muted);
  text-align: center;
}

.dialog {
  width: min(980px, calc(100vw - 24px));
  border: 0;
  border-radius: 24px;
  padding: 0;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.25);
}

.dialog::backdrop {
  background: rgba(15, 23, 42, 0.48);
}

.dialog-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 14px;
  background: rgba(255,255,255,.9);
  font-size: 24px;
  cursor: pointer;
}

.detail {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, .9fr);
  gap: 24px;
  padding: 24px;
}

.detail-image {
  border-radius: 18px;
  overflow: hidden;
  background: #eef2f7;
  aspect-ratio: 1 / 1;
}

.detail-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.detail h2 {
  margin: 0 42px 10px 0;
  font-size: 30px;
  line-height: 1.12;
}

.specs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 18px 0;
}

.spec {
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 14px;
}

.spec span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 2px;
}

.spec strong {
  font-size: 14px;
}

.description {
  color: #334155;
  white-space: pre-wrap;
}

.telegram {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  margin-top: 18px;
  padding: 0 18px;
  border-radius: 14px;
  background: #2aabee;
  color: #fff;
  font-weight: 800;
}

.site-footer {
  padding: 26px 0 34px;
  color: #64748b;
  font-size: 14px;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-top: 1px solid rgba(148, 163, 184, 0.2);
  padding-top: 18px;
}

@media (max-width: 980px) {
  .intro {
    align-items: start;
    flex-direction: column;
  }

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

  .search-wrap {
    grid-column: 1 / -1;
  }

  #resetFilters {
    grid-column: 1 / -1;
  }

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

@media (max-width: 640px) {
  .container {
    width: min(var(--container), calc(100vw - 24px));
  }

  .header-inner {
    min-height: 74px;
  }

  .nav {
    display: none;
  }

  h1 {
    font-size: 34px;
  }

  .controls {
    grid-template-columns: 1fr;
    border-radius: 20px;
  }

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

  .detail {
    padding: 14px;
  }

  .detail h2 {
    font-size: 24px;
  }

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

  .footer-inner {
    align-items: start;
    flex-direction: column;
  }
}
