/* ── Reset & base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-body: 'Plus Jakarta Sans', system-ui, sans-serif;
  --bg: #09090b;
  --bg2: #111113;
  --bg3: #18181b;
  --surface: rgba(24, 24, 27, 0.65);
  --border: rgba(255, 255, 255, 0.06);
  --border2: rgba(255, 255, 255, 0.1);
  --text: #f4f4f5;
  --text2: #a1a1aa;
  --text3: #71717a;
  --accent: #d4a84b;
  --accent2: #e8c678;
  --accent-dim: rgba(212, 168, 75, 0.12);
  --radius: 14px;
  --radius-sm: 9px;
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --shadow-lg: 0 24px 64px rgba(0, 0, 0, 0.45), 0 6px 20px rgba(0, 0, 0, 0.28);
  --ring: 0 0 0 2px var(--bg), 0 0 0 4px rgba(212, 168, 75, 0.35);
}

html { font-size: 15px; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 10001;
  padding: 12px 20px;
  background: var(--accent);
  color: #140f08;
  font-weight: 600;
  border-radius: 0 0 8px 0;
}

.skip-link:focus {
  left: 0;
}

body {
  font-family: var(--font-body);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.55;
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 100% 80% at 50% -30%, rgba(212, 168, 75, 0.09), transparent 55%),
    radial-gradient(ellipse 60% 50% at 100% 0%, rgba(99, 102, 241, 0.05), transparent 45%),
    radial-gradient(ellipse 50% 40% at 0% 100%, rgba(212, 168, 75, 0.04), transparent 50%);
}

/* ── Header ── */
.header {
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(17, 17, 19, 0.95) 0%, rgba(10, 10, 11, 0.6) 100%);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: relative;
}

.header::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(212, 168, 75, 0.25), transparent);
  opacity: 0.9;
}

.header-inner {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  min-height: 72px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-mark {
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--accent-dim);
  border: 1px solid rgba(212, 168, 75, 0.2);
}

.logo-stack {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.logo-text {
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--text);
  line-height: 1.15;
}

.logo-badge {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text3);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.header-pill {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent2);
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--accent-dim);
  border: 1px solid rgba(212, 168, 75, 0.22);
}

.header-sub {
  font-size: 13px;
  color: var(--text2);
  font-weight: 450;
}

/* ── Layout ── */
.main {
  max-width: 1320px;
  margin: 0 auto;
  padding: 32px 36px 48px;
  display: grid;
  grid-template-columns: minmax(300px, 360px) 1fr;
  gap: 32px;
  align-items: start;
}

/* ── Controls panel ── */
.controls {
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: sticky;
  top: 22px;
}

.ctrl-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 22px 20px;
  margin-bottom: 12px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset;
}

.ctrl-title {
  font-family: var(--font-display);
  font-size: 1.08rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.01em;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 10px 14px;
}

.ctrl-num {
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--accent2);
  opacity: 0.95;
}

/* ── Form fields ── */
.field {
  margin-bottom: 14px;
}

.field:last-child { margin-bottom: 0; }

.ctrl-hint {
  font-size: 11px;
  line-height: 1.5;
  color: var(--text3);
  margin: -2px 0 14px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border);
}

.ctrl-hint strong { color: var(--text2); font-weight: 600; }

.field label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text2);
  margin-bottom: 6px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.field input[type="text"],
.field input[type="number"],
.field input[type="date"],
.field textarea {
  width: 100%;
  background: rgba(10, 10, 11, 0.6);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  padding: 10px 13px;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  resize: vertical;
}

.field input:hover,
.field textarea:hover {
  border-color: rgba(255, 255, 255, 0.12);
}

.field input:focus,
.field textarea:focus {
  border-color: rgba(212, 168, 75, 0.55);
  box-shadow: var(--ring);
}

.field input[type="color"] {
  width: 100%;
  height: 42px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  cursor: pointer;
}

.field input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(0.72);
  cursor: pointer;
  opacity: 0.85;
}

.row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* ── Upload zone ── */
.upload-zone {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(10, 10, 11, 0.5);
  border: 1px dashed var(--border2);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition), color var(--transition);
  position: relative;
  overflow: hidden;
  color: var(--text2);
  font-size: 13px;
}

.upload-zone:hover {
  border-color: rgba(212, 168, 75, 0.45);
  background: rgba(212, 168, 75, 0.05);
  color: var(--text);
}

.upload-zone svg { flex-shrink: 0; opacity: 0.85; }

.upload-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

/* ── Toggle group ── */
.toggle-group {
  display: flex;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px;
  gap: 4px;
}

.toggle-btn {
  flex: 1;
  padding: 8px 10px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--text2);
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), box-shadow var(--transition);
  white-space: nowrap;
}

.toggle-btn:hover { color: var(--text); }

.toggle-btn.active {
  background: linear-gradient(145deg, var(--accent) 0%, #c4953d 100%);
  color: #140f08;
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

.toggle-btn:focus-visible,
.theme-swatch:focus-visible,
.btn-primary:focus-visible,
.btn-secondary:focus-visible {
  outline: 2px solid rgba(212, 168, 75, 0.65);
  outline-offset: 2px;
}

/* ── Theme swatches ── */
.theme-grid {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.theme-swatch {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
  outline: none;
  font-size: 0;
}

.theme-swatch:hover {
  transform: scale(1.08);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

.theme-swatch.active {
  border-color: var(--text);
  box-shadow: 0 0 0 2px var(--bg2), 0 0 0 4px rgba(255, 255, 255, 0.15);
  transform: scale(1.06);
}

.theme-swatch[data-theme="gold"]   { background: linear-gradient(135deg, #1a1208 48%, #d4a84b 52%); }
.theme-swatch[data-theme="night"]  { background: linear-gradient(135deg, #0d1117 48%, #58a6ff 52%); }
.theme-swatch[data-theme="forest"] { background: linear-gradient(135deg, #1a2e1a 48%, #6dbf67 52%); }
.theme-swatch[data-theme="rose"]   { background: linear-gradient(135deg, #1f0a12 48%, #e879a0 52%); }
.theme-swatch[data-theme="slate"]  { background: linear-gradient(135deg, #f8f7f4 48%, #3d3d3a 52%); }
.theme-swatch[data-theme="ocean"]  { background: linear-gradient(135deg, #0a1628 48%, #38bdf8 52%); }
.theme-swatch.theme-custom {
  background: var(--bg3);
  border: 1px dashed var(--border2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text2);
  font-size: 17px;
  font-family: var(--font-body);
}

/* ── Preview area ── */
.preview-area {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.preview-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.preview-heading { min-width: 200px; }

.preview-title {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.02em;
  margin-bottom: 6px;
}

.preview-lede {
  font-size: 13px;
  color: var(--text3);
  max-width: 420px;
  line-height: 1.5;
}

.preview-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* ── Buttons ── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(145deg, var(--accent2) 0%, var(--accent) 55%, #b8892e 100%);
  color: #140f08;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  padding: 10px 20px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow var(--transition), filter var(--transition);
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(212, 168, 75, 0.25);
}

.btn-primary:hover {
  filter: brightness(1.06);
  box-shadow: 0 4px 16px rgba(212, 168, 75, 0.3);
}

.btn-primary:active { transform: scale(0.98); }

.btn-icon { flex-shrink: 0; opacity: 0.9; }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text2);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  padding: 10px 18px;
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition), background var(--transition);
  white-space: nowrap;
}

.btn-secondary:hover {
  border-color: rgba(212, 168, 75, 0.35);
  color: var(--text);
  background: rgba(212, 168, 75, 0.06);
}

.full-width { width: 100%; }

/* ── Card stage ── */
.card-stage {
  position: relative;
  background: linear-gradient(165deg, rgba(24, 24, 27, 0.9) 0%, rgba(17, 17, 19, 0.95) 100%);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 4px);
  padding: 40px 36px 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 260px;
  overflow: hidden;
}

.card-stage-glow {
  pointer-events: none;
  position: absolute;
  inset: -40%;
  background: radial-gradient(ellipse 50% 35% at 50% 30%, rgba(212, 168, 75, 0.14), transparent 65%);
  opacity: 0.9;
}

#cardCanvas {
  position: relative;
  z-index: 1;
  border-radius: 18px;
  width: 720px;
  max-width: 100%;
  height: auto;
  display: block;
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(255, 255, 255, 0.04);
}

/* ── Stamps section ── */
.stamps-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset;
}

.stamps-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.stamps-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text2);
  letter-spacing: 0.04em;
}

.stamps-count {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--accent2);
}

.stamps-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 11px;
}

.stamp-cell {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1.5px dashed var(--border2);
  background: rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
  font-size: 20px;
  color: var(--text3);
  user-select: none;
}

.stamp-cell:hover {
  border-color: rgba(212, 168, 75, 0.5);
  color: var(--accent);
  transform: scale(1.06);
}

.stamp-cell.filled {
  background: linear-gradient(145deg, var(--accent2), var(--accent));
  border-color: transparent;
  border-style: solid;
  color: #140f08;
  transform: scale(1.03);
  box-shadow: 0 4px 12px rgba(212, 168, 75, 0.25);
}

.stamp-cell.filled:hover { transform: scale(1.08); }

.stamp-cell.pop {
  animation: stampPop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes stampPop {
  0%   { transform: scale(0.45) rotate(-12deg); opacity: 0.35; }
  70%  { transform: scale(1.18) rotate(5deg); }
  100% { transform: scale(1.03); opacity: 1; }
}

.reward-alert {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  padding: 12px 16px;
  background: rgba(212, 168, 75, 0.1);
  border: 1px solid rgba(212, 168, 75, 0.28);
  border-radius: var(--radius-sm);
  color: var(--accent2);
  font-size: 14px;
  font-weight: 500;
  animation: fadeSlide 0.45s ease forwards;
}

@keyframes fadeSlide {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Push section ── */
.push-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset;
}

.push-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text2);
  letter-spacing: 0.03em;
  margin-bottom: 18px;
}

.push-title svg { opacity: 0.85; }

.push-composer {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.push-preview {
  margin-top: 18px;
  display: flex;
  justify-content: center;
}

.push-phone {
  background: linear-gradient(180deg, #2c2c2e 0%, #1c1c1e 100%);
  border-radius: 36px;
  padding: 14px;
  width: 320px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: var(--shadow-lg);
}

.push-status-bar {
  display: flex;
  justify-content: space-between;
  padding: 4px 18px 10px;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  letter-spacing: 0.02em;
}

.push-notif {
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-radius: 18px;
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  animation: notifSlide 0.45s cubic-bezier(0.34, 1.2, 0.64, 1);
}

@keyframes notifSlide {
  from { opacity: 0; transform: translateY(-14px) scale(0.94); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.push-notif-app {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.push-app-icon {
  width: 24px;
  height: 24px;
  background: linear-gradient(145deg, var(--accent2), var(--accent));
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: #140f08;
  flex-shrink: 0;
  font-weight: 700;
}

.push-app-name {
  font-size: 12px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.72);
  flex: 1;
}

.push-notif-time {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.38);
}

.push-notif-title {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 4px;
  letter-spacing: 0.01em;
}

.push-notif-body {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.68);
  line-height: 1.45;
}

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(88px);
  background: var(--text);
  color: var(--bg);
  font-size: 13px;
  font-weight: 600;
  padding: 12px 22px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.35s cubic-bezier(0.34, 1.2, 0.64, 1), opacity 0.35s ease;
  z-index: 1000;
  white-space: nowrap;
  box-shadow: var(--shadow-lg);
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Responsive ── */
@media (max-width: 960px) {
  .main {
    grid-template-columns: 1fr;
    padding: 24px 20px 40px;
    gap: 28px;
  }
  .controls { position: static; }
  .card-stage { padding: 28px 20px 32px; }
}

@media (max-width: 640px) {
  .header-inner {
    flex-direction: column;
    align-items: flex-start;
    padding: 16px 20px;
    min-height: auto;
    gap: 12px;
  }
  .header-right {
    width: 100%;
    justify-content: flex-start;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .header-sub { padding-left: 0; border: none; }
  .preview-header {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
  }
  .preview-actions { width: 100%; }
  .preview-actions button { flex: 1; min-width: 0; }
  .stamp-cell { width: 42px; height: 42px; font-size: 17px; }
}

/* ── Loyalty Pro link section ── */
.loyalty-link-section {
  margin-top: 8px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.03);
}

.loyalty-link-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 6px;
}

.loyalty-link-row {
  display: flex;
  gap: 12px;
  align-items: center;
}

.loyalty-link-row input {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border2);
  background: rgba(0, 0, 0, 0.18);
  color: var(--text);
  font-size: 13px;
}

.loyalty-link-actions {
  display: flex;
  gap: 10px;
}

@media (max-width: 640px) {
  .loyalty-link-row {
    flex-direction: column;
    align-items: stretch;
  }
  .loyalty-link-actions {
    justify-content: stretch;
  }
  .loyalty-link-actions button {
    flex: 1;
  }
}

/* ── Footer ── */
.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 8px;
  padding: 20px 36px 32px;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.25));
}

.site-footer-inner {
  max-width: 1320px;
  margin: 0 auto;
}

.site-footer p {
  font-size: 12px;
  color: var(--text3);
  line-height: 1.55;
  max-width: 52rem;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
