:root {
  --navy: #1B2A4A;
  --orange: #F2A65A;
  --clay: #B94A0E;
  --clay-dark: #8A3409;
  --cream: #FFF7EC;
  --peach: #FCE3CC;
  --line: #EADFCF;
  --muted: #5B6478;
  --soft: #C9D1E3;
  --green: #2F6B47;
  --green-soft: #DCEBDD;
  --white: #FFFFFF;
  --radius: 18px;
  --display: "Bricolage Grotesque", "Trebuchet MS", system-ui, sans-serif;
  --body: "Nunito Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--cream);
  color: var(--navy);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.4;
  -webkit-tap-highlight-color: transparent;
}
#app { max-width: 480px; min-height: 100%; margin: 0 auto; display: flex; flex-direction: column; background: var(--cream); }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--clay); }
:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Typography */
h1, h2, h3 { font-family: var(--display); font-weight: 800; margin: 0; line-height: 1.1; }
h1 { font-size: 28px; }
h2 { font-size: 21px; }
.muted { color: var(--muted); }
.price { font-family: var(--display); font-weight: 800; color: var(--clay); }
.old { color: var(--muted); text-decoration: line-through; font-size: 13px; }

/* Layout */
.screen { flex: 1; display: flex; flex-direction: column; padding-bottom: 92px; }
.screen.no-nav { padding-bottom: 0; }
.pad { padding: 16px 20px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; align-items: center; gap: 12px; }
.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }

/* Header */
.hero-head { background: var(--navy); color: var(--cream); padding: 20px 20px 16px; border-radius: 0 0 24px 24px; display: flex; flex-direction: column; gap: 14px; }
.hero-head .muted { color: var(--soft); }
.hero-head.compact { padding: 8px 20px; gap: 6px; border-radius: 0 0 20px 20px; }
.hero-head.compact h1 { font-size: 22px; }
.hero-head.compact .search { height: 44px; }
.slogan { margin: 0; color: var(--orange); font-weight: 800; font-size: 14px; }
.intro { margin: 0; color: var(--soft); font-size: 13px; line-height: 1.2; }

/* Shop selector (demo) */
.shop-pick { display: flex; flex-direction: column; gap: 4px; }
.shop-pick span { font-size: 13px; font-weight: 700; color: var(--soft); }
.shop-pick select { min-height: 44px; width: 100%; border: 0; border-radius: 12px; padding: 0 10px; background: var(--cream); color: var(--navy); font-size: 16px; font-weight: 700; }
.shop-note { margin: 0; color: var(--soft); font-size: 13px; line-height: 1.25; }
#codeMsg { scroll-margin-bottom: 84px; }

/* Home guide */
.guide { flex: none; margin: 6px 20px 0; }
.guide summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; padding: 0 12px; list-style: none; cursor: pointer; }
.guide summary::-webkit-details-marker { display: none; }
.guide summary:focus-visible { outline-offset: -3px; }
.guide summary h2 { font-size: 16px; }
.guide summary .icon { flex: none; }
.guide[open] summary .icon { transform: rotate(180deg); }
.guide-steps { list-style: none; counter-reset: step; margin: 0; padding: 0 12px 8px; display: flex; flex-direction: column; gap: 4px; font-size: 13px; line-height: 1.25; }
.guide-steps li { counter-increment: step; display: flex; gap: 6px; }
.guide-steps li::before { content: counter(step); flex: none; width: 18px; height: 18px; border-radius: 50%; background: var(--orange); color: var(--navy); font-weight: 800; font-size: 12px; display: flex; align-items: center; justify-content: center; }
.install { flex: none; position: relative; margin: 6px 20px 0; }
.install summary { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 44px 0 12px; list-style: none; cursor: pointer; font-size: 14px; }
.install summary::-webkit-details-marker { display: none; }
.install summary:focus-visible, .install-close:focus-visible { outline-offset: -3px; }
.install summary .icon { flex: none; stroke: var(--clay); }
.install-close { position: absolute; top: 0; right: 0; width: 44px; height: 44px; border: 0; background: transparent; font-size: 22px; }
.install-other { margin: 0; padding: 0 12px 8px; font-size: 13px; line-height: 1.25; }
.home-list { padding-top: 6px; gap: 6px; }
.home-list h2 { font-size: 18px; }
.home-loc { display: flex; align-items: center; gap: 4px; flex: none; color: var(--muted); font-size: 13px; }
.home-loc .icon { width: 16px; height: 16px; stroke: var(--clay); }
@media (max-width: 359px) {
  .guide, .install { margin-left: 12px; margin-right: 12px; }
  .guide summary, .guide-steps { padding-left: 10px; padding-right: 10px; }
}
.topbar { display: flex; align-items: center; gap: 12px; padding: 18px 20px 6px; }
.icon-btn { width: 44px; height: 44px; flex: none; border-radius: 14px; border: 1px solid var(--line); background: var(--white); display: inline-flex; align-items: center; justify-content: center; text-decoration: none; color: var(--navy); }
.icon-btn.ghost { border: 0; background: rgba(255,247,236,.12); color: var(--cream); }
.icon { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Search */
.search { display: flex; align-items: center; gap: 10px; height: 48px; background: var(--cream); color: var(--navy); border-radius: 14px; padding: 0 14px; }
.search input { flex: 1; border: 0; background: transparent; outline: none; font-size: 15px; min-width: 0; }

/* Category chips */
.cats { display: flex; gap: 8px; overflow-x: auto; padding: 6px 20px 4px; scrollbar-width: none; }
.cats::-webkit-scrollbar { display: none; }
.chip { flex: none; min-height: 40px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--white); font-weight: 700; font-size: 14px; }
.chip[aria-pressed="true"] { background: var(--navy); color: var(--cream); border-color: var(--navy); }

/* Cards */
.card { background: var(--white); border: 1px solid var(--line); border-radius: 20px; overflow: hidden; }
.offer { display: block; text-decoration: none; color: inherit; }
.offer-top { height: 96px; position: relative; display: flex; align-items: flex-end; padding: 12px; }
.badge { position: absolute; top: 12px; font-size: 12px; font-weight: 800; border-radius: 999px; padding: 5px 10px; }
.badge.left { left: 12px; background: var(--navy); color: var(--cream); }
.badge.right { right: 12px; background: var(--cream); color: var(--navy); }
.badge.soldout { left: 12px; background: var(--muted); color: var(--white); }
.logo { width: 44px; height: 44px; border-radius: 14px; background: var(--cream); display: flex; align-items: center; justify-content: center; font-family: var(--display); font-weight: 800; font-size: 17px; color: var(--clay); flex: none; }
.offer-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 4px; }
.slot { font-size: 13px; font-weight: 700; color: var(--green); }
.offer.is-soldout { opacity: .6; }

/* Buttons */
.btn { min-height: 54px; border: 0; border-radius: 16px; background: var(--clay); color: var(--white); font-weight: 800; font-size: 17px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 20px; text-decoration: none; width: 100%; }
.btn:disabled { background: var(--muted); cursor: not-allowed; }
.btn.secondary { background: var(--white); color: var(--navy); border: 2px solid var(--navy); }
.btn.orange { background: var(--orange); color: var(--navy); }
.btn.outline-light { background: transparent; color: var(--cream); border: 2px solid rgba(255,247,236,.4); }
.btn.small { min-height: 44px; font-size: 15px; width: auto; }
.footer-bar { position: sticky; bottom: 0; background: var(--white); border-top: 1px solid var(--line); padding: 12px 20px calc(16px + env(safe-area-inset-bottom)); display: flex; gap: 12px; align-items: center; }

/* Stepper */
.stepper { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 14px; background: var(--white); }
.stepper button { width: 44px; height: 48px; border: 0; background: transparent; font-size: 22px; }
.stepper output { min-width: 24px; text-align: center; font-weight: 800; font-size: 17px; }

/* Lists / info */
.info { display: flex; gap: 12px; align-items: flex-start; }
.info .icon { stroke: var(--green); flex: none; margin-top: 2px; }
.label { font-size: 13px; font-weight: 700; color: var(--muted); }
.divider { height: 1px; background: var(--line); }
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag { background: var(--peach); color: var(--clay-dark); font-size: 13px; font-weight: 800; border-radius: 999px; padding: 6px 12px; }
.tag.fictive { background: #E3E7F0; color: var(--navy); font-size: 12px; padding: 2px 8px; white-space: nowrap; }
.note { display: flex; gap: 10px; background: #E6EFE8; color: #23503A; border-radius: 14px; padding: 12px 14px; font-size: 14px; }
.note .icon { stroke: var(--green); flex: none; }
.warn { background: var(--peach); color: var(--clay-dark); }
.warn .icon { stroke: var(--clay); }

/* Forms */
fieldset { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
legend { font-weight: 800; font-size: 16px; padding: 0; margin-bottom: 10px; }
.radio { display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 0 16px; border-radius: 16px; background: var(--white); border: 1px solid var(--line); }
.radio:has(input:checked) { border: 2px solid var(--clay); }
.radio input { width: 20px; height: 20px; accent-color: var(--clay); margin: 0; }
.pm { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 13px; flex: none; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-weight: 800; font-size: 14px; }
.input { height: 52px; border: 1px solid var(--line); border-radius: 14px; padding: 0 14px; background: var(--white); font-size: 16px; font-weight: 700; width: 100%; }
.input:focus { border: 2px solid var(--navy); outline: none; }
.phone { display: flex; align-items: center; gap: 10px; height: 54px; border: 2px solid var(--navy); border-radius: 14px; padding: 0 14px; background: var(--white); }
.phone input { flex: 1; border: 0; outline: none; font-size: 17px; font-weight: 700; background: transparent; min-width: 0; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.error { color: #A11D1D; font-size: 14px; font-weight: 700; }

/* Pickup code */
.code { display: flex; gap: 8px; justify-content: center; }
.code span { width: 56px; height: 68px; border-radius: 14px; background: var(--peach); display: flex; align-items: center; justify-content: center; font-family: var(--display); font-weight: 800; font-size: 36px; color: var(--clay-dark); }
/* Code de 8 caractères (mode connecté) : les cases se partagent la largeur, jusqu'à 36 px chacune */
.code.long { gap: 3px; width: 100%; }
.code.long span { flex: 1 1 0; min-width: 0; max-width: 36px; width: auto; height: 48px; border-radius: 10px; font-size: 22px; }
.code.long span.sep { flex: 0 0 8px; max-width: 8px; background: none; color: var(--clay-dark); }
.success-head { background: var(--green); color: var(--white); padding: 28px 24px 24px; border-radius: 0 0 28px 28px; display: flex; flex-direction: column; gap: 8px; }
.success-head p { margin: 0; color: var(--green-soft); }
.stat { background: var(--navy); color: var(--cream); border-radius: 18px; padding: 14px; }
.stat b { display: block; font-family: var(--display); font-size: 26px; color: var(--orange); }
.stat span { font-size: 13px; color: var(--soft); }
.qr { width: 120px; height: 120px; image-rendering: pixelated; }

/* Status pill */
.pill { font-size: 12px; font-weight: 800; border-radius: 999px; padding: 5px 10px; white-space: nowrap; }
.pill.paid { background: var(--green-soft); color: #23503A; }
.pill.cash { background: var(--peach); color: var(--clay-dark); }
.pill.done { background: #E3E7F0; color: var(--navy); }
.pill.cancelled, .pill.expired, .pill.noshow { background: #F1E4E4; color: #7A2E2E; }

/* Welcome */
.welcome { background: var(--navy); color: var(--cream); min-height: 100vh; min-height: 100dvh; padding: 56px 28px 36px; display: flex; flex-direction: column; gap: 28px; position: relative; overflow: hidden; }
.welcome h1 { font-size: 44px; color: var(--cream); }
.welcome p { margin: 0; }
.welcome .lead { font-size: 19px; color: #F6D9BC; }
.welcome .sub { font-size: 15px; color: var(--soft); }
.brand { display: flex; align-items: center; gap: 14px; font-family: var(--display); font-weight: 800; font-size: 32px; }
.rings { position: absolute; right: -170px; top: -150px; opacity: .16; pointer-events: none; }
.welcome .stat { background: rgba(255,247,236,.08); }

/* Bottom nav */
.nav { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 480px; background: var(--white); border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); padding-bottom: env(safe-area-inset-bottom); z-index: 5; }
.nav a { min-height: 64px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; text-decoration: none; color: var(--muted); font-size: 11.5px; font-weight: 800; }
.nav a[aria-current="page"] { color: var(--clay); }
.nav .icon { width: 22px; height: 22px; }

/* Empty */
.empty { text-align: center; padding: 48px 24px; display: flex; flex-direction: column; gap: 12px; align-items: center; }
.empty .icon { width: 48px; height: 48px; stroke: var(--soft); }

/* Toast */
#toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%) translateY(20px); background: var(--navy); color: var(--cream); padding: 12px 18px; border-radius: 14px; font-weight: 700; font-size: 14px; opacity: 0; transition: opacity .2s, transform .2s; pointer-events: none; max-width: 90%; z-index: 10; text-align: center; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Démonstration : bandeau permanent, au-dessus de l'écran */
/* Une seule ligne : l'accueil doit laisser voir la première offre sur un écran de 320 x 568 */
.demo-banner { max-width: 480px; margin: 0 auto; display: flex; justify-content: center; gap: 12px; background: var(--navy); color: var(--cream); font-size: 12px; line-height: 16px; font-weight: 700; padding: 3px 12px; white-space: nowrap; }
.demo-banner span { overflow: hidden; text-overflow: ellipsis; }
.demo-banner a { color: var(--cream); text-decoration: underline; flex: none; }

/* Offline banner */
.offline { background: var(--peach); color: var(--clay-dark); font-weight: 700; font-size: 13px; text-align: center; padding: 8px 12px; }

/* Écrans courts : carte d'offre compacte, pour voir le nom et le prix sous le guide */
@media (max-width: 359px), (max-height: 660px) {
  .offer-top { height: 48px; padding: 6px 12px; align-items: center; }
  .offer-top .logo { width: 36px; height: 36px; border-radius: 10px; font-size: 14px; }
  .offer-top .badge { top: 50%; transform: translateY(-50%); }
  .offer-top .badge.left { left: 56px; }
  .offer-body { padding: 8px 12px 10px; gap: 2px; }
  .offer-body .row > span:last-child { line-height: 1.15; }
}

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