﻿/* ==========================================================================
   CANDLE कथा — customer stamp-card app
   Mobile-first. Every colour, size, radius, shadow and easing comes from
   tokens.css; nothing is hardcoded here and no font or asset is fetched
   from a third party.
   ========================================================================== */

:root{
  --nav-h: 70px;
  /* Page gutter that keeps full-bleed bars aligned with the centred column. */
  --gutter: max(var(--s-4), calc((100% - var(--app-max)) / 2 + var(--s-4)));
}

html{
  overflow-x: hidden;
  /*
   * Stop the page rubber-banding past its own ends. The bottom nav is
   * position:fixed, so an overscroll drags the page out from under it and
   * shows blank background beyond the bar. This also disables pull-to-refresh,
   * which is what we want: an accidental downward tug on the QR screen should
   * never reload the card mid-scan.
   */
  overscroll-behavior: none;
}

body{
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}

img{ max-width: 100%; }

main{
  max-width: var(--app-max);
  margin: 0 auto;
  padding-bottom: calc(var(--nav-h) + var(--safe-bottom) + var(--s-4));
  position: relative;
}

.noscript{
  margin: var(--s-4);
  padding: var(--s-4);
  border-radius: var(--r-md);
  background: var(--danger-bg);
  color: var(--danger);
  font-size: var(--t-sm);
  line-height: var(--lh-body);
}

/* ------------------------------------------------------------- top bar --- */
.topbar{
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  background: var(--navy-deep);
  color: var(--text-on-dark);
  padding: calc(var(--safe-top) + var(--s-3)) var(--gutter) var(--s-3);
}
.topbar .brand{
  font-family: var(--font-display);
  font-size: var(--t-md);
  font-weight: 700;
  line-height: var(--lh-tight);
  letter-spacing: var(--track-tight);
}
.topbar .tagline{
  margin-top: 3px;
  font-size: var(--t-xs);
  line-height: 1.3;
  color: var(--gold-soft);
  letter-spacing: var(--track-wide);
  text-transform: uppercase;
}

/* A quiet pill; only ever used on navy. */
.chip{
  display: inline-block;
  flex: none;
  font-size: var(--t-xs);
  font-weight: 500;
  letter-spacing: var(--track-wide);
  text-transform: uppercase;
  color: var(--gold-soft);
  background: color-mix(in srgb, var(--gold) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--gold) 34%, transparent);
  border-radius: var(--r-full);
  padding: 3px 10px;
  line-height: 1.4;
  white-space: nowrap;
}

/* ------------------------------------------------------------- buttons --- */
.btn{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  width: 100%;
  min-height: 48px;
  font-family: var(--font-body);
  font-size: var(--t-base);
  font-weight: 600;
  line-height: 1.2;
  padding: var(--s-3) var(--s-6);
  border: 1px solid transparent;
  border-radius: var(--r-full);
  background: var(--navy);
  color: var(--cream);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  text-align: center;
  transition:
    transform var(--dur-fast) var(--ease),
    box-shadow var(--dur) var(--ease),
    background-color var(--dur) var(--ease),
    opacity var(--dur) var(--ease);
}
.btn:hover{ background: var(--navy-soft); }
.btn:active{ transform: scale(0.97); }

.btn.gold{
  background: var(--grad-gold);
  color: var(--navy-deep);
  box-shadow: var(--shadow-gold);
}
.btn.gold:hover{ filter: brightness(1.03); }

.btn.ghost{
  background: transparent;
  border-color: var(--line-strong);
  color: var(--navy);
  box-shadow: none;
}
.btn.ghost:hover{ background: var(--surface-2); border-color: var(--navy-soft); }

.btn.danger{ background: var(--danger); color: var(--surface); }

.btn.small{
  width: auto;
  min-height: 44px;
  font-size: var(--t-sm);
  padding: var(--s-2) var(--s-4);
}
/* Expands a capped list in place — never a new screen. */
.btn.more{
  width: 100%;
  min-height: 44px;
  margin-top: var(--s-3);
  color: var(--text-muted);
  font-weight: 600;
}
.btn.more:hover{ color: var(--navy); }
.btn[disabled]{ opacity: 0.5; cursor: default; box-shadow: none; }
.btn[disabled]:active{ transform: none; }
.btn + .btn{ margin-top: var(--s-3); }

.icon-btn{
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  min-height: 44px;
  background: none;
  border: none;
  color: var(--navy);
  font-family: var(--font-body);
  font-size: var(--t-sm);
  font-weight: 600;
  cursor: pointer;
  padding: var(--s-2);
  border-radius: var(--r-sm);
  transition: color var(--dur) var(--ease), background-color var(--dur) var(--ease);
}
.icon-btn:hover{ background: var(--surface-2); }
.icon-btn.link{ text-decoration: none; color: var(--gold-ink); }
.icon-btn.link:hover{ color: var(--navy); }

/* --------------------------------------------------------------- forms --- */
.field{ margin-bottom: var(--s-4); }
.field label{
  display: block;
  font-size: var(--t-xs);
  font-weight: 600;
  letter-spacing: var(--track-wide);
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: var(--s-2);
}

input, select, textarea{
  width: 100%;
  font-family: var(--font-body);
  font-size: var(--t-base);      /* 16px — stops iOS Safari zooming on focus */
  line-height: 1.4;
  padding: var(--s-4);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-xs);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
input::placeholder{ color: var(--text-muted); }
input:focus, select:focus, textarea:focus{
  outline: 2px solid var(--gold);
  outline-offset: 1px;
  border-color: var(--gold);
}
.field.bad input{ border-color: var(--danger); background: var(--danger-bg); }
.field-err{
  font-size: var(--t-sm);
  color: var(--danger);
  margin-top: var(--s-2);
  line-height: var(--lh-snug);
}
.hint{
  font-size: var(--t-sm);
  color: var(--text-muted);
  margin-top: var(--s-2);
  margin-bottom: 0;
  line-height: var(--lh-snug);
}
.hint.live{ margin-top: var(--s-2); color: var(--text-muted); }

/* --------------------------------------------------------------- login --- */
.login-pad{
  max-width: var(--app-max);
  margin: 0 auto;
  padding: var(--s-8) var(--s-5) var(--s-12);
}
.login-mark{
  width: 84px;
  height: 84px;
  margin: 0 auto var(--s-6);
  border-radius: 50%;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: var(--gold);
  background: var(--grad-navy);
  box-shadow:
    0 0 0 2px var(--gold),
    0 0 0 9px color-mix(in srgb, var(--gold) 14%, transparent),
    var(--shadow-md);
}
.login-mark .hero-logo{
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  background: transparent;
  box-shadow: none;
}
.login-head{ text-align: center; margin: 0 0 var(--s-8); }
.login-head h1{
  font-family: var(--font-display);
  font-size: var(--t-xl);
  color: var(--navy);
  margin: 0 0 var(--s-3);
  text-wrap: balance;
}
.login-head p{
  font-size: var(--t-base);
  color: var(--text-muted);
  margin: 0;
  line-height: var(--lh-body);
}
.login-pad .hint{ text-align: center; }
.login-pad .field .hint,
.login-pad .field-err{ text-align: left; }

/* Two-step slide. */
.step{ display: block; }
.step.in-right{ animation: ck-step-right var(--dur-slow) var(--ease) both; }
.step.in-left{ animation: ck-step-left var(--dur-slow) var(--ease) both; }
@keyframes ck-step-right{ from{ opacity:0; transform: translateX(24px); } to{ opacity:1; transform:none; } }
@keyframes ck-step-left{ from{ opacity:0; transform: translateX(-24px); } to{ opacity:1; transform:none; } }

.phone-confirm{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: var(--s-3) var(--s-3) var(--s-3) var(--s-4);
  font-size: var(--t-sm);
  margin-bottom: var(--s-5);
  box-shadow: var(--shadow-xs);
}
.phone-confirm .pc-num{
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  color: var(--text-muted);
  min-width: 0;
}
.phone-confirm b{
  color: var(--navy);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  font-size: var(--t-base);
}

/* ------------------------------------------------------------ messages --- */
.msg{
  font-size: var(--t-sm);
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-md);
  margin-bottom: var(--s-4);
  line-height: var(--lh-snug);
  border: 1px solid transparent;
}
.msg.ok{ background: var(--ok-bg);     color: var(--ok);     border-color: color-mix(in srgb, var(--ok) 22%, transparent); }
.msg.err{ background: var(--danger-bg); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 22%, transparent); }
.msg.warn{ background: var(--warn-bg);  color: var(--warn);   border-color: color-mix(in srgb, var(--warn) 22%, transparent); }
.msg.info{ background: var(--info-bg);  color: var(--info);   border-color: color-mix(in srgb, var(--info) 22%, transparent); }
.msg-slot{ margin: var(--s-4) var(--s-4) 0; }
.msg-slot .msg{ margin-bottom: 0; }
.msg-slot:empty{ display: none; }

/* ---------------------------------------------------------------- hero --- */
.hero{
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background: var(--grad-navy);
  color: var(--text-on-dark);
  padding: var(--s-5) var(--s-5) var(--s-5);
  border-radius: 0 0 var(--r-2xl) var(--r-2xl);
  box-shadow: var(--shadow-md);
}
/* Blends the hero into the flat navy bar above it — no visible seam. */
.hero::before{
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 46%;
  z-index: -1;
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--navy-deep) 88%, transparent),
    transparent);
}
/* Ambient warm glow. */
.hero-glow{
  position: absolute;
  z-index: -2;
  width: 330px;
  height: 330px;
  right: -110px;
  top: -130px;
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(circle,
    color-mix(in srgb, var(--gold) 62%, transparent) 0%,
    color-mix(in srgb, var(--gold) 18%, transparent) 45%,
    transparent 70%);
  filter: blur(34px);
  opacity: 0.5;
}
.hero.compact{ padding: var(--s-4) var(--s-5) var(--s-5); }
.hero.centred{ padding: var(--s-4) var(--s-5) var(--s-5); text-align: center; }

.hero-top{ display: flex; align-items: center; gap: var(--s-3); margin-bottom: var(--s-5); }
.hero.compact .hero-top{ margin-bottom: 0; }
.hero-top .hero-id{ min-width: 0; }

.hero-logo{
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  flex: none;
  background: var(--navy-deep);
  box-shadow: 0 0 0 2px var(--gold), 0 0 0 6px color-mix(in srgb, var(--gold) 15%, transparent);
}
.hero-logo.fallback{
  display: grid;
  place-items: center;
  color: var(--gold);
}

.biz-name{
  font-family: var(--font-display);
  font-size: var(--t-lg);
  font-weight: 700;
  line-height: var(--lh-tight);
  letter-spacing: var(--track-tight);
  overflow-wrap: anywhere;
}
.biz-sub{
  display: flex;
  align-items: center;
  gap: var(--s-2);
  flex-wrap: wrap;
  margin-top: var(--s-2);
  font-size: var(--t-xs);
  font-weight: 500;
  letter-spacing: var(--track-wide);
  text-transform: uppercase;
  color: var(--gold-soft);
}
.hero.centred .biz-sub{ justify-content: center; }
.hero.centred .biz-name{ margin-bottom: var(--s-1); }

.hero-count{
  display: flex;
  align-items: baseline;
  gap: var(--s-2);
  margin: 0 0 var(--s-3);
}
.hero-count-fig{ display: flex; align-items: baseline; gap: var(--s-2); }
.hero-count-num{
  font-family: var(--font-display);
  font-size: var(--t-3xl);
  font-weight: 700;
  line-height: 0.95;
  font-variant-numeric: tabular-nums;
  color: var(--cream);
}
.hero-count-of{
  font-size: var(--t-lg);
  line-height: 1;
  color: color-mix(in srgb, var(--gold-soft) 60%, transparent);
}
.hero-count-target{
  font-family: var(--font-display);
  font-size: var(--t-xl);
  font-weight: 500;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: color-mix(in srgb, var(--gold-soft) 78%, transparent);
}
.hero-count-label{
  margin-left: auto;
  font-size: var(--t-xs);
  font-weight: 500;
  letter-spacing: var(--track-wide);
  text-transform: uppercase;
  color: var(--gold-soft);
}

.progress-track{
  position: relative;
  height: 10px;
  border-radius: var(--r-full);
  background: color-mix(in srgb, var(--cream) 15%, transparent);
  overflow: hidden;
  box-shadow: inset 0 1px 2px color-mix(in srgb, var(--navy-deep) 45%, transparent);
}
.progress-fill{
  position: relative;
  height: 100%;
  width: 0;
  border-radius: var(--r-full);
  background: var(--grad-gold);
  overflow: hidden;
  transition: width var(--dur-slow) var(--ease);
}
.progress-fill::after{
  content: "";
  position: absolute;
  inset: 0;
  background: var(--grad-sheen);
}

/* -------------------------------------------------------------- panels --- */
.panel{
  background: var(--surface);
  margin: var(--s-3) var(--s-4) 0;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--s-3) var(--s-5) var(--s-4);
  box-shadow: var(--shadow-sm);
}
.panel.centred{ text-align: center; }
.panel h4{
  font-family: var(--font-body);
  font-size: var(--t-xs);
  font-weight: 600;
  letter-spacing: var(--track-wide);
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 var(--s-2);
}
.panel p{ line-height: var(--lh-body); }

/* Next-reward summary. */
.reward-row-top{ display: flex; align-items: flex-start; gap: var(--s-4); }
.reward-row-top .grow{ flex: 1; min-width: 0; }
.reward-icon{
  width: 48px;
  height: 48px;
  flex: none;
  border-radius: var(--r-md);
  background: var(--grad-navy);
  color: var(--gold);
  display: grid;
  place-items: center;
  box-shadow: var(--shadow-sm);
}
.reward-row-top .rtitle{
  font-family: var(--font-display);
  font-size: var(--t-md);
  font-weight: 700;
  color: var(--text);
  line-height: var(--lh-tight);
  overflow-wrap: anywhere;
}
.reward-row-top .rdesc{
  font-size: var(--t-sm);
  color: var(--text-muted);
  margin-top: var(--s-1);
  line-height: var(--lh-snug);
}
.reward-row-top .rmeta{
  display: flex;
  gap: var(--s-2);
  align-items: center;
  flex-wrap: wrap;
  font-size: var(--t-sm);
  color: var(--text-muted);
  margin-top: var(--s-2);
}
.rmeta .pill{
  display: inline-flex;
  align-items: center;
  gap: var(--s-1);
  background: var(--gold-wash);
  color: var(--gold-ink);
  padding: 3px 10px;
  border-radius: var(--r-full);
  font-size: var(--t-xs);
  font-weight: 700;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.rmeta .ready{
  display: inline-flex;
  align-items: center;
  gap: var(--s-1);
  color: var(--ok);
  font-weight: 600;
}

/* -------------------------------------------------------------- stamps --- */
/* Bleeds to the card edges so a long card reads as a scroller, not a crop. */
.stamp-row{
  display: flex;
  gap: var(--s-2);
  overflow-x: auto;
  padding: var(--s-2) var(--s-5) var(--s-3);
  margin: 0 calc(var(--s-5) * -1);
  scrollbar-width: none;
  -ms-overflow-style: none;
  scroll-snap-type: x proximity;
  overscroll-behavior-x: contain;
}
.stamp-row::-webkit-scrollbar{ width: 0; height: 0; display: none; }

.stamp-circle{
  width: 46px;
  height: 46px;
  flex: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  scroll-snap-align: start;
  border: 2px dashed var(--line-strong);
  background: var(--surface-2);
  color: var(--text-soft);
  transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.stamp-circle .icon{ width: 1.4em; height: 1.4em; }

.stamp-circle.filled{
  border: 2px solid var(--navy);
  background: var(--grad-navy);
  color: var(--gold);
  box-shadow:
    0 0 0 3px color-mix(in srgb, var(--gold) 20%, transparent),
    var(--shadow-sm);
}
.stamp-circle.next{
  border: 2px dashed var(--gold);
  background: var(--gold-wash);
  color: var(--gold-ink);
  animation: ck-breathe 2600ms var(--ease-out) infinite;
}
.stamp-circle.goal{ border-style: solid; border-color: var(--line-strong); }
.stamp-circle.goal.next{ border-color: var(--gold); }
.stamp-circle.goal.filled{ border-color: var(--navy); }

@keyframes ck-breathe{
  0%, 100%{ box-shadow: 0 0 0 0 color-mix(in srgb, var(--gold) 40%, transparent); }
  50%     { box-shadow: 0 0 0 7px color-mix(in srgb, var(--gold) 0%, transparent); }
}
@keyframes ck-pop{
  0%  { transform: scale(0.6); opacity: 0.25; }
  55% { transform: scale(1.08); opacity: 1; }
  100%{ transform: scale(1); opacity: 1; }
}
.stamp-circle.pop{ animation: ck-pop var(--dur-slow) var(--ease) both; }

.stamp-note{
  font-size: var(--t-sm);
  text-align: center;
  color: var(--text-muted);
  margin-top: var(--s-1);
  line-height: var(--lh-snug);
}
.stamp-note b{ color: var(--navy); font-weight: 700; }

/* ----------------------------------------------------------- info rows --- */
.info-row{
  display: flex;
  align-items: center;
  gap: var(--s-3);
  font-size: var(--t-sm);
  color: var(--text);
  padding: var(--s-1) 0;
  line-height: var(--lh-snug);
}
.info-row .dot{
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 50%;
  background: var(--gold-wash);
  color: var(--gold-ink);
  display: grid;
  place-items: center;
}
.info-row .val{ font-weight: 700; color: var(--navy); }
.info-row.stack{ align-items: flex-start; }
.info-row .grow{ flex: 1; min-width: 0; }
.info-row a{ color: var(--navy); font-weight: 600; }

/* ------------------------------------------------------------- QR + PIN -- */
.qr-plaque{
  display: flex;
  justify-content: center;
  width: -moz-fit-content;
  width: fit-content;
  margin: var(--s-3) auto 0;
  padding: var(--s-3);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-md);
  max-width: 100%;
  overflow: hidden;
}
.qr-plaque.lg{ margin-top: 0; padding: var(--s-3); box-shadow: var(--shadow-lg); }
.qr-plaque img,
.qr-plaque canvas{ display: block; border-radius: var(--r-sm); }
.qr-fallback{
  font-size: var(--t-sm);
  color: var(--text-muted);
  padding: var(--s-5) var(--s-3);
  text-align: center;
  max-width: 190px;
  line-height: var(--lh-snug);
  word-break: break-all;
}

.pin-line{
  text-align: center;
  font-size: var(--t-sm);
  color: var(--text-muted);
  margin-top: var(--s-2);
  line-height: var(--lh-snug);
}
.pin-line b{
  display: inline-block;
  margin-top: var(--s-2);
  font-family: var(--font-mono);
  font-size: var(--t-md);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.32em;
  padding-left: 0.32em;
  color: var(--navy);
}

.pin-cap{
  font-size: var(--t-xs);
  font-weight: 600;
  letter-spacing: var(--track-wide);
  text-transform: uppercase;
  color: var(--text-muted);
  margin-top: var(--s-3);
}
.pin-big{
  font-family: var(--font-mono);
  font-size: var(--t-2xl);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.34em;
  line-height: 1.25;
  color: var(--navy);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: var(--s-2) var(--s-4);
  padding-left: calc(var(--s-4) + 0.34em);  /* balances the trailing tracking */
  margin: var(--s-2) 0 var(--s-3);
  box-shadow: var(--shadow-inset);
  overflow-wrap: anywhere;
}

/* The 5-minute window, as a thin bar plus the live m:ss readout. */
.qr-timer{ margin-top: var(--s-2); }
.qr-timer-track{
  height: 4px;
  border-radius: var(--r-full);
  background: var(--surface-3);
  overflow: hidden;
}
.qr-timer-fill{
  display: block;
  height: 100%;
  width: 100%;
  border-radius: var(--r-full);
  background: var(--grad-gold);
  transform-origin: left center;
  animation: ck-drain 300s linear infinite;
}
@keyframes ck-drain{ from{ transform: scaleX(1); } to{ transform: scaleX(0); } }

.countdown{
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  margin-top: var(--s-3);
  font-size: var(--t-sm);
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
}
.countdown .tick{
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 50%;
  background: var(--gold);
  animation: ck-blink 2000ms var(--ease-out) infinite;
}
@keyframes ck-blink{ 0%,100%{ opacity:1; } 50%{ opacity:0.25; } }

.explain{
  font-size: var(--t-sm);
  color: var(--text-muted);
  margin-top: var(--s-3);
  margin-bottom: var(--s-3);
  line-height: var(--lh-snug);
}

/* ------------------------------------------------------- reward tiers ---- */
.rewards-list{ display: flex; flex-direction: column; gap: var(--s-2); }
.reward-row{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: var(--s-2) var(--s-3);
  font-size: var(--t-sm);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.reward-row .tier{ display: flex; align-items: center; gap: var(--s-3); min-width: 0; }
.reward-row .tier-ico{
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: var(--r-sm);
  background: var(--gold-wash);
  color: var(--gold-ink);
  display: grid;
  place-items: center;
}
.reward-row .tier > span{ min-width: 0; }
.tier-title{
  display: block;
  font-weight: 700;
  color: var(--text);
  overflow-wrap: anywhere;
}
.tier-sub{
  display: block;
  font-size: var(--t-sm);
  color: var(--text-muted);
  margin-top: 2px;
  line-height: var(--lh-snug);
  overflow-wrap: anywhere;
}
.reward-row.unlocked{
  border-color: color-mix(in srgb, var(--gold) 62%, transparent);
  background: linear-gradient(180deg, var(--surface), var(--gold-wash));
  box-shadow: var(--shadow-sm);
}
.reward-row.unlocked .tier-ico{ background: var(--grad-navy); color: var(--gold); }

.badge{
  display: inline-flex;
  align-items: center;
  gap: var(--s-1);
  flex: none;
  font-size: var(--t-xs);
  font-weight: 700;
  letter-spacing: 0.03em;
  background: var(--grad-gold);
  color: var(--navy-deep);
  padding: 5px 11px;
  border-radius: var(--r-full);
  white-space: nowrap;
}
.badge.muted{ background: var(--gold-wash); color: var(--gold-ink); }
.badge.quiet{
  background: var(--surface-3);
  color: var(--text);          /* --text-muted only reaches 4.3:1 on this sand */
  font-weight: 600;
}

/* -------------------------------------------------------- reward vault --- */
/* Rewards earned but not carried home yet. The banner sits above the QR on
   the QR tab, so it has to outrank the code visually. */
.vault-banner{
  position: relative;
  margin: var(--s-3) var(--s-4) 0;
  padding: var(--s-4);
  border-radius: var(--r-lg);
  background: linear-gradient(165deg,
    color-mix(in srgb, var(--gold-wash) 55%, var(--surface)),
    var(--gold-wash));
  border: 1px solid color-mix(in srgb, var(--gold) 55%, transparent);
  border-left: 4px solid var(--gold);
  box-shadow: var(--shadow-gold);
  color: var(--gold-ink);
}
.vault-banner-head{
  display: flex;
  align-items: center;
  gap: var(--s-2);
  margin: 0 0 var(--s-3);
  font-family: var(--font-display);
  font-size: var(--t-md);
  font-weight: 700;
  line-height: var(--lh-snug);
  color: var(--navy-deep);
}
.vault-panel{ border-color: color-mix(in srgb, var(--gold) 55%, transparent); }
.vault-panel h4{ color: var(--gold-ink); }

.vault-card{
  background: var(--surface);
  border: 1px solid color-mix(in srgb, var(--gold) 40%, transparent);
  border-radius: var(--r-md);
  padding: var(--s-3);
  text-align: center;
  box-shadow: var(--shadow-xs);
}
.vault-card + .vault-card{ margin-top: var(--s-2); }
.vault-card-head{
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  min-width: 0;
}
.vault-ico{
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: var(--r-sm);
  background: var(--grad-navy);
  color: var(--gold);
  display: grid;
  place-items: center;
}
.vault-name{
  font-family: var(--font-display);
  font-size: var(--t-md);
  font-weight: 700;
  color: var(--text);
  min-width: 0;
  overflow-wrap: anywhere;
}
.vault-code{
  font-family: var(--font-mono);
  font-size: var(--t-lg);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.28em;
  color: var(--navy-deep);
  background: var(--gold-wash);
  border: 1px dashed var(--gold);
  border-radius: var(--r-md);
  padding: var(--s-2) var(--s-3);
  padding-left: calc(var(--s-3) + 0.28em);  /* balances the trailing tracking */
  margin: var(--s-3) 0 var(--s-2);
  overflow-wrap: anywhere;
  animation: ck-code-glow 2400ms var(--ease-out) infinite;
}
@keyframes ck-code-glow{
  0%, 100%{ box-shadow: 0 0 0 0 color-mix(in srgb, var(--gold) 0%, transparent); }
  50%     { box-shadow: 0 0 0 5px color-mix(in srgb, var(--gold) 26%, transparent); }
}
.vault-facts{
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: var(--t-sm);
  color: var(--text-muted);
  line-height: var(--lh-snug);
}
.vault-fact{ display: inline-flex; align-items: center; justify-content: center; gap: var(--s-1); }
.vault-fact.forever{ color: var(--ok); }
.vault-fact.deadline{ color: var(--gold-ink); font-weight: 600; }
.vault-cta{
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  margin: var(--s-3) 0 0;
  font-size: var(--t-sm);
  font-weight: 600;
  color: var(--gold-ink);
  text-align: center;
  line-height: var(--lh-snug);
}

/* Profile tab: "My rewards" */
.vault-sub{
  font-size: var(--t-xs);
  letter-spacing: var(--track-wide);
  text-transform: uppercase;
  font-weight: 700;
  color: var(--gold-ink);
  margin: 0 0 var(--s-3);
}
.vault-sub.muted{ color: var(--text-muted); margin-top: var(--s-4); }
.vault-past{
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: var(--s-2) var(--s-3);
  margin-bottom: var(--s-2);
  background: var(--surface-2);
}
.vault-past:last-of-type{ margin-bottom: 0; }
.vault-past .vp-top{
  display: flex;
  justify-content: space-between;
  gap: var(--s-3);
  font-size: var(--t-sm);
}
.vault-past .vp-top b{ color: var(--text); min-width: 0; overflow-wrap: anywhere; }
.vault-past .when{ color: var(--text-muted); white-space: nowrap; font-size: var(--t-xs); }

/* Reward-tab receipt status */
.rstatus{
  display: inline-flex;
  align-items: center;
  gap: var(--s-1);
  flex: none;
  font-size: var(--t-xs);
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 4px 10px;
  border-radius: var(--r-full);
  background: var(--gold-wash);
  color: var(--gold-ink);
  white-space: nowrap;
}
.rstatus.waiting{ background: var(--grad-gold); color: var(--navy-deep); }
.rstatus.collected{ background: var(--ok-bg); color: var(--ok); }
.rstatus.void{ background: var(--surface-3); color: var(--text-muted); }

.redeem-row{
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: var(--s-2) var(--s-3);
  margin-bottom: var(--s-2);
  background: var(--surface);
}
.redeem-row:last-child{ margin-bottom: 0; }
.redeem-row.waiting{
  border-color: color-mix(in srgb, var(--gold) 62%, transparent);
  background: linear-gradient(180deg, var(--surface), var(--gold-wash));
  box-shadow: var(--shadow-sm);
}
.redeem-row .rtop{
  display: flex;
  justify-content: space-between;
  gap: var(--s-3);
  font-size: var(--t-sm);
  align-items: flex-start;
}
.redeem-row .rtop b{ color: var(--text); min-width: 0; overflow-wrap: anywhere; }
.code{
  display: inline-block;
  font-family: var(--font-mono);
  font-size: var(--t-md);
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--navy);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: var(--s-2) var(--s-3);
  padding-left: calc(var(--s-3) + 0.18em);
  margin-top: var(--s-3);
  overflow-wrap: anywhere;
}

/* ------------------------------------------------------------- history --- */
.day-head{
  font-size: var(--t-xs);
  font-weight: 600;
  letter-spacing: var(--track-wide);
  text-transform: uppercase;
  color: var(--text-muted);
  padding: var(--s-3) 0 var(--s-1);
  border-bottom: 1px solid var(--line);
  margin-bottom: 2px;
}
.day-head:first-child{ padding-top: 0; }

.history-item{
  display: flex;
  align-items: center;
  gap: var(--s-3);
  font-size: var(--t-sm);
  padding: var(--s-2) 0;
  border-bottom: 1px solid var(--line);
}
.history-item:last-child{ border-bottom: none; }
.history-item .h-ico{
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--navy);
  color: var(--gold);
}
.history-item.is-redeem .h-ico{ background: var(--gold-wash); color: var(--gold-ink); }
.history-item .h-main{ flex: 1; min-width: 0; }
.history-item .h-label{ color: var(--text); font-weight: 600; overflow-wrap: anywhere; }
.history-item.is-redeem .h-label{ color: var(--gold-ink); }
.history-item .h-meta{ color: var(--text-muted); font-size: var(--t-xs); margin-top: 2px; line-height: var(--lh-snug); }
.history-item .h-delta{
  font-weight: 700;
  color: var(--navy);
  font-size: var(--t-md);
  flex: none;
  font-variant-numeric: tabular-nums;
}
.history-item .h-delta.minus{ color: var(--danger); }
.history-item .when{ color: var(--text-muted); white-space: nowrap; }
.history-item .delta{ font-weight: 700; color: var(--navy); }

.tz-note{ text-align: center; margin-top: var(--s-4); }
.empty{
  font-size: var(--t-sm);
  color: var(--text-muted);
  text-align: center;
  padding: var(--s-4) 0;
}

/* --------------------------------------------------------------- inbox --- */
.inbox{ margin-top: var(--s-2); }
.inbox-item{
  display: flex;
  gap: var(--s-3);
  padding: var(--s-2) 0;
  border-bottom: 1px solid var(--line);
}
.inbox-item:last-child{ border-bottom: none; }
.inbox-item .ico{
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: 50%;
  background: var(--gold-wash);
  color: var(--gold-ink);
  display: grid;
  place-items: center;
}
.inbox-item .grow{ flex: 1; min-width: 0; }
.inbox-item .m-title{ font-size: var(--t-sm); font-weight: 700; overflow-wrap: anywhere; }
.inbox-item .m-body{ font-size: var(--t-sm); color: var(--text-muted); margin-top: 2px; line-height: var(--lh-snug); }
.inbox-item .m-ago{ font-size: var(--t-xs); color: var(--text-muted); margin-top: var(--s-1); }
.inbox-item.unread .m-title::after{
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--gold);
  margin-left: var(--s-2);
  vertical-align: middle;
}

/* ---------------------------------------------------------- bottom nav --- */
.bottomnav{
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  max-width: var(--app-max);
  margin: 0 auto;
  display: flex;
  justify-content: space-around;
  align-items: center;
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  -webkit-backdrop-filter: blur(16px) saturate(1.5);
  backdrop-filter: blur(16px) saturate(1.5);
  border-top: 1px solid var(--line);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  box-shadow: 0 -8px 28px rgba(30, 42, 46, 0.10);
  padding: var(--s-2) var(--s-2) calc(var(--s-3) + var(--safe-bottom));
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))){
  .bottomnav{ background: var(--surface); }
}

.bottomnav .navitem{
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 56px;
  min-height: 48px;
  padding: var(--s-1) var(--s-2);
  font-family: var(--font-body);
  font-size: var(--t-xs);
  font-weight: 500;
  color: var(--text-muted);
  background: none;
  border: none;
  border-radius: var(--r-md);
  cursor: pointer;
  position: relative;
  transition: color var(--dur) var(--ease), transform var(--dur-fast) var(--ease);
}
.bottomnav .navitem:active{ transform: scale(0.97); }
.bottomnav .navitem.active-nav{ color: var(--navy); font-weight: 600; }
.bottomnav .navicon{ display: inline-flex; line-height: 1; }
.bottomnav .navicon .icon{ width: 1.5em; height: 1.5em; }
.bottomnav .navlabel{ line-height: 1.2; }

.nav-dot{
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--gold);
  opacity: 0;
  transform: scale(0.4);
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.navitem.active-nav .nav-dot{ opacity: 1; transform: none; }

.bottomnav .navitem.center{
  width: 60px;
  height: 60px;
  min-width: 60px;
  min-height: 60px;
  flex: none;
  border-radius: 50%;
  background: var(--grad-navy);
  color: var(--gold);
  display: grid;
  place-items: center;
  margin-top: -32px;
  padding: 0;
  gap: 0;
  box-shadow: var(--shadow-gold), 0 0 0 5px var(--surface);
}
.bottomnav .navitem.center .navicon .icon{ width: 1.75em; height: 1.75em; }
.bottomnav .navitem.center.active-nav{
  background: var(--grad-gold);
  color: var(--navy-deep);
}

.nav-badge{
  position: absolute;
  top: -1px;
  right: 4px;
  min-width: 18px;
  height: 18px;
  border-radius: var(--r-full);
  background: var(--grad-gold);
  color: var(--navy-deep);
  font-size: var(--t-xs);
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  padding: 0 5px;
  box-shadow: 0 0 0 2px var(--surface);
}

/* -------------------------------------------------------------- toasts --- */
.toast-wrap{
  position: fixed;
  top: calc(var(--safe-top) + var(--s-3));
  left: 0;
  right: 0;
  z-index: 70;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-2);
  pointer-events: none;
  padding: 0 var(--s-3);
}
.toast{
  background: var(--grad-navy);
  color: var(--cream);
  border-left: 4px solid var(--gold);
  border-radius: var(--r-md);
  padding: var(--s-3) var(--s-5);
  font-size: var(--t-sm);
  font-weight: 600;
  line-height: var(--lh-snug);
  box-shadow: var(--shadow-lg);
  max-width: min(100%, var(--app-max));
  animation: ck-toast-in var(--dur-slow) var(--ease) both;
}
.toast.leaving{ animation: ck-toast-out var(--dur) var(--ease-in) both; }
@keyframes ck-toast-in{ from{ transform: translateY(-16px); opacity: 0; } to{ transform: none; opacity: 1; } }
@keyframes ck-toast-out{ from{ transform: none; opacity: 1; } to{ transform: translateY(-16px); opacity: 0; } }

/* --------------------------------------------------------- celebration --- */
#ck-confetti{
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 60;
}
.celebrate{
  position: fixed;
  inset: 0;
  z-index: 65;
  background: color-mix(in srgb, var(--navy-deep) 62%, transparent);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--s-6);
  animation: ck-fade-in var(--dur) var(--ease) both;
}
.celebrate .card{
  background: var(--surface);
  border-radius: var(--r-xl);
  padding: var(--s-8) var(--s-6) var(--s-6);
  text-align: center;
  max-width: 340px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  animation: ck-pop var(--dur-slow) var(--ease-back) both;
}
.celebrate .big{
  width: 76px;
  height: 76px;
  margin: 0 auto var(--s-5);
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--grad-navy);
  color: var(--gold);
  box-shadow: var(--shadow-gold);
}
.celebrate .big .icon{ width: 2.25em; height: 2.25em; }
.celebrate h3{
  font-family: var(--font-display);
  margin: 0 0 var(--s-3);
  font-size: var(--t-lg);
  color: var(--navy);
  text-wrap: balance;
}
.celebrate p{
  margin: 0 0 var(--s-6);
  font-size: var(--t-sm);
  color: var(--text-muted);
  line-height: var(--lh-body);
}
@keyframes ck-fade-in{ from{ opacity: 0; } to{ opacity: 1; } }

/* ------------------------------------------------------------- loading --- */
.loading{
  padding: var(--s-6) var(--s-5);
  text-align: center;
  color: var(--text-muted);
  font-size: var(--t-sm);
}
.spinner{
  width: 28px;
  height: 28px;
  border: 3px solid var(--surface-3);
  border-top-color: var(--gold);
  border-radius: 50%;
  margin: 0 auto var(--s-3);
  animation: ck-spin 900ms linear infinite;
}
@keyframes ck-spin{ to{ transform: rotate(360deg); } }

/* --------------------------------------------------------------- misc ---- */
.row-between{ display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); }
.row-between h4{ margin: 0; }
.name-edit{ display: flex; gap: var(--s-2); align-items: stretch; }
.name-edit input{ flex: 1; min-width: 0; }
.stat-line{
  display: flex;
  justify-content: space-between;
  font-size: var(--t-sm);
  padding: var(--s-2) 0;
  border-bottom: 1px solid var(--line);
}
.stat-line:last-child{ border-bottom: none; }
.stat-line span:last-child{ font-weight: 700; color: var(--navy); }
.push-msg{ margin-top: var(--s-3); }
.push-btn{ margin-top: var(--s-3); }

.sr-only{
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* --------------------------------------------------- narrow phones ------- */
@media (max-width: 359px){
  .stamp-circle{ width: 42px; height: 42px; }
  .pin-big{ font-size: var(--t-xl); letter-spacing: 0.24em; padding-left: calc(var(--s-4) + 0.24em); }
  .hero-count-num{ font-size: var(--t-2xl); }
}

/* ----------------------------------------------------- reduced motion ---- */
@media (prefers-reduced-motion: reduce){
  .stamp-circle.pop,
  .stamp-circle.next,
  .countdown .tick,
  .qr-timer-fill,
  .vault-code,
  .celebrate .card,
  .toast{ animation-name: none !important; }

  .qr-timer-fill{ transform: none; opacity: 0.6; }
  .vault-code{ box-shadow: 0 0 0 3px color-mix(in srgb, var(--gold) 22%, transparent); }
  .btn:active,
  .bottomnav .navitem:active{ transform: none; }
}
