:root {
  --bg: #0b0f1a;
  --panel: #121829;
  --panel-2: #182038;
  --line: #242d47;
  --text: #eef2ff;
  --muted: #94a0bf;
  --cyan: #22d3ee;
  --violet: #8b5cf6;
  --ok: #34d399;
  --err: #f87171;
  --grad: linear-gradient(135deg, var(--cyan), var(--violet));
  --radius: 18px;
  color-scheme: dark;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); line-height: 1.5; }
body { min-height: 100vh; display: flex; flex-direction: column; overflow-x: hidden; }
button, input, textarea, select { font: inherit; color: inherit; }
.i { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; vertical-align: -3px; }

.glow { position: fixed; inset: -30vh -20vw auto; height: 80vh; background: radial-gradient(closest-side, rgba(139, 92, 246, .22), transparent), radial-gradient(closest-side at 70% 40%, rgba(34, 211, 238, .16), transparent); pointer-events: none; filter: blur(20px); animation: drift 18s ease-in-out infinite alternate; }
@keyframes drift { to { transform: translate3d(6vw, 4vh, 0) scale(1.08); } }

.top { position: relative; padding: 22px clamp(16px, 5vw, 48px); }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); font-weight: 700; font-size: 1.15rem; letter-spacing: .01em; }
.brand svg { width: 34px; height: 34px; }

.app { position: relative; flex: 1; width: min(600px, 100% - 32px); margin: 2vh auto 40px; }
.foot { position: relative; text-align: center; color: var(--muted); font-size: .82rem; padding: 18px 16px 28px; }

.card { background: color-mix(in srgb, var(--panel) 92%, transparent); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(18px, 4vw, 30px); box-shadow: 0 30px 80px -30px rgba(0, 0, 0, .7); backdrop-filter: blur(8px); animation: rise .45s cubic-bezier(.2, .8, .2, 1); }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
h1 { font-size: clamp(1.4rem, 4vw, 1.9rem); margin: 0 0 6px; line-height: 1.2; }
.lead { color: var(--muted); margin: 0 0 22px; }

/* ---- Zone de dépôt ---- */
.drop { position: relative; display: grid; place-items: center; text-align: center; gap: 10px; padding: 38px 20px; border-radius: 16px; cursor: pointer; background: var(--panel-2); transition: background .2s, transform .2s; outline: none; }
.drop svg.frame { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.drop svg.frame rect { width: calc(100% - 2px); height: calc(100% - 2px); fill: none; stroke: #3a4670; stroke-width: 2; stroke-dasharray: 9 9; transition: stroke .2s; animation: march 14s linear infinite; }
@keyframes march { to { stroke-dashoffset: -180; } }
.drop:hover, .drop:focus-visible { background: #1c2542; }
.drop:hover svg.frame rect, .drop:focus-visible svg.frame rect { stroke: var(--cyan); }
.drop.over { background: #1d2a4d; transform: scale(1.01); }
.drop.over svg.frame rect { stroke: var(--violet); animation-duration: 3s; }
.drop .bubble { width: 64px; height: 64px; border-radius: 20px; display: grid; place-items: center; background: var(--grad); box-shadow: 0 12px 30px -10px rgba(139, 92, 246, .8); transition: transform .3s cubic-bezier(.3, 1.6, .5, 1); }
.drop .bubble .i { width: 30px; height: 30px; color: #fff; stroke-width: 2.4; }
.drop:hover .bubble, .drop.over .bubble { transform: translateY(-6px); }
.drop strong { font-size: 1.05rem; }
.drop span { color: var(--muted); font-size: .9rem; }

.files { list-style: none; margin: 16px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.files li { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-2); animation: rise .3s ease-out; min-width: 0; }
.files .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.files .size { color: var(--muted); font-size: .85rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ghost { border: 0; background: none; padding: 6px; border-radius: 8px; cursor: pointer; color: var(--muted); display: inline-grid; place-items: center; }
.ghost:hover { color: var(--text); background: #26304f; }

.fields { display: grid; gap: 14px; margin-top: 20px; }
label.f span { display: block; color: var(--muted); font-size: .85rem; margin-bottom: 6px; }
input[type=text], textarea, select { width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 11px 13px; outline: none; transition: border-color .2s, box-shadow .2s; }
textarea { resize: vertical; min-height: 72px; }
input[type=text]:focus, textarea:focus, select:focus { border-color: var(--violet); box-shadow: 0 0 0 4px rgba(139, 92, 246, .18); }
.seg { display: inline-flex; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 4px; gap: 4px; flex-wrap: wrap; }
.seg button { border: 0; background: none; padding: 7px 14px; border-radius: 9px; cursor: pointer; color: var(--muted); transition: background .2s, color .2s; }
.seg button[aria-pressed=true] { background: var(--grad); color: #fff; font-weight: 600; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 13px; padding: 13px 20px; font-weight: 650; cursor: pointer; background: var(--grad); color: #fff; box-shadow: 0 14px 30px -14px rgba(139, 92, 246, .9); transition: transform .15s, filter .15s, opacity .15s; text-decoration: none; }
.btn:hover { filter: brightness(1.1); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; filter: none; }
.btn.block { width: 100%; margin-top: 22px; }
.btn.soft { background: var(--panel-2); border: 1px solid var(--line); box-shadow: none; color: var(--text); }

/* ---- Progression ---- */
.progress { display: grid; place-items: center; gap: 18px; padding: 10px 0; text-align: center; }
.ring { position: relative; width: 190px; height: 190px; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 12; stroke-linecap: round; }
.ring .track { stroke: var(--panel-2); }
.ring .bar { stroke: url(#brand); transition: stroke-dashoffset .35s ease; }
.ring .pct { position: absolute; inset: 0; display: grid; place-items: center; font-size: 2.3rem; font-weight: 750; font-variant-numeric: tabular-nums; }
.stats { color: var(--muted); font-variant-numeric: tabular-nums; }
.current { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- Terminé ---- */
.done { text-align: center; }
.check { width: 84px; height: 84px; margin: 0 auto 14px; }
.check circle { fill: none; stroke: var(--ok); stroke-width: 4; stroke-dasharray: 240; stroke-dashoffset: 240; animation: draw .6s ease-out forwards; }
.check path { fill: none; stroke: var(--ok); stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 60; stroke-dashoffset: 60; animation: draw .35s .45s ease-out forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.link { display: flex; align-items: center; gap: 8px; margin: 20px 0 10px; padding: 6px 6px 6px 14px; border-radius: 14px; background: var(--bg); border: 1px solid var(--line); }
.link code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .95rem; color: #c7d2fe; text-align: left; }
.link .btn { padding: 10px 14px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 12px; }
.hint { color: var(--muted); font-size: .88rem; margin-top: 16px; }
.hint.ok { color: var(--ok); }
.hint.warn { color: var(--text); background: rgba(248, 113, 113, .08); border: 1px solid rgba(248, 113, 113, .35); border-radius: 12px; padding: 12px 14px; }
.hint.warn p { margin: 0 0 10px; }

/* ---- Envoi depuis un lien personnel ---- */
.ticket { display: flex; align-items: flex-start; gap: 10px; margin: 0 0 18px; padding: 10px 14px; border-radius: 12px; font-size: .9rem; background: rgba(34, 211, 238, .08); border: 1px solid rgba(34, 211, 238, .3); color: #cffafe; }
.ticket .i { margin-top: 2px; color: var(--cyan); }
.ticket.warn { background: rgba(248, 113, 113, .08); border-color: rgba(248, 113, 113, .35); color: var(--text); }
.ticket.warn .i { color: var(--err); }
select { appearance: none; cursor: pointer; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 36px; }
select option { background: var(--panel); }

/* ---- Téléchargement ---- */
.meta { display: flex; flex-wrap: wrap; gap: 8px 16px; color: var(--muted); font-size: .9rem; margin-bottom: 18px; }
.meta span { display: inline-flex; align-items: center; gap: 6px; }
.message { white-space: pre-wrap; background: var(--panel-2); border-radius: 12px; padding: 12px 14px; margin: 0 0 18px; }
.dl li .btn { padding: 8px 12px; font-size: .88rem; box-shadow: none; }
.bar-line { height: 4px; border-radius: 4px; background: var(--panel-2); overflow: hidden; margin-top: 6px; }
.all .bar-line { margin-top: 10px; }
.bar-line i { display: block; height: 100%; width: 0; background: var(--grad); transition: width .2s; }
.error { text-align: center; }
.error .big { font-size: 3rem; margin: 0; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; font-weight: 800; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #1f2a48; border: 1px solid var(--line); padding: 10px 16px; border-radius: 12px; animation: rise .25s ease-out; z-index: 10; }

@media (max-width: 480px) {
  .files li { flex-wrap: wrap; }
  .ring { width: 160px; height: 160px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .check circle, .check path { stroke-dashoffset: 0; }
}

/* ---- Fiche remplie sur le site ---- */
.fields.fiche { margin: 0 0 20px; }
label.f span em, .f .lbl em { font-style: normal; opacity: .7; }
.f .lbl { display: block; color: var(--muted); font-size: .85rem; margin-bottom: 6px; }
.pair { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); }
.image-pick { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; min-width: 0; }
.image-pick .btn { padding: 9px 14px; font-size: .92rem; }
.image-pick .muted { color: var(--muted); font-size: .88rem; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.image-pick .thumb { width: 96px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.image-pick .thumb[hidden], .image-pick .ghost[hidden] { display: none; }
