/* =========================================================
   Koipourki — thème clair « confettis »
   Crème pêche + corail, touches pastel ; statuts : vert (libre), ambre (réservé), indigo (commandé)
   Toujours clair. Animations désactivées si l'OS le demande.
   ========================================================= */

:root {
  --bg: #fff8f2;
  --bg-2: #ffefe4;
  --surface: #ffffff;
  --surface-2: #fff5ee;
  --text: #2d2433;
  --text-2: #5b5065;
  --muted: #908699;
  --border: #f3e5da;
  --border-strong: #e8d3c3;

  --primary: #ff6b6b;
  --primary-600: #ee4f5d;
  --primary-soft: #ffe7e5;
  --on-primary: #ffffff;
  --grad: linear-gradient(120deg, #ff6b6b 0%, #ff9a6b 45%, #ffcf5c 100%);
  --grad-cool: linear-gradient(120deg, #6c7bff 0%, #a78bfa 100%);

  --libre: #17a383;
  --libre-soft: #dcf6ee;
  --reserve: #e08a00;
  --reserve-soft: #fff0d3;
  --commande: #5a67f2;
  --commande-soft: #e9ebff;
  --danger: #e03e52;

  --av-s: 85%;
  --av-l: 88%;
  --av-fg-l: 32%;

  --radius: 20px;
  --radius-sm: 13px;
  --shadow-sm: 0 1px 2px rgba(120, 60, 40, .06), 0 3px 10px rgba(120, 60, 40, .05);
  --shadow: 0 2px 4px rgba(120, 60, 40, .05), 0 12px 30px -10px rgba(120, 60, 40, .18);
  --shadow-lg: 0 6px 14px rgba(120, 60, 40, .07), 0 26px 50px -18px rgba(150, 70, 50, .32);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  color-scheme: light;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 90px; }
body {
  margin: 0;
  min-height: 100vh;
  font: 16px/1.55 "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", sans-serif;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  background-color: var(--bg);
  /* confettis discrets */
  background-image:
    radial-gradient(circle at 12px 14px, rgba(255, 107, 107, .18) 2.5px, transparent 3px),
    radial-gradient(circle at 58px 46px, rgba(90, 103, 242, .14) 2.5px, transparent 3px),
    radial-gradient(circle at 92px 18px, rgba(255, 207, 92, .30) 3px, transparent 3.5px),
    radial-gradient(circle at 34px 84px, rgba(23, 163, 131, .14) 2px, transparent 2.5px);
  background-size: 120px 110px;
  overflow-x: hidden;
}
h1, h2, h3 { font-family: "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, sans-serif; letter-spacing: -.02em; line-height: 1.15; }
h1 { font-size: clamp(1.7rem, 4vw, 2.4rem); margin: .1em 0 .2em; font-weight: 800; }
h2 { font-size: 1.3rem; margin: 0 0 .3em; font-weight: 700; }
h3 { font-size: 1.02rem; margin: 0; font-weight: 650; }
a { color: var(--primary-600); text-underline-offset: 3px; }
img { max-width: 100%; }
p { margin: .4em 0; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.center { text-align: center; }
.big { font-size: 3.2rem; margin: 0; line-height: 1.2; }
.inline { display: inline; margin: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary) 55%, transparent); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--primary-soft); }

/* ---------- Décor animé en fond ---------- */
.bg-deco { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.bg-deco span {
  position: absolute; width: 46vmax; height: 46vmax; border-radius: 50%;
  filter: blur(80px); opacity: .4; animation: float 26s ease-in-out infinite alternate;
}
.bg-deco span:nth-child(1) { background: #ffb4bd; top: -18vmax; left: -12vmax; opacity: .55; }
.bg-deco span:nth-child(2) { background: #ffe08a; bottom: -22vmax; right: -14vmax; animation-delay: -9s; opacity: .55; }
.bg-deco span:nth-child(3) { background: #b5d8ff; top: 30%; left: 55%; width: 30vmax; height: 30vmax; animation-delay: -16s; opacity: .45; }
@keyframes float {
  0%   { transform: translate(0, 0) scale(1); }
  50%  { transform: translate(6vmax, 4vmax) scale(1.08); }
  100% { transform: translate(-4vmax, 7vmax) scale(.95); }
}

/* ---------- Barre du haut ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, #ffffff 72%, transparent);
  backdrop-filter: saturate(1.6) blur(14px);
  -webkit-backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
}
.topbar-inner {
  max-width: 1180px; margin: 0 auto; padding: 10px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); font-weight: 800; letter-spacing: -.02em; }
.brand-logo {
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px;
  background: var(--grad); background-size: 200% 200%; box-shadow: var(--shadow-sm); font-size: 1.2rem;
  animation: grad-shift 8s ease infinite;
}
.brand:hover .brand-logo { animation: wiggle .6s var(--spring), grad-shift 8s ease infinite; }
@keyframes wiggle { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-12deg) scale(1.08); } 60% { transform: rotate(10deg); } }
@keyframes grad-shift { 0%, 100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }

.nav { display: flex; align-items: center; gap: 2px; }
.nav a, .nav-btn {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--text-2); text-decoration: none; padding: 8px 12px; border-radius: 999px;
  font: inherit; font-size: .93rem; font-weight: 550; background: none; border: 0; cursor: pointer;
  transition: background .2s, color .2s;
}
.nav a:hover, .nav-btn:hover { background: var(--surface-2); color: var(--text); }
.nav a.active { background: var(--primary-soft); color: var(--primary-600); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--primary) 30%, transparent); }
@media (max-width: 720px) {
  .brand-name, .nav-label { display: none; }
  .nav a, .nav-btn { padding: 8px 11px; font-size: 1.1rem; }
}

.container { max-width: 1180px; margin: 0 auto; padding: 22px 16px 80px; }
body.bare .container { padding-top: 24px; }

/* ---------- Fil d'Ariane ---------- */
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: .88rem; margin-bottom: 14px; animation: fade .4s var(--ease) both; }
.crumbs a { color: var(--muted); text-decoration: none; padding: 2px 8px; border-radius: 8px; transition: background .2s, color .2s; }
.crumbs a:hover { background: var(--surface-2); color: var(--text); }
.crumbs .sep { color: var(--border-strong); }
.crumbs [aria-current] { color: var(--text); font-weight: 600; padding: 2px 8px; }

/* ---------- En-têtes de page ---------- */
.hero {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap;
  margin: 6px 0 22px; animation: rise .6s var(--ease) both;
}
.hero-public { justify-content: center; text-align: center; }
.eyebrow { margin: 0; font-size: .82rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--primary-600); }
.page-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; animation: rise .5s var(--ease) both; }
.page-head h1 { margin: 0; }
.page-head p { margin: 2px 0 0; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 30px 0 14px; }
.section-head h2 { margin: 0; }
.section-title { margin: 32px 0 14px; }
.list-desc { color: var(--text-2); margin: -8px 0 20px; max-width: 70ch; }

/* ---------- Cartes / grilles ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 22px;
}
.narrow { max-width: 680px; margin-left: auto; margin-right: auto; }
.empty { text-align: center; padding: 48px 20px; }
.empty h2 { margin-top: 8px; }
.pop { animation: pop .5s var(--ease) both; }
.grid { display: grid; gap: 18px; }
.events-grid { grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.kids-grid { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.gifts-grid { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.givers-grid { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
@media (max-width: 400px) { .givers-grid { grid-template-columns: 1fr; } }

.grid > .card, .kpi { animation: rise .55s var(--ease) both; animation-delay: calc(min(var(--i, 0), 12) * 55ms); }
.reveal { animation: rise .4s var(--ease) both !important; animation-delay: calc(min(var(--i, 0), 12) * 40ms) !important; }

a.card { text-decoration: none; color: inherit; transition: transform .35s var(--spring), box-shadow .35s var(--ease), border-color .3s; }
a.card:hover, .gift-card:hover, .giver-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--border-strong); }
a.card:active { transform: translateY(-1px) scale(.99); }

.tag {
  display: inline-flex; align-items: center; gap: 4px; font-size: .8rem; padding: 3px 10px; border-radius: 999px;
  background: var(--primary-soft); color: var(--primary-600); font-weight: 650;
}

/* Événements */
.event-card { display: flex; flex-direction: column; gap: 10px; position: relative; overflow: hidden; }
.event-card::before {
  content: ""; position: absolute; inset: 0 0 auto; height: 4px; background: var(--grad); background-size: 200% 100%;
  transform: scaleX(.25); transform-origin: left; transition: transform .6s var(--ease);
}
.event-card:hover::before { transform: scaleX(1); animation: grad-shift 3s ease infinite; }
.event-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.event-card h2 { margin: 2px 0 0; }
.event-stats { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .9rem; color: var(--muted); }
.event-stats strong { color: var(--text); }
.avatars { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.avatars .avatar + .avatar { margin-left: -12px; }
.avatars .muted { margin-left: 6px; }

/* Enfants */
.kid-card { display: flex; flex-direction: column; gap: 14px; }
.kid-head { display: flex; align-items: center; gap: 14px; }
.kid-head h1, .kid-head h2, .kid-head h3 { margin: 0; }
.kid-stats { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 6px; color: var(--muted); }
.kid-stats .dot:not(:first-child) { margin-left: 8px; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dot-libre { background: var(--libre); }
.dot-reserve { background: var(--reserve); }
.dot-commande { background: var(--commande); }
.kid-section { margin-top: 34px; scroll-margin-top: 140px; }
.kid-progress { display: flex; align-items: center; gap: 10px; min-width: 220px; }
.kid-progress .progress { flex: 1; }
.kid-chip {
  display: inline-block; font-size: .75rem; font-weight: 700; padding: 1px 8px; border-radius: 999px; white-space: nowrap;
  background: hsl(var(--h) var(--av-s) var(--av-l)); color: hsl(var(--h) 45% var(--av-fg-l));
}

/* Avatars (couleur stable par prénom) */
.avatar {
  --size: 36px;
  display: inline-grid; place-items: center; flex: none;
  width: var(--size); height: var(--size); border-radius: 50%;
  font-size: calc(var(--size) * .38); font-weight: 800; letter-spacing: -.02em;
  background: hsl(var(--h) var(--av-s) var(--av-l)); color: hsl(var(--h) 45% var(--av-fg-l));
  box-shadow: 0 0 0 3px var(--surface);
  transition: transform .3s var(--spring);
}
.avatar-xs { --size: 22px; box-shadow: none; vertical-align: middle; }
.avatar-sm { --size: 26px; box-shadow: none; vertical-align: middle; }
.avatar-lg { --size: 50px; }
.avatar-xl { --size: 72px; }
a.card:hover .avatar { transform: scale(1.08) rotate(-4deg); }

/* Progression */
.progress { position: relative; height: 8px; border-radius: 999px; background: var(--libre-soft); overflow: hidden; }
.progress span { position: absolute; inset: 0 auto 0 0; width: var(--w); border-radius: 999px; animation: grow 1.1s var(--ease) both .2s; }
.progress-reserve { background: var(--reserve); }
.progress-commande { background: var(--commande); }
@keyframes grow { from { width: 0; } }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 8px; }
.kpi {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 16px;
  display: flex; flex-direction: column; gap: 2px; box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
}
.kpi::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--border-strong); }
.kpi-value { font-size: 1.55rem; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.kpi-label { font-size: .82rem; color: var(--muted); }
.kpi-libre::after { background: var(--libre); }
.kpi-reserve::after { background: var(--reserve); }
.kpi-commande::after { background: var(--commande); }
.kpi-libre .kpi-value { color: var(--libre); }
.kpi-reserve .kpi-value { color: var(--reserve); }
.kpi-commande .kpi-value { color: var(--commande); }

/* ---------- Cadeaux ---------- */
.gift-card { padding: 0; overflow: hidden; display: flex; flex-direction: column; transition: transform .35s var(--spring), box-shadow .35s var(--ease), border-color .3s; }
.gift-media {
  position: relative; aspect-ratio: 4 / 3; background: #fff;
  display: grid; place-items: center; border-bottom: 1px solid var(--border); overflow: hidden;
}
.gift-media img { width: 100%; height: 100%; object-fit: contain; padding: 14px; transition: transform .6s var(--ease); }
.gift-card:hover .gift-media img { transform: scale(1.06); }
.gift-media .placeholder, .gift-media.noimg::after { font-size: 3rem; opacity: .45; }
.gift-media.noimg::after { content: "🎁"; }
.prio {
  position: absolute; top: 10px; right: 10px; font-size: .78rem; letter-spacing: 1px; color: var(--primary);
  background: color-mix(in srgb, var(--surface) 88%, transparent); padding: 1px 8px; border-radius: 999px;
  backdrop-filter: blur(4px);
}
.gift-ribbon { position: absolute; left: 10px; bottom: 10px; right: 10px; display: flex; }
.gift-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.gift-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.price { font-weight: 800; font-size: 1.12rem; letter-spacing: -.02em; white-space: nowrap; }
.store { display: inline-flex; align-items: center; gap: 6px; font-size: .84rem; color: var(--muted); }
.store img { border-radius: 4px; }
.clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; font-size: .88rem; margin: 0; }
.gift-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: auto; padding-top: 10px; }
.gift-actions form { margin: 0; }

.gift-card.is-libre { border-top: 3px solid var(--libre); }
.gift-card.is-reserve { border-top: 3px solid var(--reserve); }
.gift-card.is-commande { border-top: 3px solid var(--commande); }
.gift-card.is-reserve .gift-media img, .gift-card.is-commande .gift-media img { filter: saturate(.75); }
.gift-card.flash { animation: rise .5s var(--ease) both, flash 1.6s ease .3s 2; }
@keyframes flash { 50% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 45%, transparent), var(--shadow-lg); } }

/* Badges de statut */
.status {
  display: inline-flex; align-items: center; gap: 4px; max-width: 100%;
  font-size: .78rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  border: 1px solid transparent;
}
.gift-ribbon .status { box-shadow: var(--shadow-sm); animation: pop .4s var(--spring) both .25s; }
.status-libre { background: var(--libre-soft); color: var(--libre); border-color: color-mix(in srgb, var(--libre) 25%, transparent); }
.status-reserve { background: var(--reserve-soft); color: var(--reserve); border-color: color-mix(in srgb, var(--reserve) 30%, transparent); }
.status-commande { background: var(--commande-soft); color: var(--commande); border-color: color-mix(in srgb, var(--commande) 30%, transparent); }

/* Filtres / onglets */
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 18px; }
.sticky-tabs {
  position: sticky; top: 64px; z-index: 20; padding: 8px 0;
  background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(10px);
}
.chip {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  font: inherit; font-size: .88rem; font-weight: 600; text-decoration: none; color: var(--text-2);
  padding: 6px 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border);
  transition: all .25s var(--ease);
}
.chip b { font-weight: 700; font-size: .78rem; padding: 0 7px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.chip:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.chip.active { background: var(--primary); color: #fff; border-color: var(--primary); box-shadow: 0 6px 16px -8px var(--primary); }
.chip.active b { background: color-mix(in srgb, var(--bg) 20%, transparent); color: inherit; }
.chip-libre.active { background: var(--libre); border-color: var(--libre); color: #fff; }
.chip-reserve.active { background: var(--reserve); border-color: var(--reserve); color: #fff; }
.chip-commande.active { background: var(--commande); border-color: var(--commande); color: #fff; }

/* Panneau « Qui offre ? » et « Je l'offre » */
.assign, .reserve { width: 100%; }
.assign summary, .reserve summary { list-style: none; }
.assign summary::-webkit-details-marker, .reserve summary::-webkit-details-marker { display: none; }
.reserve[open] summary { display: none; }
.assign-form, .reserve-form {
  display: flex; flex-direction: column; gap: 10px; margin-top: 10px; padding: 12px;
  background: var(--surface-2); border-radius: var(--radius-sm); animation: drop .3s var(--ease) both;
}
.assign-form label { display: flex; flex-direction: column; gap: 4px; font-size: .82rem; font-weight: 650; }
.reserve-form { flex-direction: row; flex-wrap: wrap; align-items: center; }
.reserve-form input[type=text] { flex: 1 1 140px; }
@keyframes drop { from { opacity: 0; transform: translateY(-6px); } }

/* Contrôle segmenté (statut) */
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); }
.seg label { position: relative; cursor: pointer; }
.seg input { position: absolute; opacity: 0; inset: 0; }
.seg span { display: block; text-align: center; padding: 6px 4px; border-radius: 9px; font-size: .78rem; font-weight: 650; color: var(--muted); transition: all .25s var(--ease); }
.seg input:focus-visible + span { outline: 2px solid var(--primary); }
.seg-libre input:checked + span { background: var(--libre-soft); color: var(--libre); }
.seg-reserve input:checked + span { background: var(--reserve-soft); color: var(--reserve); }
.seg-commande input:checked + span { background: var(--commande-soft); color: var(--commande); }

/* ---------- Récap ---------- */
.table-card { padding: 0; overflow: hidden; }
.table-scroll { overflow-x: auto; }
.matrix { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: .92rem; }
.matrix th, .matrix td { padding: 12px 16px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--border); }
.matrix th:first-child { text-align: left; }
.matrix thead th { background: var(--surface-2); font-size: .82rem; color: var(--text-2); font-weight: 700; }
.matrix tbody tr { transition: background .2s; }
.matrix tbody tr:hover { background: var(--surface-2); }
.matrix td.zero { color: var(--border-strong); }
.matrix .total { font-weight: 800; background: color-mix(in srgb, var(--primary-soft) 60%, transparent); }
.matrix tfoot th, .matrix tfoot td { font-weight: 800; border-bottom: 0; background: var(--surface-2); }

.giver-card { display: flex; flex-direction: column; gap: 12px; transition: transform .35s var(--spring), box-shadow .35s var(--ease); }
.giver-head { display: flex; align-items: center; gap: 12px; }
.giver-head > div { flex: 1; min-width: 0; }
.giver-total { font-size: 1.35rem; font-weight: 800; letter-spacing: -.03em; color: hsl(var(--h) 55% 45%); }
.bar { height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.bar span { display: block; height: 100%; width: var(--w); border-radius: inherit; background: hsl(var(--h) 65% 60%); animation: grow 1.2s var(--ease) both .3s; }
.giver-gifts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.giver-gifts li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px dashed var(--border); font-size: .9rem; }
.giver-gifts li:first-child { border-top: 0; }
.giver-gift-title { min-width: 0; display: flex; align-items: center; gap: 6px; }
.giver-gift-title a { color: var(--text); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.giver-gift-title a:hover { color: var(--primary-600); text-decoration: underline; }
.giver-gift-meta { display: flex; align-items: center; gap: 8px; flex: none; }

/* Page publique */
.howto { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px 18px; margin: -6px 0 22px; font-size: .9rem; color: var(--text-2); }
.howto b { display: inline-grid; place-items: center; width: 22px; height: 22px; margin-right: 4px; border-radius: 50%; background: var(--primary); color: var(--on-primary); font-size: .75rem; }
.mine { margin-bottom: 20px; border-color: color-mix(in srgb, var(--primary) 35%, var(--border)); }
.mine summary { cursor: pointer; list-style: none; }
.mine summary::-webkit-details-marker { display: none; }
.mine .giver-gifts { margin-top: 10px; }

/* ---------- Formulaires ---------- */
.form { display: flex; flex-direction: column; gap: 16px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-weight: 650; font-size: .92rem; }
.form label small { font-weight: 400; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 560px) { .row { grid-template-columns: 1fr; } }

input[type=text], input[type=email], input[type=password], input[type=url], input[type=number], input[type=date], select, textarea {
  width: 100%; font: inherit; font-weight: 400; color: var(--text);
  background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--radius-sm); padding: 10px 13px;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
input:hover, select:hover, textarea:hover { border-color: var(--border-strong); }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 18%, transparent);
}
textarea { resize: vertical; }
textarea.code { font: .8rem/1.4 ui-monospace, Consolas, monospace; }
select { appearance: none; padding-right: 36px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 55%, calc(100% - 13px) 55%; background-size: 5px 5px; background-repeat: no-repeat; }
label.check { flex-direction: row !important; align-items: center; gap: 8px; font-weight: 500 !important; }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--primary); }

/* Interrupteur */
.switch { flex-direction: row !important; align-items: center; gap: 12px !important; font-weight: 550 !important; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-ui { flex: none; width: 44px; height: 26px; border-radius: 999px; background: var(--border-strong); position: relative; transition: background .3s var(--ease); }
.switch-ui::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .35s var(--spring);
}
.switch input:checked + .switch-ui { background: var(--primary); }
.switch input:checked + .switch-ui::after { transform: translateX(18px); }
.switch input:focus-visible + .switch-ui { outline: 3px solid color-mix(in srgb, var(--primary) 50%, transparent); outline-offset: 2px; }

.input-btn { display: flex; gap: 8px; }
.input-btn input { flex: 1; min-width: 0; }

.preview { display: grid; grid-template-columns: 130px 1fr; gap: 16px; align-items: start; }
.preview-img {
  width: 130px; height: 130px; border: 1.5px dashed var(--border-strong); border-radius: var(--radius-sm); background: #fff;
  display: grid; place-items: center; overflow: hidden; font-size: 2.6rem;
}
.preview-img img { width: 100%; height: 100%; object-fit: contain; padding: 6px; animation: pop .4s var(--spring) both; }
.preview-fields { display: flex; flex-direction: column; gap: 14px; }
@media (max-width: 560px) {
  .preview { grid-template-columns: 1fr; }
  .preview-img { width: 100%; height: 190px; }
}

.analyse-status { font-size: .9rem; padding: 10px 14px; border-radius: var(--radius-sm); animation: drop .3s var(--ease) both; }
.analyse-status:empty { display: none; }
.as-loading {
  color: var(--muted); background: linear-gradient(90deg, var(--surface-2) 25%, var(--bg-2) 50%, var(--surface-2) 75%);
  background-size: 200% 100%; animation: shimmer 1.2s linear infinite;
}
.as-ok { background: var(--libre-soft); color: var(--libre); }
.as-warn { background: var(--reserve-soft); color: var(--reserve); }
.as-error { background: color-mix(in srgb, var(--danger) 12%, var(--surface)); color: var(--danger); }
.analyse-status a { color: inherit; font-weight: 700; }
@keyframes shimmer { to { background-position: -200% 0; } }

.actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 6px; }

/* ---------- Boutons ---------- */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-weight: 650; font-size: .93rem; text-decoration: none; white-space: nowrap; line-height: 1.2;
  padding: 10px 17px; border-radius: var(--radius-sm); cursor: pointer;
  border: 1.5px solid var(--border); background: var(--surface); color: var(--text);
  transition: transform .2s var(--spring), background .2s, border-color .2s, box-shadow .2s, color .2s;
}
.btn:hover { border-color: var(--border-strong); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.btn:active { transform: translateY(0) scale(.97); }
.btn:disabled { opacity: .6; cursor: wait; transform: none; }
.btn-primary {
  background: var(--grad); background-size: 180% 100%; background-position: 0% 50%;
  border-color: transparent; color: #fff; box-shadow: 0 6px 18px -8px var(--primary);
  transition: transform .2s var(--spring), background-position .5s var(--ease), box-shadow .25s;
}
.btn-primary:hover { background-position: 100% 50%; border-color: transparent; box-shadow: 0 10px 24px -8px var(--primary); }
.btn-accent { background: var(--grad-cool); background-size: 180% 100%; color: #fff; border-color: transparent; box-shadow: 0 6px 18px -8px #6c7bff; }
.btn-accent:hover { border-color: transparent; background-position: 100% 50%; box-shadow: 0 10px 24px -8px #6c7bff; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); border-color: transparent; box-shadow: none; }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: color-mix(in srgb, var(--danger) 10%, var(--surface)); color: var(--danger); }
.btn-commande { background: var(--commande-soft); color: var(--commande); border-color: color-mix(in srgb, var(--commande) 30%, transparent); }
.btn-sm { padding: 6px 11px; font-size: .84rem; border-radius: 10px; }
.btn-lg { padding: 13px 22px; font-size: 1rem; }
.btn-block { width: 100%; }
.btn-back { width: 44px; height: 44px; padding: 0; font-size: 1.25rem; border-radius: 50%; background: var(--surface); border-color: var(--border); }
.btn.is-done { background: var(--libre); border-color: var(--libre); color: #fff; }
.btn.is-loading { color: transparent !important; pointer-events: none; }
.btn.is-loading::after {
  content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid currentColor; border-color: var(--muted) transparent var(--muted) transparent; animation: spin .7s linear infinite;
}
.btn-primary.is-loading::after { border-color: #fff transparent #fff transparent; }
@keyframes spin { to { transform: rotate(360deg); } }
.bookmarklet { font-size: 1.1rem; padding: 14px 26px; cursor: grab; animation: bounce 2.4s var(--ease) infinite; }
@keyframes bounce { 0%, 80%, 100% { transform: translateY(0); } 88% { transform: translateY(-6px); } 94% { transform: translateY(0); } }

kbd { border: 1px solid var(--border-strong); border-bottom-width: 3px; border-radius: 6px; padding: 0 6px; font-size: .85em; background: var(--surface-2); }

/* ---------- Alertes & notifications ---------- */
.alert { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; border: 1px solid; animation: drop .35s var(--ease) both; }
.alert-success { background: var(--libre-soft); border-color: color-mix(in srgb, var(--libre) 30%, transparent); }
.alert-error { background: color-mix(in srgb, var(--danger) 10%, var(--surface)); border-color: color-mix(in srgb, var(--danger) 35%, transparent); color: var(--danger); }
.alert-info { background: var(--commande-soft); border-color: color-mix(in srgb, var(--commande) 25%, transparent); }

.toasts { position: fixed; top: 76px; right: 16px; z-index: 100; display: flex; flex-direction: column; gap: 10px; max-width: min(380px, calc(100vw - 32px)); }
.toast {
  padding: 13px 18px 13px 44px; border-radius: 14px; cursor: pointer; position: relative;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg); font-size: .93rem; font-weight: 550;
  animation: toast-in .5s var(--spring) both;
}
.toast::before { position: absolute; left: 15px; top: 12px; font-size: 1.05rem; }
.toast-success::before { content: "✅"; }
.toast-error::before { content: "⚠️"; }
.toast-info::before { content: "💡"; }
.toast-success { border-left: 4px solid var(--libre); }
.toast-error { border-left: 4px solid var(--danger); }
.toast-info { border-left: 4px solid var(--commande); }
.toast.out { animation: toast-out .4s var(--ease) both; }
@keyframes toast-in { from { opacity: 0; transform: translateX(40px) scale(.95); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(40px); } }

/* ---------- Partage du lien ---------- */
.share { margin-top: 30px; }
.share-row { display: flex; flex-direction: column; gap: 10px; }
.share-row p { margin: 2px 0 0; }
.copy { display: flex; gap: 8px; flex-wrap: wrap; }
.copy input { flex: 1 1 260px; font-size: .88rem; background: var(--surface-2); }

/* Liens par enfant */
.share h2 { margin-bottom: 4px; }
.share-top { margin: -6px 0 22px; padding: 16px 20px; }
.share-top .share-row { gap: 8px; }
.share-list { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.share-item {
  display: grid; grid-template-columns: 150px 1fr; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2);
  animation: rise .45s var(--ease) both;
}
.share-who { display: flex; align-items: center; gap: 8px; min-width: 0; }
.share-who strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 600px) { .share-item { grid-template-columns: 1fr; } }
.share-all { margin-top: 16px; font-size: .9rem; color: var(--text-2); }
.share-all summary { cursor: pointer; width: fit-content; }
.share-all .copy { margin-top: 10px; }
.public-kid { display: flex; justify-content: center; margin: 10px 0 4px; }
.public-kid .avatar { animation: pop .6s var(--spring) both .1s; box-shadow: 0 0 0 5px #fff, var(--shadow); }

/* ---------- Connexion / inscription « wow » ---------- */
body.bare:has(.auth-wow) .container { max-width: none; padding: 0; }
body:has(.auth-wow) .bg-deco { display: none; }
.auth-wow { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); min-height: 100vh; }
.auth-scene, .auth-panel { min-width: 0; }

/* Scène de gauche : dégradé vivant, cadeaux flottants, confettis */
.auth-scene {
  position: relative; overflow: hidden; isolation: isolate;
  display: flex; align-items: center; padding: 56px clamp(28px, 6vw, 88px);
  color: #fff;
  background:
    radial-gradient(60% 60% at 15% 20%, #ff9a6b 0%, transparent 60%),
    radial-gradient(55% 55% at 85% 15%, #ffcf5c 0%, transparent 60%),
    radial-gradient(70% 70% at 80% 90%, #a78bfa 0%, transparent 60%),
    radial-gradient(60% 60% at 10% 95%, #6c7bff 0%, transparent 60%),
    #ff6b6b;
  background-size: 160% 160%;
  animation: mesh 18s ease-in-out infinite alternate;
}
@keyframes mesh {
  0%   { background-position: 0% 0%; }
  50%  { background-position: 60% 40%; }
  100% { background-position: 100% 100%; }
}
.auth-scene::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: radial-gradient(circle at 50% 120%, rgba(255, 255, 255, .25), transparent 55%);
}

.confetti { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.confetti i {
  position: absolute; top: -20px; left: var(--x); width: var(--w); height: calc(var(--w) * .45);
  background: var(--c); border-radius: 2px; opacity: .9;
  animation: fall var(--d) linear infinite; animation-delay: var(--delay);
}
.confetti i:nth-child(3n) { border-radius: 50%; height: var(--w); }
@keyframes fall {
  0%   { transform: translate3d(0, -5vh, 0) rotate(var(--r)); }
  50%  { transform: translate3d(28px, 50vh, 0) rotate(calc(var(--r) + 360deg)); }
  100% { transform: translate3d(-12px, 108vh, 0) rotate(calc(var(--r) + 720deg)); }
}

.floaters { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.floaters span {
  position: absolute; left: var(--x); top: var(--y); font-size: var(--s);
  filter: drop-shadow(0 10px 18px rgba(80, 20, 40, .25));
  animation: bob var(--t) ease-in-out infinite; animation-delay: var(--delay);
  opacity: .9;
}
@keyframes bob {
  0%, 100% { transform: translateY(0) rotate(-6deg); }
  50%      { transform: translateY(-18px) rotate(6deg); }
}

.auth-pitch { position: relative; max-width: 520px; animation: rise .8s var(--ease) both .1s; }
.auth-badge {
  width: 72px; height: 72px; border-radius: 22px; display: grid; place-items: center; font-size: 2.3rem;
  background: rgba(255, 255, 255, .22); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .35), 0 12px 30px -10px rgba(80, 20, 40, .4);
  animation: wiggle 2.8s var(--spring) infinite 1s;
}
.auth-pitch h1 {
  font-size: clamp(2.4rem, 5.2vw, 4.2rem); line-height: 1.02; margin: 26px 0 16px; font-weight: 900; letter-spacing: -.04em;
  text-shadow: 0 6px 30px rgba(120, 30, 60, .25);
}
.auth-pitch h1 span {
  background: linear-gradient(90deg, #fff 0%, #fff4c2 40%, #fff 80%); background-size: 200% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: sheen 4s linear infinite;
}
@keyframes sheen { to { background-position: -200% 0; } }
.auth-pitch > p { font-size: 1.1rem; line-height: 1.6; opacity: .95; max-width: 44ch; margin: 0 0 22px; }
.auth-perks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.auth-perks li {
  display: flex; align-items: center; gap: 12px; width: fit-content;
  padding: 9px 16px 9px 9px; border-radius: 999px; font-weight: 600; font-size: .95rem;
  background: rgba(255, 255, 255, .18); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .3);
  animation: rise .6s var(--ease) both;
}
.auth-perks li:nth-child(1) { animation-delay: .35s; }
.auth-perks li:nth-child(2) { animation-delay: .5s; }
.auth-perks li:nth-child(3) { animation-delay: .65s; }
.auth-perks b { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: #fff; font-size: 1rem; }

/* Panneau de droite : carte formulaire */
.auth-panel {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  padding: 40px 24px; position: relative; isolation: isolate;
}
.auth-panel::before {
  content: ""; position: absolute; width: 420px; height: 420px; max-width: 100%; border-radius: 50%; z-index: -1;
  background: radial-gradient(circle, rgba(255, 107, 107, .22), transparent 65%);
  animation: float 14s ease-in-out infinite alternate;
}
.auth-card {
  width: 100%; max-width: 420px; padding: 38px 34px 30px;
  background: rgba(255, 255, 255, .86); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, .9); border-radius: 28px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .8) inset, var(--shadow-lg);
  animation: card-in .8s var(--spring) both .15s;
}
@keyframes card-in { from { opacity: 0; transform: translateY(24px) scale(.96); } }
.auth-head h2 { font-size: 1.85rem; margin: 0 0 4px; font-weight: 850; }
.auth-head p { margin: 0 0 22px; }
.auth-form { display: flex; flex-direction: column; gap: 14px; }

/* Champs à libellé flottant */
.field { position: relative; }
.field input {
  width: 100%; height: 58px; padding: 22px 46px 6px 46px; font-size: 1rem;
  border: 1.5px solid var(--border); border-radius: 16px; background: var(--surface);
  transition: border-color .25s, box-shadow .25s, transform .25s var(--spring);
}
.field input:focus { transform: translateY(-1px); }
.field label {
  position: absolute; left: 46px; top: 50%; transform: translateY(-50%); transform-origin: left center;
  color: var(--muted); font-size: 1rem; pointer-events: none;
  transition: transform .25s var(--ease), color .25s, top .25s var(--ease);
}
.field input:focus + label,
.field input:not(:placeholder-shown) + label { top: 17px; transform: translateY(-50%) scale(.78); color: var(--primary-600); font-weight: 650; }
.field-icon { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); font-size: 1.05rem; opacity: .75; transition: transform .3s var(--spring); }
.field input:focus ~ .field-icon { transform: translateY(-50%) scale(1.18) rotate(-8deg); opacity: 1; }
.field-eye {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  width: 40px; height: 40px; border: 0; border-radius: 12px; background: transparent; cursor: pointer; font-size: 1.05rem;
  transition: background .2s;
}
.field-eye:hover { background: var(--surface-2); }

/* Bouton avec reflet qui passe */
.btn-shine { overflow: hidden; margin-top: 6px; height: 54px; font-size: 1.05rem; border-radius: 16px; }
.btn-shine span { display: inline-block; transition: transform .3s var(--spring); }
.btn-shine:hover span { transform: translateX(5px); }
.btn-shine::before {
  content: ""; position: absolute; top: 0; left: -60%; width: 40%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .55), transparent);
  transform: skewX(-20deg); animation: shine 3.2s ease-in-out infinite 1.2s;
}
@keyframes shine { 0% { left: -60%; } 35%, 100% { left: 130%; } }

.auth-switch { text-align: center; margin: 18px 0 0; color: var(--muted); font-size: .93rem; }
.auth-switch a { font-weight: 700; }
.auth-foot { font-size: .85rem; color: var(--muted); margin: 0; }

.shake { animation: shake .5s var(--ease) both; }
@keyframes shake {
  20%, 60% { transform: translateX(-7px); }
  40%, 80% { transform: translateX(7px); }
}

@media (max-width: 900px) {
  .auth-wow { grid-template-columns: minmax(0, 1fr); }
  .auth-scene { padding: 40px 24px 70px; }
  .auth-pitch h1 { margin: 16px 0 10px; }
  .auth-perks { display: none; }
  .auth-panel { margin-top: -50px; padding-top: 0; }
  .floaters span { opacity: .45; }
  .floaters span:nth-child(n+4) { display: none; }
}
@media (max-width: 480px) {
  .auth-pitch > p { font-size: 1rem; }
  .auth-card { padding: 28px 20px 24px; border-radius: 24px; }
}

/* ---------- Zone avancée ---------- */
.danger-zone { margin-top: 36px; color: var(--muted); }
.danger-zone summary { cursor: pointer; font-size: .9rem; width: fit-content; }
.danger-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.danger-actions form, .danger-zone-inline form { margin: 0; }
.danger-zone-inline { margin-top: 40px; display: flex; justify-content: center; }

/* ---------- Animations génériques ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
@keyframes pop { from { opacity: 0; transform: scale(.97); } }
@keyframes fade { from { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; animation-delay: 0s !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .bg-deco { display: none; }
}

/* ---------- Impression (récap) ---------- */
@media print {
  .topbar, .bg-deco, .toasts, .crumbs, .filters, .btn, .head-actions, .danger-zone { display: none !important; }
  body { background: #fff; color: #000; }
  .card, .kpi { box-shadow: none; break-inside: avoid; animation: none !important; }
  .grid > .card { animation: none !important; }
}

/* ---------- Connexion Google ---------- */
.btn-google {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  height: 54px; border-radius: 16px; text-decoration: none;
  background: #fff; color: #1f1f1f; border: 1.5px solid #dadce0;
  font-weight: 650; font-size: 1rem; font-family: inherit;
  box-shadow: var(--shadow-sm);
  transition: transform .2s var(--spring), box-shadow .25s, border-color .2s, background .2s;
}
.btn-google:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: #c4c7c5; background: #f8faff; }
.btn-google:active { transform: translateY(0) scale(.98); }
.btn-google .g-logo { transition: transform .5s var(--spring); }
.btn-google:hover .g-logo { transform: rotate(360deg); }
.auth-or { display: flex; align-items: center; gap: 12px; margin: 18px 0; color: var(--muted); font-size: .85rem; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: var(--border-strong); }
.google-card { margin-top: 18px; }
.google-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.google-row > div { flex: 1; min-width: 200px; }
.google-row p { margin: 2px 0 0; }

/* ---------- Pied de page ---------- */
.site-footer {
  max-width: 1180px; margin: 0 auto; padding: 22px 16px 34px;
  display: flex; justify-content: space-between; align-items: center; gap: 8px 18px; flex-wrap: wrap;
  color: var(--muted); font-size: .86rem; border-top: 1px solid var(--border);
}
.site-footer nav, .auth-legal { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.site-footer a, .auth-legal a { color: var(--muted); text-decoration: none; }
.site-footer a:hover, .auth-legal a:hover { color: var(--primary-600); text-decoration: underline; }
.auth-legal { justify-content: center; font-size: .82rem; color: var(--muted); }

/* ---------- Pages légales ---------- */
.legal { max-width: 760px; margin: 0 auto; animation: rise .5s var(--ease) both; }
.legal-head { margin-bottom: 20px; }
.legal-summary { margin-bottom: 26px; background: linear-gradient(135deg, var(--primary-soft), var(--surface) 70%); }
.legal-summary ul { margin: 8px 0 0; padding-left: 0; list-style: none; display: grid; gap: 6px; }
.legal section { margin-bottom: 26px; }
.legal h2 { font-size: 1.2rem; margin-bottom: 8px; }
.legal h3 { font-size: 1rem; margin: 14px 0 6px; color: var(--text-2); }
.legal p, .legal li { color: var(--text-2); line-height: 1.65; }
.legal ul { padding-left: 1.2em; }
.legal li { margin: 4px 0; }
.legal code { font-size: .85em; background: var(--surface-2); padding: 1px 6px; border-radius: 6px; }
.legal-table { width: 100%; border-collapse: collapse; font-size: .9rem; background: var(--surface); border-radius: var(--radius-sm); overflow: hidden; }
.legal-table th, .legal-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
.legal-table th { background: var(--surface-2); font-size: .82rem; }
.legal-links { margin-top: 30px; font-weight: 650; }

/* ---------- Suppression du compte ---------- */
.delete-card { margin-top: 18px; border-color: color-mix(in srgb, var(--danger) 25%, var(--border)); }
.delete-card summary { cursor: pointer; list-style: none; }
.delete-card summary::-webkit-details-marker { display: none; }
.delete-card[open] summary { margin-bottom: 14px; }
.btn.btn-danger:not(.btn-ghost):not(.btn-sm) { background: var(--danger); border-color: var(--danger); color: #fff; }

/* =========================================================
   Responsive : tablette & téléphone
   ========================================================= */
.grid > * { min-width: 0; }                    /* une carte ne peut jamais élargir la grille */

/* Tableau croisé : 1re colonne fixe pendant le défilement horizontal */
.matrix th[scope="row"], .matrix thead th:first-child {
  position: sticky; left: 0; z-index: 1; background: var(--surface);
  box-shadow: 1px 0 0 var(--border);
}
.matrix thead th:first-child, .matrix tfoot th { background: var(--surface-2); }
.table-scroll { -webkit-overflow-scrolling: touch; scrollbar-width: thin; }

@media (max-width: 720px) {
  /* Barre de navigation en bas, façon application */
  body:has(.nav) { padding-bottom: calc(74px + env(safe-area-inset-bottom)); }
  /* le flou crée un « conteneur » pour position:fixed : on le retire pour que la barre du bas soit bien en bas */
  .topbar { backdrop-filter: none; -webkit-backdrop-filter: none; background: rgba(255, 252, 249, .96); }
  .topbar-inner { padding: 8px 16px; }
  .brand-name { display: inline; font-size: .98rem; }
  .nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    display: grid; grid-template-columns: repeat(5, 1fr); gap: 0;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    background: color-mix(in srgb, #ffffff 90%, transparent);
    backdrop-filter: saturate(1.6) blur(16px); -webkit-backdrop-filter: saturate(1.6) blur(16px);
    border-top: 1px solid var(--border); box-shadow: 0 -6px 24px -12px rgba(120, 60, 40, .25);
  }
  .nav form { display: contents; }
  .nav a, .nav-btn {
    flex-direction: column; justify-content: center; gap: 2px; height: 56px; padding: 4px 2px;
    border-radius: 14px; font-size: 1.25rem; box-shadow: none !important;
  }
  .nav .nav-label { display: block; font-size: .68rem; font-weight: 650; letter-spacing: .01em; }
  .nav a.active { background: var(--primary-soft); }
  .nav a.active .nav-label { color: var(--primary-600); }
  .nav a:active, .nav-btn:active { transform: scale(.94); }
  .toasts { top: 64px; }

  /* Fil d'Ariane sur une ligne, défilable */
  .crumbs { flex-wrap: nowrap; overflow-x: auto; white-space: nowrap; scrollbar-width: none; margin-right: -16px; padding-right: 16px; }
  .crumbs::-webkit-scrollbar { display: none; }

  .container { padding-top: 16px; padding-bottom: 40px; }
  .hero { margin-bottom: 18px; gap: 14px; }
  .hero .head-actions, .section-head .btn { width: 100%; }
  .hero .head-actions .btn { flex: 1; }
  .section-head .btn { justify-content: center; }
  .card { padding: 18px; }
  .site-footer { padding-bottom: 20px; }
}

@media (max-width: 560px) {
  h1 { font-size: 1.65rem; }
  .avatar-xl { --size: 58px; }

  /* Formulaires : boutons empilés, pleine largeur, principal en premier */
  .actions { flex-direction: column-reverse; align-items: stretch; }
  .actions .btn { width: 100%; padding-top: 13px; padding-bottom: 13px; }
  .btn-sm { min-height: 38px; }
  .preview-img { height: 130px; }
  .preview-img:has(img) { height: 200px; }

  /* Cadeaux : image moins haute */
  .gift-media { aspect-ratio: 16 / 10; }
  .gifts-grid, .kids-grid, .events-grid, .givers-grid { gap: 14px; }

  /* Chiffres clés : la case seule prend toute la ligne */
  .kpis { grid-template-columns: 1fr 1fr; }
  .kpi:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .kpi-value { font-size: 1.35rem; }

  .matrix th, .matrix td { padding: 10px 12px; font-size: .86rem; }
  .giver-total { font-size: 1.15rem; }
  .giver-gifts li { flex-wrap: wrap; }
  .giver-gift-meta { margin-left: auto; }

  .share-item .copy { flex-wrap: wrap; }
  .copy input { flex-basis: 100%; }
  .filters { gap: 6px; }
  .chip { padding: 6px 12px; }
  .howto { flex-direction: column; align-items: center; gap: 6px; }
}

/* Titres de cadeaux très longs : 3 lignes max */
.gift-body h3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* Lien « Mon compte » = avatar + prénom nom */
.nav-user .nav-label { max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-avatar { box-shadow: 0 0 0 2px #fff; }
@media (max-width: 720px) {
  .nav-user .nav-label { max-width: 100%; }
  .nav-user .avatar-xs { --size: 24px; font-size: .62rem; }
}

/* =========================================================
   v5 : cadeau commun, co-gestion, rappels, déjà offerts
   ========================================================= */
.gift-ribbon { display: flex; flex-wrap: wrap; gap: 6px; align-items: flex-end; }
.status-commun { background: #f1ecff; color: #7a5af8; border-color: color-mix(in srgb, #7a5af8 30%, transparent); }
.status-offert { background: linear-gradient(120deg, #fff4c2, #ffe0d6); color: #b35400; border-color: #ffd28a; }
.gift-card.is-commun:not(.is-libre) { border-top-color: #7a5af8; }
.gift-card.is-offert:not(.is-reserve):not(.is-commande) { border-top: 3px solid #f2b84b; }
/* Offert : image grisée, les pastilles (offert, réservé / commandé, qui offre) gardent leurs couleurs */
.gift-card.is-offert .gift-media img { filter: grayscale(1) !important; opacity: .55; }
.gift-card.is-offert .gift-media .placeholder, .gift-card.is-offert .gift-media.noimg::after { filter: grayscale(1); }

/* Jauge d'un cadeau commun */
.cagnotte { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.cagnotte .bar { flex: 1; height: 8px; background: #f1ecff; }
.cagnotte .bar span { background: linear-gradient(90deg, #a78bfa, #7a5af8); }

/* Participants (carte cadeau) */
.participants { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.participants li { display: flex; align-items: center; gap: 6px; font-size: .86rem; }
.participants .p-nom { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.participants strong { font-variant-numeric: tabular-nums; }

/* Panneau propriétaire : gestion des participants */
.part-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 6px 0; border-bottom: 1px dashed var(--border); }
.part-who { flex: 1 1 100%; display: flex; align-items: center; gap: 6px; font-size: .9rem; }
.part-edit { display: flex; gap: 6px; flex: 1; min-width: 0; }
.part-edit input { width: 90px; flex: none; padding: 6px 8px; font-size: .88rem; }
.part-edit select { flex: 1; min-width: 0; padding: 6px 30px 6px 8px; font-size: .85rem; background-position: calc(100% - 14px) 55%, calc(100% - 9px) 55%; }
.part-add { display: flex; flex-direction: column; gap: 8px; padding-top: 8px; }
.part-add .row { gap: 8px; }
.part-add input, .part-add select { padding: 8px 10px; font-size: .9rem; }
.assign-form form { margin: 0; }
.mon-montant { display: flex; align-items: flex-end; gap: 6px; width: 100%; }
.mon-montant label { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.mon-montant input { padding: 6px 10px; }
.reserve-form { flex-direction: column; align-items: stretch; }
.reserve-form .check { font-weight: 500; }

/* Outils de l'événement */
.tools-grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); margin-top: 22px; }
.tool-card h2 { font-size: 1.1rem; }
.tool-card p { margin: 6px 0 12px; }
.members { list-style: none; margin: 8px 0 14px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.members li { display: flex; align-items: center; gap: 10px; }
.members .m-nom { flex: 1; min-width: 0; }
.members form { margin: 0; }
.invite-box { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: var(--radius-sm); background: var(--primary-soft); }
.invite-box .copy input { background: #fff; }
.shared-badge { display: inline-flex; width: fit-content; font-size: .78rem; font-weight: 650; padding: 2px 10px; border-radius: 999px; background: #f1ecff; color: #7a5af8; }
.event-card.is-archive { opacity: .8; filter: saturate(.7); }
.event-card.is-archive:hover { opacity: 1; filter: none; }
.cloture-banner a { font-weight: 700; }
.invite-card { padding: 34px 26px; }
.invite-card .actions { flex-direction: row; }

/* Déjà offerts */
.deja { margin: 0 0 20px; }
.deja summary { cursor: pointer; list-style: none; }
.deja summary::-webkit-details-marker { display: none; }
.deja-list { margin: 12px 0; padding-left: 1.1em; columns: 2 260px; }
.deja-list li { margin: 3px 0; break-inside: avoid; }
.commun-tag { font-size: .72rem; font-weight: 700; color: #7a5af8; background: #f1ecff; padding: 1px 6px; border-radius: 999px; flex: none; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 18px; border-left: 2px dashed var(--border-strong); display: flex; flex-direction: column; gap: 18px; }
.timeline-item { position: relative; animation: rise .5s var(--ease) both; }
.timeline-item::before { content: ""; position: absolute; left: -26px; top: 6px; width: 12px; height: 12px; border-radius: 50%; background: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.timeline-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.timeline-head a { color: var(--text); text-decoration: none; }
.histo-gifts { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.histo-gift { display: flex; align-items: center; gap: 12px; padding: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); min-width: 0; }
.histo-img { flex: none; width: 56px; height: 56px; border-radius: 10px; background: #fff; display: grid; place-items: center; overflow: hidden; font-size: 1.6rem; border: 1px solid var(--border); }
.histo-img img { width: 100%; height: 100%; object-fit: contain; }
.histo-info { display: flex; flex-direction: column; min-width: 0; }
.histo-info > a, .histo-info > span:first-child { font-weight: 650; color: var(--text); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 560px) {
  .tools-grid { grid-template-columns: 1fr; }
  .invite-card .actions { flex-direction: column-reverse; }
  .nav .nav-label { font-size: .62rem; }
}

/* ===== Administration ===== */
.admin-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 22px 0 16px; }
.admin-tabs .chip { text-decoration: none; }
.admin-mdp { border: 2px dashed var(--primary); margin-bottom: 16px; }
.admin-mdp h2 { font-size: 1.1rem; margin: 0 0 4px; }
.admin-mdp .copy input { font-family: ui-monospace, Consolas, monospace; font-size: 1.05rem; letter-spacing: .06em; }
.admin-new { margin-bottom: 16px; }
.admin-new > summary { list-style: none; display: inline-flex; }
.admin-new > summary::-webkit-details-marker, .admin-edit > summary::-webkit-details-marker { display: none; }
.admin-new[open] > summary { margin-bottom: 14px; }
.admin-form { max-width: 520px; }
.admin-users { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.admin-user { animation: rise .45s var(--ease) both; animation-delay: calc(var(--i, 0) * 40ms); }
.admin-user.is-off { opacity: .7; background: var(--surface-2); }
.admin-user-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.admin-user-id { display: flex; flex-direction: column; min-width: 0; flex: 1 1 180px; }
.admin-user-id .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag-admin { background: #ece8ff; color: #5b3fd6; }
.tag-off { background: color-mix(in srgb, var(--danger) 12%, var(--surface)); color: var(--danger); }
.admin-meta { margin: 8px 0 6px; }
.admin-edit > summary { list-style: none; display: inline-flex; }
.admin-edit[open] > summary { margin-bottom: 12px; }
.admin-edit .danger-actions { padding-top: 12px; border-top: 1px dashed var(--border); }
.admin-family { margin-top: 26px; }
.admin-family-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 1.15rem; margin: 0 0 12px; }
.admin-events { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.admin-event header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.admin-event > p { margin: 4px 0 6px; }
.admin-event .avatar-xs { --size: 24px; font-size: .62rem; }
.admin-inline { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.admin-inline select { flex: 1 1 170px; width: auto; padding-top: 8px; padding-bottom: 8px; font-size: .9rem; }
.admin-inline label.check { flex-basis: 100%; }
.admin-link { display: flex; align-items: center; gap: 14px; text-decoration: none; color: var(--text); margin-bottom: 16px; transition: transform .2s var(--ease), box-shadow .2s; }
.admin-link:hover { transform: translateY(-2px); }
.admin-link > span:nth-child(2) { flex: 1; }
.admin-link-icon { font-size: 1.6rem; }
@media (max-width: 720px) {
  .nav .nav-admin { display: none; } /* sur mobile : accès via « Mon compte » (la barre du bas reste à 5 entrées) */
  .admin-events { grid-template-columns: 1fr; }
}

/* Récap : budget par enfant */
.kids-budget { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); margin-bottom: 10px; }
.budget-card { display: flex; flex-direction: column; gap: 12px; text-decoration: none; color: var(--text); border-top: 3px solid hsl(var(--h) 65% 70%); transition: transform .2s var(--ease), box-shadow .2s; animation: rise .45s var(--ease) both; animation-delay: calc(var(--i, 0) * 60ms); }
a.budget-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.budget-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.budget-head strong { font-size: 1.05rem; }
.budget-head .muted { margin-left: auto; }
.budget-figs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; margin: 0; }
.budget-figs div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.budget-figs dt { font-size: .78rem; color: var(--muted); display: flex; align-items: center; gap: 5px; }
.budget-figs dd { margin: 0; font-weight: 750; font-variant-numeric: tabular-nums; }
.budget-more { color: var(--primary-600); font-weight: 650; }

/* Récap : renommer une personne (Papa → Paul) */
.rename { margin: -4px 0 6px; }
.rename > summary { cursor: pointer; color: var(--muted); list-style: none; display: inline-block; }
.rename > summary::-webkit-details-marker { display: none; }
.rename > summary:hover { color: var(--primary-600); }
.rename-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
.rename-form input[type=text] { flex: 1 1 160px; padding-top: 8px; padding-bottom: 8px; }
.rename-form label.check { flex-basis: 100%; }

/* ===== Ma famille ===== */
.famille-grid { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); margin-bottom: 16px; }
.famille-card { margin-bottom: 16px; }
.famille-card h2 { font-size: 1.15rem; margin: 0 0 6px; }
.famille-card h3 { margin: 14px 0 6px; }
.inline-edit { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; flex: 1; min-width: 0; margin: 0; }
.inline-edit input[type=text] { flex: 1 1 140px; min-width: 0; padding-top: 8px; padding-bottom: 8px; }
.inline-edit select { flex: 0 1 170px; width: auto; padding-top: 8px; padding-bottom: 8px; font-size: .9rem; }
.edit-list { list-style: none; margin: 8px 0 12px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.edit-list li { display: flex; align-items: center; gap: 10px; }
.edit-list li > form:not(.inline-edit) { margin: 0; }
.add-row { padding-top: 12px; border-top: 1px dashed var(--border); }
.nowrap { white-space: nowrap; }
.groupe-dot { flex: none; width: 12px; height: 12px; border-radius: 50%; background: hsl(var(--h) 65% 62%); box-shadow: 0 0 0 3px hsl(var(--h) 80% 92%); }
.groupe-title { display: flex; align-items: center; gap: 8px; font-size: .95rem; margin: 16px 0 4px; }
.groupes-recap { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.groupe-recap { border-top: 3px solid hsl(var(--h) 65% 68%); }
.groupe-recap header { display: flex; align-items: center; gap: 10px; }
.groupe-recap header .giver-total { margin-left: auto; }
.groupe-recap p { margin: 6px 0 0; }
@media (max-width: 720px) {
  .nav .nav-favori { display: none; } /* barre du bas : Événements, Famille, Déjà offerts, Compte, Quitter */
}
@media (max-width: 560px) {
  .edit-list li { flex-wrap: wrap; }
  .personnes-list .inline-edit select { flex: 1 1 120px; }
}
.admin-foyer-name { flex: 0 1 360px; }
.admin-foyer-name input[type=text] { font-weight: 700; font-size: 1rem; }
.admin-parents { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 12px; }
.admin-parents .admin-inline { margin: 0; flex: 1 1 260px; }
.parent-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px 4px 4px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); font-weight: 600; font-size: .9rem; }
.edit-list .inline-edit:not(:has(select)) { flex-wrap: nowrap; }
.edit-list .inline-edit:not(:has(select)) input[type=text] { flex-basis: 60px; }

/* ===== Menu « Prénom Nom ▾ » (remplace Déjà offerts / Admin / Famille / Quitter) ===== */
.user-menu { position: relative; }
.user-menu > summary { list-style: none; user-select: none; }
.user-menu > summary::-webkit-details-marker { display: none; }
.user-menu > summary.active { background: var(--primary-soft); color: var(--primary-600); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--primary) 30%, transparent); }
.user-menu .caret { font-size: .7rem; opacity: .6; transition: transform .2s var(--ease); }
.user-menu[open] .caret { transform: rotate(180deg); }
.user-menu-panel {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 80; min-width: 250px;
  display: flex; flex-direction: column; padding: 8px; gap: 2px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm, 14px);
  box-shadow: 0 18px 40px -16px rgba(120, 60, 40, .35); animation: drop .2s var(--ease) both;
}
.user-menu-head { display: flex; align-items: center; gap: 10px; padding: 8px 10px 12px; margin-bottom: 4px; border-bottom: 1px solid var(--border); line-height: 1.3; }
.user-menu-head .muted { overflow-wrap: anywhere; }
.nav .user-menu-panel a, .user-menu-logout {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border-radius: 10px;
  color: var(--text); text-decoration: none; font: inherit; font-size: .95rem; font-weight: 550;
  background: none; border: 0; cursor: pointer; text-align: left; box-shadow: none;
}
.nav .user-menu-panel a:hover, .user-menu-logout:hover { background: var(--surface-2); }
.nav .user-menu-panel a.active { background: var(--primary-soft); color: var(--primary-600); box-shadow: none; }
.user-menu-panel form { margin: 4px 0 0; padding-top: 4px; border-top: 1px solid var(--border); display: block; }
.user-menu-logout { color: var(--danger); }

/* Mobile : plus de barre en bas, tout reste dans la barre du haut */
@media (max-width: 720px) {
  body:has(.nav) { padding-bottom: 0; }
  .nav {
    position: static; display: flex; gap: 2px; padding: 0;
    background: none; backdrop-filter: none; -webkit-backdrop-filter: none; border: 0; box-shadow: none;
  }
  .nav a, .nav-btn { flex-direction: row; height: auto; padding: 8px 10px; font-size: 1.1rem; border-radius: 999px; }
  .nav .nav-label { display: none; }
  .nav .nav-favori { display: none; }
  .user-menu > summary { padding: 4px 8px 4px 4px; }
  .user-menu-panel { position: fixed; left: 12px; right: 12px; top: 60px; min-width: 0; }
  .toasts { top: 70px; }
}
@media (max-width: 720px) {
  .nav .user-menu-panel a, .user-menu-logout { justify-content: flex-start; height: auto; padding: 12px; font-size: 1rem; }
}

/* =========================================================
   Tirage au sort (Père Noël secret) — même thème
   ========================================================= */
.tirage-banner {
  position: relative; overflow: hidden; border-radius: var(--radius, 22px); min-height: 120px;
  display: flex; align-items: flex-end; color: #fff; isolation: isolate;
  background: var(--bn, linear-gradient(135deg, #1f7a4d, #2fa36b 55%, #e8574e));
}
.tirage-banner::before {
  content: var(--motif, "🎄 ⭐ 🎁 ❄️ 🎄 ⭐ 🎁 ❄️ 🎄 ⭐ 🎁 ❄️ 🎄 ⭐ 🎁 ❄️ 🎄 ⭐ 🎁 ❄️ 🎄 ⭐ 🎁 ❄️ 🎄 ⭐ 🎁 ❄️ 🎄 ⭐ 🎁 ❄️ 🎄 ⭐ 🎁 ❄️");
  position: absolute; inset: -20% -10%; z-index: -1; font-size: 26px; line-height: 2.1; letter-spacing: 22px;
  opacity: .22; transform: rotate(-8deg); word-break: break-all; pointer-events: none;
}
.tirage-banner::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(to top, rgba(30, 15, 25, .45), transparent 60%); }
.banner-sapin    { --bn: linear-gradient(135deg, #17694a, #2fa36b 55%, #e8574e); }
.banner-neige    { --bn: linear-gradient(160deg, #6aa7e8, #a8d1f7 50%, #e9f4ff); --motif: "❄️ ✨ ⛄ ❄️ ✨ ⛄ ❄️ ✨ ⛄ ❄️ ✨ ⛄ ❄️ ✨ ⛄ ❄️ ✨ ⛄ ❄️ ✨ ⛄ ❄️ ✨ ⛄ ❄️ ✨ ⛄ ❄️ ✨ ⛄ ❄️ ✨ ⛄ ❄️ ✨ ⛄ ❄️ ✨ ⛄"; }
.banner-etoiles  { --bn: radial-gradient(circle at 80% 20%, #4b3a8f, #241b4b 60%, #150f2e); --motif: "✨ ⭐ 🌙 ✨ ⭐ ✨ ⭐ 🌙 ✨ ⭐ ✨ ⭐ 🌙 ✨ ⭐ ✨ ⭐ 🌙 ✨ ⭐ ✨ ⭐ 🌙 ✨ ⭐ ✨ ⭐ 🌙 ✨ ⭐ ✨ ⭐ 🌙 ✨ ⭐ ✨ ⭐ 🌙 ✨ ⭐"; }
.banner-bonbons  { --bn: linear-gradient(135deg, #ff8fb1, #ffb8d0 45%, #b9a2ff); --motif: "🍭 🍬 🧁 🍭 🍬 🧁 🍭 🍬 🧁 🍭 🍬 🧁 🍭 🍬 🧁 🍭 🍬 🧁 🍭 🍬 🧁 🍭 🍬 🧁 🍭 🍬 🧁 🍭 🍬 🧁 🍭 🍬 🧁 🍭 🍬 🧁"; }
.banner-confetti { --bn: linear-gradient(120deg, #ff6b6b, #ff9a6b 45%, #ffcf5c); --motif: "🎉 🎊 ✨ 🎈 🎉 🎊 ✨ 🎈 🎉 🎊 ✨ 🎈 🎉 🎊 ✨ 🎈 🎉 🎊 ✨ 🎈 🎉 🎊 ✨ 🎈 🎉 🎊 ✨ 🎈 🎉 🎊 ✨ 🎈 🎉 🎊 ✨ 🎈"; }
.banner-cadeaux  { --bn: linear-gradient(135deg, #c2364b, #e8574e 50%, #f2b84b); --motif: "🎁 🎀 🎁 🎀 🎁 🎀 🎁 🎀 🎁 🎀 🎁 🎀 🎁 🎀 🎁 🎀 🎁 🎀 🎁 🎀 🎁 🎀 🎁 🎀 🎁 🎀 🎁 🎀 🎁 🎀 🎁 🎀 🎁 🎀 🎁 🎀"; }
.banner-photo    { background-color: #ddd; background-size: cover; background-position: center; background-repeat: no-repeat; }
.banner-photo::before { display: none; }
.banner-upload   { --bn: repeating-linear-gradient(45deg, #fff4ec, #fff4ec 10px, #ffe7da 10px, #ffe7da 20px); color: var(--muted); }
.banner-upload::before, .banner-upload::after { display: none; }

.banner-hero { min-height: 210px; margin-bottom: 16px; animation: rise .5s var(--ease) both; box-shadow: var(--shadow); }
.banner-content { padding: 22px 26px; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.banner-content h1 { margin: 0; color: #fff; text-shadow: 0 2px 14px rgba(0, 0, 0, .35); font-size: clamp(1.6rem, 4vw, 2.6rem); }
.tag-light { background: rgba(255, 255, 255, .9); color: var(--text); }
.banner-public { min-height: 230px; margin: 0 0 18px; }
.banner-sm { min-height: 96px; border-radius: 0; }
.banner-thumb { min-height: 64px; width: 100%; border-radius: 12px; justify-content: center; align-items: center; font-size: 1.8rem; }
.banner-thumb::after { display: none; }
.banner-thumb::before { font-size: 14px; line-height: 1.8; letter-spacing: 10px; }

/* Liste des tirages */
.tirages-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.tirage-card { padding: 0; overflow: hidden; text-decoration: none; color: var(--text); transition: transform .2s var(--ease), box-shadow .2s; animation: rise .45s var(--ease) both; animation-delay: calc(var(--i, 0) * 60ms); }
.tirage-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.tirage-card-body { padding: 14px 18px 18px; }
.tirage-card-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.tirage-card h3 { margin: 10px 0 4px; }

/* Formulaire : choix de bannière */
.tirage-form { display: flex; flex-direction: column; gap: 16px; max-width: 820px; }
.tirage-form .card { display: flex; flex-direction: column; gap: 14px; }
.form-section { font-size: 1.1rem; margin: 0; }
.banner-choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
.banner-choice { position: relative; display: flex !important; flex-direction: column; align-items: center; gap: 6px; cursor: pointer; font-weight: 600 !important; }
.banner-choice input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.banner-choice .tirage-banner { outline: 3px solid transparent; outline-offset: 2px; transition: outline-color .2s, transform .2s var(--spring); }
.banner-choice:hover .tirage-banner { transform: translateY(-2px); }
.banner-choice input:checked + .tirage-banner { outline-color: var(--primary); }
.banner-choice input:focus-visible + .tirage-banner { outline-color: color-mix(in srgb, var(--primary) 50%, transparent); }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.banner-file input[type=file] { font-size: .9rem; }

/* Gestion d'un tirage */
.tirage-infos { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.tirage-infos .chip { text-decoration: none; }
.tirage-mot { margin: 0 0 16px; font-style: italic; color: var(--text-2); }
.tirage-steps { list-style: none; padding: 0; margin: 8px 0 18px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.tirage-steps li { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); font-weight: 650; font-size: .9rem; color: var(--muted); }
.tirage-steps b { flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); font-size: .8rem; }
.tirage-steps small { margin-left: auto; font-weight: 600; }
.tirage-steps .current { color: var(--primary-600); border-color: color-mix(in srgb, var(--primary) 40%, transparent); background: var(--primary-soft); }
.tirage-steps .current b { background: var(--primary); color: #fff; }
.tirage-steps .done { color: var(--libre); }
.tirage-steps .done b { background: var(--libre); color: #fff; }
.tirage-layout { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); align-items: start; margin-bottom: 16px; }
.tirage-side { display: flex; flex-direction: column; gap: 16px; }
.section-head.compact { margin: 0 0 6px; }
.tp-list { list-style: none; margin: 10px 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.tp-item { border: 1px solid var(--border); border-radius: 14px; padding: 10px 12px; background: var(--surface); }
.tp-head { display: flex; align-items: center; gap: 10px; }
.tp-who { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.tp-who .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tp-status { display: flex; gap: 4px; font-size: 1.05rem; }
.tp-status .off { filter: grayscale(1); opacity: .3; }
.tp-edit > summary { cursor: pointer; color: var(--muted); margin-top: 6px; list-style: none; }
.tp-edit > summary::-webkit-details-marker { display: none; }
.tp-edit[open] { display: flex; flex-direction: column; gap: 8px; }
.tp-edit form { margin: 0; }
.tp-add { display: flex; flex-direction: column; gap: 8px; padding-top: 12px; border-top: 1px dashed var(--border); }
.tp-add input[type=email] { flex: 1 1 180px; }
.tirage-go h2, #exclusions h2, #resultats h2 { font-size: 1.15rem; margin: 0 0 6px; }
.excl-list { list-style: none; padding: 0; margin: 8px 0 12px; display: flex; flex-direction: column; gap: 6px; }
.excl-list li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 10px; border-radius: 10px; background: var(--surface-2); }
.excl-list form { margin: 0; }
.reveal-list { list-style: none; padding: 0; margin: 10px 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 8px; }
.reveal-list li { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 12px; background: var(--surface-2); }

/* Page secrète d'un participant */
.santa-page { max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.santa-hello { font-size: 1.25rem; margin: 0; }
.santa-wait { text-align: center; }
.santa-reveal > summary { list-style: none; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 18px 0; text-align: center; }
.santa-reveal > summary::-webkit-details-marker { display: none; }
.santa-reveal[open] > summary { display: none; }
.reveal-gift { font-size: 4.5rem; animation: wiggle 2.2s var(--spring) infinite; }
.reveal-cta { font-weight: 750; color: var(--primary-600); }
.reveal-body { animation: pop .5s var(--spring) both; }
.reveal-body h3 { margin: 22px 0 8px; font-size: 1.05rem; }
.reveal-name { display: flex; align-items: center; gap: 14px; font-size: clamp(1.6rem, 5vw, 2.3rem); font-weight: 800; margin: 6px 0 0; }
.reveal-name.small-name { font-size: 1.1rem; font-weight: 600; gap: 8px; }
.souhaits { background: var(--surface-2); border-radius: 14px; padding: 14px 16px; line-height: 1.6; overflow-wrap: anywhere; }
.chat { list-style: none; padding: 0; margin: 10px 0; display: flex; flex-direction: column; gap: 8px; }
.chat li { display: flex; flex-direction: column; max-width: 85%; }
.chat li.me { align-self: flex-end; align-items: flex-end; }
.chat-who { font-size: .72rem; color: var(--muted); margin: 0 6px 2px; }
.chat-bubble { padding: 9px 13px; border-radius: 16px; background: var(--surface-2); line-height: 1.45; overflow-wrap: anywhere; }
.chat li.me .chat-bubble { background: var(--primary-soft); border-bottom-right-radius: 4px; }
.chat li.them .chat-bubble { border-bottom-left-radius: 4px; }
.chat-form { display: flex; gap: 8px; align-items: flex-end; }
.chat-form textarea { flex: 1; resize: vertical; }
.santa-foot { text-align: center; }

@media (max-width: 860px) {
  .tirage-layout { grid-template-columns: 1fr; }
  .tirage-steps { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .row-2 { grid-template-columns: 1fr; }
  .banner-hero { min-height: 160px; }
  .chat-form { flex-direction: column; align-items: stretch; }
}
.carnet-picks { display: flex; flex-wrap: wrap; gap: 6px; }
.pick { display: inline-flex !important; flex-direction: row !important; align-items: center; gap: 6px; padding: 5px 10px 5px 6px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; font-weight: 600 !important; font-size: .9rem; }
.pick:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.pick input { width: 16px; height: 16px; }

/* =========================================================
   Koipourki — page d'accueil (mêmes couleurs que le site)
   ========================================================= */
.logo-koi { font-weight: 800; letter-spacing: -.01em; }
.logo-koi b { color: var(--primary); font-weight: 800; }
.landing { display: flex; flex-direction: column; gap: 56px; padding-bottom: 20px; }
.landing-nav { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-top: 4px; }
.landing-nav .brand { text-decoration: none; color: var(--text); display: inline-flex; align-items: center; gap: 10px; }
.landing-nav .brand-name { display: inline; font-size: 1.25rem; }
.landing-nav nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.landing-link { color: var(--text-2); text-decoration: none; font-weight: 600; padding: 8px 10px; border-radius: 999px; }
.landing-link:hover { background: var(--surface-2); color: var(--text); }

/* Hero */
.landing-hero { display: grid; grid-template-columns: 1.1fr 1fr; gap: 40px; align-items: center; min-height: 440px; }
.landing-hero h1 { font-size: clamp(2.6rem, 6vw, 4.4rem); line-height: 1.02; margin: 8px 0 18px; letter-spacing: -.02em; }
.grad { background: linear-gradient(110deg, #ff6b6b, #ff9a6b 45%, #f2b84b); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lead { font-size: 1.15rem; line-height: 1.6; color: var(--text-2); max-width: 34em; margin: 0 0 24px; }
.landing-ctas { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.landing-hero-text { animation: rise .6s var(--ease) both; }

.landing-hero-art { position: relative; min-height: 380px; }
.mock { position: absolute; background: var(--surface); border: 1px solid var(--border); border-radius: 20px; box-shadow: 0 24px 50px -24px rgba(120, 60, 40, .35); padding: 14px; animation: rise .7s var(--ease) both; }
.mock-gift { left: 2%; top: 6%; width: 250px; display: flex; flex-direction: column; gap: 6px; transform: rotate(-4deg); animation-delay: .15s; }
.mock-img { position: relative; height: 140px; border-radius: 14px; background: linear-gradient(135deg, #fff4ec, #ffe7da); display: grid; place-items: center; font-size: 4.5rem; }
.mock-img .status { position: absolute; left: 8px; bottom: 8px; font-size: .75rem; }
.mock-price { font-weight: 800; font-size: 1.1rem; }
.mock-bar { height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.mock-bar i { display: block; height: 100%; width: var(--w); background: linear-gradient(90deg, #ffb547, #ff6b6b); border-radius: inherit; }
.mock-santa { right: 0; top: 34%; width: 260px; transform: rotate(3deg); animation-delay: .3s; background: linear-gradient(160deg, #fff, #fff6f6); }
.mock-tag { display: inline-flex; font-size: .78rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: #e8f6ee; color: #17694a; }
.mock-santa p { margin: 8px 0 0; }
.mock-name { display: flex; align-items: center; gap: 10px; font-size: 1.7rem; font-weight: 800; }
.mock-chip { left: 18%; bottom: 2%; padding: 10px 16px; border-radius: 999px; font-weight: 700; color: var(--commande); transform: rotate(-2deg); animation-delay: .45s; }
.landing-hero-art .float { position: absolute; font-size: 2rem; animation: floaty 6s ease-in-out infinite; opacity: .9; }
.landing-hero-art .f1 { right: 12%; top: 0; }
.landing-hero-art .f2 { left: 58%; top: 18%; font-size: 1.4rem; animation-delay: -2s; }
.landing-hero-art .f3 { right: 4%; bottom: 8%; animation-delay: -3.5s; }
.landing-hero-art .f4 { left: 0; bottom: 22%; font-size: 1.6rem; animation-delay: -1s; }
@keyframes floaty { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-14px) rotate(6deg); } }

/* Les deux parties */
.landing-duo { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.landing-part { position: relative; overflow: hidden; background: var(--surface); border: 1px solid var(--border); border-radius: 26px; padding: 30px; display: flex; flex-direction: column; gap: 6px; box-shadow: var(--shadow-sm); scroll-margin-top: 20px; }
.landing-part::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 6px; }
.part-listes::before { background: linear-gradient(90deg, #ff6b6b, #ffcf5c); }
.part-tirage::before { background: linear-gradient(90deg, #17694a, #2fa36b, #e8574e); }
.landing-part h2 { font-size: 1.8rem; margin: 0 0 4px; }
.landing-part .eyebrow { margin: 0; }
.part-icon { font-size: 2.6rem; width: 66px; height: 66px; border-radius: 20px; display: grid; place-items: center; margin-bottom: 8px; }
.part-listes .part-icon { background: var(--primary-soft); }
.part-tirage .part-icon { background: #e8f6ee; }
.part-list { list-style: none; padding: 0; margin: 14px 0 22px; display: flex; flex-direction: column; gap: 12px; flex: 1; }
.part-list li { display: flex; gap: 12px; align-items: flex-start; line-height: 1.5; }
.part-list b { flex: none; width: 32px; height: 32px; border-radius: 10px; background: var(--surface-2); display: grid; place-items: center; font-size: 1rem; }
.landing-part .btn { align-self: flex-start; }

/* Étapes */
.landing-steps h2, .landing-final h2 { text-align: center; font-size: clamp(1.6rem, 3.5vw, 2.2rem); margin: 0 0 22px; }
.landing-steps ol { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.landing-steps li { background: var(--surface); border: 1px solid var(--border); border-radius: 22px; padding: 24px; text-align: center; }
.landing-steps li span { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: linear-gradient(135deg, #ff6b6b, #ff9a6b); color: #fff; font-weight: 800; font-size: 1.2rem; margin-bottom: 10px; box-shadow: 0 8px 18px -8px #ff6b6b; }
.landing-steps li strong { display: block; font-size: 1.15rem; }
.landing-steps li p { margin: 6px 0 0; }

/* Confiance */
.landing-trust { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.landing-trust div { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; padding: 16px 10px; border-radius: 18px; background: color-mix(in srgb, var(--surface) 70%, transparent); }
.landing-trust b { font-size: 1.7rem; margin-bottom: 4px; }

.landing-final { text-align: center; padding: 36px 24px; background: linear-gradient(135deg, #fff, #fff4ec); }
.landing-final h2 { margin-bottom: 8px; }
.landing-final p { margin: 0 0 20px; }

@media (max-width: 900px) {
  .landing-hero { grid-template-columns: 1fr; gap: 10px; }
  .landing-hero-art { min-height: 330px; max-width: 520px; width: 100%; margin: 0 auto; }
  .landing-duo { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .landing { gap: 40px; }
  .landing-nav .landing-link { display: none; }
  .landing-steps ol { grid-template-columns: 1fr; }
  .landing-trust { grid-template-columns: 1fr 1fr; }
  .landing-part { padding: 22px; }
  .mock-gift { width: 210px; left: 0; }
  .mock-santa { width: 220px; }
  .mock-img { height: 110px; font-size: 3.6rem; }
}
@media (prefers-reduced-motion: reduce) { .landing-hero-art .float { animation: none; } }

/* =========================================================
   Logo
   ========================================================= */
.brand-logo.has-img { background: none; box-shadow: none; animation: none; width: 40px; height: 40px; border-radius: 12px; overflow: visible; }
.brand-logo.has-img img { width: 100%; height: 100%; display: block; filter: drop-shadow(0 4px 10px rgba(238, 79, 93, .28)); transition: transform .4s var(--spring); }
.brand:hover .brand-logo.has-img { animation: none; }
.brand:hover .brand-logo.has-img img { transform: rotate(-8deg) scale(1.06); }
.auth-badge.has-img { background: none; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; width: 84px; height: 84px; }
.auth-badge.has-img img { width: 100%; height: 100%; filter: drop-shadow(0 12px 24px rgba(80, 20, 40, .35)); }

/* Bouton clair / sombre */
.theme-toggle { display: inline-flex; align-items: center; gap: 8px; }
.theme-toggle .t-dark, html[data-theme="dark"] .theme-toggle .t-light { display: none; }
html[data-theme="dark"] .theme-toggle .t-dark { display: inline; }
.landing-theme { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); cursor: pointer; font-size: 1.05rem; display: grid; place-items: center; }
.landing-theme:hover { background: var(--surface-2); }
.footer-theme { background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

/* =========================================================
   🌙 Mode sombre (activé par le bouton ; le site reste clair par défaut)
   ========================================================= */
html[data-theme="dark"] {
  --bg: #17121b;
  --bg-2: #1f1824;
  --surface: #231b28;
  --surface-2: #2d2333;
  --text: #f4edf6;
  --text-2: #d2c6d9;
  --muted: #a194aa;
  --border: #392e40;
  --border-strong: #4d3f56;

  --primary: #ff7b7b;
  --primary-600: #ff9090;
  --primary-soft: #4a262d;
  --on-primary: #ffffff;

  --libre: #3fd2ad;
  --libre-soft: #173d34;
  --reserve: #f5ad45;
  --reserve-soft: #43311a;
  --commande: #98a1ff;
  --commande-soft: #2a2d58;
  --danger: #ff7387;

  --av-s: 45%;
  --av-l: 32%;
  --av-fg-l: 88%;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35), 0 3px 10px rgba(0, 0, 0, .25);
  --shadow: 0 2px 4px rgba(0, 0, 0, .3), 0 12px 30px -10px rgba(0, 0, 0, .55);
  --shadow-lg: 0 6px 14px rgba(0, 0, 0, .35), 0 26px 50px -18px rgba(0, 0, 0, .7);
  color-scheme: dark;
}
html[data-theme="dark"] body {
  background-image:
    radial-gradient(circle at 12px 14px, rgba(255, 123, 123, .16) 2.5px, transparent 3px),
    radial-gradient(circle at 58px 46px, rgba(152, 161, 255, .14) 2.5px, transparent 3px),
    radial-gradient(circle at 92px 18px, rgba(255, 207, 92, .16) 3px, transparent 3.5px),
    radial-gradient(circle at 34px 84px, rgba(63, 210, 173, .12) 2px, transparent 2.5px);
}
html[data-theme="dark"] .bg-deco span { opacity: .16 !important; }
html[data-theme="dark"] .topbar { background: color-mix(in srgb, #17121b 78%, transparent); }
html[data-theme="dark"] .nav-avatar { box-shadow: 0 0 0 2px var(--surface); }
html[data-theme="dark"] .preview-img,
html[data-theme="dark"] .invite-box .copy input { background: var(--surface); }
html[data-theme="dark"] .auth-panel { background: rgba(35, 27, 40, .9); border-color: rgba(255, 255, 255, .08); box-shadow: var(--shadow-lg); }
html[data-theme="dark"] .auth-perks b { background: var(--surface-2); }
html[data-theme="dark"] .status-commun, html[data-theme="dark"] .commun-tag { background: #2f2852; color: #c4b5ff; }
html[data-theme="dark"] .status-offert { background: linear-gradient(120deg, #43331a, #45291f); color: #ffc56e; border-color: #6b4d1f; }
html[data-theme="dark"] .cagnotte .bar { background: #2f2852; }
html[data-theme="dark"] .tag-admin { background: #2f2852; color: #c4b5ff; }
html[data-theme="dark"] .banner-upload { --bn: repeating-linear-gradient(45deg, #2d2333, #2d2333 10px, #392e40 10px, #392e40 20px); }
html[data-theme="dark"] .tag-light { background: rgba(23, 18, 27, .85); color: var(--text); }
/* Les photos de produits restent sur fond blanc (lisibles) mais sans éblouir */
html[data-theme="dark"] .gift-media, html[data-theme="dark"] .histo-img { background: #f4eef2; }
html[data-theme="dark"] .gift-media img, html[data-theme="dark"] .histo-img img { filter: brightness(.94); }
/* Accueil */
html[data-theme="dark"] .mock-img { background: linear-gradient(135deg, #3a2a30, #4a2f2c); }
html[data-theme="dark"] .mock-santa { background: linear-gradient(160deg, var(--surface), #2c1f27); }
html[data-theme="dark"] .mock-tag, html[data-theme="dark"] .part-tirage .part-icon { background: #183a2c; color: #7fe0b5; }
html[data-theme="dark"] .landing-final { background: linear-gradient(135deg, var(--surface), #2b1f26); }
html[data-theme="dark"] .landing-trust div { background: color-mix(in srgb, var(--surface) 75%, transparent); }
@media (max-width: 720px) {
  html[data-theme="dark"] .topbar { background: rgba(23, 18, 27, .96); }
}
.user-menu-theme { color: var(--text) !important; }
.footer-brand { display: inline-flex; align-items: center; gap: 6px; }
.footer-brand img { border-radius: 5px; }

/* Bouton flottant clair / sombre (en bas à gauche, toutes les pages) */
.theme-fab {
  position: fixed; left: 18px; bottom: 18px; z-index: 70;
  width: 48px; height: 48px; border-radius: 50%; cursor: pointer;
  display: grid; place-items: center; font-size: 1.35rem; line-height: 1;
  background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--shadow); transition: transform .3s var(--spring), box-shadow .2s, background .3s;
}
.theme-fab:hover { transform: translateY(-3px) rotate(-12deg); box-shadow: var(--shadow-lg); }
.theme-fab:active { transform: scale(.92); }
.theme-fab:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary) 50%, transparent); outline-offset: 3px; }
.theme-fab span { grid-area: 1 / 1; }
.theme-fab .t-light, .theme-fab .t-dark { animation: fab-spin .5s var(--spring); }
html[data-theme="dark"] .theme-fab { background: #2d2333; box-shadow: 0 0 0 1px rgba(255, 207, 92, .15), 0 10px 26px -10px rgba(255, 207, 92, .35); }
@keyframes fab-spin { from { transform: rotate(-120deg) scale(.4); opacity: 0; } to { transform: none; opacity: 1; } }
@media (max-width: 720px) { .theme-fab { left: 12px; bottom: 12px; width: 44px; height: 44px; } }
@media print { .theme-fab { display: none; } }
html[data-theme="dark"] .auth-card { background: rgba(35, 27, 40, .92); border-color: rgba(255, 255, 255, .08); box-shadow: 0 1px 0 rgba(255, 255, 255, .05) inset, var(--shadow-lg); }
html[data-theme="dark"] .btn-google { border-color: #4d3f56; }
@media (max-width: 720px) { .site-footer { padding-bottom: 72px; } }

/* Mascotte (logo) */
.mascot-hero { position: absolute; right: 2%; bottom: -6%; width: 150px; height: 150px; z-index: 2; animation: mascot-hop 3.2s var(--ease) infinite; filter: drop-shadow(0 14px 18px rgba(150, 70, 50, .22)); }
@keyframes mascot-hop { 0%, 100% { transform: translateY(0) rotate(0); } 40% { transform: translateY(-12px) rotate(-4deg); } 60% { transform: translateY(-12px) rotate(3deg); } }
.auth-badge.has-img { background: rgba(255, 255, 255, .92); border-radius: 26px; padding: 8px; width: 96px; height: 96px; box-shadow: 0 14px 30px -12px rgba(80, 20, 40, .45); }
.auth-badge.has-img img { filter: none; }
.brand-logo.has-img img { filter: drop-shadow(0 3px 6px rgba(238, 79, 93, .25)); }
@media (max-width: 640px) { .mascot-hero { width: 104px; height: 104px; right: 0; bottom: -4%; } }
@media (prefers-reduced-motion: reduce) { .mascot-hero { animation: none; } }

.landing-hero-art .f5 { left: 44%; bottom: 0; font-size: 1.7rem; animation-delay: -4.5s; }
.landing-hero-art .f5 { left: 3%; top: 0; bottom: auto; font-size: 1.8rem; }
.landing-hero-art .f3 { right: auto; left: 46%; top: 2%; bottom: auto; }

/* Police des titres et du nom « KoiPourKi » : Apasih, par Khurasan Studio (gratuite, usage personnel et commercial).
   Elle a toutes les lettres accentuées (minuscules et majuscules). Il lui manque seulement « » · – (remplacés par deco()).
   (L'ancienne police, Matcha World, reste dans assets/fonts/ si on veut revenir en arrière.) */
@font-face {
  font-family: "Apasih";
  src: url("../fonts/apasih.otf") format("opentype");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}
:root { --font-title: "Apasih", "Segoe UI", system-ui, sans-serif; }

/* Tous les grands titres : police Apasih, en majuscules (accents compris) */
h1, h2 { font-family: var(--font-title); font-weight: normal; text-transform: uppercase; letter-spacing: .03em; }
h1 .font-fun, h2 .font-fun { font-size: 1em; }
.logo-koi {
  font-family: var(--font-title);
  font-weight: normal; letter-spacing: .02em; font-size: 1.35rem; line-height: 1;
}
.logo-koi b { font-weight: normal; color: var(--primary); }
.landing-nav .logo-koi { font-size: 1.6rem; }

/* Police du logo réutilisée : noms d'événements, de listes, de tirages et chiffres clés */
.font-fun, .logo-koi { font-family: var(--font-title); font-weight: normal; letter-spacing: .02em; text-transform: uppercase; }
h1 .font-fun { font-size: .92em; }
h2 .font-fun, h3 .font-fun { font-size: .9em; }
.kpi-value, .giver-total { font-family: var(--font-title); font-weight: normal; letter-spacing: .02em; }
.kpi-value { font-size: 1.6rem; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
/* Logo plus grand (mascotte + nom) */
.brand-logo.has-img { width: 54px; height: 54px; margin: -6px 0; }
.logo-koi { font-size: 1.55rem; }
.landing-nav .brand-logo.has-img { width: 66px; height: 66px; }
.landing-nav .logo-koi { font-size: 1.9rem; }
@media (max-width: 720px) {
  .brand-logo.has-img { width: 46px; height: 46px; margin: -4px 0; }
  .logo-koi { font-size: 1.3rem; }
  .landing-nav .brand-logo.has-img { width: 54px; height: 54px; }
  .landing-nav .logo-koi { font-size: 1.5rem; }
}

/* =========================================================
   Page d'accueil — style « pop » (v30)
   Bandes de couleur pleine largeur, ruban jaune (le nœud de la mascotte),
   titres dans la police du logo, étiquettes aux couleurs des statuts.
   L'ancien style de l'accueil (.landing-*) n'est plus utilisé.
   ========================================================= */
.pop {
  --pop-ink: #2d2433;          /* texte foncé fixe (sur corail et jaune) */
  --pop-coral: #ff6b6b;
  --pop-coral-deep: #d9384b;
  --pop-sun: #ffcf5c;
  --pop-indigo: #4b55dd;
  --pop-line: var(--text);     /* contours : s'inversent en mode sombre */
  display: flex; flex-direction: column; padding-bottom: 8px;
}
.pop h1, .pop h2 { font-family: var(--font-title); font-weight: normal; letter-spacing: .01em; }
.pop h1 .font-fun, .pop h2 .font-fun, .pop strong .font-fun { font-size: 1em; }
.pop-ico { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.pop-bleed { width: 100vw; margin-left: calc(50% - 50vw); }

/* Boutons */
.pop-btn { display: inline-flex; align-items: center; gap: 10px; font: inherit; font-weight: 700; font-size: 1rem; line-height: 1; text-decoration: none; padding: 16px 24px; border-radius: 999px; border: 2.5px solid var(--pop-line); cursor: pointer; transition: transform .35s var(--spring), box-shadow .35s var(--ease), background .2s; }
.pop-btn:active { transform: scale(.97); }
.pop-btn-main { background: var(--pop-line); color: var(--bg); box-shadow: 0 8px 20px -8px rgba(45, 36, 51, .55); }
.pop-btn-main:hover { transform: translateY(-3px) rotate(-1.5deg); box-shadow: 0 14px 28px -10px rgba(45, 36, 51, .6); }
.pop-btn-line { background: transparent; color: var(--text); }
.pop-btn-line:hover { background: var(--surface); transform: translateY(-2px); }
.pop-btn-sun { background: var(--pop-sun); border-color: var(--pop-sun); color: var(--pop-ink); box-shadow: 0 8px 20px -8px rgba(0, 0, 0, .4); }
.pop-btn-sun:hover { transform: translateY(-3px) rotate(-1.5deg); }
.pop-btn-sm { padding: 9px 15px; font-size: .92rem; border-width: 2px; }
.pop-arrow { transition: transform .3s var(--spring); }
.pop-btn:hover .pop-arrow { transform: translateX(4px); }

/* Navigation */
.pop-nav { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-top: 4px; }
.pop-nav .brand { text-decoration: none; color: var(--text); display: inline-flex; align-items: center; gap: 10px; }
.pop-nav .brand-name { display: inline; font-size: 1.9rem; }
.pop-nav .brand-logo.has-img { width: 66px; height: 66px; }
.pop-nav nav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pop-link { color: var(--text-2); text-decoration: none; font-weight: 600; padding: 8px 12px; border-radius: 999px; }
.pop-link:hover { background: var(--surface-2); color: var(--text); }

/* Hero */
.pop-hero { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 24px; align-items: center; padding: 28px 0 64px; }
.pop-hero h1 { font-size: clamp(3rem, 8.2vw, 6rem); line-height: .92; margin: 0; }
.pop-l2 { display: block; color: var(--pop-coral-deep); }
.pop-lead { margin: 26px 0 0; font-size: 1.2rem; line-height: 1.55; max-width: 34ch; color: var(--text-2); }
.pop-lead strong { color: var(--text); }
.pop-ctas { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; }
.pop-note { margin-top: 14px; font-size: .9rem; color: var(--muted); }
.pop-facts { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 22px; font-size: .95rem; font-weight: 600; color: var(--text-2); }
.pop-facts span { display: inline-flex; align-items: center; gap: 6px; }
.pop-facts .pop-ico { width: 18px; height: 18px; color: var(--pop-coral-deep); }

.pop-stage { position: relative; aspect-ratio: 1 / 1; max-width: 520px; width: 100%; justify-self: center; }
.pop-sun { position: absolute; inset: 9%; border-radius: 50%; background: var(--pop-sun); }
.pop-ring { position: absolute; inset: 2%; border-radius: 50%; border: 2.5px dashed color-mix(in srgb, var(--text) 22%, transparent); }
.pop-mascot { position: absolute; inset: 15%; width: 70%; height: 70%; filter: drop-shadow(0 18px 22px rgba(150, 70, 50, .28)); transform-origin: 50% 80%; animation: pop-hop 3.6s var(--ease) infinite; }
@keyframes pop-hop { 0%, 70%, 100% { transform: translateY(0) rotate(0); } 78% { transform: translateY(-14px) rotate(-4deg); } 86% { transform: translateY(0) rotate(2deg); } }
.pop-tag { position: absolute; display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px 9px 10px; border-radius: 12px; font-weight: 700; font-size: .92rem; background: var(--surface); border: 2px solid var(--pop-line); box-shadow: 0 10px 22px -12px rgba(45, 36, 51, .5); white-space: nowrap; transition: transform .4s var(--spring); }
.pop-tag:hover { transform: rotate(0) scale(1.06) !important; }
.pop-tag i { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--pop-line); background: var(--bg); }
.pop-tag-libre { color: var(--libre); background: var(--libre-soft); top: 6%; left: -2%; transform: rotate(-7deg); }
.pop-tag-reserve { color: var(--reserve); background: var(--reserve-soft); top: 40%; right: -6%; transform: rotate(6deg); }
.pop-tag-commande { color: var(--commande); background: var(--commande-soft); bottom: 8%; left: 2%; transform: rotate(-4deg); }
.pop-tag-offert { color: var(--text); bottom: -2%; right: 12%; transform: rotate(5deg); }

/* Ruban */
.pop-ribbon-clip { overflow-x: clip; position: relative; z-index: 2; }
.pop-ribbon { background: var(--pop-sun); border-block: 2.5px solid var(--pop-ink); transform: rotate(-1.5deg); margin-inline: -20px; overflow: hidden; }
.pop-track { display: flex; width: max-content; animation: pop-slide 38s linear infinite; }
.pop-track span { color: var(--pop-ink); font-size: 1.35rem; padding: 14px 22px 14px 0; white-space: nowrap; display: inline-flex; align-items: center; gap: 22px; }
.pop-track i { width: 12px; height: 12px; border-radius: 50%; background: var(--pop-coral); border: 2px solid var(--pop-ink); display: inline-block; }
@keyframes pop-slide { to { transform: translateX(-50%); } }

/* Bandes des deux parties */
.pop-band { padding: 84px 0; scroll-margin-top: 0; }
.pop-band-inner { max-width: 1180px; margin: 0 auto; padding: 0 16px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 56px; align-items: center; }
.pop-listes { background: var(--pop-coral); color: var(--pop-ink); margin-top: -14px; }
.pop-tirage { background: var(--pop-indigo); color: #fff; }
.pop-band h2 { font-size: clamp(2.4rem, 5.4vw, 4rem); line-height: .95; margin: 0; }
.pop-intro { margin: 16px 0 0; font-size: 1.15rem; max-width: 40ch; }
.pop-tirage .pop-intro { color: #e9ebff; }
.pop-feats { list-style: none; margin: 30px 0 34px; padding: 0; display: grid; gap: 14px; }
.pop-feats li { display: flex; gap: 14px; align-items: flex-start; font-size: 1.02rem; line-height: 1.5; }
.pop-feats b { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; flex: none; border: 2px solid currentColor; }
.pop-feats .pop-ico { width: 20px; height: 20px; }
.pop-feats li span { padding-top: 8px; }
.pop-listes .pop-feats b { background: #fff8f2; }
.pop-tirage .pop-feats b { background: rgba(255, 255, 255, .14); }
.pop-listes .pop-btn-main { background: var(--pop-ink); color: #fff; border-color: var(--pop-ink); }

/* Exemple de liste */
.pop-demo { background: #fff; color: var(--pop-ink); border: 2.5px solid var(--pop-ink); border-radius: 22px; padding: 22px; box-shadow: 0 30px 50px -28px rgba(80, 20, 20, .55); transform: rotate(1.5deg); }
.pop-demo-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.pop-who { display: flex; align-items: center; gap: 12px; }
.pop-who strong { font-size: 1.1rem; display: block; }
.pop-who small { color: #5b5065; font-size: .85rem; display: block; }
.pop-count { background: #ffefe4; padding: 6px 12px; border-radius: 999px; white-space: nowrap; }
.pop-gift { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 12px 0; border-top: 1.5px dashed #f3e5da; }
.pop-gift strong { display: block; line-height: 1.25; }
.pop-gift div span { font-size: .85rem; color: #5b5065; font-variant-numeric: tabular-nums; }
.pop-pic { width: 52px; height: 52px; border-radius: 12px; display: grid; place-items: center; }
.pop-pic .pop-ico { width: 26px; height: 26px; }
.pop-pic.is-libre { background: #dcf6ee; color: #0f8a6e; }
.pop-pic.is-reserve { background: #fff0d3; color: #b86e00; }
.pop-pic.is-commande { background: #e9ebff; color: #4b55dd; }
.pop-demo .status-libre { background: #dcf6ee; color: #0f8a6e; }
.pop-demo .status-reserve { background: #fff0d3; color: #b86e00; }
.pop-demo .status-commande { background: #e9ebff; color: #4b55dd; }
.pop-bar { height: 10px; border-radius: 999px; background: #dcf6ee; margin-top: 14px; overflow: hidden; display: flex; }
.pop-bar i { display: block; height: 100%; }

/* Billet à gratter */
.pop-ticket { position: relative; background: var(--pop-sun); color: var(--pop-ink); border-radius: 22px; padding: 26px 26px 24px; border: 2.5px solid var(--pop-ink); box-shadow: 0 30px 50px -26px rgba(10, 10, 60, .7); transform: rotate(-2deg); max-width: 440px; width: 100%; justify-self: center; }
.pop-ticket::before, .pop-ticket::after { content: ""; position: absolute; top: 50%; width: 28px; height: 28px; border-radius: 50%; background: var(--pop-indigo); border: 2.5px solid var(--pop-ink); transform: translateY(-50%); }
.pop-ticket::before { left: -16px; clip-path: inset(0 0 0 50%); }
.pop-ticket::after { right: -16px; clip-path: inset(0 50% 0 0); }
.pop-ticket-top { display: flex; justify-content: space-between; align-items: center; font-weight: 700; font-size: .92rem; }
.pop-ticket-top .font-fun { font-size: 1.1rem; }
.pop-ticket > p { margin: 18px 0 0; font-weight: 600; }
.pop-scratch { position: relative; margin-top: 10px; height: 92px; border-radius: 14px; background: #fff; border: 2px dashed var(--pop-ink); display: flex; align-items: center; gap: 14px; padding: 0 18px; overflow: hidden; }
.pop-name { font-size: 2.3rem; line-height: 1; }
.pop-cover { position: absolute; inset: 0; border: 0; cursor: pointer; font: inherit; font-weight: 700; color: #fff; display: flex; align-items: center; justify-content: center; gap: 10px; background: linear-gradient(135deg, #7d829c, #a3a8bf 45%, #868ba5); transition: clip-path .7s var(--ease), filter .2s; clip-path: inset(0 0 0 0); }
.pop-cover:hover { filter: brightness(1.06); }
.pop-scratch.is-open .pop-cover { clip-path: inset(0 0 0 100%); }
.pop-ticket .pop-hint { margin-top: 14px; font-size: .88rem; font-weight: 500; display: flex; gap: 8px; align-items: center; }
.pop-hint .pop-ico { width: 18px; height: 18px; }

/* Étapes */
.pop-steps { padding: 96px 0 40px; }
.pop-steps h2 { font-size: clamp(2.2rem, 5vw, 3.4rem); line-height: 1; text-align: center; margin: 0; }
.pop-steps ol { list-style: none; padding: 0; margin: 48px 0 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px; position: relative; }
.pop-steps ol::before { content: ""; position: absolute; top: 38px; left: 16%; right: 16%; border-top: 3px dashed color-mix(in srgb, var(--text) 25%, transparent); }
.pop-steps li { text-align: center; position: relative; }
.pop-n { display: inline-grid; place-items: center; width: 76px; height: 76px; border-radius: 50%; border: 2.5px solid var(--pop-ink); font-size: 2rem; color: var(--pop-ink); }
.pop-steps li:nth-child(1) .pop-n { background: var(--pop-coral); }
.pop-steps li:nth-child(2) .pop-n { background: var(--pop-sun); transform: rotate(-6deg); }
.pop-steps li:nth-child(3) .pop-n { background: #dcf6ee; }
.pop-steps li > strong { display: block; font-size: 1.6rem; margin-top: 16px; font-family: var(--font-title); font-weight: normal; }
.pop-steps li p { color: var(--text-2); max-width: 26ch; margin: 6px auto 0; }
.pop-trust { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 28px; margin-top: 56px; color: var(--text-2); font-size: .95rem; }
.pop-trust span { display: inline-flex; align-items: center; gap: 8px; }
.pop-trust strong { color: var(--text); }
.pop-trust .pop-ico { width: 20px; height: 20px; color: var(--pop-coral-deep); }

/* Fin */
.pop-final { margin-top: 32px; background: var(--pop-ink); color: #fff; border-radius: 28px; padding: 48px clamp(20px, 5vw, 64px); display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 32px; align-items: center; }
.pop-final img { width: 120px; height: 120px; transform: rotate(-8deg); }
.pop-final h2 { font-size: clamp(1.9rem, 4vw, 2.8rem); line-height: 1; margin: 0; }
.pop-final p { color: #d2c6d9; margin: 10px 0 0; }

@media (max-width: 860px) {
  .pop-hero, .pop-band-inner { grid-template-columns: minmax(0, 1fr); }
  .pop-stage { max-width: 380px; }
  .pop-band { padding: 64px 0; }
  .pop-tirage .pop-ticket { order: 2; }
  .pop-final { grid-template-columns: minmax(0, 1fr); }
  .pop-final img { width: 84px; height: 84px; }
}
@media (max-width: 640px) {
  .pop-link { display: none; }
  .pop-nav .brand-name { font-size: 1.5rem; }
  .pop-nav .brand-logo.has-img { width: 54px; height: 54px; }
  .pop-steps ol { grid-template-columns: minmax(0, 1fr); gap: 36px; }
  .pop-steps ol::before { display: none; }
  .pop-trust { flex-direction: column; align-items: flex-start; }
  .pop-tag { font-size: .8rem; padding: 7px 10px 7px 8px; }
  .pop-tag-reserve { right: -2%; }
  .pop-demo, .pop-ticket { transform: none; }
  .pop-gift { grid-template-columns: 44px minmax(0, 1fr); }
  .pop-pic { width: 44px; height: 44px; }
  .pop-gift .status { grid-column: 2; justify-self: start; }
}
@media (prefers-reduced-motion: reduce) {
  .pop-mascot, .pop-track { animation: none; }
}
/* Mode sombre */
html[data-theme="dark"] .pop-tag { box-shadow: 0 10px 22px -12px rgba(0, 0, 0, .8); }
html[data-theme="dark"] .pop-final { background: var(--surface-2); border: 2px solid var(--border-strong); }
html[data-theme="dark"] .pop-l2, html[data-theme="dark"] .pop-facts .pop-ico, html[data-theme="dark"] .pop-trust .pop-ico { color: var(--pop-coral); }

/* =========================================================
   Jeux quotidiens (jeux.php) — Mot Secret, Sudoku, Méli-Mot
   Couleurs Koipourki : corail = bien placé, jaune = mal placé, indigo pour le Méli-Mot.
   ========================================================= */
.jeux { --j-ink: #2d2433; --j-sun: #ffcf5c; --j-indigo: #4b55dd; --j-coral: #ff6b6b; }
.jeux .view[hidden] { display: none !important; }
.jeux-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; margin: 4px 0 22px; }
.jeux-head h1 { margin: 0; font-size: clamp(2rem, 5vw, 3rem); }
.jeux-sub { margin: 4px 0 0; color: var(--text-2); }
.jeux-sub .date-label { display: inline-block; font-weight: 650; color: var(--text); }
.jeux .date-label::first-letter { text-transform: uppercase; }
.jeux-sub .countdown { font-variant-numeric: tabular-nums; }
.jeux-head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.jeux-loading { padding: 40px 0; text-align: center; color: var(--muted); }
.jeux-error { text-align: center; }

/* Cartes des jeux */
.jeux-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.jeux-card { position: relative; display: flex; flex-direction: column; gap: 12px; padding: 22px; border-radius: 22px; text-decoration: none; color: var(--j-ink); border: 2.5px solid var(--j-ink); box-shadow: 0 18px 34px -22px rgba(45, 36, 51, .55); transition: transform .35s var(--spring), box-shadow .35s var(--ease); overflow: hidden; }
.jeux-card:hover { transform: translateY(-5px) rotate(-.6deg); box-shadow: 0 26px 40px -22px rgba(45, 36, 51, .6); }
.jeux-card:active { transform: scale(.98); }
.jc-word { background: var(--j-coral); }
.jc-sudoku { background: var(--j-sun); }
.jc-mix { background: var(--j-indigo); color: #fff; }
.jc-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.jeux-card h2 { margin: 0; font-size: 1.7rem; line-height: 1; }
.jeux-card p { margin: 0; font-size: .98rem; }
.jc-status { flex: none; font-size: .78rem; font-weight: 750; padding: 5px 10px; border-radius: 999px; background: rgba(255, 255, 255, .85); color: var(--j-ink); white-space: nowrap; }
.jc-meta { font-size: .85rem; font-weight: 600; opacity: .85; margin-top: auto; }
.jc-cta { align-self: flex-start; font-weight: 800; padding: 10px 18px; border-radius: 999px; background: var(--j-ink); color: #fff; }
.jc-mix .jc-cta { background: var(--j-sun); color: var(--j-ink); }
.jc-cta span { display: inline-block; transition: transform .3s var(--spring); }
.jeux-card:hover .jc-cta span { transform: translateX(4px); }
.jeux-foot { text-align: center; margin: 22px 0 0; }

/* Aperçus sur les cartes */
.word-preview { display: flex; gap: 5px; flex-wrap: wrap; }
.word-preview span { width: 32px; height: 36px; display: grid; place-items: center; border-radius: 8px; background: rgba(255, 255, 255, .9); border: 2px solid var(--j-ink); font-weight: 800; }
.word-preview span.correct { background: var(--j-sun); }
.preview-keyboard { display: grid; gap: 4px; }
.preview-keyboard div { display: flex; gap: 3px; justify-content: center; }
.preview-keyboard span { min-width: 20px; padding: 3px 0; text-align: center; font-size: .7rem; font-weight: 700; border-radius: 5px; background: rgba(255, 255, 255, .55); }
.sudoku-preview { display: grid; grid-template-columns: repeat(9, 1fr); width: min(100%, 230px); aspect-ratio: 1; border: 2.5px solid var(--j-ink); border-radius: 10px; overflow: hidden; background: #fff; align-self: center; }
.sudoku-preview span { display: grid; place-items: center; font-size: .7rem; font-weight: 700; border-right: 1px solid #f1e2c4; border-bottom: 1px solid #f1e2c4; }
.sudoku-preview span:nth-child(3n):not(:nth-child(9n)) { border-right: 2px solid var(--j-ink); }
.sudoku-preview span:nth-child(n+19):nth-child(-n+27), .sudoku-preview span:nth-child(n+46):nth-child(-n+54) { border-bottom: 2px solid var(--j-ink); }
.mix-preview { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; align-content: center; padding: 8px 0; flex: 1; }
.mix-preview span { width: 38px; height: 42px; display: grid; place-items: center; border-radius: 10px; background: var(--j-sun); color: var(--j-ink); font-family: var(--font-title); font-size: 1.4rem; border: 2px solid var(--j-ink); }
.mix-preview span:nth-child(odd) { transform: rotate(-6deg); }
.mix-preview span:nth-child(even) { transform: rotate(5deg) translateY(3px); }

/* Écrans de jeu */
.jeux-game-head { display: flex; align-items: center; gap: 12px 16px; flex-wrap: wrap; margin-bottom: 16px; }
.jeux-game-head h2 { margin: 0; font-size: clamp(1.8rem, 4vw, 2.4rem); flex: 1; }
.jeux-back { color: var(--text-2); text-decoration: none; font-weight: 650; padding: 8px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); }
.jeux-back:hover { color: var(--text); background: var(--surface-2); }
.play-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 18px; align-items: start; }
.play-main { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.play-aside { border-radius: var(--radius); padding: 20px; border: 2px solid var(--j-ink); color: var(--j-ink); }
.g-word .play-aside { background: #ffe7e5; }
.g-sudoku .play-aside { background: #fff0d3; }
.g-mix .play-aside { background: #e9ebff; }
.play-aside h3 { margin: 0 0 10px; font-family: var(--font-title); font-weight: normal; text-transform: uppercase; font-size: 1.25rem; }
.play-aside p { margin: 0 0 10px; }
.play-aside .muted { color: #5b5065; }
.legend { display: inline-block; width: 16px; height: 16px; border-radius: 4px; vertical-align: -3px; margin-right: 6px; border: 1.5px solid var(--j-ink); }
.legend.correct { background: var(--j-coral); }
.legend.present { background: var(--j-sun); }
.legend.absent { background: #d9d2dc; }
.help { margin: 0; color: var(--muted); font-size: .9rem; }
.game-topline { display: flex; justify-content: space-between; gap: 10px; font-size: .9rem; font-weight: 650; color: var(--text-2); }
.game-topline .date-label { display: inline-block; }

/* Modes du Mot Secret */
.word-modes { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.word-modes button, .level-tabs button { font: inherit; font-weight: 650; font-size: .92rem; padding: 8px 14px; border-radius: 999px; border: 1.5px solid var(--border-strong); background: var(--surface); color: var(--text-2); cursor: pointer; transition: all .2s var(--ease); }
.word-modes button[aria-pressed="true"], .level-tabs button.active { background: var(--text); color: var(--bg); border-color: var(--text); }
.word-modes button:disabled, .level-tabs button:disabled { opacity: .6; cursor: wait; }
.suite-progress { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.suite-progress span { font-size: .85rem; font-weight: 650; padding: 5px 11px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.suite-progress .current { background: var(--j-sun); color: var(--j-ink); }
.suite-progress .finished { background: var(--libre-soft); color: var(--libre); }

/* Grille du mot */
.word-grid { display: grid; gap: 6px; justify-content: center; }
.word-row { display: flex; gap: 6px; }
.letter-cell { width: clamp(30px, 8.5vw, 50px); aspect-ratio: 1; display: grid; place-items: center; border-radius: 10px; border: 2px solid var(--border-strong); background: var(--surface); font-family: var(--font-title); font-size: clamp(1.1rem, 4vw, 1.7rem); text-transform: uppercase; color: var(--text); }
.letter-cell.offered { color: var(--muted); border-style: dashed; }
.letter-cell.typing { border-color: var(--text); animation: pop .25s var(--spring); }
.letter-cell.correct { background: var(--j-coral); border-color: var(--j-ink); color: #fff; }
.letter-cell.present { background: var(--j-sun); border-color: var(--j-ink); color: var(--j-ink); border-radius: 50%; }
.letter-cell.absent { background: #d9d2dc; border-color: #d9d2dc; color: #5b5065; }
.row-reveal .letter-cell { animation: jeux-flip .5s var(--ease) both; }
.row-reveal .letter-cell:nth-child(2) { animation-delay: .07s; } .row-reveal .letter-cell:nth-child(3) { animation-delay: .14s; }
.row-reveal .letter-cell:nth-child(4) { animation-delay: .21s; } .row-reveal .letter-cell:nth-child(5) { animation-delay: .28s; }
.row-reveal .letter-cell:nth-child(6) { animation-delay: .35s; } .row-reveal .letter-cell:nth-child(7) { animation-delay: .42s; }
.row-reveal .letter-cell:nth-child(8) { animation-delay: .49s; } .row-reveal .letter-cell:nth-child(9) { animation-delay: .56s; }
@keyframes jeux-flip { 0% { transform: rotateX(90deg); } 100% { transform: rotateX(0); } }

#word-form label, #mix-form label { display: block; font-weight: 700; font-size: .9rem; margin-bottom: 6px; }
.input-line { display: flex; gap: 8px; }
.input-line input { flex: 1; min-width: 0; font: inherit; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; padding: 12px 14px; border-radius: 12px; border: 2px solid var(--border-strong); background: var(--surface); color: var(--text); }
.input-line input:focus { outline: none; border-color: var(--primary); }
.word-error { margin: 6px 0 0; color: var(--danger); font-weight: 600; font-size: .9rem; }

/* Clavier */
.keyboard { display: grid; gap: 6px; }
.key-row { display: flex; gap: 5px; justify-content: center; }
.key { flex: 1; max-width: 44px; min-width: 0; height: 50px; border-radius: 9px; border: 0; background: var(--surface-2); color: var(--text); font: inherit; font-weight: 750; cursor: pointer; transition: transform .15s var(--spring), background .2s; }
.key:hover:not(:disabled) { transform: translateY(-2px); }
.key:active:not(:disabled) { transform: scale(.93); }
.key.wide { max-width: 66px; flex: 1.5; }
.key.correct { background: var(--j-coral); color: #fff; }
.key.present { background: var(--j-sun); color: var(--j-ink); }
.key.absent { background: #d9d2dc; color: #8a7f92; }
.key:disabled { opacity: .55; cursor: default; }

/* Résultat */
.result { border-radius: 18px; padding: 20px; background: var(--j-sun); color: var(--j-ink); border: 2.5px solid var(--j-ink); display: flex; flex-direction: column; align-items: flex-start; gap: 10px; animation: pop .4s var(--spring) both; }
.result h2 { margin: 0; font-size: 1.6rem; }
.result p { margin: 0; }
.result .dark { font: inherit; font-weight: 800; padding: 11px 18px; border-radius: 999px; border: 0; background: var(--j-ink); color: #fff; cursor: pointer; }
.result .secondary-result { color: var(--j-ink); font-weight: 700; }

/* Sudoku */
.sudoku-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.level-tabs { display: flex; gap: 6px; }
.timer { font-family: var(--font-title); font-size: 1.5rem; font-variant-numeric: tabular-nums; }
.sudoku-grid { display: grid; grid-template-columns: repeat(9, 1fr); width: min(100%, 470px); aspect-ratio: 1; margin: 0 auto; border: 3px solid var(--text); border-radius: 12px; overflow: hidden; background: var(--surface); }
.sudoku-cell { position: relative; border: 0; border-right: 1px solid var(--border-strong); border-bottom: 1px solid var(--border-strong); background: var(--surface); color: var(--commande); font: inherit; font-size: clamp(1rem, 4.4vw, 1.5rem); font-weight: 700; cursor: pointer; padding: 0; min-width: 0; }
.sudoku-cell:nth-child(3n):not(:nth-child(9n)) { border-right: 2.5px solid var(--text); }
.sudoku-cell:nth-child(n+19):nth-child(-n+27), .sudoku-cell:nth-child(n+46):nth-child(-n+54) { border-bottom: 2.5px solid var(--text); }
.sudoku-cell:nth-child(9n) { border-right: 0; }
.sudoku-cell.given { color: var(--text); font-weight: 800; }
.sudoku-cell.peer { background: var(--surface-2); }
.sudoku-cell.same { background: color-mix(in srgb, var(--j-sun) 45%, var(--surface)); }
.sudoku-cell.selected { background: var(--j-sun); color: var(--j-ink); }
.sudoku-cell.conflict, .sudoku-cell.checked-error { color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, var(--surface)); }
.sudoku-cell:focus-visible { outline: 3px solid var(--primary); outline-offset: -3px; border-radius: 0; }
.notes-grid { position: absolute; inset: 2px; display: grid; grid-template-columns: repeat(3, 1fr); font-size: clamp(.5rem, 1.8vw, .66rem); font-weight: 600; color: var(--muted); line-height: 1; }
.notes-grid span { display: grid; place-items: center; }
.number-pad { display: grid; grid-template-columns: repeat(9, 1fr); gap: 6px; width: min(100%, 470px); margin: 0 auto; }
.number-pad button { aspect-ratio: 1; max-height: 52px; border-radius: 10px; border: 2px solid var(--text); background: var(--surface); color: var(--text); font: inherit; font-size: 1.2rem; font-weight: 800; cursor: pointer; transition: transform .15s var(--spring); }
.number-pad button:hover:not(:disabled) { background: var(--j-sun); color: var(--j-ink); transform: translateY(-2px); }
.sudoku-tools { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.sudoku-tools button { font: inherit; font-weight: 650; font-size: .9rem; padding: 8px 13px; border-radius: 999px; border: 1.5px solid var(--border-strong); background: var(--surface); color: var(--text-2); cursor: pointer; }
.sudoku-tools button:hover:not(:disabled) { border-color: var(--text); color: var(--text); }
.sudoku-tools button[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.sudoku-tools button:disabled, .number-pad button:disabled { opacity: .5; cursor: default; }

/* Méli-Mot */
.mix-letters { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; padding: 10px 0; }
.mix-letters button { width: clamp(40px, 10vw, 54px); aspect-ratio: 1 / 1.1; border-radius: 12px; border: 2.5px solid var(--j-ink); background: var(--j-sun); color: var(--j-ink); font-family: var(--font-title); font-size: clamp(1.3rem, 5vw, 1.9rem); cursor: pointer; box-shadow: 0 6px 0 -1px var(--j-ink); transition: transform .2s var(--spring), box-shadow .2s; }
.mix-letters button:nth-child(odd) { transform: rotate(-4deg); }
.mix-letters button:nth-child(even) { transform: rotate(3deg); }
.mix-letters button:hover:not(:disabled) { transform: translateY(-4px) rotate(0); }
.mix-letters button:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 2px 0 -1px var(--j-ink); }
.mix-letters button:disabled { opacity: .6; cursor: default; }
#shuffle-mix { align-self: center; }
.mix-history { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.mix-history li { display: flex; justify-content: space-between; gap: 10px; padding: 10px 14px; border-radius: 12px; background: var(--surface-2); font-weight: 800; letter-spacing: .12em; }
.mix-history li span { font-weight: 600; letter-spacing: 0; color: var(--muted); font-size: .88rem; }

/* Fenêtre (scores, règles) */
.jeux-dialog { width: min(520px, calc(100vw - 32px)); border: 2.5px solid var(--text); border-radius: 22px; padding: 26px; background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); }
.jeux-dialog::backdrop { background: rgba(45, 36, 51, .45); backdrop-filter: blur(3px); }
.jeux-dialog h2 { margin: 0 0 10px; font-size: 1.7rem; }
.jeux-dialog p { margin: 0 0 10px; color: var(--text-2); }
.jeux-close { position: absolute; top: 12px; right: 12px; width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font-size: 1.4rem; line-height: 1; cursor: pointer; }
.stats-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 14px 0; }
.stat { display: flex; flex-direction: column; align-items: center; padding: 14px 6px; border-radius: 14px; background: var(--j-sun); color: var(--j-ink); text-align: center; }
.stat strong { font-family: var(--font-title); font-weight: normal; font-size: 2rem; line-height: 1; }
.stat small { font-weight: 650; font-size: .78rem; margin-top: 4px; }
.stats-detail { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--border-strong); font-size: .95rem; }
.copy-area { width: 100%; min-height: 140px; font: inherit; padding: 12px; border-radius: 12px; border: 1.5px solid var(--border-strong); background: var(--surface-2); color: var(--text); }
.jeux-party { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 90; }
.jeux-toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 95; max-width: calc(100vw - 32px); padding: 12px 18px; border-radius: 14px; background: var(--text); color: var(--bg); font-weight: 650; box-shadow: var(--shadow-lg); animation: pop .3s var(--spring) both; }

@media (max-width: 900px) {
  .jeux-cards { grid-template-columns: minmax(0, 1fr); }
  .play-layout { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 720px) {
  .jeux-toast { bottom: 84px; }
  .key { height: 46px; }
  .key-row { gap: 4px; }
}
@media (prefers-reduced-motion: reduce) {
  .row-reveal .letter-cell, .letter-cell.typing, .result, .jeux-toast { animation: none; }
}
/* Mode sombre : on garde les cases colorées lisibles */
html[data-theme="dark"] .letter-cell.absent, html[data-theme="dark"] .key.absent, html[data-theme="dark"] .legend.absent { background: #4d3f56; border-color: #4d3f56; color: #a194aa; }
html[data-theme="dark"] .jeux-card { border-color: #f4edf6; }