:root {
  --bg-1: #1e293b;
  --bg-2: #0f172a;
  --accent: #64748b;
  --text: #f8fafc;
  --muted: #cbd5e1;
}

/* Thème par état */
body[data-status="WIP"]     { --bg-1: #b45309; --bg-2: #78350f; --accent: #fbbf24; }
body[data-status="PRAYING"] { --bg-1: #4c1d95; --bg-2: #2e1065; --accent: #a78bfa; }
body[data-status="FAILED"]  { --bg-1: #7f1d1d; --bg-2: #450a0a; --accent: #ef4444; }
body[data-status="SUCCESS"] { --bg-1: #064e3b; --bg-2: #022c22; --accent: #10b981; }

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: radial-gradient(circle at 50% 20%, var(--bg-1), var(--bg-2));
  background-attachment: fixed;
  transition: background 0.6s ease;
  overflow-x: hidden;
}

.stage {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  text-align: center;
}

/* ---------- Carte générique ---------- */
.card { max-width: 640px; animation: rise 0.7s cubic-bezier(0.22, 1, 0.36, 1); }
.emoji {
  font-size: clamp(4rem, 18vw, 9rem);
  line-height: 1;
  filter: drop-shadow(0 8px 24px rgba(0, 0, 0, 0.4));
}
.title {
  margin-top: 1.5rem;
  font-size: clamp(2rem, 7vw, 3.5rem);
  font-weight: 800;
  letter-spacing: -0.02em;
}
.subtitle {
  margin-top: 1rem;
  font-size: clamp(1rem, 3.5vw, 1.35rem);
  color: var(--muted);
  font-weight: 400;
}

/* ---------- Scène WIP ---------- */
.wip-scene {
  width: 100%;
  max-width: 900px;
  animation: rise 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

.sky {
  position: relative;
  height: 90px;
}
.sun {
  position: absolute;
  top: 6px; right: 12%;
  width: 54px; height: 54px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 40%, #fff7cc, #fbbf24);
  box-shadow: 0 0 40px 8px rgba(251, 191, 36, 0.5);
  animation: pulse 4s ease-in-out infinite;
}
.cloud {
  position: absolute;
  font-size: 2rem;
  opacity: 0.85;
  filter: grayscale(0.2);
}
.cloud::before { content: "☁️"; }
.cloud.c1 { top: 10px; left: -10%; animation: drift 26s linear infinite; }
.cloud.c2 { top: 40px; left: -30%; font-size: 1.4rem; animation: drift 34s linear infinite; }

.road {
  position: relative;
  height: 170px;
  border-bottom: 8px solid rgba(0, 0, 0, 0.35);
  background: linear-gradient(180deg, transparent 60%, rgba(0, 0, 0, 0.12) 60%);
}
/* pointillés de la route */
.road::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -6px;
  height: 4px;
  background: repeating-linear-gradient(
    90deg, rgba(255,255,255,0.7) 0 24px, transparent 24px 48px);
  opacity: 0.5;
}

.car {
  position: absolute;
  bottom: 2px;
  left: 76%;
  font-size: clamp(2.6rem, 9vw, 4rem);
  line-height: 1;
  transform: scaleX(-1);            /* voiture tournée vers le marcheur */
  animation: idle 1.6s ease-in-out infinite;
  filter: drop-shadow(0 6px 6px rgba(0,0,0,0.3));
}

/* Traces de chaussures qui se posent au fil de la marche */
.trail { position: absolute; inset: 0; }
.shoe-print {
  position: absolute;
  bottom: 6px;
  font-size: 1.4rem;
  opacity: 0;
  transform: rotate(-18deg);
  animation: footstep 6.5s linear infinite;
}
.shoe-print:nth-child(even) { transform: rotate(12deg); bottom: 2px; }

/* Le marcheur : tête + pieds */
.walker {
  position: absolute;
  bottom: 6px;
  left: 0;
  width: 70px;
  animation: walk 6.5s cubic-bezier(0.45, 0, 0.55, 1) infinite;
}
.face {
  position: relative;
  width: 62px; height: 62px;
  margin: 0 auto 4px;
  border-radius: 50%;
  border: 3px solid #fff;
  background: #fde68a;
  overflow: hidden;
  box-shadow: 0 4px 10px rgba(0,0,0,0.35);
  animation: bob 0.5s ease-in-out infinite;
}
.face img { width: 100%; height: 100%; object-fit: cover; display: block; }
.face-fallback {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font-size: 2.2rem;
}
.feet {
  display: flex;
  justify-content: center;
  gap: 2px;
  font-size: 1.5rem;
}
.feet .l { animation: stepL 0.5s ease-in-out infinite; }
.feet .r { animation: stepR 0.5s ease-in-out infinite; }

.footer {
  margin-top: 2.5rem;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  opacity: 0.8;
}
.card ~ .footer, .wip-scene ~ .footer {
  position: fixed; bottom: 1.5rem; left: 0; right: 0; margin: 0;
}

/* ---------- Keyframes ---------- */
@keyframes rise {
  from { opacity: 0; transform: translateY(20px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes walk {
  0%   { left: 2%; }
  85%  { left: 62%; }      /* n'atteint jamais tout à fait la voiture */
  100% { left: 2%; }
}
@keyframes bob {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50%      { transform: translateY(-4px) rotate(2deg); }
}
@keyframes stepL {
  0%, 100% { transform: translateY(0) rotate(0); }
  50%      { transform: translateY(-6px) rotate(-15deg); }
}
@keyframes stepR {
  0%, 100% { transform: translateY(-6px) rotate(15deg); }
  50%      { transform: translateY(0) rotate(0); }
}
@keyframes footstep {
  0%, 8%   { opacity: 0; }
  12%      { opacity: 0.9; }
  80%      { opacity: 0.9; }
  100%     { opacity: 0; }
}
@keyframes idle {
  0%, 100% { transform: scaleX(-1) translateY(0); }
  50%      { transform: scaleX(-1) translateY(-3px); }
}
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.08); }
}
@keyframes drift {
  from { transform: translateX(0); }
  to   { transform: translateX(120vw); }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; }
  .walker { left: 40%; }
  .shoe-print { opacity: 0.8; }
}
