:root {
  --violet: #6c4cf1;
  --bg: #0f0f17;
  --card: #1a1a26;
  --card-2: #22222f;
  --border: #2c2c3c;
  --text: #ececf3;
  --muted: #8a8a9c;
  --ok: #46d39a;
  --danger: #ff5c72;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: radial-gradient(1200px 600px at 50% -10%, #241d4a, var(--bg));
  color: var(--text);
  display: grid;
  place-items: start center;
  padding: 40px 16px;
}
.wrap { width: 100%; max-width: 440px; }

.hero { text-align: center; margin-bottom: 26px; }
.logo {
  width: 64px; height: 64px; margin: 0 auto 14px;
  display: grid; place-items: center; font-size: 34px;
  background: linear-gradient(135deg, var(--violet), #9d7bff);
  border-radius: 18px;
}
h1 { margin: 0; font-size: 30px; }
.tagline { color: var(--muted); margin: 6px 0 0; }

.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 24px;
}
h2 { font-size: 16px; margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.center { text-align: center; }

/* Bouton Google */
.btn-google {
  width: 100%;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 13px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  color: #1c1c28;
  font-size: 15px; font-weight: 600;
  cursor: pointer;
}
.btn-google:hover { background: #f2f2f7; }

/* Compte */
.account-row {
  display: flex; align-items: center; gap: 12px;
  padding-bottom: 18px; margin-bottom: 18px;
  border-bottom: 1px solid var(--border);
}
.avatar { width: 44px; height: 44px; border-radius: 50%; background: var(--card-2); }
.name { font-weight: 600; }
.link {
  margin-left: auto; background: none; border: none;
  color: var(--muted); cursor: pointer; text-decoration: underline; font-size: 13px;
}
.link:hover { color: var(--danger); }

/* Solde */
.balance {
  display: flex; align-items: baseline; gap: 8px; justify-content: center;
  padding: 18px; margin-bottom: 22px;
  background: var(--card-2); border-radius: 14px;
}
.balance-num { font-size: 40px; font-weight: 800; color: var(--violet); }
/* Pendant le chargement : le chiffre pulse doucement au lieu d'afficher un
   placeholder qu'on pourrait lire comme un vrai solde. */
.balance-num.is-loading { color: var(--muted); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) {
  .balance-num.is-loading { animation: none; }
}
.balance-label { color: var(--muted); }

/* Packs */
.packs { display: grid; gap: 10px; }
.pack {
  display: flex; flex-direction: column; gap: 3px;
  text-align: left; padding: 14px 16px;
  border: 1px solid var(--border); border-radius: 12px;
  background: var(--card-2); color: var(--text); cursor: pointer;
}
/* Carte fantôme pendant le chargement des packs (même pulsation que le solde). */
.pack-skeleton {
  height: 68px;
  background: var(--card-2);
  border-color: var(--border);
  cursor: default;
  animation: pulse 1.2s ease-in-out infinite;
}
@media (prefers-reduced-motion: reduce) {
  .pack-skeleton { animation: none; }
}

.pack:hover:not(.pack-skeleton) { border-color: var(--violet); }
.pack:disabled { opacity: .5; cursor: default; }
.pack-name { font-weight: 700; }
.pack-price { color: var(--violet); font-weight: 700; }
.pack-sub { color: var(--muted); font-size: 12px; }

/* Messages : le ton porte le sens (plus de rouge par défaut). */
.status {
  font-size: 13px;
  min-height: 16px;
  margin-top: 10px;
  color: var(--muted);
  transition: color .15s ease;
}
.status-info { color: var(--muted); }
.status-success { color: var(--ok); }
.status-error { color: var(--danger); }

/* Message porteur de sens : pastille discrète plutôt que texte nu. */
.status-success,
.status-error {
  display: block;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid transparent;
}
.status-success {
  background: color-mix(in srgb, var(--ok) 12%, transparent);
  border-color: color-mix(in srgb, var(--ok) 30%, transparent);
}
.status-error {
  background: color-mix(in srgb, var(--danger) 12%, transparent);
  border-color: color-mix(in srgb, var(--danger) 30%, transparent);
}

/* ---- Paiement embarqué ---- */
.pay-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
#checkout {
  border-radius: 12px;
  overflow: hidden;
  min-height: 320px;
}
/* Spinner affiché tant que l'iframe Stripe n'a pas pris la place du conteneur.
   Il vit en ::before, donc l'iframe montée par Stripe le recouvre d'elle-même. */
#checkout.is-loading::before {
  content: "";
  display: block;
  width: 26px; height: 26px;
  margin: 140px auto 0;
  border: 2px solid var(--border);
  border-top-color: var(--violet);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  #checkout.is-loading::before { animation: none; }
}
/* Bandeau de confirmation, en tête du panneau connecté. */
.done {
  margin: 0 0 18px;
  padding: 12px 14px;
  font-size: 14px;
  line-height: 1.4;
  font-weight: 600;
  color: var(--ok);
  background: color-mix(in srgb, var(--ok) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--ok) 30%, transparent);
  border-radius: 10px;
}

/* ---- Pied de page (support / confidentialité) ---- */
.site-footer {
  margin-top: 26px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: center;
  gap: 10px;
}
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--text); text-decoration: underline; }
