/* Parrain-Fillot : design pensé uniquement pour smartphone (maquette.html v1). */
:root {
  --blue: #0061A7;
  --green: #45A84A;
  --grad: linear-gradient(135deg, var(--blue), var(--green));
  --ink: #13203A;
  --muted: #66758C;
  --line: #E3EAF1;
  --mist: #F1F6F9;
  --white: #FFFFFF;
  --danger: #C8243F;
  --display: "Bricolage Grotesque", system-ui, sans-serif;
  --body: "Figtree", system-ui, sans-serif;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; margin: 0; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; background: var(--white); }
body { font-family: var(--body); color: var(--ink); background: var(--white); max-width: 480px; margin: 0 auto; min-height: 100dvh; -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.sprite { position: absolute; }
.icon { width: 22px; height: 22px; flex: none; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); font-size: 14px; }
.link { color: var(--blue); font-weight: 600; text-decoration: underline; padding: 8px 0; }
.link.light { color: #fff; }

.logo { display: flex; align-items: center; gap: 8px; font-family: var(--display); font-weight: 800; font-size: 20px; letter-spacing: -.02em; text-decoration: none; }
.logo svg { width: 28px; height: 28px; }

.cta { display: flex; justify-content: center; align-items: center; gap: 8px; width: 100%; padding: 15px; border-radius: 99px; background: var(--grad); color: #fff; font-weight: 700; font-size: 16px; text-decoration: none; text-align: center; }
.cta svg { width: 20px; height: 20px; fill: #fff; }
.cta.light { background: #fff; color: var(--ink); margin-top: 28px; }
.cta .left { opacity: .8; font-weight: 600; font-size: 13px; }
.cta[aria-pressed="true"] { background: var(--ink); }
.cta[aria-pressed="true"] svg { fill: #E63946; }
.cta .si-oui, .cta[aria-pressed="true"] .si-non { display: none; }
.cta[aria-pressed="true"] .si-oui { display: inline; }
.cta:disabled, .like:disabled { opacity: .55; cursor: default; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 16px; border-radius: 99px; border: 1.5px solid var(--line); background: #fff; font-weight: 700; text-decoration: none; cursor: pointer; }
.btn.small { padding: 6px 12px; font-size: 14px; }
.btn.primary { background: var(--grad); border-color: transparent; color: #fff; }
.btn.danger { color: var(--danger); border-color: #F3C3CC; }

.alert { background: #FFE8EC; color: #9B1C33; padding: 10px 12px; border-radius: 12px; font-size: 14px; font-weight: 600; }
.alert.ok { background: #E1FAF2; color: #0B6E53; }

.field label, .field legend { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 6px; padding: 0; }
/* 16px minimum : sinon Safari iPhone zoome à chaque champ */
.field input, .field textarea { width: 100%; font-size: 16px; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 14px; background: var(--mist); }
.field textarea { resize: vertical; min-height: 84px; }
fieldset { border: 0; padding: 0; min-width: 0; }
.req { color: var(--blue); }

/* ---------- Pages d'accueil ---------- */
/* Photo de la sphère (sigma-clermont.fr) sous un voile aux couleurs de l'école, pour que le texte reste lisible. */
body.signup { color: #fff; background: linear-gradient(170deg, rgba(0,97,167,.82) 0%, rgba(0,97,167,.35) 45%, rgba(69,168,74,.85) 100%), url(/sphere.png) 14% 30% / auto 118% no-repeat, var(--blue); }
.signup-body { min-height: 100dvh; display: flex; flex-direction: column; padding: calc(28px + var(--safe-t)) 24px calc(24px + var(--safe-b)); }
.signup .logo { font-size: 24px; }
.promo-pill { align-self: flex-start; margin-top: 40px; background: rgba(255,255,255,.2); padding: 6px 12px; border-radius: 99px; font-weight: 600; font-size: 13px; }
.signup h1 { font-family: var(--display); font-weight: 800; font-size: 40px; line-height: 1.02; letter-spacing: -.03em; margin: 14px 0 10px; }
.signup .logo + h1 { margin-top: 40px; }
.signup-body > p { opacity: .92; line-height: 1.45; margin-bottom: 28px; }
.signup .form { display: grid; gap: 12px; margin-top: auto; background: #fff; color: var(--ink); border-radius: 26px; padding: 20px; }
.signup .form small { text-align: center; color: var(--muted); }
.signup .form small a { color: var(--blue); font-weight: 600; }

/* ---------- Appli ---------- */
body.app { padding-bottom: calc(80px + var(--safe-b)); }
body.app.nu { padding-bottom: calc(96px + var(--safe-b)); }
.appbar { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: calc(10px + var(--safe-t)) 18px 10px; background: rgba(255,255,255,.94); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.appbar .logo { font-size: 17px; white-space: nowrap; }
.appbar .logo svg { width: 24px; height: 24px; }
.hearts { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; }
.hearts-row { display: flex; gap: 2px; }
.hearts-row svg { width: 10px; height: 10px; fill: #D5DEE8; }
.hearts-row svg.on { fill: url(#g); }
.tabbar { position: fixed; bottom: 0; left: 50%; translate: -50% 0; width: 100%; max-width: 480px; z-index: 5; display: flex; justify-content: space-around; border-top: 1px solid var(--line); padding: 8px 0 calc(8px + var(--safe-b)); background: #fff; }
.tab { display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 64px; padding: 4px 8px; font-size: 11px; font-weight: 600; color: var(--muted); text-decoration: none; }
.tab svg { width: 22px; height: 22px; }
.tab[aria-current] { color: var(--blue); }

.intro { padding: 4px 18px 0; }
.intro h1 { font-family: var(--display); font-weight: 800; font-size: 28px; letter-spacing: -.02em; line-height: 1.1; }
.sub { color: var(--muted); font-size: 14px; margin-top: 4px; line-height: 1.4; }
.empty { padding: 24px 18px; color: var(--muted); text-align: center; line-height: 1.5; }
.empty a { color: var(--blue); font-weight: 600; }

.search { margin: 14px 18px 10px; display: flex; align-items: center; gap: 8px; background: var(--mist); border-radius: 14px; padding: 10px 14px; color: var(--muted); }
.search input { border: 0; background: none; font-size: 16px; flex: 1; min-width: 0; color: var(--ink); }
.search input:focus { outline: none; }
.search:focus-within { outline: 3px solid var(--blue); outline-offset: 2px; }
.filters { display: flex; gap: 8px; padding: 0 18px 14px; }
.chip { appearance: none; -webkit-appearance: none; padding: 8px 32px 8px 14px; border-radius: 99px; border: 1.5px solid var(--line); font-size: 16px; font-weight: 600; min-width: 0;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2313203A' stroke-width='3'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center / 12px; }
.chip.on { border-color: var(--ink); }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 0 18px 18px; }
.card { position: relative; aspect-ratio: 3 / 4; border-radius: 20px; overflow: hidden; background: var(--grad); }
.card-link { position: absolute; inset: 0; color: #fff; text-decoration: none; }
.card-link img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-link::after { content: ""; position: absolute; inset: 45% 0 0; background: linear-gradient(transparent, rgba(19,32,58,.85)); pointer-events: none; }
.card-text { position: absolute; left: 12px; right: 12px; bottom: 10px; z-index: 1; display: flex; flex-direction: column; align-items: flex-start; }
.card-name { font-family: var(--display); font-weight: 800; font-size: 19px; line-height: 1.1; }
.card-nick { font-size: 12.5px; opacity: .85; }
.card-tag { margin-top: 6px; font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 99px; background: rgba(255,255,255,.22); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.card form { position: absolute; top: 8px; right: 8px; z-index: 2; }
.like { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.92); }
.like svg { width: 19px; height: 19px; fill: none; stroke: var(--ink); stroke-width: 2; }
.like[aria-pressed="true"] svg { fill: #E63946; stroke: #E63946; } /* liké = cœur rouge */

/* Profil */
.hero { position: relative; height: min(62vh, 520px); background: var(--grad); }
.hero img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hero::after { content: ""; position: absolute; inset: 50% 0 0; background: linear-gradient(transparent, rgba(19,32,58,.9)); }
.back { position: absolute; top: calc(12px + var(--safe-t)); left: 14px; z-index: 1; width: 40px; height: 40px; border-radius: 50%; background: rgba(255,255,255,.92); display: grid; place-items: center; color: var(--ink); }
.hero-text { position: absolute; left: 20px; right: 20px; bottom: 18px; color: #fff; z-index: 1; }
.hero-text h1 { font-family: var(--display); font-weight: 800; font-size: 34px; letter-spacing: -.02em; line-height: 1; }
.hero-text .nick { margin-top: 4px; opacity: .9; }
.hero-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.hero-tags span { font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 99px; background: rgba(255,255,255,.22); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
body.nu { background: var(--mist); }
.answers { padding: 16px 16px 24px; display: grid; gap: 10px; background: var(--mist); }
.answer { background: #fff; border-radius: 18px; padding: 16px; }
.answer h2 { font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.answer p { font-family: var(--display); font-weight: 600; font-size: 19px; line-height: 1.25; letter-spacing: -.01em; white-space: pre-line; overflow-wrap: anywhere; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tags span { font-size: 13px; font-weight: 600; padding: 6px 11px; border-radius: 99px; border: 1.5px solid var(--line); }
.sticky { position: fixed; bottom: 0; left: 50%; translate: -50% 0; width: 100%; max-width: 480px; z-index: 5; padding: 18px 16px calc(14px + var(--safe-b)); background: linear-gradient(transparent, var(--mist) 35%); }

/* Mon profil */
.edit { padding: 14px 18px 24px; display: grid; gap: 16px; }
.edit-form fieldset { display: grid; gap: 16px; }
.photo-edit { display: flex; align-items: center; gap: 14px; }
.photo-edit img { width: 84px; height: 112px; object-fit: cover; border-radius: 16px; background: var(--grad); }
.photo-edit .btn:focus-within { outline: 3px solid var(--blue); outline-offset: 2px; }
.choices { display: flex; flex-wrap: wrap; gap: 8px; }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; inset: 0; margin: 0; }
.choice span { display: inline-block; padding: 8px 13px; border-radius: 99px; border: 1.5px solid var(--line); font-size: 14px; font-weight: 600; }
.choice input:checked + span { background: var(--ink); border-color: var(--ink); color: #fff; }
.choice input:focus-visible + span { outline: 3px solid var(--blue); outline-offset: 2px; }
.save { position: sticky; bottom: calc(76px + var(--safe-b)); box-shadow: 0 10px 24px -12px rgba(0,97,167,.6); }

/* Cœurs qui fusent au like (public/app.js) */
.fuse { position: fixed; z-index: 20; width: 20px; height: 20px; margin: -10px 0 0 -10px; pointer-events: none; opacity: 0;
  animation: fuse .95s var(--d, 0ms) cubic-bezier(.15,.75,.35,1) forwards; }
.fuse svg { display: block; width: 100%; height: 100%; fill: var(--blue); }
.fuse.vert svg { fill: var(--green); }
@keyframes fuse {
  0% { transform: translate(0, 0) scale(.2); opacity: 1; }
  65% { opacity: 1; }
  100% { transform: translate(var(--x), var(--y)) scale(var(--s)) rotate(var(--r)); opacity: 0; }
}
.pop { animation: pop-btn .35s cubic-bezier(.3,1.6,.5,1); }
@keyframes pop-btn { 40% { scale: var(--pop, 1.18); } }
.cta.pop { --pop: 1.04; }
@media (prefers-reduced-motion: reduce) { .pop { animation: none; } }

.toast { position: fixed; left: 50%; translate: -50% 0; bottom: calc(90px + var(--safe-b)); z-index: 10; max-width: calc(100% - 32px); background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 14px; font-size: 14px; font-weight: 600; box-shadow: 0 10px 30px rgba(19,32,58,.3); }
.toast:empty { display: none; }

/* Révélation */
body.reveal { background: var(--ink); color: #fff; }
.reveal-body { position: relative; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; text-align: center; padding: calc(30px + var(--safe-t)) 26px calc(30px + var(--safe-b)); overflow: hidden; }
.glow { position: absolute; width: 520px; height: 520px; top: 60px; left: 50%; translate: -50% 0; border-radius: 50%; background: var(--grad); filter: blur(90px); opacity: .45; }
.reveal-body > *:not(.glow) { position: relative; }
.reveal-kicker { margin-top: 30px; font-weight: 600; opacity: .85; }
.pair { display: flex; align-items: center; margin: 34px 0 22px; }
.avatar { width: 128px; height: 128px; border-radius: 50%; border: 4px solid #fff; overflow: hidden; background: var(--grad); }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.pair .avatar + .avatar { margin-left: -22px; }
.pair-heart { position: absolute !important; left: 50%; top: 50%; translate: -50% -50%; width: 52px; height: 52px; border-radius: 50%; background: #fff; display: grid; place-items: center; box-shadow: 0 8px 20px rgba(0,0,0,.25); }
.pair-heart svg { width: 26px; height: 26px; fill: url(#g); }
.reveal h1 { font-family: var(--display); font-weight: 800; font-size: 40px; letter-spacing: -.03em; line-height: 1; }
.reveal .nick { margin-top: 6px; font-size: 17px; opacity: .85; }
.meet { margin-top: auto; background: rgba(255,255,255,.1); border-radius: 20px; padding: 16px 18px; line-height: 1.45; }
.meet strong { display: block; font-family: var(--display); font-size: 20px; }
.reveal .link { margin-top: 14px; }
@media (prefers-reduced-motion: no-preference) {
  .pair .avatar:first-child { animation: in-left .9s cubic-bezier(.2,.9,.3,1.2) both; }
  .pair .avatar:nth-child(2) { animation: in-right .9s cubic-bezier(.2,.9,.3,1.2) both; }
  .pair-heart { animation: pop .5s .8s cubic-bezier(.2,.9,.3,1.6) both; }
  @keyframes in-left { from { transform: translateX(-80px); opacity: 0; } }
  @keyframes in-right { from { transform: translateX(80px); opacity: 0; } }
  @keyframes pop { from { scale: 0; } }
}

/* ---------- Admin ---------- */
body.admin { background: var(--mist); padding-bottom: calc(40px + var(--safe-b)); }
.admin-bar { display: flex; justify-content: space-between; align-items: center; padding: calc(12px + var(--safe-t)) 16px 12px; background: #fff; }
.admin-nav { position: sticky; top: 0; z-index: 2; display: flex; gap: 6px; overflow-x: auto; padding: 10px 16px; background: var(--mist); scrollbar-width: none; }
.admin-nav a { flex: none; padding: 7px 12px; border-radius: 99px; background: #fff; font-size: 14px; font-weight: 600; text-decoration: none; }
.admin-back { padding: 12px 16px 0; font-weight: 600; }
.admin section { background: #fff; margin: 12px 16px; border-radius: 18px; padding: 16px; display: grid; gap: 12px; scroll-margin-top: 60px; }
.admin h2 { font-family: var(--display); font-size: 20px; display: flex; align-items: center; gap: 8px; }
.admin h3 { font-size: 15px; display: flex; align-items: center; gap: 8px; }
.count { font-family: var(--body); font-size: 13px; font-weight: 700; padding: 2px 9px; border-radius: 99px; background: var(--mist); }
.badge { font-size: 12px; font-weight: 700; padding: 4px 9px; border-radius: 99px; background: #FFF1D6; color: #8A5A00; white-space: nowrap; }
.badge.ok { background: #E1FAF2; color: #0B6E53; }
.flash { margin: 12px 16px 0; background: var(--ink); color: #fff; padding: 12px 14px; border-radius: 14px; font-weight: 600; }
.rows { list-style: none; padding: 0; display: grid; gap: 8px; }
.rows li { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 12px; background: var(--mist); border-radius: 12px; font-size: 15px; overflow-wrap: anywhere; }
.rows a { font-weight: 600; }
.lien { display: flex; gap: 8px; align-items: center; }
.lien input { flex: 1; min-width: 0; font-size: 16px; padding: 9px 10px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--mist); }
.creer { display: grid; gap: 10px; padding-top: 6px; border-top: 1px solid var(--line); }
.creer label { display: grid; gap: 4px; font-size: 13px; font-weight: 600; color: var(--muted); }
.admin select { width: 100%; font-size: 16px; padding: 10px; border-radius: 12px; border: 1.5px solid var(--line); background: #fff; color: var(--ink); }
.admin-photo { width: 160px; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 16px; }
