/* =========================================================
   Finagle Spin & Win — tablet/phone portrait, responsive
   Dark theme (from approved db.html reference):
     animated near-black gradient + floating particles,
     glassy boxes with red-glow borders.
   Brand accents from the Finagle logo:
     red #ED1C24 | cream #FFF8EC | gold #E0AE4C
   All UI visuals are hand-built (CSS/SVG) — only the prize
   item images are external (placeholders until client art).
   ========================================================= */

@font-face {
    font-family: 'Dress Code Bold';
    src: url('../font/Dress Code Bold.otf') format('opentype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    width: 100%;
    height: 100%;
    background: #0a0a0a;
    font-family: 'Arial', 'Helvetica', sans-serif;
    color: #fff;
    overflow: hidden;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

button { font-family: inherit; cursor: pointer; }

/* ---------- Device frame: fills actual viewport ---------- */
.device-frame {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;               /* respect dynamic browser chrome */
    background: linear-gradient(135deg,
                #0a0a0a 0%, #1a1a1a 25%, #2a0a0d 50%, #1a0a0a 75%, #0a0a0a 100%);
    background-size: 400% 400%;
    animation: gradientShift 10s ease infinite;
    overflow: hidden;
}
@keyframes gradientShift {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* ====================== Background FX ======================
   Particles + glow + sheen sit behind every screen (screens are
   transparent). The logo imgs render above with no effects. */
.bg-fx {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}

/* floating glowing particles (red / gold / white) */
.bg-particles {
    position: absolute;
    inset: 0;
}
.particle {
    position: absolute;
    background: radial-gradient(circle, rgba(237, 28, 36, 0.8), transparent);
    border-radius: 50%;
    animation: floatUp 8s infinite linear;
}
.particle:nth-child(odd) {
    background: radial-gradient(circle, rgba(224, 174, 76, 0.7), transparent);
}
.particle:nth-child(3n) {
    background: radial-gradient(circle, rgba(255, 255, 255, 0.4), transparent);
}
@keyframes floatUp {
    0%   { transform: translateY(100vh) rotate(0deg); opacity: 0; }
    10%  { opacity: 1; }
    90%  { opacity: 1; }
    100% { transform: translateY(-10vh) rotate(360deg); opacity: 0; }
}

/* gentle breathing red glow behind the action area */
.bg-glow {
    position: absolute;
    left: 50%;
    top: 36%;
    width: 120vmin;
    height: 120vmin;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle,
                rgba(237, 28, 36, 0.20) 0%,
                rgba(237, 28, 36, 0.08) 40%,
                rgba(237, 28, 36, 0) 70%);
    animation: glow-pulse 6s ease-in-out infinite;
}
@keyframes glow-pulse {
    0%, 100% { opacity: .55; transform: translate(-50%, -50%) scale(1); }
    50%      { opacity: 1;   transform: translate(-50%, -50%) scale(1.12); }
}

/* faint diagonal sheen sweeping across every few seconds */
.bg-sheen {
    position: absolute;
    top: -20%;
    left: 0;
    width: 38%;
    height: 140%;
    background: linear-gradient(105deg,
                rgba(255, 255, 255, 0) 0%,
                rgba(255, 255, 255, 0.05) 45%,
                rgba(255, 255, 255, 0.08) 50%,
                rgba(255, 255, 255, 0.05) 55%,
                rgba(255, 255, 255, 0) 100%);
    transform: translateX(-130%) skewX(-12deg);
    animation: sheen-sweep 9s ease-in-out infinite;
}
@keyframes sheen-sweep {
    0%       { transform: translateX(-160%) skewX(-12deg); }
    55%, 100%{ transform: translateX(360%)  skewX(-12deg); }
}

.screen {
    position: absolute;
    inset: 0;
    background: transparent;       /* let the bg FX show through */
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 1;
}

.bottom-logo-sec {
    position: absolute;
    bottom: 8vh;
    left: 50%;
    transform: translateX(-50%);
    width: 50vw;
    max-width: 380px;
    height: auto;
    z-index: 10;            /* always on top, never covered by anything */
    pointer-events: none;
    display: block;
    opacity: 1;
}

/* ====================== SCREEN 1 : REGISTRATION ====================== */
.screen-reg {
    justify-content: flex-start;   /* logo + form anchored near top */
    padding-top: 7vh;
    padding-bottom: 2vh;
    font-family: 'Dress Code Bold', 'Arial', sans-serif;
}
/* Dress Code Bold on inputs and labels only — NOT the consent text */
.screen-reg .field input,
.screen-reg .field label {
    font-family: 'Dress Code Bold', 'Arial', sans-serif;
}
.screen-reg .consent,
.screen-reg .consent span {
    font-family: 'Arial', 'Helvetica', sans-serif;
}

/* Register screen only: logo sits at the top, above the form */
.screen-reg .top-logo {
    display: block;
    width: 50vw;
    max-width: 380px;
    height: auto;
    margin: 0 auto 6vh;
    align-self: center;
}

.screen-reg .reg-form {
    width: 80vw;
    max-width: 640px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

.field {
    width: 100%;
    margin-bottom: 3vh;
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

/* glassy dark input with red-glow border (db.html card style) */
.field input {
    width: 100%;
    height: 6vh;
    min-height: 50px;
    max-height: 80px;
    border: 2px solid rgba(237, 28, 36, 0.5);
    border-radius: 25px;
    background: linear-gradient(135deg, rgba(237, 28, 36, 0.10), rgba(0, 0, 0, 0.35));
    box-shadow: 0 0 25px rgba(237, 28, 36, 0.15), inset 0 0 25px rgba(0, 0, 0, 0.35);
    padding: 0 30px;
    font-size: clamp(20px, 4.2vw, 30px);
    font-weight: 700;
    text-transform: uppercase;
    color: #fff;
    outline: none;
    text-align: center;
    transition: border-color .25s, box-shadow .25s;
}
.field input:focus {
    border-color: rgba(237, 28, 36, 0.9);
    box-shadow: 0 0 35px rgba(237, 28, 36, 0.35), inset 0 0 25px rgba(0, 0, 0, 0.35);
}

.field label {
    margin-top: 1vh;
    font-size: clamp(18px, 3vw, 30px);
    font-weight: 700;
    letter-spacing: 1.5px;
    color: #fff;
    text-align: center;
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.35);
}

/* hand-built SUBMIT button: red gradient pill with glow + shimmer */
.submit-btn {
    position: relative;
    overflow: hidden;
    width: 50vw;
    max-width: 300px;
    height: 7.5vh;
    min-height: 56px;
    max-height: 90px;
    margin: 1.5vh auto 0;
    border: 2px solid rgba(255, 255, 255, 0.25);
    border-radius: 50px;
    background: linear-gradient(180deg, #FF4B52 0%, #ED1C24 45%, #B30E15 100%);
    box-shadow: 0 0 35px rgba(237, 28, 36, 0.45),
                0 6px 18px rgba(0, 0, 0, 0.5),
                inset 0 2px 6px rgba(255, 255, 255, 0.35);
    color: #fff;
    font-family: 'Dress Code Bold', 'Arial', sans-serif;
    font-size: clamp(22px, 4.5vw, 34px);
    font-weight: 700;
    letter-spacing: 3px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
    transition: transform .1s;
    flex-shrink: 0;
}
.submit-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.25), transparent);
    animation: shimmer 3s infinite;
}
@keyframes shimmer {
    0%   { left: -100%; }
    100% { left: 100%; }
}
.submit-btn:active:not(:disabled) { transform: scale(0.95); }
.submit-btn:disabled { opacity: .45; cursor: not-allowed; }

.consent {
    margin: 3.2vh auto 0;
    width: 70vw;
    max-width: 560px;
    display: flex;
    align-items: flex-start;
    font-size: clamp(11px, 1.8vw, 15px);
    line-height: 1.35;
    color: rgba(255, 255, 255, 0.85);
    gap: 8px;
}
.consent input[type="checkbox"] {
    width: 16px; height: 16px; margin-top: 3px; flex-shrink: 0;
    accent-color: #ED1C24;
}

/* ====================== SCREEN 2 : WHEEL ====================== */
.screen-wheel {
    padding-top: 5vh;
    padding-bottom: 14vh;          /* keep clear of bottom logo */
    justify-content: flex-start;
}

.wheel-wrap {
    --wheel: min(92vw, 56vh);      /* wheel diameter — everything scales off this */
    position: relative;
    width: var(--wheel);
    height: var(--wheel);
    filter: drop-shadow(0 0 4vh rgba(237, 28, 36, 0.35))
            drop-shadow(0 1vh 2.5vh rgba(0, 0, 0, 0.55));
}

.wheel {
    position: absolute;
    inset: 0;
    transition: transform 5s cubic-bezier(0.17, 0.67, 0.21, 1);
    transform-origin: 50% 50%;
}

.wheel-base {
    position: absolute;
    width: 100%; height: 100%;
    top: 0; left: 0;
    display: block;
}

/* Wedge overlay — anchored at center, rotated, content offset outward */
.wedge {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 0;
    height: 0;
    transform-origin: 0 0;
    pointer-events: none;
}
/* Items sit at ~65% of the radius along each wedge centerline.
   Sizes are relative to the wheel so phones and tablets both look right. */
.wedge img {
    position: absolute;
    width: calc(var(--wheel) * 0.185);
    height: calc(var(--wheel) * 0.17);
    object-fit: contain;
    left: calc(var(--wheel) * -0.0925);
    top: calc(-1 * (var(--wheel) / 2) * 0.65);
    transform: translateY(-50%);
    filter: drop-shadow(0 0 .5vh rgba(255, 255, 255, .55));  /* lift red items off red slices */
}
/* Hand-built TRY AGAIN wedge text. Rendered upside-down so it reads
   upright when the wedge lands at the bottom pointer. */
.wedge.tryagain .tg-text {
    position: absolute;
    width: calc(var(--wheel) * 0.24);
    left: calc(var(--wheel) * -0.12);
    top: calc(-1 * (var(--wheel) / 2) * 0.65);
    transform: translateY(-50%) rotate(180deg);
    font-family: 'Dress Code Bold', 'Arial', sans-serif;
    font-weight: 700;
    font-size: calc(var(--wheel) * 0.052);
    line-height: 1.05;
    letter-spacing: 1px;
    color: #ED1C24;
    text-align: center;
}

/* Center hub: cream badge with gold ring; logo inside is untouched */
.wheel-center {
    position: absolute;
    width: calc(var(--wheel) * 0.30);
    height: calc(var(--wheel) * 0.30);
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 5;
    background: #FFF8EC;
    border: .6vh solid #E0AE4C;
    border-radius: 50%;
    box-shadow: 0 .4vh 1.6vh rgba(0, 0, 0, .45);
    display: flex;
    align-items: center;
    justify-content: center;
}
.wheel-center img {
    width: 78%;
    height: auto;
    display: block;
}

/* Hand-built SPIN button: red disc + pointer tip touching the wheel rim */
.spin-btn {
    position: relative;
    margin-top: -0.5vh;
    background: transparent;
    border: none;
    padding: 0;
    width: 12vh;
    height: 14.5vh;
    max-width: 140px;
    max-height: 175px;
    transition: transform .1s;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.spin-pointer {
    display: block;
    width: 0;
    height: 0;
    border-left: 2.2vh solid transparent;
    border-right: 2.2vh solid transparent;
    border-bottom: 3.6vh solid #B30E15;
    filter: drop-shadow(0 -2px 4px rgba(0, 0, 0, 0.4));
}
.spin-disc {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 11vh;
    height: 11vh;
    max-width: 130px;
    max-height: 130px;
    margin-top: -0.6vh;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 28%, #FF6058 0%, #ED1C24 45%, #9E0B11 100%);
    border: .55vh solid #FFF8EC;
    box-shadow: 0 0 30px rgba(237, 28, 36, 0.55),
                0 6px 16px rgba(0, 0, 0, 0.55),
                inset 0 -4px 10px rgba(0, 0, 0, 0.35);
    color: #fff;
    font-family: 'Dress Code Bold', 'Arial', sans-serif;
    font-weight: 700;
    font-size: clamp(20px, 2.8vh, 30px);
    letter-spacing: 2px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.45);
}
.spin-btn:active:not(:disabled) { transform: scale(0.95); }
.spin-btn:disabled { opacity: .7; cursor: not-allowed; }

/* ====================== SCREEN 3/4 : RESULT ====================== */
.screen-result {
    padding-top: 18vh;
    padding-bottom: 14vh;
    justify-content: flex-start;
}

.result-emoji {
    width: min(42vw, 320px);
    height: auto;
    object-fit: contain;
    margin-bottom: -5vh;
    z-index: 20;
    filter: drop-shadow(0 8px 24px rgba(0, 0, 0, 0.5));
}

/* Hand-built result card: glassy dark box with red-glow border,
   pulsing like the db.html message cards */
.result-box {
    position: relative;
    overflow: hidden;
    width: min(78vw, 600px);
    min-height: 24vh;
    background: linear-gradient(135deg, rgba(237, 28, 36, 0.18), rgba(0, 0, 0, 0.55));
    border: 3px solid rgba(237, 28, 36, 0.55);
    border-radius: 24px;
    box-shadow: 0 0 50px rgba(237, 28, 36, 0.35),
                inset 0 0 60px rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4vw;
    padding: 6vh 6% 4vh;
    animation: boxPulse 3s ease-in-out infinite;
}
@keyframes boxPulse {
    0%, 100% { box-shadow: 0 0 50px rgba(237, 28, 36, 0.35), inset 0 0 60px rgba(0, 0, 0, 0.45); }
    50%      { box-shadow: 0 0 80px rgba(237, 28, 36, 0.55), inset 0 0 60px rgba(0, 0, 0, 0.45); }
}
.result-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(237, 28, 36, 0.12), transparent);
    animation: shimmer 3s infinite;
}

.result-text {
    font-family: 'Dress Code Bold', 'Arial', sans-serif;
    font-weight: 700;
    font-size: clamp(26px, 6vw, 48px);
    line-height: 1.1;
    letter-spacing: 2px;
    color: #fff;
    text-align: center;
    text-shadow: 0 0 20px rgba(237, 28, 36, 0.9),
                 0 0 40px rgba(237, 28, 36, 0.5);
    flex-shrink: 1;
    min-width: 0;
    position: relative;
    z-index: 2;
}
.result-text.oops { letter-spacing: 3px; }

.result-prize {
    width: 30%;
    max-height: 18vh;
    height: auto;
    object-fit: contain;
    flex-shrink: 1;
    min-width: 0;
    position: relative;
    z-index: 2;
    filter: drop-shadow(0 0 12px rgba(255, 255, 255, 0.35));
}
