/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
}

.app-container {
    width: 100%;
    height: 100%;
    position: relative;
    background: linear-gradient(180deg, #4A9FD4 0%, #6BB8E8 50%, #87CEEB 100%);
}

/* 页面切换 */
.page {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    overflow-y: auto;
}

.page.active {
    display: flex;
}

/* 首页图标 */
.home-icon {
    position: absolute;
    top: 15px;
    left: 15px;
    width: 36px;
    height: 36px;
    background: rgba(255,255,255,0.2);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
    cursor: pointer;
    z-index: 100;
    border: 2px solid rgba(255,255,255,0.3);
}

/* 页面标题 */
.page-title {
    color: white;
    font-size: 24px;
    font-weight: 500;
    margin-top: 60px;
    margin-bottom: 30px;
    text-align: center;
}

.page-subtitle {
    color: rgba(255,255,255,0.8);
    font-size: 14px;
    margin-top: -25px;
    margin-bottom: 20px;
}

/* ========== 首页 ========== */
#page-home {
    justify-content: center;
    padding: 0;
}

.home-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/* 云朵 */
.clouds {
    position: absolute;
    width: 100%;
    height: 100%;
}

.cloud {
    position: absolute;
    background: rgba(255,255,255,0.6);
    border-radius: 100px;
}

.cloud::before,
.cloud::after {
    content: '';
    position: absolute;
    background: rgba(255,255,255,0.6);
    border-radius: 100px;
}

.cloud-1 {
    width: 100px;
    height: 40px;
    top: 10%;
    left: -20px;
    animation: float 20s infinite;
}

.cloud-1::before {
    width: 50px;
    height: 50px;
    top: -25px;
    left: 10px;
}

.cloud-1::after {
    width: 60px;
    height: 40px;
    top: -15px;
    right: 10px;
}

.cloud-2 {
    width: 80px;
    height: 35px;
    top: 20%;
    right: -10px;
    animation: float 25s infinite reverse;
}

.cloud-2::before {
    width: 40px;
    height: 40px;
    top: -20px;
    left: 15px;
}

.cloud-2::after {
    width: 50px;
    height: 35px;
    top: -10px;
    right: 15px;
}

.cloud-3 {
    width: 120px;
    height: 45px;
    bottom: 20%;
    left: -30px;
    animation: float 30s infinite;
}

.cloud-3::before {
    width: 60px;
    height: 60px;
    top: -30px;
    left: 20px;
}

.cloud-3::after {
    width: 70px;
    height: 45px;
    top: -15px;
    right: 20px;
}

.cloud-4 {
    width: 90px;
    height: 38px;
    bottom: 15%;
    right: -20px;
    animation: float 22s infinite reverse;
}

.cloud-4::before {
    width: 45px;
    height: 45px;
    top: -22px;
    left: 12px;
}

.cloud-4::after {
    width: 55px;
    height: 38px;
    top: -12px;
    right: 12px;
}

@keyframes float {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(30px); }
}

/* 燕子 */
.swallows {
    position: absolute;
    width: 100%;
    height: 100%;
}

.swallow {
    position: absolute;
    width: 30px;
    height: 15px;
    background: #333;
    clip-path: polygon(0 50%, 50% 0, 100% 50%, 50% 100%);
}

.swallow-1 {
    top: 25%;
    left: 10%;
    animation: fly 15s infinite;
}

.swallow-2 {
    top: 35%;
    right: 15%;
    animation: fly 18s infinite reverse;
}

.swallow-3 {
    top: 15%;
    right: 25%;
    animation: fly 12s infinite;
}

@keyframes fly {
    0%, 100% { transform: translate(0, 0); }
    25% { transform: translate(20px, -10px); }
    50% { transform: translate(40px, 0); }
    75% { transform: translate(20px, 10px); }
}

.home-content {
    position: relative;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.main-title {
    color: white;
    font-size: 48px;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
    margin-bottom: 10px;
    font-family: 'STXingkai', 'KaiTi', cursive;
}

.subtitle-badge {
    background: white;
    color: #4A9FD4;
    padding: 8px 30px;
    border-radius: 20px;
    font-size: 18px;
    font-weight: 500;
    margin-bottom: 40px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

/* 明信片展示 */
.postcards-showcase {
    position: relative;
    width: 200px;
    height: 260px;
    margin-bottom: 50px;
}

.postcard-card {
    position: absolute;
    width: 140px;
    height: 180px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.card-1 {
    transform: rotate(-15deg) translateX(-40px);
    background: linear-gradient(135deg, #f5f5f5 0%, #e0e0e0 100%);
    z-index: 1;
}

.card-2 {
    transform: rotate(-8deg) translateX(-20px);
    background: linear-gradient(135deg, #fafafa 0%, #e8e8e8 100%);
    z-index: 2;
}

.card-3 {
    transform: rotate(5deg) translateX(20px);
    background: linear-gradient(135deg, #f0f0f0 0%, #d8d8d8 100%);
    z-index: 3;
}

.card-main {
    width: 150px;
    height: 200px;
    transform: rotate(0deg);
    z-index: 4;
    left: 25px;
    top: 20px;
    overflow: hidden;
}

.postcard-image {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #87CEEB 0%, #4A9FD4 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.postcard-image {
    background: url('images/image_1.png') center/cover no-repeat;
}

/* 开始按钮 */
.btn-start {
    display: flex;
    align-items: center;
    gap: 8px;
    background: white;
    border: none;
    padding: 15px 40px;
    border-radius: 30px;
    font-size: 20px;
    color: #333;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    transition: transform 0.2s;
}

.btn-start:active {
    transform: scale(0.95);
}

.btn-start span {
    font-weight: 500;
}

.play-icon {
    width: 30px;
    height: 30px;
    background: #4A9FD4;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
    margin-left: 5px;
}

/* ========== 模式选择 ========== */
.mode-options {
    display: flex;
    gap: 30px;
    margin-bottom: 50px;
}

.mode-card {
    width: 140px;
    height: 200px;
    background: white;
    border-radius: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.mode-card:active {
    transform: scale(0.95);
}

.mode-card.selected {
    border: 3px solid #FFD700;
    box-shadow: 0 0 20px rgba(255,215,0,0.5);
}

.mode-image {
    width: 100%;
    height: 140px;
    background: linear-gradient(135deg, #f0f0f0 0%, #e0e0e0 100%);
    border-radius: 10px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 60px;
}

.ai-mode {
    background: url('images/image_2.png') center/cover no-repeat;
}

.real-mode {
    background: url('images/image_2.png') center/cover no-repeat;
}

.mode-label {
    font-size: 18px;
    color: #333;
    font-weight: 500;
}

.btn-confirm {
    background: linear-gradient(90deg, #FFB347 0%, #FFCC99 100%);
    border: none;
    padding: 15px 80px;
    border-radius: 25px;
    font-size: 18px;
    color: white;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(255,179,71,0.4);
    transition: transform 0.2s;
}

.btn-confirm:active {
    transform: scale(0.95);
}

/* ========== 选取方式 ========== */
.method-options {
    display: flex;
    flex-direction: column;
    gap: 25px;
    width: 100%;
    max-width: 320px;
}

.method-card {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.method-card:active {
    transform: scale(0.98);
}

.method-image {
    width: 100%;
    height: 180px;
    background: linear-gradient(135deg, #87CEEB 0%, #4A9FD4 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 80px;
}

.random-image {
    background: url('images/image_3.png') center/cover no-repeat;
}

.direct-image {
    background: url('images/image_3.png') center/cover no-repeat;
}

.method-label {
    display: block;
    text-align: center;
    padding: 15px;
    font-size: 18px;
    color: #333;
    font-weight: 500;
}

/* ========== 景点选择 ========== */
.spots-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    overflow-x: auto;
    padding: 5px;
}

.spot-tab {
    background: rgba(255,255,255,0.3);
    border: 2px solid white;
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.spot-tab.active {
    background: #FF8C42;
    border-color: #FF8C42;
}

.spots-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    width: 100%;
    max-width: 350px;
    padding-bottom: 20px;
}

.spot-item {
    aspect-ratio: 4/3;
    background: white;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.spot-item:active {
    transform: scale(0.95);
}

.spot-item.selected {
    border: 3px solid #ff6b6b;
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(255, 107, 107, 0.5);
}

.spot-image {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #e0e0e0 0%, #f0f0f0 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
}

.spot-0 { background: url('images/站点1.png') center/cover no-repeat; }
.spot-1 { background: url('images/站点2.png') center/cover no-repeat; }
.spot-2 { background: url('images/站点3.png') center/cover no-repeat; }
.spot-3 { background: url('images/站点4.png') center/cover no-repeat; }
.spot-4 { background: url('images/站点5.png') center/cover no-repeat; }
.spot-5 { background: url('images/站点6.png') center/cover no-repeat; }

/* ========== 随机抽卡 ========== */
.draw-subtitle {
    color: rgba(255,255,255,0.9);
    font-size: 18px;
    margin-bottom: 40px;
}

.draw-card {
    width: 280px;
    height: 200px;
    background: white;
    border-radius: 15px;
    overflow: hidden;
    margin-bottom: 50px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.2);
}

 .draw-image {
    width: 100%;
    height: 100%;
    background: url('images/image_5.png') center/cover no-repeat;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.draw-image.drawing {
    animation: shake 0.5s infinite;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

.btn-draw {
    background: linear-gradient(90deg, #FFB347 0%, #FFCC99 100%);
    border: none;
    padding: 18px 60px;
    border-radius: 30px;
    font-size: 20px;
    color: white;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(255,179,71,0.4);
    transition: transform 0.2s;
}

.btn-draw:active {
    transform: scale(0.95);
}

/* ========== 抽卡结果 ========== */
.result-card {
    width: 300px;
    height: 220px;
    background: white;
    border-radius: 15px;
    overflow: hidden;
    margin: 30px 0;
    box-shadow: 0 8px 30px rgba(0,0,0,0.2);
}

.result-image {
    width: 100%;
    height: 100%;
    background: url('images/image_6.png') center/cover no-repeat;
    display: flex;
    align-items: center;
    justify-content: center;
}

.result-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.btn-redraw {
    background: linear-gradient(90deg, #98D8C8 0%, #B8E6D9 100%);
    border: none;
    padding: 15px 80px;
    border-radius: 25px;
    font-size: 18px;
    color: white;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(152,216,200,0.4);
    transition: transform 0.2s;
}

.btn-redraw:active {
    transform: scale(0.95);
}

/* ========== 拍照/上传 ========== */
.photo-frame {
    width: 280px;
    background: white;
    border-radius: 20px;
    padding: 15px;
    margin: 20px 0;
    box-shadow: 0 8px 30px rgba(0,0,0,0.2);
}

.photo-preview {
    width: 100%;
    aspect-ratio: 3/4;
    background: linear-gradient(135deg, #f5f5f5 0%, #e0e0e0 100%);
    border-radius: 15px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.upload-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    color: #999;
}

.upload-icon {
    font-size: 60px;
    margin-bottom: 10px;
}

.upload-text {
    font-size: 16px;
}

.photo-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-brand {
    text-align: center;
    padding-top: 15px;
    font-size: 24px;
    color: #4A9FD4;
    font-family: 'STXingkai', 'KaiTi', cursive;
    font-weight: bold;
}

.photo-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 20px;
}

.btn-retake {
    background: linear-gradient(90deg, #98D8C8 0%, #B8E6D9 100%);
    border: none;
    padding: 15px 80px;
    border-radius: 25px;
    font-size: 18px;
    color: white;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(152,216,200,0.4);
    transition: transform 0.2s;
}

.btn-retake:active {
    transform: scale(0.95);
}

/* ========== 生成中 ========== */
#page-generating {
    justify-content: center;
    align-items: center;
}

.generating-content {
    text-align: center;
}

.generating-text {
    color: white;
    font-size: 48px;
    font-family: 'STXingkai', 'KaiTi', cursive;
    margin-bottom: 40px;
}

.progress-bar {
    width: 250px;
    height: 20px;
    background: rgba(255,255,255,0.3);
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid white;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: white;
    border-radius: 8px;
    transition: width 0.3s;
}

/* ========== 最终明信片 ========== */
.final-title {
    color: white;
    font-size: 42px;
    font-family: 'STXingkai', 'KaiTi', cursive;
    margin: 50px 0 30px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

.final-postcard {
    width: 320px;
    background: white;
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 20px;
}

.stamp-border {
    border: 2px dashed #ccc;
    padding: 10px;
    position: relative;
}

.final-image {
    width: 100%;
    height: 180px;
    background: linear-gradient(135deg, #87CEEB 0%, #4A9FD4 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 80px;
    margin-bottom: 10px;
}

.postcard-info {
    text-align: center;
    margin-bottom: 10px;
}

.postcard-info h3 {
    font-size: 20px;
    color: #333;
    margin-bottom: 5px;
}

.marathon-en {
    font-size: 12px;
    color: #999;
    letter-spacing: 2px;
}

.stamp-mark {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255,100,100,0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 5px;
    font-size: 12px;
    text-align: center;
    transform: rotate(-5deg);
}

.stamp-mark span {
    font-size: 10px;
    opacity: 0.9;
}

.qr-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 20px;
}

.qr-code {
    width: 80px;
    height: 80px;
    background: white;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
    overflow: hidden;
}

.qr-code img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.qr-text {
    color: rgba(255,255,255,0.8);
    font-size: 12px;
}

.btn-print {
    background: linear-gradient(90deg, #FFB347 0%, #FFCC99 100%);
    border: none;
    padding: 15px 60px;
    border-radius: 25px;
    font-size: 18px;
    color: white;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(255,179,71,0.4);
    transition: transform 0.2s;
}

.btn-print:active {
    transform: scale(0.95);
}

/* 响应式适配 */
@media (max-height: 700px) {
    .main-title {
        font-size: 36px;
    }
    
    .postcards-showcase {
        width: 160px;
        height: 200px;
        margin-bottom: 30px;
    }
    
    .card-main {
        width: 120px;
        height: 160px;
    }
    
    .page-title {
        margin-top: 50px;
        margin-bottom: 20px;
    }
}

@media (max-height: 600px) {
    .mode-options {
        gap: 20px;
    }
    
    .mode-card {
        width: 120px;
        height: 170px;
    }
    
    .mode-image {
        height: 110px;
    }
}
