/* Skarlett Parrainage — identité Skarlett (comme Marketing Analytics et Marketing Hub) : beige floral, vert sapin,
   vert citron, bleu givré ; titres en Skarlett Americane, texte en Manrope. Une seule colonne, pensée pour le téléphone. */

@font-face { font-family: 'Manrope'; src: url('/assets/fonts/Manrope-Variable.ttf') format('truetype'); font-weight: 200 800; font-style: normal; font-display: swap; }
@font-face { font-family: 'Skarlett Americane'; src: url('/assets/fonts/SkarlettAmericane-Black.woff2') format('woff2'), url('/assets/fonts/SkarlettAmericane-Black.woff') format('woff'); font-weight: 400 900; font-style: normal; font-display: swap; }

:root {
  color-scheme: light;
  --sapin: #19392E; --sapin-2: #12543E; --citron: #B2FF8D; --givre: #9AFFFF; --beige: #FFFEF6; --beige-2: #F6F4EA;
  --page: #F6F4EA; --surface: #FFFEF6; --surface-2: #FAF9F0; --surface-3: #EEECDF;
  --ink: #19392E; --ink-2: #4E6359; --muted: #6F8379;
  --border: rgba(25, 57, 46, 0.09); --border-strong: rgba(25, 57, 46, 0.18);
  --shadow: 0 1px 2px rgba(25, 57, 46, 0.04), 0 18px 40px -22px rgba(25, 57, 46, 0.25);
  --shadow-pop: 0 24px 60px -18px rgba(25, 57, 46, 0.32), 0 6px 18px -6px rgba(25, 57, 46, 0.12);
  --accent: #12543E; --accent-wash: rgba(178, 255, 141, 0.32); --neutral-wash: rgba(25, 57, 46, 0.06);
  --good: #22A05C; --good-text: #17784A; --good-wash: rgba(34, 160, 92, 0.12);
  --warning: #E5A119; --warning-text: #835800; --warning-wash: rgba(229, 161, 25, 0.16);
  --critical: #D24E3E; --critical-text: #B23A2C; --critical-wash: rgba(210, 78, 62, 0.11);
  --glass: linear-gradient(155deg, rgba(255, 254, 246, 0.84), rgba(255, 254, 246, 0.6));
  --glass-edge: rgba(255, 255, 255, 0.85);
  --glass-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.95), 0 28px 60px -24px rgba(25, 57, 46, 0.34), 0 6px 16px -6px rgba(25, 57, 46, 0.1);
  --blob-1: rgba(178, 255, 141, 0.55); --blob-2: rgba(154, 255, 255, 0.5); --blob-3: rgba(178, 255, 141, 0.28);
  --ring-track: #E3EEDB;
  --font: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-title: 'Skarlett Americane', 'Manrope', system-ui, sans-serif;
  --radius: 26px; --radius-md: 18px;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --page: #0C1F18; --surface: #132C23; --surface-2: #17342A; --surface-3: #1F4035;
    --ink: #FFFEF6; --ink-2: #C7D5CC; --muted: #93AE9F;
    --border: rgba(255, 254, 246, 0.09); --border-strong: rgba(255, 254, 246, 0.18);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.2), 0 18px 40px -22px rgba(0, 0, 0, 0.6); --shadow-pop: 0 24px 60px -18px rgba(0, 0, 0, 0.7);
    --accent: #B2FF8D; --accent-wash: rgba(178, 255, 141, 0.14); --neutral-wash: rgba(255, 254, 246, 0.07);
    --good-text: #6FE09E; --warning-text: #FFC75C; --critical-text: #FF9B8C;
    --glass: linear-gradient(155deg, rgba(25, 57, 46, 0.8), rgba(19, 44, 35, 0.6)); --glass-edge: rgba(255, 254, 246, 0.12);
    --glass-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 28px 60px -24px rgba(0, 0, 0, 0.7);
    --blob-1: rgba(178, 255, 141, 0.12); --blob-2: rgba(154, 255, 255, 0.1); --blob-3: rgba(18, 84, 62, 0.55);
    --ring-track: #25493D;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; background: var(--page); color: var(--ink); font: 500 15px/1.55 var(--font); -webkit-font-smoothing: antialiased; display: flex; flex-direction: column; }
body::before { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(42vmax 42vmax at 4% 0%, var(--blob-1), transparent 62%), radial-gradient(38vmax 38vmax at 100% 8%, var(--blob-2), transparent 60%), radial-gradient(50vmax 40vmax at 72% 108%, var(--blob-3), transparent 64%); }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; font-family: var(--font-title); font-weight: 900; letter-spacing: 0.005em; line-height: 1.02; }
p { margin: 0; }
:focus-visible { outline: 2px solid var(--sapin-2); outline-offset: 2px; border-radius: 8px; }
@media (prefers-color-scheme: dark) { :focus-visible { outline-color: var(--citron); } }
::selection { background: var(--citron); color: var(--sapin); }
.ico { width: 18px; height: 18px; flex: none; }
.muted { color: var(--muted); }
.center { text-align: center; }

/* ---------- En-tête et pied de page ---------- */
.top { display: flex; justify-content: center; padding: 26px 16px 4px; }
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; }
.brand img { height: 30px; width: auto; }
.brand-tag { font: 800 11.5px/1 var(--font); letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-2); padding: 6px 10px; border-radius: 999px; background: var(--accent-wash); }
.logo-on-dark { display: none; }
@media (prefers-color-scheme: dark) { .logo-on-light { display: none; } .logo-on-dark { display: block; } }
.foot { margin-top: auto; padding: 28px 16px 34px; text-align: center; color: var(--muted); font-size: 12.5px; font-weight: 600; }
.foot a { color: var(--ink-2); text-underline-offset: 2px; }

/* ---------- Page ---------- */
.page { width: 100%; max-width: 760px; margin: 0 auto; padding: 18px 16px 8px; display: grid; gap: 18px; outline: none; }
.loading { min-height: 50vh; display: grid; place-items: center; }
.card { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 26px 26px; min-width: 0; }
.card.glass { background: var(--glass); border-color: var(--glass-edge); box-shadow: var(--glass-shadow); backdrop-filter: blur(22px) saturate(160%); -webkit-backdrop-filter: blur(22px) saturate(160%); }
.card h2 { font-size: 23px; display: flex; align-items: center; gap: 10px; }
.card h2 .count { font: 800 12.5px/1 var(--font); padding: 5px 9px; border-radius: 999px; background: var(--neutral-wash); color: var(--ink-2); }
.card.center { display: grid; justify-items: center; gap: 14px; text-align: center; padding: 40px 26px; margin-top: 20px; }
.ic-big { width: 58px; height: 58px; border-radius: 18px; display: grid; place-items: center; background: var(--accent-wash); color: var(--sapin-2); }
.ic-big .ico { width: 28px; height: 28px; }
.ic-big.ok { background: var(--citron); color: var(--sapin); }
@media (prefers-color-scheme: dark) { .ic-big { color: var(--citron); } .ic-big.ok { color: var(--sapin); } }
.lead { color: var(--ink-2); font-size: 15.5px; font-weight: 500; }
.lead p + p { margin-top: 8px; }
.kicker { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); font-size: 12.5px; font-weight: 800; color: var(--ink-2); }
.kicker i { width: 8px; height: 8px; border-radius: 50%; background: var(--citron); box-shadow: 0 0 0 3px var(--accent-wash); }

/* ---------- Introduction ---------- */
.intro { position: relative; padding: 18px 4px 4px; display: grid; gap: 14px; justify-items: start; }
.intro h1 { font-size: clamp(40px, 9vw, 64px); text-transform: uppercase; line-height: 0.92; max-width: 11ch; }
.intro .lead { max-width: 52ch; }
.intro .torus { position: absolute; z-index: -1; right: -40px; top: -36px; width: min(46vw, 330px); height: auto; transform: rotate(-12deg); filter: drop-shadow(0 30px 40px rgba(18, 84, 62, 0.25)); animation: floaty 9s ease-in-out infinite; pointer-events: none; }
@keyframes floaty { 50% { transform: rotate(-8deg) translateY(10px); } }
.offer { display: inline-flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 16px; background: var(--citron); color: var(--sapin); font-weight: 800; }

/* ---------- Chèques cadeaux (tickets) ---------- */
.tickets { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(150px, 1fr); gap: 12px; overflow-x: auto; padding: 4px 2px 10px; margin: 0 -2px; scroll-snap-type: x mandatory; scrollbar-width: thin; }
.ticket { position: relative; scroll-snap-align: start; display: grid; gap: 6px; padding: 16px 16px 14px; border-radius: 20px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); overflow: hidden; min-width: 150px; }
/* encoches latérales et pointillés : l'allure d'un chèque cadeau */
.ticket::before, .ticket::after { content: ""; position: absolute; top: 58%; width: 16px; height: 16px; border-radius: 50%; background: var(--page); border: 1px solid var(--border); }
.ticket::before { left: -9px; } .ticket::after { right: -9px; }
.t-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.t-name { font: 800 11.5px/1.2 var(--font); text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-2); }
.t-ic { width: 18px; height: 18px; color: var(--muted); }
.t-amount { font: 900 34px/1 var(--font-title); letter-spacing: 0.01em; padding: 4px 0 12px; border-bottom: 1.5px dashed var(--border-strong); }
.t-foot { font-size: 12.5px; font-weight: 700; color: var(--ink-2); }
.t-bar { height: 6px; border-radius: 999px; background: var(--neutral-wash); overflow: hidden; margin-top: 4px; }
.t-bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--sapin-2), #3FA36E); }
.ticket.reached { background: radial-gradient(120% 120% at 100% 0%, #1F4A3B 0%, var(--sapin) 60%); border-color: transparent; color: var(--beige); }
.ticket.reached .t-name, .ticket.reached .t-foot { color: #C9D9CF; }
.ticket.reached .t-amount { color: var(--citron); border-color: rgba(255, 254, 246, 0.25); }
.ticket.reached .t-ic { color: var(--citron); }
.ticket.next { border: 2px solid var(--citron); box-shadow: 0 0 0 4px var(--accent-wash), var(--shadow); }
.ticket.next .t-ic { color: var(--sapin-2); }
.ticket.locked { background: transparent; box-shadow: none; border-style: dashed; border-color: var(--border-strong); }
.ticket.locked .t-amount { color: var(--muted); }
@media (prefers-color-scheme: dark) { .ticket.next .t-ic { color: var(--citron); } .t-bar i { background: linear-gradient(90deg, #8EE36C, var(--citron)); } }
@media (min-width: 640px) { .tickets { grid-auto-flow: row; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); overflow: visible; } }

/* ---------- Formulaires ---------- */
.form { display: grid; gap: 14px; }
.form h2 { margin-bottom: 4px; }
.field { display: grid; gap: 6px; min-width: 0; }
.field > span { font-size: 12.5px; color: var(--ink-2); font-weight: 800; }
.field > span em { font-style: normal; font-weight: 600; color: var(--muted); margin-left: 4px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.input { width: 100%; height: 48px; border: 1px solid var(--border-strong); background: var(--surface); border-radius: 14px; padding: 0 14px; font-weight: 600; font-size: 15px; min-width: 0; transition: border-color 0.15s, box-shadow 0.15s; }
.input:focus { outline: none; border-color: var(--sapin-2); box-shadow: 0 0 0 4px var(--accent-wash); }
.input[readonly] { background: var(--surface-2); }
.select { appearance: none; padding-right: 38px; cursor: pointer; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2384948C' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; color: var(--ink-2); font-weight: 600; cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--sapin-2); flex: none; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form-error { padding: 12px 14px; border-radius: 12px; background: var(--critical-wash); color: var(--critical-text); font-size: 13.5px; font-weight: 700; }
.hint { font-size: 12.5px; color: var(--muted); font-weight: 600; }
[hidden] { display: none !important; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 46px; padding: 0 20px; border-radius: 14px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink); font-weight: 800; font-size: 14.5px; cursor: pointer; text-decoration: none; white-space: nowrap; transition: background 0.15s, transform 0.1s, box-shadow 0.15s; }
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--sapin); color: var(--beige); border-color: var(--sapin); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12); }
.btn.primary:hover { background: var(--sapin-2); }
.btn.lg { height: 54px; font-size: 15.5px; border-radius: 16px; }
.btn.sm { height: 36px; padding: 0 13px; font-size: 13px; border-radius: 11px; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--neutral-wash); }
.btn.icon { width: 46px; padding: 0; } .btn.icon.sm { width: 36px; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.btn.done { background: var(--citron); color: var(--sapin); border-color: var(--citron); }
@media (prefers-color-scheme: dark) { .btn.primary { background: var(--citron); color: var(--sapin); border-color: var(--citron); } .btn.primary:hover { background: #A2F27B; } }
.link-btn { padding: 0; border: 0; background: none; color: var(--sapin-2); font-weight: 800; font-size: 13.5px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; text-align: left; }
@media (prefers-color-scheme: dark) { .link-btn { color: var(--citron); } }
.login-card { display: grid; gap: 10px; }
.login-card h2 { font-size: 22px; }
.intro .link-btn { margin-top: 2px; }
.form-error .btn { margin-left: 6px; vertical-align: middle; }
.spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin 0.8s linear infinite; }
.spin.lg { width: 30px; height: 30px; border-width: 3px; color: var(--sapin-2); }
@keyframes spin { to { transform: rotate(360deg); } }

.notice { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--border); font-size: 14px; color: var(--ink-2); font-weight: 600; }
.notice .ico { color: var(--sapin-2); margin-top: 1px; }
.notice.warning { background: var(--warning-wash); border-color: transparent; }
.notice.warning .ico { color: #B97E08; }

/* ---------- Espace du parrain ---------- */
.welcome { display: grid; gap: 10px; border: 2px solid var(--citron); }
.welcome b .ico { vertical-align: -3px; margin-right: 6px; color: var(--sapin-2); }
.welcome p { color: var(--ink-2); font-size: 14px; }
.hello { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 4px 0; }
.hello h1 { font-size: clamp(38px, 8vw, 56px); text-transform: uppercase; line-height: 0.92; }
.level-chip { display: inline-flex; align-items: center; gap: 7px; padding: 8px 13px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); font-weight: 800; font-size: 13px; color: var(--ink-2); }
.level-chip .ico { width: 16px; height: 16px; color: var(--muted); }
.level-chip.on { background: var(--sapin); color: var(--beige); border-color: var(--sapin); }
.level-chip.on .ico { color: var(--citron); }

.progress-card { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 24px; align-items: center; }
.ring { position: relative; width: 170px; height: 170px; }
.ring svg { width: 100%; height: 100%; display: block; }
.ring-track { fill: none; stroke: var(--ring-track); stroke-width: 18; }
.ring-fill { fill: none; stroke-width: 18; stroke-linecap: round; transition: stroke-dashoffset 1.2s cubic-bezier(.2,.8,.2,1); }
.ring-val { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring-val b { font: 700 46px/1 var(--font); letter-spacing: -0.04em; }
.ring-val span { font-size: 12.5px; font-weight: 700; color: var(--ink-2); margin-top: 4px; }
.progress-copy { display: grid; gap: 10px; }
.progress-copy h2 { font-size: 24px; line-height: 1.08; }
.progress-copy > p { color: var(--ink-2); font-size: 14px; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 6px 0 0; }
.stats div { padding: 10px 10px; border-radius: 14px; background: var(--neutral-wash); min-width: 0; }
.stats dt { font-size: 11.5px; font-weight: 700; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stats dd { margin: 2px 0 0; font-size: 19px; font-weight: 800; letter-spacing: -0.02em; white-space: nowrap; }

.share-card { display: grid; gap: 14px; }
.share-card.off { opacity: 0.55; }
.link-field { display: flex; gap: 8px; }
.link-field .input { font-size: 14px; }
.link-field.big .input { height: 52px; font-weight: 700; }
.link-field.big .btn { height: 52px; }
.share-row { display: flex; flex-wrap: wrap; gap: 8px; }
.share { flex: 1 1 120px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 46px; padding: 0 14px; border-radius: 14px; border: 1px solid var(--border-strong); background: var(--surface); font-weight: 800; font-size: 14px; text-decoration: none; cursor: pointer; transition: background 0.15s, transform 0.12s; }
.share:hover { background: var(--accent-wash); transform: translateY(-1px); }
.share.wa { background: #DFF8E7; border-color: transparent; color: #0F5132; }
@media (prefers-color-scheme: dark) { .share.wa { background: rgba(37, 211, 102, 0.18); color: #B8F5CB; } }

.refs { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 2px; }
.ref { display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 4px; border-bottom: 1px solid var(--border); }
.ref:last-child { border-bottom: 0; }
.ref .av { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; background: var(--surface-3); color: var(--ink-2); }
.ref.validated .av { background: var(--citron); color: var(--sapin); }
.r-main b { display: block; font-weight: 800; }
.r-main span { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.st { display: inline-flex; align-items: center; gap: 8px; text-align: right; }
.st .ico { width: 18px; height: 18px; }
.st b { display: block; font-size: 13px; font-weight: 800; }
.st small { display: block; font-size: 11.5px; color: var(--muted); font-weight: 600; }
.ref.pending .st .ico { color: #C78A0C; }
.ref.validated .st .ico { color: var(--good); }
.ref.refused .st .ico { color: var(--muted); }
.ref.refused { opacity: 0.7; }
.empty { display: flex; gap: 10px; align-items: flex-start; margin-top: 12px; color: var(--ink-2); font-weight: 600; font-size: 14px; }
.empty .ico { color: var(--sapin-2); margin-top: 1px; }

.conditions { border-radius: var(--radius-md); background: var(--surface-2); border: 1px solid var(--border); }
.conditions summary { display: flex; align-items: center; gap: 8px; padding: 14px 18px; cursor: pointer; font-weight: 800; font-size: 14px; color: var(--ink-2); list-style: none; }
.conditions summary::-webkit-details-marker { display: none; }
.conditions summary::after { content: "+"; margin-left: auto; font-size: 18px; color: var(--muted); }
.conditions[open] summary::after { content: "−"; }
.cond-body { padding: 0 18px 16px; color: var(--ink-2); font-size: 13.5px; }
.cond-body ul { margin: 0; padding-left: 18px; display: grid; gap: 6px; }
.account { text-align: center; color: var(--muted); font-size: 13px; font-weight: 600; }

/* ---------- Fenêtre (code QR) et messages ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(12, 31, 24, 0.36); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); z-index: 60; }
.modal { position: fixed; z-index: 61; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(420px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow: auto; display: grid; gap: 14px; padding: 22px 24px 24px; background: var(--surface); border-radius: 26px; box-shadow: var(--shadow-pop); border: 1px solid var(--border); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.modal-head h2 { font-size: 26px; }
.modal-actions { display: flex; justify-content: center; }
.qr-box { background: #fff; border-radius: 18px; padding: 10px; border: 1px solid var(--border); }
.qr-box svg { display: block; width: 100%; height: auto; }
.toasts { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); display: grid; gap: 8px; z-index: 120; width: min(420px, calc(100vw - 32px)); }
.toast { background: var(--sapin); color: var(--beige); padding: 13px 16px; border-radius: 16px; box-shadow: var(--shadow-pop); font-size: 13.5px; font-weight: 700; }
.toast::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--citron); margin-right: 10px; vertical-align: 1px; }
.toast.error { background: #7E2A20; } .toast.error::before { background: #FFB4A8; }
.confetti { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 130; }

/* ---------- Téléphone ---------- */
@media (max-width: 560px) {
  .card { padding: 22px 18px; border-radius: 22px; }
  .field-row { grid-template-columns: 1fr; }
  .progress-card { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); text-align: left; }
  .ring { width: 156px; height: 156px; }
  .link-field.big { flex-direction: column; }
  .intro .torus { width: 190px; right: -26px; top: -22px; opacity: 0.9; }
  .st small { display: none; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
