/* celebrate.css - the winner card, the celebration settings, and the effect layer.
   Paired with js/celebrate.js; every element here is created by that script. */

.sww-fx {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10050;
}

/* ---------------------------------------------------------------- overlay */

.sww-reveal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    justify-content: center;
    padding: 16px;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: rgba(30, 27, 46, 0.55);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}

.sww-reveal[hidden] {
    display: none;
}

.sww-reveal.is-open {
    animation: swwFade 0.25s ease both;
}

.sww-reveal__card {
    position: relative;
    /* margin:auto rather than align-items:center - "safe" centring, so a card
       taller than the viewport (settings open, phone in landscape) scrolls from
       its top instead of being cut off above the fold. */
    margin: auto;
    width: min(460px, 100%);
    background: #FFFFFF;
    border-radius: 28px;
    overflow: hidden;
    text-align: center;
    font-family: var(--font-display);
    box-shadow: 0 30px 80px rgba(30, 27, 46, 0.38), 0 0 0 6px rgba(255, 255, 255, 0.22);
}

.sww-reveal.is-open .sww-reveal__card {
    animation: swwPop 0.62s cubic-bezier(0.18, 1.35, 0.4, 1) both;
}

.sww-reveal__x {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 3;
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.24);
    color: var(--win-ink, #FFFFFF);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.15s ease;
}

.sww-reveal__x:hover {
    background: rgba(255, 255, 255, 0.4);
    transform: rotate(90deg);
}

.sww-reveal__x:focus-visible,
.sww-reveal__link:focus-visible,
.sww-btn:focus-visible {
    outline: 3px solid #FF6B35;
    outline-offset: 2px;
}

/* ------------------------------------------------------------ the winner */

.sww-reveal__stage {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    padding: 2.3rem 1.25rem 2rem;
    color: var(--win-ink, #FFFFFF);
    background: radial-gradient(120% 95% at 50% 0%, var(--win-2, #7B6FE0), var(--win, #4C3FCB) 55%, var(--win-3, #3A2FA8));
}

.sww-reveal__rays {
    position: absolute;
    left: 50%;
    top: 55%;
    width: 240%;
    aspect-ratio: 1;
    z-index: -1;
    transform: translate(-50%, -50%);
    background: repeating-conic-gradient(rgba(255, 255, 255, 0.17) 0deg 9deg, transparent 9deg 22.5deg);
    -webkit-mask: radial-gradient(circle, #000 12%, transparent 58%);
    mask: radial-gradient(circle, #000 12%, transparent 58%);
    animation: swwRays 28s linear infinite;
}

/* One sweep of light across the stage, after the letters have landed. */
.sww-reveal__stage::after {
    content: '';
    position: absolute;
    top: -10%;
    bottom: -10%;
    left: -45%;
    width: 32%;
    pointer-events: none;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.38), transparent);
    transform: skewX(-20deg);
    opacity: 0;
}

.sww-reveal.is-open .sww-reveal__stage::after {
    animation: swwShine 1.15s 0.8s ease-out both;
}

.sww-reveal__kicker {
    margin: 0 0 0.4rem;
    font-size: 0.98rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    opacity: 0.94;
}

.sww-reveal__name {
    margin: 0 auto;
    max-width: 100%;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: calc(var(--name-size, 3) * 1rem);
    line-height: 1.08;
    color: inherit;
    overflow-wrap: anywhere;
    text-shadow: 0 3px 0 rgba(0, 0, 0, 0.14), 0 12px 34px rgba(0, 0, 0, 0.2);
}

.sww-word {
    display: inline-block;
    white-space: nowrap;
}

.sww-ch {
    display: inline-block;
    animation: swwLetter 0.56s cubic-bezier(0.2, 1.6, 0.35, 1) both;
}

.sww-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
}

/* ---------------------------------------------------------------- actions */

.sww-reveal__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.6rem;
    padding: 1.3rem 1.25rem 0.35rem;
}

.sww-btn {
    min-height: 44px;
    padding: 0.62rem 1.2rem;
    border: 2px solid #E4E0F5;
    border-radius: 999px;
    background: #FFFFFF;
    color: #1E1B2E;
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.sww-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(76, 63, 203, 0.18);
}

.sww-btn:active {
    transform: translateY(0) scale(0.97);
}

.sww-btn[hidden] {
    display: none;
}

.sww-btn--go {
    padding-inline: 1.6rem;
    border: 0;
    color: #FFFFFF;
    background: linear-gradient(135deg, #4C3FCB, #7B5CF0 55%, #E0529C);
    box-shadow: 0 8px 20px rgba(76, 63, 203, 0.35);
}

.sww-btn--go:hover {
    box-shadow: 0 10px 26px rgba(76, 63, 203, 0.45);
}

.sww-btn--quiet {
    border-color: transparent;
    color: #6B6880;
}

.sww-reveal__links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.15rem 0.35rem;
    margin: 0.35rem 0 1.1rem;
}

.sww-reveal__link[hidden] {
    display: none;
}

.sww-reveal__link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.85rem;
    border: 0;
    border-radius: 999px;
    background: none;
    color: #4C3FCB;
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
}

.sww-reveal__link:hover,
.sww-reveal__style-toggle[aria-expanded="true"] {
    background: #F1EEFF;
}

/* ------------------------------------------------------- settings panel */

.sww-style {
    margin-top: 0.1rem;
    padding: 1rem 1.25rem 1.25rem;
    border-top: 1px solid #EEEAF8;
    text-align: left;
}

.sww-style[hidden] {
    display: none;
}

.sww-style__group {
    min-width: 0;
    margin: 0 0 0.95rem;
    padding: 0;
    border: 0;
}

.sww-style__group legend {
    margin-bottom: 0.45rem;
    padding: 0;
    font-family: var(--font-display);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: #6B6880;
}

.sww-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.sww-chip {
    position: relative;
    cursor: pointer;
}

/* Visually hidden but still a real radio: arrow keys move through a group and
   screen readers announce "Confetti, radio button, 1 of 9, selected". */
.sww-chip input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.sww-chip span {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.36rem 0.75rem;
    border: 2px solid #E8E4F6;
    border-radius: 999px;
    background: #FBFAFF;
    color: #2D2940;
    font-family: var(--font-display);
    font-size: 0.9rem;
    font-weight: 500;
    transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.sww-chip:hover span {
    border-color: #C9C1F2;
}

.sww-chip:active span {
    transform: scale(0.96);
}

.sww-chip input:checked + span {
    border-color: #4C3FCB;
    background: #EEEBFF;
    color: #3A2FA8;
    box-shadow: 0 2px 8px rgba(76, 63, 203, 0.18);
}

.sww-chip input:focus-visible + span {
    outline: 3px solid #FF6B35;
    outline-offset: 2px;
}

.sww-chip i {
    font-style: normal;
}

.sww-swatch {
    display: inline-block;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1);
}

.sww-swatch--match {
    background: conic-gradient(var(--win, #4C3FCB) 0 50%, #FFFFFF 50% 75%, #FFD166 75%);
}

.sww-style__hint {
    margin: 0.15rem 0 0;
    font-size: 0.86rem;
    line-height: 1.45;
    color: #6B6880;
}

/* The standalone settings dialog used on pages that keep their own result UI. */
.sww-reveal--settings .sww-reveal__x {
    background: #F1EEFF;
    color: #4C3FCB;
}

.sww-style__title {
    margin: 1.6rem 3.5rem 0.25rem 1.25rem;
    text-align: left;
    font-family: var(--font-display);
    font-size: 1.5rem;
    color: #1E1B2E;
}

.sww-style__sub {
    margin: 0 1.25rem 0.9rem;
    text-align: left;
    font-size: 0.95rem;
    color: #6B6880;
}

.sww-reveal--settings .sww-style {
    padding-top: 0;
    border-top: 0;
}

.sww-reveal--settings .sww-reveal__actions {
    padding: 0 1.25rem 1.25rem;
    justify-content: flex-end;
}

/* ------------------------------------------------------ the little pill */

.sww-pill {
    position: fixed;
    left: 50%;
    bottom: 18px;
    z-index: 1001;
    padding: 0.62rem 1.1rem;
    border: 0;
    border-radius: 999px;
    background: #1E1B2E;
    color: #FFFFFF;
    font-family: var(--font-display);
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
    transform: translateX(-50%);
    box-shadow: 0 10px 30px rgba(30, 27, 46, 0.3);
    animation: swwPillIn 0.45s cubic-bezier(0.2, 1.4, 0.4, 1) both;
    transition: opacity 0.35s ease, transform 0.35s ease;
}

.sww-pill.is-leaving {
    opacity: 0;
    transform: translate(-50%, 12px);
}

/* ------------------------------------------------------------ keyframes */

@keyframes swwFade {
    from { opacity: 0; }
}

@keyframes swwPop {
    0% { opacity: 0; transform: scale(0.55) translateY(34px); }
    55% { opacity: 1; }
    100% { opacity: 1; transform: none; }
}

@keyframes swwRays {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

@keyframes swwShine {
    0% { left: -45%; opacity: 0; }
    15% { opacity: 1; }
    100% { left: 135%; opacity: 0; }
}

@keyframes swwLetter {
    from { opacity: 0; transform: translateY(0.55em) scale(0.3) rotate(-12deg); }
    to { opacity: 1; transform: none; }
}

@keyframes swwPillIn {
    from { opacity: 0; transform: translate(-50%, 16px) scale(0.9); }
}

@media (max-width: 480px) {
    .sww-reveal {
        padding: 12px;
    }

    .sww-reveal__card {
        border-radius: 22px;
    }

    .sww-reveal__stage {
        padding: 2.1rem 1rem 1.7rem;
    }

    .sww-btn {
        flex: 1 1 auto;
    }
}

@media (prefers-reduced-motion: reduce) {
    .sww-reveal.is-open,
    .sww-reveal.is-open .sww-reveal__card,
    .sww-reveal.is-open .sww-reveal__stage::after,
    .sww-reveal__rays,
    .sww-ch,
    .sww-pill {
        animation: none !important;
    }

    .sww-reveal__x:hover {
        transform: none;
    }
}
