:root {
    --bg: #f7f2e9;
    --panel: #ffffff;
    --ink: #1d2a2f;
    --accent: #bd2f2f;
    --accent-ink: #ffffff;
    --border: #dfd7c9;
    --bg-image-desktop: none;
    --bg-image-desktop-hd: none;
    --bg-image-tablet: none;
    --bg-image-mobile: none;
}

* {
    box-sizing: border-box;
}

/* Body: struttura flex, nessuna immagine di sfondo (footer su sfondo pieno) */
body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: "Trebuchet MS", "Segoe UI", sans-serif;
    color: var(--ink);
    background-color: var(--bg);
}

/* Solo immagine, stirata al 100% in larghezza e altezza (può deformarsi). Nessun gradiente. */
.site-canvas {
    flex: 0 0 auto;
    width: 100%;
    aspect-ratio: 1920 / 1082;
    background-image: var(--bg-image-desktop);
    background-repeat: no-repeat;
    background-position: center top;
    background-size: 100% auto;
    background-attachment: scroll;
}

.site-main {
    background: transparent;
    width: 100%;
    margin: 0 auto;
    padding-left: clamp(12px, 3vw, 32px);
    padding-right: clamp(12px, 3vw, 32px);
    max-width: 1200px;
}

@media (min-width: 1400px) {
    .site-main {
        max-width: 1280px;
    }
}

@media (max-width: 575.98px) {
    .site-main {
        padding-left: 12px;
        padding-right: 12px;
        padding-top: 16px;
        padding-bottom: 20px;
    }
}

@media (max-width: 767.98px) and (orientation: portrait) {
    .site-main {
        padding-top: 16px;
    }

    .hero {
        margin-top: 88px;
        padding: 12px;
    }

    .campaign-logo {
        max-width: 520px;
    }

    .calendar-wrap {
        margin-top: 16px;
        max-width: 260px;
        padding: 10px;
    }
}

/* Mobile (≤ 767.98px) */
@media (max-width: 767.98px) {
    .site-canvas {
        background-image: var(--bg-image-mobile);
        background-position: center top;
        background-size: 100% auto;
        background-attachment: scroll;
        aspect-ratio: 1086 / 4040;
    }
}

@media (max-width: 767.98px) and (orientation: landscape) {
    .site-canvas {
        background-image: var(--bg-image-mobile-landscape, var(--bg-image-mobile));
        background-position: center top;
        background-size: 100% auto;
        background-attachment: scroll;
        aspect-ratio: 2000 / 2800;
    }
}

/* Tablet (768px - 1199px) */
@media (min-width: 768px) and (max-width: 1199px) {
    .site-canvas {
        background-image: var(--bg-image-tablet);
        background-position: center top;
        background-size: 100% auto;
        background-attachment: scroll;
        aspect-ratio: 1538 / 2048;
    }
}

@media (min-width: 768px) and (max-width: 1199px) and (orientation: portrait) {
    .site-canvas {
        background-size: 100% auto;
        background-position: center top;
    }
}

/* Desktop standard (1200px - 1919px) */
@media (min-width: 1200px) and (max-width: 1919px) {
    .site-canvas {
        background-image: var(--bg-image-desktop);
        background-position: center top;
        background-size: 100% auto;
        background-attachment: scroll;
        aspect-ratio: 1920 / 1082;
    }
}

/* Desktop grande 1920x1080 (1920px - 2559px) */
@media (min-width: 1920px) and (max-width: 2559px) {
    .site-canvas {
        background-image: var(--bg-image-desktop);
        background-position: center top;
        background-size: 100% auto;
        background-attachment: scroll;
        aspect-ratio: 1920 / 1082;
    }
}

/* Desktop grande / Ultrawide (≥ 2560px) */
@media (min-width: 2550px) {
    .site-canvas {
        background-image: var(--bg-image-desktop-hd);
        background-position: center top;
        background-size: 100% auto;
        background-attachment: scroll;
        aspect-ratio: 2550 / 1444;
    }

    .hero {
        margin-top: 120px;
    }

    .campaign-logo {
        max-width: 820px;
    }

    .calendar-wrap {
        margin-top: 48px;
        max-width: 680px;
    }
}

.page {
    max-width: 1100px;
    margin: 0 auto;
    padding: 24px;
}

.hero {
    background: transparent;
    border: 0;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.campaign-logo {
    display: block;
    width: 100%;
    max-width: 460px;
    height: auto;
}

.calendar-wrap {
    max-width: 500px;
    margin: 0 auto 24px;
    padding: 18px 14px;
}

@media (min-width: 1200px) {
    .calendar-wrap {
        max-width: 360px;
    }
}

@media (min-width: 1200px) and (max-width: 1399.98px) {
    .calendar-wrap {
        margin-top: -55px;
        max-width: 300px;
    }
}

@media (min-width: 768px) and (max-width: 1199px) and (orientation: portrait) {
    .calendar-wrap {
        max-width: 400px;
        padding: 12px;
    }

    .hero {
        margin-top: 72px;
    }
}

@media (min-width: 1024px) and (max-width: 1199.98px) and (orientation: portrait) {
    .hero {
        margin-top: 120px;
    }

    .campaign-logo {
        max-width: 560px;
    }

    .calendar-wrap {
        margin-top: 24px;
        max-width: 460px;
    }
}

@media (min-width: 768px) and (max-width: 1199px) and (orientation: landscape) {
    .calendar-wrap {
        margin-top: 24px;
        max-width: 400px;
        padding: 12px;
    }

    .hero {
        margin-top: 120px;
    }
}

@media (min-width: 768px) and (max-width: 1199px) and (max-height: 430px) and (orientation: landscape) {
    .calendar-wrap {
        max-width: 320px;
        padding: 10px;
    }
}

@media (max-width: 575.98px) {
    .calendar-wrap {
        width: 100%;
        max-width: 320px;
        padding: 6px;
    }
}

@media (max-width: 767.98px) and (max-height: 430px) and (orientation: landscape) {
    .calendar-wrap {
        margin: -20px auto 24px;
        max-width: 360px;
        padding: 8px;
    }
}

@media (max-width: 767.98px) and (orientation: landscape) {
    .hero {
        margin-top: 52px;
    }

    .campaign-logo {
        max-width: 360px;
    }
}

.prize-fallback {
    max-width: 860px;
    margin: 0 auto 24px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.9);
    padding: 16px;
}

.prize-actions {
    display: flex;
    justify-content: flex-start;
    margin-bottom: 8px;
}

.prize-back {
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    line-height: 1;
}

@media (min-width: 768px) {
    .prize-back {
        min-width: 180px;
        height: auto;
        padding: 6px 12px;
        font-size: 14px;
    }
}

.prize-divider {
    border: 0;
    border-top: 1px solid var(--border);
    margin: 8px 0 12px;
}

.prize-modal-content {
    border-radius: 14px;
    border-color: #e3d6bf;
}

.prize-image {
    width: 100%;
    max-width: 260px;
    height: auto;
    object-fit: cover;
    border-radius: 10px;
    border: 1px solid #d8c6a7;
    display: block;
    margin: 0 auto 12px;
}

.prize-fallback .prize-image {
    border: 0;
    border-radius: 0;
}

#prize-modal .modal-body {
    padding: 16px;
}

#prize-modal .prize-image {
    max-width: 260px;
    margin: 0 auto;
    border: 0;
    border-radius: 0;
}

.prize-content {
    min-width: 0;
}

.prize-status {
    margin: 0 0 10px;
}

.prize-status.is-loading {
    color: #1d2a2f;
}

.prize-status.is-error {
    color: #a41919;
    font-weight: 700;
}

.prize-title {
    margin: 0 0 4px;
    font-size: 18px;
}

.prize-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 4px;
}

.prize-day-icon {
    width: 54px;
    height: 54px;
    object-fit: cover;
    border-radius: 6px;
    border: 0;
    flex: 0 0 auto;
}

.prize-description {
    margin: 0;
}

.prize-barcode-wrap {
    margin-top: 10px;
    padding: 8px;
    background: #fff;
    border: 0;
    border-radius: 0;
}

.prize-barcode {
    display: block;
    width: 100%;
    max-width: 220px;
    height: auto;
    margin: 0 auto;
}

@media (max-width: 560px) {
    .prize-image {
        max-width: 220px;
    }
}

.site-footer {
    margin-top: 0;
    padding: 20px 0 28px;
    color: #5f665d;
    font-size: 14px;
    background: var(--bg);
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
    align-items: start;
    max-width: 860px;
    margin: 0 auto;
    padding: 0 12px;
}

.footer-col p {
    margin: 0;
    line-height: 1.35;
}

.footer-heading {
    font-weight: 700;
    letter-spacing: 0.02em;
    color: #0f4e42;
    margin-bottom: 6px !important;
}

.footer-left p + p {
    margin-top: 4px;
}

.footer-center {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
}

.footer-center a {
    color: #0f4e42;
    text-decoration: none;
    font-weight: 500;
}

.footer-center a:hover {
    text-decoration: underline;
}

.footer-right {
    text-align: right;
}

.footer-right p + p {
    margin-top: 2px;
}

.footer-spacer {
    margin-top: 10px !important;
}

@media (max-width: 900px) {
    .footer-grid {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 12px;
    }

    .footer-right {
        text-align: center;
    }

    .footer-center {
        align-items: center;
    }
}

@media (min-width: 901px) {
    .footer-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        justify-items: center;
    }

    .footer-left,
    .footer-right {
        text-align: center;
    }
}

@media (max-width: 575.98px) {
    .site-footer {
        padding: 16px 0 20px;
    }

    .footer-grid {
        max-width: 100%;
        padding: 0 16px;
    }

    .footer-col p {
        line-height: 1.4;
        word-break: break-word;
    }
}

@media (max-width: 767.98px) and (orientation: portrait) {
    .calendar-wrap {
        max-width: 260px !important;
    }
}

@media (min-width: 2550px) {
    .site-main {
        max-width: 1800px !important;
    }

    .page {
        max-width: 1800px !important;
    }

    .campaign-logo {
        max-width: 740px !important;
    }

    .calendar-wrap {
        max-width: 520px !important;
        margin-top: -26px;
    }
}

@media (max-width: 767.98px) {
    .hero {
        margin-top: 44px !important;
    }

    .calendar-wrap {
        margin-top: -8px !important;
    }
}

/* Desktop standard (1200px - 1919px) - posizione calendario */
@media (min-width: 1200px) and (max-width: 1919px) {
    .calendar-wrap {
        margin-top: -40px !important;
        max-width: 320px !important;
        padding: 12px !important;
    }
}

/* Tablet landscape (768px - 1199px) - override finale */
@media (min-width: 768px) and (max-width: 1199px) and (orientation: landscape) {
    .hero {
        margin-top: 120px !important;
    }

    .campaign-logo {
        max-width: 580px !important;
    }

    .calendar-wrap {
        margin-top: 24px !important;
        max-width: 520px !important;
        padding: 16px !important;
    }
}

@media (min-width: 768px) and (max-width: 1199px) and (max-height: 430px) and (orientation: landscape) {
    .calendar-wrap {
        max-width: 400px !important;
        padding: 10px !important;
    }
}
    .hero {
        margin-top: -12px;
    }
