:root {
    --bg-color: #050505;
    --card-bg: rgba(22, 22, 28, 0.6);
    --glass-border: rgba(255, 255, 255, 0.08);

    /* Brand Colors */
    --primary: #6c5ce7;
    --primary-glow: rgba(108, 92, 231, 0.6);
    --secondary: #00cec9;
    --danger: #ff7675;
    --success: #00b894;
    --text-primary: #ffffff;
    --text-secondary: #a0a0b0;

    /* Gradients */
    --gold-gradient: linear-gradient(135deg, #fdcb6e 0%, #d63031 100%);
    --hero-gradient: linear-gradient(135deg, #a29bfe 0%, #6c5ce7 100%);

    /* Spacing */
    --nav-height: 70px;
    --safe-top: env(safe-area-inset-top, 24px);
    --safe-bottom: env(safe-area-inset-bottom, 20px);
    --header-spacing: 80px;
    /* Increased from 40px for better clearance */
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    font-family: 'Inter', system-ui, sans-serif;
    /* Performance: reduce paint complexity */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

#app {
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
    padding-top: 0;
    /* Removed fixed padding */
}

.content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0 24px;
    padding-top: calc(var(--safe-top) + var(--header-spacing));
    padding-bottom: calc(var(--nav-height) + 40px);
    scrollbar-width: none;
    /* Performance: native momentum scrolling */
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    /* GPU acceleration without jank */
    transform: translate3d(0, 0, 0);
    -webkit-transform: translate3d(0, 0, 0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    /* Prevent layout thrashing */
    contain: layout style;
}

.content::-webkit-scrollbar {
    display: none;
}

/* Global Components */
.action-btn {
    width: 100%;
    padding: 16px;
    border-radius: 16px;
    border: none;
    background: rgba(255, 255, 255, 0.08);
    color: white;
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 12px;
    transition: transform 0.1s, background 0.2s;
}

.action-btn:active {
    transform: scale(0.98);
    background: rgba(255, 255, 255, 0.15);
}

.action-btn.primary {
    background: var(--primary);
    box-shadow: 0 4px 15px var(--primary-glow);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.section {
    display: none;
    animation: fadeIn 0.4s ease-out;
}

.section.active {
    display: block;
}

/* Navigation Bar */
/* Navigation Bar - iOS 16 Glassmorphism */
.bottom-nav {
    position: fixed;
    bottom: 30px;
    left: 20px;
    right: 20px;
    height: 72px;
    background: rgba(22, 22, 28, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 40px;
    display: flex;
    justify-content: space-around;
    align-items: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    z-index: 900;
    /* Performance: GPU layer */
    transform: translate3d(0, 0, 0);
    -webkit-transform: translate3d(0, 0, 0);
    contain: layout style;
}

.nav-item {
    background: none;
    border: none;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    opacity: 0.5;
    transition: all 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
    width: 60px;
    height: 100%;
    position: relative;
    cursor: pointer;
}

.nav-logo-svg {
    width: 26px;
    height: 26px;
    fill: currentColor;
    stroke: currentColor;
    stroke-width: 0;
    transition: all 0.4s ease;
}

.nav-item span {
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.3px;
    transition: all 0.3s ease;
}

/* Active State */
.nav-item.active {
    opacity: 1;
    color: white;
}

.nav-item.active .nav-logo-svg {
    transform: translateY(-2px);
    fill: #a29bfe;
    /* Fallback active color */
    filter: drop-shadow(0 0 12px rgba(162, 155, 254, 0.6));
}

.nav-item.active span {
    font-weight: 600;
    color: #fff;
    transform: translateY(-2px);
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

/* Tap Highlight (iOS feel) */
.nav-item:active {
    transform: scale(0.92);
    opacity: 0.8;
}

/* Reward Overlay */
.reward-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 2000;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease-out;
}

.reward-content {
    text-align: center;
    transform: scale(0.8);
    animation: popIn 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
}

@keyframes popIn {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }

    70% {
        transform: scale(1.1);
        opacity: 1;
    }

    100% {
        transform: scale(1);
    }
}

.reward-title {
    font-size: 32px;
    font-weight: 800;
    margin-bottom: 20px;
    margin-bottom: 20px;
    background: var(--gold-gradient);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-transform: uppercase;
    letter-spacing: 2px;
    filter: drop-shadow(0 0 10px rgba(253, 203, 110, 0.5));
}

.reward-amount {
    font-size: 64px;
    font-weight: 900;
    color: white;
    margin-bottom: 30px;
    text-shadow: 0 0 30px rgba(108, 92, 231, 0.8);
}

.reward-btn {
    padding: 16px 40px;
    font-size: 18px;
    background: white;
    color: black;
    border: none;
    border-radius: 30px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.4);
    transition: transform 0.2s;
}

.reward-btn:active {
    transform: scale(0.95);
}

/* Oops Popup (Spin Wheel Loss) */
.oops-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 2000;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    transform: translateZ(0);
    backface-visibility: hidden;
}

.oops-overlay.visible {
    opacity: 1;
}

.oops-content {
    text-align: center;
    transform: scale(0.8);
    animation: oopsPopIn 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
}

@keyframes oopsPopIn {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }

    70% {
        transform: scale(1.05);
        opacity: 1;
    }

    100% {
        transform: scale(1);
    }
}

.oops-emoji {
    font-size: 80px;
    margin-bottom: 16px;
    animation: oopsShake 0.5s ease-in-out;
}

@keyframes oopsShake {

    0%,
    100% {
        transform: translateX(0);
    }

    20%,
    60% {
        transform: translateX(-8px);
    }

    40%,
    80% {
        transform: translateX(8px);
    }
}

.oops-title {
    font-size: 32px;
    font-weight: 800;
    margin-bottom: 12px;
    background: linear-gradient(135deg, #ff7675 0%, #d63031 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.oops-message {
    font-size: 20px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 8px;
}

.oops-encourage {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 28px;
}

.oops-btn {
    padding: 16px 40px;
    font-size: 18px;
    background: linear-gradient(135deg, #6c5ce7, #a29bfe);
    color: white;
    border: none;
    border-radius: 30px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 8px 25px rgba(108, 92, 231, 0.4);
    transition: transform 0.2s, box-shadow 0.2s;
}

.oops-btn:active {
    transform: scale(0.95);
    box-shadow: 0 4px 15px rgba(108, 92, 231, 0.3);
}

/* Confetti Helper */
.confetti-piece {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #ffd300;
    top: -10px;
    opacity: 0;
}

@keyframes confettiFall {
    0% {
        transform: translateY(-10vh) list-style(0deg);
        opacity: 1;
    }

    100% {
        transform: translateY(110vh) rotate(720deg);
        opacity: 0;
    }
}

/* Disabled States */
button:disabled,
.btn-disabled {
    opacity: 0.5;
    cursor: not-allowed !important;
    filter: grayscale(1);
    transform: none !important;
    box-shadow: none !important;
}

/* Toast Notification */
.toast-container {
    position: fixed;
    top: var(--safe-top);
    left: 0;
    width: 100%;
    pointer-events: none;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    gap: 10px;
}

.toast {
    background: rgba(30, 30, 35, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 12px 20px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    transform: translateY(-50px);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    max-width: 90%;
    pointer-events: auto;
}

.toast.visible {
    transform: translateY(0);
    opacity: 1;
}

.toast-icon {
    font-size: 20px;
}

.toast-message {
    font-size: 14px;
    font-weight: 500;
    color: white;
}

.toast.success {
    border-color: rgba(0, 184, 148, 0.3);
    background: rgba(0, 184, 148, 0.15);
}

.toast.error {
    border-color: rgba(255, 118, 117, 0.3);
    background: rgba(214, 48, 49, 0.15);
}

.toast.warning {
    border-color: rgba(253, 203, 110, 0.3);
    background: rgba(253, 203, 110, 0.15);
}