/* ── Variables (mirrors admin.html theme) ── */
    :root {
      --gold:          #c8a96e;
      --gold-light:    #e2c98a;
      --gold-dim:      rgba(200,169,110,0.18);
      --bg:            #0f0e0c;
      --surface:       rgba(20,17,12,0.82);
      --surface-rim:   rgba(200,169,110,0.22);
      --text:          #f0e8d8;
      --text-dim:      rgba(240,232,216,0.55);
      --text-muted:    rgba(240,232,216,0.28);
      --radius:        18px;
      --radius-sm:     10px;
    }

    *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

    html, body {
      height: 100%;
      font-family: 'DM Sans', sans-serif;
      background: var(--bg);
      color: var(--text);
      overflow: hidden;
    }

    /* ── Background ── */
    .bg {
      position: fixed;
      inset: 0;
      background-image: url('https://images.unsplash.com/photo-1569050467447-ce54b3bbc37d?w=1400&q=80');
      background-size: cover;
      background-position: center 40%;
      filter: brightness(0.38) saturate(0.7);
      transform: scale(1.04);
      animation: bgDrift 18s ease-in-out infinite alternate;
    }

    @keyframes bgDrift {
      from { transform: scale(1.04) translate(0, 0); }
      to   { transform: scale(1.07) translate(-1%, 1%); }
    }

    /* vignette */
    .bg::after {
      content: '';
      position: absolute;
      inset: 0;
      background: radial-gradient(ellipse at center, transparent 30%, rgba(0,0,0,0.72) 100%);
    }

    /* grain overlay */
    .grain {
      position: fixed;
      inset: 0;
      pointer-events: none;
      opacity: 0.032;
      background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
      background-size: 180px;
    }

    /* ── Layout ── */
    .stage {
      position: relative;
      z-index: 1;
      height: 100vh;
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 24px;
    }

    /* ── Card ── */
    .card {
      width: 100%;
      max-width: 400px;
      background: var(--surface);
      border: 1px solid var(--surface-rim);
      border-radius: var(--radius);
      padding: 44px 36px 40px;
      backdrop-filter: blur(28px) saturate(1.4);
      -webkit-backdrop-filter: blur(28px) saturate(1.4);
      box-shadow:
        0 32px 80px rgba(0,0,0,0.7),
        0 0 0 1px rgba(200,169,110,0.08) inset,
        0 1px 0 rgba(200,169,110,0.3) inset;
      animation: cardIn 0.7s cubic-bezier(0.22,1,0.36,1) both;
    }

    @keyframes cardIn {
      from { opacity: 0; transform: translateY(28px) scale(0.97); }
      to   { opacity: 1; transform: translateY(0)    scale(1); }
    }

    /* ── Gold top line ── */
    .card::before {
      content: '';
      display: block;
      width: 48px;
      height: 2px;
      background: var(--gold);
      margin: 0 auto 28px;
      border-radius: 2px;
      opacity: 0.8;
    }

    /* ── Store name ── */
    .store-name {
      font-family: 'Noto Serif Thai', 'Playfair Display', serif;
      font-weight: 700;
      font-size: 1.65rem;
      text-align: center;
      color: var(--text);
      letter-spacing: 0.02em;
      line-height: 1.25;
      margin-bottom: 6px;
      animation: fadeUp 0.6s 0.15s both;
    }

    .store-sub {
      text-align: center;
      font-size: 0.72rem;
      color: var(--gold);
      letter-spacing: 0.18em;
      text-transform: uppercase;
      font-weight: 500;
      margin-bottom: 36px;
      animation: fadeUp 0.6s 0.22s both;
    }

    @keyframes fadeUp {
      from { opacity: 0; transform: translateY(12px); }
      to   { opacity: 1; transform: translateY(0); }
    }

    /* ── Divider label ── */
    .section-label {
      font-size: 0.68rem;
      letter-spacing: 0.16em;
      text-transform: uppercase;
      color: var(--text-dim);
      text-align: center;
      margin-bottom: 12px;
      font-weight: 500;
      animation: fadeUp 0.6s 0.3s both;
    }

    /* ── Dev input ── */
    .dev-input-wrap {
      margin-bottom: 12px;
      animation: fadeUp 0.6s 0.32s both;
    }

    .dev-input {
      width: 100%;
      padding: 11px 14px;
      background: rgba(255,255,255,0.05);
      border: 1px solid rgba(200,169,110,0.2);
      border-radius: var(--radius-sm);
      color: var(--text-dim);
      font-family: 'DM Sans', sans-serif;
      font-size: 0.8rem;
      text-align: center;
      outline: none;
      transition: border-color 0.2s, background 0.2s;
    }

    .dev-input::placeholder { color: var(--text-muted); }

    .dev-input:focus {
      border-color: var(--gold);
      background: rgba(200,169,110,0.06);
    }

    .dev-badge {
      display: block;
      text-align: center;
      font-size: 0.62rem;
      color: var(--text-muted);
      margin-top: 5px;
      letter-spacing: 0.05em;
    }

    /* ── Or separator ── */
    .or-sep {
      display: flex;
      align-items: center;
      gap: 10px;
      margin: 22px 0 16px;
      animation: fadeUp 0.6s 0.42s both;
    }

    .or-sep::before,
    .or-sep::after {
      content: '';
      flex: 1;
      height: 1px;
      background: rgba(200,169,110,0.18);
    }

    .or-sep span {
      font-size: 0.7rem;
      color: var(--text-muted);
      letter-spacing: 0.1em;
      white-space: nowrap;
    }

    /* ── Buttons ── */
    .btn {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 10px;
      width: 100%;
      padding: 14px 20px;
      border: none;
      border-radius: var(--radius-sm);
      font-family: 'DM Sans', sans-serif;
      font-weight: 700;
      font-size: 0.92rem;
      cursor: pointer;
      letter-spacing: 0.03em;
      transition: transform 0.15s, opacity 0.15s, box-shadow 0.15s;
      position: relative;
      overflow: hidden;
    }

    .btn::after {
      content: '';
      position: absolute;
      inset: 0;
      background: rgba(255,255,255,0);
      transition: background 0.15s;
    }

    .btn:hover::after  { background: rgba(255,255,255,0.07); }
    .btn:active        { transform: scale(0.97); opacity: 0.88; }

    /* Gold — primary (Scan QR) */
    .btn-gold {
      background: linear-gradient(135deg, #c8a96e 0%, #a8843e 100%);
      color: #0f0e0c;
      box-shadow: 0 4px 20px rgba(200,169,110,0.35);
      animation: fadeUp 0.6s 0.36s both;
    }

    .btn-gold:hover {
      box-shadow: 0 6px 28px rgba(200,169,110,0.5);
    }

    /* Line green */
    .btn-line {
      background: linear-gradient(135deg, #06C755 0%, #04a843 100%);
      color: #fff;
      box-shadow: 0 4px 20px rgba(6,199,85,0.28);
      animation: fadeUp 0.6s 0.48s both;
    }

    .btn-line:hover {
      box-shadow: 0 6px 28px rgba(6,199,85,0.42);
    }

    /* ── Icon inside button ── */
    .btn-icon {
      width: 22px;
      height: 22px;
      flex-shrink: 0;
      display: flex;
      align-items: center;
      justify-content: center;
    }

    /* ── Footer note ── */
    .footer-note {
      margin-top: 28px;
      text-align: center;
      font-size: 0.65rem;
      color: var(--text-muted);
      letter-spacing: 0.06em;
      animation: fadeUp 0.6s 0.55s both;
    }

    /* ── Mobile tweaks ── */
    @media (max-width: 420px) {
      .card        { padding: 36px 24px 32px; }
      .store-name  { font-size: 1.4rem; }
    }

    /* ── QR Scanner Modal ────────────────────────────── */
.qr-modal {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; align-items: center; justify-content: center;
}
.qr-modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.75);
  backdrop-filter: blur(6px);
}
.qr-modal-box {
  position: relative; z-index: 1;
  background: #1a1410;
  border: 1px solid rgba(201,168,76,.35);
  border-radius: 18px;
  padding: 1.5rem;
  width: min(92vw, 380px);
  box-shadow: 0 0 60px rgba(0,0,0,.8), 0 0 0 1px rgba(201,168,76,.1);
  animation: qrSlideUp .3s cubic-bezier(.4,0,.2,1);
}
@keyframes qrSlideUp {
  from { opacity:0; transform: translateY(24px) scale(.97); }
  to   { opacity:1; transform: translateY(0)    scale(1); }
}
.qr-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1rem;
}
.qr-modal-title {
  font-family: 'Noto Serif Thai', serif;
  color: #c9a84c; font-size: 1rem; font-weight: 700;
  letter-spacing: .04em;
}
.qr-close-btn {
  background: none; border: none; cursor: pointer;
  color: #888; font-size: 1.1rem; line-height:1;
  padding: 4px 8px; border-radius: 6px;
  transition: color .2s, background .2s;
}
.qr-close-btn:hover { color: #fff; background: rgba(255,255,255,.08); }

/* Video */
.qr-video-wrap {
  position: relative; border-radius: 12px; overflow: hidden;
  background: #000; aspect-ratio: 1;
}
#qrVideo {
  width: 100%; height: 100%; object-fit: cover; display: block;
}

/* Corner frame */
.qr-frame {
  position: absolute; inset: 0; pointer-events: none;
}
.qr-corner {
  position: absolute; width: 28px; height: 28px;
  border-color: #c9a84c; border-style: solid; border-width: 0;
}
.qr-corner.tl { top:16px;  left:16px;  border-top-width:3px; border-left-width:3px;  border-top-left-radius:4px; }
.qr-corner.tr { top:16px;  right:16px; border-top-width:3px; border-right-width:3px; border-top-right-radius:4px; }
.qr-corner.bl { bottom:16px; left:16px;  border-bottom-width:3px; border-left-width:3px;  border-bottom-left-radius:4px; }
.qr-corner.br { bottom:16px; right:16px; border-bottom-width:3px; border-right-width:3px; border-bottom-right-radius:4px; }

/* Scan line */
.qr-scan-line {
  position: absolute; left: 16px; right: 16px; height: 2px;
  background: linear-gradient(90deg, transparent, #c9a84c, transparent);
  top: 16px;
  animation: scanMove 2s ease-in-out infinite;
  border-radius: 2px;
  box-shadow: 0 0 8px rgba(201,168,76,.6);
}
@keyframes scanMove {
  0%   { top: 16px; }
  50%  { top: calc(100% - 18px); }
  100% { top: 16px; }
}

/* Hint text */
.qr-hint {
  margin: 1rem 0 0;
  text-align: center; font-size: .82rem;
  color: #888; letter-spacing: .03em;
  font-family: 'DM Sans', sans-serif;
  min-height: 1.2em;
  transition: color .3s;
}
.qr-hint.success { color: #6fcf97; }
.qr-hint.error   { color: #eb5757; }