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

:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --text: #111;
  --muted: #888;
  --border: #e5e5e5;
  --radius: 8px;
  --card-bg: linear-gradient(135deg, #1a1a1a 0%, #333 100%);
}

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Hero ─────────────────────────────────────────────────────────────────── */
.hero {
  background: #fff;
  padding: 48px 24px 56px;
  text-align: center;
  border-bottom: 1px solid var(--border);
}
.hero::before { display: none; }
.hero-inner { position: relative; z-index: 1; max-width: 480px; margin: 0 auto; }
.brand-icon { display: flex; justify-content: center; margin-bottom: 14px; }
.brand-icon svg { width: 48px; height: 48px; }
.brand-icon svg rect { fill: #111; fill-opacity: 1; }
.brand-icon svg path { stroke: #fff; }
.brand-icon svg circle { fill: #888; }
.hero h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); font-weight: 700; color: var(--text); letter-spacing: -0.5px; }
.hero p { margin-top: 10px; color: var(--muted); font-size: 0.95rem; line-height: 1.6; }
.hero-legal { font-size: 0.72rem !important; color: #bbb !important; margin-top: 8px !important; }

/* ── Main ─────────────────────────────────────────────────────────────────── */
main {
  flex: 1;
  max-width: 560px;
  width: 100%;
  margin: -24px auto 48px;
  padding: 0 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ── Form Section ─────────────────────────────────────────────────────────── */
.form-section {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 28px;
  border: 1px solid var(--border);
}
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 18px; }
.field:last-of-type { margin-bottom: 0; }
label { font-size: 0.78rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
input {
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.95rem;
  color: var(--text);
  background: #fff;
  transition: border-color 0.2s;
  outline: none;
}
input:focus { border-color: #333; }
input.invalid { border-color: #ef4444; }
.field-error { font-size: 0.78rem; color: #ef4444; min-height: 1em; }

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border: none;
  border-radius: 6px;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
  text-decoration: none;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  width: 100%;
  margin-top: 20px;
  background: #111;
  color: #fff;
}
.btn-primary:hover:not(:disabled) { opacity: 0.85; }

.btn-apple {
  flex: 1;
  background: #111;
  color: #fff;
}
.btn-apple:hover { opacity: 0.85; }

.btn-google {
  flex: 1;
  background: #fff;
  color: #111;
  border: 1px solid var(--border);
}
.btn-google:hover { background: #f5f5f5; }

.btn-loader .spinner {
  width: 18px; height: 18px;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Wallet message ───────────────────────────────────────────────────────── */
.wallet-message {
  margin-top: 14px;
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 0.85rem;
  line-height: 1.5;
}
.wallet-message.info { background: #f0f0f0; color: #333; border: 1px solid #ddd; }
.wallet-message.error { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.wallet-message.success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }

/* ── Card Section ─────────────────────────────────────────────────────────── */
.card-section {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 28px;
  border: 1px solid var(--border);
  text-align: center;
}
.card-section h2 { font-size: 1.2rem; font-weight: 700; margin-bottom: 20px; }

/* ── 3D Card ──────────────────────────────────────────────────────────────── */
.card-3d-wrapper {
  perspective: 1200px;
  display: flex;
  justify-content: center;
  margin-bottom: 8px;
}

.card {
  position: relative;
  width: 340px;
  height: 215px;
  transform-style: preserve-3d;
  transition: transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  border-radius: 14px;
}
.card.flipped { transform: rotateY(180deg); }

.card-face {
  position: absolute;
  inset: 0;
  border-radius: 14px;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

/* ── Front face ── */
.card-front { background: var(--card-bg); color: #fff; padding: 20px 24px 20px; }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.card-brand { font-size: 1.1rem; font-weight: 800; letter-spacing: 0.15em; }
.card-type { font-size: 0.65rem; font-weight: 600; letter-spacing: 0.1em; opacity: 0.7; text-transform: uppercase; }
.card-chip svg { width: 46px; height: 34px; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3)); }
.card-details { margin-top: 14px; }
.card-holder-label { font-size: 0.62rem; font-weight: 600; letter-spacing: 0.1em; opacity: 0.6; text-transform: uppercase; margin-bottom: 2px; }
.card-holder-name { font-size: 1rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; }
.card-bottom-row { display: flex; justify-content: space-between; align-items: flex-end; margin-top: 10px; }
.card-small-value { font-size: 0.85rem; font-weight: 600; letter-spacing: 0.06em; }
.card-number-display { font-size: 0.75rem; letter-spacing: 0.12em; font-family: 'Courier New', monospace; }
.card-shine {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, transparent 50%, rgba(255,255,255,0.03) 100%);
  pointer-events: none;
}

/* ── Back face ── */
.card-back { background: #222; transform: rotateY(180deg); }
.card-stripe { height: 42px; background: #111; margin-top: 24px; }
.card-back-content { padding: 12px 20px 16px; color: #fff; }
.barcode-wrapper {
  background: #fff;
  border-radius: 4px;
  padding: 8px 12px 4px;
  margin-bottom: 8px;
  display: flex;
  justify-content: center;
}
.barcode-wrapper svg { max-width: 100%; height: auto; width: 100px; }
.card-back-info { text-align: center; margin-bottom: 8px; }
.card-back-info .card-holder-label { color: rgba(255,255,255,0.5); font-size: 0.6rem; }
.barcode-number { font-size: 0.75rem; font-family: 'Courier New', monospace; font-weight: 600; color: #ccc; letter-spacing: 0.1em; }
.card-back-terms { font-size: 0.62rem; color: rgba(255,255,255,0.35); line-height: 1.4; text-align: center; }

/* ── Flip hint ── */
.flip-hint { font-size: 0.75rem; color: var(--muted); margin-bottom: 20px; }

/* ── Wallet buttons ── */
.wallet-buttons { display: flex; gap: 10px; flex-wrap: wrap; }
.wallet-buttons .btn { min-width: 140px; }

/* ── Footer ───────────────────────────────────────────────────────────────── */
footer { text-align: center; padding: 24px 16px; color: #bbb; font-size: 0.78rem; }

/* ── Animations ───────────────────────────────────────────────────────────── */
@keyframes slideUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
.card-section:not([hidden]) { animation: slideUp 0.3s ease; }

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .form-section, .card-section { padding: 20px 16px; }
  .card { width: 290px; height: 183px; }
  .card-brand { font-size: 0.9rem; }
  .card-holder-name { font-size: 0.85rem; }
  .wallet-buttons { flex-direction: column; }
  .wallet-buttons .btn { width: 100%; }
}
