/* Berfyo köprüsü: her üç şablonda aynı duran küçük katman. Şablonun kendi stiline dokunmaz. */
#berfyo-track, #berfyo-dock, #bf-sheet, #berfyo-toast, .bf-sold {
  --bf-bg: rgba(22, 20, 18, .94); --bf-ink: #fbf7f1; --bf-mute: #bdb4a8; --bf-line: rgba(255, 255, 255, .12);
  --bf-ok: #3ccf7a; --bf-warm: #ffb547; --bf-bad: #ff6b5a; --bf-accent: #ffb547;
  font: 500 14px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; letter-spacing: 0; color: var(--bf-ink);
  -webkit-font-smoothing: antialiased;
}
#berfyo-track *, #berfyo-dock *, #bf-sheet * { box-sizing: border-box; }
#berfyo-track svg, #berfyo-dock svg, #bf-sheet svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- canlı sipariş kartı (üstte) ---------- */
/* şablonun üst çubuğunun (logo, dil, sepet) altında durur; kapalıyken küçük bir hap */
#berfyo-track { position: fixed; z-index: 2147483000; left: 50%; top: calc(env(safe-area-inset-top, 0px) + var(--bf-track-top, 72px)); transform: translateX(-50%);
  width: min(420px, calc(100vw - 24px)); display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.bf-card { width: 100%; }
.bf-card:not(.bf-open) { width: auto; max-width: 100%; border-radius: 999px; }
.bf-card:not(.bf-open) .bf-head { padding: 9px 14px; }
.bf-card { pointer-events: auto; background: var(--bf-bg); border: 1px solid var(--bf-line); border-radius: 18px; box-shadow: 0 12px 40px rgba(0, 0, 0, .35);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); overflow: hidden; }
.bf-card.bf-in { animation: bf-drop .5s cubic-bezier(.2, .9, .3, 1.2); }
@keyframes bf-drop { from { transform: translateY(-120%); opacity: 0; } }
.bf-head { all: unset; box-sizing: border-box; cursor: pointer; display: flex; align-items: center; gap: 10px; width: 100%; padding: 12px 14px; color: var(--bf-ink); }
.bf-head:focus-visible { outline: 2px solid var(--bf-accent); outline-offset: -2px; border-radius: 18px; }
.bf-title { flex: 1; font-size: 14px; }
.bf-title b { font-weight: 700; }
.bf-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--bf-warm); box-shadow: 0 0 0 0 rgba(255, 181, 71, .6); animation: bf-pulse 1.6s infinite; }
.bf-card[data-status=ready] .bf-dot { background: var(--bf-ok); animation-duration: .9s; }
.bf-card[data-status=done] .bf-dot { background: var(--bf-ok); animation: none; }
.bf-card[data-status=cancelled] .bf-dot { background: var(--bf-bad); animation: none; }
@keyframes bf-pulse { 70% { box-shadow: 0 0 0 9px rgba(255, 181, 71, 0); } 100% { box-shadow: 0 0 0 0 rgba(255, 181, 71, 0); } }
.bf-chev { width: 9px; height: 9px; border-right: 2px solid var(--bf-mute); border-bottom: 2px solid var(--bf-mute); transform: rotate(45deg) translateY(-3px); transition: transform .25s; }
.bf-open .bf-chev { transform: rotate(-135deg) translateY(-1px); }
.bf-body { display: none; padding: 0 14px 14px; }
.bf-open .bf-body { display: block; }
.bf-body p { margin: 0 0 12px; color: var(--bf-mute); }
.bf-card[data-status=ready] { border-color: rgba(60, 207, 122, .55); }
.bf-card[data-status=ready] .bf-body p { color: var(--bf-ink); font-weight: 600; }
.bf-steps { list-style: none; margin: 0 0 4px; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.bf-steps li { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--bf-mute); }
.bf-steps i { display: block; height: 5px; border-radius: 3px; background: var(--bf-line); }
.bf-steps li.past i { background: var(--bf-ok); }
.bf-steps li.now i { background: linear-gradient(90deg, var(--bf-warm), rgba(255, 181, 71, .35)); background-size: 200% 100%; animation: bf-flow 1.4s linear infinite; }
.bf-steps li.now { color: var(--bf-ink); font-weight: 700; }
.bf-card[data-status=ready] .bf-steps li.now i { background: var(--bf-ok); animation: none; }
@keyframes bf-flow { to { background-position: -200% 0; } }

.bf-phone { margin: 12px 0 0; display: grid; gap: 6px; }
.bf-phone label { font-size: 13px; color: var(--bf-ink); font-weight: 600; }
.bf-phone.bad label { color: var(--bf-bad); }
.bf-phone > span { display: flex; gap: 8px; }
.bf-phone input { flex: 1; min-width: 0; font: inherit; font-size: 16px; color: var(--bf-ink); background: rgba(255, 255, 255, .08); border: 1px solid var(--bf-line); border-radius: 12px; padding: 10px 12px; }
.bf-phone input:focus { outline: 2px solid var(--bf-accent); outline-offset: 0; }
.bf-phone button, .bf-cta { font: inherit; font-weight: 700; border: 0; border-radius: 12px; padding: 10px 16px; background: var(--bf-accent); color: #1a1410; cursor: pointer; }
.bf-phone small { color: var(--bf-mute); font-size: 12px; }
.bf-ghost { font: inherit; width: 100%; margin-top: 10px; padding: 11px; border-radius: 12px; border: 1px solid var(--bf-line); background: transparent; color: var(--bf-ink); cursor: pointer; }

/* ---------- yüzen butonlar (sol alt) ---------- */
#berfyo-dock { position: fixed; z-index: 2147482000; left: 12px; bottom: calc(env(safe-area-inset-bottom, 0px) + var(--bf-dock-bottom, 16px)); display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
#berfyo-dock[data-tpl=burger] { --bf-dock-bottom: 92px; }
#berfyo-dock[data-tpl=pizza] { --bf-dock-bottom: 96px; }
#berfyo-dock[data-tpl=pilav] { --bf-dock-bottom: 96px; }
/* şablonun sepet/sipariş sayfası açıkken yüzen butonlar çekilir */
#berfyo-dock { transition: opacity .2s, transform .2s; }
body:has(.sheet.open) #berfyo-dock, body:has(dialog[open]) #berfyo-dock, body:has(#bf-sheet.on) #berfyo-dock { opacity: 0; transform: translateY(12px); pointer-events: none; }
/* pilav: tabak hazırlama ekranında alt panel düğmelerin yerini kaplar (dökme anı hariç) */
body:has(#builder:not(.off-right):not([data-step=pour])) #berfyo-dock[data-tpl=pilav] { opacity: 0; transform: translateY(12px); pointer-events: none; }
.bf-fab { display: inline-flex; align-items: center; gap: 7px; min-height: 42px; padding: 9px 14px 9px 11px; border-radius: 999px; border: 1px solid var(--bf-line);
  background: var(--bf-bg); color: var(--bf-ink); font: 600 13px/1 system-ui, -apple-system, "Segoe UI", sans-serif; cursor: pointer; box-shadow: 0 6px 20px rgba(0, 0, 0, .28);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.bf-fab:focus-visible { outline: 2px solid var(--bf-accent); outline-offset: 2px; }
.bf-fab.ready { background: var(--bf-accent); color: #1a1410; border-color: transparent; animation: bf-wiggle 2.4s infinite; }
@keyframes bf-wiggle { 0%, 88%, 100% { transform: none; } 92% { transform: rotate(-4deg); } 96% { transform: rotate(4deg); } }

/* ---------- alt sayfa ---------- */
#bf-sheet-back { position: fixed; inset: 0; z-index: 2147483100; background: rgba(0, 0, 0, .5); opacity: 0; pointer-events: none; transition: opacity .25s; }
#bf-sheet-back.on { opacity: 1; pointer-events: auto; }
#bf-sheet { position: fixed; z-index: 2147483200; left: 50%; bottom: 0; width: min(480px, 100vw); transform: translate(-50%, 105%); transition: transform .35s cubic-bezier(.2, .9, .3, 1);
  background: #1b1916; border-radius: 22px 22px 0 0; padding: 8px 18px calc(env(safe-area-inset-bottom, 0px) + 18px); box-shadow: 0 -10px 40px rgba(0, 0, 0, .4); max-height: 88vh; overflow: auto; }
#bf-sheet.on { transform: translate(-50%, 0); }
.bf-grab { width: 40px; height: 4px; border-radius: 2px; background: var(--bf-line); margin: 4px auto 12px; }
#bf-sheet h2 { margin: 0 0 6px; font-size: 20px; font-weight: 750; color: var(--bf-ink); }
#bf-sheet p { margin: 0 0 14px; color: var(--bf-mute); }
#bf-sheet p b { color: var(--bf-ink); }
.bf-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.bf-big { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 18px 10px; border-radius: 16px; border: 1px solid var(--bf-line); background: rgba(255, 255, 255, .06); color: var(--bf-ink); font: 700 15px/1.2 system-ui, sans-serif; cursor: pointer; }
.bf-big svg { width: 28px; height: 28px; }
.bf-big:disabled { opacity: .5; }
.bf-cta { width: 100%; padding: 13px; margin-top: 2px; }
.bf-cta.on { background: var(--bf-ok); }
.bf-stampcard { border-radius: 18px; padding: 14px; margin: 6px 0 14px; background: linear-gradient(140deg, #2b2620, #1e1b17); border: 1px solid var(--bf-line); }
.bf-stampcard.ready { border-color: var(--bf-accent); }
.bf-sc-top { display: flex; flex-direction: column; gap: 2px; margin-bottom: 12px; }
.bf-sc-top b { font-size: 16px; }
.bf-sc-top small, .bf-sc-foot { color: var(--bf-mute); font-size: 12px; }
.bf-slots { display: grid; grid-template-columns: repeat(auto-fit, minmax(34px, 1fr)); gap: 8px; }
.bf-slots span { aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center; border: 1.5px dashed rgba(255, 255, 255, .25); color: var(--bf-mute); font-size: 12px; }
.bf-slots span.on { border: 0; background: var(--bf-accent); color: #1a1410; font-weight: 800; transform: rotate(-8deg); }
.bf-slots span.gift { border-style: solid; font-size: 16px; }
.bf-sc-foot { display: flex; justify-content: space-between; margin-top: 12px; }

/* ---------- toast ---------- */
#berfyo-toast { position: fixed; z-index: 2147483300; left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) + 24px); transform: translate(-50%, 140%); max-width: calc(100vw - 32px);
  padding: 11px 16px; border-radius: 14px; background: var(--bf-bg); border: 1px solid var(--bf-line); box-shadow: 0 10px 30px rgba(0, 0, 0, .35); transition: transform .3s; text-align: center; }
#berfyo-toast.on { transform: translate(-50%, 0); }

/* ---------- tükendi ---------- */
.berfyo-soldout { position: relative; filter: grayscale(1); opacity: .55; }
.berfyo-soldout button, button.berfyo-soldout { cursor: not-allowed !important; }
.bf-sold { position: absolute; top: 8px; right: 8px; z-index: 5; padding: 3px 8px; border-radius: 999px; background: #1d1a16; color: #fff; font-size: 11px; font-weight: 800; letter-spacing: .02em; text-transform: uppercase; pointer-events: none; }

@media (prefers-reduced-motion: reduce) {
  .bf-card.bf-in, .bf-dot, .bf-steps li.now i, .bf-fab.ready { animation: none; }
  #bf-sheet, #berfyo-toast { transition: none; }
}
