@import url('https://fonts.googleapis.com/css2?family=Assistant:wght@400;600;700&display=swap');

/* Fix icons and remove outlines */
* {
    outline: none !important;
    -webkit-tap-highlight-color: transparent;
}

/* Wheel page: viewport lock, no scroll */
.wheel-page {
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    height: -webkit-fill-available !important;
    overflow: hidden !important;
    margin: 0 !important;
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000px;
}
.wheel-bg {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.2);
    pointer-events: none;
    z-index: -1;
}
@keyframes gradient-shift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* Prevent background scrolling; wheel page gradient and typography */
body.wheel-page {
    overflow: hidden !important;
    touch-action: none;
    position: fixed;
    width: 100%;
    background: linear-gradient(135deg, #00d2ff 0%, #3a7bd5 50%, #ee0979 100%);
    background-size: 200% 200%;
    animation: gradient-shift 12s ease infinite;
    color: #fff;
    font-family: 'Assistant', sans-serif;
}

/* Lock wheel content: no scroll, full viewport, space for nav */
.wheel-app-frame {
    height: 100vh !important;
    height: -webkit-fill-available !important;
    display: flex !important;
    flex-direction: column !important;
    padding-bottom: 85px !important;
    overflow: hidden !important;
}

.wheel-header {
    position: relative;
    text-align: center;
    padding: 1.5rem 1rem;
}
.wheel-back-link {
    position: absolute;
    top: 50%;
    right: 0.75rem;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    color: #fff;
    text-decoration: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transition: background 0.2s ease;
}
.wheel-back-link:hover {
    background: rgba(255, 255, 255, 0.35);
}
.wheel-back-link [data-lucide],
.wheel-back-link svg {
    width: 1.25rem;
    height: 1.25rem;
}
[dir="ltr"] .wheel-back-link {
    right: auto;
    left: 0.75rem;
}

/* Nav on wheel page: ensure it shows over content */
.wheel-page-nav {
    z-index: 9998;
}
.wheel-title {
    margin: 0 0 0.35rem;
    font-size: 1.75rem;
    font-weight: 800;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}
.wheel-subtitle {
    margin: 0;
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.75);
}

.wheel-main {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 1rem 2rem;
}

/* Wheel container: needle fixed at top, wheel rotates inside */
.wheel-container {
    position: relative;
    width: min(320px, 90vw);
    aspect-ratio: 1;
    margin-bottom: 1.5rem;
}
.wheel-needle {
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 14px solid transparent;
    border-right: 14px solid transparent;
    border-top: 28px solid #f59e0b;
    filter: drop-shadow(0 0 8px rgba(245, 158, 11, 0.8));
    z-index: 10;
    pointer-events: none;
}
.wheel-outer {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 3px solid rgba(255, 255, 255, 0.2);
    box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.3), 0 0 30px rgba(0, 0, 0, 0.2);
    padding: 8px;
    box-sizing: border-box;
}
.wheel-rotate {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    overflow: hidden;
}
.wheel-svg {
    width: 100%;
    height: 100%;
    display: block;
}

/* 6 slices: glass effect + neon border */
.wheel-slice {
    fill: rgba(255, 255, 255, 0.15);
    stroke: rgba(255, 255, 255, 0.35);
    stroke-width: 1.5;
    transition: fill 0.2s ease;
}
.wheel-slice:hover {
    fill: rgba(255, 255, 255, 0.22);
}
.wheel-slice[data-slice="0"] { filter: url(#wheelGlow); }
.wheel-slice[data-slice="1"] { filter: url(#wheelGlow); }
.wheel-slice[data-slice="2"] { filter: url(#wheelGlow); }
.wheel-slice[data-slice="3"] { filter: url(#wheelGlow); }
.wheel-slice[data-slice="4"] { filter: url(#wheelGlow); }
.wheel-slice[data-slice="5"] { filter: url(#wheelGlow); }
.wheel-center {
    fill: #1e293b;
    stroke: rgba(255, 255, 255, 0.4);
    stroke-width: 2;
}

/* Slice icons: emoji centered in each slice; micro-animation pulse */
.slice-icon-wrap {
    transform-origin: 0 0;
}
.slice-icon {
    font-size: 26px;
    fill: #fff;
    text-anchor: middle;
    dominant-baseline: central;
    transform-origin: 0 0;
    animation: icon-pulse 2s ease-in-out infinite;
}
@keyframes icon-pulse {
    0%, 100% { transform: scale(0.95); }
    50% { transform: scale(1.05); }
}

/* When spinning: subtle motion blur glow on icons */
.wheel-rotate.is-spinning .slice-icon {
    filter: url(#iconMotionBlur);
}

/* When stopped: winning slice gets pulsating neon border */
.wheel-slice.slice-winner {
    stroke-width: 3;
    filter: url(#sliceWinnerGlow);
    animation: slice-winner-pulse 1s ease-in-out infinite;
}
@keyframes slice-winner-pulse {
    0%, 100% { stroke: #fbbf24; opacity: 1; }
    50% { stroke: #fcd34d; opacity: 0.95; }
}

/* GO phase: linear infinite rotation */
.wheel-rotate.is-spinning {
    animation: wheel-spin 1.2s linear infinite;
}
@keyframes wheel-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* STOP phase: 5s cubic-bezier slow-down, premium smooth deceleration */
.wheel-rotate.is-stopping {
    animation: none;
    transition: transform 5s cubic-bezier(0.1, 0, 0.1, 1);
}

/* Buttons */
.wheel-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
}
.wheel-empty-msg {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.95);
    text-align: center;
    padding: 0.5rem 1rem;
}
.wheel-empty-msg.hidden {
    display: none !important;
}
.wheel-btn-go:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}
.wheel-btn {
    padding: 0.85rem 2rem;
    border-radius: 14px;
    font-size: 1.1rem;
    font-weight: 700;
    border: none;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.wheel-btn-go {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: #fff;
    box-shadow: 0 4px 20px rgba(34, 197, 94, 0.4);
}
.wheel-btn-go:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 24px rgba(34, 197, 94, 0.5);
}
.wheel-btn-stop {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #fff;
    box-shadow: 0 4px 20px rgba(239, 68, 68, 0.4);
}
.wheel-btn-stop:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 24px rgba(239, 68, 68, 0.5);
}

/* Prize modal: full-screen dark overlay */
#prizeModal,
.prize-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.85) !important;
}
.prize-modal.hidden {
    display: none !important;
}
.prize-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
.prize-modal-content {
    position: relative;
    width: 100% !important;
    max-width: 500px !important;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 60vh;
    padding: 50px 10px 10px;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-radius: 20px;
    animation: fadeIn 0.4s ease-out;
    filter: none;
}
.prize-modal-body {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
@keyframes modal-glow-pulse {
    0%, 100% { box-shadow: 0 0 30px rgba(255, 255, 255, 0.3), 0 0 60px rgba(0, 210, 255, 0.2); }
    50% { box-shadow: 0 0 40px rgba(255, 255, 255, 0.4), 0 0 80px rgba(0, 210, 255, 0.3); }
}
.prize-modal-title {
    margin: 0 0 1rem;
    font-size: 1.6rem;
    font-weight: 700;
    font-family: 'Assistant', sans-serif;
    color: #ffffff;
    text-align: center;
    text-shadow: none;
    filter: none;
    letter-spacing: 0.02em;
}
#prizeModalBody,
.prize-modal-body {
    position: relative !important;
    margin-bottom: 1rem;
    width: 95%;
    max-width: 500px;
    padding: 10px;
}
.prize-text {
    margin: 0 0 0.5rem;
    font-size: 1.4rem;
    font-weight: 700;
    font-family: 'Assistant', sans-serif;
    color: #ffffff;
    text-shadow: none;
    filter: none;
}
.prize-desc {
    margin: 0;
    font-size: 0.95rem;
    font-family: 'Assistant', sans-serif;
    color: #ffffff;
    line-height: 1.5;
    opacity: 0.95;
    text-shadow: none;
    filter: none;
}
.wheel-btn-claim {
    display: block;
    width: 100%;
    margin-bottom: 0.75rem;
    padding: 0.9rem 1.25rem;
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: #ffffff !important;
    font-size: 1.05rem;
    font-weight: 700;
    font-family: 'Assistant', sans-serif;
    border: none;
    border-radius: 14px;
    cursor: pointer;
    box-shadow: 0 4px 24px rgba(34, 197, 94, 0.5);
    filter: none;
    text-shadow: none;
    animation: claim-pulse 2s ease-in-out infinite;
}
.wheel-btn-claim:hover {
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
    box-shadow: 0 6px 24px rgba(34, 197, 94, 0.5);
}
.wheel-btn-claim:disabled {
    opacity: 0.85;
    cursor: default;
    animation: none;
}
@keyframes claim-pulse {
    0%, 100% { transform: scale(1); box-shadow: 0 4px 20px rgba(34, 197, 94, 0.4); }
    50% { transform: scale(1.02); box-shadow: 0 6px 24px rgba(34, 197, 94, 0.5); }
}
.prize-saved-msg {
    margin: 0 0 0.75rem;
    font-size: 1rem;
    font-weight: 600;
    font-family: 'Assistant', sans-serif;
    color: #ffffff;
    text-align: center;
    text-shadow: none;
}
.prize-saved-msg.hidden {
    display: none !important;
}
.wheel-btn-close {
    display: block;
    width: 100%;
    background: rgba(255, 255, 255, 0.25);
    color: #ffffff;
    font-family: 'Assistant', sans-serif;
}
.wheel-btn-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Confetti container: burst from wheel center */
.confetti-container {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 2147483647;
}
.confetti-piece {
    position: fixed;
    width: 8px;
    height: 8px;
    transform-origin: 0 0;
    border-radius: 50%;
}
.confetti-piece.confetti-rect {
    border-radius: 2px;
}
@keyframes confetti-burst {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) translate(calc(var(--dx) * 1px), calc(var(--dy) * 1px)) scale(1);
        opacity: 0;
    }
}

/* Bottom nav: match root for wheel page */
.bottom-nav {
    position: fixed !important;
    bottom: 2px !important;
    left: 0 !important;
    right: 0 !important;
    height: 72px !important;
    background: rgba(255, 255, 255, 0.92) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    z-index: 10000 !important;
    contain: paint;
    display: flex !important;
    justify-content: space-around !important;
    align-items: center !important;
    border-top: 1px solid rgba(255, 255, 255, 0.1) !important;
}

/* Nav icons: visible on wheel gradient background */
.bottom-nav .nav-button .icon i {
    stroke: #ffffff !important;
    opacity: 1 !important;
    stroke-width: 2.5px !important;
}

/* Wallet badge: red bubble at top-right of icon */
.nav-badge {
    position: absolute !important;
    top: -5px !important;
    right: -8px !important;
    background: #ef4444 !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    color: white !important;
    font-size: 10px !important;
    padding: 2px 5px !important;
    border-radius: 10px !important;
    min-width: 16px;
    z-index: 10;
}
.nav-button-wallet {
    position: relative !important;
}

/* Wheel coupon card modal: expanded card UI (matches feed) */
.wheel-coupon-card-wrap {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    visibility: hidden;
    transition: none;
    pointer-events: none;
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000px;
}
.wheel-coupon-card-wrap.visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}
.wheel-coupon-card-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
}
.wheel-coupon-card-scroll {
    position: relative;
    width: 100%;
    max-width: 420px;
    max-height: 90vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.wheel-card-loading {
    padding: 2rem;
    text-align: center;
    color: #64748b;
    font-size: 1rem;
}
.wheel-coupon-card-inner .coupon-card {
    margin: 0;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}
.wheel-coupon-card-inner .card-hero {
    display: block !important;
    height: 200px !important;
    width: 100% !important;
    position: relative !important;
    overflow: hidden !important;
    background: #f1f5f9; /* Light gray while loading */
}
.wheel-coupon-card-inner .card-hero img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
}
.wheel-coupon-card-inner .card-hero .card-hero-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f1f5f9;
}
.wheel-coupon-card-inner .card-hero .card-hero-placeholder.hidden {
    display: none;
}
.wheel-coupon-card-inner .feed-view-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    border-radius: 12px;
    font-weight: 500;
    font-size: 0.95rem;
    background: transparent;
    border: 2px solid #94a3b8;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s;
}
.wheel-coupon-card-inner .feed-view-btn:hover {
    background: #f1f5f9;
    border-color: #64748b;
    color: #475569;
}
.wheel-coupon-card-inner .wallet-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}
.wheel-coupon-card-inner .feed-claim-btn-disabled,
.wheel-coupon-card-inner .feed-claim-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    background: #94a3b8 !important;
}

/* Wheel premium ticket modal (full barcode/QR view) */
.wheel-premium-ticket-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s, visibility 0.25s;
    pointer-events: none;
}
.wheel-premium-ticket-modal.visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}
.wheel-premium-ticket-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
}
.wheel-premium-ticket-container {
    position: relative;
    width: 100%;
    max-width: 420px;
    max-height: 90vh;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.wheel-premium-ticket-close {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 10;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.08);
    color: #374151;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.wheel-premium-ticket-iframe {
    width: 100%;
    height: 75vh;
    min-height: 400px;
    border: none;
    display: block;
}

.card-close-btn {
    position: absolute !important;
    top: 15px !important;
    right: 15px !important;
    width: 32px !important;
    height: 32px !important;
    background: rgba(255, 255, 255, 0.9) !important;
    border: 1px solid rgba(0,0,0,0.1) !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 18px !important;
    color: #333 !important;
    cursor: pointer !important;
    z-index: 999 !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1) !important;
    padding: 0 !important;
    line-height: 1 !important;
}
