:root {
  --host: #7b2cbf;
  --partner: #e2001a;
  --bg: #14002b;
  --card: rgba(255, 255, 255, 0.08);
  --text: #ffffff;
  --muted: rgba(255, 255, 255, 0.65);
  --ok: #2ecc71;
  --ko: #ff5c5c;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: radial-gradient(circle at 20% 0%, color-mix(in srgb, var(--host) 55%, transparent), transparent 60%),
    radial-gradient(circle at 100% 100%, color-mix(in srgb, var(--partner) 35%, transparent), transparent 55%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

main {
  max-width: 480px;
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-size: 1.7rem; }
h2 { font-size: 1.35rem; }
p { margin: 0; }
.muted { color: var(--muted); }
.center { text-align: center; }
.grow { flex: 1; }

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.brand .x { color: var(--muted); }
.brand .partner { color: var(--partner); background: #fff; border-radius: 6px; padding: 1px 6px; }

.card {
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  padding: 18px;
}

label { display: block; font-size: 0.9rem; margin-bottom: 6px; color: var(--muted); }
input[type="text"], input[type="password"] {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  padding: 12px 14px;
}
.consent { display: flex; gap: 10px; align-items: flex-start; font-size: 0.85rem; color: var(--muted); }
.consent input { margin-top: 3px; width: 18px; height: 18px; }

button, .btn {
  font: inherit;
  font-weight: 650;
  border: 0;
  border-radius: 14px;
  padding: 14px 18px;
  background: var(--host);
  color: #fff;
  cursor: pointer;
  width: 100%;
}
button:disabled { opacity: 0.45; cursor: default; }
button.secondary { background: rgba(255, 255, 255, 0.12); }
button.danger { background: var(--partner); }

.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }

/* Attente / parcours */
.route { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.route li { display: flex; align-items: center; gap: 12px; }
.route .dot {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid var(--muted); flex: none;
}
.route li.done .dot { background: var(--ok); border-color: var(--ok); }
.route li.live .dot { background: var(--partner); border-color: var(--partner); animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 8px color-mix(in srgb, var(--partner) 25%, transparent); } }

.bus-anim { font-size: 3.2rem; text-align: center; animation: drive 2.4s ease-in-out infinite; }
@keyframes drive { 50% { transform: translateX(14px); } }

.board { list-style: none; margin: 0; padding: 0; counter-reset: rank; }
.board li {
  counter-increment: rank;
  display: flex; justify-content: space-between; gap: 10px;
  padding: 8px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.board li::before { content: counter(rank); width: 1.6em; color: var(--muted); }
.board li .who { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board li.me { color: #ffd166; font-weight: 700; }

/* Story */
.story {
  position: fixed; inset: 0; z-index: 10;
  background: linear-gradient(160deg, var(--host), var(--bg) 70%);
  display: flex; flex-direction: column;
  padding: max(14px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
  user-select: none;
}
.bars { display: flex; gap: 4px; }
.bars span { flex: 1; height: 3px; border-radius: 2px; background: rgba(255, 255, 255, 0.3); overflow: hidden; }
.bars span i { display: block; height: 100%; width: 0; background: #fff; }
.bars span.seen i { width: 100%; }
.bars span.now i { animation: fill var(--dur, 6s) linear forwards; }
@keyframes fill { to { width: 100%; } }
.story .slide { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 16px; max-width: 480px; margin: 0 auto; }
.story .emoji { font-size: 4.5rem; }
.story h2 { font-size: 1.8rem; }
.story p { font-size: 1.15rem; }
.story .hint { text-align: center; font-size: 0.8rem; color: var(--muted); }

/* Quiz */
.timer { height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.15); overflow: hidden; }
.timer i { display: block; height: 100%; background: #ffd166; width: 100%; transition: width 0.1s linear; }
.choices { display: grid; gap: 10px; }
.choices button { text-align: left; background: rgba(255, 255, 255, 0.1); border: 2px solid transparent; }
.choices button.picked { border-color: #fff; }
.choices button.good { background: var(--ok); }
.choices button.bad { background: var(--ko); }

.score-big { font-size: 3rem; font-weight: 800; text-align: center; }

.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%);
  background: #000c; padding: 10px 16px; border-radius: 999px; font-size: 0.85rem;
}

/* Console animateur */
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 0.8rem; background: rgba(255,255,255,0.12); }
.pill.on { background: var(--ok); color: #000; }
.steps-admin { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.steps-admin li { display: flex; align-items: center; gap: 10px; }
.steps-admin li .name { flex: 1; }
.steps-admin li button { width: auto; padding: 8px 12px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 0.9rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.choices button:disabled { opacity: 0.5; }
.choices button.good, .choices button.bad, .choices button.picked { opacity: 1; }
select, textarea, input[type="number"], input[type="date"], input[type="color"] {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  padding: 12px 14px;
}
select option { color: #000; }
textarea { min-height: 70px; resize: vertical; }
input[type="color"] { padding: 4px; height: 46px; }
