:root {
  color-scheme: dark light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
body { background: #0b111a; margin: 0; min-width: 320px; }
button { color: inherit; font: inherit; }
button:focus-visible, a:focus-visible { outline: 3px solid #f3ad5e; outline-offset: 3px; }
[hidden] { display: none !important; }

.app {
  --page: #101923;
  --surface: #1a2733;
  --surface-raised: #223240;
  --ink: #f3f7fb;
  --muted: #adbac8;
  --line: #344656;
  --blue: #57b9e7;
  --blue-ink: #082638;
  --blue-soft: #1d3e50;
  --orange: #f3b16f;
  --orange-soft: #483321;
  --green: #69c7a2;
  --green-soft: #1d4037;
  background: var(--page);
  color: var(--ink);
  min-height: 100vh;
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
  transition: background-color 160ms ease, color 160ms ease;
}
.app[data-theme="light"] {
  --page: #f4f7fa;
  --surface: #ffffff;
  --surface-raised: #edf2f6;
  --ink: #142433;
  --muted: #65788a;
  --line: #e0e7ed;
  --blue: #08618c;
  --blue-ink: #ffffff;
  --blue-soft: #e2f1f8;
  --orange: #9b510e;
  --orange-soft: #fff0df;
  --green: #137953;
  --green-soft: #e3f4ed;
}

.app-header {
  align-items: center;
  display: flex;
  height: 66px;
  justify-content: space-between;
  margin: 0 auto;
  max-width: 780px;
  padding: 0 20px;
}
.brand { align-items: flex-start; color: var(--blue); display: flex; flex-direction: column; font-size: 30px; font-weight: 820; gap: 3px; letter-spacing: -1px; line-height: 1; text-decoration: none; }
.brand-row { align-items: center; display: flex; gap: 8px; }
.brand-balls { display: inline-flex; gap: 6px; }
.ball { --ball: #d32f2f; align-items: center; background: radial-gradient(circle at 34% 26%, rgba(255,255,255,.9) 0 6%, transparent 26%), radial-gradient(circle at 40% 35%, var(--ball), color-mix(in srgb, var(--ball) 45%, #000) 100%); border-radius: 50%; box-shadow: 0 4px 7px rgba(0,0,0,.55), inset 0 -3px 5px rgba(0,0,0,.35); display: inline-flex; height: 38px; justify-content: center; width: 38px; }
.ball b { align-items: center; background: radial-gradient(circle at 40% 30%, #fff, #e3e8ee); border-radius: 50%; box-shadow: inset 0 -1px 2px rgba(0,0,0,.2); color: #16212e; display: flex; font-size: 17px; font-style: normal; font-weight: 900; height: 24px; justify-content: center; letter-spacing: 0; width: 24px; }
.ball-red { --ball: #e0302f; }
.ball-blue { --ball: #1f78e0; }
.ball-green { --ball: #26a65b; }
.brand-version { color: var(--muted); font-size: 10px; font-weight: 650; letter-spacing: .35px; line-height: 1; }
.theme-switch {
  align-items: center;
  appearance: none;
  background: var(--surface-raised);
  border: 0;
  border-radius: 999px;
  display: inline-flex;
  flex: 0 0 auto;
  height: 44px;
  justify-content: space-between;
  padding: 9px 3px;
  position: relative;
  width: 60px;
}
.theme-switch .switch-sun, .theme-switch .switch-moon {
  align-items: center;
  color: var(--blue);
  display: inline-flex;
  font-size: 15px;
  height: 26px;
  justify-content: center;
  position: relative;
  width: 26px;
  z-index: 3;
}
.theme-switch .switch-thumb {
  align-items: center;
  background: var(--blue);
  border-radius: 50%;
  height: 26px;
  left: 3px;
  position: absolute;
  top: 9px;
  transition: transform 160ms ease;
  width: 26px;
  z-index: 2;
}
.theme-switch[aria-checked="true"] { background: var(--blue-soft); }
.theme-switch[aria-checked="true"] .switch-thumb { transform: translateX(28px); }
.theme-switch[aria-checked="true"] .switch-moon { color: var(--blue-ink); }
.theme-switch[aria-checked="false"] .switch-sun { color: var(--blue-ink); }

.demo-banner {
  align-items: center;
  background: var(--surface-raised);
  color: var(--muted);
  display: flex;
  font-size: 12px;
  gap: 8px;
  justify-content: center;
  margin: 0 auto;
  max-width: 740px;
  padding: 9px 14px;
}
.demo-dot { background: var(--orange); border-radius: 50%; flex: 0 0 7px; height: 7px; }
.demo-auth-link { background: transparent; border: 0; color: var(--blue); cursor: pointer; font: inherit; font-size: 11px; font-weight: 750; margin-left: 8px; min-height: 44px; padding: 2px 0; white-space: nowrap; }
.app-main { margin: 0 auto; max-width: 740px; padding: calc(25px + 2rem + env(safe-area-inset-top)) 20px 34px; }
.screen { animation: enter 160ms ease-out; }
.auth-screen { max-width: 470px; margin: 0 auto; }
.auth-heading { margin: 18px 0 21px; }
.auth-form { padding: 20px; }
.auth-form > .button { margin-top: 12px; }
.auth-actions { background: var(--surface); bottom: 0; margin: 22px -17px 0; padding: 14px 17px 6px; position: sticky; z-index: 2; }
.auth-actions .button { margin-top: 0; }
.form-label { color: var(--muted); display: block; font-size: 12px; font-weight: 650; margin: 13px 0 7px; }
.form-control { background: var(--surface-raised); border: 1px solid var(--line); border-radius: 12px; color: var(--ink); font: inherit; font-size: 14px; min-height: 46px; padding: 0 13px; width: 100%; }
.form-control::placeholder { color: var(--muted); opacity: .8; }
.password-input { position: relative; }
.password-input .form-control { padding-right: 54px; }
.password-toggle { align-items: center; appearance: none; background: transparent; border: 0; border-radius: 10px; color: var(--muted); cursor: pointer; display: inline-flex; height: 44px; justify-content: center; min-height: 44px; min-width: 44px; padding: 0; position: absolute; right: 2px; top: 50%; transform: translateY(-50%); width: 44px; }
.password-toggle svg { fill: none; height: 21px; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; width: 21px; }
.password-toggle:focus-visible { outline: 2px solid var(--blue); outline-offset: -3px; }
.form-control:focus-visible { border-color: var(--blue); outline: 3px solid color-mix(in srgb, var(--blue) 28%, transparent); outline-offset: 1px; }
.auth-text-link { background: transparent; border: 0; color: var(--blue); cursor: pointer; font: inherit; font-size: 12px; font-weight: 700; min-height: 44px; }
.forgot-link { display: block; margin: 3px 0 10px auto; min-height: 44px; }
.auth-divider { align-items: center; color: var(--muted); display: flex; font-size: 11px; gap: 12px; margin: 12px 0; }
.auth-divider::before, .auth-divider::after { background: var(--line); content: ""; height: 1px; flex: 1; }
.auth-demo-return { background: transparent; border: 0; color: var(--muted); cursor: pointer; display: block; font: inherit; font-size: 12px; margin: 15px auto; min-height: 44px; }
@keyframes enter { from { opacity: .7; transform: translateY(3px); } to { opacity: 1; transform: translateY(0); } }
.group-heading { margin: 0 0 20px; }
.eyebrow { color: var(--blue); font-size: 11px; font-weight: 750; letter-spacing: .09em; margin: 0 0 5px; }
h1 { font-size: clamp(24px, 6vw, 32px); letter-spacing: -.8px; line-height: 1.12; margin: 0; }
h2 { font-size: 17px; letter-spacing: -.25px; margin: 0; }
.muted, .summary-label, .helper-text { color: var(--muted); }
.muted { font-size: 13px; line-height: 1.45; margin: 6px 0 0; }
.summary-panel, .detail-panel {
  background: var(--surface);
  border-radius: 20px;
  margin-bottom: 18px;
  padding: 17px;
}
.summary-top { align-items: center; display: flex; justify-content: space-between; gap: 12px; }
.summary-label { display: block; font-size: 12px; margin: 0 0 4px; }
.summary-amount { font-size: 29px; font-variant-numeric: tabular-nums; font-weight: 790; letter-spacing: -1px; line-height: 1; margin: 0; }
.summary-side { text-align: right; }
.summary-side strong { font-size: 13px; }
.progress-track { background: var(--line); border-radius: 999px; height: 7px; margin: 14px 0 10px; overflow: hidden; }
.progress-track > span { background: var(--blue); border-radius: inherit; display: block; height: 100%; transition: width 160ms ease; }
.summary-bottom { align-items: center; display: flex; font-size: 13px; justify-content: space-between; }
.summary-bottom strong { font-variant-numeric: tabular-nums; }
.deadline { color: var(--orange); font-size: 12px; font-weight: 650; margin: 11px 0 0; }
.section-heading { align-items: baseline; display: flex; justify-content: space-between; margin: 23px 2px 9px; }
.member-list { background: var(--surface); border-radius: 18px; overflow: hidden; }
.member-row { align-items: center; border-bottom: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; min-height: 62px; padding: 9px 13px; }
.member-row > code { background: var(--surface-raised); border-radius: 8px; font-size: 12px; padding: 7px 9px; }
.wero-pay { border: 1.5px solid #ffd23f; }
.wero-phone { font-size: 24px; font-weight: 800; letter-spacing: 1px; margin: 4px 0 10px; }
.wero-copy { display: flex; gap: 8px; margin-bottom: 10px; }
.wero-copy .button { flex: 1; }
.declared-alert { border: 1.5px solid var(--orange); }
.declared-row { align-items: center; display: flex; gap: 10px; justify-content: space-between; padding: 6px 0; }
.play-days { display: flex; gap: 8px; }
.play-day { background: var(--surface-raised); border: 1.5px solid var(--line); border-radius: 12px; color: var(--ink); cursor: pointer; flex: 1; font: inherit; font-size: 13px; font-weight: 700; padding: 10px 0; }
.play-day[aria-pressed="true"] { border-color: var(--blue); color: var(--blue); }
.member-row:last-child { border-bottom: 0; }
.person { align-items: center; display: flex; gap: 10px; min-width: 0; }
.avatar { align-items: center; background: var(--blue-soft); border-radius: 50%; color: var(--blue); display: inline-flex; flex: 0 0 36px; font-size: 13px; font-weight: 760; height: 36px; justify-content: center; }
.avatar.is-pending { background: var(--orange-soft); color: var(--orange); }
.person-copy { min-width: 0; }
.person-name { font-size: 13px; font-weight: 680; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person-detail { color: var(--muted); font-size: 11px; margin-top: 3px; }
.member-trailing { align-items: flex-end; display: flex; flex-direction: column; gap: 3px; white-space: nowrap; }
.member-amount { font-size: 12px; font-variant-numeric: tabular-nums; font-weight: 700; }
.status { font-size: 11px; font-weight: 680; }
.status.is-paid { color: var(--green); }
.status.is-waiting { color: var(--orange); }
.status-badge { border-radius: 999px; padding: 4px 10px; }
.status-badge.is-paid { background: var(--green-soft); }
.status-badge.is-waiting { background: var(--orange-soft); }
.status-badge.is-none { background: var(--surface-raised); color: var(--muted); }
.home-actions { margin-top: 14px; }
.button { align-items: center; border: 0; border-radius: 999px; cursor: pointer; display: inline-flex; font-size: 13px; font-weight: 700; justify-content: center; min-height: 44px; padding: 0 16px; }
.button-primary { background: var(--blue); color: var(--blue-ink); }
.button-secondary { background: var(--surface-raised); color: var(--ink); }
.full-button { width: 100%; }
.helper-text { font-size: 12px; line-height: 1.5; margin: 10px 2px 0; }
.segmented-control { background: var(--surface-raised); border-radius: 999px; display: flex; gap: 3px; margin: 0 0 14px; padding: 3px; }
.segment { background: transparent; border: 0; border-radius: 999px; color: var(--muted); flex: 1; font-size: 13px; min-height: 40px; }
.segment span { font-size: 11px; margin-left: 4px; }
.segment.is-selected { background: var(--blue); color: var(--blue-ink); font-weight: 700; }
.member-list-large { margin-bottom: 14px; }
.status-pill { border-radius: 999px; display: inline-flex; font-size: 11px; font-weight: 700; padding: 6px 9px; white-space: nowrap; }
.status-ok { background: var(--green-soft); color: var(--green); }
.status-wait { background: var(--orange-soft); color: var(--orange); }
.stake-panel { padding: 17px; }
.grid-stepper { align-items: center; display: flex; justify-content: space-between; margin: 14px 0; }
.step-button { background: var(--surface-raised); border: 0; border-radius: 50%; color: var(--ink); font-size: 24px; height: 48px; width: 48px; }
.grid-count { align-items: center; display: flex; flex-direction: column; }
.grid-count strong { font-size: 34px; font-variant-numeric: tabular-nums; }
.grid-count span { color: var(--muted); font-size: 12px; }
.price-line, .calculation-row { align-items: center; border-top: 1px solid var(--line); display: flex; font-size: 13px; justify-content: space-between; padding: 11px 0 0; }
.price-line strong, .calculation-row strong { font-variant-numeric: tabular-nums; }
.detail-panel h2 { margin-bottom: 13px; }
.share-value { font-size: 32px; font-weight: 780; letter-spacing: -.8px; }
.sticky-action { align-items: center; background: var(--surface); border-top: 1px solid var(--line); bottom: calc(67px + env(safe-area-inset-bottom)); display: flex; justify-content: space-between; margin: 22px -20px -34px; padding: 12px 20px; position: sticky; }
.sticky-action > div { display: flex; flex-direction: column; gap: 3px; }
.sticky-action strong { font-size: 19px; font-variant-numeric: tabular-nums; }
.stake-buttons { align-items: center; display: flex; gap: 7px; }
.stake-buttons .button { min-height: 40px; padding: 0 12px; }
.upload-placeholder { align-items: center; background: var(--surface-raised); border-radius: 14px; display: flex; gap: 11px; padding: 13px; }
.upload-placeholder strong { font-size: 13px; }
.upload-placeholder .muted { font-size: 11px; }
.upload-icon { align-items: center; background: var(--blue-soft); border-radius: 50%; color: var(--blue); display: inline-flex; flex: 0 0 38px; font-size: 20px; height: 38px; justify-content: center; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { border-left: 1px solid var(--line); margin-left: 5px; padding: 0 0 17px 15px; position: relative; }
.timeline li:last-child { border-color: transparent; padding-bottom: 0; }
.timeline li::before { background: var(--blue); border: 3px solid var(--surface); border-radius: 50%; content: ""; height: 9px; left: -6px; position: absolute; top: 0; width: 9px; }
.timeline strong { display: block; font-size: 13px; }
.timeline span { color: var(--muted); display: block; font-size: 11px; margin-top: 3px; }
.timeline-full li { padding-bottom: 21px; }
.calculation-row { padding: 10px 0; }
.calculation-row:first-of-type { border-top: 0; }
.explain-dialog { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; color: var(--ink); margin: auto; max-width: 420px; padding: 0; width: calc(100% - 32px); }
.explain-dialog::backdrop { background: #07111bb8; }
.dialog-content { padding: 20px; }
.dialog-content p { font-size: 14px; line-height: 1.55; }
.dialog-top { align-items: center; display: flex; justify-content: space-between; }
.icon-button { background: var(--surface-raised); border: 0; border-radius: 50%; font-size: 22px; height: 44px; min-width: 44px; width: 44px; }
.bottom-nav { background: var(--page); border-top: 1px solid var(--line); bottom: 0; display: flex; justify-content: space-around; left: 0; padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); position: fixed; right: 0; z-index: 5; }
.nav-item { align-items: center; background: transparent; border: 0; border-radius: 12px; color: var(--muted); display: flex; flex: 1; flex-direction: column; font-size: 9px; gap: 2px; justify-content: center; min-height: 48px; min-width: 46px; padding: 3px 2px; }
.nav-item > span:first-child { font-size: 17px; line-height: 1; }
.nav-item.is-active { color: var(--blue); font-weight: 750; }
.toast { background: var(--ink); border-radius: 14px; bottom: calc(80px + env(safe-area-inset-bottom)); color: var(--page); font-size: 13px; left: 50%; max-height: 30vh; max-width: 420px; overflow: auto; padding: 12px 16px; position: fixed; transform: translateX(-50%); white-space: pre-line; width: calc(100% - 32px); z-index: 10; }
.toast.toast-auth-flow { bottom: calc(44px + env(safe-area-inset-bottom)); }

@media (min-width: 700px) {
  .app { padding-bottom: 26px; }
  .app-header { height: 76px; }
  .demo-banner { border-radius: 999px; margin-bottom: 8px; }
  .app-main { padding-top: calc(28px + 2rem); }
  .bottom-nav { border: 1px solid var(--line); border-radius: 999px; bottom: 18px; left: 50%; max-width: 610px; padding: 5px 8px; right: auto; transform: translateX(-50%); width: calc(100% - 36px); }
  .nav-item { min-height: 45px; }
}
@media (max-width: 380px) {
  .app-header { padding: 0 15px; }
  .app-main { padding-left: 14px; padding-right: 14px; }
  .member-row { gap: 6px; padding-left: 9px; padding-right: 9px; }
  .nav-item { font-size: 8px; min-width: 42px; }
  .sticky-action { margin-left: -14px; margin-right: -14px; padding-left: 14px; padding-right: 14px; }
  .demo-banner { flex-wrap: wrap; text-align: center; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; scroll-behavior: auto !important; transition-duration: .01ms !important; }
}

.ticket-preview { display: block; width: 100%; max-height: 60vh; object-fit: contain; border-radius: 12px; background: #0b1420; margin-top: 8px; }
.ticket-preview.is-zoom { max-height: none; }
#ticket-current a { color: var(--accent, #56b8e8); }

.balls { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 6px 0; }
.nball { width: 38px; height: 38px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 15px; color: #fff; background: radial-gradient(circle at 32% 28%, #8fd8ff, #1b78b8 55%, #0d4a78); box-shadow: 0 3px 6px #0008; }
.nball-chance { background: radial-gradient(circle at 32% 28%, #ff9a9a, #d6293a 55%, #8a1020); }
.nball-hit, .nball-chance.nball-hit { background: radial-gradient(circle at 32% 28%, #a8f0c0, #22a050 55%, #106a30); outline: 3px solid #5fd08a55; }
.nball-miss { opacity: .4; }
.ball-label { font-size: 11px; color: var(--muted, #9fb0c6); }
.grid-card { background: rgba(255,255,255,.04); border-radius: 14px; padding: 10px 12px; margin-bottom: 8px; }
.grid-card .grid-result { font-size: 12px; font-weight: 800; color: #5fd08a; margin-left: 6px; }
.num-row { display: flex; gap: 5px; align-items: center; margin-bottom: 8px; }
.num-row input { width: 100%; min-width: 0; padding: 8px 2px; text-align: center; font-size: 15px; }
.num-row input.num-chance { border-color: #d6293a; }

/* Comme une vraie appli : pas de balade latérale, pas de rebond, pas de zoom (Safari iPhone). */
html, body { max-width: 100%; overflow-x: clip; overscroll-behavior-x: none; -webkit-text-size-adjust: 100%; touch-action: pan-y; }
body { min-width: 0; -webkit-touch-callout: none; }
.app { max-width: 100vw; overflow-x: clip; }
input, select, textarea { font-size: 16px; }
button, a, label { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }

.bio-overlay { align-items: center; background: rgba(0, 0, 0, .6); display: flex; inset: 0; justify-content: center; padding: 24px; position: fixed; z-index: 9999; }
.bio-overlay[hidden] { display: none; }
.bio-card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; max-width: 360px; padding: 24px 20px 16px; text-align: center; width: 100%; }
.bio-card h2 { margin: 0 0 10px; }
.bio-card p { margin: 0 0 18px; }

html, body, * { scrollbar-width: none; }
*::-webkit-scrollbar { display: none; }
