.hero{
    position:relative;
    text-align:center;
    color:#fff;
    padding:6px 0 150px;
    background:linear-gradient(
        180deg,
        var(--color-red-dark) 0%,
        var(--color-red) 55%,
        rgba(236,232,224,0) 100%
    );
}

.status{
    display:inline-block;
    background:rgba(255,255,255,.15);
    padding:6px 14px;
    border-radius:20px;
    font-size:10px;
    letter-spacing:.5px;
    margin-bottom:18px;
    backdrop-filter:blur(5px);
}

.banner{
    position:relative;
    width:100%;
    margin:0 0 22px;
    aspect-ratio:12/5;
    overflow:hidden;
    background:
        radial-gradient(circle at 20% 25%, rgba(255,255,255,.15), transparent 45%),
        linear-gradient(180deg, var(--color-red-dark) 0%, var(--color-red) 60%, var(--color-navy) 150%);
}

.banner-img{
    width:100%;
    height:100%;
    object-fit:contain;
    object-position:center;
    padding:18px;
    display:block;
    filter:drop-shadow(0 12px 20px rgba(0,0,0,.3));
}

.status .dot{
    color:var(--color-blue-light);
}

.subtitle{
    letter-spacing:3px;
    font-size:12px;
    opacity:.9;
    margin-bottom:16px;
}

.hero h1{
    font-size:2.9rem;
    font-weight:800;
    line-height:1.15;
    direction:rtl;
    margin-bottom:18px;
}

.hero h1 .blue{
    color:var(--color-blue-light);
    direction:ltr;
    display:inline-block;
}

.small{
    margin-top:0;
    font-size:14px;
    opacity:.95;
}

.prize-box{
    width:220px;
    margin:36px auto 0;
    background:var(--color-blue-light);
    color:var(--color-red-dark);
    border-radius:22px;
    padding:20px;
    box-shadow:0 10px 25px rgba(0,0,0,.2);
}

.prize-box-image{
    display:block;
    max-width:100%;
    max-height:120px;
    object-fit:contain;
    margin:0 auto 6px;
    border-radius:12px;
}

/* A dedicated prize photo (Textes tab) replaces the "500 DH" text badge —
   the blue card behind it is dropped too, so only the photo itself shows,
   same as how the banner/logo images are never boxed in. */
.prize-box.has-image{
    background:none;
    box-shadow:none;
    padding:0;
}

.prize-box h2{
    font-size:2.6rem;
    font-weight:800;
}

.prize-box p{
    color:#fff;
    font-size:13px;
    margin-top:4px;
}

/* ---------- Steps ---------- */

.steps{
    display:flex;
    justify-content:center;
    gap:12px;
    padding:0 22px;
    margin:-20px 0 34px;
    position:relative;
    z-index:2;
}

.step{
    flex:1;
    background:rgba(255,255,255,.5);
    border:1px solid rgba(255,255,255,.6);
    backdrop-filter:blur(10px);
    border-radius:18px;
    text-align:center;
    padding:18px 10px;
    box-shadow:0 5px 20px rgba(0,0,0,.08);
}

.circle{
    width:30px;
    height:30px;
    border-radius:50%;
    background:var(--color-blue-light);
    color:var(--color-red-dark);
    margin:0 auto 8px;
    display:flex;
    justify-content:center;
    align-items:center;
    font-weight:700;
    font-size:14px;
}

.step p{
    color:#333;
    font-size:11.5px;
    line-height:1.3;
}

/* ---------- Form ---------- */

.form-section{
    padding:38px 26px 26px;
    text-align:center;
}

.form-section h3{
    color:var(--color-text);
    margin-bottom:28px;
    font-size:22px;
    font-weight:700;
    line-height:1.4;
}

/* ---------- Tirage au sort confirmation ----------
   Replaces the whole form after a successful registration on a raffle
   campaign. Colours are fixed dark-on-light rather than pulled from the
   campaign theme on purpose: this card sits on the white form area, and
   theme colours here have twice produced unreadable text (the invisible
   "Retour" button, the near-white form heading). */

.raffle-done[hidden]{
    display:none;
}

.raffle-done{
    text-align:center;
    padding:32px 22px 28px;
    border-radius:20px;
    background:#f7f9fc;
    border:1px solid #e6ebf2;
}

.raffle-done-title{
    font-size:22px;
    font-weight:800;
    line-height:1.3;
    color:#1b1b1b;
    margin-bottom:14px;
}

.raffle-done-body{
    font-size:15px;
    line-height:1.65;
    color:#444;
    margin-bottom:12px;
}

.raffle-done-note{
    font-size:15px;
    line-height:1.65;
    font-weight:600;
    color:#1b1b1b;
}

.ticket-upload{
    position:relative;
    margin-bottom:22px;
}

.ticket-btn{
    position:relative;
    width:100%;
    min-height:58px;
    border:none;
    border-radius:18px;
    background:linear-gradient(90deg,var(--color-blue-light),var(--color-blue));
    color:#fff;
    cursor:pointer;
    overflow:hidden;
    transition:.3s;
    box-shadow:0 6px 15px rgba(39,167,255,.35);
    display:flex;
    align-items:center;
    justify-content:center;
    padding:16px;
}

.ticket-btn:hover{
    transform:translateY(-2px);
}

/* The uploaded photo fills the entire button, not just a small corner of it */
.ticket-btn-img{
    position:absolute;
    inset:0;
    width:100%;
    height:100%;
    object-fit:cover;
}

.ticket-btn:disabled{
    cursor:not-allowed;
    opacity:.85;
}

.ticket-btn-spinner{
    position:relative;
    width:20px;
    height:20px;
    border:3px solid rgba(255,255,255,.35);
    border-top-color:#fff;
    border-radius:50%;
    animation:spin .8s linear infinite;
    margin-right:10px;
    z-index:1;
    flex-shrink:0;
}

.ticket-btn-text{
    position:relative;
    font-size:15px;
    font-weight:700;
    z-index:1;
}

.ticket-btn.has-file{
    min-height:132px;
    background:#0b1220;
    align-items:flex-end;
    justify-content:flex-start;
    padding:0;
}

.ticket-btn.has-file .ticket-btn-text{
    width:100%;
    text-align:left;
    padding:12px 44px 12px 14px;
    background:linear-gradient(0deg, rgba(0,0,0,.75) 0%, rgba(0,0,0,0) 100%);
    font-size:12.5px;
    font-weight:600;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
}

.ticket-remove{
    position:absolute;
    top:10px;
    right:10px;
    width:28px;
    height:28px;
    border-radius:50%;
    border:none;
    background:rgba(0,0,0,.55);
    color:#fff;
    font-size:16px;
    line-height:1;
    cursor:pointer;
    display:flex;
    align-items:center;
    justify-content:center;
    transition:.2s;
    z-index:2;
}

.ticket-remove:hover{
    background:#ef4444;
}

.ticket-remove[hidden]{
    display:none;
}

.ticket-error{
    color:#ef4444;
    font-size:12px;
    margin-top:-12px;
    margin-bottom:14px;
    text-align:left;
    display:none;
}

.ticket-error.show{
    display:block;
}

#formError{
    text-align:center;
}

.field{
    position:relative;
    margin-bottom:18px;
}

.hint{
    display:block;
    text-align:left;
    font-size:11px;
    color:#999;
    margin:-12px 0 16px 4px;
}

.field .icon{
    position:absolute;
    left:16px;
    top:50%;
    transform:translateY(-50%);
    font-size:15px;
    opacity:.55;
    pointer-events:none;
}

/* font-size MUST stay >= 16px. iOS Safari force-zooms the whole page when a
   focused input is smaller than that, and never zooms back out on blur — the
   page ends up wider than the screen and pans sideways for the rest of the
   visit. Desktop Chrome at a 375px viewport shows nothing wrong, so this only
   ever reproduces on a real iPhone. Don't "tidy" this back down to 14.5px. */
#registerForm input,
#registerForm select{
    width:100%;
    padding:16px 16px 16px 42px;
    border-radius:14px;
    border:1px solid #ddd;
    font-size:16px;
    outline:none;
    transition:.3s;
    background:#fafafa;
    color:#333;
}

#registerForm select{
    appearance:none;
    -webkit-appearance:none;
}

#registerForm input:focus,
#registerForm select:focus{
    border-color:var(--color-blue);
    box-shadow:0 0 0 4px rgba(58,181,242,.15);
    background:#fff;
}

.row{
    display:flex;
    gap:10px;
}

.row .field{
    flex:1;
}

.submit-btn{
    margin-top:10px;
}

.consent-check{
    display:flex;
    align-items:flex-start;
    gap:10px;
    margin-top:22px;
    font-size:12px;
    color:#555;
    line-height:1.5;
    cursor:pointer;
    border-radius:8px;
    padding:6px;
    margin-inline:-6px;
    transition:background-color .15s ease;
}

#registerForm #cguConsent{
    flex-shrink:0;
    width:18px;
    height:18px;
    margin-top:1px;
    padding:0;
    accent-color:var(--color-red);
    cursor:pointer;
}

.consent-check > span{
    flex:1 1 auto;
    min-width:0;
}

.consent-check a{
    color:var(--color-blue);
    font-weight:600;
    text-decoration:none;
}

.consent-check a:hover{
    text-decoration:underline;
}

.consent-check.invalid{
    background-color:rgba(226,0,26,.08);
    color:var(--color-red);
}

.consent-sub{
    padding-bottom:6px;
    font-size:11px;
    color:#999;
    line-height:1.5;
}

.consent-sub a{
    color:var(--color-blue);
    text-decoration:none;
}

.staff-link{
    display:block;
    text-align:center;
    margin-top:18px;
    font-size:11px;
    color:var(--color-blue);
    opacity:.7;
    text-decoration:none;
}

.staff-link:hover{
    text-decoration:underline;
    opacity:1;
}

/* ---------- Precise polish ---------- */

.status .dot{
    display:inline-block;
    animation:dotPulse 1.6s ease-in-out infinite;
}

@keyframes dotPulse{
    0%,100%{opacity:1;}
    50%{opacity:.35;}
}

.prize-box{
    background:linear-gradient(155deg,var(--color-blue-light),var(--color-blue));
}

/* ---------- RTL ---------- */

[dir="rtl"] .subtitle{
    letter-spacing:normal;
}

[dir="rtl"] .hint{
    text-align:right;
    margin:-12px 4px 16px 0;
}

[dir="rtl"] .field .icon{
    left:auto;
    right:16px;
}

[dir="rtl"] #registerForm input,
[dir="rtl"] #registerForm select{
    padding:16px 42px 16px 16px;
}

[dir="rtl"] .ticket-error{
    text-align:right;
}

[dir="rtl"] .ticket-btn.has-file .ticket-btn-text{
    text-align:right;
    padding:12px 14px 12px 44px;
}

[dir="rtl"] .ticket-remove{
    right:auto;
    left:10px;
}

[dir="rtl"] .ticket-btn-spinner{
    margin-right:0;
    margin-left:10px;
}

/* ---------- Desktop ----------
   Same top-to-bottom flow as mobile (header, hero, steps, form) — just a
   wider, roomier version people scroll through, not a split layout. */

@media(min-width:900px){
    .hero{
        padding:24px 0 90px;
    }

    .hero h1{
        font-size:4.2rem;
    }

    .subtitle{
        font-size:13px;
    }

    .banner{
        width:100%;
        margin:0 0 28px;
        aspect-ratio:auto;
        height:420px;
    }

    .banner-img{
        padding:40px;
    }

    .small{
        font-size:16px;
    }

    .prize-box{
        width:300px;
        padding:24px;
    }

    .prize-box h2{
        font-size:3rem;
    }

    .steps{
        max-width:1100px;
        margin:-45px auto 70px;
        padding:0 max(24px, calc((100% - 1100px) / 2));
        gap:24px;
    }

    .step{
        padding:24px 16px;
    }

    .step p{
        font-size:14px;
    }

    .form-section{
        max-width:780px;
        margin:0 auto;
        padding:20px 24px 70px;
    }

    .form-section h3{
        font-size:28px;
    }
}

/* ---------- CGU / Politique de confidentialité modal ---------- */

.legal-overlay{
    position:fixed;
    inset:0;
    background:rgba(0,20,40,.55);
    display:flex;
    align-items:center;
    justify-content:center;
    padding:20px;
    z-index:1000;
}

.legal-overlay[hidden]{
    display:none;
}

.legal-modal{
    background:#fff;
    border-radius:18px;
    max-width:640px;
    width:100%;
    max-height:80vh;
    padding:32px 28px 28px;
    position:relative;
    box-shadow:0 15px 40px rgba(0,0,0,.25);
    display:flex;
    flex-direction:column;
    transition:max-width .15s ease;
}

.legal-modal:has(.legal-rich){
    max-width:760px;
}

.legal-close{
    position:absolute;
    top:14px;
    inset-inline-end:16px;
    background:none;
    border:none;
    font-size:26px;
    line-height:1;
    color:#999;
    cursor:pointer;
    padding:4px;
}

.legal-close:hover{
    color:var(--color-red);
}

.legal-title{
    font-size:20px;
    color:var(--color-navy);
    margin:0 0 16px;
    padding-inline-end:24px;
}

.legal-body{
    font-size:13px;
    line-height:1.7;
    color:var(--color-text);
    white-space:pre-line;
    overflow-y:auto;
}

/* The règlement/CGU document (js/legal.js's renderLegalDocument) is real
   HTML, not a single pre-formatted string like the privacy policy — drop
   the pre-line whitespace handling so its own <p>/<ul>/<table> spacing
   controls the layout instead. */
.legal-body.legal-rich{
    white-space:normal;
}
