/* ==================== Index 页面样式 ==================== */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    min-height: 100vh;
    background: #f5f6fa;
    position: relative;
    overflow-x: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    -webkit-font-smoothing: antialiased;
}

/* ===== 电商背景 ===== */
body::before {
    content: '';
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background:
        radial-gradient(ellipse at 20% 20%, rgba(255, 107, 53, 0.25) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(255, 71, 87, 0.25) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(247, 147, 30, 0.15) 0%, transparent 60%),
        radial-gradient(ellipse at 10% 90%, rgba(255, 215, 0, 0.15) 0%, transparent 40%),
        linear-gradient(rgba(255,107,53,0.10) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,107,53,0.10) 1px, transparent 1px),
        linear-gradient(160deg, #fff0ec 0%, #fff5f0 20%, #fff8f5 50%, #fef5f0 75%, #f5f6fa 100%);
    background-size: auto, auto, auto, auto, 25px 25px, 25px 25px, auto;
    z-index: -2; pointer-events: none;
}

body::after {
    content: '';
    position: fixed; top: 0; left: 0; right: 0; height: 400px;
    background: linear-gradient(180deg, rgba(255,107,53,0.15) 0%, rgba(247,147,30,0.10) 25%, rgba(255,71,87,0.06) 50%, rgba(255,215,0,0.04) 75%, transparent 100%);
    z-index: -1; pointer-events: none;
}

/* 装饰元素 */
.bg-deco-1 { position: fixed; bottom: 5%; right: 3%; font-size: 120px; opacity: 0.08; z-index: -1; pointer-events: none; transform: rotate(-8deg); animation: floatDeco 8s ease-in-out infinite; }
.bg-deco-2 { position: fixed; top: 8%; left: 2%; font-size: 80px; opacity: 0.07; z-index: -1; pointer-events: none; transform: rotate(12deg); animation: floatDeco 10s ease-in-out infinite reverse; }
.bg-deco-3 { position: fixed; top: 30%; right: 5%; font-size: 50px; opacity: 0.08; z-index: -1; pointer-events: none; animation: twinkle 3s ease-in-out infinite; }
.bg-deco-4 { position: fixed; bottom: 30%; left: 1%; font-size: 70px; opacity: 0.06; z-index: -1; pointer-events: none; transform: rotate(5deg); animation: floatDeco 12s ease-in-out infinite 2s; }
.bg-deco-5 { position: fixed; top: 55%; right: 1%; font-size: 45px; opacity: 0.07; z-index: -1; pointer-events: none; animation: twinkle 4s ease-in-out infinite 1s; }

@keyframes floatDeco { 0%,100% { transform: translateY(0px) rotate(-8deg); } 50% { transform: translateY(-20px) rotate(-5deg); } }
@keyframes twinkle { 0%,100% { opacity: 0.04; transform: scale(1); } 50% { opacity: 0.12; transform: scale(1.1); } }

/* 粒子 */
.particles { position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.particle { position: absolute; border-radius: 50%; opacity: 0.10; animation: particleFloat 15s ease-in-out infinite; }
.particle:nth-child(1) { width: 300px; height: 300px; top: -50px; right: -50px; background: radial-gradient(circle, #ff6b35, transparent); animation-delay: 0s; }
.particle:nth-child(2) { width: 200px; height: 200px; bottom: -30px; left: -30px; background: radial-gradient(circle, #f7931e, transparent); animation-delay: -3s; }
.particle:nth-child(3) { width: 150px; height: 150px; top: 40%; left: 50%; background: radial-gradient(circle, #ff4757, transparent); animation-delay: -6s; }
.particle:nth-child(4) { width: 100px; height: 100px; bottom: 40%; right: 10%; background: radial-gradient(circle, #ffd700, transparent); animation-delay: -9s; }

@keyframes particleFloat { 0%,100% { transform: translate(0,0) scale(1); } 25% { transform: translate(30px,-20px) scale(1.1); } 50% { transform: translate(-20px,30px) scale(0.9); } 75% { transform: translate(20px,10px) scale(1.05); } }

/* ===== 导航 ===== */
.top-nav {
    background: linear-gradient(135deg, #ff6b35 0%, #f7931e 50%, #ff4757 100%);
    padding: 0 16px; display: flex; align-items: center; justify-content: center;
    position: sticky; top: 0; z-index: 100;
    box-shadow: 0 2px 12px rgba(255, 107, 53, 0.35);
    min-height: 54px; border-radius: 0;
}
.top-nav .nav-title { color: #fff; font-size: 17px; font-weight: 600; letter-spacing: 1px; text-align: center; }

/* ===== 容器 ===== */
.container {
    max-width: 480px; margin: 0 auto;
    padding: 20px 16px 32px;
    padding-bottom: calc(32px + env(safe-area-inset-bottom));
    position: relative; z-index: 1;
}

/* ===== 步骤 ===== */
.step-section { animation: fadeUp 0.4s ease; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }

/* ===== 卡片 ===== */
.card {
    background: #fff; border-radius: 16px;
    padding: 20px 18px 24px;
    box-shadow: 0 2px 16px rgba(0,0,0,0.06);
    margin-bottom: 12px; border: 1px solid rgba(0,0,0,0.04);
}
.card-header { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; padding-bottom: 14px; border-bottom: 1px solid #f0f0f0; }
.card-icon { width: 44px; height: 44px; border-radius: 50%; background: #fff5f0; display: flex; align-items: center; justify-content: center; font-size: 22px; flex-shrink: 0; }
.card-title { font-size: 17px; font-weight: 700; color: #333; line-height: 1.3; }
.card-sub { font-size: 12px; color: #999; }

/* ===== 地址 ===== */
.address-card .form-group { margin-bottom: 14px; }
.address-card .form-group:last-of-type { margin-bottom: 18px; }
.address-card .form-label { display: block; font-size: 13px; font-weight: 600; color: #444; margin-bottom: 4px; }
.address-card .form-label .required { color: #ff6b35; margin-right: 2px; }
.address-card input, .address-card textarea {
    width: 100%; padding: 12px 14px; border: 1.5px solid #e8e8e8;
    border-radius: 10px; font-size: 14px; color: #333; background: #fafafa;
    outline: none; transition: all 0.3s; font-family: inherit;
}
.address-card input:focus, .address-card textarea:focus { border-color: #ff6b35; background: #fff; box-shadow: 0 0 0 3px rgba(255,107,53,0.08); }
.address-card input::placeholder, .address-card textarea::placeholder { color: #bbb; }
.address-card input.error, .address-card textarea.error { border-color: #ff4757; background: #fff5f5; }
.address-card .form-error { font-size: 12px; color: #ff4757; margin-top: 4px; display: none; }
.address-card .form-error.show { display: block; }

/* 已保存地址 */
.saved-address { background: #f8f9fa; border-radius: 10px; padding: 14px 16px; margin-bottom: 16px; display: flex; align-items: flex-start; gap: 12px; }
.saved-address .saved-info { flex: 1; min-width: 0; }
.saved-address .saved-name { font-size: 15px; font-weight: 600; color: #333; }
.saved-address .saved-phone { font-size: 13px; color: #666; margin-top: 1px; }
.saved-address .saved-addr { font-size: 13px; color: #888; margin-top: 3px; word-break: break-all; }
.saved-address .btn-edit { padding: 4px 14px; border: 1px solid #ddd; border-radius: 14px; background: #fff; color: #666; font-size: 12px; cursor: pointer; flex-shrink: 0; margin-top: 2px; }
.saved-address .btn-edit:active { background: #f0f0f0; }

/* ===== 按钮 ===== */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 12px 24px; border: none; border-radius: 24px;
    font-size: 15px; font-weight: 600; cursor: pointer;
    transition: all 0.3s; font-family: inherit;
    -webkit-tap-highlight-color: transparent; user-select: none;
}
.btn:active { transform: scale(0.97); }
.btn-block { width: 100%; justify-content: center; }
.btn-primary { background: linear-gradient(135deg, #ff6b35, #f7931e); color: #fff; box-shadow: 0 4px 16px rgba(255,107,53,0.35); }
.btn-primary:active { box-shadow: 0 2px 8px rgba(255,107,53,0.25); }
.btn-primary:disabled { background: #ffd1b3; cursor: not-allowed; box-shadow: none; }
.btn-gold { background: linear-gradient(135deg, #f7931e, #ff6b35); color: #fff; box-shadow: 0 4px 16px rgba(247,147,30,0.35); }
.btn-gold:active { box-shadow: 0 2px 8px rgba(247,147,30,0.25); }
.btn-gold:disabled { background: #ffe0b3; cursor: not-allowed; box-shadow: none; }
.btn-outline { background: #fff; color: #ff6b35; border: 1.5px solid #ff6b35; }
.btn-outline:active { background: #fff5f0; }

/* ===== 九宫格 ===== */
.lottery-card .grid-container { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; max-width: 320px; margin: 0 auto 18px; }
.lottery-card .grid-item {
    aspect-ratio: 1; border-radius: 12px;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    font-size: 30px; font-weight: 700; color: #fff;
    transition: all 0.15s; position: relative;
    text-shadow: 0 1px 3px rgba(0,0,0,0.2); cursor: default; overflow: hidden;
    
}
.lottery-card .grid-item .grid-label {
    position: absolute; bottom: 0; left: 0; right: 0; text-align: center;
    font-size: 11px; font-weight: 500; background: rgba(0,0,0,0.45);
    padding: 4px 4px; color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
    border-radius: 0 0 10px 10px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.lottery-card .grid-item.active { transform: scale(1.08); box-shadow: 0 0 30px rgba(255,215,0,0.8); z-index: 5; border: 2px solid #ffd700; animation: pulse 0.5s ease-in-out; }
@keyframes pulse { 0%,100% { transform: scale(1.08); } 50% { transform: scale(1.15); } }
.lottery-card .lottery-note { text-align: center; font-size: 12px; color: #bbb; margin-top: 14px; }

/* ===== 结果 ===== */
.result-card { text-align: center; }
.result-card .result-icon { font-size: 56px; margin-bottom: 4px; }
.result-card .result-title { font-size: 20px; font-weight: 700; color: #333; }
.result-card .result-prize { font-size: 18px; font-weight: 600; color: #ff6b35; margin-top: 2px; }
.result-card .divider { height: 1px; background: #f0f0f0; margin: 16px 0; }
.result-card .address-info { text-align: left; background: #fafafa; border-radius: 10px; padding: 14px 16px; margin-bottom: 14px; }
.result-card .address-info-title { font-size: 14px; font-weight: 600; color: #333; margin-bottom: 8px; }
.result-card .address-info-item { display: flex; padding: 4px 0; font-size: 13px; }
.result-card .address-info-item .label { color: #999; width: 64px; flex-shrink: 0; }
.result-card .address-info-item .value { color: #333; flex: 1; word-break: break-all; }
.result-card .result-msg { font-size: 14px; color: #f7931e; font-weight: 500; margin-bottom: 16px; }
.result-card .result-actions { display: flex; flex-direction: column; gap: 10px; }

/* ===== Toast ===== */
.toast {
    position: fixed; top: 64px; left: 50%; transform: translateX(-50%);
    background: rgba(0,0,0,0.82); color: #fff;
    padding: 10px 22px; border-radius: 22px; font-size: 13px;
    z-index: 9999; opacity: 0; transition: all 0.35s;
    pointer-events: none; white-space: nowrap; max-width: 90%;
}
.toast.show { opacity: 1; top: 76px; }

/* ===== PC ===== */
@media (min-width: 768px) {
    body { display: block; background: #e8ecf1; padding: 0; }
    body::before { background: radial-gradient(ellipse at 10% 20%, rgba(255,107,53,0.10) 0%, transparent 50%), radial-gradient(ellipse at 90% 80%, rgba(255,71,87,0.10) 0%, transparent 50%), linear-gradient(160deg, #f0f2f5 0%, #e4e8ee 50%, #d5dae3 100%); }
    .container {
        max-width: 520px; padding: 0; margin-top: 20px; margin-bottom: 20px;
        background: rgba(255,255,255,0.85); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
        border-radius: 28px;
        box-shadow: 0 20px 60px rgba(0,0,0,0.08), 0 8px 24px rgba(0,0,0,0.04), inset 0 1px 0 rgba(255,255,255,0.8);
        margin-left: auto; margin-right: auto; border: 1px solid rgba(255,255,255,0.3); overflow: hidden;
    }
    .top-nav { border-radius: 0; padding: 16px 28px; position: relative; top: auto; margin: 0; }
    .card { background: transparent; box-shadow: none; border: none; padding: 20px 28px 24px; }
    .card-header { border-bottom-color: rgba(0,0,0,0.06); }
    .address-card { padding-top: 8px; }
    .address-card input, .address-card textarea { background: #fafafa; }
    .lottery-card .grid-container { max-width: 340px; }
    .result-card .address-info { background: #fafafa; }
    .bg-deco-1,.bg-deco-2,.bg-deco-3,.bg-deco-4,.bg-deco-5 { opacity: 0.06; }
    .particle { opacity: 0.06; }
}

@media (min-width: 1024px) {
    .container { max-width: 560px; margin-top: 30px; margin-bottom: 30px; }
    .top-nav { padding: 18px 36px; }
    .card { padding: 24px 36px 28px; }
}

/* ===== 小屏 ===== */
@media (max-width: 380px) {
    .container { padding: 20px 10px 24px; }
    .card { padding: 14px 12px 18px; }
    .top-nav { padding: 0 14px; min-height: 48px; }
    .top-nav .nav-title { font-size: 15px; }
    .lottery-card .grid-item { font-size: 22px; }
    .lottery-card .grid-item .grid-label { font-size: 9px; }
    .result-card .result-icon { font-size: 44px; }
}

/* ===== 平板 ===== */
@media (min-width: 600px) and (max-width: 767px) {
    .container { max-width: 440px; padding: 24px 24px 32px; }
    .lottery-card .grid-container { max-width: 340px; }
}

/* ===== 暗色 ===== */
@media (prefers-color-scheme: dark) {
    body::before { background: radial-gradient(ellipse at 10% 20%, rgba(255,107,53,0.20) 0%, transparent 60%), radial-gradient(ellipse at 90% 80%, rgba(255,71,87,0.20) 0%, transparent 60%), linear-gradient(160deg, #1a1a2e 0%, #16213e 50%, #0f0f23 100%); }
    @media (min-width: 768px) { .container { background: rgba(26,26,46,0.92); border-color: rgba(255,255,255,0.06); box-shadow: 0 20px 60px rgba(0,0,0,0.4), 0 8px 24px rgba(0,0,0,0.2), inset 0 1px 0 rgba(255,255,255,0.05); } .card { background: transparent; border: none; } }
    .card { background: rgba(255,255,255,0.04); border-color: rgba(255,255,255,0.06); }
    .card-title { color: #e8e8e8; }
    .card-sub { color: #888; }
    .card-header { border-bottom-color: rgba(255,255,255,0.06); }
    .address-card input, .address-card textarea { background: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.10); color: #e0e0e0; }
    .address-card input:focus, .address-card textarea:focus { background: rgba(255,255,255,0.08); border-color: #ff6b35; }
    .address-card input::placeholder, .address-card textarea::placeholder { color: #666; }
    .address-card .form-label { color: #bbb; }
    .saved-address { background: rgba(255,255,255,0.05); }
    .saved-address .saved-name { color: #e0e0e0; }
    .saved-address .saved-phone { color: #999; }
    .saved-address .saved-addr { color: #777; }
    .saved-address .btn-edit { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.12); color: #aaa; }
    .result-card .result-title { color: #e8e8e8; }
    .result-card .result-prize { color: #ff8c5a; }
    .result-card .address-info { background: rgba(255,255,255,0.05); }
    .result-card .address-info-title { color: #ddd; }
    .result-card .address-info-item .value { color: #ddd; }
    .result-card .divider { background: rgba(255,255,255,0.06); }
    .result-card .result-msg { color: #ffd700; }
    .btn-outline { background: transparent; color: #ff8c5a; border-color: #ff8c5a; }
    .lottery-card .lottery-note { color: #666; }
    .toast { background: rgba(0,0,0,0.9); color: #e8e8e8; }
    .bg-deco-1,.bg-deco-2,.bg-deco-3,.bg-deco-4,.bg-deco-5 { opacity: 0.05; }
}

/* ===== 滚动条 ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,107,53,0.3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,107,53,0.5); }

/* 弹窗 */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.55);
    display: flex; align-items: flex-end; justify-content: center;
    z-index: 1000; opacity: 0; pointer-events: none;
    transition: opacity 0.3s;
    backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
.modal-overlay.active { opacity: 1; pointer-events: auto; }
.modal {
    background: #fff; border-radius: 20px 20px 0 0;
    width: 100%; max-width: 420px; max-height: 85vh;
    overflow-y: auto; padding: 24px 20px 32px; text-align: center;
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
    box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
}
.modal-overlay.active .modal { transform: translateY(0); }
.modal-handle { width: 36px; height: 4px; background: #ddd; border-radius: 2px; margin: 0 auto 16px; }
.modal h3 { font-size: 19px; font-weight: 700; margin-bottom: 4px; }
.modal .btn { margin-top: 8px; }

@media (min-width: 768px) {
    .modal { border-radius: 20px; margin-bottom: 0; max-width: 440px; transform: translateY(30px) scale(0.95); }
    .modal-overlay { align-items: center; }
    .modal-overlay.active .modal { transform: translateY(0) scale(1); }
}