/* =========================================================
   Living Just Right with LG — Spin the Wheel (G3)
   Tablet / phone portrait, responsive.
   Theme taken from the LG identity + supplied logos:
     LG Active Red #A50034 (grad #D4004A -> #6E0023)
     deep maroon-black backdrop #170209 / #2B0512
     peach #FBD3A5 — matches the AI Home Hunt logo artwork
     Abans purple #7B2382 — partner accent
   No client game art was supplied for this game, so the wheel,
   buttons, game logo and result ticket are all built in CSS.
   ========================================================= */

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

html, body {
    width: 100%;
    height: 100%;
    background: #170209;
    font-family: 'Helvetica Neue', 'Segoe UI', Arial, 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: LG red gradient backdrop ---------- */
.device-frame {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;               /* respect dynamic browser chrome */
    background:
        radial-gradient(120% 80% at 50% 12%, rgba(196, 0, 62, 0.55) 0%, rgba(23, 2, 9, 0) 62%),
        radial-gradient(100% 70% at 50% 108%, rgba(123, 35, 130, 0.35) 0%, rgba(23, 2, 9, 0) 60%),
        linear-gradient(180deg, #2B0512 0%, #170209 45%, #0C0105 100%);
    overflow: hidden;
}

/* ====================== Background FX ======================
   Subtle life on top of the gradient backdrop. Logo imgs
   render above with no effects applied. */
.bg-fx {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}

/* floating glowing particles (peach / white / LG red) */
.bg-particles {
    position: absolute;
    inset: 0;
}
.particle {
    position: absolute;
    background: radial-gradient(circle, rgba(251, 211, 165, 0.75), transparent);
    border-radius: 50%;
    animation: floatUp 8s infinite linear;
}
.particle:nth-child(odd) {
    background: radial-gradient(circle, rgba(255, 255, 255, 0.35), transparent);
}
.particle:nth-child(3n) {
    background: radial-gradient(circle, rgba(212, 0, 74, 0.55), 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 glow behind the action area */
.bg-glow {
    position: absolute;
    left: 50%;
    top: 46%;
    width: 110vmin;
    height: 110vmin;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle,
                rgba(251, 211, 165, 0.16) 0%,
                rgba(212, 0, 74, 0.08) 40%,
                rgba(212, 0, 74, 0) 70%);
    animation: glow-pulse 6s ease-in-out infinite;
}
@keyframes glow-pulse {
    0%, 100% { opacity: .5; 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, 231, 205, 0.04) 45%,
                rgba(255, 231, 205, 0.08) 50%,
                rgba(255, 231, 205, 0.04) 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 backdrop + FX show through */
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 1;
}

/* ---------- Logo lock-up on every screen ----------
   Event logo (AI Home Hunt) on top, partner brand logo (Abans)
   directly beneath it. The Abans artwork carries black "In
   Partnership with" text, so it sits on a white chip to stay
   readable on the dark backdrop. */
.brand-stack {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.6vh;
    flex-shrink: 0;
}

.top-logo {
    display: block;
    width: 34vw;
    max-width: 260px;
    height: auto;
}

.brand-logo {
    display: block;
    width: 24vw;
    max-width: 180px;
    height: auto;
    background: #fff;
    border-radius: 10px;
    padding: 1.4% 3%;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.45);
}

/* ====================== SCREEN 0 : START ====================== */
.screen-start {
    justify-content: flex-start;
    padding-top: 6vh;
}

/* CSS "SPIN THE WHEEL" lock-up — no game-logo art was supplied */
.screen-start .game-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 7vh auto 0;
    text-align: center;
    filter: drop-shadow(0 1.2vh 2.5vh rgba(0, 0, 0, 0.6));
}
.game-logo .gl-top {
    font-size: clamp(52px, 17vw, 130px);
    font-weight: 900;
    letter-spacing: 6px;
    line-height: .95;
    background: linear-gradient(180deg, #FFF3E2 0%, #FBD3A5 45%, #E9A45E 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-shadow: 0 0 40px rgba(251, 211, 165, 0.35);
}
.game-logo .gl-mid {
    font-size: clamp(24px, 7.4vw, 56px);
    font-weight: 800;
    letter-spacing: 8px;
    line-height: 1.4;
    color: #fff;
}
.game-logo .gl-sub {
    margin-top: 1.6vh;
    padding: .7vh 4vw;
    font-size: clamp(12px, 3.2vw, 22px);
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: #FFE7CE;
    background: linear-gradient(160deg, #D4004A 0%, #A50034 55%, #6E0023 100%);
    border: 1px solid rgba(251, 211, 165, 0.45);
    border-radius: 40px;
    box-shadow: 0 0 26px rgba(212, 0, 74, 0.45);
}

/* ====================== Shared gold/peach action button ====================== */
.play-btn,
.submit-btn,
.spin-btn {
    position: relative;
    overflow: hidden;
    border: 2px solid rgba(255, 240, 220, 0.6);
    border-radius: 18px;
    background: linear-gradient(160deg, #6E0023 0%, #E4004F 26%, #C4003F 50%, #A50034 74%, #5E001E 100%);
    box-shadow: 0 0 30px rgba(212, 0, 74, 0.45),
                0 6px 16px rgba(0, 0, 0, 0.6),
                inset 0 2px 6px rgba(255, 255, 255, 0.28);
    color: #FFF3E4;
    font-weight: 900;
    letter-spacing: 4px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.45);
    transition: transform .1s;
}
.play-btn::before,
.submit-btn::before,
.spin-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.35), transparent);
    animation: shimmer 3s infinite;
}
@keyframes shimmer {
    0%   { left: -100%; }
    100% { left: 100%; }
}
.play-btn:active:not(:disabled),
.submit-btn:active:not(:disabled),
.spin-btn:active:not(:disabled) { transform: scale(0.95); }
.submit-btn:disabled,
.spin-btn:disabled { opacity: .45; cursor: not-allowed; }

.screen-start .play-btn {
    width: 46vw;
    max-width: 330px;
    height: 8.5vh;
    min-height: 62px;
    max-height: 100px;
    margin-top: 7vh;
    font-size: clamp(26px, 6vw, 44px);
}

/* ====================== SCREEN 1 : REGISTRATION ====================== */
.screen-reg {
    justify-content: flex-start;
    padding-top: 6vh;
    padding-bottom: 2vh;
}
.screen-reg .brand-stack { margin-bottom: 5vh; }

.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 a peach glow border */
.field input {
    width: 100%;
    height: 6vh;
    min-height: 50px;
    max-height: 80px;
    border: 2px solid rgba(251, 211, 165, 0.5);
    border-radius: 25px;
    background: linear-gradient(135deg, rgba(251, 211, 165, 0.10), rgba(0, 0, 0, 0.45));
    box-shadow: 0 0 22px rgba(251, 211, 165, 0.12), inset 0 0 25px rgba(0, 0, 0, 0.4);
    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(251, 211, 165, 0.95);
    box-shadow: 0 0 32px rgba(251, 211, 165, 0.3), inset 0 0 25px rgba(0, 0, 0, 0.4);
}

.field label {
    margin-top: 1vh;
    font-size: clamp(18px, 3vw, 30px);
    font-weight: 800;
    letter-spacing: 1.5px;
    color: #FBD3A5;
    text-align: center;
    text-shadow: 0 0 14px rgba(251, 211, 165, 0.4);
}

.submit-btn {
    width: 50vw;
    max-width: 300px;
    height: 7.5vh;
    min-height: 56px;
    max-height: 90px;
    margin: 1.5vh auto 0;
    font-size: clamp(22px, 4.5vw, 34px);
    flex-shrink: 0;
}

.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: #A50034;
}

/* ====================== SCREEN 2 : WHEEL ====================== */
.screen-wheel {
    justify-content: flex-start;
    padding-top: 4vh;
}

.wheel-wrap {
    --wheel: min(92vw, 46vh);      /* rim diameter — everything scales off this */
    position: relative;
    width: var(--wheel);
    height: var(--wheel);
    flex-shrink: 0;                /* never let the flex column squash it oval */
    margin-top: 3.5vh;
    filter: drop-shadow(0 0 3.5vh rgba(212, 0, 74, 0.35))
            drop-shadow(0 1vh 2.5vh rgba(0, 0, 0, 0.65));
}

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

/* Face: 8 alternating slices, LG red / charcoal.
   conic-gradient starts at 12 o'clock and runs clockwise, so
   slice k spans 45k -> 45(k+1) — exactly the wedge geometry. */
.wheel-base {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: conic-gradient(
        #C4003F 0deg    45deg,
        #24060F 45deg   90deg,
        #C4003F 90deg   135deg,
        #24060F 135deg  180deg,
        #C4003F 180deg  225deg,
        #24060F 225deg  270deg,
        #C4003F 270deg  315deg,
        #24060F 315deg  360deg
    );
    box-shadow: inset 0 0 calc(var(--wheel) * 0.10) rgba(0, 0, 0, 0.55);
}

/* thin peach separator line on every slice boundary + soft centre sheen */
.wheel-spokes {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background:
        repeating-conic-gradient(
            rgba(251, 211, 165, 0.85) 0deg 0.5deg,
            rgba(251, 211, 165, 0)    0.5deg 45deg),
        radial-gradient(circle at 50% 32%, rgba(255, 255, 255, 0.10), rgba(255, 255, 255, 0) 62%);
    pointer-events: none;
}

/* ---------- Static rim + top pointer + hub above the spinning face ---------- */
.wheel-rim {
    --rim-w: calc(var(--wheel) * 0.045);
    position: absolute;
    inset: 0;
    border-radius: 50%;
    pointer-events: none;
    z-index: 5;
}

/* The metallic ring lives on a pseudo-element so the mask that hollows
   out its centre cannot clip the pointer, bulbs or hub. The centre MUST
   stay fully transparent or it hides the spinning wheel face. */
.wheel-rim::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: conic-gradient(from 200deg, #FFF0DC, #FBD3A5, #C98A4B, #FFE7CE, #E9A45E, #FFF0DC);
    /* closest-side is essential: the default farthest-corner makes 100% the
       half-diagonal (0.707w), which shrinks the hole and fattens the ring. */
    -webkit-mask: radial-gradient(circle closest-side at 50% 50%,
                  transparent calc(100% - var(--rim-w)),
                  #000 calc(100% - var(--rim-w) + 1px));
            mask: radial-gradient(circle closest-side at 50% 50%,
                  transparent calc(100% - var(--rim-w)),
                  #000 calc(100% - var(--rim-w) + 1px));
}

/* Flat ring for engines without mask support — never a filled disc. */
@supports not ((-webkit-mask: radial-gradient(#000, #000)) or (mask: radial-gradient(#000, #000))) {
    .wheel-rim::before { display: none; }
    .wheel-rim {
        border: var(--rim-w) solid #E9C089;
        box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.5),
                    0 0 0 2px rgba(140, 90, 40, 0.9);
    }
}

/* bulb lights around the rim */
.rim-lights { position: absolute; inset: 0; }
.rim-lights i {
    position: absolute;
    left: 50%;
    top: 50%;
    width: calc(var(--wheel) * 0.022);
    height: calc(var(--wheel) * 0.022);
    margin: calc(var(--wheel) * -0.011) 0 0 calc(var(--wheel) * -0.011);
    border-radius: 50%;
    background: #FFF6E8;
    box-shadow: 0 0 calc(var(--wheel) * 0.02) rgba(255, 240, 220, 0.9);
    transform: rotate(var(--a)) translateY(calc(var(--wheel) * -0.478));
    animation: bulb 1.4s ease-in-out infinite;
}
.rim-lights i:nth-child(odd) { animation-delay: .7s; }
@keyframes bulb {
    0%, 100% { opacity: 1; }
    50%      { opacity: .25; }
}

/* top pointer aiming down into the wheel */
.wheel-pointer {
    position: absolute;
    left: 50%;
    top: calc(var(--wheel) * -0.045);
    width: calc(var(--wheel) * 0.10);
    height: calc(var(--wheel) * 0.14);
    transform: translateX(-50%);
    background: linear-gradient(180deg, #FFF0DC 0%, #FBD3A5 45%, #C98A4B 100%);
    clip-path: polygon(50% 100%, 0 0, 100% 0);
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.6));
    z-index: 7;
}

/* centre hub */
.wheel-hub {
    position: absolute;
    left: 50%;
    top: 50%;
    width: calc(var(--wheel) * 0.16);
    height: calc(var(--wheel) * 0.16);
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: radial-gradient(circle at 38% 32%, #FFF6E8 0%, #FBD3A5 40%, #C98A4B 75%, #8A5A2B 100%);
    border: calc(var(--wheel) * 0.012) solid #A50034;
    box-shadow: 0 0 calc(var(--wheel) * 0.04) rgba(0, 0, 0, 0.6),
                inset 0 2px 6px rgba(255, 255, 255, 0.55);
    z-index: 6;
}

/* Wedge overlay — anchored at centre, rotated, content offset outward */
.wedge {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 0;
    height: 0;
    transform-origin: 0 0;
    pointer-events: none;
}
/* Product shots sit at ~62% of the radius along each wedge centreline.
   The supplied photos have light backgrounds, so each sits in a white
   circular chip — reads as a deliberate token on the dark/red slices. */
.wedge img {
    position: absolute;
    width: calc(var(--wheel) * 0.20);
    height: calc(var(--wheel) * 0.20);
    object-fit: cover;
    border-radius: 50%;
    background: #fff;
    border: calc(var(--wheel) * 0.008) solid #FFF0DC;
    box-shadow: 0 0 calc(var(--wheel) * 0.025) rgba(0, 0, 0, 0.5);
    left: calc(var(--wheel) * -0.10);
    top: calc(-1 * (var(--wheel) / 2) * 0.62);
    transform: translateY(-50%);
}
/* TRY AGAIN wedge text (peach on the charcoal slice). Reads upright
   when the wedge lands under the TOP 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.62);
    transform: translateY(-50%);
    font-weight: 900;
    font-size: calc(var(--wheel) * 0.055);
    line-height: 1.1;
    letter-spacing: 2px;
    color: #FBD3A5;
    text-align: center;
    text-shadow: 0 0 10px rgba(251, 211, 165, 0.45);
}

.spin-btn {
    width: 40vw;
    max-width: 280px;
    height: 7.5vh;
    min-height: 56px;
    max-height: 90px;
    margin-top: 3.5vh;
    font-size: clamp(22px, 4.5vw, 34px);
    flex-shrink: 0;
    z-index: 1;
}

/* ====================== SCREENS 3 & 4 : RESULT ======================
   Dark glossy frame holding an LG-red ticket with serrated edges. */
.screen-result {
    justify-content: flex-start;
    padding-top: 5vh;
}

.result-frame {
    margin-top: 3.5vh;
    width: min(74vw, 520px);
    padding: 7% 8%;
    background: linear-gradient(160deg, #260610 0%, #0A0104 55%, #1A030B 100%);
    border: 1px solid rgba(251, 211, 165, 0.18);
    border-radius: 8px;
    box-shadow: 0 1.5vh 4vh rgba(0, 0, 0, 0.7),
                inset 0 0 40px rgba(0, 0, 0, 0.8),
                inset 0 1px 0 rgba(255, 255, 255, 0.10);
    display: flex;
    align-items: center;
    justify-content: center;
}

.result-ticket {
    position: relative;
    width: 100%;
    background: linear-gradient(160deg, #C4003F 0%, #A50034 60%, #7E0027 100%);
    padding: 9% 6% 8%;
    text-align: center;
    filter: drop-shadow(0 0.8vh 2vh rgba(0, 0, 0, 0.55));
}
/* serrated ticket teeth on top and bottom edges */
.result-ticket::before,
.result-ticket::after {
    content: '';
    position: absolute;
    left: 0;
    width: 100%;
    height: 12px;
    background-image:
        linear-gradient(-45deg, transparent 70%, #A50034 71%),
        linear-gradient(45deg, transparent 70%, #A50034 71%);
    background-size: 16px 12px;
    background-repeat: repeat-x;
}
.result-ticket::before {
    top: -11px;
    background-position: 8px 0, 0 0;
}
.result-ticket::after {
    bottom: -11px;
    transform: scaleY(-1);
    background-position: 8px 0, 0 0;
}

/* "You Won!" / "Oops...!" script-style headline */
.win-oops {
    font-family: Georgia, 'Times New Roman', serif;
    font-style: italic;
    font-weight: 700;
    font-size: clamp(38px, 10vw, 76px);
    line-height: 1.05;
    color: #fff;
    text-shadow: 0 3px 8px rgba(0, 0, 0, 0.35);
    margin-bottom: 7%;
}

/* won product shot inside the ticket */
.win-prize-shot {
    width: 40%;
    margin: 0 auto 6%;
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    background: #fff;
    border: 4px solid #FFF0DC;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
    overflow: hidden;
}
.win-prize-shot img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* dark band carrying the prize name */
.result-band {
    background: #0c0004;
    color: #FFE7CE;
    font-size: clamp(17px, 4.2vw, 30px);
    font-weight: 800;
    padding: 4% 3%;
    letter-spacing: 1px;
    line-height: 1.25;
}
