/* BEBO "Spin to Win" popup. Mobile first: centred card, 92% wide (max 420px), scrolls inside itself.
   Desktop (>= 768px): wheel on the left, content on the right. Colours come from the campaign (CSS variables). */
html.sw-lock, html.sw-lock body { overflow: hidden !important; overscroll-behavior: none; }

.sw-modal { container: sw / inline-size; position: fixed; inset: 0; z-index: 2050; display: flex; align-items: center; justify-content: center; padding: 12px; padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); opacity: 0; transition: opacity .25s ease; }
.sw-modal.is-open { opacity: 1; }
.sw-backdrop { position: absolute; inset: 0; background: rgba(28, 10, 18, .62); backdrop-filter: blur(2px); }

.sw-dialog {
    --sw-bg: #fde8ef; --sw-text: #3b1424; --sw-accent: #dd3872;
    position: relative; width: min(92vw, 420px); max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px);
    display: flex; flex-direction: column; border-radius: 22px; overflow: hidden; color: var(--sw-text);
    background: var(--sw-bg); box-shadow: 0 24px 60px -12px rgba(28, 10, 18, .45); outline: none;
    transform: translateY(14px) scale(.97); transition: transform .3s cubic-bezier(.2, .8, .2, 1);
    font-family: inherit; text-align: center;
}
.sw-dialog.has-bg-image { background-image: var(--sw-bg-image); background-size: cover; background-position: center; }
.sw-modal.is-open .sw-dialog { transform: none; }
.sw-scroll { overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding: 20px 18px 18px; display: grid; gap: 12px; grid-template-areas: "head" "wheel" "body"; min-width: 0; }

.sw-close { position: absolute; top: 8px; right: 8px; z-index: 3; width: 44px; height: 44px; border-radius: 50%; border: 0; display: grid; place-items: center; background: rgba(255, 255, 255, .92); color: var(--sw-text); box-shadow: 0 4px 12px rgba(0, 0, 0, .12); cursor: pointer; }
.sw-close:hover { background: #fff; color: var(--sw-accent); }
.sw-close:focus-visible, .sw-btn:focus-visible, .sw-copy:focus-visible, .sw-input:focus-visible { outline: 3px solid var(--sw-accent); outline-offset: 2px; }

.sw-head { grid-area: head; padding: 0 40px; min-width: 0; }
.sw-title { margin: 0; font-size: clamp(1.35rem, 1.1rem + 1.6vw, 2rem); font-weight: 800; line-height: 1.15; color: var(--sw-text); overflow-wrap: anywhere; }
.sw-sub { margin: 6px 0 0; font-size: .92rem; opacity: .85; overflow-wrap: anywhere; }

.sw-wheel-col { grid-area: wheel; display: flex; justify-content: center; min-width: 0; }
.sw-wheel { position: relative; width: min(100%, 300px, 44vh); width: min(100%, 300px, 44dvh); aspect-ratio: 1 / 1; flex-shrink: 0; }
.sw-svg { display: block; width: 100%; height: 100%; filter: drop-shadow(0 10px 18px rgba(28, 10, 18, .18)); overflow: visible; }
.sw-svg text { font-family: inherit; user-select: none; }
.sw-rotor { transform-box: view-box; transform-origin: 150px 150px; will-change: transform; }
.sw-pointer { position: absolute; top: -6px; left: 50%; width: 26px; height: 34px; transform: translateX(-50%); background: var(--sw-accent); clip-path: polygon(50% 100%, 0 30%, 15% 8%, 50% 0, 85% 8%, 100% 30%); filter: drop-shadow(0 3px 3px rgba(0, 0, 0, .25)); z-index: 2; }

.sw-body { grid-area: body; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.sw-gift { display: none; }
.sw-gift img, .sw-gift-svg { display: block; width: 100%; max-height: 150px; object-fit: contain; margin: 0 auto; }

.sw-form { display: grid; gap: 6px; text-align: left; }
.sw-form[hidden] { display: none; }
.sw-label { font-size: .8rem; font-weight: 700; margin-top: 2px; }
.sw-opt { font-weight: 500; opacity: .7; }
.sw-input { width: 100%; min-height: 46px; border: 1.5px solid rgba(0, 0, 0, .12); border-radius: 12px; padding: 10px 14px; font-size: 16px; background: #fff; color: #1f1f1f; }
.sw-input.is-invalid { border-color: #dc2626; background: #fff5f5; }
.sw-error { min-height: 0; margin: 0; color: #b91c1c; font-size: .84rem; font-weight: 600; }
.sw-error:empty { display: none; }
.sw-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.sw-btn { display: inline-flex; align-items: center; justify-content: center; width: 100%; min-height: 50px; border: 0; border-radius: 14px; padding: 12px 18px; font-size: 1.1rem; font-weight: 800; color: #fff; background: var(--sw-accent); box-shadow: 0 10px 22px -10px var(--sw-accent); text-decoration: none; cursor: pointer; transition: transform .15s, filter .15s; }
.sw-btn:hover { filter: brightness(1.06); color: #fff; transform: translateY(-1px); }
.sw-btn:disabled { opacity: .7; cursor: progress; transform: none; }
.sw-btn-light { background: #fff; color: var(--sw-text); box-shadow: none; border: 1.5px solid rgba(0, 0, 0, .1); font-size: 1rem; }
.sw-btn-light:hover { color: var(--sw-text); }
.sw-fine { margin: 2px 0 0; font-size: .72rem; opacity: .7; text-align: center; }

.sw-result { display: grid; gap: 8px; }
.sw-result[hidden] { display: none; }
.sw-r-title { margin: 0; font-size: 1.4rem; font-weight: 800; outline: none; }
.sw-r-prize { margin: 0; font-size: 1.6rem; font-weight: 800; color: var(--sw-accent); }
.sw-r-message { margin: 0; font-size: .92rem; }
.sw-ticket { background: #fff; border: 2px dashed var(--sw-accent); border-radius: 14px; padding: 10px 12px; color: #1f1f1f; }
.sw-ticket[hidden] { display: none; }
.sw-ticket-label { display: block; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; opacity: .7; }
.sw-ticket-row { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; margin: 4px 0; }
.sw-code { font-size: 1.3rem; font-weight: 800; letter-spacing: .08em; color: var(--sw-accent); background: none; user-select: all; }
.sw-copy { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 8px 14px; border-radius: 999px; border: 1.5px solid var(--sw-accent); background: #fff; color: var(--sw-accent); font-weight: 700; font-size: .85rem; cursor: pointer; }
.sw-copy:hover { background: var(--sw-accent); color: #fff; }
.sw-expiry { margin: 0; font-size: .76rem; opacity: .8; }
.sw-actions { display: grid; gap: 8px; }
.sw-actions [hidden] { display: none; }
.sw-modal.is-win .sw-wheel { animation: swPulse 1.2s ease 1; }
@keyframes swPulse { 50% { transform: scale(1.03); } }

/* Phones in landscape / short screens: smaller wheel, everything still scrolls inside the card. */
@media (max-height: 520px) and (max-width: 991.98px) {
    .sw-scroll { grid-template-areas: "head head" "wheel body"; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: center; }
    .sw-dialog { width: min(94vw, 680px); }
    .sw-wheel { width: min(100%, 72vh); width: min(100%, 72dvh); }
}

/* Tablet / desktop: wheel left, content right (like the reference). A container query, so the admin preview can
   show both layouts; on the storefront the container is the whole screen (minus 24px padding). */
@container sw (min-width: 744px) {
    .sw-dialog { width: min(92vw, 820px); border-radius: 26px; }
    .sw-scroll { grid-template-areas: "wheel head" "wheel body"; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); grid-template-rows: auto 1fr; align-items: center; column-gap: 26px; padding: 30px 30px 26px; }
    .sw-head { padding: 0 34px 0 0; text-align: left; align-self: end; }
    .sw-wheel { width: min(100%, 360px, 62vh); width: min(100%, 360px, 62dvh); }
    .sw-body { align-self: start; }
    .sw-gift { display: block; }
    .sw-result { text-align: left; }
    .sw-ticket-row { justify-content: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
    .sw-modal, .sw-dialog, .sw-btn { transition: none; }
    .sw-modal.is-win .sw-wheel { animation: none; }
}

/* Admin live preview: same card, rendered in the page instead of fixed over it. */
.sw-modal.is-preview { position: relative; inset: auto; z-index: 1; padding: 0; opacity: 1; display: block; }
.sw-modal.is-preview .sw-dialog { width: 100%; max-height: none; transform: none; box-shadow: 0 10px 30px -12px rgba(28, 10, 18, .35); }
.sw-modal.is-preview .sw-close { pointer-events: none; }
