:root {
  --cream: #e8e8e8;
  --radius: 24px;
  --ease-spring: cubic-bezier(0.34, 1.4, 0.5, 1);
  /* per-card theme defaults (overridden inline on each .wcard) */
  --paper: #f0f0f0;
  --paper-2: #e2e2e2;
  --ink: #171717;
  --ink-dim: #565656;
  --ink-faint: #9a9a9a;
  --line: #cccccc;
  --stamp-ink: #171717;
  --terra: #2a2a2a;
  --terra-deep: #1c1c1c;
  --gold: #8a8a8a;
  /* glassmorphism surface tokens (neutral monochrome glass) */
  --glass-fill: rgba(255, 255, 255, 0.34);
  --glass-fill-strong: rgba(255, 255, 255, 0.55);
  --glass-border: rgba(255, 255, 255, 0.7);
  --glass-hi: rgba(255, 255, 255, 0.9);
  --glass-shadow: 0 34px 70px -28px rgba(20, 20, 20, 0.5);
  /* swapped for a Persian-capable font under html[dir="rtl"] (see fonts.css) */
  --font-heading: "Quicksand", "Nunito", sans-serif;
  --font-body: "Nunito", sans-serif;
}
html[dir="rtl"] {
  --font-heading: "Vazirmatn", "Quicksand", "Nunito", sans-serif;
  --font-body: "Vazirmatn", "Nunito", sans-serif;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; margin: 0; }

body {
  font-family: var(--font-body), system-ui, -apple-system, "Segoe UI", sans-serif;
  color: #171717;
  background: linear-gradient(165deg, #f5f5f5 0%, #e6e6e6 46%, #d2d2d2 100%);
  overflow-x: hidden; /* allow vertical scroll for a tall multi-card wallet; bg + nav are fixed */
  -webkit-font-smoothing: antialiased;
}

/* ---------------- Aurora background (gives the glass something to refract) ---- */
.bg { position: fixed; inset: 0; z-index: 0; overflow: hidden; }
/* two extra drifting orbs via pseudo-elements */
.bg::before, .bg::after {
  content: ""; position: absolute; border-radius: 50%;
  filter: blur(72px); opacity: 0.6; will-change: transform;
}
.bg::before {
  width: 52vmax; height: 52vmax; top: -16vmax; right: -12vmax;
  background: radial-gradient(circle at 50% 50%, #c4c4c4, transparent 66%);
  animation: orbA 34s ease-in-out infinite;
}
.bg::after {
  width: 46vmax; height: 46vmax; bottom: -18vmax; left: -14vmax;
  background: radial-gradient(circle at 50% 50%, #3a3a3a, transparent 64%);
  animation: orbB 40s ease-in-out infinite;
}
.stain { position: absolute; border-radius: 50%; filter: blur(66px); opacity: 0.5; will-change: transform; }
.stain--1 {
  width: 46vmax; height: 46vmax; top: -10vmax; left: -8vmax;
  background: radial-gradient(circle at 42% 40%, #d8d8d8, transparent 66%);
  animation: float1 28s ease-in-out infinite;
}
.stain--2 {
  width: 42vmax; height: 42vmax; bottom: -12vmax; right: 8vmax;
  background: radial-gradient(circle at 50% 50%, #808080, transparent 66%);
  animation: float2 32s ease-in-out infinite;
}
@keyframes float1 { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(10vmax,6vmax) scale(1.12); } }
@keyframes float2 { 0%,100% { transform: translate(0,0) scale(1.05); } 50% { transform: translate(-8vmax,-5vmax) scale(0.94); } }
@keyframes orbA  { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(-9vmax,7vmax) scale(1.14); } }
@keyframes orbB  { 0%,100% { transform: translate(0,0) scale(1.06); } 50% { transform: translate(7vmax,-6vmax) scale(0.92); } }
.grain { position: absolute; inset: 0; opacity: 0.05; mix-blend-mode: overlay; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }

/* ---------------- Stage & wallet ---------------- */
.stage {
  position: relative; z-index: 1;
  min-height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  padding: calc(30px + env(safe-area-inset-top, 0px)) 20px 28px;
  gap: 22px;
}
.greeting { margin-top: 6px; }

/* detail-view close button (top-left) + focus state */
.wallet-close {
  position: fixed; top: calc(26px + env(safe-area-inset-top, 0px)); left: 16px; z-index: 225;
  width: 40px; height: 40px; border-radius: 50%; cursor: pointer;
  border: 1px solid var(--glass-border); color: #171717; font-size: 24px; font-weight: 900;
  display: grid; place-items: center;
  background: var(--glass-fill-strong); backdrop-filter: blur(14px) saturate(150%); -webkit-backdrop-filter: blur(14px) saturate(150%);
  box-shadow: 0 10px 24px -12px rgba(20,20,20,0.45), inset 0 1px 0 var(--glass-hi);
  animation: fadeDown 0.35s var(--ease-spring) both;
}
.wallet-close[hidden] { display: none; }

/* Manual stamp button — hidden by default: stamps are only granted by a real NFC
   tap. It's revealed (.dev-on, added by app.js) only on localhost for testing. */
.stampbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: none; justify-content: center;
  padding: 0 20px calc(20px + env(safe-area-inset-bottom, 0px));
  pointer-events: none;
}
.stampbar.dev-on { display: flex; }
.stampbar__btn {
  pointer-events: auto;
  width: min(92vw, 360px);
  font-size: 17px; padding: 16px 20px; border-radius: 16px;
  box-shadow: 0 14px 30px -10px rgba(20,20,20, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}
.wallet-head { position: absolute; top: 26px; left: 0; right: 0; text-align: center; z-index: 2; }
.wallet-title { font-family: var(--font-heading); font-weight: 700; font-size: 24px; margin: 0; letter-spacing: -0.3px; color: #171717; text-shadow: 0 1px 10px rgba(255,255,255,0.4); animation: fadeDown 0.7s var(--ease-spring) both; }
.greeting { font-family: var(--font-heading); font-weight: 700; font-size: 19px; margin: 0; color: #171717; text-align: center; text-shadow: 0 1px 10px rgba(255,255,255,0.4); animation: fadeDown 0.7s var(--ease-spring) 0.08s both; }
@keyframes fadeDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }

.wallet {
  position: relative;
  width: min(100%, 460px);
  margin: 0 auto;
  overflow: visible; /* let the glass card's soft shadow breathe */
}

.wcard {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  transform-origin: 50% 0;
  /* A plain 2D transform/opacity transition — no perspective, no 3D compositing
     layer. Keep this simple; it's what actually stays smooth on Safari. */
  transition: transform 0.68s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.65s ease, filter 0.5s ease;
  will-change: transform;
  cursor: pointer;
}
.wcard.is-open { cursor: default; }
/* covered cards in the stack — a touch dimmer so the header on top reads clearly */
.wcard.is-peek { filter: brightness(0.99) saturate(0.98); }
/* the card itself always keeps the English layout (header/counter order, stamp
   grid flow, alignment) regardless of UI language — only the text content
   (e.g. the min-purchase line) translates */
.wcard { direction: ltr; }

/* ---------------- Card ---------------- */
.card {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
}

.face {
  position: absolute; inset: 0;
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex; flex-direction: column;
  /* Opaque card so stacked cards fully cover each other — no bleed-through. */
  background:
    linear-gradient(158deg, rgba(255,255,255,0.97), rgba(255,255,255,0.9)),
    linear-gradient(158deg, var(--paper), var(--paper-2));
  border: 1px solid var(--glass-border);
  box-shadow:
    0 20px 38px -16px rgba(20, 20, 20, 0.45),
    inset 0 1px 0 var(--glass-hi),
    inset 0 0 0 1px rgba(255, 255, 255, 0.22);
  overflow: hidden;
}
/* diagonal light streak + soft top-corner glow for the glass sheen */
.face::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(130% 60% at 20% -10%, rgba(255,255,255,0.6), transparent 52%),
    linear-gradient(125deg, transparent 30%, rgba(255,255,255,0.18) 46%, transparent 60%);
}
.face--front { opacity: 1; animation: cardIn 0.9s var(--ease-spring) both; }
@keyframes cardIn {
  from { opacity: 0; transform: translateY(26px) scale(0.94); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.notch { position: absolute; top: 50%; width: 20px; height: 20px; background: var(--cream); border-radius: 50%; transform: translateY(-50%); box-shadow: inset 0 0 0 2px rgba(0,0,0,0.07); z-index: 2; }
.notch--l { left: -10px; }
.notch--r { right: -10px; }

/* ---------------- Brand header ---------------- */
.brand { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 12px; margin-bottom: 18px; position: relative; z-index: 1; }
.brand__name { font-family: var(--font-heading); font-weight: 600; font-size: 23px; line-height: 1.05; margin: 0; letter-spacing: -0.3px; color: var(--ink); }
.brand__tag { margin: 5px 0 0; font-size: 9.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 1.5px; color: var(--ink-faint); }
.counter { font-family: var(--font-heading); font-weight: 600; font-size: 14px; color: var(--ink-faint); display: flex; align-items: baseline; gap: 1px; letter-spacing: -0.5px; }
.counter .count { color: var(--terra-deep); font-size: 24px; }
.counter__sep { opacity: 0.45; margin: 0 1px; }

/* ---------------- Oram card header ---------------- */
.oram-sheen {
  position: absolute; top: 0; left: 0; width: 55%; height: 100%;
  background: linear-gradient(105deg, transparent 20%, rgba(255,255,255,0.55) 50%, transparent 80%);
  transform: translateX(-170%) skewX(-12deg);
  pointer-events: none; z-index: 3;
  animation: sheen 7s ease-in-out 0.9s infinite;
}
@keyframes sheen {
  0%   { transform: translateX(-170%) skewX(-12deg); }
  16%  { transform: translateX(340%) skewX(-12deg); }
  100% { transform: translateX(340%) skewX(-12deg); }
}

.oram-head { display: flex; flex-direction: row; align-items: flex-start; justify-content: space-between; gap: 12px; text-align: left; margin-bottom: 12px; position: relative; z-index: 1; }
.oram-head__id { min-width: 0; }
/* compact progress in the top-right corner */
.oram-mini { flex: 0 0 auto; display: flex; align-items: baseline; gap: 2px; font-family: var(--font-heading); line-height: 1; }
.oram-mini .count { font-weight: 700; font-size: 22px; color: var(--accent, var(--ink)); }
.oram-mini__sep { font-size: 16px; color: var(--ink-faint); opacity: 0.5; }
.oram-mini > span:last-child { font-size: 16px; color: var(--ink-faint); font-weight: 700; }
.oram-name {
  font-family: var(--font-heading); font-weight: 700; font-size: 21px; letter-spacing: 2.5px;
  margin: 0; color: var(--accent, var(--ink)); text-transform: uppercase;
  opacity: 0; transform-origin: 0% 50%;
  animation: nameIn 0.7s var(--ease-spring) 0.12s forwards;
}
@keyframes nameIn {
  from { opacity: 0; transform: translateY(-8px) scale(0.82); letter-spacing: 0; }
  60%  { opacity: 1; }
  to   { opacity: 1; transform: translateY(0) scale(1); letter-spacing: 2.5px; }
}
.oram-sub { margin: 3px 0 0; font-size: 10px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; color: var(--gold); }


/* optional "minimum purchase for a stamp" note — only shown when the café sets one */
.oram-min { margin: -8px 4px 0; font-size: 10.5px; font-weight: 700; letter-spacing: 0.2px; color: var(--ink-dim); text-align: center;
  background: rgba(20,20,20,0.05); border: 1px dashed rgba(20,20,20,0.16); border-radius: 10px; padding: 7px 10px; }

/* ---------------- Reward teaser (shown below the card, only once it's open) ---------------- */
/* UI chrome, not part of the branded card — reads in the page's own
   direction (unlike .wcard, which forces LTR above) */
html[dir="rtl"] .reward-teaser { direction: rtl; }
.reward-teaser {
  display: none;
  width: 100%; box-sizing: border-box;
  align-items: center; gap: 11px;
  margin-top: 14px;
  padding: 12px 15px; border-radius: 15px;
  /* Plain (no backdrop-filter) — a live blur sampled every frame while this
     card's ancestor is transforming during the select animation is one of the
     most expensive things WebKit can do; a solid-ish gradient looks close
     enough and stays cheap to composite. */
  background: linear-gradient(120deg, rgba(86,86,86,0.85), rgba(255,255,255,0.85));
  border: 1px solid rgba(255,255,255,0.5);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.6), 0 8px 20px -12px rgba(20,20,20,0.45);
  position: relative; z-index: 1; overflow: hidden;
  animation: teaserIn 0.55s var(--ease-spring) 0.15s both;
}
.reward-teaser[hidden] { display: none; }
/* only the open card's teaser is visible — the browse stack stays compact */
.wcard.is-open .reward-teaser:not([hidden]) { display: flex; }
.reward-teaser__gift { font-size: 22px; flex: 0 0 auto; line-height: 1; animation: giftBob 2.4s ease-in-out infinite; }
.reward-teaser__body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.reward-teaser__main { font-family: var(--font-heading); font-weight: 700; font-size: 13px; color: #171717; letter-spacing: -0.2px; }
.reward-teaser__main b { font-weight: 800; color: #1c1c1c; }
.reward-teaser__sub { font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px; color: #2b2b2b; }
@keyframes teaserIn { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes giftBob { 0%,100% { transform: translateY(0) rotate(-6deg); } 50% { transform: translateY(-3px) rotate(6deg); } }

/* ---------------- Stamp grid ---------------- */
.grid { flex: 1; display: grid; grid-template-columns: repeat(var(--cols, 4), 1fr); grid-template-rows: repeat(2, 1fr); gap: 7px 6px; margin-bottom: 12px; position: relative; z-index: 1; }
.slot {
  position: relative; border-radius: 50%; display: grid; place-items: center;
  aspect-ratio: 1; align-self: center; justify-self: center; width: 100%; max-width: 84px;
  color: var(--ink-faint);
  background:
    radial-gradient(circle at 34% 28%, rgba(255,255,255,0.55), transparent 60%),
    rgba(255, 251, 242, 0.28);
  border: 1.5px dashed rgba(110, 110, 110, 0.42);
  box-shadow: inset 0 1px 2px rgba(255,255,255,0.5), inset 0 -2px 6px rgba(70,70,70,0.06);
  transition: border-color 0.4s ease, transform 0.3s var(--ease-spring);
  animation: slotIn 0.5s var(--ease-spring) both;
  animation-delay: calc(var(--i, 0) * 55ms + 0.35s);
}
@keyframes slotIn { from { opacity: 0; transform: scale(0.4); } to { opacity: 1; transform: scale(1); } }
.slot__num { position: absolute; font-size: 9px; font-weight: 700; bottom: 2px; left: 50%; transform: translateX(-50%); color: var(--ink-faint); }
.slot .stamp { position: absolute; inset: 0; display: grid; place-items: center; color: var(--stamp-ink); opacity: 0; transform: scale(0.2); will-change: transform, opacity; z-index: 1; }
.slot .stamp svg { width: 76%; height: 76%; }
.slot .stamp .stamp-mark { width: 90%; height: 90%; object-fit: contain; display: block; }
.slot.is-stamped { border-color: rgba(0,0,0,0.08); }
.slot.is-stamped .stamp { animation: starIn 0.5s var(--ease-spring) forwards; }
@keyframes starIn {
  0%   { opacity: 0; transform: translate(var(--dx,0), var(--dy,0)) scale(1.55) rotate(var(--r,0deg)); }
  45%  { opacity: var(--sa,1); }
  62%  { transform: translate(var(--dx,0), var(--dy,0)) scale(0.9) rotate(var(--r,0deg)); }
  100% { opacity: var(--sa,1); transform: translate(var(--dx,0), var(--dy,0)) scale(1) rotate(var(--r,0deg)); }
}
.slot .halo { position: absolute; inset: 8%; border-radius: 50%; background: radial-gradient(circle, rgba(0,0,0,0.18), transparent 65%); opacity: 0; pointer-events: none; }
.slot.is-stamped .halo { animation: halo 0.6s ease-out forwards; }
@keyframes halo {
  0% { opacity: 0.7; transform: translate(var(--dx,0), var(--dy,0)) scale(0.5); }
  100% { opacity: 0; transform: translate(var(--dx,0), var(--dy,0)) scale(1.6); }
}

/* ---------------- Controls ---------------- */
.controls { display: flex; align-items: center; gap: 10px; position: relative; z-index: 1; }
.btn { font-family: var(--font-heading); font-weight: 600; font-size: 15px; border: none; border-radius: 13px; padding: 12px 18px; cursor: pointer; position: relative; transition: transform 0.14s ease, box-shadow 0.3s ease, opacity 0.3s ease, filter 0.3s ease; }
.btn:active { transform: translateY(1px) scale(0.985); }
.btn:focus-visible { outline: 2px solid var(--terra-deep); outline-offset: 3px; }
.btn--primary { flex: 1; color: #f2fbf5; background: linear-gradient(150deg, var(--terra), var(--terra-deep)); box-shadow: 0 9px 18px -8px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.3); text-shadow: 0 1px 1px rgba(0,0,0,0.25); }
.btn--primary:hover { box-shadow: 0 13px 24px -8px rgba(0,0,0,0.45), inset 0 1px 0 rgba(255,255,255,0.3); }
.btn--primary:disabled { cursor: default; opacity: 0.55; filter: saturate(0.7); box-shadow: none; }
.btn--primary:disabled:active { transform: none; }
.btn--primary.pulse { animation: btnPulse 0.4s ease; }
@keyframes btnPulse { 50% { transform: scale(1.04); } }
.btn--ghost { background: transparent; border: 1.5px solid var(--line); color: var(--ink-dim); font-size: 13px; padding: 11px 15px; }
.btn--ghost:hover { color: var(--ink); border-color: var(--ink-dim); }

/* ---------------- Stamp tool ---------------- */
.stamper { position: fixed; top: 0; left: 0; width: 120px; height: 150px; transform-origin: 50% 100%; opacity: 0; pointer-events: none; z-index: 40; filter: drop-shadow(0 12px 14px rgba(40,40,40,0.3)); will-change: transform, opacity; }

/* ---------------- Reward / back ---------------- */
.reward { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 12px; position: relative; z-index: 1; }
.reward__eyebrow { font-family: var(--font-heading); font-size: 12px; letter-spacing: 2px; text-transform: uppercase; color: var(--terra-deep); margin: 0; }
.reward__prize { position: relative; width: 200px; height: 176px; border-radius: 15px; overflow: hidden; display: grid; place-items: center; border: 2px dashed var(--line); background: linear-gradient(160deg, var(--paper), var(--paper-2)); }
.reward__hidden { position: absolute; inset: 0; display: grid; place-content: center; gap: 4px; text-align: center; padding: 10px; }
.reward__percent { font-family: var(--font-heading); font-weight: 700; font-size: 24px; line-height: 1; margin: 0; background: linear-gradient(120deg, var(--terra-deep), var(--terra) 60%, var(--gold)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.qr { width: 98px; height: 98px; padding: 5px; margin: 4px auto 0; background: #ffffff; border-radius: 9px; box-shadow: 0 2px 7px rgba(0,0,0,0.14); }
.qr svg { display: block; width: 100%; height: 100%; }
.reward__scan { margin: 5px 0 0; font-family: var(--font-heading); font-weight: 700; font-size: 10px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--ink-dim); }
.scratch { position: absolute; inset: 0; width: 100%; height: 100%; cursor: grab; touch-action: none; border-radius: 15px; transition: opacity 0.5s ease; }
.scratch:active { cursor: grabbing; }
.scratch.is-cleared { opacity: 0; pointer-events: none; }
.reward__hint { margin: 0; font-size: 11px; color: var(--ink-dim); transition: opacity 0.4s ease; }
.reward__hint.is-hidden { opacity: 0; }
.reward__actions { display: flex; gap: 9px; align-items: center; margin-top: 2px; }
.reward__reveal.is-hidden { display: none; }
.reward__restart { flex: 0 0 auto; padding: 11px 16px; font-size: 14px; }
.reward__prize.shine::after { content: ""; position: absolute; inset: 0; background: linear-gradient(115deg, transparent 30%, rgba(255,255,255,0.7) 50%, transparent 70%); transform: translateX(-120%); animation: sweep 0.7s ease-out; }
@keyframes sweep { to { transform: translateX(120%); } }

/* ---------------- Sign out ---------------- */
.signout-btn {
  position: absolute; top: 16px; left: 16px; z-index: 60;
  width: 46px; height: 46px; border-radius: 14px;
  display: grid; place-items: center; cursor: pointer;
  color: #171717;
  background: linear-gradient(155deg, rgba(246,246,246,0.62), rgba(228,228,228,0.5));
  backdrop-filter: blur(14px) saturate(150%);
  -webkit-backdrop-filter: blur(14px) saturate(150%);
  border: 1px solid rgba(255,255,255,0.5);
  box-shadow: 0 10px 22px -10px rgba(20,20,20,0.4), inset 0 1px 0 var(--glass-hi);
  transition: transform 0.16s ease, box-shadow 0.3s ease;
}
.signout-btn:hover { box-shadow: 0 12px 22px -8px rgba(20,20,20,0.45), inset 0 1px 0 rgba(255,255,255,0.6); }
.signout-btn:active { transform: scale(0.94); }
.signout-btn:focus-visible { outline: 2px solid #171717; outline-offset: 3px; }

/* ---------------- Discounts pocket ---------------- */
.pocket-btn {
  position: fixed; top: 16px; right: 16px; z-index: 60;
  width: 46px; height: 46px; border-radius: 14px;
  display: grid; place-items: center; cursor: pointer;
  color: #1c1c1c;
  background: var(--glass-fill-strong);
  backdrop-filter: blur(14px) saturate(150%);
  -webkit-backdrop-filter: blur(14px) saturate(150%);
  border: 1px solid var(--glass-border);
  box-shadow: 0 10px 22px -10px rgba(20,20,20,0.5), inset 0 1px 0 var(--glass-hi);
  transition: transform 0.16s ease, box-shadow 0.3s ease;
}
.pocket-btn:hover { box-shadow: 0 12px 22px -8px rgba(20,20,20,0.6), inset 0 1px 0 rgba(255,255,255,0.6); }
.pocket-btn:active { transform: scale(0.94); }
.pocket-btn:focus-visible { outline: 2px solid #1c1c1c; outline-offset: 3px; }
.pocket-btn.pop { animation: pocketPop 0.5s var(--ease-spring); }
@keyframes pocketPop { 0%,100% { transform: scale(1); } 40% { transform: scale(1.18) rotate(-6deg); } }

.pocket-badge {
  position: absolute; top: -6px; right: -6px;
  min-width: 20px; height: 20px; padding: 0 5px;
  display: grid; place-items: center;
  font-family: var(--font-heading); font-weight: 700; font-size: 11px;
  color: #f2fbf5; background: #2a2a2a;
  border: 2px solid var(--cream); border-radius: 10px;
}
.pocket-badge.bump { animation: pocketPop 0.5s var(--ease-spring); }
.pocket-badge[hidden] { display: none; }

.scrim { position: fixed; inset: 0; z-index: 190; background: rgba(30,30,30,0.34); opacity: 0; transition: opacity 0.3s ease; }
.scrim.show { opacity: 1; }

.drawer {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 215;
  width: 100%; max-height: min(86vh, 720px);
  background: linear-gradient(160deg, #ececec, #e2e2e2);
  box-shadow: 0 -18px 50px -20px rgba(40,40,40,0.6);
  border-radius: 26px 26px 0 0;
  transform: translateY(100%);
  transition: transform 0.42s var(--ease-spring);
  display: flex; flex-direction: column;
  padding: 12px 18px calc(20px + env(safe-area-inset-bottom, 0px));
}
.drawer.open { transform: translateY(0); }
.drawer__grip { width: 42px; height: 4px; border-radius: 3px; background: rgba(20,20,20,0.18); margin: 2px auto 14px; }
.drawer__head { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.drawer__title { flex: 1; min-width: 0; font-family: var(--font-heading); font-weight: 600; font-size: 22px; margin: 0; letter-spacing: -0.3px; color: #171717; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drawer__close { flex: 0 0 auto; width: 34px; height: 34px; border-radius: 10px; border: 1px solid rgba(0,0,0,0.08); background: rgba(255,255,255,0.5); color: #565656; font-size: 15px; cursor: pointer; display: grid; place-items: center; }
.drawer__close:hover { color: #171717; }
.drawer__back { flex: 0 0 auto; width: 34px; height: 34px; border-radius: 10px; border: 1px solid rgba(0,0,0,0.08); background: rgba(255,255,255,0.5); color: #565656; font-size: 20px; line-height: 1; cursor: pointer; display: grid; place-items: center; }
.drawer__back:hover { color: #171717; }
.drawer__back[hidden] { display: none; }
.drawer__list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.drawer__empty { margin: 40px 8px; text-align: center; font-size: 13px; line-height: 1.6; color: #9a9a9a; }

/* avatar/name/chevron order stays like the English version regardless of UI
   language — only the text content translates */
.cafe-list { display: flex; flex-direction: column; gap: 10px; direction: ltr; }
.cafe-row {
  display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 12px;
  padding: 13px 14px; border-radius: 16px; border: 0; cursor: pointer; text-align: left;
  background: rgba(255,255,255,0.55); border: 1px solid rgba(255,255,255,0.6);
  box-shadow: 0 6px 16px -10px rgba(40,40,40,0.4);
  transition: transform 0.14s ease, box-shadow 0.3s ease;
}
html[dir="rtl"] .cafe-row { text-align: right; }
.cafe-row:hover { box-shadow: 0 10px 22px -10px rgba(40,40,40,0.5); }
.cafe-row:active { transform: scale(0.98); }
.cafe-row__avatar {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  background: #171717; color: #fff; font-family: var(--font-heading); font-weight: 700; font-size: 16px;
  flex-shrink: 0;
}
.cafe-row__body { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.cafe-row__name { font-family: var(--font-heading); font-weight: 700; font-size: 14.5px; color: #171717; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; direction: ltr; text-align: left; }
.cafe-row__sub { font-size: 11.5px; color: #7a7a7a; }
.cafe-row__badge {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  background: #171717; color: #fff; font-size: 11px; font-weight: 800;
  display: grid; place-items: center;
}
.cafe-row__go { font-size: 22px; font-weight: 700; color: var(--ink-faint); line-height: 1; }

.wallet-empty {
  margin: 20vh auto 0; max-width: 300px; text-align: center; padding: 26px 22px;
  border-radius: 20px; background: var(--glass-fill); border: 1px solid var(--glass-border);
  backdrop-filter: blur(16px) saturate(150%); -webkit-backdrop-filter: blur(16px) saturate(150%);
  box-shadow: var(--glass-shadow), inset 0 1px 0 var(--glass-hi);
}
.wallet-empty__title { font-family: var(--font-heading); font-weight: 700; font-size: 17px; margin: 0 0 6px; color: #171717; }
.wallet-empty__sub { font-size: 13px; line-height: 1.55; margin: 0; color: #7a7a7a; }

/* ---------------- Café discount grid ---------------- */
.discounts-page { animation: pageIn 0.42s var(--ease-spring) both; }
@keyframes pageIn { 0% { opacity: 0; transform: translateX(26px); } 100% { opacity: 1; transform: none; } }

.coupon-grid {
  flex-shrink: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px;
  perspective: 900px;
}

/* Active reward — a bold dark "ticket" that pops off the light drawer */
.coupon-card {
  position: relative;
  isolation: isolate;
  display: flex; flex-direction: column;
  min-height: 138px;
  padding: 15px 15px 13px;
  border-radius: 18px;
  background: linear-gradient(150deg, #2b2b2b 0%, #171717 55%, #0c0c0c 100%);
  color: #fff;
  box-shadow: 0 18px 34px -18px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.09);
  overflow: hidden; cursor: pointer;
  transform-origin: 50% 100%;
  animation: couponIn 0.6s var(--ease-spring) both;
  transition: transform 0.24s var(--ease-spring), box-shadow 0.3s ease;
}
.coupon-card:hover { transform: translateY(-5px) scale(1.025); box-shadow: 0 26px 44px -18px rgba(0,0,0,0.7), inset 0 1px 0 rgba(255,255,255,0.12); }
.coupon-card:active { transform: translateY(-1px) scale(0.98); }
@keyframes couponIn { 0% { opacity: 0; transform: translateY(18px) scale(0.9) rotate(-2deg); } 100% { opacity: 1; transform: none; } }
.coupon-grid .coupon-card:nth-child(1) { animation-delay: 0.02s; }
.coupon-grid .coupon-card:nth-child(2) { animation-delay: 0.08s; }
.coupon-grid .coupon-card:nth-child(3) { animation-delay: 0.14s; }
.coupon-grid .coupon-card:nth-child(4) { animation-delay: 0.20s; }
.coupon-grid .coupon-card:nth-child(5) { animation-delay: 0.26s; }
.coupon-grid .coupon-card:nth-child(n+6) { animation-delay: 0.30s; }

/* soft coloured glow bleeding from the top-right */
.coupon-card__glow {
  position: absolute; top: -26px; right: -26px; width: 96px; height: 96px; z-index: 0;
  border-radius: 50%; filter: blur(22px); pointer-events: none; opacity: 0.55;
}
.coupon-card.is-urgent .coupon-card__glow { animation: couponGlow 1.9s ease-in-out infinite; }
@keyframes couponGlow { 0%,100% { opacity: 0.45; } 50% { opacity: 0.9; } }

/* diagonal shine that sweeps across once on entry, and again on hover */
.coupon-card__shine {
  position: absolute; inset: 0; z-index: 2; pointer-events: none;
  background: linear-gradient(115deg, transparent 32%, rgba(255,255,255,0.22) 47%, rgba(255,255,255,0.06) 54%, transparent 64%);
  transform: translateX(-130%);
  animation: couponShine 1s ease 0.35s both;
}
.coupon-card:hover .coupon-card__shine { animation: couponShine 0.75s ease; }
@keyframes couponShine { 0% { transform: translateX(-130%); } 100% { transform: translateX(130%); } }

.coupon-card__kicker {
  position: relative; z-index: 1; align-self: flex-start;
  font-family: var(--font-heading); font-size: 9px; font-weight: 800;
  text-transform: uppercase; letter-spacing: 1.4px; color: rgba(255,255,255,0.5);
  margin-bottom: 6px;
}
.coupon-card__deal {
  position: relative; z-index: 1;
  font-family: var(--font-heading); font-weight: 800; font-size: 27px;
  line-height: 1; margin: 0; letter-spacing: -0.6px;
  background: linear-gradient(180deg, #ffffff, #cfcfcf); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.coupon-card__desc {
  position: relative; z-index: 1;
  font-size: 11px; color: rgba(255,255,255,0.62); margin: 5px 0 0;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
/* perforated tear line, pushed to the bottom, with punched notches at both edges */
.coupon-card__notch { position: relative; height: 0; margin: auto -15px 11px; align-self: stretch; border-top: 1.5px dashed rgba(255,255,255,0.22); }
.coupon-card__notch::before, .coupon-card__notch::after {
  content: ""; position: absolute; top: 0; width: 12px; height: 12px; border-radius: 50%;
  background: #e7e7e7; transform: translate(-50%, -50%);
}
.coupon-card__notch::before { left: 0; }
.coupon-card__notch::after { left: 100%; }
.coupon-card__exp {
  position: relative; z-index: 1; display: inline-flex; align-items: center; gap: 5px; align-self: flex-start;
  font-size: 11px; font-weight: 700; color: rgba(255,255,255,0.6); margin: 0;
}
.coupon-card__exp.is-urgent { color: #ff6f61; }
.coupon-card__dot { width: 6px; height: 6px; border-radius: 50%; background: #ff5a4a; box-shadow: 0 0 7px rgba(255,90,74,0.9); animation: couponGlow 1.4s ease-in-out infinite; }

/* ---------------- Congratulation ticket ---------------- */
.congrats {
  position: fixed; inset: 0; z-index: 216;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 24px;
  padding: 40px 22px;
  background: linear-gradient(165deg, #3a3a3a 0%, #262626 45%, #161616 100%);
  opacity: 0; transition: opacity 0.3s ease;
  overflow: hidden;
}
.congrats[hidden] { display: none; }
.congrats.show { opacity: 1; }
/* soft ambient glow the glass ticket floats over */
.congrats::before, .congrats::after {
  content: ""; position: absolute; border-radius: 50%; pointer-events: none;
  filter: blur(60px); opacity: 0.5;
}
.congrats::before { top: 6%; left: 50%; width: 300px; height: 300px; background: radial-gradient(circle, rgba(255,255,255,0.24), transparent 70%); animation: congGlowA 9s ease-in-out infinite; }
.congrats::after { bottom: 3%; right: 6%; width: 240px; height: 240px; background: radial-gradient(circle, rgba(255,255,255,0.13), transparent 70%); animation: congGlowB 11s ease-in-out infinite; }
@keyframes congGlowA { 0%,100% { transform: translateX(-50%) translateY(0) scale(1); } 50% { transform: translateX(-50%) translateY(20px) scale(1.08); } }
@keyframes congGlowB { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(-16px,-14px) scale(1.1); } }

.ticket {
  position: relative;
  isolation: isolate; /* keep the sheen pseudo-element clipped to the scalloped mask */
  width: min(88vw, 330px);
  background: linear-gradient(165deg, rgba(255,255,255,0.96), rgba(255,255,255,0.88));
  border: 1px solid rgba(255,255,255,0.9);
  box-shadow: 0 30px 60px -22px rgba(0,0,0,0.65), 0 2px 0 rgba(255,255,255,0.6) inset;
  backdrop-filter: blur(22px) saturate(165%);
  -webkit-backdrop-filter: blur(22px) saturate(165%);
  padding: 30px 26px 26px;
  text-align: center;
  transform: translateY(32px) scale(0.9) rotate(-1.5deg); opacity: 0;
  transition: transform 0.55s var(--ease-spring), opacity 0.35s ease;
  --sc: 12px;
  -webkit-mask:
    radial-gradient(var(--sc) at 50% 0, #0000 98%, #000 100%) 50% 0 / calc(var(--sc) * 2) 51% repeat-x,
    radial-gradient(var(--sc) at 50% 100%, #0000 98%, #000 100%) 50% 100% / calc(var(--sc) * 2) 51% repeat-x;
          mask:
    radial-gradient(var(--sc) at 50% 0, #0000 98%, #000 100%) 50% 0 / calc(var(--sc) * 2) 51% repeat-x,
    radial-gradient(var(--sc) at 50% 100%, #0000 98%, #000 100%) 50% 100% / calc(var(--sc) * 2) 51% repeat-x;
}
.congrats.show .ticket { transform: translateY(0) scale(1) rotate(0); opacity: 1; }
/* glossy diagonal sheen — the "glass" highlight raking across the top */
.ticket::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(115deg, rgba(255,255,255,0.65) 0%, rgba(255,255,255,0) 32%, rgba(255,255,255,0) 78%, rgba(255,255,255,0.35) 100%);
  pointer-events: none;
}

.ticket__pop { font-size: 44px; line-height: 1; display: inline-block; transform-origin: 70% 90%; }
.ticket__title {
  font-family: var(--font-heading); font-weight: 700; font-size: 30px; margin: 8px 0 0; letter-spacing: -0.4px;
  background: linear-gradient(100deg, #171717 0%, #171717 38%, #b9a06a 50%, #171717 62%, #171717 100%);
  background-size: 220% 100%; background-position: 200% 0;
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.ticket__sub { margin: 8px 4px 0; font-size: 14.5px; line-height: 1.4; color: #565656; }
.ticket__sub b { color: #171717; }
.ticket__divider { border-top: 2px dashed rgba(20,20,20,0.16); margin: 18px 0; }
.ticket__stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.ticket__stats > div { display: flex; flex-direction: column; gap: 4px; }
.ticket__k { font-size: 11.5px; font-weight: 600; color: #9a9a9a; }
.ticket__v { font-family: var(--font-heading); font-weight: 700; font-size: 17px; color: #171717; }
.ticket__qr {
  position: relative; overflow: hidden;
  width: 176px; height: 176px; margin: 8px auto 0; padding: 14px;
  background: #ffffff; border-radius: 24px;
  box-shadow: 0 16px 34px -18px rgba(20,20,20,0.4), inset 0 1px 0 rgba(255,255,255,0.9);
}
.ticket__qr svg { display: block; width: 100%; height: 100%; }
/* scan line sweeping down the QR — signals "scan me" */
.ticket__qr::after {
  content: ""; position: absolute; left: 12px; right: 12px; top: 8px; height: 30px; z-index: 3; pointer-events: none;
  border-radius: 8px;
  background: linear-gradient(to bottom, rgba(31,43,58,0) 0%, rgba(31,43,58,0.16) 55%, rgba(31,43,58,0) 100%);
  box-shadow: 0 0 10px rgba(31,43,58,0.15);
  animation: qrScan 2.6s cubic-bezier(0.55,0,0.45,1) 1s infinite;
}
@keyframes qrScan {
  0% { transform: translateY(0); opacity: 0; }
  10% { opacity: 1; }
  50% { transform: translateY(122px); opacity: 1; }
  60% { transform: translateY(122px); opacity: 0; }
  100% { transform: translateY(0); opacity: 0; }
}
.congrats.is-used .ticket__qr::after { display: none; }
.ticket__hint { margin: 12px 0 0; font-size: 12.5px; color: #565656; transition: color 0.3s ease; }
.ticket__code {
  margin: 8px auto 0; display: inline-block;
  font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 14px; font-weight: 700; letter-spacing: 2px;
  color: #171717; background: rgba(20,20,20,0.06); border: 1px dashed rgba(20,20,20,0.22); border-radius: 9px; padding: 6px 14px;
}

/* "Used" stamp — slammed onto the ticket in realtime when the cashier redeems */
.ticket__used { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; z-index: 6; }
.ticket__used[hidden] { display: none; } /* beat the .ticket__used display:flex so hidden actually hides */
.ticket__usedmark {
  display: flex; align-items: center; justify-content: center; box-sizing: border-box;
  width: 168px; height: 168px; border-radius: 50%;
  font-family: var(--font-heading); font-weight: 800; font-size: 36px; letter-spacing: 2px;
  text-transform: uppercase; color: #171717; opacity: 0.9;
  border: 5px solid #171717;
  transform: rotate(-14deg);
  box-shadow: inset 0 0 0 3px rgba(20,20,20,0.28), 0 8px 22px -12px rgba(20,20,20,0.6);
  text-shadow: 0 1px 0 rgba(255,255,255,0.4);
}
.ticket__used.stamp-in .ticket__usedmark { animation: stampSlam 0.5s cubic-bezier(0.2, 1.5, 0.35, 1) both; }
@keyframes stampSlam {
  0%   { transform: rotate(-14deg) scale(2.6); opacity: 0; }
  55%  { transform: rotate(-14deg) scale(0.9);  opacity: 0.95; }
  75%  { transform: rotate(-14deg) scale(1.08); }
  100% { transform: rotate(-14deg) scale(1);    opacity: 0.9; }
}
/* the QR fades out under the stamp, and the ticket gives a little recoil */
.congrats.is-used .ticket__qr { opacity: 0.18; filter: grayscale(1); transition: opacity 0.4s ease, filter 0.4s ease; }
.congrats.is-used .ticket__hint { color: #4a4a4a; font-weight: 700; }
.congrats.is-used .ticket { animation: ticketRecoil 0.4s ease; }
@keyframes ticketRecoil { 0%,100% { transform: translateY(0) scale(1); } 22% { transform: translateY(4px) scale(0.985); } 55% { transform: translateY(-1px) scale(1.004); } }

.congrats__continue {
  font-family: var(--font-heading); font-weight: 600; font-size: 16px;
  color: #ffffff; background: rgba(255,255,255,0.16);
  border: 1.5px solid rgba(255,255,255,0.55); border-radius: 16px;
  padding: 15px 44px; cursor: pointer; min-width: 220px;
  transition: background 0.2s ease, transform 0.14s ease;
}
.congrats__continue:hover { background: rgba(255,255,255,0.26); }
.congrats__continue:active { transform: scale(0.98); }

/* ---- celebratory entrance choreography (plays when .congrats gets .show) ---- */
@keyframes cFadeUp { 0% { opacity: 0; transform: translateY(12px); } 100% { opacity: 1; transform: none; } }
@keyframes popBounce {
  0% { opacity: 0; transform: scale(0) rotate(-35deg); }
  55% { opacity: 1; transform: scale(1.25) rotate(10deg); }
  72% { transform: scale(0.92) rotate(-6deg); }
  86% { transform: scale(1.06) rotate(3deg); }
  100% { opacity: 1; transform: scale(1) rotate(0); }
}
@keyframes titleShimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
@keyframes continueGlow {
  0%,100% { box-shadow: 0 0 0 0 rgba(255,255,255,0); }
  50% { box-shadow: 0 0 22px -2px rgba(255,255,255,0.35); }
}

.congrats.show .ticket__pop { animation: popBounce 0.8s var(--ease-spring) 0.15s both; }
.congrats.show .ticket__title { animation: titleShimmer 2s ease 0.45s 2; }
.congrats.show .ticket__sub { animation: cFadeUp 0.5s ease 0.30s both; }
.congrats.show .ticket__divider { animation: cFadeUp 0.5s ease 0.38s both; }
.congrats.show .ticket__stats { animation: cFadeUp 0.5s ease 0.44s both; }
.congrats.show .ticket__qr { animation: cFadeUp 0.55s var(--ease-spring) 0.54s both; }
.congrats.show .ticket__hint { animation: cFadeUp 0.5s ease 0.66s both; }
.congrats.show .ticket__code { animation: cFadeUp 0.5s ease 0.72s both; }
.congrats.show .congrats__continue { animation: cFadeUp 0.5s ease 0.82s both, continueGlow 2.8s ease-in-out 1.6s infinite; }

/* ---------------- Confetti ---------------- */
.confetti { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 220; pointer-events: none; }

/* ---------------- Reduced motion ---------------- */
@media (prefers-reduced-motion: reduce) {
  .stain, .bg::before, .bg::after { animation: none; }
  .wcard, .card { transition: transform 0.3s ease; }
  .face { transition-delay: 0.15s; }
  .face--front, .slot, .reward-teaser, .oram-sheen, .wallet-title, .greeting, .oram-name { animation: none; opacity: 1; transform: none; }
  .slot.is-stamped .stamp { animation: none; opacity: var(--sa,1); transform: translate(var(--dx,0), var(--dy,0)) scale(1) rotate(var(--r,0deg)); }
  .slot.is-stamped .halo { animation: none; }
  .reward__prize.shine::after { animation: none; }
  /* congrats ticket: keep it readable, drop the choreography */
  .congrats::before, .congrats::after, .ticket__qr::after, .ticket__pop,
  .congrats.show .ticket__pop, .congrats.show .ticket__title, .congrats.show .ticket__sub,
  .congrats.show .ticket__divider, .congrats.show .ticket__stats, .congrats.show .ticket__qr,
  .congrats.show .ticket__hint, .congrats.show .ticket__code, .congrats.show .congrats__continue { animation: none; opacity: 1; transform: none; }
  .ticket__title { background: none; color: #171717; -webkit-text-fill-color: #171717; }
}

/* ---------------- Toast (cooldown / invalid-tap feedback) ---------------- */
.toast {
  position: fixed; left: 50%; bottom: 32px; transform: translate(-50%, 20px);
  max-width: min(88vw, 420px); z-index: 250;
  padding: 13px 18px; border-radius: 14px;
  background: rgba(20,20,20, 0.96); color: #f4f4f4;
  font-family: var(--font-heading); font-weight: 600; font-size: 14px;
  text-align: center; line-height: 1.35;
  box-shadow: 0 16px 34px -14px rgba(0, 0, 0, 0.55);
  opacity: 0; pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ================= Glassy bottom navigation ================= */
/* discounts now live in the tab bar; retire the top-corner buttons */
.pocket-btn { display: none; }
.signout-btn { display: none; }
/* keep the card clear of the floating bar */
.stage { padding-bottom: 104px; }
/* dev-only Stamp button sits above the bar */
.stampbar.dev-on { bottom: 88px; }

.tabbar {
  position: fixed; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%); z-index: 210;
  display: flex; padding: 7px; border-radius: 22px;
  background: var(--glass-fill-strong);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  border: 1px solid var(--glass-border);
  box-shadow: 0 18px 40px -16px rgba(20,20,20,0.5), inset 0 1px 0 var(--glass-hi);
  animation: tabbarIn 0.6s var(--ease-spring) 0.25s both;
  transition: transform 0.32s var(--ease-spring), opacity 0.28s ease;
}
@keyframes tabbarIn { from { opacity: 0; transform: translate(-50%, 26px); } to { opacity: 1; transform: translate(-50%, 0); } }
/* hidden while the full-height discounts drawer is open, so that panel is the
   topmost thing on screen instead of the toolbar poking out over it — the
   settings sheet sits higher up and leaves the toolbar visible and tappable */
.tabbar.is-hidden { opacity: 0; transform: translate(-50%, 100%); pointer-events: none; }

.tabbar__ind {
  position: absolute; top: 7px; left: 7px;
  width: 84px; height: calc(100% - 14px);
  border-radius: 16px; background: #171717;
  transform: translateX(calc(var(--ti, 1) * 84px));
  transition: transform 0.44s var(--ease-spring);
  z-index: 0;
}
.tab {
  position: relative; z-index: 1;
  width: 84px; padding: 9px 0 8px;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: none; border: 0; cursor: pointer; color: #565656;
  transition: color 0.35s ease;
}
.tab.is-active { color: #ffffff; }
.tab__ico { position: relative; display: grid; place-items: center; height: 24px; }
.tab.is-active .tab__ico { animation: tabPop 0.5s var(--ease-spring); }
@keyframes tabPop { 0% { transform: scale(1); } 42% { transform: scale(1.3) translateY(-2px); } 100% { transform: scale(1); } }
.tab__ico svg { width: 23px; height: 23px; }
.tab__label { font-family: var(--font-heading); font-size: 10.5px; font-weight: 700; letter-spacing: 0.2px; }
.tab__badge {
  position: absolute; top: -6px; right: -9px; min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 8px; background: #171717; color: #fff; font-size: 9px; font-weight: 800;
  display: grid; place-items: center; box-shadow: 0 0 0 2px var(--glass-fill-strong);
}
.tab.is-active .tab__badge { background: #fff; color: #171717; }
.tab__badge[hidden] { display: none; }

/* ================= Settings bottom sheet ================= */
.sheet {
  position: fixed; left: 50%; bottom: calc(92px + env(safe-area-inset-bottom, 0px));
  transform: translate(-50%, 130%); opacity: 0;
  width: min(92vw, 400px); z-index: 215; overflow: hidden;
  padding: 14px 20px 20px; border-radius: 24px;
  background: var(--glass-fill-strong);
  backdrop-filter: blur(22px) saturate(160%);
  -webkit-backdrop-filter: blur(22px) saturate(160%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow), inset 0 1px 0 var(--glass-hi);
  transition: transform 0.46s var(--ease-spring), opacity 0.3s ease;
}
.sheet.open { transform: translate(-50%, 0); opacity: 1; }
.sheet__grip { width: 42px; height: 4px; border-radius: 3px; background: rgba(20,20,20,0.18); margin: 2px auto 12px; }
.sheet__title { font-family: var(--font-heading); font-size: 20px; font-weight: 700; margin: 0 0 12px; color: #171717; }
.sheet__rows { display: flex; flex-direction: column; margin-bottom: 16px; }
.srow { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 13px 2px; border-bottom: 1px solid rgba(20,20,20,0.08); }
.srow:last-child { border-bottom: 0; }
.srow__k { font-size: 13px; font-weight: 700; color: #565656; flex: 0 0 auto; }
.srow__v { font-size: 14px; font-weight: 700; color: #171717; min-width: 0; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* a phone number reads the same way regardless of UI language — isolate it
   from the surrounding RTL row so the digit groups don't reorder */
#setPhone { direction: ltr; unicode-bidi: isolate; }
.lang-switch { display: inline-flex; gap: 6px; }
.lang-switch__btn {
  font-family: var(--font-body); font-weight: 700; font-size: 12px; padding: 5px 12px;
  border: 1px solid rgba(20,20,20,0.12); border-radius: 20px; background: rgba(20,20,20,0.04);
  color: #565656; cursor: pointer; transition: background 0.2s ease, color 0.2s ease;
}
html[lang="en"] .lang-switch__btn[data-lang="en"],
html[lang="fa"] .lang-switch__btn[data-lang="fa"] { background: #171717; color: #fff; border-color: #171717; }
.sheet__signout {
  width: 100%; padding: 14px; border-radius: 14px; border: 0; cursor: pointer;
  background: #171717; color: #fff; font-family: var(--font-heading);
  font-weight: 700; font-size: 15px; letter-spacing: 0.2px;
  transition: transform 0.14s ease, background 0.2s ease;
}
.sheet__signout:hover { background: #000; }
.sheet__signout:active { transform: scale(0.98); }

@media (prefers-reduced-motion: reduce) {
  .tabbar { animation: none; }
  .tab.is-active .tab__ico { animation: none; }
  .tabbar__ind, .sheet, .drawer { transition: none; }
  .discounts-page, .coupon-card, .coupon-card__glow, .coupon-card__dot { animation: none; }
  .coupon-card__shine { display: none; }
}

/* ---------------- RTL ---------------- */
/* the detail-view close/back control sits at the "start" edge — the right
   side under RTL, matching how .back buttons work on auth.html */
html[dir="rtl"] .wallet-close { left: auto; right: 16px; }
/* the tab order visually reverses under RTL (flex row follows dir), so the
   sliding active-tab indicator needs to anchor from the other edge and
   translate the opposite way to still land under the right tab */
html[dir="rtl"] .tabbar__ind { left: auto; right: 7px; transform: translateX(calc(var(--ti, 1) * -84px)); }
