:root {
  --bg: #f4f1eb;
  --bg-hero: #eef5f2;
  --surface: #ffffff;
  --ink: #1a1a18;
  --muted: #5c5a55;
  --line: #e4e0d6;
  --brand: #0e7c6b;
  --brand-dark: #0a5448;
  --brand-soft: #d7efe9;
  --gold: #c98911;
  --gold-soft: #fff3d0;
  --red: #d61f3a;
  --red-soft: #fde8eb;
  --shadow: 0 10px 30px rgba(26, 26, 24, 0.08);
  --shadow-sm: 0 2px 10px rgba(26, 26, 24, 0.06);
  --radius: 16px;
  --font: "Segoe UI", "Helvetica Neue", "Noto Sans", "Noto Sans Arabic", "Arial", sans-serif;
  --max: 1080px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body { margin: 0; padding: 0; }
html { height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  min-height: 100dvh;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.app-bar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top, 0px);
  padding-inline: env(safe-area-inset-left, 0px) env(safe-area-inset-right, 0px);
}
img { max-width: 100%; display: block; }
a { color: var(--brand-dark); }
button, input, select { font: inherit; }

.skip {
  position: absolute;
  inset-inline-start: -999px;
  top: 0;
  background: var(--brand);
  color: #fff;
  padding: 0.5rem 1rem;
  z-index: 20;
}
.skip:focus { inset-inline-start: 0.5rem; top: 0.5rem; }
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.site-header, .site-footer, .page, .hero, .results {
  width: min(var(--max), calc(100% - 2rem));
  margin-inline: auto;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 0;
  min-height: 3.5rem;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}
.install-btn {
  appearance: none;
  border: 0;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  line-height: 1.2;
}
.install-btn:hover { background: var(--brand-dark); }
body.is-standalone .install-btn { display: none !important; }
@media (display-mode: standalone) {
  .install-btn { display: none !important; }
}
.install-hint {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 3.6rem);
  inset-inline-end: max(0.75rem, env(safe-area-inset-right, 0px));
  z-index: 50;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  border-radius: 12px;
  padding: 0.85rem 1rem;
  max-width: 18rem;
}
.install-hint[hidden] { display: none !important; }
.install-hint p { margin: 0 0 0.6rem; font-size: 0.95rem; font-weight: 650; }
.install-hint button {
  appearance: none;
  border: 0;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
  border-radius: 999px;
  padding: 0.3rem 0.8rem;
  cursor: pointer;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  color: inherit;
}
.brand img { width: 36px; height: 36px; }
.brand-name {
  font-weight: 750;
  font-size: 1.2rem;
  letter-spacing: -0.03em;
}
.brand-name span { color: var(--brand); }

.lang-wrap select {
  appearance: none;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%235c5a55' d='M1 1l5 5 5-5'/%3E%3C/svg%3E") no-repeat;
  background-position: right 0.7rem center;
  padding: 0.4rem 2rem 0.4rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  cursor: pointer;
}
[dir="rtl"] .lang-wrap select {
  background-position: left 0.7rem center;
  padding: 0.4rem 0.75rem 0.4rem 2rem;
}

main { flex: 1 0 auto; }

.hero {
  text-align: center;
  padding: 3.2rem 0 2.5rem;
}
.wordmark {
  margin: 0;
  font-size: clamp(2.4rem, 6vw, 4rem);
  letter-spacing: -0.05em;
  font-weight: 800;
  line-height: 1;
}
.wordmark span { color: var(--brand); }
.tagline {
  margin: 0.7rem 0 1.6rem;
  font-size: clamp(1.05rem, 2.4vw, 1.35rem);
  color: var(--muted);
  font-weight: 500;
}

.search-form {
  display: flex;
  align-items: stretch;
  gap: 0;
  max-width: 720px;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.search-form:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px var(--brand-soft), var(--shadow);
}
.search-form input[type="search"] {
  flex: 1;
  border: 0;
  outline: none;
  background: transparent;
  padding: 0.95rem 1.25rem;
  font-size: 1.05rem;
  min-width: 0;
}
.search-form input[type="search"]::-webkit-search-cancel-button { appearance: none; }
.search-form button {
  border: 0;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
  padding: 0 1.4rem;
  cursor: pointer;
  min-width: 6.5rem;
}
.search-form button:hover { background: var(--brand-dark); }

.intro {
  max-width: 46rem;
  margin: 1.6rem auto 0;
  color: var(--muted);
  font-size: 1.02rem;
  text-align: start;
}
.chips-label {
  margin: 1.4rem 0 0.6rem;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  list-style: none;
  padding: 0;
  margin: 0 auto;
}
.chips button {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.4rem 0.9rem;
  cursor: pointer;
  color: var(--ink);
}
.chips button:hover {
  border-color: var(--brand);
  color: var(--brand-dark);
}

body.has-results .hero {
  padding: 0.4rem 0 1rem;
  text-align: start;
}
body.has-results .wordmark,
body.has-results .tagline,
body.has-results .intro,
body.has-results .chips-wrap { display: none; }
body.has-results .search-form { margin: 0; }

.demo-banner {
  background: var(--gold-soft);
  color: #6a4a08;
  border: 1px solid #efd48a;
  border-radius: 12px;
  padding: 0.7rem 1rem;
  font-weight: 650;
  font-size: 0.95rem;
  margin-bottom: 1rem;
}
.results-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.4rem 1rem;
  margin-bottom: 1rem;
}
.results-head h2 {
  margin: 0;
  font-size: 1.2rem;
  letter-spacing: -0.02em;
}
.results-head p { margin: 0; color: var(--muted); }

.cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  padding-bottom: 2.5rem;
}
.card {
  display: grid;
  grid-template-columns: 160px 1fr auto;
  gap: 1rem 1.2rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 1rem;
  align-items: center;
}
.card.is-best {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft), var(--shadow-sm);
}
.card-image {
  width: 160px;
  height: 120px;
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg-hero);
}
.card-image img { width: 100%; height: 100%; object-fit: cover; }
.card-body { min-width: 0; }
.card-body h3 {
  margin: 0 0 0.25rem;
  font-size: 1.08rem;
  letter-spacing: -0.02em;
  line-height: 1.3;
}
.card-body h3,
.card-desc,
.store-name {
  unicode-bidi: isolate;
}
[dir="rtl"] .card-body h3,
[dir="rtl"] .card-desc,
[dir="rtl"] .store-name {
  direction: ltr;
  text-align: right;
}
[dir="rtl"] .site-footer p {
  unicode-bidi: isolate;
}

.card-desc {
  margin: 0 0 0.5rem;
  color: var(--muted);
  font-size: 0.92rem;
}
.meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.7rem;
  font-size: 0.88rem;
}
.store-name {
  font-weight: 700;
  color: var(--ink);
}
.best-badge {
  background: var(--brand);
  color: #fff;
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 0.02em;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
}
.card-buy {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.45rem;
  text-align: end;
  min-width: 8.5rem;
}
[dir="rtl"] .card-buy { align-items: flex-start; text-align: start; }
.price {
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
}
.price-was {
  color: var(--muted);
  text-decoration: line-through;
  font-size: 0.95rem;
}
.discount {
  display: inline-block;
  background: var(--red);
  color: #fff;
  font-weight: 800;
  font-size: 0.85rem;
  padding: 0.18rem 0.5rem;
  border-radius: 8px;
  letter-spacing: 0.01em;
}
.view-deal {
  display: inline-block;
  background: var(--brand);
  color: #fff !important;
  text-decoration: none;
  font-weight: 700;
  padding: 0.5rem 0.9rem;
  border-radius: 999px;
  white-space: nowrap;
}
.view-deal:hover { background: var(--brand-dark); }

.empty, .loading {
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 2rem 1.2rem;
  text-align: center;
  color: var(--muted);
}

.site-footer {
  border-top: 1px solid var(--line);
  padding: 1.4rem 0 max(2rem, env(safe-area-inset-bottom, 0px));
  color: var(--muted);
  font-size: 0.92rem;
}
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.1rem;
  margin-bottom: 0.5rem;
}
.footer-links a { color: var(--ink); text-decoration: none; }
.footer-links a:hover { color: var(--brand-dark); text-decoration: underline; }
.site-footer p { margin: 0; }

.page { padding: 0.5rem 0 3rem; max-width: 42rem; }
.page h1 { margin: 0 0 1rem; letter-spacing: -0.03em; }
.page p { color: var(--ink); }

@media (max-width: 720px) {
  .card {
    grid-template-columns: 1fr;
    align-items: stretch;
  }
  .card-image {
    width: 100%;
    height: 180px;
  }
  .card-buy {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    text-align: start;
    min-width: 0;
  }
  [dir="rtl"] .card-buy { text-align: start; }
  .hero { padding: 1.8rem 0 1.6rem; }
  .search-form button { min-width: 5.2rem; padding-inline: 1rem; }
}
