/* Wave checkout self-enrollment (MPD-11026).
 * Sunlight-readable, thumb-first UI: white ground, deep-green identity,
 * crop-tinted produce tiles, prices as the display type. */

:root {
    /* Brand palette sampled from the official Bindal sa bopp logo. */
    --green-deep: #14532d;
    --green-primary: #047c35;
    --amber: #feb100;
    --ink: #111827;
    --ink-soft: #4b5563;
    --paper: #ffffff;
}

.enroll-page {
    justify-content: flex-start;
    /* Bottom clearance: the last row must scroll clear of the fixed
       72px guide speaker instead of hiding a price under it. */
    padding: 12px 12px calc(104px + env(safe-area-inset-bottom));
    max-width: 480px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
}

/* --- paid banner ------------------------------------------------------- */

.paid-banner {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    background: var(--green-deep);
    color: var(--paper);
    border-radius: 18px;
    padding: 14px 18px;
    box-sizing: border-box;
}

.paid-banner__icon {
    width: 52px;
    height: 52px;
    flex: none;
}

.paid-banner__text {
    text-align: left;
}

.paid-banner__title {
    font-size: 22px;
    font-weight: 600;
    line-height: 1.15;
}

.paid-banner__amount {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: #bbf7d0;
}

/* --- greeting ---------------------------------------------------------- */

.greeting {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 14px 0 0;
    font-size: 19px;
    font-weight: 600;
    color: var(--ink);
}

.greeting__wave {
    font-size: 22px;
}

/* Status card (MPD-11126/MPD-11052): one green container for everything
   that answers "whose account, and how is it doing" — phone + village
   identity, a hairline rule, then the savings balance and goal. Reads as
   one status, not two disconnected facts. */
.status-card {
    margin: 8px 0 0;
    padding: 10px 12px;
    background: #f0fdf4;
    border: 1.5px solid var(--green-primary);
    border-radius: 12px;
}

.status-card__id {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    row-gap: 4px;
    gap: 8px;
}

.status-card__rule {
    height: 1px;
    margin: 10px 0;
    background: rgba(20, 83, 45, 0.14);
}

.account__icon {
    font-size: 17px;
    line-height: 1;
}

.account__value {
    display: flex;
    align-items: baseline;
    gap: 6px;
    /* The number must never wrap mid-digit-group on a narrow screen. */
    white-space: nowrap;
}

.account__prefix {
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-soft);
}

.account__number {
    font-size: 17px;
    font-weight: 800;
    letter-spacing: 0.03em;
    color: var(--green-deep);
}

/* Divider + village badge (MPD-11052): shares the phone pill rather than
   getting its own card — it is the same "which account am I on" glance,
   not a second fact to scan. Pushed to the row's far edge, mirroring the
   balance/goal split below it. */
.account__divider {
    width: 1px;
    align-self: stretch;
    background: rgba(20, 83, 45, 0.18);
}

.account__village {
    display: flex;
    align-items: baseline;
    gap: 4px;
    margin-left: auto;
    /* Lets account__village-name actually shrink/ellipsize instead of
       forcing the whole row wider — a flex item's default min-width is
       its content's full width, which would defeat text-overflow. */
    min-width: 0;
}

.account__village-icon {
    font-size: 14px;
}

/* Truncates a long village name on a small screen ("Village Name…") while
   the code that follows it never does — the code is the part ops and the
   farmer actually rely on to be readable in full. */
.account__village-name {
    max-width: 110px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-soft);
}

.account__village-code {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--green-deep);
    white-space: nowrap;
    flex-shrink: 0;
}

/* --- sections ---------------------------------------------------------- */

.enroll {
    width: 100%;
}

.section-title {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-soft);
    margin: 0;
    text-align: left;
}

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 18px 0 8px;
}

/* --- balance (nested inside .status-card, see above) --------------------- */

.balance__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    /* Narrow screens: the goal cell drops to its own line as a unit —
       never split an amount mid-number. */
    flex-wrap: wrap;
    gap: 6px 10px;
}

.balance__cell {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.balance__icon {
    font-size: 19px;
}

.balance__label {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink-soft);
}

.balance__amount {
    font-size: 20px;
    font-weight: 700;
    color: var(--green-deep);
    white-space: nowrap;
}

.balance__goal {
    font-size: 17px;
    font-weight: 700;
    color: var(--ink-soft);
    white-space: nowrap;
}

/* Small phones (the field devices): tighter numbers, same hierarchy. */
@media (max-width: 380px) {
    .balance__icon {
        font-size: 16px;
    }

    .balance__label {
        font-size: 11px;
    }

    .balance__amount {
        font-size: 18px;
    }

    .balance__goal {
        font-size: 15px;
    }

    .account__village-name {
        max-width: 70px;
    }
}

/* Distance to the total savings goal, readable without words. */
.balance__track {
    margin-top: 8px;
    height: 8px;
    border-radius: 999px;
    background: rgba(20, 83, 45, 0.14);
    overflow: hidden;
}

.balance__fill {
    height: 100%;
    border-radius: 999px;
    background: var(--green-primary);
    transition: width 0.6s ease;
}

.balance__fill--full {
    background: var(--amber);
}

/* --- catalog grid ------------------------------------------------------- */

.catalog__grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.pkg-tile {
    position: relative;
    border: 2px solid var(--tile-rim, #d1d5db);
    background: var(--tile-bg, #f3f4f6);
    border-radius: 18px;
    padding: 0;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    font-family: inherit;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.pkg-tile:active {
    transform: scale(0.97);
}

.pkg-tile--locked {
    opacity: 0.45;
    filter: grayscale(0.35);
}

.pkg-tile--locked:active {
    transform: none;
}

.pkg-tile__photo {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pkg-tile__fallback {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 72px;
    padding-bottom: 42px;
}

.pkg-tile__overlay {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 26px 8px 9px;
    background: linear-gradient(transparent, rgba(17, 24, 39, 0.78));
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
}

.pkg-tile__name {
    font-size: 15px;
    font-weight: 600;
    color: var(--paper);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}

.pkg-tile__size {
    font-size: 12px;
    font-weight: 600;
    color: var(--paper);
    opacity: 0.92;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}

.pkg-tile__price {
    font-size: 20px;
    font-weight: 700;
    color: var(--paper);
    letter-spacing: 0.3px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}

/* A held package keeps its full-size box: green ring, quantity riding on
   top, package total in the overlay (new concept — replaces the shelf).
   Shares the pkg-tile child styles (photo, overlay, name, size, price). */
.held-tile {
    position: relative;
    border: 2px solid var(--green-primary);
    background: var(--tile-bg, #f3f4f6);
    border-radius: 18px;
    padding: 0;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    font-family: inherit;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    box-shadow: 0 0 0 3px rgba(4, 124, 53, 0.25);
}

.held-tile:active {
    transform: scale(0.97);
}

.held-tile--static {
    cursor: default;
}

.held-tile--static:active {
    transform: none;
}

.held-tile__qty {
    position: absolute;
    top: 6px;
    right: 6px;
    background: var(--green-primary);
    color: var(--paper);
    border-radius: 999px;
    padding: 3px 11px;
    font-size: 19px;
    font-weight: 700;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* ⏳ while any unit is still in the pipeline, ✔ once all delivered. */
.held-tile__state {
    position: absolute;
    top: 6px;
    left: 6px;
    background: var(--green-primary);
    color: var(--paper);
    border-radius: 50%;
    width: 26px;
    height: 26px;
    font-size: 15px;
    line-height: 26px;
    text-align: center;
}

.held-tile__state--pending {
    background: var(--amber);
    font-size: 14px;
}

/* Struck-through catalogue total above the discounted one (MPD-11090). */
.pkg-tile__price--list {
    font-size: 13px;
    font-weight: 600;
    color: var(--paper);
    opacity: 0.85;
    text-decoration: line-through;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}

/* Quantity promo runs on this package (MPD-11090). */
.pkg-tile__promo {
    position: absolute;
    top: 6px;
    left: 6px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    width: 30px;
    height: 30px;
    font-size: 17px;
    line-height: 30px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

/* Two-step pick (MPD-11249): the tapped tile wears the language chooser's
   selected look — a heavy green ring plus a ✓ badge. Held tiles are
   already green-ringed, so on them the badge is the distinguishing mark
   and the ring only gains weight. */
.pkg-tile--picked,
.held-tile--picked {
    border-color: var(--green-primary);
    box-shadow: 0 0 0 4px rgba(4, 124, 53, 0.5);
}

/* Top-center: clear of the promo/state badges (top-left) and the held
   ×N (top-right). Above the photo, below nothing. */
.pkg-tile__pick {
    position: absolute;
    top: 6px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1;
    background: var(--green-primary);
    color: var(--paper);
    border-radius: 50%;
    width: 26px;
    height: 26px;
    font-size: 15px;
    line-height: 26px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* --- remaining photo sizing (sheet hero + quantity cards) ---------------- */

img.product-img {
    object-fit: contain;
}

img.sheet__emoji {
    width: 128px;
    height: 128px;
}

img.qty-card__icon {
    width: 26px;
    height: 26px;
}

/* --- crop tints (the produce stall) ------------------------------------- */

.tile--mais { --tile-bg: #fef3c7; --tile-rim: #f59e0b; }
.tile--dap { --tile-bg: #dcfce7; --tile-rim: #16a34a; }
.tile--mil { --tile-bg: #fef9c3; --tile-rim: #ca8a04; }
.tile--riz { --tile-bg: #e0f2fe; --tile-rim: #0284c7; }
.tile--bissap { --tile-bg: #fce7f3; --tile-rim: #db2777; }
.tile--pasteque { --tile-bg: #fee2e2; --tile-rim: #dc2626; }
.tile--gombo { --tile-bg: #ecfccb; --tile-rim: #65a30d; }
.tile--niebe { --tile-bg: #fdeadd; --tile-rim: #b45309; }
.tile--tomate { --tile-bg: #ffe4e6; --tile-rim: #f43f5e; }
.tile--calthio { --tile-bg: #fae8ff; --tile-rim: #a21caf; }
.tile--poulet { --tile-bg: #ffedd5; --tile-rim: #ea580c; }
.tile--autre { --tile-bg: #f1f5f9; --tile-rim: #64748b; }

/* --- speaker buttons ----------------------------------------------------- */

.speaker {
    border: 0;
    background: var(--green-primary);
    color: var(--paper);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
}

.speaker--inline {
    width: 48px;
    height: 48px;
    flex: none;
}

.speaker--guide {
    position: fixed;
    right: 16px;
    bottom: 16px;
    width: 72px;
    height: 72px;
    box-shadow: 0 6px 18px rgba(20, 83, 45, 0.35);
    animation: speaker-pulse 2.2s ease-in-out infinite;
    z-index: 30;
}

.speaker__icon {
    font-size: 26px;
    line-height: 1;
}

.speaker--guide .speaker__icon {
    font-size: 34px;
}

/* While audio is audible every speaker shows the pause glyph
   (body.audio-playing is kept in sync by the audio guide). */
.speaker__icon--pause {
    display: none;
}

.audio-playing .speaker__icon--play {
    display: none;
}

.audio-playing .speaker__icon--pause {
    display: inline;
}

@keyframes speaker-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.07); }
}

/* Step two of the crop pick (MPD-11249): while a tile is picked, a wide
   button floats over the bottom of the shop carrying the arrow and the
   crop's name. Same shape as .sheet__confirm on purpose — the sheet is
   where the farmer learns that the big green bar at the bottom is what
   moves you forward. Deliberately NOT a .speaker: the gesture latch skips
   .speaker targets, and body.audio-playing would swap its glyph for ⏸.
   No pulse — at this width the scale would swing ~30px. The page already
   reserves 104px of bottom padding for the guide speaker, which clears
   this too. */
.fab-continue {
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: calc(16px + env(safe-area-inset-bottom));
    margin: 0 auto;
    max-width: 440px;
    border: 0;
    border-radius: 18px;
    padding: 18px;
    box-sizing: border-box;
    background: var(--green-primary);
    color: var(--paper);
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    box-shadow: 0 6px 18px rgba(20, 83, 45, 0.35);
    z-index: 30;
}

.fab-continue__arrow {
    font-size: 26px;
    font-weight: 700;
    flex: none;
}

/* Names run long ("Mais Hybride + Fertilizer"), so the label takes the
   ellipsis rather than pushing the arrow off the button. */
.fab-continue__name {
    font-size: 20px;
    font-weight: 600;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* --- package sheet ------------------------------------------------------- */

.sheet {
    position: fixed;
    inset: 0;
    background: var(--tile-bg, #f3f4f6);
    z-index: 40;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 14px 16px calc(20px + env(safe-area-inset-bottom));
    box-sizing: border-box;
    overflow-y: auto;
    /* Rubber-banding must not scroll the shop behind the overlay. */
    overscroll-behavior: contain;
}

/* The sheet covers the whole screen, so it has to carry the training
   cue too or the tint vanishes the moment a package is opened. */
body.training-mode .sheet {
    background: var(--color-training);
}

.sheet__top {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sheet__back {
    border: 0;
    background: rgba(255, 255, 255, 0.85);
    color: var(--ink);
    width: 52px;
    height: 52px;
    border-radius: 50%;
    font-size: 26px;
    cursor: pointer;
}

.sheet__hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    margin: 10px 0 18px;
}

.sheet__emoji {
    font-size: 96px;
    line-height: 1.05;
    height: 128px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sheet__name {
    font-size: 24px;
    font-weight: 600;
    color: var(--ink);
}

.sheet__size {
    font-size: 16px;
    font-weight: 600;
    color: var(--ink-soft);
}

.sheet__quantities {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
    width: 100%;
    max-width: 440px;
}

.qty-card {
    border: 3px solid rgba(255, 255, 255, 0.9);
    background: rgba(255, 255, 255, 0.72);
    border-radius: 16px;
    padding: 14px 4px 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    font-family: inherit;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.qty-card--active {
    border-color: var(--green-primary);
    background: var(--paper);
    box-shadow: 0 4px 14px rgba(20, 83, 45, 0.18);
}

.qty-card--disabled,
.qty-card:disabled {
    opacity: 0.4;
    filter: grayscale(0.35);
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.qty-card--disabled:active,
.qty-card:disabled:active {
    transform: none;
}

.qty-card__icons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    /* Four 26px icons per row: counts up to 16 read as a 4×4 domino. */
    max-width: 104px;
    line-height: 1;
}

.qty-card__icon {
    font-size: 22px;
    height: 26px;
    display: inline-flex;
    align-items: center;
}

.qty-card__count {
    font-size: 30px;
    font-weight: 700;
    color: var(--ink);
    line-height: 1;
}

.qty-card__price {
    font-size: 14px;
    font-weight: 600;
    color: var(--green-deep);
}

.qty-card__price--list {
    font-size: 12px;
    color: var(--ink-soft);
    text-decoration: line-through;
}

/* The 0-card: the way out of a held package (gated by the 24h clock). */
.qty-card--remove .qty-card__remove-mark {
    font-size: 22px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    color: #dc2626;
    font-weight: 700;
}

.qty-card--remove.qty-card--active {
    border-color: #dc2626;
    box-shadow: 0 4px 14px rgba(220, 38, 38, 0.22);
}

.sheet__confirm {
    width: 100%;
    max-width: 440px;
    border: 0;
    background: var(--green-primary);
    color: var(--paper);
    border-radius: 18px;
    padding: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    cursor: pointer;
    font-family: inherit;
    margin-top: 22px;
    /* Always in view: long quantity grids scroll beneath it, so the
       accept button never has to be hunted for below the fold. */
    position: sticky;
    bottom: 0;
    z-index: 1;
    flex-shrink: 0;
    box-shadow: 0 -6px 18px rgba(17, 24, 39, 0.18);
}

.sheet__confirm:disabled {
    opacity: 0.7;
    cursor: wait;
}

/* Confirm flips destructive when the 0-card is selected on a held
   package — and to a quiet grey Fermer on a fresh one, where 0 just
   closes the sheet without adding anything. */
.sheet__confirm--remove {
    background: #dc2626;
}

.sheet__confirm--close {
    background: var(--ink-soft);
}

/* Ten seconds without acting and the guide repeats the action while the
   button that carries it pulses (MPD-11249). One class for every screen
   so the tuning lives in one place. Most carriers are full-width bars
   (continue FAB, Valider, Autoriser, the chooser's Valider): at 440px
   .speaker--guide's 1.07 would swing ~30px and read as a lurch, and even
   1.04 is ~18px, so a bar breathes at 1.02. The keypad ✓ and Oui are
   narrow keys and can move more before it looks like a jump. */
.nudge-pulse {
    --nudge-scale: 1.02;
    animation: nudge-pulse 2s ease-in-out infinite;
}

.phone__key.nudge-pulse,
.phone__choice.nudge-pulse {
    --nudge-scale: 1.05;
}

@keyframes nudge-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(var(--nudge-scale)); }
}

.sheet__confirm--busy .sheet__confirm-check {
    display: inline-block;
    animation: busy-spin 1s linear infinite;
}

@keyframes busy-spin {
    to { transform: rotate(360deg); }
}

.sheet__back:disabled {
    opacity: 0.4;
    cursor: wait;
}

.sheet__confirm-check {
    font-size: 26px;
    font-weight: 700;
}

.sheet__confirm-label {
    font-size: 22px;
    font-weight: 600;
}

.sheet__confirm-price {
    font-size: 22px;
    font-weight: 700;
}

.sheet__confirm-price--list {
    font-size: 16px;
    font-weight: 600;
    opacity: 0.8;
    text-decoration: line-through;
}

.sheet__error {
    margin-top: 12px;
    width: 100%;
    max-width: 440px;
    border: 0;
    background: var(--amber);
    color: var(--ink);
    border-radius: 18px;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    font-family: inherit;
    -webkit-tap-highlight-color: transparent;
}

.sheet__error-icon {
    font-size: 24px;
}

.sheet__error-text {
    font-size: 20px;
    font-weight: 600;
}

/* --- success party -------------------------------------------------------- */

.party {
    position: fixed;
    inset: 0;
    /* The celebration-flag green: the fond-vert logo's black "sa bopp" is
       designed against it, where the old near-black deep green swallowed it. */
    background: rgba(27, 125, 64, 0.96);
    z-index: 50;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 30px;
    overflow: hidden;
    pointer-events: none;
    animation: party-fade 3.2s ease forwards;
}

.party__logo {
    width: 210px;
    max-width: 64vw;
    height: auto;
}

.party__endorse {
    display: flex;
    align-items: center;
    gap: 8px;
    color: rgba(255, 255, 255, 0.95);
    font-size: 17px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.party__endorse img {
    width: 22px;
    height: auto;
}

/* Short viewports (landscape phones): the logo + hero + endorsement stack
   is ~500px at full size and the overlay clips both ends — shrink the
   pieces so the endorsement stays on screen instead of silently hiding. */
@media (max-height: 540px) {
    .party {
        gap: 14px;
    }

    .party__logo {
        width: 140px;
    }

    .party__hero {
        width: 132px;
        height: 132px;
    }

    .party__product {
        width: 100px;
        height: 100px;
        border-width: 4px;
    }

    .party__product-fallback {
        font-size: 72px;
    }

    .party__check {
        width: 44px;
        height: 44px;
        font-size: 28px;
    }
}

.party__confetti {
    position: absolute;
    inset: 0;
}

.party__piece {
    position: absolute;
    top: -6vh;
    width: 12px;
    height: 18px;
    border-radius: 3px;
    transform: scale(var(--piece-scale, 1));
    animation-name: confetti-fall;
    animation-timing-function: linear;
    animation-fill-mode: both;
}

.party__piece--emoji {
    width: auto;
    height: auto;
    font-size: 26px;
    background: none;
    line-height: 1;
}

@keyframes confetti-fall {
    from {
        transform: translate(0, -6vh) rotate(0deg) scale(var(--piece-scale, 1));
        opacity: 1;
    }
    85% { opacity: 1; }
    to {
        transform: translate(var(--drift, 0px), 112vh) rotate(var(--spin, 360deg))
            scale(var(--piece-scale, 1));
        opacity: 0.6;
    }
}

.party__hero {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 200px;
    height: 200px;
}

.party__ring {
    position: absolute;
    inset: 0;
    border: 4px solid rgba(249, 246, 239, 0.85);
    border-radius: 50%;
    animation: party-ring 1.1s ease-out forwards;
}

.party__ring--late {
    animation-delay: 0.35s;
}

@keyframes party-ring {
    from { transform: scale(0.4); opacity: 0.9; }
    to { transform: scale(2.4); opacity: 0; }
}

.party__product {
    width: 148px;
    height: 148px;
    border-radius: 50%;
    object-fit: cover;
    border: 6px solid var(--paper);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
    animation: party-pop 0.6s cubic-bezier(0.2, 1.9, 0.4, 1) both;
}

.party__product-fallback {
    font-size: 110px;
    line-height: 1;
    animation: party-pop 0.6s cubic-bezier(0.2, 1.9, 0.4, 1) both;
}

.party__check {
    position: absolute;
    right: 2px;
    bottom: 2px;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--amber);
    color: var(--green-deep);
    font-size: 40px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
    animation: party-pop 0.5s cubic-bezier(0.2, 1.9, 0.4, 1) 0.25s both;
}

@keyframes party-pop {
    from { transform: scale(0.1); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

@keyframes party-fade {
    0%, 78% { opacity: 1; }
    100% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .speaker--guide { animation: none; }
    .nudge-pulse { animation: none; }
    .party { animation: party-fade 2s ease forwards; }
    .party__ring { animation: none; opacity: 0; }
    .party__product,
    .party__product-fallback,
    .party__check { animation: none; }
    .pkg-tile:active { transform: none; }
    .held-tile:active { transform: none; }
    .sheet__confirm--busy .sheet__confirm-check { animation: none; }
}

/* --- enroll landing: welcome header --------------------------------------- */

.enroll-welcome {
    padding: 10px 0 4px;
}

.enroll-welcome__logo {
    display: block;
    width: 132px;
    height: auto;
}

/* --- enroll landing: phone entry ------------------------------------------ */

.phone {
    margin-top: 10px;
}

.phone__display {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 12px 0 16px;
    padding: 16px 18px;
    background: #f0fdf4;
    border: 2px solid var(--green-primary);
    border-radius: 16px;
    min-height: 64px;
}

.phone__display--error {
    border-color: var(--amber);
    background: #fffbeb;
}

.phone__prefix {
    font-size: 18px;
    font-weight: 700;
    color: var(--ink-soft);
    white-space: nowrap;
}

/* Nine countable slots. An underline marks what is still empty, so how much
   is left to type is visible without a word of explanation, and the checkmark
   lights exactly as the last one fills. */
.phone__digits {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    font-size: 28px;
    font-weight: 800;
    color: var(--green-deep);
    min-height: 34px;
}

.phone__group {
    display: flex;
    gap: 5px;
}

.phone__slot {
    min-width: 19px;
    padding-bottom: 2px;
    text-align: center;
    line-height: 1.1;
    border-bottom: 3px solid rgba(20, 83, 45, 0.2);
}

.phone__slot--filled {
    border-bottom-color: transparent;
}

/* Every Senegalese mobile starts with a 7: show it in place, greyed out,
   instead of only saying so. */
.phone__slot--ghost {
    color: rgba(20, 83, 45, 0.3);
}

/* The refused digit, on its way back out of the display. */
.phone__slot--reject {
    color: var(--amber);
}

/* The number for assistive tech. The slots are a visual counting aid and are
   hidden from it, so the whole number is announced once, properly grouped. */
.phone__sr {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

/* A refused tap gets an answer, never silence: the display shakes while the
   voice names the rule that was broken. */
.phone__display--shake {
    animation: phone-shake 0.36s ease;
}

@keyframes phone-shake {
    0%,
    100% {
        transform: translateX(0);
    }
    20% {
        transform: translateX(-7px);
    }
    45% {
        transform: translateX(6px);
    }
    70% {
        transform: translateX(-4px);
    }
    88% {
        transform: translateX(2px);
    }
}

.phone__pad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    max-width: 360px;
}

.phone__key {
    border: 2px solid rgba(20, 83, 45, 0.16);
    background: #fff;
    border-radius: 16px;
    font-size: 28px;
    font-weight: 700;
    color: var(--green-deep);
    padding: 16px 0;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.phone__key:active {
    background: #f0fdf4;
}

.phone__key--back {
    color: var(--ink-soft);
}

.phone__key--ok {
    background: var(--green-primary);
    border-color: var(--green-primary);
    color: #fff;
}

.phone__key--ok:disabled {
    opacity: 0.35;
    cursor: default;
}

/* Dimmed, but never disabled: tapping it on an unfinished number is how a
   farmer who cannot read finds out what is missing. */
.phone__key--ok-wait {
    opacity: 0.4;
}

/* The number just became valid. "Then press the green check" played nine taps
   ago, so the button repeats it on its own. */
.phone__key--ok-ready {
    animation: phone-beckon 1.7s ease-in-out infinite;
}

/* The farmer keyed something no number can start with: point at the key that
   can, rather than leave them hunting. */
.phone__key--hint {
    border-color: var(--green-primary);
    background: #f0fdf4;
    animation: phone-beckon 1.2s ease-in-out infinite;
}

@keyframes phone-beckon {
    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.5);
    }
    60% {
        box-shadow: 0 0 0 12px rgba(22, 163, 74, 0);
    }
}

/* Without motion the beckon becomes a standing ring: the farmer still needs
   to be told which key to press. */
@media (prefers-reduced-motion: reduce) {
    .phone__display--shake {
        animation: none;
    }

    .phone__key--ok-ready,
    .phone__key--hint {
        animation: none;
        box-shadow: 0 0 0 4px rgba(22, 163, 74, 0.35);
    }
}

/* --- enroll landing: phone confirmation ------------------------------------ */

/* The number is the whole screen here — no keypad competing with it. */
.phone__display--confirm {
    justify-content: center;
    padding: 24px 18px;
    margin-bottom: 24px;
}

/* Nothing left to count here — the number is whole, so it is just the digits,
   large and centred. */
.phone__number {
    font-size: 34px;
    font-weight: 800;
    letter-spacing: 0.04em;
    color: var(--green-deep);
}

.phone__choices {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    max-width: 360px;
}

.phone__choice {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    border: 2px solid rgba(20, 83, 45, 0.16);
    background: #fff;
    border-radius: 16px;
    padding: 18px 0;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.phone__choice-icon {
    font-size: 30px;
    line-height: 1;
}

.phone__choice-label {
    font-size: 18px;
    font-weight: 700;
    color: var(--green-deep);
}

.phone__choice--yes {
    background: var(--green-primary);
    border-color: var(--green-primary);
}

.phone__choice--yes .phone__choice-label {
    color: #fff;
}

.phone__choice--no {
    background: #fffbeb;
    border-color: var(--amber);
}

.phone__choice:disabled {
    opacity: 0.35;
    cursor: default;
}

/* --- enroll landing: boot (reload with a live session) --------------------- */

.boot {
    display: flex;
    justify-content: center;
    padding: 56px 0;
}

.boot__spinner {
    font-size: 44px;
    animation: boot-pulse 1.1s ease-in-out infinite;
}

@keyframes boot-pulse {
    0%,
    100% {
        opacity: 0.35;
    }
    50% {
        opacity: 1;
    }
}

@media (prefers-reduced-motion: reduce) {
    .boot__spinner {
        animation: none;
    }
}

/* --- enroll landing: pay step ---------------------------------------------- */

.pay {
    margin-top: 10px;
}

/* The sheet's back circle is white-on-tile; on the pay page's light
   background it needs its own contrast. */
.pay__back {
    background: #e8eaed;
    flex-shrink: 0;
}

.pay__chosen {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 12px 0 18px;
    padding: 12px 14px;
    background: var(--tile-bg, #f0fdf4);
    border: 2px solid var(--tile-rim, var(--green-primary));
    border-radius: 16px;
}

.pay__chosen-photo,
img.pay__chosen-photo {
    width: 64px;
    height: 64px;
    border-radius: 12px;
    object-fit: cover;
}

.pay__chosen-fallback {
    font-size: 44px;
    line-height: 1;
}

.pay__chosen-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.pay__chosen-name {
    font-size: 18px;
    font-weight: 700;
    color: var(--green-deep);
}

.pay__chosen-size {
    font-size: 14px;
    font-weight: 600;
    color: var(--ink-soft);
}

.pay__chosen-qty {
    font-size: 16px;
    font-weight: 700;
    color: var(--ink-soft);
}

.pay__button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    max-width: 440px;
    border: 0;
    border-radius: 20px;
    padding: 20px 16px;
    background: var(--green-primary);
    color: #fff;
    cursor: pointer;
    box-shadow: 0 8px 22px rgba(22, 163, 74, 0.35);
    animation: pay-pulse 2.4s ease-in-out infinite;
    -webkit-tap-highlight-color: transparent;
}

.pay__button-icon {
    font-size: 30px;
}

/* The Wave roundel sits on the green button inside a white ring so the
   brand blue keeps its contrast. */
img.pay__button-icon--wave {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #fff;
    padding: 2px;
    box-sizing: content-box;
}

.pay__button-label {
    font-size: 22px;
    font-weight: 800;
}

/* The Fayal lockup stands in for the "Payer" word on the button. */
img.pay__button-fayal {
    height: 48px;
    width: auto;
}

.pay__button-amount {
    font-size: 22px;
    font-weight: 800;
}

.pay__button--busy {
    opacity: 0.6;
    animation: none;
}

/* Shop-screen variant: shown when a selection already exists (reload /
   returned from Wave) so payment never requires re-selecting. */
.pay__button--cta {
    margin: 16px 0 6px;
}

.pay__error {
    margin-top: 14px;
}

@keyframes pay-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.03); }
}

@media (prefers-reduced-motion: reduce) {
    .pay__button { animation: none; }
}

/* --- language chooser (MPD-11098) ---------------------------------------- */

.lang {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
    max-width: 440px;
    margin: 18px auto 0;
}

.lang__option {
    border: 3px solid rgba(255, 255, 255, 0.9);
    background: rgba(255, 255, 255, 0.85);
    border-radius: 20px;
    padding: 22px 16px;
    cursor: pointer;
    text-align: center;
    -webkit-tap-highlight-color: transparent;
}

.lang__option-label {
    font-size: 26px;
    font-weight: 700;
    color: var(--ink);
}

.lang__option--active {
    border-color: var(--green-primary);
    background: #f0fdf4;
}

/* Same big green ✓ Valider as the package sheet — one confirm gesture
   across the whole page. Greyed until a language has been tapped. */
.lang__confirm {
    width: 100%;
    border: 0;
    background: var(--green-primary);
    color: var(--paper);
    border-radius: 18px;
    padding: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    cursor: pointer;
    font-family: inherit;
    margin-top: 10px;
    -webkit-tap-highlight-color: transparent;
}

.lang__confirm:disabled {
    opacity: 0.45;
    cursor: default;
}

.lang-chip {
    display: block;
    margin-left: auto;
    border: 1px solid rgba(17, 24, 39, 0.15);
    background: rgba(255, 255, 255, 0.8);
    border-radius: 999px;
    padding: 5px 12px;
    font-size: 14px;
    font-weight: 600;
    color: var(--ink-soft);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

/* --- enroll landing: village from location (MPD-11052) -------------------- */

.geo {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

/* The head is the only full-width child of a centred column. */
.geo .section-head {
    align-self: stretch;
}

.geo__mark {
    font-size: 76px;
    line-height: 1;
    margin: 18px 0 22px;
}

.geo__allow {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    max-width: 440px;
    border: 0;
    border-radius: 20px;
    padding: 20px 16px;
    background: var(--green-primary);
    color: #fff;
    font-family: inherit;
    cursor: pointer;
    box-shadow: 0 8px 22px rgba(22, 163, 74, 0.35);
    -webkit-tap-highlight-color: transparent;
}

.geo__allow-icon {
    font-size: 30px;
}

/* Precise fix, coarse retry, then the lookup: up to ~25s of waiting, which
   a frozen glyph reads as a dead button. Same pulse as the boot hourglass. */
.geo__allow-icon--busy {
    animation: boot-pulse 1.1s ease-in-out infinite;
}

.geo__allow-label {
    font-size: 22px;
    font-weight: 800;
}

.geo__allow:disabled {
    opacity: 0.45;
    cursor: default;
}

/* Deliberately quiet next to the green button: skipping is allowed, but
   sharing a position is the outcome that gets the farmer a real village. */
/* The escape hatch stays a full touch target: it is the only way off this
   screen while a permission bubble no callback will answer is open. */
.geo__skip {
    border: 0;
    background: none;
    margin-top: 18px;
    min-height: 48px;
    padding: 10px 14px;
    font-family: inherit;
    font-size: 17px;
    font-weight: 600;
    color: var(--ink-soft);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

@media (prefers-reduced-motion: reduce) {
    .geo__allow-icon--busy {
        animation: none;
    }
}

/* Compass, button and the way out must all sit above the fold on a 320px
   handset. */
@media (max-width: 380px) {
    .geo__mark {
        font-size: 56px;
        margin: 10px 0 16px;
    }
}

/* --- enroll landing: SMS verification wait (MPD-11163) ------------------- */

.verify {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.verify .section-head {
    align-self: stretch;
}

.verify__mark {
    font-size: 76px;
    line-height: 1;
    margin: 18px 0 22px;
}

.verify__ve {
    margin: 10px 0 2px;
    font-size: 22px;
    font-weight: 800;
    color: var(--green-deep);
}

#verify-resend {
    width: 100%;
    max-width: 440px;
    border: 0;
    border-radius: 20px;
    padding: 20px 16px;
    background: var(--green-primary);
    color: #fff;
    font-family: inherit;
    font-size: 22px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 8px 22px rgba(22, 163, 74, 0.35);
    -webkit-tap-highlight-color: transparent;
}

#verify-resend:disabled {
    opacity: 0.45;
    cursor: default;
}

#verify-giveup,
#verify-edit {
    border: 0;
    background: none;
    margin-top: 18px;
    min-height: 48px;
    padding: 10px 14px;
    font-family: inherit;
    font-size: 17px;
    font-weight: 600;
    color: var(--ink-soft);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

#verify-edit {
    text-decoration: underline;
    text-underline-offset: 4px;
}

.verify__number {
    margin: 0 0 16px;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: 0.03em;
    color: var(--ink-soft);
}

@media (max-width: 380px) {
    .verify__mark {
        font-size: 56px;
        margin: 10px 0 16px;
    }
}
