/* ==========================================================================
   MAACO GAMES STUDIO — identité et coquille de l'application
   Encre #172057 · Bleu défi #2E5BF0 · Rouge #FF4D5E · Jaune #FFC93C · Vert #2ECC71 · Bleu pion #3D7BFF · Crème #FFF6E8
   ========================================================================== */
:root {
  --ink: #172057;
  --ink-2: #3A4478;
  --muted: #6B7299;
  --blue: #2E5BF0;
  --blue-2: #4F8CFF;
  --blue-3: #2442D6;
  --red: #FF4D5E;
  --yellow: #FFC93C;
  --green: #2ECC71;
  --pawn: #3D7BFF;
  --cream: #FFFDF8;
  --bg: #FFF6E8;
  --card: #FFFFFF;
  --line: rgba(23, 32, 87, .1);
  /* utilisées par le jeu (p4.css) */
  --gold: #FFC93C;
  --gold-2: #FFE08A;
  --ember: #FF4D5E;
  --ember-2: #FF7A86;
  --f-display: 'Lilita One', 'Arial Rounded MT Bold', 'Trebuchet MS', sans-serif;
  --f-body: 'Nunito', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --out: cubic-bezier(.16, 1, .3, 1);
  --tab-h: calc(66px + env(safe-area-inset-bottom));
  --hd-h: calc(62px + env(safe-area-inset-top));
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); color-scheme: light; }
body {
  margin: 0; min-height: 100svh; font-family: var(--f-body); font-size: 16px; line-height: 1.5; color: var(--ink);
  background:
    radial-gradient(circle at 12% 8%, rgba(255, 201, 60, .22) 0 6px, transparent 7px),
    radial-gradient(circle at 88% 14%, rgba(46, 204, 113, .25) 0 5px, transparent 6px),
    radial-gradient(circle at 92% 62%, rgba(255, 77, 94, .2) 0 7px, transparent 8px),
    radial-gradient(circle at 6% 74%, rgba(61, 123, 255, .2) 0 5px, transparent 6px),
    radial-gradient(ellipse 80% 50% at 50% 0%, #FFFFFF, transparent 70%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input { font: inherit; color: inherit; }
img, svg { display: block; max-width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--pawn); outline-offset: 2px; border-radius: 10px; }
.i { width: 1.2em; height: 1.2em; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.t-red { color: var(--red); }
.t-yellow { color: #E3A400; }

/* ---------- En-tête ---------- */
.hd {
  position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: .6rem;
  height: var(--hd-h); padding: env(safe-area-inset-top) max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
  background: rgba(255, 246, 232, .86); backdrop-filter: blur(16px) saturate(160%); -webkit-backdrop-filter: blur(16px) saturate(160%);
  border-bottom: 1px solid var(--line);
}
.hd__home { display: flex; align-items: center; min-width: 0; }
.hd__tools { margin-left: auto; display: flex; align-items: center; gap: .4rem; }
.hd__btn { display: inline-flex; align-items: center; gap: .4rem; height: 40px; min-width: 40px; padding: 0 .7rem; justify-content: center; border-radius: 999px; background: var(--card); border: 1px solid var(--line); color: var(--ink); font-weight: 800; font-size: .8rem; box-shadow: 0 4px 12px -8px rgba(23, 32, 87, .5); transition: transform .3s var(--spring); }
.hd__btn:active { transform: scale(.92); }
.hd__btn.is-muted { color: var(--muted); }
.hd__back { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; background: var(--card); border: 1px solid var(--line); box-shadow: 0 4px 12px -8px rgba(23, 32, 87, .5); }
.hd__title { margin: 0; font-family: var(--f-display); font-weight: 400; font-size: 1.45rem; letter-spacing: .01em; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Logo (manette-M + AAC + jeton) */
.logo { display: inline-grid; grid-template-columns: auto auto auto; align-items: end; column-gap: .05em; font-family: var(--f-display); font-size: 31px; line-height: 1; color: var(--ink); }
.logo__m { width: .968em; height: .78em; color: var(--ink); margin-right: .03em; }
.logo b { font-weight: 400; letter-spacing: .015em; transform: translateY(.07em); }
.logo__o { width: .73em; height: .73em; margin-left: .03em; }
.logo small { grid-column: 1 / -1; margin-top: .22em; font-family: var(--f-display); font-size: .32em; letter-spacing: .38em; text-transform: uppercase; color: var(--ink-2); text-align: center; padding-left: .38em; }

/* ---------- Pages ---------- */
.app { min-height: 100svh; }
.view { width: 100%; max-width: 720px; margin: 0 auto; padding: 1rem max(16px, env(safe-area-inset-left)) calc(var(--tab-h) + 1.5rem); }
body.is-game .view { max-width: 760px; padding-bottom: calc(2rem + env(safe-area-inset-bottom)); }
.page { animation: pageIn .45s var(--out); }
@keyframes pageIn { from { opacity: 0; transform: translateY(10px); } }
.sec { margin: 1.8rem 0 .8rem; font-family: var(--f-display); font-weight: 400; font-size: 1.35rem; letter-spacing: .01em; color: var(--ink); }
.sec--first { margin-top: .6rem; }
.empty { margin: 0; padding: 1rem; border-radius: 18px; background: var(--card); border: 1px dashed var(--line); color: var(--muted); text-align: center; font-weight: 700; font-size: .9rem; }
.foot { margin: 2.2rem 0 0; text-align: center; font-size: .75rem; font-weight: 800; letter-spacing: .14em; color: var(--muted); text-transform: uppercase; }
.loading { display: grid; place-items: center; min-height: 50svh; }

/* ---------- Boutons, puces ---------- */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: .55em;
  height: 50px; padding: 0 1.4em; border-radius: 999px; font-weight: 900; font-size: .95rem; white-space: nowrap;
  background: var(--card); color: var(--ink); border: 1px solid var(--line);
  box-shadow: 0 6px 0 -1px rgba(23, 32, 87, .12); transition: transform .3s var(--spring), box-shadow .3s, filter .3s;
}
.btn:active { transform: translateY(3px); box-shadow: 0 2px 0 -1px rgba(23, 32, 87, .12); }
.btn .i { width: 1.1em; height: 1.1em; }
.btn--primary { background: linear-gradient(180deg, var(--blue-2), var(--blue)); color: #FFFFFF; border-color: transparent; box-shadow: 0 6px 0 0 var(--blue-3), 0 14px 26px -12px rgba(46, 91, 240, .8); }
.btn--primary:active { box-shadow: 0 2px 0 0 var(--blue-3), 0 8px 16px -10px rgba(46, 91, 240, .8); }
.btn--primary .i { fill: currentColor; }
.btn--danger { background: linear-gradient(180deg, #FF6B79, var(--red)); color: #FFFFFF; border-color: transparent; box-shadow: 0 6px 0 0 #C9283A; }
.btn--line { background: transparent; box-shadow: none; }
.btn--lg { height: 58px; padding: 0 1.8em; font-size: 1.05rem; }
.btn--sm { height: 40px; padding: 0 1.1em; font-size: .82rem; }
.btn--block { width: 100%; margin-top: 1.4rem; }
.chip { display: inline-flex; align-items: center; height: 28px; padding: 0 .75rem; border-radius: 999px; background: rgba(23, 32, 87, .07); color: var(--ink-2); font-size: .72rem; font-weight: 900; letter-spacing: .02em; white-space: nowrap; }
.chip--ok { background: rgba(46, 204, 113, .16); color: #138A47; }
.chip--red { background: rgba(255, 77, 94, .14); color: #D62F44; }

/* ---------- Accueil ---------- */
.hello { display: flex; align-items: center; gap: .9rem; margin: .4rem 0 1rem; }
.hello__bob { flex: none; padding-top: 6px; }
.hello__bubble { position: relative; flex: 1; margin: 0; padding: .8rem 1rem; border-radius: 20px 20px 20px 6px; background: var(--card); border: 1px solid var(--line); font-weight: 800; font-size: .98rem; box-shadow: 0 10px 24px -16px rgba(23, 32, 87, .6); animation: bubbleIn .6s var(--spring) .15s both; }
@keyframes bubbleIn { from { opacity: 0; transform: translateY(8px) scale(.94); } }

.feat {
  position: relative; display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 1.1rem; align-items: center;
  padding: 1.2rem; border-radius: 28px; overflow: hidden; color: #FFFFFF;
  background: radial-gradient(circle at 85% 10%, rgba(255, 255, 255, .22), transparent 40%), linear-gradient(135deg, var(--blue-2), var(--blue) 55%, var(--blue-3));
  box-shadow: 0 8px 0 0 var(--blue-3), 0 26px 40px -22px rgba(36, 66, 214, .9); transition: transform .35s var(--spring);
}
.feat:active { transform: scale(.98); }
.feat::after { content: ''; position: absolute; right: -30px; bottom: -40px; width: 160px; height: 160px; border-radius: 50%; background: rgba(255, 201, 60, .25); }
.feat__art { position: relative; z-index: 1; filter: drop-shadow(0 14px 18px rgba(10, 20, 80, .45)); transform: rotate(-4deg); }
.feat__art svg { width: 100%; height: auto; }
.feat__body { position: relative; z-index: 1; display: grid; gap: .45rem; justify-items: start; }
.feat__body small { font-size: .7rem; font-weight: 900; letter-spacing: .16em; text-transform: uppercase; color: var(--yellow); }
.feat__body b { font-family: var(--f-display); font-weight: 400; font-size: 1.7rem; line-height: 1.05; }
.feat__desc { font-size: .88rem; font-weight: 700; color: rgba(255, 255, 255, .86); }
.feat__stats { display: flex; gap: .9rem; margin: .2rem 0 .4rem; }
.feat__stats span { display: grid; font-size: .66rem; font-weight: 800; color: rgba(255, 255, 255, .78); }
.feat__stats b { font-size: 1.35rem; color: #FFFFFF; line-height: 1.1; }
.feat .btn--primary { background: linear-gradient(180deg, #FFE08A, var(--yellow)); color: var(--ink); box-shadow: 0 6px 0 0 #D99A00, 0 14px 26px -12px rgba(0, 0, 0, .4); }

.gcards { display: grid; gap: .7rem; }
.gcard { display: flex; align-items: center; gap: .9rem; padding: .8rem .9rem .8rem .8rem; border-radius: 22px; background: var(--card); border: 1px solid var(--line); box-shadow: 0 5px 0 -1px rgba(23, 32, 87, .08); transition: transform .3s var(--spring); }
a.gcard:active { transform: scale(.98); }
.gcard__art { flex: none; width: 66px; height: 66px; display: grid; place-items: center; border-radius: 18px; background: color-mix(in srgb, var(--c) 12%, #FFFFFF); }
.gcard__art svg { width: 54px; height: 54px; }
.gcard__txt { flex: 1; min-width: 0; display: grid; }
.gcard__txt b { font-family: var(--f-display); font-weight: 400; font-size: 1.2rem; line-height: 1.15; }
.gcard__txt small { color: var(--muted); font-weight: 700; font-size: .84rem; }
.gcard.is-soon { opacity: .72; }
.gcard.is-soon .gcard__art { filter: grayscale(.35); }

.install { display: flex; align-items: center; gap: .8rem; margin-top: 1.1rem; padding: .85rem .9rem; border-radius: 20px; background: #FFFFFF; border: 2px dashed rgba(46, 91, 240, .35); }
.install__ic { flex: none; width: 42px; height: 42px; display: grid; place-items: center; border-radius: 14px; background: rgba(46, 91, 240, .1); color: var(--blue); }
.install > span:nth-child(2) { flex: 1; min-width: 0; display: grid; }
.install b { font-weight: 900; }
.install small { color: var(--muted); font-weight: 700; font-size: .8rem; }
.install small .i { display: inline; width: 1em; height: 1em; vertical-align: -2px; }
.install--settings { margin-top: 0; margin-bottom: .7rem; }

/* ---------- Records ---------- */
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .7rem; }
.tile { display: grid; gap: .1rem; padding: 1rem; border-radius: 22px; background: var(--card); border: 1px solid var(--line); box-shadow: 0 5px 0 -1px rgba(23, 32, 87, .08); }
.tile small { font-size: .7rem; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.tile b { font-family: var(--f-display); font-weight: 400; font-size: 2.1rem; line-height: 1.05; }
.tile b i { font-style: normal; font-size: .6em; color: var(--muted); }
.tile span { font-size: .8rem; font-weight: 700; color: var(--muted); }
.tile--gold { background: linear-gradient(135deg, #FFF3C8, #FFE08A); border-color: rgba(217, 154, 0, .25); }
.tile--gold b { color: #8A5A00; }
.podium { margin: 0; padding: 0; list-style: none; display: grid; gap: .45rem; }
.podium li { display: flex; align-items: center; gap: .8rem; padding: .7rem .9rem; border-radius: 16px; background: var(--card); border: 1px solid var(--line); font-weight: 800; }
.podium li span:nth-child(2) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.podium li b { font-family: var(--f-display); font-weight: 400; font-size: 1.3rem; color: var(--blue); }
.podium__r { width: 28px; height: 28px; flex: none; display: grid; place-items: center; border-radius: 50%; background: rgba(23, 32, 87, .07); font-size: .8rem; }
.hist { margin: 0; padding: 0; list-style: none; display: grid; gap: .45rem; }
.hist li { display: flex; align-items: center; gap: .8rem; padding: .7rem .9rem; border-radius: 16px; background: var(--card); border: 1px solid var(--line); }
.hist__t { display: grid; font-weight: 700; font-size: .9rem; }
.hist__t b { font-weight: 900; }
.hist__t small { color: var(--muted); font-size: .75rem; }

/* ---------- Réglages ---------- */
.field { display: grid; gap: .4rem; }
.field > span { font-size: .82rem; font-weight: 800; color: var(--ink-2); }
.input { width: 100%; height: 52px; padding: 0 1rem; border-radius: 16px; border: 2px solid var(--line); background: var(--card); font-size: 16px; font-weight: 800; outline: none; transition: border-color .2s, box-shadow .2s; }
.input:focus { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(46, 91, 240, .14); }
.list { display: grid; border-radius: 20px; background: var(--card); border: 1px solid var(--line); overflow: hidden; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; width: 100%; padding: .9rem 1rem; text-align: left; cursor: pointer; }
.row + .row { border-top: 1px solid var(--line); }
.row > span { display: grid; grid-template-columns: auto 1fr; column-gap: .7rem; align-items: center; }
.row > span .i { grid-row: span 2; color: var(--blue); width: 1.35em; height: 1.35em; }
.row b { font-weight: 900; }
.row small { grid-column: 2; color: var(--muted); font-weight: 700; font-size: .78rem; }
.switch { appearance: none; -webkit-appearance: none; flex: none; position: relative; width: 52px; height: 30px; margin: 0; border-radius: 999px; background: rgba(23, 32, 87, .16); cursor: pointer; transition: background .3s; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #FFFFFF; box-shadow: 0 2px 6px rgba(0, 0, 0, .25); transition: transform .35s var(--spring); }
.switch:checked { background: var(--green); }
.switch:checked::after { transform: translateX(22px); }
.about { display: grid; justify-items: center; gap: .6rem; margin-top: 2rem; padding: 1.4rem; border-radius: 24px; background: var(--card); border: 1px solid var(--line); text-align: center; }
.about .logo { font-size: 40px; }
.about p { margin: 0; color: var(--ink-2); font-weight: 700; font-size: .9rem; max-width: 34ch; }
.about small { color: var(--muted); font-weight: 800; font-size: .75rem; }

/* ---------- Onglets ---------- */
.tabs { position: fixed; z-index: 40; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(3, 1fr); height: var(--tab-h); padding: 6px 10px env(safe-area-inset-bottom); background: rgba(255, 253, 248, .92); backdrop-filter: blur(16px) saturate(160%); -webkit-backdrop-filter: blur(16px) saturate(160%); border-top: 1px solid var(--line); }
.tabs a { display: grid; justify-items: center; align-content: center; gap: 2px; border-radius: 16px; color: var(--muted); font-size: .7rem; font-weight: 900; transition: color .25s; }
.tabs a .i { width: 25px; height: 25px; transition: transform .35s var(--spring); }
.tabs a.is-on { color: var(--blue); }
.tabs a.is-on .i { transform: translateY(-2px) scale(1.08); }
body.is-game .tabs { display: none; }

/* ---------- Table de jeu ---------- */
.table {
  position: relative; display: grid; place-items: center; padding: clamp(.9rem, 3vw, 1.6rem) clamp(.7rem, 3vw, 1.6rem) clamp(1rem, 3vw, 1.6rem);
  border-radius: 30px; color: #FFFFFF; overflow: hidden;
  background: radial-gradient(ellipse 70% 45% at 50% 100%, rgba(255, 77, 94, .22), transparent 70%), radial-gradient(ellipse 60% 50% at 50% 20%, rgba(79, 140, 255, .35), transparent 70%), linear-gradient(180deg, #1B2C86, #0F1A55);
  box-shadow: 0 8px 0 0 #0A1240, 0 30px 50px -26px rgba(15, 26, 85, .9);
}
.p4__tally { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; font-size: .82rem; color: rgba(230, 236, 255, .78); }
.p4__tally small { font-size: .66rem; font-weight: 900; letter-spacing: .14em; text-transform: uppercase; }
.p4__tally span { display: inline-flex; align-items: baseline; gap: .35rem; font-weight: 800; }
.p4__tally b { font-family: var(--f-display); font-weight: 400; font-size: 1.45rem; color: #FFFFFF; }
.p4__tally i { font-style: normal; opacity: .6; }
.p4__tally em { font-style: normal; font-weight: 800; }
.p4__best { display: inline-flex; align-items: center; gap: .3rem; padding: .2rem .6rem; border-radius: 999px; background: rgba(255, 201, 60, .16); color: var(--gold-2); }
.p4__best .i { width: 15px; height: 15px; }
.table .btn--line { color: #FFFFFF; border-color: rgba(255, 255, 255, .25); }
.rules { margin-top: 1rem; border-radius: 20px; background: var(--card); border: 1px solid var(--line); }
.rules summary { display: flex; align-items: center; gap: .55rem; padding: .9rem 1rem; cursor: pointer; list-style: none; font-weight: 900; color: var(--blue); }
.rules summary::-webkit-details-marker { display: none; }
.rules summary::after { content: '+'; margin-left: auto; font-size: 1.2rem; transition: transform .3s; }
.rules[open] summary::after { transform: rotate(45deg); }
.rules ul { margin: 0; padding: 0 1.1rem 1.1rem 2.2rem; display: grid; gap: .45rem; font-size: .88rem; font-weight: 600; color: var(--ink-2); }

/* ---------- Notifications, confirmations ---------- */
.toasts { position: fixed; z-index: 500; left: 12px; right: 12px; bottom: calc(var(--tab-h) + 12px); display: grid; justify-items: center; gap: .5rem; pointer-events: none; }
body.is-game .toasts { bottom: calc(16px + env(safe-area-inset-bottom)); }
.toast { pointer-events: auto; display: flex; align-items: center; gap: .8rem; max-width: 480px; padding: .75rem .9rem .75rem 1.1rem; border-radius: 18px; background: var(--ink); color: #FFFFFF; font-weight: 800; font-size: .88rem; box-shadow: 0 16px 34px -16px rgba(0, 0, 0, .6); animation: toastIn .45s var(--spring); }
.toast button { flex: none; padding: .45rem .8rem; border-radius: 999px; background: var(--yellow); color: var(--ink); font-weight: 900; font-size: .8rem; }
.toast.is-out { opacity: 0; transform: translateY(10px); transition: opacity .3s, transform .3s; }
@keyframes toastIn { from { opacity: 0; transform: translateY(14px) scale(.95); } }
/* Nouvelle version prête : un bandeau qui reste jusqu'à la mise à jour (le toast de 3 s passait inaperçu).
   Caché pendant une partie pour ne pas gêner le jeu ; il revient dès qu'on quitte la partie. */
.maj { position: fixed; z-index: 450; left: 12px; right: 12px; bottom: calc(var(--tab-h) + 12px); margin: 0 auto; max-width: 480px; display: flex; align-items: center; justify-content: space-between; gap: .8rem; padding: .7rem .75rem .7rem 1rem; border-radius: 18px; background: var(--ink); color: #FFFFFF; box-shadow: 0 16px 34px -16px rgba(0, 0, 0, .6); animation: toastIn .45s var(--spring); }
.maj span { display: flex; align-items: center; gap: .55rem; min-width: 0; font-weight: 800; font-size: .88rem; }
.maj .i { flex: none; color: var(--yellow); }
.maj button { flex: none; min-height: 40px; padding: .5rem .95rem; border-radius: 999px; background: var(--yellow); color: var(--ink); font-weight: 900; font-size: .82rem; }
.maj button:disabled { opacity: .7; }
body.is-game .maj { display: none; }
body:has(.maj) .toasts { bottom: calc(var(--tab-h) + 84px); }
body.is-game:has(.maj) .toasts { bottom: calc(16px + env(safe-area-inset-bottom)); }
.sheet { position: fixed; inset: 0; z-index: 600; display: grid; place-items: end center; padding: 16px; }
.sheet__bg { position: absolute; inset: 0; background: rgba(15, 20, 60, .5); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); opacity: 0; transition: opacity .3s; }
.sheet__box { position: relative; width: min(440px, 100%); padding: 1.4rem; margin-bottom: env(safe-area-inset-bottom); border-radius: 26px; background: var(--card); text-align: center; transform: translateY(30px); opacity: 0; transition: transform .45s var(--spring), opacity .3s; }
.sheet.is-open .sheet__bg { opacity: 1; }
.sheet.is-open .sheet__box { transform: none; opacity: 1; }
.sheet h3 { margin: 0 0 .4rem; font-family: var(--f-display); font-weight: 400; font-size: 1.5rem; }
.sheet p { margin: 0; color: var(--muted); font-weight: 700; }
.sheet__cta { display: flex; gap: .6rem; margin-top: 1.2rem; }
.sheet__cta .btn { flex: 1; }
@media (min-width: 640px) { .sheet { place-items: center; } }

/* ---------- Compte : avatar, écran de connexion, formulaires ---------- */
.av { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--c, var(--blue)); color: #FFFFFF; font-family: var(--f-display); font-size: 1.2rem; line-height: 1; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .18), 0 4px 12px -6px rgba(23, 32, 87, .6); }
.av--lg { width: 64px; height: 64px; font-size: 2rem; }
.hd__me { display: block; border-radius: 50%; transition: transform .3s var(--spring); }
.hd__me:active { transform: scale(.92); }
body.is-auth .hd { display: none; }
body.is-auth .view { padding-top: max(1.2rem, env(safe-area-inset-top)); padding-bottom: calc(2rem + env(safe-area-inset-bottom)); }
body.is-auth .toasts { bottom: calc(16px + env(safe-area-inset-bottom)); }

.auth { display: grid; gap: 1rem; max-width: 460px; margin: 0 auto; }
.auth__brand { display: grid; justify-items: center; padding: .6rem 0 .2rem; }
.auth__brand .logo { font-size: 46px; }
.auth__hello { display: flex; align-items: center; gap: .8rem; }
.auth__bob { flex: none; padding-top: 6px; }
.auth__bubble { flex: 1; margin: 0; padding: .8rem 1rem; border-radius: 20px 20px 20px 6px; background: var(--card); border: 1px solid var(--line); font-weight: 800; font-size: .95rem; box-shadow: 0 10px 24px -16px rgba(23, 32, 87, .6); animation: bubbleIn .6s var(--spring) both; }
.auth__msg { display: flex; align-items: center; gap: .6rem; margin: 0; padding: .75rem .9rem; border-radius: 16px; background: #FFF3C8; color: #7A4F00; font-weight: 800; font-size: .88rem; }
.auth__form { display: grid; gap: .9rem; padding: 1.1rem; border-radius: 26px; background: var(--card); border: 1px solid var(--line); box-shadow: 0 6px 0 -1px rgba(23, 32, 87, .08); }
.auth__fields { display: grid; gap: .9rem; }
.auth__form .btn--block { margin-top: .2rem; }
.auth__link { justify-self: center; padding: .3rem .6rem; color: var(--blue); font-weight: 900; font-size: .88rem; }
.auth__perks { margin: 0; padding: 0; list-style: none; display: grid; gap: .5rem; }
.auth__perks li { display: flex; align-items: center; gap: .7rem; color: var(--ink-2); font-weight: 700; font-size: .86rem; }
.auth__perks .i { color: var(--blue); width: 1.3em; height: 1.3em; }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; border-radius: 999px; background: rgba(23, 32, 87, .07); }
.seg button { height: 44px; padding: 0 .8rem; border-radius: 999px; font-weight: 900; font-size: .88rem; color: var(--ink-2); transition: background .25s, color .25s, box-shadow .25s; }
.seg button.is-on { background: var(--card); color: var(--blue); box-shadow: 0 4px 12px -6px rgba(23, 32, 87, .5); }
.seg--sm button { height: 38px; font-size: .82rem; }

.field__in { position: relative; display: block; }
.field__in .input { padding-right: 3.2rem; }
.field__eye { position: absolute; top: 50%; right: 6px; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; color: var(--muted); transform: translateY(-50%); }
.field__help { color: var(--muted); font-weight: 700; font-size: .76rem; }
.input[aria-invalid="true"] { border-color: var(--red); box-shadow: 0 0 0 4px rgba(255, 77, 94, .14); }
.input::placeholder { color: #A9AECB; font-weight: 700; }
.form-err { margin: 0; padding: .7rem .9rem; border-radius: 14px; background: rgba(255, 77, 94, .1); color: #C9283A; font-weight: 800; font-size: .86rem; text-align: left; }
.sheet form.sheet__box { display: grid; gap: .8rem; text-align: left; }
.sheet form.sheet__box h3, .sheet form.sheet__box > p { text-align: center; }
.sheet form.sheet__box .sheet__cta { margin-top: .4rem; }
.btn.is-busy { color: transparent !important; pointer-events: none; }
.btn.is-busy::after { content: ''; position: absolute; width: 22px; height: 22px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .45); border-top-color: #FFFFFF; animation: gspin .8s linear infinite; }
.btn--line.is-busy::after { border-color: rgba(23, 32, 87, .2); border-top-color: var(--ink); }
.loading .spinner { border-color: rgba(23, 32, 87, .12); border-top-color: var(--blue); }
.loading--sm { min-height: 120px; }
@keyframes gspin { to { transform: rotate(360deg); } }

/* Réglages : carte du compte */
.me { display: flex; align-items: center; gap: 1rem; margin: .4rem 0 1rem; padding: 1rem; border-radius: 24px; background: var(--card); border: 1px solid var(--line); box-shadow: 0 5px 0 -1px rgba(23, 32, 87, .08); }
.me__txt { min-width: 0; display: grid; }
.me__txt b { font-family: var(--f-display); font-weight: 400; font-size: 1.45rem; line-height: 1.15; overflow: hidden; text-overflow: ellipsis; }
.me__txt small { color: var(--muted); font-weight: 700; font-size: .82rem; overflow: hidden; text-overflow: ellipsis; }
.row--danger, .row--danger > span .i { color: #D62F44; }
.row .btn { flex: none; }

/* Invitation aux notifications */
.install__ic--bell { background: rgba(255, 201, 60, .22); color: #B97A00; }
.install__x { flex: none; width: 34px; height: 34px; display: grid; place-items: center; margin-left: -.3rem; border-radius: 50%; color: var(--muted); }

/* Classement */
.rank { margin-top: .7rem; }
.podium li.is-me { background: linear-gradient(135deg, #EAF1FF, #FFFFFF); border-color: rgba(46, 91, 240, .35); }
.podium em { margin-left: .45rem; padding: .1rem .45rem; border-radius: 999px; background: var(--blue); color: #FFFFFF; font-style: normal; font-size: .66rem; font-weight: 900; letter-spacing: .04em; text-transform: uppercase; vertical-align: 2px; }
.podium__r.r1 { background: var(--yellow); }
.podium__r.r2 { background: #D9DEEA; }
.podium__r.r3 { background: #F5C49B; }
.rank__me { margin: .7rem 0 0; text-align: center; font-weight: 800; color: var(--ink-2); }
.rank__me sup { font-size: .65em; }
.rank__old { margin: .3rem 0 0; text-align: center; font-size: .76rem; font-weight: 700; color: var(--muted); }

/* ---------- Rappel des notifications avant une partie ---------- */
.porte { display: grid; gap: 1rem; max-width: 460px; margin: .4rem auto 0; padding: 1.3rem 1.2rem 1.2rem; border-radius: 28px; background: #FFFFFF; border: 1px solid var(--line); box-shadow: 0 8px 0 -1px rgba(23, 32, 87, .08), 0 26px 40px -26px rgba(23, 32, 87, .5); animation: pageIn .45s var(--out); }
.porte__haut { display: flex; align-items: center; gap: .8rem; }
.porte__bob { position: relative; flex: none; padding-top: 6px; }
.porte__cloche { position: absolute; right: -10px; top: -4px; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: var(--yellow); color: var(--ink); box-shadow: 0 6px 14px -6px rgba(0, 0, 0, .5); animation: cloche 1.4s ease-in-out infinite; }
.porte__cloche .i { width: 20px; height: 20px; stroke-width: 2.4; }
@keyframes cloche { 0%, 60%, 100% { transform: rotate(0); } 10%, 30% { transform: rotate(14deg); } 20%, 40% { transform: rotate(-14deg); } }
.porte__bulle { flex: 1; margin: 0; padding: .75rem .95rem; border-radius: 20px 20px 20px 6px; background: #EAF1FF; font-weight: 800; font-size: .92rem; color: var(--ink-2); }
.porte__titre { margin: .2rem 0 0; font-family: var(--f-display); font-weight: 400; font-size: 1.9rem; line-height: 1.05; text-align: center; color: var(--ink); }
.porte__plus { margin: 0; padding: 0; list-style: none; display: grid; gap: .55rem; }
.porte__plus li { display: flex; align-items: center; gap: .75rem; padding: .7rem .85rem; border-radius: 16px; background: #FFF9EC; font-weight: 700; color: var(--ink-2); }
.porte__plus .i { flex: none; width: 1.4em; height: 1.4em; color: var(--blue); }
.porte__plus b, .porte__etapes b { color: var(--ink); }
.porte__txt { margin: 0; color: var(--ink-2); font-weight: 700; text-align: center; }
.porte__etapes { margin: 0; padding: .9rem 1rem .9rem 2.1rem; border-radius: 18px; background: #FFF9EC; display: grid; gap: .5rem; font-weight: 700; color: var(--ink-2); }
.porte__etapes .i { display: inline; width: 1.05em; height: 1.05em; vertical-align: -3px; color: var(--blue); }
.porte__cta { display: grid; gap: .3rem; }
.porte__cta .btn--block { margin-top: .2rem; }
.porte__tard { justify-self: center; padding: .55rem 1rem; color: var(--muted); font-weight: 800; font-size: .86rem; }

/* ---------- Invitation par QR code ---------- */
.invite-card { display: flex; align-items: center; gap: .8rem; margin-top: 1.1rem; padding: .85rem 1rem; border-radius: 22px; color: #FFFFFF; background: radial-gradient(circle at 92% 0%, rgba(255, 255, 255, .25), transparent 45%), linear-gradient(135deg, #FF7A86, var(--red) 60%, #E23A4D); box-shadow: 0 6px 0 0 #C9283A, 0 18px 30px -18px rgba(214, 47, 68, .9); transition: transform .3s var(--spring); }
.invite-card:active { transform: scale(.98); }
.invite-card__ic { flex: none; width: 46px; height: 46px; display: grid; place-items: center; border-radius: 15px; background: #FFFFFF; }
.invite-card__ic svg { width: 34px; height: 34px; }
.invite-card > span:nth-child(2) { flex: 1; min-width: 0; display: grid; }
.invite-card b { font-family: var(--f-display); font-weight: 400; font-size: 1.2rem; line-height: 1.15; }
.invite-card small { font-weight: 700; font-size: .8rem; color: rgba(255, 255, 255, .88); }
.invite { display: grid; gap: 1rem; max-width: 460px; margin: 0 auto; }
.invite__intro { margin: .3rem 0 0; color: var(--ink-2); font-weight: 700; text-align: center; }
.invite__card { display: grid; justify-items: center; gap: .9rem; padding: 1.4rem 1.2rem 1.2rem; border-radius: 28px; background: #FFFFFF; border: 1px solid var(--line); box-shadow: 0 8px 0 -1px rgba(23, 32, 87, .08), 0 26px 40px -26px rgba(23, 32, 87, .5); }
.invite__card .logo { font-size: 34px; }
.invite__qr { width: min(76vw, 300px); aspect-ratio: 1; }
.invite__qr .qr { display: block; width: 100%; height: 100%; }
.invite__de { margin: 0; font-weight: 800; color: var(--muted); }
.invite__de b { color: var(--ink); }
.invite__cta { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.invite__cta .btn { width: 100%; padding: 0 .8rem; }
.invite__compte { margin: 0; padding: .75rem 1rem; border-radius: 16px; background: linear-gradient(135deg, #FFF3C8, #FFE08A); color: #6B4A00; font-weight: 800; text-align: center; }
.invite__steps { margin: 0; padding: 1rem 1.1rem 1rem 2.2rem; border-radius: 20px; background: var(--card); border: 1px solid var(--line); display: grid; gap: .55rem; font-weight: 600; font-size: .9rem; color: var(--ink-2); }
.invite__steps b { color: var(--ink); }
.auth__ami { display: flex; align-items: center; gap: .6rem; margin: 0; padding: .8rem 1rem; border-radius: 16px; background: linear-gradient(135deg, #EAF1FF, #FFFFFF); border: 1px solid rgba(46, 91, 240, .3); font-weight: 800; font-size: .92rem; color: var(--ink-2); animation: bubbleIn .6s var(--spring) both; }
.auth__ami .i { flex: none; color: var(--blue); width: 1.4em; height: 1.4em; }
.auth__ami b { color: var(--ink); }

@media (max-width: 420px) {
  .feat { grid-template-columns: 1fr; }
  .feat__art { width: 62%; justify-self: center; }
  .logo { font-size: 27px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
