/* Ultimate — le socle : couleurs, typographie, coquille, composants. */

:root {
  --fond: #070a13;
  --fond-2: #0c1220;
  --surface: #121a2c;
  --surface-2: #19233a;
  --trait: #243150;
  --texte: #eef2fb;
  --doux: #92a0bf;
  --accent: #35e0a1;
  --accent-2: #12b981;
  --or: #f6c94f;
  --danger: #ff5d6c;
  --rayon: 16px;
  --police: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --police-titre: "Bahnschrift", "DIN Alternate", "Roboto Condensed", "Arial Narrow", var(--police);
  --police-carte: "Bahnschrift", "DIN Alternate", "Roboto Condensed", "Arial Narrow", "Segoe UI", sans-serif;
  --bas: env(safe-area-inset-bottom, 0px);
  --haut: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh;
  background:
    radial-gradient(1100px 520px at 50% -120px, #16254a 0%, transparent 70%),
    linear-gradient(180deg, var(--fond-2), var(--fond) 420px);
  background-color: var(--fond);
  background-attachment: fixed;
  color: var(--texte); font-family: var(--police); font-size: 15px; line-height: 1.45;
  overscroll-behavior-y: none;
}
[hidden] { display: none !important; }
h1, h2, h3 { font-family: var(--police-titre); margin: 0; letter-spacing: .01em; font-stretch: 88%; }
h1 { font-size: 26px; } h2 { font-size: 20px; } h3 { font-size: 16px; }
p { margin: 0; }
a { color: var(--accent); }
button { font: inherit; color: inherit; }
::selection { background: var(--accent); color: #04130d; }

/* ------------------------------------------------------------ l'amorce -- */
.amorce { min-height: 100dvh; display: grid; place-content: center; gap: 18px; justify-items: center; }
.amorce-logo, .logo {
  font-family: var(--police-titre); font-weight: 800; letter-spacing: .22em; font-stretch: 80%;
  background: linear-gradient(100deg, #fff 10%, var(--or) 45%, #fff 80%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.amorce-logo { font-size: 34px; }
.amorce-barre { width: 150px; height: 3px; border-radius: 3px; background: var(--trait); overflow: hidden; }
.amorce-barre i { display: block; width: 40%; height: 100%; background: var(--accent); border-radius: 3px;
  animation: amorce 1.1s ease-in-out infinite; }
@keyframes amorce { 0% { transform: translateX(-110%); } 100% { transform: translateX(260%); } }

/* ----------------------------------------------------------- la coquille -- */
.entete {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  padding: calc(10px + var(--haut)) 16px 10px;
  background: rgba(7, 10, 19, .82); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.logo { font-size: 19px; text-decoration: none; }
.entete .vide { flex: 1; }
.solde {
  display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px 6px 8px;
  border-radius: 999px; background: var(--surface); border: 1px solid var(--trait);
  font-family: var(--police-titre); font-weight: 700; font-size: 16px; font-variant-numeric: tabular-nums;
}
.solde.bouge { animation: pouls .5s ease; }
@keyframes pouls { 40% { transform: scale(1.09); border-color: var(--or); } }
.piece {
  width: 18px; height: 18px; border-radius: 50%; flex: none; display: inline-block;
  background: radial-gradient(circle at 35% 30%, #fff3bf, var(--or) 45%, #b9861a 100%);
  box-shadow: inset 0 0 0 1.5px rgba(120, 80, 0, .45);
  vertical-align: -3px;
}
.piece.p { width: 13px; height: 13px; vertical-align: -1.5px; box-shadow: inset 0 0 0 1px rgba(120, 80, 0, .45); }

.vue { padding: 18px 16px calc(96px + var(--bas)); max-width: 1180px; margin: 0 auto; }
.vue > * + * { margin-top: 18px; }

.onglets {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; justify-content: space-around;
  padding: 6px 6px calc(6px + var(--bas));
  background: rgba(9, 13, 24, .92); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid rgba(255,255,255,.07);
}
.onglet {
  flex: 1; max-width: 120px; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 7px 4px 5px; border-radius: 12px; text-decoration: none; position: relative;
  color: var(--doux); font-size: 11px; font-weight: 600; letter-spacing: .02em;
  -webkit-tap-highlight-color: transparent;
}
.onglet svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round; }
.onglet.actif { color: var(--accent); }
.onglet.actif::before {
  content: ""; position: absolute; top: -7px; left: 30%; right: 30%; height: 3px;
  border-radius: 0 0 3px 3px; background: var(--accent);
}
.onglet .point {
  position: absolute; top: 4px; right: calc(50% - 18px); width: 9px; height: 9px; border-radius: 50%;
  background: var(--or); box-shadow: 0 0 0 2px #090d18;
}

@media (min-width: 900px) {
  /* Sur grand ecran, les onglets montent dans l en-tete, au centre. */
  .onglets {
    position: fixed; top: 0; bottom: auto; left: 50%; right: auto; transform: translateX(-50%);
    z-index: 21; border-top: 0; background: none;
    backdrop-filter: none; -webkit-backdrop-filter: none;
    justify-content: center; gap: 4px; padding: 11px 0;
  }
  .onglet { flex: none; flex-direction: row; gap: 8px; padding: 9px 14px; font-size: 14px; max-width: none; }
  .onglet svg { width: 19px; height: 19px; }
  .onglet.actif { background: rgba(53, 224, 161, .1); }
  .onglet.actif::before { display: none; }
  .onglet .point { top: 5px; right: 5px; }
  .vue { padding-bottom: 60px; }
  .entete { padding-top: 12px; padding-bottom: 12px; min-height: 61px; }
}

/* ---------------------------------------------------------- composants -- */
.bouton {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 10px 18px; border-radius: 13px; border: 1px solid transparent;
  background: var(--accent); color: #04130d; cursor: pointer;
  font-family: var(--police-titre); font-weight: 700; font-size: 16px; letter-spacing: .02em;
  text-decoration: none; white-space: nowrap; -webkit-tap-highlight-color: transparent;
  transition: transform .08s ease, filter .15s ease, background .15s ease;
}
.bouton:hover { filter: brightness(1.08); }
.bouton:active { transform: scale(.97); }
.bouton:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.bouton[disabled] { opacity: .45; cursor: not-allowed; filter: none; transform: none; }
.bouton.second { background: var(--surface-2); color: var(--texte); border-color: var(--trait); }
.bouton.or { background: linear-gradient(180deg, #ffe08a, var(--or)); color: #2b1d00; }
.bouton.fantome { background: transparent; color: var(--doux); border-color: var(--trait); }
.bouton.danger { background: transparent; color: var(--danger); border-color: rgba(255, 93, 108, .45); }
.bouton.petit { min-height: 36px; padding: 6px 12px; font-size: 14px; border-radius: 10px; }
.bouton.large { width: 100%; }
.bouton.charge { position: relative; color: transparent !important; pointer-events: none; }
.bouton.charge::after {
  content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%;
  border: 2.5px solid rgba(0,0,0,.25); border-top-color: #04130d; animation: tourne .7s linear infinite;
}
.bouton.second.charge::after, .bouton.fantome.charge::after { border-color: rgba(255,255,255,.2); border-top-color: #fff; }
@keyframes tourne { to { transform: rotate(360deg); } }

.puces { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.puces::-webkit-scrollbar { display: none; }
.puce {
  flex: none; padding: 7px 13px; border-radius: 999px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--trait); color: var(--doux);
  font-size: 13.5px; font-weight: 600; -webkit-tap-highlight-color: transparent;
}
.puce.actif { background: var(--texte); color: var(--fond); border-color: var(--texte); }

.panneau {
  background: linear-gradient(180deg, var(--surface), #0f1627);
  border: 1px solid var(--trait); border-radius: var(--rayon); padding: 16px;
}
.titre-section { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.titre-section small, .doux { color: var(--doux); font-size: 13px; }
.rangee { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pousse { margin-left: auto; }
.credits { font-family: var(--police-titre); font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }

.champ { display: grid; gap: 6px; }
.champ label { font-size: 13px; color: var(--doux); font-weight: 600; }
.saisie, select.saisie {
  width: 100%; min-height: 46px; padding: 10px 14px; border-radius: 12px;
  background: #0a101d; border: 1px solid var(--trait); color: var(--texte); font: inherit; font-size: 16px;
}
.saisie:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(53, 224, 161, .16); }
select.saisie { appearance: none; -webkit-appearance: none; padding-right: 34px;
  background-image: linear-gradient(45deg, transparent 50%, var(--doux) 50%), linear-gradient(135deg, var(--doux) 50%, transparent 50%);
  background-position: calc(100% - 18px) 21px, calc(100% - 13px) 21px; background-size: 5px 5px; background-repeat: no-repeat; }
.erreur { color: var(--danger); font-size: 13.5px; min-height: 20px; }

/* ------------------------------------------------------------ la feuille -- */
#feuille { position: fixed; inset: 0; z-index: 60; display: grid; align-items: end; justify-items: center; }
#feuille .voile { position: absolute; inset: 0; background: rgba(3, 5, 10, .72); backdrop-filter: blur(3px);
  animation: fondu .2s ease; }
#feuille .papier {
  position: relative; width: 100%; max-width: 560px; max-height: 92dvh; overflow-y: auto;
  background: linear-gradient(180deg, #162038, #0d1424 220px);
  border: 1px solid var(--trait); border-bottom: 0; border-radius: 22px 22px 0 0;
  padding: 10px 18px calc(22px + var(--bas)); animation: monte .26s cubic-bezier(.2, .9, .3, 1);
  overscroll-behavior: contain;
}
#feuille .papier::before { content: ""; display: block; width: 42px; height: 4px; border-radius: 4px;
  background: var(--trait); margin: 0 auto 12px; }
#feuille .fermer {
  position: absolute; top: 12px; right: 12px; width: 36px; height: 36px; border-radius: 50%;
  border: 0; background: rgba(255,255,255,.07); color: var(--texte); font-size: 20px; cursor: pointer; line-height: 1;
}
@media (min-width: 700px) {
  #feuille { align-items: center; }
  #feuille .papier { border-radius: 22px; border-bottom: 1px solid var(--trait); padding-bottom: 22px; }
  #feuille .papier::before { visibility: hidden; margin-bottom: 4px; }
}
@keyframes fondu { from { opacity: 0; } }
@keyframes monte { from { transform: translateY(40px); opacity: 0; } }

/* -------------------------------------------------------------- toasts -- */
#toasts { position: fixed; left: 0; right: 0; top: calc(64px + var(--haut)); z-index: 90;
  display: grid; justify-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast {
  max-width: 440px; padding: 11px 16px; border-radius: 13px; font-weight: 600; font-size: 14.5px;
  background: #1c2742; border: 1px solid #33426a; box-shadow: 0 10px 30px rgba(0,0,0,.5);
  animation: toast .28s cubic-bezier(.2, .9, .3, 1.2);
}
.toast.ok { border-color: rgba(53, 224, 161, .6); }
.toast.rate { border-color: rgba(255, 93, 108, .6); }
.toast.part { opacity: 0; transform: translateY(-8px); transition: all .25s ease; }
@keyframes toast { from { opacity: 0; transform: translateY(-14px) scale(.96); } }

/* --------------------------------------------------------------- l'accueil -- */
.porte { min-height: 100dvh; display: grid; place-items: center; padding: 24px 18px; }
.porte-boite { width: 100%; max-width: 400px; display: grid; gap: 18px; }
.porte-titre { text-align: center; display: grid; gap: 6px; }
.porte-titre .logo { font-size: 40px; }
.porte-cartes { display: flex; justify-content: center; height: 150px; margin-bottom: 4px; }
.porte-cartes > div { width: 100px; margin: 0 -14px; }
.porte-cartes > div:nth-child(1) { transform: rotate(-11deg) translateY(12px); }
.porte-cartes > div:nth-child(2) { transform: translateY(-4px) scale(1.12); z-index: 1; }
.porte-cartes > div:nth-child(3) { transform: rotate(11deg) translateY(12px); }
.porte form { display: grid; gap: 14px; }
.bascule { text-align: center; color: var(--doux); font-size: 14px; }
.bascule button { background: none; border: 0; color: var(--accent); font-weight: 700; cursor: pointer; padding: 4px; }
.mention { text-align: center; color: #6c7896; font-size: 12px; line-height: 1.5; }

/* Le reglage « animations reduites » du compte pose cette classe. */
html.calme * { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
