:root {
  --pink: #ff4f9a;
  --pink2: #ff8fc2;
  --pink3: #ffd1e6;
  --red: #ff2e63;
  --purple: #8a2be2;
  --yellow: #ffe14d;
  --mint: #4be3b1;
  --cream: #fff3fa;
  --ink: #3a0a2e;
  --card: #ffffff;
  --shadow: 6px 6px 0 var(--ink);
  --display: 'Pacifico', 'Comic Sans MS', cursive;
  --body: 'Fredoka', 'Comic Sans MS', system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root { --cream: #2a0720; --ink: #ffe3f1; --card: #43102f; --shadow: 6px 6px 0 #ff4f9a; --pink3: #5a1743; }
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  font-family: var(--body); font-weight: 400; color: var(--ink); line-height: 1.45;
  background:
    radial-gradient(circle at 20% 20%, rgba(255,255,255,.55) 0 3px, transparent 4px) 0 0 / 46px 46px,
    linear-gradient(135deg, #ffd1e6, #ffc2dc, #e9c9ff, #ffd1e6);
  background-size: 46px 46px, 400% 400%;
  animation: bgmove 18s ease infinite;
  overflow-x: hidden;
  cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='32' height='32'><text y='24' font-size='24'>💗</text></svg>") 4 4, auto;
}
@media (prefers-color-scheme: dark) {
  body { background:
    radial-gradient(circle at 20% 20%, rgba(255,79,154,.25) 0 3px, transparent 4px) 0 0 / 46px 46px,
    linear-gradient(135deg, #2a0720, #3d0a33, #1f0a3d, #2a0720);
    background-size: 46px 46px, 400% 400%; }
}
@keyframes bgmove { 0%,100% { background-position: 0 0, 0% 50%; } 50% { background-position: 0 0, 100% 50%; } }
a, button, label, select, input { cursor: inherit; }
button, .btn, a, label.drop { cursor: pointer; }

/* ---- fond ---- */
.hearts { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; }
.hearts span { position: absolute; bottom: -60px; opacity: 0; animation: rise linear infinite; }
@keyframes rise {
  0% { transform: translateY(0) rotate(-20deg) scale(.8); opacity: 0; }
  10% { opacity: .55; }
  50% { transform: translateY(-55vh) rotate(25deg) scale(1.1); }
  100% { transform: translateY(-115vh) rotate(-30deg) scale(.9); opacity: 0; }
}
.trail, .burst, .confetti { position: fixed; pointer-events: none; z-index: 60; }
.trail { animation: trail .9s ease-out forwards; }
@keyframes trail { to { transform: translateY(-34px) scale(.2) rotate(40deg); opacity: 0; } }
.burst { animation: burst 1.1s cubic-bezier(.2,.9,.3,1) forwards; }
@keyframes burst { to { transform: translate(var(--dx), var(--dy)) rotate(var(--rot)) scale(1.7); opacity: 0; } }
.confetti { top: -20px; animation: fall linear forwards; width: 10px; height: 16px; border-radius: 2px; }
@keyframes fall { to { transform: translate(var(--dx), 110vh) rotate(var(--rot)); } }

.top, main, .foot, .marquee { position: relative; z-index: 1; }

/* ---- bandeau défilant ---- */
.marquee {
  overflow: hidden; white-space: nowrap; background: var(--ink); color: var(--yellow);
  font-weight: 700; letter-spacing: 1px; padding: 6px 0; border-bottom: 4px solid var(--pink);
}
@media (prefers-color-scheme: dark) { .marquee { background: var(--pink); color: #2a0720; border-color: var(--yellow); } }
.marquee div { display: inline-block; padding-left: 100%; animation: scroll 32s linear infinite; }
@keyframes scroll { to { transform: translateX(-100%); } }

/* ---- header ---- */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 14px max(16px, calc((100vw - 1100px) / 2)); }
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.logo-heart {
  display: grid; place-items: center; width: 54px; height: 54px; border-radius: 50%;
  background: var(--red); color: #fff; font-size: 30px; border: 4px solid var(--ink);
  box-shadow: 3px 3px 0 var(--ink); animation: beat 1.1s infinite;
}
.logo-text { font-family: var(--display); font-size: clamp(30px, 6vw, 44px); line-height: 1; text-shadow: 3px 3px 0 var(--pink2); }
.logo-text b { color: var(--red); font-weight: 400; }
.tag { font-weight: 700; background: var(--yellow); color: #3a0a2e; padding: 6px 14px; border-radius: 99px; border: 3px solid var(--ink); transform: rotate(3deg); box-shadow: 3px 3px 0 var(--ink); }

main { flex: 1; width: min(1100px, 100% - 28px); margin: 0 auto 40px; }

/* ---- hero ---- */
.hero { text-align: center; padding: 26px 0 8px; position: relative; }
.hero h1 { font-family: var(--display); font-weight: 400; font-size: clamp(36px, 8vw, 78px); line-height: 1.05; margin: 0 0 12px; text-shadow: 4px 4px 0 var(--pink2); }
.hero h1 em { display: inline-block; color: var(--red); font-style: normal; animation: wobble 2.4s ease-in-out infinite; }
.hero h1 .big { display: inline-block; animation: beat 1s infinite; }
.hero p { margin: 0 auto; max-width: 660px; font-size: 20px; font-weight: 600; }
.stickers { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin: 18px 0 6px; }
.sticker {
  padding: 6px 14px; border-radius: 99px; border: 3px solid var(--ink); font-weight: 700; box-shadow: 3px 3px 0 var(--ink);
  background: var(--mint); color: #3a0a2e; transform: rotate(var(--r, -3deg));
}
.sticker:nth-child(2) { --r: 4deg; background: var(--yellow); }
.sticker:nth-child(3) { --r: -5deg; background: var(--pink2); }
.sticker:nth-child(4) { --r: 2deg; background: #c9a7ff; }
@keyframes wobble { 0%,100% { transform: rotate(-4deg) scale(1); } 50% { transform: rotate(4deg) scale(1.08); } }
@keyframes beat { 0%,100% { transform: scale(1); } 25% { transform: scale(1.22); } 40% { transform: scale(1); } 60% { transform: scale(1.14); } }

/* love-o-mètre */
.meter { max-width: 520px; margin: 18px auto 0; text-align: left; }
.meter label { font-weight: 700; display: block; margin-bottom: 4px; text-align: center; }
.meter .track { height: 36px; border: 4px solid var(--ink); border-radius: 99px; background: var(--card); overflow: hidden; box-shadow: 4px 4px 0 var(--ink); position: relative; }
.meter .fill { height: 100%; width: 100%; background: repeating-linear-gradient(45deg, var(--red) 0 14px, var(--pink) 14px 28px); animation: stripes 1s linear infinite; transition: width .5s cubic-bezier(.3,1.6,.5,1); }
.meter .pct { position: absolute; inset: 0; display: grid; place-items: center; padding: 0 6px; }
.meter .pct span { background: #fff; color: #3a0a2e; border: 3px solid #3a0a2e; border-radius: 99px; padding: 0 12px; font-size: 14px; font-weight: 700; line-height: 1.35; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
@keyframes stripes { to { background-position: 28px 0; } }

/* ---- cartes outils ---- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 26px 22px; margin-top: 30px; padding: 6px; }
.tool-card {
  --r: -1.5deg; --c: var(--pink3);
  position: relative; display: flex; flex-direction: column; gap: 6px; padding: 22px 18px 18px;
  background: var(--c); color: var(--ink); border: 4px solid var(--ink); border-radius: 26px;
  box-shadow: var(--shadow); text-decoration: none; transform: rotate(var(--r));
  transition: transform .18s cubic-bezier(.3,1.8,.5,1), box-shadow .18s;
}
.tool-card:nth-child(4n+2) { --r: 1.8deg; --c: #fff0a8; }
.tool-card:nth-child(4n+3) { --r: -2.2deg; --c: #c8f7e3; }
.tool-card:nth-child(4n+4) { --r: 1.2deg; --c: #e2d0ff; }
@media (prefers-color-scheme: dark) { .tool-card { --c: #5a1743 !important; } }
.tool-card:hover, .tool-card:focus-visible { transform: rotate(0deg) scale(1.07) translateY(-6px); box-shadow: 10px 12px 0 var(--ink); outline: none; z-index: 2; }
.tool-card:hover .ico { animation: wobble .5s ease-in-out infinite; }
.tool-card:active { transform: scale(.97); box-shadow: 2px 2px 0 var(--ink); }
.tool-card .ico { font-size: 48px; display: inline-block; filter: drop-shadow(3px 3px 0 rgba(58,10,46,.25)); }
.tool-card h3 { margin: 2px 0 0; font-family: var(--display); font-weight: 400; font-size: 25px; line-height: 1.1; }
.tool-card p { margin: 0; font-weight: 600; font-size: 15px; }
.tool-card::after { content: "♥"; position: absolute; top: -14px; right: -10px; font-size: 30px; color: var(--red); text-shadow: 2px 2px 0 var(--ink); transform: rotate(18deg); }
.tool-card.soon { opacity: .75; cursor: not-allowed; filter: grayscale(.4); }
.tool-card.soon:hover { transform: rotate(var(--r)) translateX(-3px); box-shadow: var(--shadow); }
.tool-card.soon::after { content: "🔒"; }
.badge { align-self: flex-start; font-size: 12px; padding: 2px 10px; border-radius: 99px; border: 2px solid var(--ink); background: var(--yellow); color: #3a0a2e; font-weight: 700; }

/* ---- page outil ---- */
.back { display: inline-block; margin: 14px 0 6px; font-weight: 700; color: #3a0a2e; background: var(--yellow); border: 3px solid var(--ink); padding: 6px 14px; border-radius: 99px; text-decoration: none; box-shadow: 3px 3px 0 var(--ink); }
.back:hover { transform: translate(-2px,-2px) rotate(-2deg); }
.panel { background: var(--card); border: 4px solid var(--ink); border-radius: 30px; box-shadow: 9px 9px 0 var(--ink); padding: clamp(16px, 3vw, 30px); margin-top: 10px; position: relative; }
.panel::before, .panel::after { position: absolute; font-size: 34px; pointer-events: none; }
.panel::before { content: "💘"; top: -22px; left: 18px; transform: rotate(-15deg); }
.panel::after { content: "💖"; bottom: -24px; right: 22px; transform: rotate(14deg); }
.tool-head { text-align: center; margin-bottom: 18px; }
.tool-head .ico { font-size: 64px; display: inline-block; animation: wobble 2s ease-in-out infinite; }
.tool-head h2 { font-family: var(--display); font-weight: 400; font-size: clamp(32px, 6vw, 56px); margin: 0; line-height: 1.1; text-shadow: 3px 3px 0 var(--pink2); }
.tool-head p { margin: 4px 0 0; font-weight: 600; }
.tool-head em { color: var(--red); font-weight: 700; }

.drop {
  display: block; text-align: center; border: 4px dashed var(--red); border-radius: 26px;
  padding: 38px 16px; background: repeating-linear-gradient(-45deg, var(--pink3) 0 16px, transparent 16px 32px);
  transition: transform .15s;
}
.drop:hover, .drop.over { transform: scale(1.025) rotate(-.7deg); background: var(--yellow); color: #3a0a2e; }
.drop input { display: none; }
.drop .big { font-size: 54px; display: block; animation: beat 1.4s infinite; }
.drop strong { display: block; font-family: var(--display); font-weight: 400; font-size: 28px; margin-bottom: 2px; }
.drop span { font-weight: 600; }

.files { list-style: none; padding: 0; margin: 18px 0 0; display: grid; gap: 10px; }
.files li { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border: 3px solid var(--ink); border-radius: 18px; background: var(--pink3); box-shadow: 3px 3px 0 var(--ink); animation: pop .4s cubic-bezier(.3,1.8,.5,1); }
@keyframes pop { from { transform: scale(.5) rotate(-6deg); opacity: 0; } }
.files .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.files .meta { font-size: 13px; white-space: nowrap; font-weight: 600; }
.files .err { color: var(--red); }

button, .btn { font: inherit; font-weight: 700; border: 3px solid var(--ink); border-radius: 14px; padding: 6px 12px; background: var(--yellow); color: #3a0a2e; text-decoration: none; display: inline-block; box-shadow: 3px 3px 0 var(--ink); transition: transform .1s; }
button:hover:not(:disabled), .btn:hover { transform: translate(-2px,-2px) rotate(-1.5deg); box-shadow: 5px 5px 0 var(--ink); }
button:active:not(:disabled) { transform: translate(2px,2px); box-shadow: 1px 1px 0 var(--ink); }
button:disabled { opacity: .45; cursor: not-allowed; }
.icon-btn { padding: 2px 9px; }
.primary { background: var(--red); color: #fff; font-family: var(--display); font-weight: 400; font-size: 26px; padding: 12px 34px; border-radius: 99px; box-shadow: 6px 6px 0 var(--ink); animation: pulse 1.6s infinite; }
.primary:disabled { animation: none; }
.primary:hover:not(:disabled) { background: var(--pink); }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.06); } }
.actions { text-align: center; margin-top: 26px; }

.opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-top: 22px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field.wide { grid-column: 1 / -1; }
.field label { font-weight: 700; }
.field .hint { font-size: 13px; font-weight: 600; opacity: .8; }
input[type=text], input[type=number], select, textarea { font: inherit; font-weight: 600; padding: 10px 12px; border-radius: 14px; border: 3px solid var(--ink); background: var(--cream); color: var(--ink); }
input[type=color] { width: 100%; height: 46px; border: 3px solid var(--ink); border-radius: 14px; background: var(--cream); }
input[type=range] { accent-color: var(--red); height: 30px; }
input:focus, select:focus, button:focus-visible, .drop:focus-within { outline: 4px solid var(--purple); outline-offset: 2px; }

.status { text-align: center; margin-top: 18px; font-weight: 700; min-height: 26px; }
.bar { height: 30px; border: 4px solid var(--ink); border-radius: 99px; background: var(--cream); margin: 8px auto 0; max-width: 460px; position: relative; overflow: visible; }
.bar > i { display: block; height: 100%; width: 0; border-radius: 99px; background: repeating-linear-gradient(45deg, var(--red) 0 12px, var(--pink) 12px 24px); animation: stripes 1s linear infinite; transition: width .25s; position: relative; }
.bar > i::after { content: "💗"; position: absolute; right: -16px; top: -10px; font-size: 32px; animation: beat .6s infinite; }
.error { margin-top: 18px; padding: 14px 16px; border-radius: 20px; background: #ffe1e8; color: #7a0a2a; border: 4px solid var(--ink); box-shadow: 5px 5px 0 var(--ink); font-weight: 700; animation: shake .5s; }
.error::before { content: "💔 "; }
@keyframes shake { 0%,100% { transform: translateX(0); } 20% { transform: translateX(-10px) rotate(-1deg); } 40% { transform: translateX(10px) rotate(1deg); } 60% { transform: translateX(-6px); } 80% { transform: translateX(6px); } }

.results { margin-top: 26px; padding: 20px; border-radius: 26px; background: var(--mint); color: #3a0a2e; border: 4px solid var(--ink); box-shadow: 6px 6px 0 var(--ink); animation: pop .5s cubic-bezier(.3,1.8,.5,1); }
.results h3 { margin: 0 0 12px; font-family: var(--display); font-weight: 400; font-size: 30px; }
.results ul { list-style: none; padding: 0; margin: 0 0 14px; display: grid; gap: 10px; }
.results li { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; background: #fff; border: 3px solid var(--ink); border-radius: 16px; padding: 8px 12px; }
.results li .nm { flex: 1; min-width: 160px; font-weight: 700; word-break: break-all; }
.results .note { font-size: 13px; font-weight: 600; }
.dl { background: var(--red); color: #fff; }

/* organize */
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(135px, 1fr)); gap: 14px; margin-top: 8px; }
.thumb { border: 3px solid var(--ink); border-radius: 18px; padding: 8px; background: var(--pink3); text-align: center; cursor: grab; box-shadow: 3px 3px 0 var(--ink); }
.thumb:nth-child(odd) { transform: rotate(-1.5deg); }
.thumb:nth-child(even) { transform: rotate(1.5deg); }
.thumb.drag { opacity: .4; }
.thumb .pic { height: 130px; display: grid; place-items: center; overflow: hidden; }
.thumb canvas { max-width: 100%; max-height: 126px; border: 2px solid var(--ink); transition: transform .2s; background: #fff; }
.thumb .tb { display: flex; gap: 3px; justify-content: center; margin-top: 6px; }
.thumb .tb button { padding: 0 7px; font-size: 13px; box-shadow: 2px 2px 0 var(--ink); }
.thumb small { font-weight: 700; }

/* sign */
.sigpad { border: 4px dashed var(--ink); border-radius: 18px; background: #fff; touch-action: none; max-width: 100%; cursor: crosshair; }
.preview-wrap { position: relative; display: inline-block; max-width: 100%; margin-top: 6px; cursor: crosshair; }
.preview-wrap canvas { max-width: 100%; height: auto; border: 4px solid var(--ink); background: #fff; display: block; }
.marker { position: absolute; border: 3px dashed var(--red); background: rgba(255, 46, 99, .2); pointer-events: none; transform: translate(-50%, -50%); }

/* ---- mascottes ---- */
.mascots { position: fixed; left: 10px; bottom: 6px; z-index: 40; display: flex; align-items: flex-end; gap: 4px; pointer-events: none; }
.mascot { font-size: 54px; line-height: 1; pointer-events: auto; cursor: pointer; display: inline-block; filter: drop-shadow(3px 3px 0 rgba(58,10,46,.35)); transform-origin: bottom center; animation: bob 2.6s ease-in-out infinite; }
.mascot.mel { animation-delay: -1.3s; }
.mascot:hover { animation: jump .5s infinite; }
@keyframes bob { 0%,100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-8px) rotate(3deg); } }
@keyframes jump { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-22px) scale(1.1); } }
.bubble { align-self: flex-start; max-width: 230px; background: #fff; color: #3a0a2e; border: 3px solid var(--ink); border-radius: 18px 18px 18px 4px; padding: 8px 12px; font-weight: 700; font-size: 14px; box-shadow: 3px 3px 0 var(--ink); transform-origin: bottom left; animation: pop .35s cubic-bezier(.3,1.8,.5,1); margin-bottom: 36px; }
.bubble[hidden] { display: none; }

.foot { text-align: center; padding: 26px 16px 90px; font-weight: 700; }
.foot p { margin: 4px 0; }
.foot .small { font-size: 14px; font-weight: 600; opacity: .85; }
.beat { color: var(--red); display: inline-block; animation: beat 1.1s infinite; font-size: 1.3em; }

@media (max-width: 560px) {
  .mascot { font-size: 40px; }
  .bubble { max-width: 160px; font-size: 12px; }
  .tag { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .hearts { display: none; }
}
