/* PhotoQuest — noir profond, accents réservés au thème, au compte à rebours et au vote.
   Animations : uniquement transform / opacity. */
:root {
  --bg: #000;
  --s1: #0b0b0d;
  --s2: #131316;
  --s3: #1b1b20;
  --line: rgba(255, 255, 255, .08);
  --text: #f5f5f7;
  --mut: #8d8d97;
  --hue: 8;
  --accent: hsl(var(--hue) 92% 62%);
  --accent-soft: hsl(var(--hue) 92% 62% / .16);
  --timer: #ffb224;
  --vote: #ff3d71;
  --ease: cubic-bezier(.2, .9, .25, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --tabh: 68px;
  --col: 640px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { background: var(--bg); }
/* Tout élément qui redéfinit --hue (chaque défi a sa teinte) recalcule son accent. */
[style*="--hue"] { --accent: hsl(var(--hue) 92% 62%); --accent-soft: hsl(var(--hue) 92% 62% / .16); }
body {
  margin: 0; min-height: 100dvh; background: var(--bg); color: var(--text);
  font: 400 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI Variable", "Segoe UI", Inter, system-ui, Roboto, sans-serif;
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; touch-action: manipulation; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
img { display: block; max-width: 100%; }
.noscript { padding: 24px; text-align: center; color: var(--mut); }

#app { max-width: var(--col); margin: 0 auto; min-height: 100dvh; position: relative; }
@media (min-width: 700px) {
  #app { border-inline: 1px solid var(--line); }
}

/* ---------- barre haute ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: calc(10px + var(--safe-t)) 16px 10px; background: linear-gradient(var(--bg) 78%, transparent);
}
.brand { font-size: 1.15rem; font-weight: 700; letter-spacing: -.02em; }
.brand span { color: var(--mut); font-weight: 500; }
.seg { position: relative; display: grid; grid-template-columns: 1fr 1fr; background: var(--s2); border-radius: 999px; padding: 3px; }
.seg button { position: relative; z-index: 1; min-height: 44px; min-width: 44px; padding: 0 14px; border-radius: 999px; color: var(--mut); font-size: .9rem; font-weight: 600; transition: color .25s; }
.seg button[aria-checked="true"] { color: var(--text); }
.seg-thumb { position: absolute; top: 3px; bottom: 3px; left: 3px; width: calc(50% - 3px); border-radius: 999px; background: var(--s3); box-shadow: 0 0 0 1px var(--line); transition: transform .35s var(--ease); }
.seg[data-value="community"] .seg-thumb { transform: translateX(100%); }
.offline { margin: 0 16px 6px; padding: 6px 12px; text-align: center; font-size: .8rem; color: var(--timer); background: rgba(255, 178, 36, .1); border-radius: 999px; }

/* ---------- vues ---------- */
#views { position: relative; padding: 4px 16px calc(var(--tabh) + var(--safe-b) + 28px); }
.view { animation: none; }
.view.enter-fwd { animation: viewInFwd .42s var(--ease) both; }
.view.enter-back { animation: viewInBack .42s var(--ease) both; }
.view.leaving { position: absolute; inset: 4px 16px auto; pointer-events: none; animation: viewOut .18s ease-in both; }
@keyframes viewInFwd { from { opacity: 0; transform: translate3d(28px, 0, 0); } to { opacity: 1; transform: none; } }
@keyframes viewInBack { from { opacity: 0; transform: translate3d(-28px, 0, 0); } to { opacity: 1; transform: none; } }
@keyframes viewOut { to { opacity: 0; transform: translate3d(-10px, 0, 0); } }
.fade-in { animation: fadeIn .4s var(--ease) both; }
@keyframes fadeIn { from { opacity: 0; transform: translate3d(0, 8px, 0); } to { opacity: 1; transform: none; } }

/* ---------- barre d'onglets ---------- */
.tabbar {
  position: fixed; z-index: 30; bottom: 0; left: 50%; width: min(100%, var(--col)); transform: translateX(-50%);
  display: grid; grid-template-columns: repeat(4, 1fr); padding: 6px 8px calc(6px + var(--safe-b));
  background: rgba(8, 8, 10, .94); border-top: 1px solid var(--line);
}
.tabbar button { position: relative; z-index: 1; min-height: 52px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--mut); font-size: .72rem; font-weight: 600; transition: color .25s, transform .15s; }
.tabbar button:active { transform: scale(.92); }
.tabbar button[aria-selected="true"] { color: var(--text); }
.tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; transition: transform .35s var(--spring); }
.tabbar button[aria-selected="true"] svg { transform: translateY(-1px) scale(1.12); }
.tab-thumb { position: absolute; top: 6px; left: 8px; height: 52px; width: calc((100% - 16px) / 4); border-radius: 16px; background: var(--s2); transition: transform .4s var(--ease); }

/* ---------- boutons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 22px; border-radius: 16px; font-weight: 700; background: var(--s2); color: var(--text); transition: transform .15s var(--ease), opacity .2s, background .2s; }
.btn:active:not(:disabled) { transform: scale(.95); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #0a0a0a; width: 100%; min-height: 54px; font-size: 1.05rem; box-shadow: 0 8px 30px -8px var(--accent); }
.btn-ghost { background: transparent; box-shadow: inset 0 0 0 1px var(--line); }
.btn-danger { color: #ff7a7a; }
.btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- défi : hero ---------- */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 12px; scrollbar-width: none; margin-inline: -16px; padding-inline: 16px; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; min-height: 44px; padding: 0 16px; border-radius: 999px; background: var(--s2); color: var(--mut); font-size: .88rem; font-weight: 600; transition: background .25s, color .25s, transform .15s; white-space: nowrap; }
.chip:active { transform: scale(.95); }
.chip[aria-pressed="true"] { background: var(--text); color: #000; }

.hero { position: relative; padding: 22px 20px 20px; border-radius: 28px; background: radial-gradient(120% 90% at 0% 0%, var(--accent-soft), transparent 60%), var(--s1); border: 1px solid var(--line); overflow: hidden; }
.kicker { font-size: .78rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--mut); }
.theme { margin: 6px 0 4px; font-size: min(4.4rem, calc((100vw - 84px) / (var(--len, 8) * .62))); font-weight: 800; letter-spacing: -.04em; line-height: 1; color: var(--accent); }
.theme .w { display: inline-block; white-space: nowrap; margin-right: .22em; }
.theme .l { display: inline-block; opacity: 0; animation: letterIn .7s var(--spring) both; animation-delay: calc(var(--i) * 50ms + 120ms); }
@keyframes letterIn { from { opacity: 0; transform: translate3d(0, .5em, 0) scale(.85); } to { opacity: 1; transform: none; } }
.hint { color: var(--mut); max-width: 32ch; }

.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 18px; }
.step { padding: 8px 10px; border-radius: 14px; background: rgba(255, 255, 255, .04); color: var(--mut); font-size: .72rem; line-height: 1.25; transition: background .3s, color .3s; }
.step b { display: block; font-size: .8rem; color: inherit; }
.step.on { background: var(--text); color: #000; }
.step.past { opacity: .5; }

.countdown { margin-top: 18px; }
.cd-label { font-size: .8rem; color: var(--mut); margin-bottom: 8px; }
.cd { display: flex; gap: 8px; align-items: stretch; transform-origin: left center; }
.cd-u { flex: 1; min-width: 0; padding: 10px 4px 8px; border-radius: 16px; background: rgba(255, 178, 36, .08); text-align: center; }
.cd-u b { display: block; font-size: clamp(1.5rem, 8vw, 2.1rem); font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.02em; color: var(--timer); line-height: 1.1; }
.cd-u span { font-size: .68rem; text-transform: uppercase; letter-spacing: .1em; color: var(--mut); }
.cd.urgent { animation: pulse 1s ease-in-out infinite; }
.cd.urgent .cd-u { background: rgba(255, 80, 60, .14); }
.cd.urgent .cd-u b { color: #ff6b4a; }
@keyframes pulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.035); opacity: .8; } }
.bar { height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .08); margin-top: 12px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 100%; background: var(--timer); transform-origin: left; transform: scaleX(var(--p, 0)); transition: transform 1s linear; border-radius: 4px; }
.dates { margin-top: 10px; font-size: .8rem; color: var(--mut); }

/* ---------- défi : publication ---------- */
.cta { margin-top: 16px; }
.slots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; }
.slot { position: relative; aspect-ratio: 4 / 5; border-radius: 18px; overflow: hidden; background: var(--s2); border: 1px dashed rgba(255, 255, 255, .16); display: grid; place-items: center; color: var(--mut); transition: transform .15s var(--ease); }
.slot:active { transform: scale(.96); }
.slot svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.slot.full { border: 0; }
.slot img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.slot.pop { animation: pop .55s var(--spring) both; }
@keyframes pop { from { opacity: 0; transform: scale(.6); } to { opacity: 1; transform: none; } }
.note { margin-top: 14px; padding: 14px 16px; border-radius: 18px; background: var(--s1); border: 1px solid var(--line); color: var(--mut); font-size: .9rem; }
.note b { color: var(--text); }

/* ---------- défi surprise ---------- */
.surprise { position: relative; display: block; width: 100%; text-align: left; margin-bottom: 14px; padding: 16px 18px; border-radius: 24px; overflow: hidden; color: #140a00; background: linear-gradient(115deg, #ffb224, #ff5a3c 55%, #ff3d71); box-shadow: 0 14px 44px -12px rgba(255, 90, 60, .7); animation: surpriseIn 1s var(--spring) both; transition: transform .15s; }
.surprise:active { transform: scale(.97); }
.surprise::after { content: ""; position: absolute; inset: 0; background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, .55) 50%, transparent 65%); transform: translateX(-120%); animation: shine 3.2s 1.2s ease-in-out infinite; }
@keyframes surpriseIn { 0% { opacity: 0; transform: translate3d(0, -40px, 0) scale(.7) rotate(-3deg); } 60% { opacity: 1; transform: translate3d(0, 6px, 0) scale(1.04) rotate(.6deg); } 100% { opacity: 1; transform: none; } }
@keyframes shine { 0% { transform: translateX(-120%); } 45%, 100% { transform: translateX(120%); } }
.surprise .s-top { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: .78rem; letter-spacing: .14em; text-transform: uppercase; }
.surprise .bolt { display: inline-block; font-size: 1.3rem; animation: bolt 1.2s ease-in-out infinite; }
@keyframes bolt { 0%, 100% { transform: scale(1) rotate(0); } 50% { transform: scale(1.3) rotate(-12deg); } }
.surprise h3 { font-size: 1.7rem; font-weight: 800; letter-spacing: -.03em; line-height: 1.15; margin-top: 2px; }
.surprise p { font-weight: 600; font-size: .92rem; opacity: .85; }
.surprise-teaser { margin-bottom: 14px; padding: 12px 16px; border-radius: 18px; background: var(--s1); border: 1px dashed rgba(255, 178, 36, .3); color: var(--mut); font-size: .86rem; }
.surprise-teaser b { color: var(--timer); }

/* ---------- grille de photos ---------- */
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 16px; }
@media (min-width: 560px) { .grid { grid-template-columns: repeat(3, 1fr); } }
.card { position: relative; aspect-ratio: 4 / 5; border-radius: 20px; overflow: hidden; background: var(--s2); animation: fadeIn .5s var(--ease) both; animation-delay: calc(var(--i, 0) * 45ms); }
.card > .open { position: absolute; inset: 0; width: 100%; height: 100%; }
.card img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s var(--ease); }
.card > .open:active img { transform: scale(1.04); }
.card::after { content: ""; position: absolute; inset: auto 0 0 0; height: 45%; background: linear-gradient(transparent, rgba(0, 0, 0, .7)); pointer-events: none; }
.tag { position: absolute; left: 10px; bottom: 10px; z-index: 2; font-size: .78rem; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: rgba(0, 0, 0, .55); }
.tag.mine { background: var(--text); color: #000; }
.heart { position: absolute; right: 6px; bottom: 6px; z-index: 3; min-width: 44px; min-height: 44px; display: flex; align-items: center; justify-content: center; gap: 4px; padding: 0 10px; border-radius: 999px; background: rgba(0, 0, 0, .55); font-weight: 700; font-size: .85rem; transition: transform .15s; }
.heart:active:not(:disabled) { transform: scale(.88); }
.heart:disabled { opacity: .4; }
.heart svg { width: 22px; height: 22px; fill: none; stroke: #fff; stroke-width: 2; stroke-linejoin: round; transition: fill .2s, stroke .2s; }
.heart[aria-pressed="true"] svg { fill: var(--vote); stroke: var(--vote); }
.heart.bounce svg { animation: heartBounce .6s var(--spring); }
@keyframes heartBounce { 0% { transform: scale(1); } 30% { transform: scale(1.6); } 60% { transform: scale(.9); } 100% { transform: scale(1); } }
.vote-banner { margin-top: 16px; padding: 14px 16px; border-radius: 18px; background: rgba(255, 61, 113, .08); border: 1px solid rgba(255, 61, 113, .25); font-size: .9rem; color: #ffb3c6; }
.vote-banner b { color: #fff; }

/* ---------- classement ---------- */
.status { margin: 4px 0 14px; padding: 12px 16px; border-radius: 18px; background: var(--s1); border: 1px solid var(--line); color: var(--mut); font-size: .9rem; }
.status b { color: var(--text); }
.rank-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; position: relative; }
.rank-row { position: relative; display: grid; grid-template-columns: 34px 60px 1fr auto; align-items: center; gap: 12px; padding: 10px 14px 10px 10px; border-radius: 22px; background: var(--s1); border: 1px solid var(--line); will-change: transform; }
.rank-row.first { background: radial-gradient(120% 140% at 0% 0%, var(--accent-soft), transparent 55%), var(--s1); border-color: hsl(var(--hue) 92% 62% / .35); }
.rank-row.flip { transition: transform .6s var(--ease); }
.rk, .rank-row .thumb { grid-row: 1 / 3; }
.rk { font-size: 1.15rem; font-weight: 800; text-align: center; color: var(--mut); font-variant-numeric: tabular-nums; }
.first .rk { color: var(--accent); }
.rank-row .thumb { width: 60px; height: 60px; border-radius: 16px; overflow: hidden; background: var(--s3); }
.rank-row .thumb img { width: 100%; height: 100%; object-fit: cover; }
.who { min-width: 0; }
.who b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who small { color: var(--mut); }
.who .anon { color: var(--mut); font-weight: 600; }
.score { text-align: right; font-weight: 800; font-variant-numeric: tabular-nums; display: flex; align-items: center; gap: 5px; color: var(--vote); }
.score svg { width: 16px; height: 16px; fill: var(--vote); }
.meter { grid-column: 3 / 5; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .06); overflow: hidden; margin-top: -2px; }
.meter i { display: block; height: 100%; width: 100%; background: var(--vote); transform-origin: left; transform: scaleX(var(--p, 0)); animation: grow .9s var(--ease) both; animation-delay: .25s; border-radius: 4px; }
@keyframes grow { from { transform: scaleX(0); } }
.reveal-name { display: inline-block; opacity: 0; animation: revealName .8s var(--spring) both; animation-delay: calc(var(--i) * var(--step, 260ms) + 500ms); }
.reveal-lock { position: absolute; opacity: 1; animation: lockOut .5s ease-in both; animation-delay: calc(var(--i) * var(--step, 260ms) + 400ms); color: var(--mut); font-weight: 600; }
.who.reveal { position: relative; }
.who.reveal b { transform-origin: left; }
@keyframes revealName { from { opacity: 0; transform: translate3d(0, .6em, 0) rotateX(80deg) scale(.8); } to { opacity: 1; transform: none; } }
@keyframes lockOut { to { opacity: 0; transform: translate3d(0, -.5em, 0); } }
.empty { padding: 40px 16px; text-align: center; color: var(--mut); }
.empty b { color: var(--text); display: block; margin-bottom: 4px; font-size: 1.05rem; }

/* ---------- carte ---------- */
.map-wrap { position: relative; border-radius: 28px; overflow: hidden; background: var(--s1); border: 1px solid var(--line); }
.map-wrap svg { display: block; width: 100%; height: auto; }
.map-grid line { stroke: rgba(255, 255, 255, .05); stroke-width: 1; }
.map-land { fill: #101014; stroke: rgba(255, 255, 255, .22); stroke-width: 1.2; stroke-linejoin: round; }
.pin { cursor: pointer; }
.pin .zone { fill: hsl(var(--hue) 92% 62% / .18); stroke: hsl(var(--hue) 92% 62% / .7); stroke-width: 1.4; stroke-dasharray: 4 4; transform-box: fill-box; transform-origin: center; animation: pinIn .7s var(--spring) both; animation-delay: calc(var(--i) * 70ms + 200ms); }
.pin .dot { fill: var(--accent); transform-box: fill-box; transform-origin: center; animation: pinIn .6s var(--spring) both; animation-delay: calc(var(--i) * 70ms + 300ms); }
.pin.precise .dot { fill: #fff; stroke: var(--accent); stroke-width: 3; }
.pin .halo { fill: none; stroke: #fff; stroke-width: 1.4; transform-box: fill-box; transform-origin: center; animation: halo 2.2s ease-out infinite; }
.pin text { fill: #000; font-size: 11px; font-weight: 800; text-anchor: middle; pointer-events: none; }
.pin:focus-visible { outline: none; }
.pin:focus-visible .dot { stroke: #fff; stroke-width: 3; }
@keyframes pinIn { from { opacity: 0; transform: scale(.2); } to { opacity: 1; transform: none; } }
@keyframes halo { from { opacity: .8; transform: scale(1); } to { opacity: 0; transform: scale(3); } }
.legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 14px; font-size: .85rem; color: var(--mut); }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }
.legend .i-p { background: #fff; box-shadow: 0 0 0 2px var(--accent); }
.legend .i-z { border: 1.5px dashed var(--accent); background: var(--accent-soft); }

/* ---------- profil ---------- */
.me { display: flex; align-items: center; gap: 14px; padding: 6px 0 16px; }
.input { flex: 1; min-width: 0; min-height: 48px; padding: 0 16px; border-radius: 14px; background: var(--s2); border: 1px solid transparent; outline: none; transition: border-color .2s; }
.input:focus { border-color: var(--text); }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.stat { padding: 12px 6px; border-radius: 18px; background: var(--s1); border: 1px solid var(--line); text-align: center; }
.stat b { display: block; font-size: 1.45rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat span { font-size: .68rem; color: var(--mut); text-transform: uppercase; letter-spacing: .08em; }
h2.section { margin: 26px 0 12px; font-size: 1.05rem; font-weight: 700; letter-spacing: -.01em; }
.hist { display: grid; gap: 10px; }
.hist-item { padding: 14px; border-radius: 22px; background: var(--s1); border: 1px solid var(--line); animation: fadeIn .5s var(--ease) both; animation-delay: calc(var(--i, 0) * 60ms); }
.hist-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; width: 100%; min-height: 44px; text-align: left; }
.hist-head b { font-size: 1.05rem; color: var(--accent); }
.hist-head small { display: block; color: var(--mut); }
.badge { flex: none; padding: 4px 11px; border-radius: 999px; background: var(--s3); font-weight: 700; font-size: .82rem; }
.badge.gold { background: var(--text); color: #000; }
.mini { display: flex; gap: 8px; margin-top: 8px; }
.mini button { width: 64px; height: 80px; border-radius: 14px; overflow: hidden; background: var(--s3); transition: transform .15s; }
.mini button:active { transform: scale(.93); }
.mini img { width: 100%; height: 100%; object-fit: cover; }
.fine { margin: 22px 4px 0; font-size: .78rem; color: var(--mut); }

/* ---------- squelettes ---------- */
.sk { position: relative; overflow: hidden; background: var(--s2); border-radius: 20px; }
.sk::after { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 20%, rgba(255, 255, 255, .06) 50%, transparent 80%); transform: translateX(-100%); animation: shimmer 1.4s infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }
.sk-hero { height: 330px; border-radius: 28px; }
.sk-card { aspect-ratio: 4 / 5; }
.sk-row { height: 82px; border-radius: 22px; margin-bottom: 10px; }
.sk-map { aspect-ratio: 1 / 1; border-radius: 28px; }
.sk-line { height: 18px; border-radius: 8px; margin: 10px 0; }

/* ---------- feuille (viewer, publication) ---------- */
#sheet-root { position: relative; z-index: 50; }
.backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, .72); opacity: 0; transition: opacity .3s; }
.backdrop.in { opacity: 1; }
.sheet { position: fixed; z-index: 51; left: 50%; bottom: 0; width: min(100%, var(--col)); max-height: 92dvh; display: flex; flex-direction: column; background: var(--s1); border-radius: 28px 28px 0 0; border: 1px solid var(--line); border-bottom: 0; transform: translate3d(-50%, 100%, 0); transition: transform .45s var(--ease); outline: none; }
.sheet.in { transform: translate3d(-50%, 0, 0); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 14px 6px 20px; }
.sheet-head h2 { font-size: 1.1rem; }
.sheet-body { overflow-y: auto; overscroll-behavior: contain; padding: 4px 20px calc(24px + var(--safe-b)); }
.close { width: 44px; height: 44px; border-radius: 50%; background: var(--s3); display: grid; place-items: center; transition: transform .15s; }
.close:active { transform: scale(.9); }
.close svg { width: 18px; height: 18px; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; fill: none; }
@media (min-width: 700px) {
  .sheet { bottom: auto; top: 50%; border-radius: 28px; border-bottom: 1px solid var(--line); transform: translate3d(-50%, -46%, 0) scale(.96); opacity: 0; transition: transform .4s var(--ease), opacity .3s; max-height: 88dvh; }
  .sheet.in { transform: translate3d(-50%, -50%, 0); opacity: 1; }
}
.viewer-img { position: relative; border-radius: 22px; overflow: hidden; background: var(--s2); max-height: 56dvh; display: flex; justify-content: center; }
.viewer-img img { max-height: 56dvh; width: auto; max-width: 100%; object-fit: contain; animation: fadeIn .5s var(--ease) both; }
.viewer-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 14px 0 4px; }
.viewer-meta h3 { font-size: 1.05rem; }
.viewer-meta small { color: var(--mut); display: block; }
.vote-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 18px; border-radius: 999px; background: var(--s3); font-weight: 700; transition: transform .15s, background .25s; }
.vote-btn:active:not(:disabled) { transform: scale(.93); }
.vote-btn:disabled { opacity: .4; }
.vote-btn svg { width: 22px; height: 22px; fill: none; stroke: #fff; stroke-width: 2; stroke-linejoin: round; transition: fill .2s, stroke .2s; }
.vote-btn[aria-pressed="true"] { background: rgba(255, 61, 113, .18); }
.vote-btn[aria-pressed="true"] svg { fill: var(--vote); stroke: var(--vote); }
.vote-btn.bounce svg { animation: heartBounce .6s var(--spring); }
.loc { display: inline-block; margin-top: 6px; padding: 3px 10px; border-radius: 999px; background: var(--s3); font-size: .78rem; color: var(--mut); }
.comments { margin: 18px 0 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.comments li { padding: 10px 14px; border-radius: 16px; background: var(--s2); animation: fadeIn .4s var(--ease) both; }
.comments li.mine { background: var(--s3); }
.comments b { font-size: .82rem; color: var(--mut); display: block; }
.c-form { display: flex; gap: 8px; margin-top: 14px; }
.c-form .btn { min-width: 48px; padding: 0 16px; }
.drop { display: grid; place-items: center; gap: 6px; width: 100%; min-height: 150px; border-radius: 22px; border: 1.5px dashed rgba(255, 255, 255, .22); color: var(--mut); text-align: center; padding: 16px; transition: background .2s, transform .15s; }
.drop:active { transform: scale(.98); background: var(--s2); }
.drop svg { width: 34px; height: 34px; stroke: var(--text); fill: none; stroke-width: 1.6; stroke-linecap: round; }
.previews { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 14px 0; }
.prev { position: relative; aspect-ratio: 4 / 5; border-radius: 16px; overflow: hidden; background: var(--s2); animation: pop .45s var(--spring) both; }
.prev img { width: 100%; height: 100%; object-fit: cover; }
.prev button { position: absolute; top: 4px; right: 4px; width: 44px; height: 44px; display: grid; place-items: center; }
.prev button span { width: 26px; height: 26px; border-radius: 50%; background: rgba(0, 0, 0, .7); display: grid; place-items: center; font-size: 16px; line-height: 1; }
.errors { margin: 10px 0; padding: 0; list-style: none; color: #ff8a8a; font-size: .88rem; display: grid; gap: 4px; }
.check { display: flex; align-items: center; gap: 12px; min-height: 48px; margin: 8px 0 14px; color: var(--mut); font-size: .88rem; }
.check input { width: 22px; height: 22px; accent-color: var(--accent); flex: none; }

/* ---------- toasts & confettis ---------- */
#toasts { position: fixed; z-index: 90; left: 0; right: 0; bottom: calc(var(--tabh) + var(--safe-b) + 16px); display: grid; justify-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast { padding: 12px 18px; border-radius: 999px; background: var(--text); color: #000; font-weight: 700; font-size: .92rem; animation: toastIn .45s var(--spring) both, toastOut .3s 2.4s ease-in forwards; box-shadow: 0 10px 30px rgba(0, 0, 0, .6); }
.toast.err { background: #ff6b6b; }
@keyframes toastIn { from { opacity: 0; transform: translate3d(0, 20px, 0) scale(.9); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translate3d(0, 10px, 0); } }
.confetti { position: fixed; inset: 0; z-index: 99; pointer-events: none; overflow: hidden; }
.confetti i { position: absolute; left: var(--ox, 50%); top: var(--oy, 60%); width: 8px; height: 14px; border-radius: 2px; background: var(--c); opacity: 0; animation: confetti 1.4s cubic-bezier(.2, .7, .3, 1) forwards; animation-delay: var(--d); }
@keyframes confetti {
  0% { opacity: 1; transform: translate3d(0, 0, 0) rotate(0); }
  70% { opacity: 1; }
  100% { opacity: 0; transform: translate3d(var(--x), var(--y), 0) rotate(var(--r)); }
}

/* ---------- animations réduites : version sobre (fondus courts, aucun mouvement) ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; animation-delay: 0ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .view.enter-fwd, .view.enter-back, .fade-in { animation: fadeOnly .2s ease both !important; }
  .toast { animation: fadeOnly .2s ease both, toastOut .2s 2.6s forwards !important; }
  .confetti, .surprise::after { display: none; }
  .theme .l, .reveal-name { opacity: 1; }
  .reveal-lock { display: none; }
  @keyframes fadeOnly { from { opacity: 0; } to { opacity: 1; } }
}

/* ---------- pastilles de profil ---------- */
.av { display: inline-grid; place-items: center; flex: none; border-radius: 50%; overflow: hidden; font-weight: 800; color: #000; background: hsl(var(--h, 150) 70% 62%); }
.av img { width: 100%; height: 100%; object-fit: cover; }
.me-info { flex: 1; min-width: 0; }
.me-info b { display: block; font-size: 1.15rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-info p { color: var(--text); font-size: .88rem; overflow-wrap: anywhere; }
.me-info p.muted { color: var(--mut); }
.tools { display: grid; gap: 10px; margin-top: 26px; }
.who b.n { display: flex; align-items: center; gap: 8px; }
.who b.n .t { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- écrans d'accueil : installation et profil ---------- */
.gate-root { position: fixed; inset: 0; z-index: 100; background: var(--bg); overflow-y: auto; }
.gate { min-height: 100dvh; max-width: 480px; margin: 0 auto; padding: calc(32px + var(--safe-t)) 24px calc(32px + var(--safe-b)); display: flex; flex-direction: column; justify-content: center; gap: 18px; animation: fadeIn .5s var(--ease) both; }
.gate h1 { font-size: 2rem; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; }
.gate p { color: var(--mut); }
.gate-logo { width: 84px; height: 84px; border-radius: 22px; }
.gate-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; counter-reset: step; }
.gate-steps li { counter-increment: step; position: relative; padding: 14px 16px 14px 56px; border-radius: 18px; background: var(--s1); border: 1px solid var(--line); line-height: 1.35; }
.gate-steps li::before { content: counter(step); position: absolute; left: 14px; top: 50%; width: 30px; height: 30px; margin-top: -15px; border-radius: 50%; background: var(--text); color: #000; font-weight: 800; display: grid; place-items: center; }
.glyph { display: inline-block; width: 20px; height: 20px; vertical-align: -4px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.gate-note { font-size: .88rem; }
.gate-done { padding: 18px; border-radius: 22px; background: rgba(60, 200, 120, .1); border: 1px solid rgba(60, 200, 120, .35); }
.gate-done b { color: #7ee2a8; }
.gate-done p { margin-top: 4px; }

.pf { display: grid; gap: 16px; }
.av-field { display: grid; justify-items: center; gap: 8px; }
.av-pick { width: 116px; height: 116px; border-radius: 50%; background: var(--s2); border: 1.5px dashed rgba(255, 255, 255, .28); overflow: hidden; display: grid; place-items: center; transition: transform .15s var(--ease); }
.av-pick:active { transform: scale(.95); }
.av-preview { display: grid; place-items: center; width: 100%; height: 100%; }
.av-preview svg { width: 38px; height: 38px; stroke: var(--text); fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.av-preview img { width: 100%; height: 100%; object-fit: cover; }
.av-label { font-size: .85rem; color: var(--mut); }
.field { display: grid; gap: 6px; }
.field label { font-size: .85rem; font-weight: 600; }
.field label small { color: var(--mut); font-weight: 400; }
.input.area { padding: 12px 16px; min-height: 84px; resize: none; line-height: 1.4; }
.counter { justify-self: end; color: var(--mut); font-variant-numeric: tabular-nums; }
.form-err { color: #ff8a8a; font-size: .88rem; }

/* ---------- sous les photos : réactions et commentaires ---------- */
.cell { display: grid; gap: 4px; margin-top: 0; }
.grid .cell .card { animation-fill-mode: both; }
.under { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; padding: 0 10px; border-radius: 14px; background: var(--s1); color: var(--mut); font-size: .85rem; font-weight: 600; text-align: left; transition: background .2s, transform .15s; }
.under:active { transform: scale(.97); background: var(--s2); }
.under .cm { color: var(--text); white-space: nowrap; }
.rx { display: flex; gap: 6px; overflow-x: auto; padding: 4px 0; margin-top: 12px; scrollbar-width: none; }
.rx::-webkit-scrollbar { display: none; }
.rx-btn { flex: none; min-width: 48px; min-height: 44px; padding: 0 12px; display: inline-flex; align-items: center; justify-content: center; gap: 5px; border-radius: 999px; background: var(--s2); font-size: 1.2rem; transition: transform .15s var(--spring), background .2s; }
.rx-btn small { font-size: .8rem; font-weight: 700; color: var(--mut); }
.rx-btn:active { transform: scale(.88); }
.rx-btn.on { background: var(--text); }
.rx-btn.on small { color: #000; }
.rx-btn.pop .e { display: inline-block; animation: heartBounce .5s var(--spring); }
.c-title { margin: 16px 0 0; font-size: .95rem; font-weight: 700; }
.comments li { display: grid; grid-template-columns: 32px 1fr auto; gap: 10px; align-items: start; }
.comments li.none { display: block; color: var(--mut); text-align: center; background: transparent; }
.c-head { display: flex; align-items: baseline; gap: 8px; }
.comments .c-head b { display: inline; font-size: .85rem; color: var(--text); }
.c-head small { color: var(--mut); font-size: .72rem; }
.c-main p { margin-top: 2px; overflow-wrap: anywhere; font-size: .95rem; }
.c-del { width: 44px; height: 44px; margin: -10px -10px 0 0; display: grid; place-items: center; color: var(--mut); }
.c-del svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }

/* ---------- lieu de la photo ---------- */
.place { margin: 12px 0 14px; padding: 14px; border-radius: 22px; background: var(--s2); }
.place-title { font-weight: 700; }
.place-sub { margin: 4px 0 10px; color: var(--mut); font-size: .85rem; }
.picker { position: relative; border-radius: 18px; overflow: hidden; background: var(--bg); border: 1px solid var(--line); }
.picker .picker-svg { display: block; width: 100%; height: auto; touch-action: none; cursor: crosshair; }
.picker-hint { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); padding: 5px 12px; border-radius: 999px; background: rgba(0, 0, 0, .7); font-size: .78rem; font-weight: 600; pointer-events: none; white-space: nowrap; }
.pk-zone { fill: hsl(var(--hue) 92% 62% / .18); stroke: var(--accent); stroke-width: 1.4; stroke-dasharray: 4 4; }
.pk-dot { fill: var(--accent); stroke: #fff; stroke-width: 2.5; }
.pk-pin { outline: none; transition: opacity .2s; }
.pk-pin:focus-visible .pk-dot { stroke-width: 4; }
.pk-pin.idle { opacity: .45; }
.pk-pin.idle .pk-dot { transform-box: fill-box; transform-origin: center; animation: pkPulse 1.6s ease-in-out infinite; }
@keyframes pkPulse { 50% { transform: scale(1.35); opacity: .6; } }
.place-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
.place-actions .btn { min-height: 44px; padding: 0 16px; font-size: .88rem; }
.place-status { flex: 1 1 100%; font-size: .85rem; color: var(--mut); }
.place-status.ok { color: #7ee2a8; }
.prev.sel { box-shadow: 0 0 0 2px var(--accent); }
.prev .prev-sel { position: absolute; inset: 0; width: 100%; height: 100%; top: 0; right: 0; }
.prev .prev-sel img { width: 100%; height: 100%; object-fit: cover; }
.prev-pin { position: absolute; left: 6px; bottom: 6px; font-style: normal; font-size: .9rem; filter: drop-shadow(0 1px 2px #000); }
.prev .prev-del { position: absolute; top: 4px; right: 4px; width: 44px; height: 44px; display: grid; place-items: center; }
.map-note { margin: 0 0 12px; }

/* ---------- tutoriel ---------- */
.tuto { position: fixed; inset: 0; z-index: 120; display: grid; place-items: center; padding: calc(16px + var(--safe-t)) 16px calc(16px + var(--safe-b)); background: rgba(0, 0, 0, .92); animation: fadeIn .4s var(--ease) both; }
.tuto-card { width: min(100%, 460px); padding: 14px 20px 22px; border-radius: 32px; background: var(--s1); border: 1px solid var(--line); overflow: hidden; }
.tuto-top { display: flex; justify-content: flex-end; }
.tuto-skip { min-height: 44px; padding: 0 12px; color: var(--mut); font-weight: 600; }
.tuto-viewport { overflow: hidden; touch-action: pan-y; }
.tuto-track { display: flex; transition: transform .45s var(--ease); }
.tuto-slide { flex: 0 0 100%; padding: 6px 4px 8px; text-align: center; }
.tuto-ico { display: grid; place-items: center; width: 112px; height: 112px; margin: 0 auto 18px; border-radius: 50%; font-size: 3.4rem; background: radial-gradient(circle at 30% 20%, var(--accent-soft), transparent 70%), var(--s2); animation: tutoFloat 3s ease-in-out infinite; }
@keyframes tutoFloat { 50% { transform: translate3d(0, -8px, 0); } }
.tuto-slide h2 { font-size: 1.45rem; letter-spacing: -.02em; line-height: 1.2; }
.tuto-slide p { margin-top: 8px; color: var(--mut); min-height: 6.6em; }
.tuto-dots { display: flex; justify-content: center; gap: 8px; margin: 10px 0 16px; }
.tuto-dots i { width: 8px; height: 8px; border-radius: 50%; background: rgba(255, 255, 255, .2); transition: transform .3s var(--ease), background .3s; }
.tuto-dots i.on { background: var(--text); transform: scale(1.35); }
.tuto-actions { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 10px; }
.tuto-actions .btn-primary { width: auto; min-height: 52px; font-size: 1rem; }

.gate .btn-primary { background: var(--text); box-shadow: none; }
.gate .btn-primary:disabled { background: var(--s3); color: var(--mut); opacity: 1; }
