/* Spin & Win widget. Uses the PrimeHost theme tokens (styles.css :root) with fallbacks for other themes. */
.sw {
    --sw-accent: #116AF9;
    --sw-accent-2: #20BCED;
    --sw-label: #FFFFFF;
    position: relative;
    color: var(--text-primary, #fff);
    background: var(--bg-card, #0A1A47);
    border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.08));
    border-radius: var(--radius-lg, 24px);
    box-shadow: var(--glass-box-shadow, 0 8px 24px rgba(1, 6, 24, 0.35));
    padding: 40px;
    overflow: hidden;
}
.sw::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(520px 320px at 0% 0%, color-mix(in srgb, var(--sw-accent) 22%, transparent), transparent 70%),
        radial-gradient(420px 300px at 100% 100%, color-mix(in srgb, var(--sw-accent-2) 14%, transparent), transparent 70%);
    pointer-events: none;
}
.sw-grid {
    position: relative;
    display: grid;
    grid-template-columns: minmax(240px, 340px) 1fr;
    gap: 44px;
    align-items: center;
}

/* Wheel */
.sw-wheel-wrap {
    position: relative;
    width: 100%;
    max-width: 340px;
    aspect-ratio: 1 / 1;
    margin: 0 auto;
    filter: drop-shadow(0 18px 30px rgba(1, 6, 24, 0.55));
}
.sw-wheel {
    display: block;
    width: 100%;
    height: 100%;
    transform-origin: 50% 50%;
    will-change: transform;
}
.sw-ring { fill: var(--bg-darker, #020A24); stroke: var(--sw-accent-2); stroke-width: 2; }
.sw-seg { stroke: var(--bg-darker, #020A24); stroke-width: 0.8; }
.sw-seg-alt { filter: brightness(0.86); }
.sw-seg-label {
    fill: var(--sw-label);
    font-family: 'Archivo', 'Inter', sans-serif;
    font-weight: 800;
    letter-spacing: 0.02em;
    paint-order: stroke;
    stroke: rgba(2, 10, 36, 0.45);
    stroke-width: 1.4px;
}
.sw-pointer {
    position: absolute;
    top: -6px;
    left: 50%;
    z-index: 2;
    width: 0;
    height: 0;
    transform: translateX(-50%);
    border-left: 15px solid transparent;
    border-right: 15px solid transparent;
    border-top: 30px solid #fff;
    filter: drop-shadow(0 3px 4px rgba(1, 6, 24, 0.6));
}
.sw-hub {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 2;
    width: 16%;
    height: 16%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, #fff, var(--sw-accent-2) 45%, var(--sw-accent) 100%);
    border: 3px solid var(--bg-darker, #020A24);
}

/* Chances and terms under the wheel */
.sw-wheel-col { min-width: 0; }
.sw-odds-title { margin: 18px 0 6px; font-size: 0.78rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; text-align: center; color: var(--text-dim, #7D8DB3); }
.sw-odds { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 14px; margin: 0; padding: 0; list-style: none; font-size: 0.85rem; color: var(--text-secondary, #B4C0DB); }
.sw-odds li { display: inline-flex; align-items: center; gap: 6px; }
.sw-odds strong { color: #fff; }
.sw-odds-dot { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.sw-terms-link { margin: 12px 0 0; text-align: center; font-size: 0.85rem; }
.sw-terms-link a { color: var(--brand-sky, #20BCED); text-decoration: underline; }

/* Text and panels */
.sw-body { min-width: 0; }
.sw .eyebrow { margin-bottom: 10px; }
.sw-title {
    font-size: clamp(1.7rem, 3.4vw, 2.4rem);
    font-weight: 900;
    line-height: 1.08;
    margin: 0 0 12px;
    color: #fff;
}
.sw-subtitle { font-size: 1.35rem; font-weight: 900; margin: 0 0 12px; color: #fff; }
.sw-subtitle:focus { outline: none; }
.sw-text { color: var(--text-secondary, #B4C0DB); margin: 0 0 18px; }
.sw-panel[hidden] { display: none !important; }
.sw-panel-center { text-align: left; }
.sw-icon {
    display: inline-grid;
    place-items: center;
    width: 52px;
    height: 52px;
    border-radius: 14px;
    margin-bottom: 14px;
    background: color-mix(in srgb, var(--sw-accent) 22%, transparent);
    color: var(--sw-accent-2);
    font-size: 1.4rem;
}

.sw-form { display: grid; gap: 12px; }
.sw-label { font-weight: 600; font-size: 0.95rem; color: #fff; }
.sw-input {
    width: 100%;
    min-height: 52px;
    padding: 12px 16px;
    font: inherit;
    font-size: 1rem;
    color: #fff;
    background: var(--bg-darker, #020A24);
    border: 1.5px solid rgba(255, 255, 255, 0.16);
    border-radius: 12px;
    transition: var(--transition, all 0.3s ease);
}
.sw-input::placeholder { color: var(--text-dim, #7D8DB3); }
.sw-input:focus { outline: none; border-color: var(--brand-sky, #20BCED); box-shadow: 0 0 0 3px rgba(32, 188, 237, 0.3); }
.sw-input[aria-invalid="true"] { border-color: var(--danger, #F87171); }
.sw-check {
    display: grid;
    grid-template-columns: 22px 1fr;
    gap: 10px;
    align-items: start;
    font-size: 0.9rem;
    color: var(--text-secondary, #B4C0DB);
}
.sw-check input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--sw-accent); }
.sw-check label { cursor: pointer; }
.sw-fine { font-size: 0.82rem; color: var(--text-dim, #7D8DB3); margin: 0; }
.sw-fine a { color: var(--brand-sky, #20BCED); text-decoration: underline; }
.sw-submit, .sw-spin { justify-self: start; }
.sw button:disabled { opacity: 0.6; cursor: progress; }

.sw-code {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    padding: 16px 18px;
    margin: 0 0 14px;
    border: 2px dashed var(--sw-accent-2);
    border-radius: 14px;
    background: rgba(2, 10, 36, 0.55);
}
.sw-code[hidden] { display: none; }
.sw-code-label { width: 100%; font-size: 0.78rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-dim, #7D8DB3); }
.sw-code-value {
    flex: 1 1 auto;
    font-family: Consolas, Menlo, monospace;
    font-size: 1.45rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: #fff;
    background: none;
    padding: 0;
    word-break: break-all;
    user-select: all;
}
.sw-terms { margin: 0 0 16px; padding: 0; list-style: none; color: var(--text-secondary, #B4C0DB); font-size: 0.9rem; }
.sw-terms li { position: relative; padding-left: 18px; margin-bottom: 4px; }
.sw-terms li::before { content: ""; position: absolute; left: 0; top: 0.6em; width: 7px; height: 7px; border-radius: 50%; background: var(--sw-accent-2); }
.sw-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.sw-actions [hidden] { display: none; }
.sw-status { min-height: 1.4em; margin: 14px 0 0; font-size: 0.92rem; color: var(--success, #22C55E); }
.sw-status:empty { margin: 0; min-height: 0; }
.sw-status-error { color: var(--danger, #F87171); }

/* Inline section and confirmation page */
.sw-section { padding: 60px 0; }
/* section.sw-page only: the widget itself also carries sw-page (its mode) and keeps its own padding. */
section.sw-page { padding: 8px 0 24px; }

/* Popup */
.sw-dialog {
    width: min(920px, calc(100% - 32px));
    max-height: calc(100dvh - 32px);
    padding: 0;
    margin: auto;
    border: 0;
    background: transparent;
    color: inherit;
    overflow: auto;
    overscroll-behavior: contain;
}
.sw-dialog::backdrop { background: rgba(2, 10, 36, 0.78); backdrop-filter: blur(3px); }
.sw-dialog[open] { animation: sw-in 0.35s cubic-bezier(0.16, 1, 0.3, 1); }
@keyframes sw-in { from { opacity: 0; transform: translateY(16px) scale(0.98); } to { opacity: 1; transform: none; } }
html.sw-dialog-open { overflow: hidden; }
.sw-close {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 3;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(2, 10, 36, 0.6);
    color: #fff;
    font-size: 1.1rem;
    cursor: pointer;
}
.sw-close:hover { background: rgba(255, 255, 255, 0.1); }
.sw-launcher {
    position: fixed;
    left: 16px;
    bottom: 16px;
    z-index: 900;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 48px;
    padding: 10px 18px 10px 12px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: var(--bg-card, #0A1A47);
    color: #fff;
    font: inherit;
    font-weight: 700;
    box-shadow: 0 10px 28px rgba(1, 6, 24, 0.5);
    cursor: pointer;
}
.sw-launcher:hover { border-color: var(--glass-border-hover, rgba(32, 188, 237, 0.4)); }
.sw-launcher-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: conic-gradient(var(--brand-blue, #116AF9) 0 25%, var(--brand-sky, #20BCED) 0 50%, var(--brand-blue, #116AF9) 0 75%, var(--brand-sky, #20BCED) 0);
    border: 2px solid #fff;
}
.sw :focus-visible, .sw-launcher:focus-visible, .sw-close:focus-visible {
    outline: 3px solid var(--brand-sky, #20BCED);
    outline-offset: 2px;
}

/* Tablet */
@media (max-width: 900px) {
    .sw { padding: 32px 28px; }
    .sw-grid { grid-template-columns: minmax(200px, 280px) 1fr; gap: 28px; }
}
/* Phone and small tablet: wheel above the text */
@media (max-width: 767px) {
    .sw { padding: 28px 18px 24px; border-radius: var(--radius-md, 16px); }
    .sw-grid { grid-template-columns: 1fr; gap: 20px; }
    .sw-wheel-wrap { max-width: 240px; }
    /* The form comes right after the wheel; the chance list moves below it. */
    .sw-wheel-col { display: contents; }
    .sw-terms-link { order: 1; margin: -8px 0 0; }
    .sw-body { order: 2; }
    .sw-odds-title { order: 3; margin: 0 0 -14px; }
    .sw-odds { order: 4; }
    .sw-body { text-align: left; }
    .sw-submit, .sw-spin { justify-self: stretch; width: 100%; }
    .sw-actions .btn { flex: 1 1 100%; justify-content: center; }
    .sw-section { padding: 40px 0; }
    section.sw-page { padding: 0 0 16px; }
    .sw-dialog { width: calc(100% - 16px); max-height: calc(100dvh - 16px); }
    .sw-dialog .sw-wheel-wrap { max-width: 190px; }
    .sw-launcher { left: 12px; bottom: 12px; }
    .sw-code-value { font-size: 1.2rem; }
}
@media (prefers-reduced-motion: reduce) {
    .sw-dialog[open] { animation: none; }
    .sw-wheel { transition: none !important; }
}
