/* ── Reset & Base ── */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Nunito', sans-serif;
    min-height: 100vh;
    background: linear-gradient(135deg, #0f0c29 0%, #302b63 50%, #24243e 100%);
    color: #fff;
    overflow-x: hidden;
}

/* ── Floating Ambient Blobs ── */
.blob {
    position: fixed;
    border-radius: 50%;
    filter: blur(90px);
    opacity: 0.14;
    pointer-events: none;
    z-index: 0;
    animation: blobFloat 10s ease-in-out infinite alternate;
}

.blob1 {
    width: 420px;
    height: 420px;
    background: #9B72CF;
    top: -120px;
    left: -120px;
}

.blob2 {
    width: 380px;
    height: 380px;
    background: #FF6B9D;
    bottom: -100px;
    right: -100px;
    animation-delay: -4s;
}

.blob3 {
    width: 280px;
    height: 280px;
    background: #5B9BD5;
    top: 40%;
    left: 55%;
    animation-delay: -7s;
}

@keyframes blobFloat {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(28px, 38px) scale(1.1); }
}

/* ── Section System ── */
.section {
    display: none;
    position: relative;
    z-index: 1;
}

.section.active {
    display: flex;
    animation: fadeSlideIn 0.5s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes fadeSlideIn {
    from { opacity: 0; transform: translateY(28px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ── Gradient Text ── */
.gradient-text {
    background: linear-gradient(135deg, #FF6B9D 0%, #C97DDB 50%, #5B9BD5 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ── Glass Card ── */
.glass-card {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.13);
    border-radius: 22px;
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

/* ── Buttons ── */
.btn-glow {
    background: linear-gradient(135deg, #FF6B9D 0%, #9B72CF 100%);
    color: #fff;
    border: none;
    border-radius: 99px;
    font-family: 'Fredoka One', sans-serif;
    font-size: 1.15rem;
    letter-spacing: 0.04em;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 8px 28px rgba(155, 114, 207, 0.55), 0 0 50px rgba(255, 107, 157, 0.18);
}

.btn-glow::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.22), transparent 60%);
    border-radius: inherit;
}

.btn-glow:hover:not(:disabled) {
    transform: translateY(-4px) scale(1.05);
    box-shadow: 0 18px 42px rgba(155, 114, 207, 0.7), 0 0 70px rgba(255, 107, 157, 0.35);
}

.btn-glow:active:not(:disabled) {
    transform: translateY(-1px) scale(1.02);
}

.btn-glow:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.btn-outline {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.8);
    border: 2px solid rgba(255, 255, 255, 0.18);
    border-radius: 99px;
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.22s ease;
    backdrop-filter: blur(8px);
}

.btn-outline:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.35);
    transform: translateY(-2px);
}

.btn-danger {
    background: linear-gradient(135deg, #FF5E7E 0%, #FF8E53 100%);
    color: #fff;
    border: none;
    border-radius: 99px;
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 6px 22px rgba(255, 94, 126, 0.45);
}

.btn-danger:hover:not(:disabled) {
    transform: translateY(-3px) scale(1.04);
    box-shadow: 0 14px 34px rgba(255, 94, 126, 0.65);
}

.btn-danger:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.btn-success {
    background: linear-gradient(135deg, #52C99C 0%, #5B9BD5 100%);
    color: #fff;
    border: none;
    border-radius: 99px;
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 6px 22px rgba(82, 201, 156, 0.45);
}

.btn-success:hover {
    transform: translateY(-3px) scale(1.04);
    box-shadow: 0 14px 34px rgba(82, 201, 156, 0.65);
}

/* ── Pulse animation for Spin button ── */
@keyframes pulseBtn {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 8px 28px rgba(155, 114, 207, 0.55), 0 0 50px rgba(255, 107, 157, 0.18);
    }
    50% {
        transform: scale(1.04);
        box-shadow: 0 12px 38px rgba(155, 114, 207, 0.75), 0 0 70px rgba(255, 107, 157, 0.3);
    }
}

.btn-pulse {
    animation: pulseBtn 2.2s ease-in-out infinite;
}

.btn-pulse:hover {
    animation: none;
}

/* ── Textarea ── */
textarea {
    background: rgba(255, 255, 255, 0.06);
    border: 2px solid rgba(255, 255, 255, 0.14);
    color: #fff;
    border-radius: 16px;
    font-family: 'Nunito', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    resize: vertical;
    width: 100%;
    transition: border-color 0.2s, box-shadow 0.2s;
}

textarea:focus {
    outline: none;
    border-color: rgba(155, 114, 207, 0.65);
    box-shadow: 0 0 0 4px rgba(155, 114, 207, 0.18);
}

textarea::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

/* ── Wheel Layout ── */
#wheel-container {
    position: relative;
    display: inline-block;
}

/* Pointer (fixed at top of wheel-container) */
.pointer-wrap {
    position: absolute;
    top: -18px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.pointer-triangle {
    width: 0;
    height: 0;
    border-left: 14px solid transparent;
    border-right: 14px solid transparent;
    border-top: 32px solid #FFD700;
    filter: drop-shadow(0 4px 12px rgba(255, 215, 0, 0.9));
}

/* Wheel glow ring */
.wheel-glow-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 115%;
    height: 115%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: radial-gradient(circle, rgba(155, 114, 207, 0.25) 0%, rgba(255, 107, 157, 0.15) 40%, transparent 70%);
    pointer-events: none;
    z-index: -1;
    animation: glowPulse 2.5s ease-in-out infinite alternate;
}

@keyframes glowPulse {
    0% { opacity: 0.5; transform: translate(-50%, -50%) scale(0.96); }
    100% { opacity: 1; transform: translate(-50%, -50%) scale(1.04); }
}

/* Wheel wrapper (this rotates via CSS) */
#wheel-wrapper {
    display: block;
    transform-origin: center center;
    transition: transform 5s cubic-bezier(0.17, 0.67, 0.12, 0.99);
}

#wheel-canvas {
    display: block;
    border-radius: 50%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55), 0 0 50px rgba(155, 114, 207, 0.3);
}

/* ── Item chips ── */
.item-chip {
    border-radius: 99px;
    padding: 4px 12px;
    font-size: 0.78rem;
    font-weight: 800;
    white-space: nowrap;
    max-width: 110px;
    overflow: hidden;
    text-overflow: ellipsis;
    border: 1.5px solid;
}

/* ── Winner Card ── */
.winner-card {
    background: linear-gradient(135deg, rgba(155, 114, 207, 0.28), rgba(255, 107, 157, 0.18));
    border: 2px solid rgba(255, 255, 255, 0.18);
    border-radius: 26px;
    backdrop-filter: blur(22px);
}

@keyframes winnerPop {
    0% { opacity: 0; transform: scale(0.4) rotate(-8deg); }
    65% { transform: scale(1.12) rotate(3deg); }
    100% { opacity: 1; transform: scale(1) rotate(0deg); }
}

.winner-pop {
    animation: winnerPop 0.65s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* ── Confetti ── */
.confetti-piece {
    position: fixed;
    opacity: 0;
    z-index: 9999;
    pointer-events: none;
    animation: confettiFall linear forwards;
}

@keyframes confettiFall {
    0% { opacity: 1; transform: translateY(-10px) rotate(0deg); }
    100% { opacity: 0; transform: translateY(110vh) rotate(740deg); }
}

/* ── Stars/sparkle decoration ── */
@keyframes twinkle {
    0%, 100% { opacity: 0.2; transform: scale(0.8); }
    50% { opacity: 1; transform: scale(1.2); }
}

.star {
    animation: twinkle linear infinite;
}

/* ── Bouncing icon ── */
@keyframes bounceIcon {
    0%, 100% { transform: translateY(0) rotate(-3deg); }
    50% { transform: translateY(-14px) rotate(3deg); }
}

/* ── Spinning indicator ── */
@keyframes spinnerRing {
    to { transform: rotate(360deg); }
}

.spin-ring {
    width: 22px;
    height: 22px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spinnerRing 0.7s linear infinite;
    display: inline-block;
}

/* ── Toast notification ── */
#toast {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%) translateY(80px);
    background: rgba(30, 20, 60, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #fff;
    padding: 12px 24px;
    border-radius: 99px;
    font-weight: 800;
    font-size: 0.9rem;
    z-index: 9998;
    backdrop-filter: blur(12px);
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    white-space: nowrap;
}

#toast.show {
    transform: translateX(-50%) translateY(0);
}

/* ── Responsive canvas max-width ── */
@media (max-width: 420px) {
    #wheel-canvas {
        max-width: calc(100vw - 60px);
        max-height: calc(100vw - 60px);
    }
}
