/* Police Outfit, auto-hebergee (variable, latin + latin-ext) — aucune requete
   vers Google Fonts (vie privee + perf). Fichiers dans frontend/fonts/. */
@font-face {
  font-family: "Outfit";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("fonts/outfit-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Outfit";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("fonts/outfit-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --emerald: #059669;
  --teal: #0d9488;
  --sky: #0ea5e9;
  --gold: #f59e0b;
  --ink: #0b1f1a;
  --muted: #64748b;
  --bg: #eef3f1;
  --card-border: rgba(255, 255, 255, 0.6);
  --shadow: 0 18px 40px -18px rgba(6, 78, 59, 0.35);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: "Outfit", ui-sans-serif, system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 90% -10%, #d1fae5 0%, transparent 55%),
    radial-gradient(900px 500px at -10% 10%, #cffafe 0%, transparent 50%),
    var(--bg);
  min-height: 100vh;
}

/* ---------- décor flottant ---------- */
.bg { position: fixed; inset: 0; overflow: hidden; z-index: 0; pointer-events: none; }
.bg span {
  position: absolute;
  top: 110%;
  left: var(--x);
  font-size: calc(2.2rem * var(--s));
  font-weight: 800;
  color: rgba(13, 148, 136, 0.13);
  animation: float 16s linear infinite;
  animation-delay: var(--d);
}
@keyframes float {
  0%   { transform: translateY(0) rotate(0deg); opacity: 0; }
  10%  { opacity: 1; }
  90%  { opacity: 1; }
  100% { transform: translateY(-118vh) rotate(220deg); opacity: 0; }
}

/* ---------- confetti ---------- */
#confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 60; }

/* ---------- hero ---------- */
.hero {
  position: relative;
  color: #fff;
  background: linear-gradient(135deg, #064e3b 0%, #0d9488 48%, #0ea5e9 100%);
  padding: 0 0 5.5rem;
  overflow: hidden;
  z-index: 1;
}
.hero::before {
  content: "";
  position: absolute; inset: 0;
  background:
    radial-gradient(600px 300px at 80% 0%, rgba(245, 158, 11, 0.35), transparent 60%),
    radial-gradient(500px 260px at 10% 30%, rgba(255, 255, 255, 0.18), transparent 60%);
  pointer-events: none;
}
.nav {
  position: relative; z-index: 2;
  max-width: 1000px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.25rem 1.25rem 0;
}
.brand { font-weight: 800; font-size: 1.25rem; letter-spacing: -0.02em; display: flex; align-items: center; gap: .5rem; }
.brand .logo { font-size: 1.5rem; filter: drop-shadow(0 2px 6px rgba(0,0,0,.25)); }
.brand-accent { color: #fde68a; }
.hero-inner { position: relative; z-index: 2; max-width: 780px; margin: 2.6rem auto 0; padding: 0 1.25rem; text-align: center; }
.pill {
  display: inline-block; background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.35);
  padding: .4rem 1rem; border-radius: 999px; font-weight: 600; font-size: .9rem;
  backdrop-filter: blur(6px);
}
.hero-title { font-size: clamp(2.1rem, 5.5vw, 3.6rem); line-height: 1.05; font-weight: 900; letter-spacing: -0.03em; margin: 1.1rem 0 .6rem; }
.grad-text { background: linear-gradient(90deg, #fde68a, #fffbeb); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-sub { font-size: 1.1rem; opacity: .95; max-width: 580px; margin: 0 auto; }
.wave {
  position: absolute; bottom: -1px; left: 0; right: 0; height: 60px;
  background: var(--bg);
  -webkit-mask: radial-gradient(70px 60px at 50% 0, transparent 98%, #000) repeat-x;
  mask: radial-gradient(70px 60px at 50% 0, transparent 98%, #000) repeat-x;
  -webkit-mask-size: 140px 60px; mask-size: 140px 60px;
}

/* ---------- layout ---------- */
.container { position: relative; z-index: 2; max-width: 880px; margin: -2.5rem auto 0; padding: 0 1.25rem 3rem; }
.glass {
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--card-border);
  border-radius: 22px;
  box-shadow: var(--shadow);
}
.card, .cta-card { padding: 1.6rem 1.7rem; margin-bottom: 1.3rem; animation: fadeUp .6s both; }
.card:nth-child(2) { animation-delay: .05s; }
.card:nth-child(3) { animation-delay: .12s; }
.card:nth-child(4) { animation-delay: .18s; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(22px); } to { opacity: 1; transform: none; } }
h2 { margin: 0 0 1rem; font-size: 1.35rem; font-weight: 800; letter-spacing: -0.02em; }

/* ---------- CTA déconnecté ---------- */
.cta-card { text-align: center; }
.cta-card h2 { font-size: 1.7rem; }
.lead { color: var(--muted); font-size: 1.05rem; max-width: 460px; margin: 0 auto 1.4rem; }
.btn-xl {
  border: 0; cursor: pointer; color: #fff; font: inherit; font-weight: 800; font-size: 1.15rem;
  padding: 1rem 2.2rem; border-radius: 999px;
  background: linear-gradient(135deg, var(--emerald), var(--teal));
  box-shadow: 0 12px 28px -8px rgba(13, 148, 136, 0.7);
  display: inline-flex; align-items: center; gap: .6rem;
  transition: transform .18s ease, box-shadow .18s ease;
}
.btn-xl:hover { transform: translateY(-3px) scale(1.02); box-shadow: 0 18px 36px -8px rgba(13, 148, 136, 0.8); }
.btn-xl .arrow { transition: transform .18s ease; }
.btn-xl:hover .arrow { transform: translateX(5px); }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-top: 2.2rem; }
.step { text-align: center; padding: 1rem; border-radius: 16px; background: rgba(13, 148, 136, 0.06); }
.step-emoji { font-size: 2rem; }
.step h3 { margin: .5rem 0 .3rem; font-size: 1rem; }
.step p { margin: 0; color: var(--muted); font-size: .88rem; }

/* ---------- stats ---------- */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-bottom: 1.3rem; }
.stat {
  background: rgba(255, 255, 255, 0.78); backdrop-filter: blur(14px);
  border: 1px solid var(--card-border); border-radius: 18px; padding: 1.1rem .5rem;
  text-align: center; box-shadow: var(--shadow); animation: fadeUp .5s both;
}
.stat-num { font-size: 2.1rem; font-weight: 900; line-height: 1; color: var(--teal); letter-spacing: -0.03em; }
.stat-hot .stat-num { color: var(--gold); }
.stat-lbl { font-size: .82rem; color: var(--muted); margin-top: .3rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }

/* ---------- formulaire ---------- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
label { display: block; margin: .8rem 0; font-weight: 700; font-size: .92rem; }
.muted { color: var(--muted); font-weight: 400; }
input, textarea {
  width: 100%; margin-top: .4rem; padding: .75rem .85rem;
  border: 1.5px solid #dbe6e2; border-radius: 12px; font: inherit; font-weight: 500;
  background: #fff; transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, textarea:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 4px rgba(13, 148, 136, 0.12); }
textarea { resize: vertical; }
.count {
  float: right; background: rgba(13, 148, 136, 0.12); color: var(--teal);
  font-weight: 800; font-size: .8rem; padding: .1rem .6rem; border-radius: 999px;
}
.count-hot { background: rgba(245, 158, 11, 0.15); color: #b45309; }
.save-row { display: flex; align-items: center; gap: .9rem; margin-top: .5rem; }
.btn-primary {
  border: 0; cursor: pointer; color: #fff; font: inherit; font-weight: 700; font-size: 1rem;
  padding: .7rem 1.5rem; border-radius: 999px;
  background: linear-gradient(135deg, var(--emerald), var(--teal));
  box-shadow: 0 10px 22px -10px rgba(13, 148, 136, 0.8);
  transition: transform .15s ease;
}
.btn-primary:hover { transform: translateY(-2px); }
.btn-ghost {
  border: 1.5px solid #d6e3df; background: #fff; cursor: pointer; font: inherit; font-weight: 700;
  padding: .45rem .9rem; border-radius: 999px; color: var(--ink); font-size: .85rem;
}
.btn-ghost:hover { border-color: var(--teal); color: var(--teal); }
.status { font-weight: 700; color: var(--emerald); }
.row-between { display: flex; align-items: center; justify-content: space-between; }

/* ---------- auth bar ---------- */
#authBar .btn-sm {
  border: 1px solid rgba(255, 255, 255, 0.5); background: rgba(255, 255, 255, 0.15);
  color: #fff; cursor: pointer; font: inherit; font-weight: 600; font-size: .85rem;
  padding: .4rem .9rem; border-radius: 999px; backdrop-filter: blur(6px);
}
#authBar .btn-sm:hover { background: rgba(255, 255, 255, 0.28); }

/* ---------- matches ---------- */
.match {
  position: relative; overflow: hidden;
  border: 1.5px solid #e3ece9; border-radius: 16px; padding: 1.1rem 1.2rem; margin-bottom: 1rem;
  background: #fff; animation: fadeUp .45s both;
}
.match.mutual {
  border: 0; color: #3a2a00;
  background:
    linear-gradient(#fffdf5, #fffdf5) padding-box,
    linear-gradient(120deg, #f59e0b, #fde68a, #f59e0b) border-box;
  border: 2px solid transparent;
  box-shadow: 0 14px 30px -16px rgba(245, 158, 11, 0.7);
}
.match.mutual::after {
  content: ""; position: absolute; top: 0; left: -60%; width: 50%; height: 100%;
  background: linear-gradient(120deg, transparent, rgba(255, 255, 255, 0.75), transparent);
  transform: skewX(-18deg); animation: sheen 3.2s ease-in-out infinite;
}
@keyframes sheen { 0% { left: -60%; } 55%, 100% { left: 130%; } }
.match h3 { margin: 0 0 .5rem; font-size: 1.15rem; display: flex; align-items: center; gap: .5rem; }
.badge {
  font-size: .68rem; font-weight: 800; padding: .18rem .6rem; border-radius: 999px;
  text-transform: uppercase; letter-spacing: .04em;
}
.badge.mutual { background: linear-gradient(135deg, #f59e0b, #fbbf24); color: #422006; }
.trade-line { display: flex; align-items: center; gap: .5rem; margin: .35rem 0; font-size: .95rem; }
.trade-line .dir { font-size: 1.1rem; }
.chips { display: flex; flex-wrap: wrap; gap: .35rem; }
.chip { font-family: ui-monospace, monospace; font-weight: 700; font-size: .82rem; padding: .12rem .55rem; border-radius: 8px; }
.chip.get { background: rgba(14, 165, 233, 0.14); color: #0369a1; }
.chip.give { background: rgba(5, 150, 105, 0.14); color: #047857; }
.match-actions { margin-top: .8rem; display: flex; gap: .5rem; }
.match-actions input { margin-top: 0; }
.match-actions button { white-space: nowrap; }
.btn-primary:disabled { opacity: .45; cursor: not-allowed; }
.album-head-right { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; justify-content: flex-end; }

/* Page publique (lecture seule) /u/<sub> : on masque tout ce qui est édition. */
body.public #profileCard, body.public #matchesCard, body.public #propsCard,
body.public #saveBar, body.public #readyBanner, body.public .legend,
body.public #shareBtn, body.public #linkBtn, body.public .stat-hot { display: none !important; }
body.public .tile { cursor: default; }
#publicBanner { position: relative; z-index: 2; border-radius: 16px; padding: 1rem 1.2rem; margin-bottom: 1rem;
  background: linear-gradient(135deg, #064e3b, #0d9488); color: #fff; box-shadow: var(--shadow); }
#publicBanner .pb-title { font-weight: 800; font-size: 1.15rem; }
#publicBanner .pb-sub { opacity: .9; font-size: .9rem; margin-top: .15rem; }
#publicBanner .pb-cta { display: inline-block; margin-top: .7rem; background: #fde68a; color: #422006;
  font-weight: 800; padding: .5rem .9rem; border-radius: 10px; text-decoration: none; }
.adjust-row { margin: .5rem 0 .1rem; }
.btn-link { background: none; border: 0; padding: .1rem 0; color: var(--teal); font: inherit; font-size: .85rem; cursor: pointer; text-decoration: underline; }
button.chip { border: 0; cursor: pointer; }
.chips.pick { margin: .25rem 0 .55rem; }
.chip.off { opacity: .4; filter: grayscale(.6); }

/* ---------- propositions d'échange ---------- */
.sub-h { margin: 1.1rem 0 .5rem; font-size: .95rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 800; }
.prop { border: 1.5px solid #e3ece9; border-left-width: 4px; border-radius: 0 14px 14px 0; padding: .8rem 1rem; margin-bottom: .8rem; background: #fff; }
.prop-pending { border-left-color: var(--gold); }
.prop-accepted { border-left-color: var(--emerald); background: rgba(5, 150, 105, 0.05); }
.prop-declined { border-left-color: #cbd5e1; opacity: .7; }
.prop-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .4rem; }
.prop-status { font-size: .78rem; font-weight: 700; color: var(--muted); white-space: nowrap; }
.prop-note { margin: .5rem 0 0; font-style: italic; color: #475569; font-size: .92rem; }
.prop-contact { margin-top: .6rem; padding: .5rem .7rem; background: rgba(5, 150, 105, 0.12); border-radius: 10px; font-size: 1rem; }

/* ---------- footer ---------- */
.footer { position: relative; z-index: 2; text-align: center; color: var(--muted); font-size: .9rem; padding: 1rem 1rem 2.5rem; }
.footer-links { display: block; margin-top: .5rem; font-size: .82rem; }
.footer-links a { color: var(--teal); text-decoration: none; }
.footer-links a:hover { text-decoration: underline; }

/* Pages légales (mentions-legales.html, confidentialite.html) */
.legal { position: relative; z-index: 2; max-width: 760px; margin: 2.5rem auto; padding: 0 1.25rem 3rem; }
.legal .back { display: inline-block; margin-bottom: 1rem; color: var(--teal); text-decoration: none; font-weight: 600; }
.legal .back:hover { text-decoration: underline; }
.legal h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); margin: .2rem 0 1.4rem; }
.legal h2 { font-size: 1.15rem; margin: 1.8rem 0 .5rem; color: var(--emerald); }
.legal p, .legal li { color: #334155; line-height: 1.65; }
.legal a { color: var(--teal); }
.legal .updated { color: var(--muted); font-size: .85rem; }
.legal .note { background: rgba(13,148,136,.07); border: 1px solid #dbe6e2; border-radius: 12px; padding: .8rem 1rem; font-size: .9rem; }
.hidden { display: none !important; }

/* ---------- responsive ---------- */
@media (max-width: 620px) {
  .grid-2, .steps { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(3, 1fr); gap: .6rem; }
  .stat-num { font-size: 1.6rem; }
  .match-actions { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
  .bg span, .match.mutual::after, .card, .stat, .match { animation: none; }
}

/* ---------- album : légende ---------- */
.legend { display: flex; flex-wrap: wrap; gap: .5rem .9rem; align-items: center; color: var(--muted); font-size: .85rem; margin: .1rem 0 1rem; }
.lg { display: inline-flex; align-items: center; gap: .35rem; font-weight: 700; font-size: .8rem; padding: .15rem .55rem; border-radius: 999px; }
.lg::before { content: ""; width: .7rem; height: .7rem; border-radius: 50%; }
.lg.missing { background: rgba(239, 68, 68, .12); color: #b91c1c; } .lg.missing::before { background: #ef4444; }
.lg.own { background: rgba(5, 150, 105, .14); color: #047857; } .lg.own::before { background: #10b981; }
.lg.double { background: rgba(245, 158, 11, .15); color: #b45309; } .lg.double::before { background: #f59e0b; }

/* ---------- album : barre d'outils ---------- */
.album-toolbar { position: sticky; top: 0; z-index: 5; background: rgba(255, 255, 255, .88); backdrop-filter: blur(8px); padding: .6rem 0; margin-bottom: .7rem; }
#search { width: 100%; margin: 0 0 .6rem; padding: .7rem 1rem; border: 1.5px solid #dbe6e2; border-radius: 999px; font: inherit; font-weight: 500; }
#search:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(13, 148, 136, .15); }
.cat-chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip-cat { border: 1.5px solid #d6e3df; background: #fff; cursor: pointer; font: inherit; font-weight: 700; font-size: .82rem; padding: .35rem .8rem; border-radius: 999px; color: var(--ink); }
.chip-cat.active { background: linear-gradient(135deg, var(--emerald), var(--teal)); border-color: transparent; color: #fff; }

/* ---------- album : sections ---------- */
.sec { border: 1px solid #e3ece9; border-radius: 14px; margin-bottom: .6rem; background: #fff; overflow: hidden; }
.sec[open] { box-shadow: var(--shadow); }
.sec-head { list-style: none; cursor: pointer; display: flex; align-items: center; gap: .6rem; padding: .7rem .9rem; font-weight: 800; }
.sec-head::-webkit-details-marker { display: none; }
.sec-head::after { content: "▾"; margin-left: .3rem; color: var(--muted); transition: transform .2s; }
.sec[open] .sec-head::after { transform: rotate(180deg); }
.sec-flag { font-size: 1.3rem; line-height: 1; }
.sec-title { flex: 1 1 auto; min-width: 0; }
.sec-meta { display: flex; align-items: center; gap: .4rem; }
.sec-badge { background: linear-gradient(135deg, #f59e0b, #fbbf24); color: #422006; font-size: .72rem; font-weight: 800; padding: .1rem .5rem; border-radius: 999px; }
.sec-count { color: var(--muted); font-size: .8rem; font-weight: 700; }

/* ---------- album : vignettes ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: .5rem; padding: .2rem .9rem .9rem; }
.tile { position: relative; text-align: left; cursor: pointer; font: inherit; border: 1.5px solid #e3ece9; border-radius: 12px; background: #fff; padding: .5rem .6rem; min-height: 60px; display: flex; flex-direction: column; gap: .15rem; transition: transform .08s ease, border-color .15s, background .15s; }
.tile:active { transform: scale(.95); }
.tcode { font-family: ui-monospace, monospace; font-size: .68rem; font-weight: 700; color: var(--muted); }
.tname { font-size: .82rem; font-weight: 600; color: var(--ink); line-height: 1.2; }
.tile.missing { background: rgba(239, 68, 68, .07); border-color: rgba(239, 68, 68, .45); }
.tile.missing .tcode { color: #b91c1c; }
.tile.own { background: rgba(5, 150, 105, .09); border-color: rgba(5, 150, 105, .5); }
.tile.own .tcode { color: #047857; }
.tile.double { background: rgba(245, 158, 11, .14); border-color: rgba(245, 158, 11, .65); }
.tile.double .tcode { color: #b45309; }
.tile::after { position: absolute; top: .28rem; right: .42rem; font-size: .72rem; font-weight: 800; }
.tile.own::after { content: "✓"; color: #059669; }
.tile.double::after { content: "🟡"; }
.tile.foil { background-image: linear-gradient(135deg, rgba(245, 230, 138, .28), rgba(14, 165, 233, .12), rgba(168, 85, 247, .16)); }
.tile.foil .tname::after { content: " ✦"; color: #b45309; }

/* ---------- album : barre d'enregistrement ---------- */
.savebar { position: fixed; left: 50%; transform: translateX(-50%); bottom: 14px; z-index: 30; display: flex; align-items: center; gap: .8rem; background: rgba(11, 31, 26, .92); color: #fff; padding: .5rem .6rem .5rem 1.1rem; border-radius: 999px; box-shadow: 0 14px 30px -8px rgba(0, 0, 0, .4); backdrop-filter: blur(6px); max-width: calc(100% - 24px); }
.savebar-counts { font-size: .85rem; font-weight: 600; white-space: nowrap; }
.savebar-counts b { color: #fde68a; }
.savebar .btn-primary { padding: .5rem 1.1rem; font-size: .92rem; }
.savebar .status { font-size: .8rem; white-space: nowrap; }
.savebar .status.ok { color: #6ee7b7; }
.savebar .status.warn { color: #fca5a5; }
.savebar .status.dirty { color: #fcd34d; }
#loggedIn { padding-bottom: 88px; }

/* ---------- bandeau "prêt à échanger" ---------- */
.ready-banner { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; border-radius: 16px; padding: .85rem 1.05rem; margin-bottom: 1rem; font-size: .95rem; box-shadow: var(--shadow); }
.ready-banner .rb-txt { flex: 1 1 220px; min-width: 0; }
.ready-banner.warn { background: linear-gradient(135deg, #fffbeb, #fef3c7); color: #7c2d12; border: 1.5px solid #fcd34d; }
.ready-banner.ok { background: linear-gradient(135deg, #ecfdf5, #d1fae5); color: #065f46; border: 1.5px solid #6ee7b7; }
.ready-banner .btn-primary { white-space: nowrap; }
.ready-banner .pausebtn { border: 1.5px solid #6ee7b7; background: rgba(255, 255, 255, .65); color: #047857; font: inherit; font-weight: 700; font-size: .85rem; padding: .45rem 1rem; border-radius: 999px; cursor: pointer; white-space: nowrap; transition: background .15s; }
.ready-banner .pausebtn:hover { background: #fff; }

@media (max-width: 620px) {
  .tiles { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
  .savebar-counts { font-size: .78rem; }
  .ready-banner { font-size: .9rem; }
  .ready-banner .btn-primary { flex: 1 1 100%; }
}
