:root {
  --page: #e6eaf0;
  --ink: #161c2b;
  --muted: #566075;
  --paper: #ffffff;
  --line: #c7cfdc;
  --yes: #17795a;
  --no: #b93a3a;
  --signal: #f5a400;
  --focus: #2457f5;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 16px/1.45 "Avenir Next", "Segoe UI", Roboto, "Helvetica Neue", system-ui, sans-serif;
}

.top, main { max-width: 480px; margin: 0 auto; padding: 0 16px; }
.top { display: flex; align-items: center; justify-content: space-between; padding-top: 16px; padding-bottom: 8px; }
main { padding-bottom: 48px; }

.brand { margin: 0; font-size: 1.7rem; font-weight: 800; letter-spacing: -0.03em; }

.tabs { display: flex; gap: 4px; }
.tabs button {
  border: 0; background: none; color: var(--muted); font: inherit; font-weight: 600;
  padding: 8px 10px; border-bottom: 3px solid transparent; cursor: pointer;
}
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--signal); }

h2 { font-size: 1.1rem; margin: 28px 0 8px; }

.stack { display: grid; gap: 8px; }
label { font-weight: 600; font-size: 0.95rem; }
input, select {
  width: 100%; min-height: 44px; padding: 8px 10px; font: inherit; color: var(--ink);
  background: var(--paper); border: 1px solid var(--line); border-radius: 8px;
}
.trio { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.trio label { display: block; margin-bottom: 4px; font-size: 0.85rem; }

button { font: inherit; cursor: pointer; }
.primary, .ghost {
  min-height: 48px; border-radius: 8px; font-weight: 700; padding: 0 16px;
}
.primary { background: var(--ink); color: #fff; border: 0; margin-top: 8px; }
.ghost { background: transparent; color: var(--ink); border: 1px solid var(--ink); }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.balance { margin: 12px 0 4px; color: var(--muted); }
.balance strong { color: var(--ink); }
.wait, .msg { color: var(--muted); }
.msg { min-height: 1.4em; margin: 0; }

/* Le billet : la mission arrive comme un ticket que l'on déchire en deux parties */
.ticket {
  margin-top: 12px; background: var(--paper); border: 1px solid var(--line);
  border-radius: 14px; overflow: hidden;
}
.ticket img { display: block; width: 100%; max-height: 56vh; object-fit: contain; background: var(--paper); }
.stub { position: relative; padding: 20px 16px 16px; border-top: 2px dashed var(--line); }
.stub::before, .stub::after {
  content: ""; position: absolute; top: -12px; width: 22px; height: 22px;
  background: var(--page); border: 1px solid var(--line); border-radius: 50%;
}
.stub::before { left: -12px; }
.stub::after { right: -12px; }

.meter { height: 6px; background: #e3e7ee; border-radius: 3px; overflow: hidden; }
.meter span { display: block; height: 100%; width: 100%; background: var(--signal); transition: width 0.2s linear; }
.figures { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 8px 0 12px; color: var(--muted); font-size: 0.9rem; }
.figures strong { color: var(--ink); font-variant-numeric: tabular-nums; }

.question { margin: 0 0 16px; font-size: 1.3rem; font-weight: 650; line-height: 1.3; }
.answers { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.answers button {
  min-height: 60px; border: 0; border-radius: 10px; color: #fff; font-size: 1.15rem; font-weight: 700;
}
.yes { background: var(--yes); }
.no { background: var(--no); }
.answers button:disabled { opacity: 0.4; cursor: default; }
.result { min-height: 1.5em; margin: 12px 0 0; font-weight: 600; }

.facts { display: grid; grid-template-columns: auto 1fr; gap: 4px 16px; margin: 8px 0 16px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-variant-numeric: tabular-nums; }

table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { text-align: left; padding: 6px 4px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; }

@media (prefers-reduced-motion: reduce) {
  .meter span { transition: none; }
}
