:root {
  --bg: #0d0a16; --surface: #17122a; --surface-2: #1f1838; --line: #2e2550;
  --text: #ece8f8; --muted: #9a92b8; --violet: #8b5cf6; --lilac: #c4b5fd; --danger: #f08aa0; --ok: #7ddba5;
  --radius: 18px; font-family: ui-rounded, "Avenir Next", "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; color: var(--text);
  background: radial-gradient(900px 500px at 15% -10%, #2a1a5e 0%, transparent 60%),
              radial-gradient(700px 500px at 100% 0%, #1b1240 0%, transparent 55%), var(--bg); }
h1, h2 { margin: 0; font-weight: 650; letter-spacing: -.02em; }
h2 { font-size: 1.05rem; margin-bottom: .75rem; }
.muted { color: var(--muted); margin: 0; }
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--lilac); outline-offset: 2px; }

/* Connexion */
.gate { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; }
.gate form { width: min(380px, 100%); background: var(--surface); border: 1px solid var(--line);
  border-radius: 24px; padding: 2rem; display: grid; gap: .7rem; box-shadow: 0 30px 80px #0008; }
.gate h1 { font-size: 2.4rem; letter-spacing: .08em; }
label { font-size: .85rem; color: var(--muted); }
input { width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: .8rem 1rem; }
input:focus { border-color: var(--violet); }
.primary { background: linear-gradient(135deg, #7c4dff, #a78bfa); border: 0; border-radius: 12px; padding: .85rem;
  font-weight: 600; cursor: pointer; transition: transform .15s, filter .15s; }
.primary:hover { filter: brightness(1.1); } .primary:active { transform: scale(.98); }
.ghost { background: none; border: 1px solid var(--line); color: var(--muted); border-radius: 10px; padding: .35rem .75rem; cursor: pointer; }
.ghost:hover { color: var(--text); border-color: var(--violet); }
.error { color: var(--danger); margin: 0; font-size: .9rem; }

/* En-tête */
header { display: flex; align-items: center; gap: 1rem; padding: 1rem 1.25rem; max-width: 860px; margin: 0 auto; }
.brand { letter-spacing: .12em; }
header .muted { flex: 1; text-transform: capitalize; font-size: .9rem; }
.status { display: flex; align-items: center; gap: .4rem; font-size: .8rem; color: var(--muted); }
.status i { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.status.ok i { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.status.ko i { background: var(--danger); }

main { max-width: 860px; margin: 0 auto; padding: 0 1.25rem 4rem; }
.banner { background: var(--surface-2); border: 1px solid var(--violet); border-radius: 14px; padding: .7rem 1rem;
  display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; justify-content: space-between; }

/* Héros : le numéro du jour est l'élément mémorable */
.hero { text-align: center; padding: 1.5rem 0 1.2rem; }
.day-number { font-size: clamp(3.5rem, 12vw, 5rem); font-weight: 800; line-height: 1.05; letter-spacing: -.04em;
  background: linear-gradient(180deg, #fff 10%, var(--violet) 90%); -webkit-background-clip: text; background-clip: text; color: transparent; }

.cards { display: flex; flex-wrap: wrap; gap: .9rem; margin-top: .9rem; }
.cards .card { flex: 1 1 150px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.2rem; }
.card .k { color: var(--muted); font-size: .85rem; }
.card .v { font-size: 1.5rem; font-weight: 650; margin-top: .25rem; }
.card.special { flex-basis: 100%; border-color: var(--violet); background: linear-gradient(135deg, #2a1d57, var(--surface)); }
.card.special p { margin: .3rem 0 0; color: var(--lilac); }

.panel { margin-top: 2.2rem; }
.history { list-style: none; padding: 0; margin: .9rem 0 0; display: grid; gap: .5rem; }
.history button { width: 100%; display: flex; gap: .8rem; align-items: center; text-align: left; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: .7rem 1rem; }
.history button:hover, .history button[aria-current="true"] { border-color: var(--violet); }
.history b { min-width: 2.2rem; color: var(--lilac); } .history span:last-child { margin-left: auto; color: var(--muted); font-size: .85rem; }
.stats { display: grid; gap: .5rem; }
.bar { display: grid; grid-template-columns: 8.5rem 1fr 2rem; gap: .7rem; align-items: center; font-size: .9rem; }
.bar div { height: 8px; background: var(--surface-2); border-radius: 8px; overflow: hidden; }
.bar div i { display: block; height: 100%; background: linear-gradient(90deg, #6d41f0, var(--lilac)); border-radius: 8px; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

.card .note { color: var(--muted); font-size: .85rem; margin-top: .35rem; }
.card.special img { display: block; width: 100%; max-height: 220px; object-fit: cover; border-radius: 12px; margin-top: .9rem; }

/* Carte à retourner */
.cover { display: grid; place-items: center; align-content: center; gap: .4rem; width: 100%; min-height: 280px; cursor: pointer;
  border: 1px solid var(--violet); border-radius: 26px; color: var(--text); font-size: 1rem;
  background: radial-gradient(circle at 30% 20%, #5b34c9, #241552 60%, #150f2e); box-shadow: 0 20px 60px #4c1d9540; transition: transform .2s; }
.cover:hover { transform: translateY(-3px); }
.cover .q { font-size: 6rem; font-weight: 800; line-height: 1; opacity: .9; }
.cover.flip { animation: flipOut .28s ease-in forwards; }
@keyframes flipOut { to { transform: perspective(900px) rotateY(90deg); opacity: .5; } }
#reveal.in { animation: flipIn .4s ease-out both; }
@keyframes flipIn { from { transform: perspective(900px) rotateY(-90deg); opacity: .3; } to { transform: none; opacity: 1; } }

/* Défi principal */
.main-card { background: linear-gradient(160deg, var(--surface-2), var(--surface)); border: 1px solid var(--line); border-radius: 24px; padding: 1.6rem; }
.main-card .big { font-size: clamp(1.9rem, 7vw, 2.6rem); font-weight: 700; letter-spacing: -.02em; }
.main-card .desc { color: var(--muted); margin: .4rem 0 0; }
.main-card .sub { margin-top: 1.1rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.main-card .sub span { color: var(--muted); font-size: .85rem; display: block; }
.main-card .sub strong { font-size: 1.5rem; color: var(--lilac); }
.pill { background: var(--violet); color: #fff; border-radius: 99px; padding: .1rem .55rem; font-size: .72rem; margin-left: .5rem; }
.history .check { margin-left: .4rem; color: var(--ok); }
.done { display: flex; flex-wrap: wrap; align-items: center; gap: .9rem; margin-top: 1.2rem; }
.done .primary { padding: .7rem 1.2rem; }
.done .primary.on { background: var(--surface-2); border: 1px solid var(--ok); color: var(--ok); }
