:root {
  --bg: #f6f5f2;
  --surface: #ffffff;
  --ink: #18181b;
  --muted: #6b6b70;
  --line: #e6e4df;
  --accent: #18181b;
  --accent-ink: #ffffff;
  --wa: #1fa855;
  --wa-ink: #ffffff;
  --chip: #ecebe6;
  --badge: #e5484d;
  --shadow: 0 1px 2px rgb(0 0 0 / .06), 0 8px 24px rgb(0 0 0 / .06);
  --radius: 14px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111214;
    --surface: #1a1b1e;
    --ink: #f1f1f2;
    --muted: #a0a0a6;
    --line: #2a2b2f;
    --accent: #f1f1f2;
    --accent-ink: #111214;
    --wa: #25c264;
    --wa-ink: #08130c;
    --chip: #24252a;
    --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 8px 24px rgb(0 0 0 / .35);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html.locked, html.locked body { overflow: hidden; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

.app { max-width: 1180px; margin: 0 auto; padding: 0 16px calc(96px + env(safe-area-inset-bottom)); }

/* üst bölüm */
.top { position: sticky; top: 0; z-index: 5; margin: 0 -16px; padding: 12px 16px 10px; background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.top-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { margin: 0; font-size: 19px; font-weight: 750; letter-spacing: -.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cart-btn { position: relative; flex: none; width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 50%; background: var(--surface); display: grid; place-items: center; }
.cart-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.badge { position: absolute; top: -4px; right: -4px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: var(--badge); color: #fff; font-size: 11.5px; font-weight: 700; display: grid; place-items: center; }
.tools { display: flex; gap: 8px; margin-top: 10px; }
.search { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; height: 42px; padding: 0 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.search svg { flex: none; width: 18px; height: 18px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 16px; }
.search:focus-within { border-color: var(--ink); }
.sort { flex: none; height: 42px; padding: 0 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); max-width: 42vw; }
.chips { display: flex; gap: 6px; margin: 10px -16px 0; padding: 0 16px 2px; overflow-x: auto; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; height: 32px; padding: 0 13px; border: 0; border-radius: 16px; background: var(--chip); font-size: 13.5px; font-weight: 600; }
.chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.chips.categories .chip { height: 34px; padding: 0 15px; font-size: 14px; }
.cat-bar { position: relative; }
/* Masaüstü (fare): şerit kaydırılmaz; sığmayanlar "…" menüsündedir. */
.chips.categories.fit { overflow: hidden; }
.chip.cat-more { min-width: 42px; }
.chip.cat-more[aria-expanded="true"] { outline: 2px solid var(--ink); outline-offset: 1px; }
.cat-menu { position: absolute; top: calc(100% + 6px); z-index: 6; min-width: 180px; max-width: min(320px, calc(100vw - 16px)); max-height: min(60vh, 420px); overflow-y: auto;
  padding: 6px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); display: grid; gap: 2px; }
.cat-menu[hidden] { display: none; }
.cat-item { text-align: left; padding: 9px 12px; border: 0; border-radius: 8px; background: transparent; font-size: 14px; font-weight: 600; color: inherit; }
.cat-item:hover, .cat-item:focus-visible { background: var(--chip); outline: none; }
.cat-item[aria-checked="true"] { background: var(--accent); color: var(--accent-ink); }
.cat-bar + .chips { margin-top: 8px; }
.cat-bar + .chips .chip { height: 28px; font-size: 12.5px; background: transparent; border: 1px solid var(--line); }
.cat-bar + .chips .chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

/* liste */
.count { margin: 14px 2px 10px; color: var(--muted); font-size: 13px; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; } }
@media (min-width: 960px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.card { display: flex; flex-direction: column; background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.card-link { display: flex; flex-direction: column; flex: 1; color: inherit; text-decoration: none; }
.card-media { position: relative; aspect-ratio: 1 / 1; background: var(--chip); }
.card-media img { width: 100%; height: 100%; object-fit: cover; }
.num { position: absolute; left: 8px; top: 8px; padding: 2px 8px; border-radius: 8px; background: rgb(0 0 0 / .72); color: #fff; font-size: 12.5px; font-weight: 700; letter-spacing: .01em; }
.num.inline { position: static; display: inline-block; background: var(--accent); color: var(--accent-ink); }
.card-body { padding: 10px 12px 4px; }
.card-title { margin: 0; font-size: 14px; font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-price { margin: 6px 0 0; font-size: 15.5px; font-weight: 750; }
/* İndirim: eski fiyat üstü çizili, indirimli fiyat vurgulu; kartta oran rozeti */
.was { color: var(--muted); font-weight: 500; font-size: .82em; }
.now { color: var(--badge); }
.off { position: absolute; right: 8px; top: 8px; padding: 2px 8px; border-radius: 8px; background: var(--badge); color: #fff; font-size: 12.5px; font-weight: 700; }
.card-sub { margin: 2px 0 0; color: var(--muted); font-size: 12.5px; }
.card-add { margin: 8px 10px 10px; height: 38px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font-weight: 650; font-size: 13.5px; }
.card-add:active { transform: scale(.98); }
.ph { width: 100%; height: 100%; display: grid; place-items: center; background: repeating-linear-gradient(135deg, var(--chip) 0 12px, color-mix(in srgb, var(--chip) 70%, var(--surface)) 12px 24px); }
.ph span { font-size: 22px; font-weight: 800; color: var(--muted); }
.more { min-height: 1px; display: flex; justify-content: center; padding: 6px 0 2px; }
.more .loading { margin: 10px 0; color: var(--muted); font-size: 13px; }
.empty { grid-column: 1 / -1; margin: 40px 0; text-align: center; color: var(--muted); }
.foot { margin: 28px 0 0; text-align: center; color: var(--muted); font-size: 12.5px; }

/* alt sepet çubuğu */
.cartbar { position: fixed; z-index: 6; left: 50%; bottom: calc(14px + env(safe-area-inset-bottom)); transform: translateX(-50%); width: min(560px, calc(100% - 32px));
  height: 52px; padding: 0 18px; border: 0; border-radius: 26px; background: var(--accent); color: var(--accent-ink); box-shadow: 0 10px 30px rgb(0 0 0 / .25);
  display: flex; align-items: center; justify-content: space-between; font-weight: 650; }

/* katman (ürün / sepet) */
.layer { position: fixed; inset: 0; z-index: 10; background: rgb(0 0 0 / .45); display: flex; align-items: flex-end; justify-content: center; }
.layer.opening { animation: fade .15s ease-out; }
.layer.opening .sheet { animation: up .2s ease-out; }
.sheet { position: relative; width: 100%; max-height: 92dvh; overflow-y: auto; overscroll-behavior: contain; background: var(--surface); border-radius: 18px 18px 0 0;
  padding-bottom: env(safe-area-inset-bottom); }
@media (min-width: 760px) {
  .layer { align-items: center; padding: 24px; }
  .sheet { max-width: 520px; border-radius: 18px; max-height: 88vh; }
  .gallery { max-height: 60vh; }
}
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(24px); opacity: .6; } }
@media (prefers-reduced-motion: reduce) { .layer.opening, .layer.opening .sheet { animation: none; } }
.close { position: sticky; top: 10px; float: right; z-index: 2; margin: 10px 10px -46px 0; width: 36px; height: 36px; border: 0; border-radius: 50%;
  background: rgb(0 0 0 / .55); color: #fff; font-size: 22px; line-height: 1; display: grid; place-items: center; }
.cart .close { background: var(--chip); color: var(--ink); }
.gallery { display: flex; width: 100%; aspect-ratio: 1 / 1; max-height: 62dvh; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; background: var(--chip); border-radius: 18px 18px 0 0; }
.gallery::-webkit-scrollbar { display: none; }
.gallery img, .gallery .ph { flex: 0 0 100%; width: 100%; height: 100%; object-fit: contain; scroll-snap-align: center; }
.dots { display: flex; justify-content: center; gap: 6px; margin-top: 10px; }
.dots i { width: 6px; height: 6px; border-radius: 3px; background: var(--line); transition: width .15s; }
.dots i.on { width: 16px; background: var(--ink); }
.sheet-body { padding: 14px 18px 20px; }
.meta { display: flex; align-items: center; gap: 8px; margin: 0; }
.code { color: var(--muted); font-size: 13px; }
.p-title { margin: 8px 0 0; font-size: 20px; font-weight: 700; line-height: 1.25; }
.p-price { margin: 6px 0 0; font-size: 22px; font-weight: 800; }
.opt { margin: 16px 0 0; padding: 0; border: 0; }
.opt legend { padding: 0; margin-bottom: 8px; color: var(--muted); font-size: 13.5px; }
.opt legend b { color: var(--ink); }
.opt-values { display: flex; flex-wrap: wrap; gap: 8px; }
.opt-btn { min-width: 46px; height: 40px; padding: 0 14px; border: 1.5px solid var(--line); border-radius: 10px; background: var(--surface); font-weight: 600; }
.opt-btn[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: var(--surface); }
.opt-btn[data-off] { color: var(--muted); text-decoration: line-through; opacity: .55; }
.buy { display: flex; gap: 10px; margin-top: 20px; }
.qty { flex: none; display: flex; align-items: center; height: 50px; border: 1.5px solid var(--line); border-radius: 12px; }
.qty button { width: 42px; height: 100%; border: 0; background: transparent; font-size: 20px; }
.qty output { min-width: 26px; text-align: center; font-weight: 700; }
.qty.small { height: 38px; border-radius: 10px; }
.qty.small button { width: 34px; font-size: 16px; }
.primary { flex: 1; min-height: 50px; padding: 0 16px; border: 0; border-radius: 12px; background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 15.5px; }
.primary[aria-disabled="true"] { opacity: .45; }
.primary.wa { width: 100%; margin-top: 14px; background: var(--wa); color: var(--wa-ink); }
.cart .primary:not(.wa) { width: 100%; }
.link { display: block; margin: 14px auto 0; padding: 6px; border: 0; background: transparent; color: var(--muted); font-size: 13.5px; text-decoration: underline; text-underline-offset: 3px; }

/* sepet */
.lines { list-style: none; margin: 14px 0 0; padding: 0; }
.line { display: grid; grid-template-columns: 58px 1fr auto; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.line-media { width: 58px; height: 58px; border-radius: 10px; overflow: hidden; background: var(--chip); }
.line-media img { width: 100%; height: 100%; object-fit: cover; }
.line-media .ph span { font-size: 12px; }
.line-body { min-width: 0; }
.line-title { margin: 0; font-size: 14px; font-weight: 600; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; }
.line-title .num { font-size: 11.5px; padding: 1px 6px; }
.line-sub { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.line-price { margin: 4px 0 0; font-weight: 700; font-size: 14px; }
.line-price small { color: var(--muted); font-weight: 500; }
.sum { display: flex; justify-content: space-between; margin-top: 10px; font-size: 14.5px; color: var(--muted); }
.sum + .sum { margin-top: 4px; }
.hint.free { color: var(--wa); font-weight: 600; margin-top: 4px; }
.qty button:disabled { opacity: .3; cursor: default; }
.notice { position: fixed; z-index: 30; left: 50%; top: calc(14px + env(safe-area-inset-top)); transform: translateX(-50%); width: min(520px, calc(100% - 32px));
  padding: 14px 16px; border-radius: 14px; background: var(--surface); color: var(--ink); border: 1.5px solid var(--badge); box-shadow: 0 12px 32px rgb(0 0 0 / .22); }
.notice ul { margin: 0; padding-left: 18px; font-size: 14px; font-weight: 600; }
.notice li + li { margin-top: 4px; }
.notice-close { display: block; margin: 10px 0 0 auto; height: 34px; padding: 0 16px; border: 0; border-radius: 10px; background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.total { display: flex; justify-content: space-between; align-items: baseline; margin-top: 14px; font-size: 16px; }
.total b { font-size: 21px; }
.hint { margin: 10px 0 0; color: var(--muted); font-size: 13px; }
.hint.warn { color: var(--badge); }
.sent { margin-top: 14px; padding: 12px; border-radius: 12px; background: var(--chip); text-align: center; font-size: 13.5px; }
.sent p { margin: 0; }
.sent .link { margin-top: 6px; color: var(--ink); font-weight: 600; }

.toast { position: fixed; z-index: 20; left: 50%; top: calc(14px + env(safe-area-inset-top)); transform: translate(-50%, -12px); max-width: calc(100% - 32px);
  padding: 10px 16px; border-radius: 12px; background: var(--ink); color: var(--surface); font-size: 14px; font-weight: 600; box-shadow: var(--shadow);
  opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
