@import url('https://fonts.googleapis.com/css2?family=Source+Serif+4:opsz,wght@8..60,600;8..60,700&family=Figtree:wght@400;500;600;700&display=swap');

:root {
  --color-bg: #f7f5ee;
  --color-heading: #1a2438;
  --color-text: #3d4654;
  --color-text-muted: #5c6470;
  --color-text-faint: #8a94a6;
  --color-primary: #1e3a6e;
  --color-primary-hover: #16305e;
  --color-accent: #b78233;
  --color-progress: #ce181e;
  --border-soft: rgba(26, 36, 56, 0.08);
  --shadow-card: 0 2px 14px rgba(26, 36, 56, 0.06);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

noscript { display: none; }

html, body { height: 100%; overflow: hidden; }

body {
  font-family: 'Figtree', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--color-accent); }
a:hover { color: var(--color-primary); }

button { font-family: inherit; }

.container {
  height: 100dvh;
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  padding: 0 20px clamp(12px, 2.4dvh, 22px);
  overflow: hidden;
}

/* ---------- Header / logo ---------- */
.logo {
  display: flex;
  justify-content: center;
  padding: clamp(12px, 2.6dvh, 28px) 0 4px;
  text-decoration: none;
}
.logo-image { width: 170px; height: auto; display: block; }

.hero { text-align: center; display: flex; flex-direction: column; gap: 10px; padding: clamp(10px, 2dvh, 20px) 0 0; }
.hero h1, .page-title {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: clamp(22px, 3.2dvh, 29px);
  font-weight: 700;
  line-height: 1.22;
  color: var(--color-heading);
  text-wrap: pretty;
}
.subtitle { font-size: 14.5px; line-height: 1.6; color: var(--color-text-muted); }

/* ---------- Cards ---------- */
.card {
  background: #ffffff;
  border: 1px solid var(--border-soft);
  border-radius: 18px;
  padding: 20px;
  box-shadow: var(--shadow-card);
}

.consent-kicker {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.13em;
  color: var(--color-text-faint);
  text-transform: uppercase;
}
.consent-text { font-size: 14px; line-height: 1.6; color: var(--color-text); }
.consent-text a {
  color: var(--color-accent);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-skip-ink: none;
}

.consent-confirmation {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  padding-top: 2px;
}
.consent-confirmation input { position: absolute; opacity: 0; pointer-events: none; }
.consent-checkmark {
  flex: 0 0 18px;
  width: 18px; height: 18px;
  border-radius: 6px;
  border: 1.5px solid rgba(26, 36, 56, 0.3);
  background: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: border-color .2s;
}
.consent-checkmark::after {
  content: '';
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--color-primary);
  transform: scale(0);
  transition: transform .2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.consent-confirmation input:checked + .consent-checkmark { border-color: var(--color-primary); }
.consent-confirmation input:checked + .consent-checkmark::after { transform: scale(1); }
.consent-label { font-size: 13.5px; font-weight: 700; color: var(--color-heading); }

/* ---------- Buttons ---------- */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 16px 30px;
  border: none;
  border-radius: 28px;
  background: var(--color-primary);
  color: #ffffff;
  font-weight: 600;
  font-size: 16.5px;
  letter-spacing: 0.01em;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, opacity .25s;
}
.btn-primary:hover { background: var(--color-primary-hover); color: #ffffff; }
.btn-primary:disabled { opacity: 0.35; cursor: not-allowed; }

.btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 15px 30px;
  border: 1.5px solid rgba(30, 58, 110, 0.35);
  border-radius: 28px;
  background: transparent;
  color: var(--color-primary);
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  text-decoration: none;
  transition: border-color .15s;
}
.btn-outline:hover { border-color: var(--color-primary); color: var(--color-primary); }

.btn-ghost {
  width: 100%;
  padding: 8px;
  border: none;
  background: transparent;
  color: #6b7280;
  font-weight: 500;
  font-size: 13.5px;
  cursor: pointer;
}
.btn-ghost:hover { color: var(--color-heading); }

/* ---------- Dropzone ---------- */
.dropzone {
  border: 1.5px dashed rgba(30, 58, 110, 0.35);
  border-radius: 18px;
  background: #ffffff;
  padding: clamp(20px, 4.5dvh, 44px) 20px;
  cursor: pointer;
  box-shadow: 0 2px 14px rgba(26, 36, 56, 0.05);
  transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.dragover { border-color: var(--color-primary); background: #fbfaf6; }

/* When a photo is loaded, the preview fills the free space edge to edge */
.dropzone.has-photo {
  flex: 1;
  min-height: 0;
  width: 100%;
  padding: 0;
  border: none;
  background: #12182a;
  position: relative;
  overflow: hidden;
  box-shadow: 0 6px 24px rgba(26, 36, 56, 0.14);
}
.dropzone-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
}
.dropzone-icon img { width: 46px; height: auto; margin-bottom: 6px; }
.dropzone-title { font-size: 15.5px; font-weight: 700; color: var(--color-heading); }
.dropzone-hint { font-size: 13.5px; color: var(--color-text-muted); }
.dropzone-formats { font-size: 11px; color: #9ca3af; letter-spacing: 0.04em; }

.dropzone-preview {
  position: absolute;
  inset: 0;
  line-height: 0;
}
.dropzone-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.dropzone-preview::after {
  content: 'Cliquez pour remplacer';
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 12px;
  text-align: center;
  background: linear-gradient(transparent, rgba(10, 14, 24, 0.65));
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  pointer-events: none;
}
.btn-remove {
  position: absolute;
  top: 12px; right: 12px;
  width: 36px; height: 36px;
  border: none;
  border-radius: 50%;
  background: rgba(26, 36, 56, 0.72);
  color: #ffffff;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
}
.btn-remove:hover { background: rgba(206, 24, 30, 0.9); }

/* ---------- Bottom sheet (source choice) ---------- */
.source-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26, 36, 56, 0.28);
  display: none;
  z-index: 100;
}
.source-overlay.show { display: block; }
.source-sheet {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  max-width: 560px;
  margin: 0 auto;
  background: #ffffff;
  border-radius: 24px 24px 0 0;
  padding: 24px 20px 30px;
  display: flex;
  flex-direction: column;
  gap: 11px;
  box-shadow: 0 -14px 44px rgba(26, 36, 56, 0.22);
}
.source-sheet::before {
  content: '';
  width: 40px; height: 4px;
  border-radius: 2px;
  background: rgba(26, 36, 56, 0.15);
  margin: 0 auto 8px;
}

/* ---------- Progress ring (status page) ---------- */
.ring-wrap { position: relative; width: clamp(84px, 14dvh, 132px); aspect-ratio: 1 / 1; height: auto; margin: 0 auto; }
.ring-wrap svg { width: 100%; height: 100%; display: block; }
.ring-pct {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: clamp(22px, 3.8dvh, 32px);
  font-weight: 700;
  color: var(--color-heading);
}
.ring-pct small { font-size: 0.55em; }

.status-title {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 24px;
  font-weight: 700;
  color: var(--color-heading);
  letter-spacing: 0.005em;
}
.status-sub { font-size: 14px; color: var(--color-text-muted); }

.status-banner-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.status-banner {
  height: min(100%, calc(min(100vw - 40px, 520px) * 0.75));
  aspect-ratio: 4 / 3;
  border-radius: 18px;
  overflow: hidden;
  transition: opacity .5s ease;
  background: #0f1a33 center/cover no-repeat;
  box-shadow: 0 2px 14px rgba(26, 36, 56, 0.08);
}

.link-hint { font-size: 12.5px; color: var(--color-text-muted); text-align: center; }

/* ---------- Ready / result ---------- */
.check-circle {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 20px rgba(30, 58, 110, 0.3);
}

.result-video-wrap {
  max-height: 100%;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.result-video { max-width: 100%; max-height: 100%; width: auto; height: auto; display: block; border-radius: 18px; box-shadow: 0 10px 32px rgba(26, 36, 56, 0.18); }
.video-caption { margin-top: 14px; text-align: center; font-family: 'Source Serif 4', Georgia, serif; font-style: italic; font-size: 17px; color: var(--color-text-muted); }

/* ---------- Misc ---------- */
.error-message {
  background: rgba(206, 24, 30, 0.06);
  border: 1px solid rgba(206, 24, 30, 0.25);
  color: var(--color-progress);
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 13.5px;
  text-align: center;
}

.spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #ffffff;
  border-radius: 50%;
  display: inline-block;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.fade-text { transition: opacity .3s; }
