/* SkoolDesk Pay — pages publiques */
:root {
  --ink: #14181f;
  --ink-2: #3a4250;
  --muted: #5b6472;
  --line: #cfd6e0;
  --line-soft: #e3e7ee;
  --canvas: #e9edf2;
  --paper: #ffffff;
  --accent: #1f4fd1;
  --on-accent: #ffffff;
  --ok: #0a7a4a;
  --err: #c4271b;
  --warn: #a14a00;
  --r: 10px;
  --font: 'Public Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.5; color: var(--ink); background: var(--canvas); }
img { max-width: 100%; display: block; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.app { max-width: 540px; margin: 0 auto; min-height: 100vh; background: var(--paper); display: flex; flex-direction: column; }
@media (min-width: 600px) {
  body { padding: 28px 16px; }
  .app { min-height: 0; border-radius: 14px; overflow: hidden; overflow: clip; box-shadow: 0 1px 0 var(--line), 0 18px 40px -24px rgba(20,24,31,.35); }
}

/* Barre école */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--line-soft); }
.topbar img { height: 28px; width: auto; }
.topbar a { font-size: 14px; font-weight: 600; text-decoration: none; color: var(--ink-2); }
.topbar a:hover { color: var(--accent); }

/* En-tête activité */
.cover { aspect-ratio: 16 / 7; background: var(--line-soft) center / cover no-repeat; }
.band { position: relative; background: var(--accent); color: var(--on-accent); padding: 18px 20px 20px; }
.cover + .band { margin-top: -18px; border-radius: 18px 18px 0 0; }
.cover { aspect-ratio: 16 / 7; }

/* Bandeau compact qui reste visible au défilement */
.mini { position: fixed; top: 0; left: 50%; z-index: 20; width: 100%; max-width: 540px; transform: translate(-50%, -110%); transition: transform .2s ease;
  display: flex; align-items: center; gap: 10px; padding: 8px 16px; background: var(--accent); color: var(--on-accent); box-shadow: 0 6px 16px -8px rgba(0,0,0,.45); }
.mini.show { transform: translate(-50%, 0); }
.mini .m-img { width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0; background: rgba(255,255,255,.25) center / cover; border: 2px solid rgba(255,255,255,.85); }
.mini .m-txt { min-width: 0; line-height: 1.35; }
.mini .m-name { font-weight: 800; font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini .m-sub { font-size: .78rem; font-weight: 600; opacity: .9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (min-width: 600px) { .mini { border-radius: 0 0 12px 12px; } }
.band h1 { margin: 0; font-size: 1.5rem; line-height: 1.2; font-weight: 800; letter-spacing: -.01em; }
.band .price { margin-top: 8px; font-size: 1.05rem; font-weight: 600; }
.band .price strong { font-size: 1.35rem; font-weight: 800; }
.facts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; padding: 0; list-style: none; }
.facts li { display: inline-flex; align-items: center; gap: 6px; font-size: .85rem; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: rgba(0,0,0,.22); }
.facts li.hot { background: #fff; color: var(--accent); }

.sheet { padding: 6px 20px 24px; flex: 1; }
.desc { color: var(--ink-2); font-size: .95rem; margin: 16px 0 0; }
.desc.clamp { max-height: 4.6em; overflow: hidden; -webkit-mask-image: linear-gradient(#000 55%, transparent); mask-image: linear-gradient(#000 55%, transparent); }
.rich > :first-child { margin-top: 0; }
.rich > :last-child { margin-bottom: 0; }
.rich p { margin: 0 0 .6em; }
.rich ul, .rich ol { margin: 0 0 .6em; padding-left: 1.3em; }
.rich li { margin: .15em 0; }
.rich a { font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.rich strong { color: var(--ink); }
.linkbtn { background: none; border: 0; padding: 4px 0; color: var(--accent); font-weight: 700; font-size: .9rem; cursor: pointer; }

/* Sections de formulaire */
.block { margin-top: 26px; }
.block > h2 { font-size: 1.05rem; font-weight: 800; margin: 0 0 12px; padding-bottom: 8px; border-bottom: 2px solid var(--ink); }
.field { margin-bottom: 16px; }
.field > label, .field > .label { display: block; font-weight: 600; font-size: .95rem; margin-bottom: 6px; }
.opt { font-weight: 400; color: var(--muted); font-size: .85rem; }
.help { font-size: .85rem; color: var(--muted); margin-top: 5px; }
.input, select.input, textarea.input {
  width: 100%; padding: 12px 14px; border: 2px solid var(--line); border-radius: var(--r);
  background: var(--paper); font-size: 1rem; transition: border-color .15s;
}
textarea.input { min-height: 96px; resize: vertical; }
.input:hover { border-color: #aab4c2; }
.input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.input.invalid { border-color: var(--err); }
.err-msg { color: var(--err); font-size: .85rem; font-weight: 600; margin-top: 5px; }

/* Tuiles de choix */
.choices { display: grid; gap: 10px; }
.choice { position: relative; display: flex; align-items: center; gap: 12px; padding: 14px 14px; border: 2px solid var(--line); border-radius: var(--r); cursor: pointer; background: var(--paper); }
.choice:hover { border-color: #aab4c2; }
.choice input[type=radio] { appearance: none; -webkit-appearance: none; width: 22px; height: 22px; border: 2px solid var(--line); border-radius: 50%; margin: 0; flex-shrink: 0; display: grid; place-items: center; }
.choice input[type=radio]::after { content: ''; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); transform: scale(0); transition: transform .12s; }
.choice input[type=radio]:checked { border-color: var(--accent); }
.choice input[type=radio]:checked::after { transform: scale(1); }
.choice:has(input:checked), .choice.on { border-color: var(--accent); box-shadow: inset 4px 0 0 var(--accent); }
.choice .c-main { flex: 1; min-width: 0; }
.choice .c-label { font-weight: 700; }
.choice .c-note { font-size: .85rem; color: var(--muted); }
.choice .c-price { font-weight: 800; white-space: nowrap; }

/* Stepper */
.stepper { display: inline-flex; align-items: stretch; border: 2px solid var(--ink); border-radius: var(--r); overflow: hidden; flex-shrink: 0; }
.stepper button { width: 40px; border: 0; background: var(--paper); font-size: 1.25rem; font-weight: 700; cursor: pointer; }
.stepper button:hover { background: var(--ink); color: #fff; }
.stepper button:disabled { color: #b5bdc8; background: var(--paper); cursor: not-allowed; }
.stepper output { min-width: 40px; display: grid; place-items: center; font-weight: 800; border-left: 2px solid var(--ink); border-right: 2px solid var(--ink); }

/* Montant libre */
.amount-box { display: flex; align-items: center; border: 2px solid var(--ink); border-radius: var(--r); overflow: hidden; }
.amount-box input { flex: 1; min-width: 0; border: 0; padding: 12px 14px; font-size: 1.6rem; font-weight: 800; outline: none; }
.amount-box span { padding: 0 16px; font-size: 1.4rem; font-weight: 800; background: var(--ink); color: #fff; align-self: stretch; display: grid; place-items: center; }
.amount-box:focus-within { border-color: var(--accent); }
.amount-box:focus-within span { background: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.chip { padding: 7px 14px; border-radius: 999px; border: 2px solid var(--line); background: var(--paper); font-weight: 700; cursor: pointer; }
.chip:hover, .chip.on { border-color: var(--accent); color: var(--accent); }

/* Cases à cocher */
.check, .field > label.check { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; font-size: .95rem; }
.check input { width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--accent); flex-shrink: 0; }
.radios { display: grid; gap: 8px; }
.radios label { display: flex; gap: 10px; align-items: center; font-weight: 500; cursor: pointer; }
.radios input { width: 20px; height: 20px; accent-color: var(--accent); margin: 0; }

.cgu { margin-top: 26px; padding: 14px; border: 2px solid var(--line); border-radius: var(--r); }
.cgu.invalid { border-color: var(--err); }

/* Barre de paiement */
.paybar { position: sticky; bottom: 0; background: var(--paper); border-top: 2px solid var(--ink); padding: 12px 20px calc(12px + env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 14px; z-index: 5; }
.paybar .total { line-height: 1.15; }
.paybar .total small { display: block; font-size: .8rem; color: var(--muted); font-weight: 600; }
.paybar .total strong { font-size: 1.45rem; font-weight: 800; letter-spacing: -.01em; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 14px 20px; border-radius: var(--r); border: 2px solid transparent; font-weight: 800; font-size: 1rem; cursor: pointer; text-decoration: none; }
.btn-pay { flex: 1; background: var(--accent); color: var(--on-accent); font-size: 1.05rem; }
.btn-pay:hover { filter: brightness(.92); }
.btn-pay:disabled { background: #9aa3af; cursor: not-allowed; filter: none; }
.btn-ghost { background: var(--paper); border-color: var(--ink); color: var(--ink); }
.btn-ghost:hover { background: var(--ink); color: #fff; }
.btn-block { width: 100%; }

.alert { padding: 12px 14px; border-radius: var(--r); font-weight: 600; font-size: .95rem; border-left: 5px solid; margin-top: 16px; }
.alert-err { background: #fdecea; border-color: var(--err); color: #8a1b12; }
.alert-info { background: #edf1f7; border-color: var(--ink); color: var(--ink); }
.alert-warn { background: #fff1e0; border-color: var(--warn); color: #6b3100; }

/* Écran paiement */
.paystep { padding: 24px 20px 28px; text-align: center; }
.paystep h2 { font-size: 1.3rem; font-weight: 800; margin: 0 0 6px; }
.paystep .lead { color: var(--ink-2); margin: 0 auto 18px; max-width: 34ch; }
.paystep .amount-big { font-size: 2.2rem; font-weight: 800; letter-spacing: -.02em; margin: 6px 0 16px; }
.qr { display: inline-block; padding: 14px; border: 3px solid var(--ink); border-radius: 14px; background: #fff; }
.qr img { width: 230px; height: 230px; }
.timer { margin-top: 14px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.timer.low { color: var(--err); }
.waiting { display: inline-flex; align-items: center; gap: 10px; margin-top: 10px; font-weight: 600; color: var(--muted); }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); animation: pulse 1.2s infinite ease-in-out; }
@keyframes pulse { 50% { transform: scale(.5); opacity: .4; } }
.stack { display: grid; gap: 10px; max-width: 360px; margin: 0 auto; }
.alt-toggle { margin-top: 18px; }
.result-icon { width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center; margin: 4px auto 14px; color: #fff; font-size: 2.2rem; font-weight: 800; }
.result-icon.ok { background: var(--ok); }
.result-icon.ko { background: var(--err); }
.recap { text-align: left; margin: 20px auto 0; max-width: 400px; border-top: 2px solid var(--ink); }
.recap div { display: flex; justify-content: space-between; gap: 16px; padding: 9px 0; border-bottom: 1px solid var(--line-soft); font-size: .95rem; }
.recap dt, .recap span:first-child { color: var(--muted); }
.recap span:last-child { font-weight: 700; text-align: right; }
.note { text-align: left; max-width: 400px; margin: 18px auto 0; padding: 14px 16px; border-left: 5px solid var(--accent); background: #f2f4f8; }

.sandbox { background: #ffd43b; color: #3d2a00; text-align: center; font-weight: 800; font-size: .85rem; padding: 6px; }
.secure { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 18px 20px 6px; color: var(--muted); font-size: .85rem; }
.secure img { height: 34px; width: auto; }
.foot { padding: 16px 20px 22px; font-size: .78rem; color: var(--muted); text-align: center; border-top: 1px solid var(--line-soft); white-space: pre-line; }
.foot button { background: none; border: 0; color: var(--muted); text-decoration: underline; cursor: pointer; font-size: .78rem; padding: 0; }

/* Liste d'activités */
.list { padding: 8px 16px 20px; display: grid; gap: 14px; }
.list h1 { font-size: 1.4rem; font-weight: 800; margin: 14px 4px 2px; }
.list .intro { margin: 0 4px 6px; color: var(--muted); }
.card { display: grid; grid-template-columns: 112px 1fr; border: 2px solid var(--line); border-radius: 12px; overflow: hidden; text-decoration: none; color: inherit; background: var(--paper); }
.card:hover { border-color: var(--ink); }
.card .thumb { background: var(--line-soft) center / cover no-repeat; border-right: 6px solid var(--card-accent, var(--accent)); }
.card .body { padding: 12px 14px; min-width: 0; }
.card h2 { font-size: 1.02rem; margin: 0 0 4px; font-weight: 800; line-height: 1.25; }
.card p { margin: 0; font-size: .87rem; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card .meta { display: flex; flex-wrap: wrap; gap: 6px 12px; margin-top: 8px; font-size: .85rem; font-weight: 700; }
.card .meta .p { color: var(--card-accent, var(--accent)); }
.card .meta .w { color: var(--warn); }
.card.express { grid-template-columns: 1fr; border-style: dashed; }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }

dialog { border: 0; border-radius: 14px; padding: 0; width: min(640px, calc(100vw - 24px)); max-height: calc(100vh - 40px); }
dialog::backdrop { background: rgba(20,24,31,.6); }
dialog .d-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 2px solid var(--ink); position: sticky; top: 0; background: #fff; }
dialog .d-head h3 { margin: 0; font-size: 1.1rem; }
dialog .d-body { padding: 4px 18px 18px; font-size: .9rem; line-height: 1.55; }
dialog .d-body h6 { font-size: .95rem; margin: 16px 0 4px; }
dialog .close { background: none; border: 0; font-size: 1.6rem; line-height: 1; cursor: pointer; }

/* ═════════ Mise en page adaptative (v15) ═════════ */
.hero-desc { padding: 0 20px; }
.hero-desc .desc { margin-top: 18px; }
.block > h2 { display: flex; align-items: center; gap: 10px; }
.block > h2 .n { display: inline-grid; place-items: center; flex-shrink: 0; width: 26px; height: 26px; border-radius: 50%; background: var(--ink); color: #fff; font-size: .8rem; }
.paybar .total { min-width: 0; flex: 0 1 auto; }
.choice .c-pr { color: var(--ink); font-weight: 800; }
.choices:has(.stepper) .choice { padding-top: 11px; padding-bottom: 11px; }
.paybar .total small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 46vw; }
.paybar .btn-pay { flex: 1 0 auto; }
.pay-sum { margin: -8px auto 16px; max-width: 46ch; color: var(--ink-2); font-weight: 600; font-size: .92rem; }
.topbar .tb-r { display: flex; align-items: center; gap: 16px; }

/* Tablette (portrait) */
@media (min-width: 700px) {
  .app, .mini { max-width: 760px; }
  .cover { aspect-ratio: 16 / 6; }
  .band { padding: 22px 28px 24px; }
  .band h1 { font-size: 1.8rem; }
  .hero-desc, .sheet { padding-left: 28px; padding-right: 28px; }
  .paybar { padding-left: 28px; padding-right: 28px; }
  .paybar .total small { max-width: 300px; }
  .fgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; align-items: start; }
  .fgrid .field.wide { grid-column: 1 / -1; }
}

/* Ordinateur et tablette (paysage) : l’activité à gauche, la commande à droite */
@media (min-width: 960px) {
  body { padding: 24px; }
  .app { max-width: 1220px; }
  .topbar { padding: 14px 28px; }
  .topbar img { height: 34px; }
  .layout { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); }
  .hero { border-right: 2px solid var(--ink); background: #f6f8fb; }
  .hero-in { position: sticky; top: 0; max-height: 100vh; overflow-y: auto; padding-bottom: 28px; scrollbar-width: thin; }
  .cover { aspect-ratio: 16 / 10; }
  .band { padding: 24px 32px 26px; }
  .band h1 { font-size: 2rem; }
  .hero-desc { padding: 0 32px; }
  .hero-desc .desc { font-size: 1rem; margin-top: 22px; }
  .desc.clamp { max-height: none; -webkit-mask-image: none; mask-image: none; }
  #desc-toggle { display: none !important; }
  .mini { display: none; }
  .order { min-width: 0; display: flex; flex-direction: column; }
  .order > form { display: flex; flex-direction: column; flex: 1; }
  .sheet { padding: 4px 40px 28px; }
  .block { margin-top: 30px; }
  .paybar { padding: 16px 40px; }
  .paybar .total small { max-width: 340px; }
  .paybar .btn-pay { flex: 0 0 auto; min-width: 300px; margin-left: auto; }
  .paystep { padding: 56px 40px; }
  .qr img { width: 260px; height: 260px; }
}

/* Liste des activités : grille sur tablette / ordinateur */
.card .go { display: none; }
@media (min-width: 700px) {
  .list { padding: 8px 28px 28px; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
  .list-head, .list .empty, .card.express { grid-column: 1 / -1; }
  .list h1 { font-size: 1.9rem; margin: 22px 0 4px; }
  .list .intro { margin: 0 0 8px; max-width: 60ch; }
  .card:not(.express) { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .card .thumb { aspect-ratio: 16 / 9; border-right: 0; border-bottom: 6px solid var(--card-accent, var(--accent)); }
  .card .body { display: flex; flex-direction: column; padding: 16px 18px 18px; }
  .card h2 { font-size: 1.15rem; }
  .card .meta { margin-bottom: 12px; }
  .card .go { display: block; margin-top: auto; align-self: flex-start; padding: 9px 16px; border-radius: 8px; background: var(--card-accent, var(--accent)); color: #fff; font-weight: 800; font-size: .92rem; }
  .card:hover .go { filter: brightness(.9); }
  .card:hover { border-color: var(--ink); box-shadow: 0 10px 24px -18px rgba(20,24,31,.6); }
}
@media (min-width: 960px) {
  .app:has(.list) { max-width: 1220px; }
  .list { grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 8px 40px 36px; }
}

/* Bouton et fenêtre « Partager » */
.share-btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border: 2px solid var(--ink); border-radius: 8px; background: var(--paper); font-weight: 800; font-size: 14px; cursor: pointer; }
.share-btn:hover { background: var(--ink); color: #fff; }
.share-btn svg, .sh-apps svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.topbar .share-btn { margin-left: auto; }
@media (max-width: 420px) { .topbar .tb-r a { display: none; } }
.share-dlg { width: min(520px, calc(100vw - 24px)); }
.share-dlg .d-body { padding: 16px 18px 20px; font-size: .95rem; }
.sh-name { margin: 0 0 12px; font-weight: 800; font-size: 1.05rem; }
.sh-link { display: flex; gap: 8px; }
.sh-link .input { flex: 1; min-width: 0; padding: 10px 12px; font-size: .92rem; background: #f6f8fb; }
.btn-ink { background: var(--ink); color: #fff; padding: 10px 16px; }
.btn-ink:hover { background: #000; }
.sh-apps { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 8px; margin-top: 12px; }
.sh-apps a, .sh-apps button { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 10px; border: 2px solid var(--line); border-radius: 10px; background: var(--paper); color: var(--ink); text-decoration: none; font-weight: 700; font-size: .92rem; cursor: pointer; }
.sh-apps a:hover, .sh-apps button:hover { border-color: var(--ink); }
.sh-qr { display: flex; gap: 16px; align-items: center; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line-soft); }
.sh-qr #share-qr { flex-shrink: 0; padding: 8px; border: 2px solid var(--ink); border-radius: 10px; background: #fff; }
.sh-qr #share-qr img, .sh-qr #share-qr canvas { width: 132px; height: 132px; }
.sh-qr p { margin: 4px 0 10px; color: var(--muted); font-size: .88rem; }
.sh-qr .btn { padding: 9px 14px; font-size: .9rem; }
@media (max-width: 460px) { .sh-qr { flex-direction: column; text-align: center; } }

[hidden] { display: none !important; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
