:root {
  --bg: #f4f2ef;
  --surface: #ffffff;
  --surface-2: #ece9e4;
  --text: #1d1b19;
  --muted: #6b665f;
  --border: #e0dcd5;
  --accent: #e8501b;
  --accent-text: #ffffff;
  --price: #c4310a;
  --good: #1a7f37;
  --img-bg: #ffffff;
  --shadow: 0 1px 2px rgba(0,0,0,.06), 0 2px 8px rgba(0,0,0,.04);
  --radius: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111317;
    --surface: #1b1e24;
    --surface-2: #262a32;
    --text: #ecebe8;
    --muted: #9b9a96;
    --border: #2e333b;
    --accent: #ff6a3d;
    --accent-text: #1a0c06;
    --price: #ff8a5c;
    --good: #4ac26b;
    --img-bg: #f3f3f3;
    --shadow: none;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111317;
  --surface: #1b1e24;
  --surface-2: #262a32;
  --text: #ecebe8;
  --muted: #9b9a96;
  --border: #2e333b;
  --accent: #ff6a3d;
  --accent-text: #1a0c06;
  --price: #ff8a5c;
  --good: #4ac26b;
  --img-bg: #f3f3f3;
  --shadow: none;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
}
button, input, select { font: inherit; color: inherit; }

.top {
  position: sticky; top: 0; z-index: 10;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  display: grid; gap: 10px;
}
.top-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand img { border-radius: 7px; flex: none; }
.brand h1 { font-size: 18px; margin: 0; letter-spacing: -.01em; }
.updated { margin: 0; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-actions { display: flex; gap: 6px; }
.icon-btn {
  width: 38px; height: 38px; display: grid; place-items: center;
  border: 1px solid var(--border); background: var(--surface); border-radius: 10px; cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); }

.search {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 0 12px;
  color: var(--muted);
}
.search:focus-within { border-color: var(--accent); }
.search input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; padding: 11px 0; color: var(--text);
  font-size: 16px; /* iOS'ta yakınlaştırmayı önler */
}

.chips {
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none;
  margin: 0 -16px; padding: 0 16px;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px; border-radius: 999px; cursor: pointer; white-space: nowrap;
  border: 1px solid var(--border); background: var(--surface); font-size: 14px;
}
.chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--muted)); }
.chip .n { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.chip[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.chip[aria-pressed="true"] .n { color: inherit; opacity: .7; }

.filters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.filters select {
  width: 100%; min-width: 0; padding: 9px 10px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface);
}

.segment {
  display: grid; grid-template-columns: repeat(3, 1fr);
  background: var(--surface-2); border-radius: 10px; padding: 3px; gap: 3px;
}
.segment[hidden] { display: none; }
.segment button {
  border: 0; background: transparent; padding: 7px 4px; border-radius: 8px; cursor: pointer; font-size: 14px;
}
.segment button[aria-pressed="true"] { background: var(--surface); box-shadow: var(--shadow); font-weight: 600; }

main { padding: 12px 16px 24px; max-width: 1200px; margin: 0 auto; }
.result-info { margin: 0 0 10px; color: var(--muted); font-size: 13px; }

.grid {
  display: grid; gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
@media (min-width: 560px) { .grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; } }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--shadow);
}
.card-img {
  position: relative; display: block; aspect-ratio: 1 / 1; background: var(--img-bg);
}
.card-img img { width: 100%; height: 100%; object-fit: contain; padding: 8px; display: block; }
.card-img img.placeholder { padding: 28%; opacity: .35; }
.badge-discount {
  position: absolute; left: 8px; top: 8px; background: var(--good); color: #fff;
  font-weight: 700; font-size: 12px; padding: 3px 7px; border-radius: 6px;
}
.badge-chain {
  position: absolute; right: 8px; top: 8px; background: var(--c, #555); color: #fff;
  font-weight: 700; font-size: 11px; padding: 3px 7px; border-radius: 6px; letter-spacing: .02em;
}
.card-body { padding: 10px 10px 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.card-brand { margin: 0; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-title {
  margin: 0; font-size: 14px; font-weight: 500; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.6em;
}
.price-row { display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px 8px; margin-top: 2px; }
.price { font-size: 19px; font-weight: 800; color: var(--price); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.old-price { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.card-note {
  margin: 0; font-size: 12px; color: var(--text); background: var(--surface-2); border-radius: 6px; padding: 3px 6px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-date { margin: 0; font-size: 12px; color: var(--muted); }
.card-date.soon { color: var(--accent); font-weight: 600; }
.card-link { margin-top: auto; padding-top: 6px; font-size: 12px; color: var(--muted); text-decoration: none; }
.card-link:hover { color: var(--accent); text-decoration: underline; }

.skeleton .card-img, .skeleton .sk { background: var(--surface-2); }
.skeleton .sk { height: 12px; border-radius: 4px; margin: 4px 0; }
.skeleton { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .55; } }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } }

.empty { text-align: center; color: var(--muted); padding: 40px 16px; }
.more { display: grid; place-items: center; padding: 16px 0; }
#moreBtn {
  padding: 10px 18px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); cursor: pointer;
}
#sentinel { height: 1px; width: 100%; }
.foot { text-align: center; color: var(--muted); font-size: 12px; padding: 8px 16px 28px; max-width: 640px; margin: 0 auto; }
