/* Coffre : interface inspirée de Phantom (sombre, violet lavande, tuiles arrondies, barre d'onglets). */
:root {
  --fond: #1c1c1c; --surface: #2a2a2a; --surface2: #333333; --survol: #3a3a3a; --trait: #2f2f2f;
  --texte: #ffffff; --doux: #999999; --tres-doux: #666666;
  --violet: #ab9ff2; --violet-vif: #9886e5; --violet-sombre: #3c315b;
  --vert: #2ec08b; --rouge: #eb3742; --jaune: #ffdc62;
  --rayon: 12px; --onglets: 64px;
  color-scheme: dark;
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { background: var(--fond); } html, body { color: var(--texte); min-height: 100%; }
body { font: 15px/1.35 -apple-system, BlinkMacSystemFont, "SF Pro Text", Inter, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased; overscroll-behavior: none; user-select: none; -webkit-user-select: none; }
input, textarea, .selectionnable { user-select: text; -webkit-user-select: text; }
a { color: inherit; text-decoration: none; }
svg.ic { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

#app { max-width: 460px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column;
  padding: calc(env(safe-area-inset-top) + 8px) 16px calc(env(safe-area-inset-bottom) + 20px); gap: 14px; animation: entree .18s ease-out; }
#app.avec-onglets { padding-bottom: calc(env(safe-area-inset-bottom) + var(--onglets) + 16px); }
@keyframes entree { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

h1 { font-size: 28px; font-weight: 700; letter-spacing: -.4px; }
h2 { font-size: 17px; font-weight: 600; }
p, .doux { color: var(--doux); }
.petit { font-size: 13px; }
.centre { text-align: center; }
.espace { flex: 1; }
.ligne { display: flex; align-items: center; gap: 10px; }
.vert { color: var(--vert); } .rouge { color: var(--rouge); }

/* Boutons */
button, .bouton { appearance: none; border: 0; font: inherit; color: inherit; background: none; cursor: pointer; }
.btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; height: 50px; border-radius: var(--rayon);
  background: var(--violet); color: #1c1c1c; font-weight: 600; font-size: 16px; transition: transform .08s, background .15s; }
.btn:active { transform: scale(.98); background: var(--violet-vif); }
.btn.gris { background: var(--surface); color: var(--texte); }
.btn.gris:active { background: var(--survol); }
.btn.danger { background: transparent; color: var(--rouge); }
.btn:disabled { opacity: .4; }
.duo { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.lien { color: var(--violet); font-weight: 500; padding: 6px; }

/* Champs */
.champ { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1.5px solid transparent; border-radius: var(--rayon); padding: 0 12px; transition: border-color .15s; }
.champ:focus-within { border-color: var(--violet); }
.champ input, .champ textarea { flex: 1; min-width: 0; background: none; border: 0; outline: none; color: var(--texte); font: inherit; font-size: 16px; padding: 15px 0; }
.champ textarea { min-height: 120px; resize: none; line-height: 1.5; }
.champ .ic-bouton { color: var(--violet); }
input::placeholder, textarea::placeholder { color: var(--tres-doux); }
.etiquette { font-size: 13px; color: var(--doux); margin: 0 2px 6px; display: block; }

/* En-tête */
.entete { display: flex; align-items: center; justify-content: space-between; min-height: 44px; }
.entete .titre { position: absolute; left: 50%; transform: translateX(-50%); font-weight: 600; font-size: 17px; }
.entete { position: relative; }
.ic-bouton { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: var(--doux); transition: background .15s; }
.ic-bouton:active { background: var(--surface); }
.compte { display: flex; align-items: center; gap: 10px; padding: 4px 8px 4px 0; border-radius: 20px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg, #ab9ff2, #6b5bd2); display: grid; place-items: center; font-weight: 700; color: #1c1c1c; font-size: 14px; }
.compte b { font-size: 16px; }

/* Solde */
.solde { text-align: center; padding: 22px 0 6px; }
.solde .montant { font-size: 44px; font-weight: 700; letter-spacing: -1.2px; line-height: 1.1; }
.solde .variation { margin-top: 6px; font-size: 16px; font-weight: 500; display: flex; gap: 8px; justify-content: center; }
.pilule { padding: 1px 7px; border-radius: 6px; font-size: 14px; }
.pilule.vert { background: rgba(46,192,139,.15); } .pilule.rouge { background: rgba(235,55,66,.15); }

/* Tuiles d'action */
.actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 10px 0 6px; }
.action { background: var(--surface); border-radius: var(--rayon); height: 78px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px;
  font-size: 13px; font-weight: 500; color: var(--doux); transition: transform .08s, background .15s; }
.action svg.ic { color: var(--violet); width: 24px; height: 24px; }
.action:active { transform: scale(.96); background: var(--survol); }

/* Liste des jetons */
.liste { display: flex; flex-direction: column; gap: 8px; }
.jeton { display: flex; align-items: center; gap: 12px; width: 100%; background: var(--surface); border-radius: var(--rayon); padding: 12px 14px; text-align: left; transition: background .15s; }
.jeton:active { background: var(--survol); }
.jeton .infos { min-width: 0; }
.jeton .nom { font-weight: 600; font-size: 16px; }
.jeton .sous { color: var(--doux); font-size: 14px; margin-top: 1px; }
.jeton .droite { margin-left: auto; text-align: right; }
.jeton .valeur { font-weight: 600; font-size: 16px; }
.logo-jeton { position: relative; width: 44px; height: 44px; flex: none; }
.logo-jeton > img { width: 44px; height: 44px; border-radius: 50%; display: block; }
.logo-jeton .reseau { position: absolute; right: -2px; bottom: -2px; width: 18px; height: 18px; border-radius: 6px; border: 2px solid var(--surface); background: var(--surface); }
.logo-jeton.grand, .logo-jeton.grand > img { width: 64px; height: 64px; }
.logo-jeton.grand .reseau { width: 24px; height: 24px; border-color: var(--fond); }
.gerer { color: var(--doux); font-size: 14px; font-weight: 500; padding: 12px; display: flex; gap: 6px; align-items: center; justify-content: center; }
.squelette { height: 68px; border-radius: var(--rayon); background: linear-gradient(90deg, var(--surface) 0%, var(--surface2) 50%, var(--surface) 100%); background-size: 200% 100%; animation: brille 1.2s infinite; }
@keyframes brille { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* Barre d'onglets */
.onglets { position: fixed; left: 0; right: 0; bottom: 0; background: rgba(28,28,28,.94); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--trait); display: flex; justify-content: space-around; padding: 8px 0 calc(env(safe-area-inset-bottom) + 6px); z-index: 5; }
.onglet { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 11px; color: var(--tres-doux); width: 80px; padding: 4px 0; }
.onglet.actif { color: var(--violet); }

/* Cartes et détails */
.carte { background: var(--surface); border-radius: var(--rayon); overflow: hidden; }
.detail { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 14px 16px; border-bottom: 1px solid var(--fond); }
.detail:last-child { border: 0; }
.detail > span:first-child { color: var(--doux); }
.detail > span:last-child { text-align: right; word-break: break-all; font-weight: 500; }
.menu .detail { width: 100%; text-align: left; }
.menu .detail:active { background: var(--survol); }
.menu .detail > span:first-child { color: var(--texte); display: flex; gap: 12px; align-items: center; }
.menu .detail svg.ic { color: var(--doux); width: 20px; height: 20px; }
.section { font-size: 13px; color: var(--doux); font-weight: 600; margin: 8px 4px -4px; text-transform: uppercase; letter-spacing: .4px; }

/* Phrase de récupération */
.mots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; position: relative; }
.mot { background: var(--surface); border-radius: 10px; padding: 11px 10px; font-size: 15px; font-weight: 500; }
.mot b { color: var(--tres-doux); font-weight: 500; margin-right: 6px; }
.voile { position: absolute; inset: 0; border-radius: var(--rayon); backdrop-filter: blur(9px); -webkit-backdrop-filter: blur(9px); background: rgba(28,28,28,.4);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: var(--texte); font-weight: 500; }
.coche { display: flex; gap: 12px; align-items: center; background: var(--surface); border-radius: var(--rayon); padding: 14px; font-size: 15px; }
.coche input { width: 22px; height: 22px; accent-color: var(--violet); flex: none; }

/* Recevoir */
.puces { display: flex; gap: 6px; background: var(--surface); padding: 4px; border-radius: 12px; }
.puce { flex: 1; padding: 9px 4px; border-radius: 9px; font-size: 13px; font-weight: 600; color: var(--doux); display: flex; align-items: center; justify-content: center; gap: 6px; }
.puce img { width: 16px; height: 16px; border-radius: 50%; }
.puce.active { background: var(--survol); color: var(--texte); }
.qr { background: #fff; border-radius: 20px; padding: 16px; width: 248px; height: 248px; margin: 8px auto 0; position: relative; }
.qr > img { width: 100%; height: 100%; image-rendering: pixelated; display: block; }
.qr .centre-logo { position: absolute; left: 50%; top: 50%; width: 48px; height: 48px; transform: translate(-50%, -50%); border-radius: 50%; border: 4px solid #fff; background: #fff; }
.adresse { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 14px; word-break: break-all; line-height: 1.5; }
.adresse-boite { background: var(--surface); border-radius: var(--rayon); padding: 14px 16px; text-align: center; }

/* Envoyer */
.grand-montant { display: flex; align-items: baseline; justify-content: center; gap: 8px; padding: 18px 0 2px; }
.grand-montant input { background: none; border: 0; outline: none; color: var(--texte); font: inherit; font-size: 44px; font-weight: 700; text-align: right; width: 0; flex: 1; letter-spacing: -1px; }
.grand-montant .unite { font-size: 28px; font-weight: 600; color: var(--doux); flex: 1; }
.sous-montant { text-align: center; color: var(--doux); display: flex; justify-content: center; gap: 10px; align-items: center; }
.max { background: var(--surface); color: var(--texte); border-radius: 8px; padding: 4px 10px; font-size: 13px; font-weight: 600; }

/* Messages */
.alerte { display: flex; gap: 10px; background: rgba(255,220,98,.08); color: var(--jaune); border-radius: var(--rayon); padding: 12px 14px; font-size: 14px; line-height: 1.4; }
.alerte svg.ic { width: 18px; height: 18px; margin-top: 1px; }
.erreur { color: var(--rouge); font-size: 14px; min-height: 18px; text-align: center; }
.toast { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + var(--onglets) + 20px); transform: translateX(-50%); background: #f2f2f2; color: #1c1c1c;
  padding: 10px 18px; border-radius: 22px; font-size: 14px; font-weight: 600; z-index: 10; display: flex; gap: 6px; align-items: center; animation: entree .15s; }
.statut-rond { width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center; margin: 30px auto 6px; background: var(--violet-sombre); color: var(--violet); }
.statut-rond svg.ic { width: 34px; height: 34px; }
.statut-rond.ok { background: rgba(46,192,139,.15); color: var(--vert); }
.statut-rond.ko { background: rgba(235,55,66,.15); color: var(--rouge); }

/* Bienvenue */
.accueil-violet { margin: calc(-8px - env(safe-area-inset-top)) -16px 0; padding: calc(env(safe-area-inset-top) + 70px) 24px 40px; background: radial-gradient(120% 90% at 50% 0%, #6b5bd2 0%, #3c315b 55%, var(--fond) 100%); text-align: center; }
.accueil-violet img { width: 96px; height: 96px; border-radius: 26px; box-shadow: 0 12px 40px rgba(0,0,0,.4); }
.accueil-violet h1 { margin-top: 22px; font-size: 32px; }
.accueil-violet p { color: #d6d0f5; margin-top: 8px; font-size: 16px; }
.points { display: flex; flex-direction: column; gap: 14px; margin: 26px 4px; }
.point { display: flex; gap: 14px; align-items: flex-start; }
.point svg.ic { color: var(--violet); }
.point b { display: block; font-weight: 600; } .point span { color: var(--doux); font-size: 14px; }
.verrou-haut { text-align: center; margin-top: 18vh; }
.verrou-haut img { width: 84px; height: 84px; border-radius: 22px; }
.verrou-haut h1 { margin-top: 18px; font-size: 26px; }

/* ===== Brillance : halos, reflets, verre ===== */
.halo { position: fixed; left: 50%; top: -160px; width: 560px; height: 420px; transform: translateX(-50%); pointer-events: none; z-index: -1;
  background: radial-gradient(closest-side, rgba(171,159,242,.30), rgba(107,91,210,.12) 55%, transparent); filter: blur(10px); }
.action, .jeton, .carte, .puces, .champ, .mot, .adresse-boite, .coche, .btn.gris {
  background-image: linear-gradient(180deg, rgba(255,255,255,.055), rgba(255,255,255,.012));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.07), 0 1px 2px rgba(0,0,0,.35); }
.btn:not(.gris):not(.danger) { background: linear-gradient(180deg, #c3b8ff 0%, #ab9ff2 45%, #9886e5 100%); position: relative; overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.55), 0 8px 24px rgba(171,159,242,.28); }
.btn:not(.gris):not(.danger)::after { content: ""; position: absolute; top: 0; left: -60%; width: 40%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.35), transparent); animation: reflet 3.6s ease-in-out infinite; }
@keyframes reflet { 0%, 60% { left: -60%; } 100% { left: 130%; } }
.btn:disabled::after { display: none; }
.solde { display: block; width: 100%; }
.solde .montant { background: linear-gradient(180deg, #ffffff 30%, #d9d3ff 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.logo-jeton > img:first-child { box-shadow: 0 2px 8px rgba(0,0,0,.45); }
.avatar { box-shadow: 0 0 0 2px rgba(171,159,242,.25), 0 4px 14px rgba(171,159,242,.35); }
.action svg.ic { filter: drop-shadow(0 0 6px rgba(171,159,242,.45)); }
.onglet.actif svg.ic { filter: drop-shadow(0 0 6px rgba(171,159,242,.6)); }

/* Page d'un jeton */
.tete-jeton { display: flex; gap: 14px; align-items: center; margin-top: 6px; }
.tete-jeton .montant { font-size: 32px; font-weight: 700; letter-spacing: -.8px; }
.tete-jeton .ligne { margin-top: 4px; font-size: 13px; }
.zone-courbe { height: 190px; margin: 4px -16px 0; touch-action: none; }
.courbe { width: 100%; height: 100%; display: block; }
.squelette.grande { height: 180px; margin: 0 16px; }
.periodes { display: flex; justify-content: space-between; gap: 4px; }
.periode { flex: 1; padding: 8px 0; border-radius: 9px; font-size: 13px; font-weight: 600; color: var(--doux); }
.periode.active { background: var(--surface); color: var(--texte); box-shadow: inset 0 1px 0 rgba(255,255,255,.07); }
.centre > .logo-jeton { margin: 0 auto; }
.menu .detail > span.rouge:first-child { color: var(--rouge); }
