:root {
  --bg: #f6f7fb;
  --text: #10131a;
  --muted: #6f7785;
  --line: #e7e9ee;
  --card: #fff;
  --accent: #2563eb;
  --shadow: 0 12px 32px rgba(20, 28, 50, .07);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

button, input, select { font: inherit; }

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(37, 99, 235, .18);
  outline-offset: 2px;
}

.wrap {
  max-width: 1240px;
  margin: auto;
  padding: 0 22px;
}

.top {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(246, 247, 251, .9);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(231, 233, 238, .8);
}

.nav {
  height: 72px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand {
  font-weight: 900;
  font-size: 22px;
  letter-spacing: -.6px;
  margin-right: auto;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  color: inherit;
}

.brand span { color: var(--accent); }

.navlinks {
  display: flex;
  gap: 8px;
  align-items: center;
}

.navlinks button,
.ghost {
  border: 0;
  background: transparent;
  padding: 10px 13px;
  border-radius: 10px;
  color: #4f5663;
  cursor: pointer;
}

.navlinks button.active,
.navlinks button:hover {
  background: #fff;
  color: #111;
  box-shadow: 0 5px 18px rgba(20, 28, 50, .05);
}

.menu-btn {
  display: none;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  cursor: pointer;
}

.city-btn {
  background: #111;
  color: #fff;
  border: 0;
  border-radius: 11px;
  padding: 10px 13px;
  cursor: pointer;
}

.lang-wrap {
  display: flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .92);
  border-radius: 13px;
  padding: 0 8px 0 10px;
  box-shadow: 0 4px 14px rgba(20, 28, 50, .04);
  transition: .18s;
}

.lang-wrap:hover,
.lang-wrap:focus-within {
  border-color: #d2d7e0;
  box-shadow: 0 8px 22px rgba(20, 28, 50, .07);
}

.lang-icon { font-size: 12px; color: #7b8390; }

.hero { padding: 55px 0 25px; }

.hero-grid {
  display: grid;
  grid-template-columns: 1.35fr .65fr;
  gap: 25px;
  align-items: end;
}

.eyebrow {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  background: #eaf0ff;
  color: #1e56d8;
  padding: 7px 10px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 12px;
}

.hero h1 {
  font-size: clamp(34px, 6vw, 60px);
  line-height: 1.08;
  letter-spacing: -1.2px;
  max-width: 760px;
  margin: 16px 0;
}

.hero p {
  font-size: 18px;
  color: var(--muted);
  max-width: 720px;
  line-height: 1.55;
  margin: 0;
}

.searchbox {
  margin-top: 28px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  border-radius: 17px;
  display: flex;
  align-items: center;
  padding: 8px;
}

.searchbox input {
  flex: 1;
  border: 0;
  outline: 0;
  padding: 13px 14px;
  font-size: 16px;
  min-width: 0;
}

.searchbtn {
  border: 0;
  background: #111827;
  color: #fff;
  padding: 12px 16px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 700;
  white-space: nowrap;
}

.stats {
  background: #111827;
  color: #fff;
  border-radius: 20px;
  padding: 22px;
}

.stats .big {
  font-size: 40px;
  font-weight: 900;
  letter-spacing: -1px;
}

.stats p {
  color: #b6becd;
  margin: 5px 0 18px;
}

.mini {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.mini div {
  background: #1f2634;
  border-radius: 12px;
  padding: 11px;
}

.mini b { display: block; font-size: 18px; }
.mini span { color: #aeb7c7; font-size: 12px; }

.toolbar {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  justify-content: space-between;
  margin: 22px 0 16px;
  flex-wrap: wrap;
}

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

.chip {
  border: 1px solid var(--line);
  background: #fff;
  padding: 9px 12px;
  border-radius: 999px;
  cursor: pointer;
  color: #4f5663;
}

.chip.active {
  background: #111827;
  color: #fff;
  border-color: #111827;
}

.content {
  display: grid;
  grid-template-columns: 235px 1fr;
  gap: 20px;
}

.sidebar {
  position: sticky;
  top: 92px;
  height: max-content;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 17px;
  padding: 17px;
  box-shadow: var(--shadow);
}

.sidebar h3 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .7px;
  color: #858c98;
  margin: 0 0 11px;
}

.store {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 8px;
  border-radius: 11px;
  cursor: pointer;
}

.store:hover { background: #f6f7fb; }
.store input { accent-color: #111827; }

.store-logo {
  width: 29px;
  height: 29px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  font-weight: 900;
  font-size: 12px;
  flex-shrink: 0;
}

.sep { height: 1px; background: var(--line); margin: 14px 0; }
.muted { color: var(--muted); }

.cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 15px;
}

.card {
  background: #fff;
  border: 2px solid #e8ebf0;
  border-radius: 18px;
  padding: 13px;
  box-shadow: 0 8px 24px rgba(20, 28, 50, .05);
  transition: .18s;
  cursor: pointer;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 30px rgba(20, 28, 50, .09);
}

.cardtop { display: flex; align-items: center; gap: 8px; }
.cardtop b { font-size: 13px; }

.discount {
  margin-left: auto;
  background: #111827;
  color: #fff;
  padding: 5px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
}

.prodimg {
  height: 190px;
  margin: 12px 0;
  border-radius: 13px;
  background: linear-gradient(135deg, #f3f5f8, #eef1f5);
  display: grid;
  place-items: center;
  font-size: 66px;
  overflow: hidden;
}

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

.cat { font-size: 11px; color: #8a919e; }

.name {
  font-size: 16px;
  font-weight: 800;
  line-height: 1.28;
  margin: 5px 0 8px;
  min-height: 41px;
}

.price-row { display: flex; align-items: baseline; gap: 7px; }
.price { font-size: 24px; font-weight: 950; letter-spacing: -.5px; }
.old { text-decoration: line-through; color: #999; font-size: 13px; }

.sub {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 11px;
  font-size: 11px;
  color: #7c8490;
}

.fav {
  border: 1px solid var(--line);
  background: #fff;
  width: 31px;
  height: 31px;
  border-radius: 10px;
  cursor: pointer;
}

.urgent { color: #d33b3b; font-weight: 800; }
.section-title { margin: 0; font-size: 24px; letter-spacing: -.5px; }

.nores {
  padding: 45px;
  background: #fff;
  border: 1px dashed #dfe3ea;
  border-radius: 18px;
  text-align: center;
  color: var(--muted);
  grid-column: 1 / -1;
}

.store-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 15px;
}

.store-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 20px;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: .18s;
}

.store-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 30px rgba(20, 28, 50, .09);
}

.store-card .count {
  font-size: 28px;
  font-weight: 900;
  margin: 12px 0 4px;
}

.footer {
  padding: 50px 0 70px;
  color: #7b8390;
  font-size: 13px;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(10, 13, 20, .46);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 50;
}

.modal.open { display: flex; }

.dialog {
  width: min(850px, 100%);
  max-height: 90vh;
  overflow: auto;
  background: #fff;
  border-radius: 22px;
  padding: 20px;
}

.dialogtop {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.close {
  border: 0;
  background: #f2f4f7;
  border-radius: 10px;
  padding: 9px 12px;
  cursor: pointer;
}

.detail {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
  margin-top: 16px;
}

.detailimg {
  min-height: 300px;
  border-radius: 18px;
  background: linear-gradient(135deg, #f2f4f8, #e9edf3);
  display: grid;
  place-items: center;
  font-size: 100px;
  overflow: hidden;
}

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

.detail h2 {
  font-size: 32px;
  line-height: 1.05;
  margin: 10px 0;
}

.bigprice { font-size: 36px; font-weight: 950; }

.compare {
  margin-top: 20px;
  border-top: 1px solid var(--line);
  padding-top: 15px;
}

.compare-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid #f0f1f4;
}

.compare-row.best { font-weight: 800; }
.source-link { color: var(--accent); font-weight: 700; text-decoration: none; }

.toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #111827;
  color: #fff;
  padding: 12px 15px;
  border-radius: 12px;
  opacity: 0;
  pointer-events: none;
  transition: .2s;
  z-index: 80;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.dropdown { position: relative; min-width: 190px; }

.dropdown-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .96);
  color: #232833;
  border-radius: 12px;
  padding: 10px 12px;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(20, 28, 50, .035);
}

.dropdown-value {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dropdown-chevron {
  font-size: 16px;
  color: #7a8290;
  line-height: 1;
  transition: transform .16s;
}

.dropdown.open .dropdown-chevron { transform: rotate(180deg); }

.dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  padding: 6px;
  background: rgba(255, 255, 255, .98);
  border: 1px solid #e3e6ec;
  border-radius: 14px;
  box-shadow: 0 18px 45px rgba(20, 28, 50, .15);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-5px);
  transition: .14s;
  z-index: 70;
}

.dropdown.open .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-menu button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 0;
  background: transparent;
  color: #303643;
  text-align: left;
  padding: 10px 11px;
  border-radius: 9px;
  cursor: pointer;
}

.dropdown-menu button:hover { background: #f3f5f8; }
.dropdown-menu button[aria-selected="true"] {
  background: #eef3ff;
  color: #1d4ed8;
  font-weight: 800;
}

.sort-dropdown { display: none; min-width: 210px; }
.dropdown-menu-right { left: auto; right: 0; min-width: 100%; }

.page-deals .stores-page,
.page-stores .deals-page,
.page-favorites .deals-page,
.page-stores .sidebar,
.page-favorites .sidebar { display: none; }

.page-stores .stores-page,
.page-favorites .deals-page { display: block; }

.page-favorites .sidebar { display: none; }
.page-favorites .content { grid-template-columns: 1fr; }
.page-stores .sort-chips,
.page-stores .sort-dropdown { display: none; }

@media (max-width: 980px) {
  .hero-grid { grid-template-columns: 1fr; }
  .content { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .cards,
  .store-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .wrap { padding: 0 14px; }
  .nav { height: 64px; }
  .menu-btn { display: grid; place-items: center; }
  .navlinks {
    display: none;
    position: absolute;
    top: 72px;
    left: 14px;
    right: 14px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 8px;
    flex-direction: column;
    align-items: stretch;
    box-shadow: var(--shadow);
  }
  .nav.open .navlinks { display: flex; }
  .hero { padding-top: 34px; }
  .hero h1 { letter-spacing: -1.7px; }
  .cards,
  .store-cards { grid-template-columns: 1fr; }
  .prodimg { height: 220px; }
  .detail { grid-template-columns: 1fr; }
  .detailimg { min-height: 220px; }
  .toolbar { align-items: stretch; }
  .sort-chips { display: none; }
  .sort-dropdown { display: block; width: 100%; min-width: 0; }
  .city-btn { display: none; }
}
