html:has(#app[data-view="done"]),
html:has(#app[data-view="done"]) body { background: var(--night); }

/* Les styles de base sont l'état final. La célébration (.is-playing) y arrive par étapes. */
.done {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  background: var(--night); color: var(--creme); text-align: center;
}
.done-sky { position: absolute; inset: 0 0 auto; opacity: .35; }
/* Sur l'écran de fin, le ciel n'est qu'un fond : ni l'île ni sa lueur. */
.done-sky .island, .done-sky .halo { display: none; }
/* Et il ne bouge plus : c'est le moment de poser son téléphone (et d'épargner sa batterie). */
.done-sky .sky * { animation: none !important; }
.done-main { position: relative; display: flex; flex-direction: column; align-items: center; padding-bottom: 40px; }

.done-moon { position: relative; width: 104px; height: 104px; margin-bottom: 10px; color: #2A3A82; }
.done-moon svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.done-moon .moon-off { opacity: 0; }
.done-halo { position: absolute; inset: -24px; border-radius: 50%; background: radial-gradient(circle, rgba(255, 217, 168, .32), rgba(255, 217, 168, 0) 68%); }
.spark {
  position: absolute; left: 50%; top: 50%; width: var(--s); height: var(--s); margin: calc(var(--s) / -2);
  border-radius: 50%; background: var(--c); opacity: 0;
}

.done-count { display: grid; justify-items: center; margin: 0; }
.done-roll { display: flex; flex-direction: column; height: 64px; overflow: hidden; color: var(--abricot); }
.done-roll b { display: block; height: 64px; font-size: 60px; font-weight: 800; line-height: 64px; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; transform: translateY(-64px); }
.done-label { margin-top: 2px; font-size: 18px; font-weight: 600; }

.done-week { display: flex; gap: 8px; margin: 26px 0 0; padding: 0; list-style: none; }
.wd { display: grid; justify-items: center; gap: 6px; }
.wd > span { color: rgba(251, 246, 239, .6); font-size: 12px; font-weight: 600; }
.wd.is-today > span { color: var(--abricot); }
.wd > i { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px rgba(251, 246, 239, .25); color: var(--navy); }
.wd .icon { width: 18px; height: 18px; stroke-width: 2.6; }
.wd-done > i { background: var(--ciel); box-shadow: none; }
.wd-joker > i { box-shadow: inset 0 0 0 2px var(--ciel); color: var(--ciel); }
.wd-joker .icon { fill: currentColor; stroke-width: 1.4; }
.wd-missed > i { background: rgba(251, 246, 239, .12); box-shadow: none; }
.wd.is-today > i { outline: 2px solid var(--abricot); outline-offset: 2px; }

.done-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 18px; }
.done-chip { margin: 0; padding: 6px 12px; border-radius: 999px; background: rgba(251, 246, 239, .1); color: var(--abricot); box-shadow: inset 0 0 0 1.5px rgba(255, 217, 168, .45); font-size: 14px; font-weight: 700; }

.done-text { margin-top: 34px; }
.done-title { margin: 0; font-size: 28px; line-height: 1.2; font-weight: 600; letter-spacing: -0.02em; }
.done-sub { margin: 12px 0 0; opacity: .75; }
/* Mon ciel : bouton pilule crème, en relief comme les autres boutons. */
.done-link {
  position: absolute; left: 50%; bottom: calc(var(--safe-bottom) + 28px); transform: translateX(-50%);
  min-height: 48px; padding: 0 28px; border-radius: 999px; color: var(--creme); font-size: 16px; font-weight: 600;
  background: rgba(251, 246, 239, .08);
  box-shadow: inset 0 0 0 1.5px rgba(251, 246, 239, .55), 0 3px 0 rgba(251, 246, 239, .25);
  transition: transform .08s ease, box-shadow .08s ease;
}
.done-link:active { transform: translateX(-50%) translateY(3px); box-shadow: inset 0 0 0 1.5px rgba(251, 246, 239, .55), 0 0 0 rgba(251, 246, 239, .25); }

/* La célébration : environ 4 s, une fois. */
.done.is-playing { animation: done-in .4s ease both; }
.is-playing .moon-off { animation: moon-out .45s ease .5s both; }
.is-playing .moon-on { animation: moon-in .7s cubic-bezier(.3, 1.6, .5, 1) .9s both; }
.is-playing .done-halo { animation: halo 1.4s ease 1s both; }
.is-playing .spark { animation: spark .9s cubic-bezier(.2, .7, .3, 1) 1s both; }
.is-playing .done-roll { animation: roll-tint .3s ease 1.6s both; }
.is-playing .done-roll b { animation: roll .55s cubic-bezier(.3, 1.4, .5, 1) 1.5s both; }
.is-playing .done-label { animation: rise .4s ease 1.8s both; }
.is-playing .wd { animation: rise .35s ease calc(1.9s + var(--i) * 50ms) both; }
.is-playing .wd.is-today > i { animation: day-pop .5s cubic-bezier(.3, 1.8, .5, 1) 2.5s both; }
.is-playing .wd.is-today .icon { animation: fade .2s ease 2.75s both; }
.is-playing .done-week.is-perfect .wd > i { animation: perfect .5s ease calc(3s + var(--i) * 70ms) both; }
.is-playing .done-week.is-perfect .wd.is-today > i { animation: day-pop .5s cubic-bezier(.3, 1.8, .5, 1) 2.5s both, perfect .5s ease calc(3s + var(--i) * 70ms); }
.is-playing .done-chips { animation: rise .45s cubic-bezier(.3, 1.5, .5, 1) 3.2s both; }
.is-playing .done-text { animation: rise .6s ease 3.4s both; }
.is-playing .done-link { animation: fade .6s ease 3.9s both; pointer-events: none; }

@keyframes done-in { from { opacity: 0; } }
@keyframes moon-out { from { opacity: 1; } to { opacity: 0; transform: scale(1.15, .8); } }
@keyframes moon-in { from { opacity: 0; transform: scale(.2); } to { opacity: 1; transform: none; } }
@keyframes halo { 0% { opacity: 0; transform: scale(.3); } 45% { opacity: 1; transform: scale(1.25); } 100% { opacity: 1; transform: none; } }
@keyframes spark {
  0% { opacity: 1; transform: translate(0, 0) scale(1); }
  100% { opacity: 0; transform: translate(var(--x), var(--y)) scale(.3); }
}
@keyframes roll-tint { from { color: rgba(251, 246, 239, .35); } }
@keyframes roll { from { transform: translateY(0); } }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
@keyframes fade { from { opacity: 0; } }
@keyframes day-pop {
  0% { background: transparent; box-shadow: inset 0 0 0 1.5px rgba(251, 246, 239, .25); transform: scale(1); }
  50% { background: var(--ciel); box-shadow: none; transform: scale(1.35); }
  100% { background: var(--ciel); transform: none; }
}
@keyframes perfect { 50% { transform: scale(1.2); box-shadow: 0 0 0 4px rgba(255, 217, 168, .5); } }

@media (prefers-reduced-motion: reduce) {
  .done.is-playing, .done.is-playing * { animation: none !important; }
}
