/* 全局重置与基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-gradient: linear-gradient(135deg, #ff6b9d 0%, #c44569 100%);
    --secondary-gradient: linear-gradient(135deg, #ff9ff3 0%, #f368e0 100%);
    --gold-gradient: linear-gradient(135deg, #ffd700 0%, #ffb347 100%);
    --success-gradient: linear-gradient(135deg, #ff6b9d 0%, #ff8a80 100%);
    
    --text-primary: #2c3e50;
    --text-secondary: #7f8c8d;
    --bg-primary: #f8fafc;
    --bg-card: #ffffff;
    
    --shadow-soft: 0 10px 40px rgba(0,0,0,0.1);
    --shadow-hover: 0 20px 60px rgba(0,0,0,0.15);
    --border-radius: 16px;
    
    --font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, sans-serif;
}

body {
    font-family: var(--font-family);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

/* 背景粒子画布 */
#particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: linear-gradient(135deg, #ff6b9d 0%, #c44569 50%, #ff9ff3 100%);
}

/* 主容器 */
.container {
    max-width: 414px;
    margin: 0 auto;
    padding: 20px;
    position: relative;
    z-index: 1;
}

/* 头部标题 */
.header {
    text-align: center;
    margin-bottom: 30px;
    animation: fadeInDown 1s ease-out;
}

.title {
    font-size: 28px;
    font-weight: 700;
    color: white;
    text-shadow: 0 2px 10px rgba(0,0,0,0.3);
    margin-bottom: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.title-icon {
    font-size: 36px;
    animation: bounce 2s infinite;
}

.title-subtitle {
    font-size: 16px;
    font-weight: 300;
    opacity: 0.9;
}


/* 抽奖区域 */
.lottery-section {
    text-align: center;
    margin-bottom: 40px;
}

/* 抽奖标题 */
.lottery-title {
    text-align: center;
    color: white;
    font-size: 20px;
    font-weight: 500;
    margin-bottom: 25px;
    text-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

/* 神秘卡片容器 */
.mystery-cards-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 30px;
    perspective: 1000px;
}

/* 神秘卡片 */
.mystery-card {
    aspect-ratio: 3/4;
    cursor: pointer;
    position: relative;
    transition: transform 0.3s ease;
    animation: cardFloat 0.6s ease-out forwards;
    opacity: 0;
    transform: translateY(30px);
}

.mystery-card:nth-child(1) { animation-delay: 0.1s; }
.mystery-card:nth-child(2) { animation-delay: 0.2s; }
.mystery-card:nth-child(3) { animation-delay: 0.3s; }
.mystery-card:nth-child(4) { animation-delay: 0.4s; }
.mystery-card:nth-child(5) { animation-delay: 0.5s; }
.mystery-card:nth-child(6) { animation-delay: 0.6s; }

.mystery-card:hover {
    transform: translateY(-8px) scale(1.05);
}

.mystery-card.disabled {
    cursor: not-allowed;
    opacity: 0.6;
    transform: scale(0.95);
}

.mystery-card.flipped .card-inner {
    transform: rotateY(180deg);
}

.mystery-card.winner {
    animation: winnerPulse 1.5s ease-in-out infinite;
    transform: scale(1.1);
    z-index: 10;
}

/* 卡片内部容器 */
.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    transform-style: preserve-3d;
}

/* 卡片正面 */
.card-front {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    background: var(--primary-gradient);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-soft);
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.card-front::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 50%, rgba(255,255,255,0.1) 1px, transparent 1px),
        radial-gradient(circle at 80% 50%, rgba(255,255,255,0.1) 1px, transparent 1px),
        radial-gradient(circle at 40% 80%, rgba(255,255,255,0.1) 1px, transparent 1px);
    background-size: 30px 30px, 30px 30px, 30px 30px;
    border-radius: 12px;
    animation: sparkle 3s ease-in-out infinite;
}

.card-pattern {
    position: absolute;
    width: 60%;
    height: 60%;
    background: 
        linear-gradient(45deg, transparent 30%, rgba(255,255,255,0.1) 50%, transparent 70%),
        repeating-linear-gradient(
            45deg,
            transparent,
            transparent 10px,
            rgba(255,255,255,0.05) 10px,
            rgba(255,255,255,0.05) 20px
        );
    border-radius: 8px;
}

.card-number {
    font-size: 32px;
    font-weight: 700;
    color: white;
    text-shadow: 0 2px 8px rgba(0,0,0,0.3);
    z-index: 2;
}

/* 卡片背面 */
.card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    background: white;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-hover);
    transform: rotateY(180deg);
    padding: 16px;
}

.card-city-image {
    font-size: 48px;
    margin-bottom: 8px;
}

.card-city-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    text-align: center;
}

/* 炫酷结果弹窗 */
.result-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.result-modal.show {
    opacity: 1;
    visibility: visible;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
}

.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.5);
    background: linear-gradient(145deg, #fff 0%, #f8fafc 100%);
    border-radius: 24px;
    padding: 40px 30px;
    max-width: 320px;
    width: 90%;
    text-align: center;
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.3),
        0 0 0 1px rgba(255, 255, 255, 0.1);
    transition: transform 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    overflow: hidden;
    position: relative;
}

.result-modal.show .modal-content {
    transform: translate(-50%, -50%) scale(1);
}

/* 皇冠装饰 */
.result-crown {
    font-size: 48px;
    margin-bottom: 16px;
    animation: crownBounce 2s ease-in-out infinite;
}

/* 结果标题 */
.result-title {
    font-size: 24px;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 24px;
    background: var(--gold-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 2px 2px 4px rgba(255, 215, 0, 0.3);
}

/* 目的地信息 */
.result-destination {
    margin-bottom: 30px;
    padding: 20px;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border-radius: 16px;
    border: 2px solid rgba(255, 215, 0, 0.3);
}

.destination-emoji {
    font-size: 64px;
    margin-bottom: 12px;
    animation: destinationPulse 2s ease-in-out infinite;
}

.destination-name {
    font-size: 32px;
    font-weight: 700;
    color: #1a202c;
    margin-bottom: 8px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.destination-desc {
    font-size: 16px;
    color: #4a5568;
    margin-bottom: 8px;
    font-weight: 500;
}

.destination-time {
    font-size: 14px;
    color: #718096;
    background: rgba(255, 215, 0, 0.1);
    padding: 6px 12px;
    border-radius: 20px;
    display: inline-block;
    border: 1px solid rgba(255, 215, 0, 0.3);
}

/* 闪烁星星装饰 */
.result-sparkles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
}

.sparkle {
    position: absolute;
    font-size: 20px;
    animation: sparkleFloat 3s ease-in-out infinite;
    opacity: 0;
}

.sparkle-1 { top: 15%; left: 10%; animation-delay: 0s; }
.sparkle-2 { top: 20%; right: 15%; animation-delay: 0.5s; }
.sparkle-3 { top: 60%; left: 5%; animation-delay: 1s; }
.sparkle-4 { top: 70%; right: 10%; animation-delay: 1.5s; }
.sparkle-5 { top: 40%; left: 85%; animation-delay: 2s; }
.sparkle-6 { top: 80%; left: 50%; animation-delay: 2.5s; }

.result-actions {
    display: flex;
    gap: 16px;
    justify-content: center;
    margin-top: 20px;
}

.btn-share,
.btn-again {
    padding: 8px 16px;
    border: none;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    flex: 1;
    max-width: 80px;
}

.btn-share {
    background: var(--success-gradient);
    color: white;
}

.btn-again {
    background: var(--secondary-gradient);
    color: white;
}

.btn-share:hover,
.btn-again:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}


/* 状态文字 */
.status-text {
    color: white;
    font-size: 14px;
    margin-top: 16px;
    opacity: 0.9;
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

/* 规则说明 */
.rules-section {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: var(--border-radius);
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.rules-details {
    color: white;
}

.rules-title {
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    padding: 8px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.rules-title::before {
    display: none;
}

.rules-content {
    padding-top: 12px;
    font-size: 14px;
    line-height: 1.8;
    opacity: 0.9;
}

.rules-content p {
    margin-bottom: 8px;
}

/* 动画定义 */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@keyframes bounce {
    0%, 20%, 53%, 80%, 100% {
        transform: translateY(0);
    }
    40%, 43% {
        transform: translateY(-8px);
    }
    70% {
        transform: translateY(-4px);
    }
    90% {
        transform: translateY(-2px);
    }
}

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

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

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

@keyframes rotate {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

@keyframes explode {
    0% {
        box-shadow: 
            0 0 0 0 rgba(255, 215, 0, 0.8),
            0 0 0 0 rgba(255, 215, 0, 0.8),
            0 0 0 0 rgba(255, 215, 0, 0.8);
    }
    100% {
        box-shadow: 
            20px -20px 10px -5px rgba(255, 215, 0, 0),
            -20px 20px 10px -5px rgba(255, 215, 0, 0),
            0 -40px 15px -5px rgba(255, 215, 0, 0);
    }
}

@keyframes winningPulse {
    0%, 100% {
        box-shadow: 0 0 20px rgba(255, 215, 0, 0.6);
    }
    50% {
        box-shadow: 0 0 40px rgba(255, 215, 0, 0.9);
    }
}

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

@keyframes sparkle {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.6; }
}

@keyframes winnerPulse {
    0%, 100% {
        box-shadow: 0 0 20px rgba(255, 215, 0, 0.6);
        transform: scale(1.1);
    }
    50% {
        box-shadow: 0 0 40px rgba(255, 215, 0, 0.9);
        transform: scale(1.15);
    }
}

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

@keyframes crownBounce {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    25% { transform: translateY(-8px) rotate(5deg); }
    50% { transform: translateY(-12px) rotate(0deg); }
    75% { transform: translateY(-8px) rotate(-5deg); }
}

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

@keyframes sparkleFloat {
    0% { opacity: 0; transform: translateY(0) scale(0.5); }
    20% { opacity: 1; transform: translateY(-10px) scale(1); }
    80% { opacity: 1; transform: translateY(-20px) scale(1); }
    100% { opacity: 0; transform: translateY(-30px) scale(0.5); }
}

/* 响应式设计 */
@media (max-width: 375px) {
    .container {
        padding: 16px;
    }
    
    .title {
        font-size: 24px;
    }
    
    
    .mystery-cards-container {
        gap: 8px;
    }
    
    .card-city-image {
        font-size: 36px;
    }
    
    .card-city-name {
        font-size: 14px;
    }
}

@media (min-width: 415px) {
    .container {
        max-width: 480px;
    }
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-primary: #1a1a1a;
        --bg-card: #2d2d2d;
        --text-primary: #ffffff;
        --text-secondary: #a0a0a0;
    }
}