/* ===== CSS Variables & Theme ===== */
:root {
    --primary: #FF6B35;
    --primary-dark: #E55A2B;
    --primary-light: #FF8F5E;
    --secondary: #FFD700;
    --success: #00E676;
    --bg-gradient-start: #0F0C29;
    --bg-gradient-mid: #302B63;
    --bg-gradient-end: #24243E;
    --card-bg: rgba(255, 255, 255, 0.08);
    --card-border: rgba(255, 255, 255, 0.12);
    --card-border-hover: rgba(255, 255, 255, 0.2);
    --text-primary: #FFFFFF;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.45);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.4);
    --radius: 20px;
    --radius-sm: 14px;
    --radius-xs: 10px;
    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html, body {
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    font-family: var(--font);
    background: linear-gradient(135deg, var(--bg-gradient-start), var(--bg-gradient-mid), var(--bg-gradient-end));
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

body {
    display: flex;
    justify-content: center;
    padding: 0;
    background-attachment: fixed;
    position: relative;
}

/* ===== Background Decoration ===== */
.bg-decoration {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.bg-circle {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.15;
    animation: bgFloat 8s ease-in-out infinite;
}

.bg-circle-1 {
    width: 300px;
    height: 300px;
    background: var(--primary);
    top: -80px;
    right: -80px;
    animation-delay: 0s;
}

.bg-circle-2 {
    width: 250px;
    height: 250px;
    background: var(--secondary);
    bottom: 20%;
    left: -100px;
    animation-delay: -3s;
}

.bg-circle-3 {
    width: 200px;
    height: 200px;
    background: #7C4DFF;
    bottom: -60px;
    right: 20%;
    animation-delay: -6s;
}

@keyframes bgFloat {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(30px, -30px) scale(1.1); }
    66% { transform: translate(-20px, 20px) scale(0.9); }
}

/* ===== Container ===== */
.container {
    width: 100%;
    max-width: 480px;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 8px 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: relative;
    z-index: 1;
    justify-content: flex-start;
}

/* ===== Header ===== */
.header {
    text-align: center;
    padding: 6px 0 2px;
    animation: fadeInDown 0.6s ease-out;
}

/* ===== Header Logo with Dynamic Glow ===== */
.header-logo-wrapper {
    position: relative;
    display: inline-block;
    margin-bottom: 6px;
    width: 80px;
    height: 80px;
    animation: logoFloat 3s ease-in-out infinite;
}

.header-logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
    position: relative;
    z-index: 2;
    border-radius: 16px;
}

/* 动态发光层 */
.header-logo-glow {
    position: absolute;
    top: -20%;
    left: -20%;
    width: 140%;
    height: 140%;
    z-index: 1;
    pointer-events: none;
    background: radial-gradient(
        circle at center,
        rgba(255, 107, 53, 0.6) 0%,
        rgba(255, 215, 0, 0.4) 30%,
        rgba(255, 107, 53, 0.2) 50%,
        transparent 70%
    );
    animation: logoGlowPulse 2s ease-in-out infinite;
    border-radius: 50%;
}

/* 第二个发光层 - 旋转光晕 */
.header-logo-wrapper::after {
    content: '';
    position: absolute;
    top: -30%;
    left: -30%;
    width: 160%;
    height: 160%;
    z-index: 0;
    pointer-events: none;
    background: conic-gradient(
        from 0deg,
        transparent,
        rgba(255, 215, 0, 0.15),
        rgba(255, 107, 53, 0.2),
        rgba(255, 215, 0, 0.15),
        transparent
    );
    animation: logoGlowRotate 3s linear infinite;
    border-radius: 50%;
    mask: radial-gradient(circle at center, transparent 30%, black 31%, black 50%, transparent 51%);
    -webkit-mask: radial-gradient(circle at center, transparent 30%, black 31%, black 50%, transparent 51%);
}

@keyframes logoFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

@keyframes logoGlowPulse {
    0%, 100% {
        opacity: 0.6;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.1);
    }
}

@keyframes logoGlowRotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}


.header-title {
    font-size: 22px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--secondary), var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.3;
    letter-spacing: -0.5px;
}

.header-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 3px;
    font-weight: 500;
    letter-spacing: 0.3px;
}

/* ===== Prize Pool Card ===== */
.prize-pool-card {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 16px 16px 14px;
    text-align: center;
    box-shadow: var(--shadow);
    animation: fadeInUp 0.6s ease-out 0.1s both;
    transition: border-color var(--transition);
}

.prize-pool-card:hover {
    border-color: var(--card-border-hover);
}

.prize-pool-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 4px;
    font-weight: 500;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.prize-pool-amount {
    font-size: 34px;
    font-weight: 900;
    background: linear-gradient(135deg, #FFD700, #FF6B35, #FFD700);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
    margin-bottom: 12px;
    animation: goldShimmer 3s ease-in-out infinite;
}

@keyframes goldShimmer {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.prize-pool-amount .currency {
    font-size: 15px;
    font-weight: 700;
    -webkit-text-fill-color: var(--secondary);
    color: var(--secondary);
}

/* ===== Progress Section ===== */
.progress-section {
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-sm);
    padding: 12px;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.progress-label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

.progress-percent {
    font-size: 14px;
    font-weight: 800;
    color: var(--secondary);
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
}

/* ===== Progress Bar Track ===== */
.progress-bar-track {
    height: 12px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.progress-bar-fill {
    height: 100%;
    border-radius: 20px;
    background: linear-gradient(90deg, var(--primary), var(--secondary), var(--primary-light));
    background-size: 200% 100%;
    animation: shimmer 2.5s ease-in-out infinite;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.progress-bar-glow {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.4),
        transparent
    );
    animation: shimmerSlide 1.5s ease-in-out infinite;
}

/* ===== Progress Dots ===== */
.progress-dots {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

.progress-dot {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 4px;
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    z-index: 2;
}

/* ===== Progress Stats ===== */
.progress-stats {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 8px;
}

.progress-stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
}

.stat-value {
    font-size: 16px;
    font-weight: 800;
    color: var(--text-primary);
}

.stat-label {
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.progress-stat-divider {
    width: 1px;
    height: 24px;
    background: rgba(255, 255, 255, 0.1);
}

/* ===== Help Info Card ===== */
.help-info-card {
    background: linear-gradient(135deg, rgba(255, 107, 53, 0.12), rgba(255, 215, 0, 0.08));
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 107, 53, 0.2);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: fadeInUp 0.6s ease-out 0.2s both;
}

.help-info-icon {
    font-size: 26px;
    flex-shrink: 0;
    animation: pulse 2s ease-in-out infinite;
}

.help-info-text {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 3px;
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.help-info-count {
    font-size: 22px;
    font-weight: 800;
    color: var(--primary);
    margin: 0 3px;
    animation: pulse 1.5s ease-in-out infinite;
    text-shadow: 0 0 20px rgba(255, 107, 53, 0.3);
}

/* ===== Invite Button ===== */
.invite-btn {
    width: 100%;
    padding: 16px 24px;
    border: none;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    font-size: 17px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    transition: all var(--transition);
    box-shadow: 0 8px 24px rgba(255, 107, 53, 0.4);
    position: relative;
    overflow: hidden;
    animation: fadeInUp 0.6s ease-out 0.3s both;
    -webkit-tap-highlight-color: transparent;
    letter-spacing: 0.5px;
}

.invite-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
    transition: left 0.6s ease;
}

.invite-btn:hover::before {
    left: 100%;
}

.invite-btn:active {
    transform: scale(0.97);
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.3);
}

.invite-btn-icon {
    font-size: 24px;
    animation: bounce 2s ease-in-out infinite;
}

.invite-btn-text {
    position: relative;
    z-index: 1;
}

/* ===== Ripple Effect ===== */
.invite-btn-ripple {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.invite-btn:active .invite-btn-ripple {
    animation: ripple 0.6s ease-out;
}

@keyframes ripple {
    to {
        width: 300px;
        height: 300px;
        opacity: 0;
    }
}

/* ===== Reward Section ===== */
.reward-section {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 14px 14px 10px;
    box-shadow: var(--shadow);
    animation: fadeInUp 0.6s ease-out 0.4s both;
    overflow: hidden;
    transition: border-color var(--transition);
}

.reward-section:hover {
    border-color: var(--card-border-hover);
}

.reward-section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    padding: 0 2px;
}

.reward-section-icon {
    font-size: 18px;
}

.reward-section-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    flex: 1;
}

.reward-section-badge {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
    min-width: 20px;
    text-align: center;
}

/* ===== Reward Carousel ===== */
.reward-carousel-wrapper {
    overflow: hidden;
    position: relative;
    height: 310px;
    border-radius: var(--radius-xs);
}

.reward-carousel-wrapper::before,
.reward-carousel-wrapper::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    height: 24px;
    z-index: 2;
    pointer-events: none;
}

.reward-carousel-wrapper::before {
    top: 0;
    background: linear-gradient(to bottom, var(--card-bg), transparent);
}

.reward-carousel-wrapper::after {
    bottom: 0;
    background: linear-gradient(to top, var(--card-bg), transparent);
}

.reward-carousel {
    display: flex;
    flex-direction: column;
    gap: 8px;
    animation: scrollUp 15s linear infinite;
    padding: 4px 0;
}

.reward-carousel:hover {
    animation-play-state: paused;
}

.reward-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: var(--radius-xs);
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all var(--transition);
    flex-shrink: 0;
}

.reward-item:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateX(4px);
    border-color: rgba(255, 255, 255, 0.1);
}

.reward-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.3);
}

.reward-info {
    flex: 1;
    min-width: 0;
}

.reward-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.reward-desc {
    font-size: 12px;
    color: var(--secondary);
    margin-top: 2px;
    font-weight: 600;
}

.reward-time {
    font-size: 11px;
    color: var(--text-muted);
    flex-shrink: 0;
    white-space: nowrap;
}

/* ===== Bottom Safe Area ===== */
.bottom-safe {
    height: 20px;
    flex-shrink: 0;
}

/* ===== Completion Banner ===== */
#completionBanner {
    margin-top: 16px;
    padding: 12px 16px;
    background: linear-gradient(135deg, rgba(0,230,118,0.15), rgba(0,200,83,0.1));
    border: 1px solid rgba(0,230,118,0.3);
    border-radius: 12px;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    color: #00E676;
    animation: fadeInUp 0.5s ease;
}

/* ===== Animations ===== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes shimmer {
    0%, 100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}

@keyframes shimmerSlide {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.08);
    }
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-6px);
    }
}

@keyframes scrollUp {
    0% {
        transform: translateY(0);
    }
    100% {
        transform: translateY(-50%);
    }
}

/* ===== Telegram Mini App Safe Area ===== */
@supports (padding-top: env(safe-area-inset-top)) {
    .container {
        padding-top: calc(8px + env(safe-area-inset-top));
        padding-bottom: calc(20px + env(safe-area-inset-bottom));
    }
}

/* ===== Desktop Styles (min-width: 768px) ===== */
@media (min-width: 768px) {
    body {
        padding: 40px 20px;
        align-items: flex-start;
        background: linear-gradient(160deg, #0F0C29, #302B63, #24243E, #1a1a3e);
    }

    .container {
        max-width: 420px;
        padding: 28px 24px 40px;
        border-radius: 28px;
        background: rgba(15, 12, 41, 0.7);
        backdrop-filter: blur(40px);
        -webkit-backdrop-filter: blur(40px);
        border: 1px solid rgba(255, 255, 255, 0.08);
        box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 80px rgba(255, 107, 53, 0.05);
        min-height: auto;
        gap: 16px;
    }

    .bg-circle-1 {
        width: 400px;
        height: 400px;
        top: -120px;
        right: -120px;
    }

    .bg-circle-2 {
        width: 350px;
        height: 350px;
        bottom: 10%;
        left: -150px;
    }

    .bg-circle-3 {
        width: 280px;
        height: 280px;
        bottom: -80px;
        right: 15%;
    }

    .header {
        padding: 12px 0 6px;
    }

    .header-logo-wrapper {
        width: 100px;
        height: 100px;
    }

    .header-title {
        font-size: 28px;
    }

    .header-subtitle {
        font-size: 16px;
    }

    .prize-pool-card {
        padding: 28px 24px 22px;
    }

    .prize-pool-amount {
        font-size: 46px;
    }

    .prize-pool-amount .currency {
        font-size: 20px;
    }

    .progress-section {
        padding: 18px;
    }

    .progress-bar-track {
        height: 18px;
    }

    .stat-value {
        font-size: 20px;
    }

    .invite-btn {
        padding: 20px 24px;
        font-size: 19px;
        cursor: pointer;
    }

    .invite-btn:hover {
        transform: translateY(-2px);
        box-shadow: 0 12px 32px rgba(255, 107, 53, 0.5);
    }

    .reward-carousel-wrapper {
        height: 340px;
    }

    .reward-item {
        padding: 12px 16px;
    }

    .reward-item:hover {
        background: rgba(255, 255, 255, 0.1);
        transform: translateX(6px);
    }

    .bottom-safe {
        display: none;
    }
}

/* ===== Large Desktop (min-width: 1200px) ===== */
@media (min-width: 1200px) {
    body {
        padding: 60px 20px;
    }

    .container {
        max-width: 440px;
        padding: 32px 28px 48px;
    }
}

/* ===== Dark Scrollbar ===== */
::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}
