/**
 * 核心样式文件
 * 紫色渐变主题 + 毛玻璃效果
 */

:root {
    --primary-color: #8B5CF6;
    --primary-light: #A78BFA;
    --primary-dark: #7C3AED;
    --secondary-color: #C084FC;
    --accent-color: #E879F9;
    /* 背景颜色变浅 */
    --bg-gradient-start: #2d1b69;
    --bg-gradient-mid: #4c3d82;
    --bg-gradient-end: #3d2b6e;
    /* 透明白色毛玻璃 */
    --glass-bg: rgba(255, 255, 255, 0.12);
    --glass-border: rgba(255, 255, 255, 0.25);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    --text-primary: #FFFFFF;
    --text-secondary: rgba(255, 255, 255, 0.75);
    --success-color: #10B981;
    --error-color: #EF4444;
    --warning-color: #F59E0B;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-mid) 50%, var(--bg-gradient-end) 100%);
    background-attachment: fixed;
    min-height: 100vh;
    color: var(--text-primary);
    overflow-x: hidden;
    position: relative;
}

/* 粒子画布 */
#particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

/* 页面过渡动画 */
.page-transition {
    animation: fadeIn 0.5s ease-out;
}

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

.fade-out {
    animation: fadeOut 0.3s ease-in forwards;
}

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

/* 毛玻璃效果 - 透明白色 */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    box-shadow: var(--glass-shadow);
}

.glass-strong {
    background: rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border: 1px solid rgba(255, 255, 255, 0.35);
}

/* 按钮样式 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 32px;
    font-size: 16px;
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4);
}

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

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

.btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(139, 92, 246, 0.6);
}

.btn:active {
    transform: translateY(-1px);
}

.btn-secondary {
    background: transparent;
    border: 2px solid var(--primary-light);
    box-shadow: none;
}

.btn-secondary:hover {
    background: rgba(139, 92, 246, 0.2);
}

.btn-large {
    padding: 18px 48px;
    font-size: 18px;
}

/* 涟漪效果 - 圆形 */
.ripple {
    position: relative;
    overflow: visible;
}

.ripple::after,
.ripple::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid var(--primary-light);
    transform: translate(-50%, -50%);
    animation: rippleEffect 2s infinite;
    pointer-events: none;
}

.ripple::before {
    animation-delay: 0.5s;
}

@keyframes rippleEffect {
    0% {
        width: 100%;
        height: 100%;
        opacity: 1;
    }
    100% {
        width: 180%;
        height: 180%;
        opacity: 0;
    }
}

/* 进度条 */
.progress-container {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
    margin: 20px 0;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    border-radius: 4px;
    transition: width 0.1s linear;
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.5);
}

.progress-bar.animated {
    animation: progressPulse 1s ease-in-out infinite alternate;
}

@keyframes progressPulse {
    from {
        box-shadow: 0 0 10px rgba(139, 92, 246, 0.5);
    }
    to {
        box-shadow: 0 0 20px rgba(232, 121, 249, 0.8);
    }
}

/* 倒计时样式 - 每个数字单独框 */
.countdown-container {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

.countdown-title {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 700;
    margin-bottom: 50px;
    text-align: center;
    color: var(--text-primary);
    text-shadow: 0 0 30px rgba(139, 92, 246, 0.5);
}

.countdown-display {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 40px;
    flex-wrap: wrap;
}

.countdown-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 25px 30px;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    box-shadow: var(--glass-shadow);
    min-width: 100px;
}

.countdown-number {
    font-size: clamp(3rem, 8vw, 4.5rem);
    font-weight: 700;
    line-height: 1;
    color: var(--text-primary);
    text-shadow: 0 0 20px rgba(139, 92, 246, 0.5);
}

.countdown-label {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 12px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.countdown-ended {
    animation: glowPulse 2s ease-in-out infinite alternate;
}

@keyframes glowPulse {
    from {
        text-shadow: 0 0 20px rgba(139, 92, 246, 0.5);
    }
    to {
        text-shadow: 0 0 40px rgba(232, 121, 249, 0.8), 0 0 60px rgba(139, 92, 246, 0.6);
    }
}

/* 信封样式 - 增大占比 */
.envelope-page {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.envelope-container {
    position: relative;
    width: 100%;
    max-width: 700px;
    perspective: 1500px;
}

.envelope-wrapper {
    position: relative;
    width: 100%;
    padding-bottom: 75%; /* 增大高度占比 */
    transform-style: preserve-3d;
    transition: all 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.envelope-body {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, 
        rgba(139, 92, 246, 0.35) 0%, 
        rgba(124, 58, 237, 0.25) 50%,
        rgba(167, 139, 250, 0.2) 100%);
    border-radius: 20px;
    border: 2px solid rgba(167, 139, 250, 0.4);
    box-shadow: 
        0 20px 60px rgba(139, 92, 246, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    overflow: hidden;
    transform-style: preserve-3d;
}

/* 信封顶部三角形 */
.envelope-flap {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 50%;
    background: linear-gradient(180deg, 
        rgba(167, 139, 250, 0.25) 0%, 
        rgba(139, 92, 246, 0.1) 100%);
    clip-path: polygon(0 0, 100% 0, 50% 100%);
    transform-origin: top;
    transition: transform 0.6s ease 0.2s;
    z-index: 10;
    border-bottom: 1px solid rgba(167, 139, 250, 0.3);
}

/* 信封底部 */
.envelope-bottom {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 50%;
    background: linear-gradient(0deg, 
        rgba(124, 58, 237, 0.25) 0%, 
        rgba(139, 92, 246, 0.1) 100%);
    clip-path: polygon(0 100%, 100% 100%, 50% 0);
    z-index: 5;
}

/* 信封左右侧边 */
.envelope-left {
    position: absolute;
    top: 0;
    left: 0;
    width: 50%;
    height: 100%;
    background: linear-gradient(90deg, 
        rgba(139, 92, 246, 0.15) 0%, 
        transparent 100%);
    clip-path: polygon(0 0, 100% 50%, 0 100%);
    z-index: 4;
}

.envelope-right {
    position: absolute;
    top: 0;
    right: 0;
    width: 50%;
    height: 100%;
    background: linear-gradient(-90deg, 
        rgba(139, 92, 246, 0.15) 0%, 
        transparent 100%);
    clip-path: polygon(100% 0, 100% 100%, 0 50%);
    z-index: 4;
}

/* 开启按钮 - 圆形 */
.open-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 20;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    font-size: 16px;
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, 
        rgba(139, 92, 246, 0.95) 0%, 
        rgba(124, 58, 237, 0.95) 100%);
    border: 2px solid rgba(167, 139, 250, 0.6);
    cursor: pointer;
    transition: all 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    box-shadow: 
        0 10px 40px rgba(139, 92, 246, 0.5),
        0 0 60px rgba(139, 92, 246, 0.3);
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

/* 圆形涟漪效果 */
.open-button::before,
.open-button::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid rgba(167, 139, 250, 0.5);
    transform: translate(-50%, -50%);
    animation: circleRipple 2s infinite;
    pointer-events: none;
}

.open-button::after {
    animation-delay: 0.5s;
    border-width: 1px;
}

@keyframes circleRipple {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(1.6);
        opacity: 0;
    }
}

.open-button:hover {
    transform: translate(-50%, -50%) scale(1.1);
    box-shadow: 
        0 15px 50px rgba(139, 92, 246, 0.7),
        0 0 80px rgba(139, 92, 246, 0.5);
}

.open-button .icon {
    font-size: 28px;
}

.open-button .text {
    font-size: 13px;
}

/* 信封内容 - 随信封增大 */
.envelope-inner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.85);
    width: 85%;
    height: 75%;
    background: linear-gradient(135deg, 
        rgba(45, 27, 105, 0.98) 0%, 
        rgba(60, 35, 110, 0.98) 100%);
    border-radius: 15px;
    padding: 40px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.6s ease 0.4s;
    z-index: 3;
    overflow-y: auto;
    border: 1px solid rgba(167, 139, 250, 0.3);
    backdrop-filter: blur(20px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.envelope-inner::-webkit-scrollbar {
    width: 4px;
}

.envelope-inner::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 2px;
}

/* 打开状态 */
.envelope-wrapper.open .envelope-flap {
    transform: rotateX(180deg);
}

.envelope-wrapper.open .open-button {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0);
    pointer-events: none;
}

.envelope-wrapper.open .envelope-inner {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -55%) scale(1);
}

.envelope-wrapper.open {
    transform: translateY(-20px);
}

/* 内容样式 */
.envelope-content-title {
    font-size: 2rem;
    margin-bottom: 25px;
    color: var(--text-primary);
    text-align: center;
}

.envelope-content-body {
    color: var(--text-secondary);
    line-height: 1.8;
    font-size: 1rem;
    text-align: center;
    margin-bottom: 30px;
}

.envelope-content-body p {
    margin-bottom: 15px;
}

.envelope-action {
    text-align: center;
}

/* 装饰元素 */
.decoration-stars {
    position: absolute;
    top: 10%;
    left: 10%;
    width: 20px;
    height: 20px;
    background: radial-gradient(circle, var(--accent-color), transparent);
    border-radius: 50%;
    animation: twinkle 2s infinite;
}

.decoration-stars:nth-child(2) {
    top: 20%;
    right: 15%;
    left: auto;
    width: 15px;
    height: 15px;
    animation-delay: 0.5s;
}

.decoration-stars:nth-child(3) {
    bottom: 20%;
    left: 20%;
    top: auto;
    width: 12px;
    height: 12px;
    animation-delay: 1s;
}

@keyframes twinkle {
    0%, 100% {
        opacity: 0.3;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.2);
    }
}

/* 地图容器 */
.map-container {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.map-header {
    padding: 20px;
    text-align: center;
}

.map-title {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.map-subtitle {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.map-wrapper {
    flex: 1;
    position: relative;
    min-height: 500px;
    margin: 0 20px 20px;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: var(--glass-shadow);
    border: 1px solid var(--glass-border);
}

#map {
    width: 100%;
    height: 100%;
    min-height: 500px;
}

.map-info-panel {
    position: absolute;
    top: 20px;
    right: 20px;
    padding: 20px;
    max-width: 280px;
    z-index: 100;
}

.map-info-panel h3 {
    margin-bottom: 12px;
    font-size: 1.1rem;
    color: var(--text-primary);
}

.map-info-panel .address {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 10px;
    line-height: 1.5;
}

.map-info-panel .description {
    color: var(--text-secondary);
    font-size: 0.8rem;
    line-height: 1.6;
    opacity: 0.8;
}

.route-btn {
    margin-top: 15px;
    width: 100%;
    padding: 12px;
    font-size: 14px;
}

.online-users {
    position: absolute;
    bottom: 20px;
    left: 20px;
    padding: 15px 25px;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 10px;
}

.online-indicator {
    width: 10px;
    height: 10px;
    background: var(--success-color);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.online-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.online-count {
    font-weight: 700;
    color: var(--text-primary);
}

/* 定位弹窗 */
.location-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.location-modal.active {
    opacity: 1;
    visibility: visible;
}

.location-modal-content {
    padding: 40px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.location-modal.active .location-modal-content {
    transform: scale(1);
}

.location-modal h2 {
    margin-bottom: 20px;
    font-size: 1.8rem;
}

.location-modal p {
    color: var(--text-secondary);
    margin-bottom: 30px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .countdown-display {
        gap: 10px;
    }
    
    .countdown-item {
        min-width: 70px;
        padding: 18px 15px;
    }
    
    .countdown-number {
        font-size: 2.5rem;
    }
    
    .map-info-panel {
        position: relative;
        top: auto;
        right: auto;
        max-width: 100%;
        margin: 15px;
    }
    
    .map-wrapper {
        margin: 0 15px 15px;
        min-height: 400px;
    }
    
    #map {
        min-height: 400px;
    }
    
    .online-users {
        bottom: 15px;
        left: 15px;
    }
    
    .btn {
        padding: 12px 24px;
        font-size: 14px;
    }
    
    .envelope-container {
        max-width: 95%;
    }
    
    .envelope-inner {
        padding: 25px;
    }
    
    .envelope-content-title {
        font-size: 1.5rem;
    }
    
    .envelope-content-body {
        font-size: 0.9rem;
    }
    
    .open-button {
        width: 100px;
        height: 100px;
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .countdown-display {
        gap: 8px;
    }
    
    .countdown-item {
        min-width: 60px;
        padding: 15px 10px;
    }
    
    .countdown-number {
        font-size: 2rem;
    }
    
    .countdown-label {
        font-size: 11px;
    }
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-gradient-start);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-light);
}

/* 选择文本样式 */
::selection {
    background: rgba(139, 92, 246, 0.5);
    color: white;
}
