/* Solent Coffee House — Coffee Loyalty Card */
:root {
  --espresso: #0b0300;
  --espresso-2: #140806;
  --brown: #2a1508;
  --gold: #e8c547;
  --gold-bright: #ffe9a0;
  --gold-deep: #c9a227;
  --gold-bar: #f3e0a0;
  --cream: #fff8ee;
  --cup: #d4c4a8;
  --cup-filled: #5c3b1e;
  --ink: #1a0c05;
  --text: #f7f0e4;
  --muted: #c4b7a0;
  --danger: #f0c0a8;
  --ok: #cde3b8;
  --frame: 3px;
  --radius: 18px;
  --font-sans: "Oswald", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font-script: "Great Vibes", "Snell Roundhand", "Segoe Script", cursive;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
html { background: var(--espresso); }
body {
  font-family: var(--font-sans);
  background:
    radial-gradient(1200px 500px at 50% -10%, rgba(232, 197, 71, 0.12), transparent 55%),
    var(--espresso);
  color: var(--text);
  min-height: 100svh;
  -webkit-font-smoothing: antialiased;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
img { max-width: 100%; display: block; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--gold-bright); }

.page {
  width: min(430px, 100%);
  margin: 0 auto;
  padding: 8px 10px 24px;
}

/* Outer gold card frame */
.card-frame {
  position: relative;
  background:
    linear-gradient(180deg, rgba(20, 8, 6, 0.2), rgba(11, 3, 0, 0.55)),
    url("../assets/beans.jpg") bottom center / 100% auto no-repeat,
    linear-gradient(180deg, #120805 0%, #0b0300 48%, #1a0c06 100%);
  border: var(--frame) solid var(--gold);
  border-radius: 14px;
  box-shadow:
    0 0 0 1px #8a6a1c,
    0 0 0 4px var(--espresso),
    0 0 0 6px rgba(232, 197, 71, 0.55),
    0 18px 40px rgba(0, 0, 0, 0.45);
  overflow: hidden;
  padding: 14px 14px 18px;
}
.card-frame::before {
  content: "";
  pointer-events: none;
  position: absolute;
  inset: 5px;
  border: 1px solid rgba(232, 197, 71, 0.35);
  border-radius: 9px;
}

/* Header */
.brand-row {
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
  z-index: 1;
}
.brand-row .logo {
  width: 78px;
  height: 78px;
  flex: 0 0 78px;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.45));
}
.brand-copy { flex: 1; min-width: 0; text-align: center; }
.script-title {
  font-family: var(--font-script);
  font-weight: 400;
  font-size: clamp(30px, 10.4vw, 42px);
  line-height: 0.95;
  color: #fff;
  margin: 2px 0 6px;
  text-shadow: 0 2px 0 rgba(0,0,0,0.35);
  letter-spacing: 0.2px;
}
.gold-rule {
  display: block;
  height: 3px;
  width: 78%;
  margin: 0 auto 10px;
  border: 0;
  background: linear-gradient(90deg, transparent, var(--gold-bright) 15%, var(--gold) 50%, var(--gold-bright) 85%, transparent);
  border-radius: 2px;
}

.offer {
  text-align: center;
  position: relative;
  z-index: 1;
  margin: 0 0 4px;
}
.offer .line {
  font-weight: 700;
  font-size: clamp(16px, 5.1vw, 20px);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1.15;
  margin: 0;
}
.offer .free-word {
  display: inline-block;
  background: linear-gradient(180deg, #ffe9a0, #e0b83a 60%, #c4921c);
  color: #1a0c05;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 2px 9px 1px;
  margin-left: 4px;
  transform: rotate(-3deg);
  border-radius: 2px;
  box-shadow: 0 1px 0 rgba(0,0,0,0.25);
}

.hello {
  text-align: center;
  margin: 4px 0 2px;
  position: relative;
  z-index: 1;
}
.hello .name {
  font-family: var(--font-script);
  font-size: 26px;
  margin: 0;
  color: #fff;
}
.hello .count {
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold-bar);
  font-size: 14px;
  margin: 2px 0 0;
}

.banner-free {
  display: none;
  text-align: center;
  margin: 6px 8px 2px;
  padding: 8px 12px 7px;
  background: linear-gradient(180deg, #ffe9a0, #e0b83a);
  color: var(--ink);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 15px;
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(224, 184, 58, 0.28);
  position: relative;
  z-index: 1;
  animation: pulse-glow 1.6s ease-in-out infinite;
}
.banner-free.is-on { display: block; }

.today-note {
  display: none;
  text-align: center;
  margin: 6px 8px 2px;
  padding: 6px 10px;
  color: var(--cream, #f4efe4);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.02em;
  position: relative;
  z-index: 1;
}
.today-note.is-on { display: block; }
.daily-limit-note { color: var(--gold-bar, #e0b83a); }
@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 233, 160, 0.15), 0 6px 18px rgba(224, 184, 58, 0.28); }
  50% { box-shadow: 0 0 0 6px rgba(255, 233, 160, 0.12), 0 8px 22px rgba(224, 184, 58, 0.4); }
}

/* Stamp grid: 3 × 3, last cell is FREE */
.stamps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px 8px;
  padding: 8px 4px 4px;
  position: relative;
  z-index: 1;
  max-width: 340px;
  margin: 0 auto;
}
.stamp {
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--cream);
  border: 3px solid var(--gold);
  box-shadow: 0 0 0 1px rgba(0,0,0,0.25), 0 4px 10px rgba(0,0,0,0.28);
  display: grid;
  place-items: center;
  color: var(--cup);
  position: relative;
}
.stamp img, .stamp svg {
  width: 68%;
  height: 68%;
}
.stamp.is-filled {
  color: var(--cup-filled);
  box-shadow:
    0 0 0 1px rgba(0,0,0,0.25),
    0 0 0 3px rgba(232, 197, 71, 0.25),
    0 4px 12px rgba(0,0,0,0.35);
}
.stamp.is-filled::after {
  content: "";
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  border: 1px solid rgba(92, 59, 30, 0.12);
  pointer-events: none;
}
.stamp.pop {
  animation: stamp-pop 0.55s cubic-bezier(0.2, 1.4, 0.4, 1);
}
@keyframes stamp-pop {
  0% { transform: scale(0.6); }
  60% { transform: scale(1.12); }
  100% { transform: scale(1); }
}

.stamp.free {
  background: linear-gradient(180deg, #ffe9a0 0%, #e8c547 45%, #c9a227 100%);
  color: var(--ink);
  border-color: #f6e7b0;
}
.stamp.free .free-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  line-height: 1;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.stamp.free .free-label svg { width: 22px; height: 18px; margin-bottom: 1px; }
.stamp.free .free-label span {
  font-size: 13px;
  letter-spacing: 0.14em;
}
.stamp.free.is-ready {
  animation: free-pulse 1.4s ease-in-out infinite;
  box-shadow:
    0 0 0 3px rgba(255, 233, 160, 0.35),
    0 0 22px rgba(232, 197, 71, 0.65);
}
@keyframes free-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

/* QR + meta */
.qr-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin: 6px 0 2px;
  position: relative;
  z-index: 1;
}
.qr-wrap {
  background: #fff;
  padding: 8px;
  border-radius: 10px;
  border: 2px solid var(--gold);
  box-shadow: 0 4px 14px rgba(0,0,0,0.3);
}
.qr-wrap > div, .qr-wrap canvas, .qr-wrap img, .qr-wrap table {
  display: block;
}
.card-id {
  font-weight: 500;
  letter-spacing: 0.16em;
  font-size: 12px;
  color: var(--gold-bar);
  text-transform: uppercase;
  margin: 0;
}

.actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 10px 6px 4px;
  position: relative;
  z-index: 1;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  border: 0;
  border-radius: 10px;
  padding: 11px 16px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  background: linear-gradient(180deg, #ffe9a0, #d4af37);
  color: var(--ink);
  box-shadow: 0 3px 0 #8a6a1c, 0 8px 16px rgba(0,0,0,0.25);
}
.btn:active { transform: translateY(1px); box-shadow: 0 2px 0 #8a6a1c, 0 4px 10px rgba(0,0,0,0.25); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-ghost {
  background: transparent;
  color: var(--gold-bar);
  box-shadow: none;
  border: 1px solid rgba(232, 197, 71, 0.45);
}
.btn-danger {
  background: linear-gradient(180deg, #f4d2c2, #e8b090);
}
.btn-row {
  display: flex;
  gap: 8px;
}
.btn-row .btn { width: auto; flex: 1; }

.footer-note {
  text-align: center;
  margin: 12px 8px 2px;
  position: relative;
  z-index: 1;
}
.footer-note p {
  margin: 0;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 9.5px;
  color: var(--cream);
  line-height: 1.45;
  padding: 0 4px;
}
.gold-rule.wide { width: 92%; margin: 8px auto; }
.privacy, .tiny {
  text-align: center;
  font-family: var(--font-sans);
  font-weight: 400;
  letter-spacing: 0.02em;
  text-transform: none;
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.45;
  margin: 10px 12px 0;
  position: relative;
  z-index: 1;
}
.tiny a { color: var(--muted); text-decoration: underline; text-underline-offset: 2px; }

/* Forms */
.form { position: relative; z-index: 1; margin: 8px 4px 0; }
label {
  display: block;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 12px;
  color: var(--gold-bar);
  margin: 12px 0 6px;
}
input[type="text"], input[type="tel"], input[type="email"], input[type="password"], input[type="search"], input[type="number"] {
  width: 100%;
  background: rgba(255, 248, 238, 0.96);
  color: var(--ink);
  border: 2px solid var(--gold-deep);
  border-radius: 10px;
  padding: 12px 14px;
  letter-spacing: 0.02em;
  outline: none;
}
input:focus { border-color: var(--gold-bright); box-shadow: 0 0 0 3px rgba(232, 197, 71, 0.25); }
input::placeholder { color: #8a7a68; font-weight: 400; letter-spacing: 0; text-transform: none; }
.error {
  color: var(--danger);
  font-size: 13px;
  letter-spacing: 0.02em;
  text-transform: none;
  font-weight: 400;
  min-height: 1.2em;
  margin: 8px 2px 0;
  text-align: center;
}
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid rgba(232, 197, 71, 0.35);
  margin: 6px 4px 4px;
  position: relative;
  z-index: 1;
}
.tabs button {
  flex: 1;
  background: none;
  border: 0;
  color: var(--muted);
  padding: 10px 8px 8px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
  font-size: 13px;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tabs button.is-on {
  color: var(--gold-bright);
  border-bottom-color: var(--gold);
}

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(20px);
  background: #fff8ee;
  color: var(--ink);
  padding: 11px 16px;
  border-radius: 10px;
  border: 2px solid var(--gold);
  box-shadow: 0 10px 30px rgba(0,0,0,0.35);
  opacity: 0;
  pointer-events: none;
  z-index: 80;
  max-width: min(92vw, 360px);
  text-align: center;
  font-weight: 500;
  letter-spacing: 0.03em;
  transition: opacity 0.25s, transform 0.25s;
}
.toast.is-on { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Modal */
.modal-back {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.62);
  display: none;
  align-items: flex-end;
  justify-content: center;
  z-index: 60;
  padding: 16px;
}
.modal-back.is-on { display: flex; }
.modal {
  width: min(400px, 100%);
  background: linear-gradient(180deg, #1a0c06, #0b0300);
  border: 2px solid var(--gold);
  border-radius: 16px 16px 12px 12px;
  padding: 18px 16px 16px;
  margin-bottom: env(safe-area-inset-bottom);
}
.modal h2 {
  font-family: var(--font-script);
  font-size: 34px;
  font-weight: 400;
  text-align: center;
  margin: 0 0 4px;
}
.modal p.lead { text-align: center; color: var(--muted); margin: 0 0 10px; font-weight: 400; letter-spacing: 0; text-transform: none; font-size: 14px; }

/* Celebration overlay */
.confetti {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 70;
  overflow: hidden;
}
.confetti i {
  position: absolute;
  top: -10px;
  width: 8px;
  height: 14px;
  border-radius: 1px;
  background: var(--gold);
  animation: fall 1.4s ease-in forwards;
}
@keyframes fall {
  to { transform: translateY(110vh) rotate(280deg); opacity: 0.2; }
}

.install-hint {
  margin: 10px 8px 0;
  padding: 10px 12px;
  border: 1px dashed rgba(232, 197, 71, 0.45);
  border-radius: 10px;
  color: var(--muted);
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  font-size: 12.5px;
  line-height: 1.45;
  text-align: center;
  position: relative;
  z-index: 1;
}
.hidden { display: none !important; }

/* Staff screen */
body.staff { background: var(--espresso); }
.staff-top {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 4px 12px;
}
.staff-top .logo { width: 54px; height: 54px; }
.staff-top h1 {
  font-family: var(--font-script);
  font-size: 30px;
  margin: 0;
  font-weight: 400;
  line-height: 1;
}
.staff-top p { margin: 2px 0 0; color: var(--gold-bar); letter-spacing: 0.1em; text-transform: uppercase; font-size: 11px; font-weight: 600; }

.pin-pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 16px 8px 8px;
}
.pin-pad button {
  background: rgba(255,248,238,0.06);
  border: 1px solid rgba(232,197,71,0.4);
  border-radius: 12px;
  padding: 16px 0;
  font-size: 24px;
  font-weight: 600;
  color: var(--cream);
}
.pin-pad button:active { background: rgba(232,197,71,0.18); }
.pin-dots {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 8px 0 4px;
}
.pin-dots span {
  width: 12px; height: 12px; border-radius: 50%;
  border: 2px solid var(--gold);
  background: transparent;
}
.pin-dots span.on { background: var(--gold); }

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 4px 0 14px;
}
.stat {
  background: rgba(255,248,238,0.05);
  border: 1px solid rgba(232,197,71,0.3);
  border-radius: 10px;
  padding: 10px 8px;
  text-align: center;
}
.stat b { display: block; font-size: 22px; color: var(--gold-bright); font-weight: 700; }
.stat span { display: block; font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin-top: 2px; }

.customer-preview {
  background: rgba(255,248,238,0.04);
  border: 1px solid rgba(232,197,71,0.35);
  border-radius: 12px;
  padding: 12px;
  margin: 10px 0;
}
.customer-preview h3 {
  font-family: var(--font-script);
  font-size: 28px;
  margin: 0;
  font-weight: 400;
}
.mini-stamps { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 6px; }
.mini-stamps i {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid var(--gold);
  background: transparent;
  display: inline-block;
}
.mini-stamps i.on { background: var(--gold-bar); }
.mini-stamps i.free { background: linear-gradient(180deg,#ffe9a0,#c9a227); }

#reader {
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  background: #000;
  min-height: 180px;
}
.search-list { list-style: none; margin: 8px 0 0; padding: 0; max-height: 40vh; overflow: auto; }
.search-list li {
  border-bottom: 1px solid rgba(232,197,71,0.18);
  padding: 10px 4px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.search-list li:active { background: rgba(232,197,71,0.08); }
.search-list .who { font-weight: 600; letter-spacing: 0.04em; }
.search-list .meta { color: var(--muted); font-size: 12px; font-weight: 400; letter-spacing: 0; text-transform: none; }
.search-list .pips { color: var(--gold-bar); font-size: 12px; white-space: nowrap; }

/* Decorative cup on wider phones / staff? keep subtle on customer card */
.cup-deco {
  display: none;
}

@media (min-width: 400px) {
  .card-frame { padding-top: 20px; }
}

/* Desktop / tablet preview of the card */
@media (min-width: 720px) {
  .page { width: min(520px, 100%); padding-top: 24px; }
  body.staff .page { width: min(640px, 100%); }
}

