/* ═══════════════════════════════════════════════════════════
   QIZHI — fond papier millimétré · billes en orbite · chapelet
   ═══════════════════════════════════════════════════════════ */

:root {
  --paper:      #fdfdfb;
  --grid-fine:  rgba(30, 90, 160, 0.07);
  --grid-bold:  rgba(30, 90, 160, 0.13);
  --ink:        #1a2332;
  --ink-soft:   #5a6578;
  --accent:     #c2410c;      /* encre orange, style stylo */
  --accent-2:   #1d4ed8;      /* bille bleue */
  --line:       #d8dce3;
  --card:       #ffffff;
  --radius:     14px;
  --font:       'Segoe UI', system-ui, -apple-system, sans-serif;
  --mono:       'Cascadia Code', 'Consolas', monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  color: var(--ink);
  background-color: var(--paper);
  /* Papier millimétré : petits carreaux 10px + carreaux gras 50px */
  background-image:
    linear-gradient(var(--grid-fine) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-fine) 1px, transparent 1px),
    linear-gradient(var(--grid-bold) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-bold) 1px, transparent 1px);
  background-size: 10px 10px, 10px 10px, 50px 50px, 50px 50px;
  background-position: -1px -1px;
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

.hidden { display: none !important; }

/* ─── Billes qui tournent en fond ─────────────────────────── */
.marbles {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.orbit {
  position: absolute;
  border: 1px dashed rgba(30, 90, 160, 0.14);
  border-radius: 50%;
  animation: spin linear infinite;
}
.marble {
  position: absolute;
  top: -7px;
  left: 50%;
  transform: translateX(-50%);
  width: 14px;
  height: 14px;
  border-radius: 50%;
  box-shadow: inset -3px -3px 5px rgba(0,0,0,0.25), inset 2px 2px 4px rgba(255,255,255,0.6), 0 1px 4px rgba(0,0,0,0.12);
}
/* cinq orbites, tailles/vitesses/couleurs différentes */
.o1 { width: 340px; height: 340px; top: 8%;  left: -120px; animation-duration: 26s; }
.o1 .marble { background: radial-gradient(circle at 32% 30%, #7fb2ff, #1d4ed8 68%); width: 18px; height: 18px; }
.o2 { width: 220px; height: 220px; top: 22%; right: -70px; animation-duration: 18s; animation-direction: reverse; }
.o2 .marble { background: radial-gradient(circle at 32% 30%, #ffb27f, #c2410c 68%); }
.o3 { width: 460px; height: 460px; bottom: -160px; left: 18%; animation-duration: 40s; }
.o3 .marble { background: radial-gradient(circle at 32% 30%, #b7f5c9, #15803d 68%); width: 12px; height: 12px; }
.o4 { width: 160px; height: 160px; top: 58%; right: 12%; animation-duration: 13s; }
.o4 .marble { background: radial-gradient(circle at 32% 30%, #f3c6ff, #a21caf 68%); width: 10px; height: 10px; }
.o5 { width: 300px; height: 300px; top: 42%; left: 8%; animation-duration: 33s; animation-direction: reverse; }
.o5 .marble { background: radial-gradient(circle at 32% 30%, #ffe9a8, #ca8a04 68%); width: 15px; height: 15px; }

@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
@media (prefers-reduced-motion: reduce) {
  .orbit { animation: none; }
}

/* ─── Header + menu chapelet ──────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem clamp(1rem, 4vw, 3rem);
  background: rgba(253, 253, 251, 0.88);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.logo {
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 9px;
}
/* Marque Qizhi noire à gauche du texte */
.logo-mark {
  display: block;
  height: 26px;
  width: auto;
  flex-shrink: 0;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.logo:hover .logo-mark { transform: rotate(-8deg) scale(1.08); }

/* Chapelet : chaque lien est un grain relié par le fil (la barre) */
.chapelet ul {
  display: flex;
  align-items: center;
  list-style: none;
  gap: 0;
}
.chapelet li { display: flex; align-items: center; }
/* le fil entre les grains */
.chapelet li + li::before {
  content: '';
  width: 26px;
  height: 1px;
  background: repeating-linear-gradient(90deg, var(--accent) 0 3px, transparent 3px 6px);
  opacity: 0.55;
}
.chapelet a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  text-decoration: none;
  color: var(--ink-soft);
  font-size: 0.92rem;
  font-weight: 600;
  padding: 0.35rem 0.55rem;
  border-radius: 999px;
  transition: color 0.18s, background 0.18s;
  white-space: nowrap;
}
/* le grain : petite bille percée */
.grain {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, #fff, var(--accent) 75%);
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
  flex-shrink: 0;
  transition: transform 0.18s;
}
.chapelet a:hover { color: var(--ink); background: rgba(194, 65, 12, 0.07); }
.chapelet a:hover .grain { transform: scale(1.35); }

/* ─── Layout sections ─────────────────────────────────────── */
main { position: relative; z-index: 1; }

.hero {
  max-width: 860px;
  margin: 0 auto;
  padding: clamp(3.5rem, 9vw, 7rem) 1.5rem 3rem;
  text-align: center;
}
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 1rem;
}
.hero h1 {
  font-size: clamp(2.3rem, 6vw, 3.8rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.12;
}
.hero h1 em { font-style: normal; color: var(--accent-2); }
.lede {
  margin: 1.4rem auto 2rem;
  max-width: 640px;
  color: var(--ink-soft);
  font-size: 1.08rem;
}
.cta-row { display: flex; gap: 0.8rem; justify-content: center; flex-wrap: wrap; }

.btn {
  display: inline-block;
  padding: 0.7rem 1.5rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.95rem;
  text-decoration: none;
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
  font-family: var(--font);
}
.btn:hover { transform: translateY(-1px); }
.btn-primary {
  background: var(--ink);
  color: var(--paper);
  box-shadow: 0 2px 10px rgba(26, 35, 50, 0.25);
}
.btn-primary:hover { background: #2c3a52; }
.btn-ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--ink);
}
.btn-ghost:hover { background: rgba(26, 35, 50, 0.05); }
.btn-sm { padding: 0.35rem 0.9rem; font-size: 0.85rem; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

.grid-section {
  max-width: 1060px;
  margin: 0 auto;
  padding: 3.2rem 1.5rem;
}
.grid-section h2 {
  font-size: clamp(1.5rem, 3.5vw, 2.1rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 1.8rem;
  text-align: center;
}

/* ─── Cartes produit ──────────────────────────────────────── */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.4rem;
  position: relative;
  box-shadow: 0 1px 3px rgba(26,35,50,0.05);
  transition: transform 0.18s, box-shadow 0.18s;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 6px 18px rgba(26,35,50,0.09); }
.card-num {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--accent);
  letter-spacing: 0.1em;
}
.card h3 { font-size: 1.12rem; margin: 0.4rem 0 0.5rem; }
.card p { color: var(--ink-soft); font-size: 0.93rem; }

/* ─── Étapes crédits ──────────────────────────────────────── */
.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  margin-bottom: 2.5rem;
}
.step {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.4rem;
}
.step-n {
  display: inline-flex;
  width: 34px; height: 34px;
  border-radius: 50%;
  align-items: center; justify-content: center;
  background: radial-gradient(circle at 34% 30%, #7fb2ff, #1d4ed8 70%);
  color: #fff; font-weight: 800;
  box-shadow: inset -2px -2px 4px rgba(0,0,0,0.2), 0 2px 5px rgba(0,0,0,0.12);
  margin-bottom: 0.8rem;
}
.step h3 { font-size: 1.05rem; margin-bottom: 0.4rem; }
.step p { color: var(--ink-soft); font-size: 0.93rem; }
.step a { color: var(--accent-2); }

/* ─── Packs ───────────────────────────────────────────────── */
.packs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  max-width: 860px;
  margin: 0 auto 1rem;
}
.pack {
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem 1.2rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.pack.featured {
  border-color: var(--accent);
  box-shadow: 0 4px 20px rgba(194, 65, 12, 0.14);
  transform: scale(1.03);
}
.pack-credits { font-size: 1.5rem; font-weight: 800; }
.pack-name { text-transform: uppercase; letter-spacing: 0.12em; font-size: 0.72rem; color: var(--accent); font-weight: 700; }
.pack-price { font-size: 1.15rem; font-weight: 700; margin-top: 0.3rem; }
.pack-note { font-size: 0.8rem; color: var(--ink-soft); }

.fine { font-size: 0.85rem; color: var(--ink-soft); }
.center { text-align: center; }

/* ─── Installation ────────────────────────────────────────── */
.downloads {
  display: flex;
  gap: 0.8rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}
.notice {
  background: #fffbeb;
  border: 1.5px solid #f0c36d;
  border-radius: var(--radius);
  padding: 1.5rem;
  max-width: 780px;
  margin: 0 auto;
}
.notice h3 { margin-bottom: 0.6rem; font-size: 1.1rem; }
.notice > p { color: #57430f; font-size: 0.95rem; margin-bottom: 1rem; }
.notice details {
  border-top: 1px dashed #e0c98a;
  padding: 0.8rem 0.2rem;
}
.notice summary { cursor: pointer; font-size: 0.97rem; padding: 0.2rem 0; }
.notice ol { margin: 0.6rem 0 0.4rem 1.4rem; font-size: 0.92rem; color: #57430f; }
.notice li { margin-bottom: 0.35rem; }
.notice code {
  font-family: var(--mono);
  background: rgba(26,35,50,0.07);
  padding: 0.1rem 0.4rem;
  border-radius: 5px;
  font-size: 0.85em;
}

/* ─── Footer ──────────────────────────────────────────────── */
.site-footer {
  position: relative;
  z-index: 1;
  border-top: 1px solid var(--line);
  padding: 2rem 1.5rem 2.5rem;
  text-align: center;
  background: rgba(253,253,251,0.75);
  backdrop-filter: blur(6px);
}
.site-footer a { color: var(--accent-2); }
.site-footer .fine { margin-top: 0.5rem; }

/* ─── Compte ──────────────────────────────────────────────── */
.auth-wrap { display: flex; justify-content: center; padding: 2rem 0; }
.auth-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 2rem;
  width: 100%;
  max-width: 430px;
  box-shadow: 0 4px 24px rgba(26,35,50,0.08);
}
.auth-card h2 { font-size: 1.5rem; margin-bottom: 0.3rem; }
.auth-card form { margin-top: 1.2rem; display: flex; flex-direction: column; gap: 0.9rem; }
.auth-card label {
  display: flex; flex-direction: column; gap: 0.3rem;
  font-size: 0.85rem; font-weight: 600; color: var(--ink-soft);
}
input[type="email"], input[type="password"], input[type="text"] {
  font-family: var(--font);
  font-size: 0.95rem;
  padding: 0.65rem 0.85rem;
  border: 1.5px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus {
  outline: none;
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(29,78,216,0.12);
}
#redeem-code { font-family: var(--mono); letter-spacing: 0.08em; text-transform: uppercase; }

.form-error { color: #b91c1c; font-size: 0.86rem; min-height: 1.2em; }
.form-ok { color: #15803d; font-size: 0.86rem; min-height: 1.2em; }
.switch { margin-top: 1rem; }
.switch a { color: var(--accent-2); font-weight: 600; text-decoration: none; }

.account-head {
  display: flex; justify-content: space-between; align-items: center;
  gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem;
}
.account-head h2 { font-size: 1.6rem; }

.balance-panel {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
@media (max-width: 760px) { .balance-panel { grid-template-columns: 1fr; } }

.balance {
  background: var(--ink);
  color: var(--paper);
  border-radius: var(--radius);
  padding: 1.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  box-shadow: 0 4px 18px rgba(26,35,50,0.25);
}
.balance-label { text-transform: uppercase; letter-spacing: 0.12em; font-size: 0.72rem; opacity: 0.7; }
.balance-value { font-size: 2.8rem; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.balance-usd { opacity: 0.65; }

.redeem {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.4rem;
}
.redeem h3 { font-size: 1.05rem; margin-bottom: 0.8rem; }
.redeem-row { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.redeem-row input { flex: 1; min-width: 220px; }
.redeem a { color: var(--accent-2); }

/* ─── WhatsApp flottant ───────────────────────────────────── */
.wa-float {
  position: fixed;
  bottom: 22px;
  right: 22px;
  z-index: 60;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #1faa54;
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
  text-decoration: none;
  padding: 0.7rem 1.1rem;
  border-radius: 999px;
  box-shadow: 0 4px 16px rgba(31, 170, 84, 0.4);
  transition: transform 0.15s, box-shadow 0.15s;
}
.wa-float:hover { transform: translateY(-2px); box-shadow: 0 6px 22px rgba(31, 170, 84, 0.5); }
.wa-link { color: #1faa54; }
@media (max-width: 560px) {
  .wa-float span { display: none; }
  .wa-float { padding: 0.85rem; }
}
.or-sep { margin-top: 1.3rem; text-align: center; font-size: 0.85rem; color: var(--ink-soft); font-weight: 600; }
.stripe-packs { display: flex; gap: 0.5rem; flex-wrap: wrap; margin: 0.8rem 0; }
.stripe-buy { flex: 1; min-width: 140px; }

.history-panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.4rem;
  overflow-x: auto;
}
.history-head {
  display: flex; justify-content: space-between; align-items: center;
  gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem;
}
.history-head h3 { font-size: 1.15rem; }
.filters { display: flex; gap: 0.45rem; flex-wrap: wrap; }
.chip {
  font-family: var(--font);
  border: 1.5px solid var(--line);
  background: #fff;
  color: var(--ink-soft);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.32rem 0.85rem;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s;
}
.chip:hover { border-color: var(--ink-soft); }
.chip.active { background: var(--ink); color: var(--paper); border-color: var(--ink); }

.ledger { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.ledger th {
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.7rem;
  color: var(--ink-soft);
  border-bottom: 1.5px solid var(--line);
  padding: 0.55rem 0.6rem;
}
.ledger td { padding: 0.6rem; border-bottom: 1px solid #eef0f4; }
.ledger .num { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--mono); font-size: 0.85rem; }
.ledger .pos { color: #15803d; font-weight: 700; }
.ledger .neg { color: #b91c1c; }
.ledger .empty { text-align: center; color: var(--ink-soft); padding: 2rem; }
.tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
}
.tag-topup { background: #dcfce7; color: #166534; }
.tag-consumption { background: #dbeafe; color: #1e40af; }
.tag-refund { background: #fef3c7; color: #92400e; }
.tag-adjustment { background: #f3e8ff; color: #6b21a8; }

.pager {
  display: flex; justify-content: center; align-items: center;
  gap: 1rem; margin-top: 1rem;
}
