/* Tombola MM — interface douce type application mobile :
   fond gris chaud, cartes blanches très arrondies, panneaux jaune soleil, boutons noirs en pilule. */
@font-face { font-family: "Plus Jakarta Sans"; font-weight: 400; font-display: swap; src: url(/fonts/plus-jakarta-sans-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "Plus Jakarta Sans"; font-weight: 500; font-display: swap; src: url(/fonts/plus-jakarta-sans-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "Plus Jakarta Sans"; font-weight: 600; font-display: swap; src: url(/fonts/plus-jakarta-sans-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "Plus Jakarta Sans"; font-weight: 700; font-display: swap; src: url(/fonts/plus-jakarta-sans-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: "Plus Jakarta Sans"; font-weight: 800; font-display: swap; src: url(/fonts/plus-jakarta-sans-latin-800-normal.woff2) format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-weight: 400; font-display: swap; src: url(/fonts/jetbrains-mono-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-weight: 700; font-display: swap; src: url(/fonts/jetbrains-mono-latin-700-normal.woff2) format("woff2"); }

:root {
  --bg: #eceae4; --surface: #ffffff; --ink: #141414; --muted: #63605a; --line: #e4e1d9;
  --sun: #f7c948; --sun-soft: #fbe08f; --sun-pale: #fdf1c9; --sun-deep: #8a5a00;
  --success: #1f9d55; --success-bg: #dff5e7; --success-ink: #116237;
  --danger: #d92d20; --danger-bg: #fde7e4; --danger-ink: #a11b12;
  --r-xl: 28px; --r-lg: 20px; --r-md: 14px; --r-pill: 999px;
  --shadow: 0 1px 2px rgba(20, 20, 20, .04), 0 8px 24px rgba(20, 20, 20, .06);
  --shadow-float: 0 10px 30px rgba(20, 20, 20, .28);
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  --ease: cubic-bezier(.2, .8, .2, 1);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 400 16px/1.55 var(--font); color: var(--ink); background: var(--bg); }
main { max-width: 1040px; margin: 0 auto; padding: 8px 16px 24px; }
a { color: var(--ink); text-underline-offset: 3px; text-decoration-thickness: 1.5px; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; border-radius: 6px; }
h1, h2, h3 { line-height: 1.15; font-weight: 800; letter-spacing: -.02em; margin: 0; }
h1 { font-size: clamp(26px, 5.5vw, 40px); margin-bottom: 12px; }
h2 { font-size: 20px; margin-bottom: 12px; }
h3 { font-size: 17px; }
p { margin: 0 0 12px; }
.icon { width: 22px; height: 22px; flex: none; }
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--ink); color: #fff; padding: 10px 16px; border-radius: var(--r-pill); z-index: 100; }
.skip-link:focus { left: 8px; }

/* En-tête */
.topbar { max-width: 1040px; margin: 0 auto; display: flex; gap: 16px; justify-content: space-between; align-items: center; padding: 16px; }
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; font-weight: 800; font-size: 18px; letter-spacing: -.01em; }
.brand-mark { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--ink); color: var(--sun); }
.brand-text { display: grid; line-height: 1.15; }
.brand-text small { font-size: 12px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.topnav { display: none; gap: 4px; align-items: center; background: var(--surface); padding: 6px; border-radius: var(--r-pill); box-shadow: var(--shadow); }
.topnav a, .topnav button.link { display: inline-flex; align-items: center; min-height: 40px; padding: 0 16px; border-radius: var(--r-pill); text-decoration: none; font-weight: 600; font-size: 14px; color: var(--ink); transition: background .15s var(--ease); }
.topnav a:hover, .topnav button.link:hover { background: var(--sun-pale); }
.topnav a[aria-current="page"] { background: var(--ink); color: #fff; }
.banner { max-width: 1008px; margin: 0 auto 12px; background: var(--ink); color: #fff; text-align: center; padding: 8px 16px; font-size: 13px; font-weight: 600; border-radius: var(--r-pill); width: calc(100% - 32px); }

/* Barre de navigation flottante (mobile) */
.tabbar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(14px + env(safe-area-inset-bottom)); z-index: 30;
  display: flex; gap: 4px; padding: 6px; background: var(--ink); border-radius: var(--r-pill); box-shadow: var(--shadow-float);
}
.tabbar a { display: flex; align-items: center; justify-content: center; gap: 8px; min-width: 48px; height: 48px; padding: 0 12px; border-radius: var(--r-pill); color: #cfcabd; text-decoration: none; font-size: 13px; font-weight: 700; transition: background .2s var(--ease), color .2s var(--ease); }
.tabbar a span { display: none; }
.tabbar a[aria-current="page"] { background: var(--sun); color: var(--ink); padding: 0 16px; }
.tabbar a[aria-current="page"] span { display: inline; }
.tabbar a:focus-visible { outline-color: #fff; }
body { padding-bottom: calc(92px + env(safe-area-inset-bottom)); }

/* Cartes et panneaux */
.card { background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--shadow); padding: 24px 20px; margin-bottom: 16px; }
.card.narrow { max-width: 440px; margin: 32px auto; }
.card-quiet { background: transparent; box-shadow: none; border: 1.5px dashed #cfcabd; color: var(--muted); }
.card-quiet h3 { color: var(--ink); margin-bottom: 8px; }
.panel { background: var(--sun); border-radius: var(--r-xl); padding: 20px; margin-bottom: 16px; }
.panel .muted { color: #5a4300; }
.panel-head, .section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin: 4px 0 12px; }
.panel-head h2, .section-head h2 { margin: 0; font-size: 18px; }
.panel-head:not(:first-child) { margin-top: 20px; }
.section-head { margin: 24px 4px 12px; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }

/* Accueil */
.hero { position: relative; background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--shadow); padding: 44px 20px 24px; margin-top: 26px; text-align: center; }
.hero-badge { position: absolute; top: -24px; left: 50%; transform: translateX(-50%); display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; background: var(--ink); color: var(--sun); box-shadow: 0 0 0 6px var(--bg); }
.hero-title { font-size: clamp(28px, 7vw, 46px); max-width: 16ch; margin: 0 auto 12px; }
.hero-lead { color: var(--muted); max-width: 44ch; margin: 0 auto 20px; }
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.steps li { display: flex; align-items: center; gap: 8px; background: var(--sun-pale); border-radius: var(--r-pill); padding: 6px 16px 6px 6px; font-weight: 600; font-size: 14px; }
.steps span { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--ink); color: var(--sun); font-weight: 800; font-size: 13px; }

.raffle-card { display: flex; flex-direction: column; gap: 14px; margin: 0; transition: transform .2s var(--ease); }
.raffle-card:hover { transform: translateY(-3px); }
.raffle-card h3 a { text-decoration: none; }
.raffle-card .row { flex-wrap: nowrap; align-items: flex-start; }
.raffle-card .button { margin-top: auto; }
.scoreline, .split { display: grid; grid-template-columns: 1fr 1fr; }
.scoreline div, .split div { display: grid; gap: 2px; text-align: center; padding: 4px 8px; }
.scoreline div + div { border-left: 1.5px solid rgba(20, 20, 20, .18); }
.scoreline span, .split span { font-size: 12px; font-weight: 600; color: #5a4300; }
.scoreline strong { font-size: 24px; font-weight: 800; letter-spacing: -.02em; line-height: 1.2; }

/* Page tombola */
.summary { margin-top: 8px; }
.summary h1 { margin-top: 16px; }
.split { margin-top: 16px; padding-top: 16px; border-top: 1.5px solid var(--line); }
.split div + div { border-left: 1.5px solid var(--line); }
.split span { color: var(--muted); }
.split strong { font-size: clamp(22px, 6vw, 30px); font-weight: 800; letter-spacing: -.02em; line-height: 1.2; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.actions > :only-child { grid-column: 1 / -1; }

.countdown { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.countdown div { background: var(--sun-soft); border-radius: var(--r-md); padding: 10px 4px; text-align: center; display: grid; }
.countdown div:first-child { background: var(--ink); color: #fff; }
.countdown strong { font: 700 24px/1.2 var(--mono); }
.countdown span { font-size: 12px; font-weight: 600; }

.prizes { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.prize { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-radius: var(--r-md); padding: 12px 14px; background: var(--sun-soft); min-height: 48px; }
.prize-rank { flex: none; font-weight: 600; font-size: 13px; color: #5a4300; }
.prize-rank sup { font-size: .7em; }
.prize-name { font-weight: 700; text-align: right; }
.prize-1 { background: var(--ink); color: #fff; }
.prize-1 .prize-rank { color: var(--sun); }
.prize-1 .prize-name { font-size: 17px; }
.card .prize { background: var(--sun-pale); }
.card .prize-1 { background: var(--ink); }

/* Gagnants */
.winners { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.winner { border-radius: var(--r-lg); padding: 16px; background: var(--sun-pale); display: grid; gap: 6px; justify-items: start; animation: rise .5s var(--ease) both; }
.winner .prize-rank { background: var(--surface); border-radius: var(--r-pill); padding: 2px 12px; color: var(--ink); }
.winner-1 { background: var(--sun); }
.winner-2 { animation-delay: .1s; }
.winner-3 { animation-delay: .2s; }
.winner-prize { font-weight: 800; font-size: 18px; line-height: 1.25; }
.winner-uid { font-size: 18px; font-weight: 700; background: var(--ink); color: #fff; border-radius: 10px; padding: 6px 10px; white-space: nowrap; }
.winner-name { font-weight: 500; font-size: 14px; }

/* Formulaires et boutons */
.card-form h2 { font-size: 22px; margin-bottom: 16px; }
.form { display: grid; gap: 16px; max-width: 540px; }
.form label { display: grid; gap: 6px; font-weight: 600; font-size: 14px; }
.form label.check { display: flex; gap: 12px; align-items: flex-start; font-weight: 500; font-size: 15px; background: var(--bg); border-radius: var(--r-md); padding: 12px; cursor: pointer; }
input, textarea { font: 500 16px var(--font); color: var(--ink); padding: 14px 16px; border: 1.5px solid transparent; border-radius: var(--r-md); width: 100%; background: var(--bg); transition: border-color .15s var(--ease), background .15s var(--ease); }
input::placeholder, textarea::placeholder { color: #8a867d; }
input:hover, textarea:hover { border-color: #cfcabd; }
input:focus, textarea:focus { outline: none; border-color: var(--ink); background: #fff; }
input[type=checkbox] { width: 22px; height: 22px; flex: none; margin: 1px 0 0; accent-color: var(--ink); padding: 0; }
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 12px; min-height: 56px; padding: 6px 22px 6px 6px;
  background: var(--ink); color: #fff; border: 0; border-radius: var(--r-lg); font: 700 15px var(--font); cursor: pointer; text-decoration: none;
  transition: transform .12s var(--ease), box-shadow .2s var(--ease), background .15s var(--ease);
}
.button:not(:has(.button-icon)) { padding: 6px 22px; }
.button:hover { transform: translateY(-2px); box-shadow: 0 8px 18px rgba(20, 20, 20, .22); }
.button:active { transform: scale(.97); box-shadow: none; }
.button-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: var(--r-md); background: var(--sun); color: var(--ink); flex: none; }
.button.secondary { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.button.secondary .button-icon { background: var(--bg); }
.panel .button.secondary { box-shadow: none; }
.button.danger { background: var(--danger); }
.button.big { min-height: 64px; font-size: 17px; }
.button.block { display: flex; width: 100%; }
button.link { background: none; border: 0; color: var(--ink); cursor: pointer; font: inherit; font-weight: 600; padding: 0; text-decoration: underline; text-underline-offset: 3px; }
form.inline { display: inline; }
.inline-form { margin-bottom: 16px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.row.between { justify-content: space-between; }

/* Messages et pastilles */
.muted { color: var(--muted); }
.small { font-size: 14px; }
.pre { white-space: pre-line; }
.error, .success { padding: 14px 16px; border-radius: var(--r-md); font-weight: 600; }
.error { background: var(--danger-bg); color: var(--danger-ink); }
.success { background: var(--success-bg); color: var(--success-ink); }
.badge, .chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: var(--r-pill); font-size: 12px; font-weight: 700; white-space: nowrap; }
.badge { background: #e2dfd6; color: var(--ink); }
.chip { background: var(--bg); color: var(--muted); font-weight: 600; }
.status-open, .ticket-paid { background: var(--success); color: #fff; }
.status-open::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #fff; animation: pulse 1.6s ease-in-out infinite; }
.status-drawn { background: var(--ink); color: var(--sun); }
.status-closed, .ticket-pending { background: #e9a100; color: var(--ink); }
.ticket-failed, .ticket-late { background: var(--danger-bg); color: var(--danger-ink); }

/* Ticket (UID) */
.ticket { position: relative; display: flex; border-radius: var(--r-lg); overflow: hidden; margin: 20px 0; animation: rise .5s var(--ease) both; }
.ticket-main { flex: 1; min-width: 0; background: var(--sun); padding: 22px 12px; display: grid; gap: 6px; text-align: center; }
.ticket-label { font-size: 12px; font-weight: 700; color: #5a4300; }
.ticket-holder { font-weight: 600; font-size: 14px; }
.ticket-stub { flex: none; background: var(--ink); color: #fff; padding: 16px 12px; display: flex; flex-direction: column; justify-content: center; gap: 8px; text-align: center; font-weight: 700; font-size: 13px; border-left: 2px dashed var(--sun); writing-mode: vertical-rl; }
.ticket-stub span:last-child { color: var(--sun); }
.uid { font: 700 clamp(20px, 6.2vw, 44px)/1.15 var(--mono); letter-spacing: .02em; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.ticket-actions { max-width: none; margin-top: 16px; grid-template-columns: 1fr; }
@media (min-width: 620px) { .ticket-actions { grid-template-columns: 1fr 1fr; } }
.ticket-actions .button { justify-content: flex-start; }
.notice { padding: 14px 16px; border-radius: var(--r-md); font-weight: 600; background: var(--sun-pale); color: #4a3800; margin-bottom: 16px; }
.mono-input { font-family: var(--mono); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.mono-input::placeholder { font-weight: 400; }

/* Liste « mes tickets » */
.my-tickets { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 10px; }
.my-tickets li { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; background: var(--bg); border-radius: var(--r-lg); padding: 14px 16px; border-left: 6px solid var(--sun); }
.my-ticket-main { display: grid; gap: 2px; min-width: 0; }
.my-ticket-uid { font: 700 20px/1.2 var(--mono); letter-spacing: .02em; white-space: nowrap; }
.my-ticket-raffle { font-weight: 700; }
.my-ticket-side { display: grid; gap: 6px; justify-items: start; }
.my-ticket-side a { font-weight: 700; }
@media (min-width: 560px) { .my-ticket-side { justify-items: end; text-align: right; } }

/* Tableaux et back-office */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; padding: 8px 10px; font-size: 12px; font-weight: 700; color: var(--muted); border-bottom: 1.5px solid var(--line); white-space: nowrap; }
.table td { padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; font-size: 14px; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #faf9f6; }
.table td code { white-space: nowrap; }
.table a { font-weight: 700; }
.scroll { overflow-x: auto; }
.stats { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); margin: 16px 0; }
.stats div { background: var(--sun-pale); border-radius: var(--r-md); padding: 14px; display: grid; gap: 2px; }
.stats div:first-child { background: var(--ink); color: #fff; }
.stats div:nth-child(2) { background: var(--sun); }
.stats strong { white-space: nowrap; font-size: 22px; font-weight: 800; letter-spacing: -.02em; line-height: 1.2; }
.stats span { font-size: 12px; font-weight: 600; }
code { font-family: var(--mono); font-size: .9em; }
.hash, .wrap, .kv code { word-break: break-all; }
.hash { display: block; background: var(--bg); border-radius: 10px; padding: 10px 12px; color: var(--ink); }
.kv dt { font-weight: 700; margin-top: 14px; font-size: 13px; }
.kv dd { margin: 6px 0 0; }
.footer { text-align: center; color: var(--muted); font-size: 13px; padding: 8px 16px 16px; }
.card > h1 + p, .card h2 + p { margin-top: 4px; }
.card ol:not([class]), .card ul:not([class]) { padding-left: 20px; display: grid; gap: 8px; }
.card h2:not(:first-child) { margin-top: 24px; }

@keyframes pulse { 50% { opacity: .35; } }
@keyframes rise { from { transform: translateY(14px); opacity: 0; } }

@media (min-width: 860px) {
  .topnav { display: flex; }
  .tabbar { display: none; }
  body { padding-bottom: 0; }
  main { padding-top: 8px; }
  .card { padding: 28px; }
  .panel { padding: 24px; }
  .actions { max-width: 520px; }
  .footer { padding-bottom: 32px; }
}
@media (max-width: 859px) {
  /* Sur mobile, le back-office garde un accès direct à la déconnexion. */
  .is-admin .topnav { display: flex; }
  .is-admin .topnav a { display: none; }
  .is-admin .brand-text small { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}
