/* ============================================
   抽奖系统 - 喜庆红金九宫格主题
   ============================================ */

:root {
    --red-dark: #8B0000;
    --red: #C41E3A;
    --red-light: #DC143C;
    --gold: #FFD700;
    --gold-dark: #B8860B;
    --gold-light: #FFF8DC;
    --bg: #1a0000;
    --card-bg: rgba(255,255,255,0.97);
    --text: #333;
    --text-light: #666;
}

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

body {
    font-family: 'Microsoft YaHei','PingFang SC','Helvetica Neue',sans-serif;
    background: linear-gradient(135deg, #4a0000 0%, var(--bg) 30%, #5c0000 60%, var(--bg) 100%);
    min-height: 100vh;
    color: #fff;
    overflow-x: hidden;
}

/* ===== 背景灯笼 ===== */
.bg-decor { position:fixed; inset:0; pointer-events:none; z-index:0; }
.lantern { position:absolute; font-size:48px; opacity:0.25; animation:swing 3s ease-in-out infinite alternate; filter:drop-shadow(0 0 10px rgba(255,215,0,.5)); }
.l1 { top:5%; left:3%; animation-delay:0s; }
.l2 { top:5%; right:3%; animation-delay:1s; }
.l3 { top:40%; left:1%; animation-delay:.5s; }
.l4 { top:40%; right:1%; animation-delay:1.5s; }
@keyframes swing { 0% { transform:rotate(-8deg); } 100% { transform:rotate(8deg); } }

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

/* ===== 标题 ===== */
.header { text-align:center; padding:20px 0 15px; }
.title { font-size:42px; font-weight:900; letter-spacing:6px; background:linear-gradient(180deg,#FFE066 0%,var(--gold) 50%,var(--gold-dark) 100%); -webkit-background-clip:text; -webkit-text-fill-color:transparent; filter:drop-shadow(0 2px 4px rgba(0,0,0,.4)); }
.title-deco { -webkit-text-fill-color:initial; font-size:28px; }
.subtitle { font-size:16px; color:var(--gold-light); margin-top:8px; letter-spacing:2px; opacity:.85; }

/* ===== 抽奖说明 ===== */
.instructions-box { max-width:800px; margin:10px auto 0; background:rgba(0,0,0,.25); border:1px solid rgba(255,215,0,.25); border-radius:12px; padding:12px 20px; }
.instructions-title { font-size:14px; color:var(--gold); margin-bottom:6px; font-weight:700; }
.instructions-text { font-size:13px; color:rgba(255,255,255,.7); line-height:1.7; white-space:pre-line; }

/* ===== 内容区 ===== */
.content {
    display: flex;
    flex-direction: column;
    gap: 30px;
    margin-top: 10px;
    align-items: center;
}

/* ===== 九宫格区 ===== */
.wheel-section { flex:none; display:flex; flex-direction:column; align-items:center; }

/* 九宫格容器 */
.grid-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 6px;
    width:600px;
    height: 430px;
    background: rgba(0,0,0,.3);
    border-radius: 16px;
    padding: 8px;
    box-shadow: 0 0 40px rgba(255,215,0,.3);
    border: 3px solid var(--gold-dark);
}

.grid-cell {
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    text-align: center;
    transition: all .15s;
    cursor: default;
    position: relative;
    overflow: hidden;
    color: #fff;
    font-size: 15px;
    letter-spacing: 1px;
    border: 2px solid transparent;
    padding: 6px;
}

.grid-cell.highlight {
    border-color: var(--gold);
    box-shadow: 0 0 25px rgba(255,215,0,.7), inset 0 0 20px rgba(255,255,255,.15);
    transform: scale(1.03);
    z-index: 2;
    animation: pulse 0.5s ease-in-out;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 25px rgba(255,215,0,.7), inset 0 0 20px rgba(255,255,255,.15); }
    50% { box-shadow: 0 0 45px rgba(255,215,0,1), inset 0 0 35px rgba(255,255,255,.25); }
}

.grid-cell.winner {
    border-color: #fff !important;
    box-shadow: 0 0 40px rgba(255,215,0,1), 0 0 80px rgba(255,0,0,.5), inset 0 0 30px rgba(255,255,255,.2) !important;
    animation: winPulse 0.4s ease-in-out 3;
}
@keyframes winPulse {
    0%, 100% { transform: scale(1.03); }
    50% { transform: scale(1.1); }
}

/* 色彩方案 - 9 个格子交替 */
.grid-cell.c0 { background: linear-gradient(135deg, #DC143C, #B22222); }
.grid-cell.c1 { background: linear-gradient(135deg, #DAA520, #B8860B); color: #8B0000; }
.grid-cell.c2 { background: linear-gradient(135deg, #C41E3A, #8B0000); }
.grid-cell.c3 { background: linear-gradient(135deg, #B8860B, #8B6914); color: #8B0000; }
.grid-cell.c4 { background: linear-gradient(135deg, #FF6B6B, #DC143C); }
.grid-cell.c5 { background: linear-gradient(135deg, #CD853F, #A0522D); color: #8B0000; }
.grid-cell.c6 { background: linear-gradient(135deg, #8B0000, #5B0000); }
.grid-cell.c7 { background: linear-gradient(135deg, #DAA520, #CD853F); color: #8B0000; }
.grid-cell.c8 { background: linear-gradient(135deg, #B22222, #8B0000); }

/* 格子内奖项图标 */
.grid-icon { font-size: 28px; margin-bottom: 2px; }
.grid-img { width: 50px; height: 50px; object-fit: contain; margin-bottom: 2px; }
.grid-name { font-size: 13px; line-height: 1.2; max-height: 2.4em; overflow: hidden; }

/* ===== 输入区 ===== */
.code-area {
    display: flex;
    gap: 8px;
    margin-top: 24px;
    width: 100%;
    max-width:800px;
    flex-wrap: wrap;
    justify-content: center;
}
.code-input {
    height: 42px;
    border: 2px solid var(--gold);
    background: rgba(255,255,255,.95);
    border-radius: 21px;
    padding: 0 16px;
    font-size: 14px;
    text-align: center;
    letter-spacing: 1px;
    color: #333;
    outline: none;
    transition: all .3s;
    min-width: 110px;
    flex: 1;
}
.code-input:focus { border-color:#fff; box-shadow:0 0 15px rgba(255,215,0,.5); }
.code-input::placeholder { color:#bbb; font-size:13px; }

.spin-btn {
    height: 42px;
    padding: 0 24px;
    border: none;
    border-radius: 21px;
    background: linear-gradient(180deg,#FFE55C 0%,var(--gold) 40%,var(--gold-dark) 100%);
    color: var(--red-dark);
    font-size: 18px;
    font-weight: 900;
    letter-spacing: 3px;
    cursor: pointer;
    transition: all .3s;
    white-space: nowrap;
    box-shadow: 0 4px 15px rgba(255,215,0,.4);
}
.spin-btn:hover { transform:translateY(-2px); box-shadow:0 6px 25px rgba(255,215,0,.6); }
.spin-btn:active { transform:translateY(1px); }
.spin-btn:disabled { opacity:.5; cursor:not-allowed; transform:none; box-shadow:none; }

.hint { color:rgba(255,255,255,.6); font-size:13px; margin-top:10px; }

/* ===== 中奖名单 ===== */
.winners-section { width:100%; max-width:600px; background:rgba(0,0,0,.35); border-radius:16px; border:2px solid rgba(255,215,0,.3); overflow:hidden; }
.winners-title { font-size:20px; color:var(--gold); text-align:center; padding:16px 0; border-bottom:1px solid rgba(255,215,0,.2); letter-spacing:2px; display:flex; align-items:center; justify-content:center; gap:8px; }
.winners-scroll { height:280px; overflow:hidden; mask-image:linear-gradient(to bottom,transparent 0%,black 10%,black 90%,transparent 100%); }
.winners-list { animation:scrollUp 90s linear infinite; padding:0 16px; }
@keyframes scrollUp { 0%{transform:translateY(0)} 100%{transform:translateY(-50%)} }
.winner-item { display:flex; align-items:center; gap:10px; padding:11px 12px; border-bottom:1px solid rgba(255,255,255,.06); }
.winner-phone { font-size:14px; color:rgba(255,255,255,.7); font-family:monospace; min-width:105px; }
.winner-prize { font-size:14px; color:var(--gold-light); font-weight:600; flex:1; }
.winner-time { font-size:12px; color:rgba(255,255,255,.4); white-space:nowrap; }
.winner-empty { text-align:center; padding:40px 0; color:rgba(255,255,255,.4); font-size:15px; }

/* ===== 弹窗 ===== */
.modal-overlay { position:fixed; inset:0; background:rgba(0,0,0,.75); z-index:1000; display:flex; align-items:center; justify-content:center; padding:20px; animation:fadeIn .3s ease; }
@keyframes fadeIn { from{opacity:0} to{opacity:1} }
.modal-card { background:#fff; border-radius:20px; max-width:440px; width:100%; padding:36px 30px; text-align:center; box-shadow:0 20px 60px rgba(0,0,0,.5); animation:bounceIn .5s ease; position:relative; overflow:hidden; }
.modal-card::before { content:''; position:absolute; top:0; left:0; right:0; height:6px; background:linear-gradient(90deg,var(--red),var(--gold),var(--red)); }
@keyframes bounceIn { 0%{transform:scale(.5);opacity:0} 60%{transform:scale(1.05)} 100%{transform:scale(1);opacity:1} }
.modal-header { margin-bottom:10px; }
.modal-icon { font-size:48px; display:block; animation:pulseIcon 1s ease infinite; }
@keyframes pulseIcon { 0%,100%{transform:scale(1)} 50%{transform:scale(1.15)} }
.modal-title { font-size:24px; color:var(--red); margin-top:8px; letter-spacing:2px; }
.modal-prize { font-size:28px; font-weight:900; color:var(--red-dark); padding:14px; margin:14px auto; background:linear-gradient(135deg,#FFF4E0,#FFEAA7); border-radius:12px; border:2px dashed var(--gold); letter-spacing:1px; }
.modal-desc { color:#666; font-size:14px; margin-bottom:20px; }
.claim-form { text-align:left; }
.form-group { margin-bottom:16px; }
.form-group label { display:block; font-size:14px; color:#333; margin-bottom:6px; font-weight:500; }
.required { color:var(--red-light); font-weight:bold; }
.form-input { width:100%; height:44px; border:1.5px solid #ddd; border-radius:10px; padding:0 14px; font-size:15px; color:#333; outline:none; transition:border-color .3s; background:#fafafa; }
.form-input:focus { border-color:var(--gold-dark); background:#fff; }
.submit-btn { width:100%; height:48px; border:none; border-radius:24px; background:linear-gradient(180deg,#FF4136,var(--red-dark)); color:#fff; font-size:18px; font-weight:700; letter-spacing:2px; cursor:pointer; margin-top:8px; transition:all .3s; box-shadow:0 4px 15px rgba(220,20,60,.4); }
.submit-btn:hover { transform:translateY(-2px); box-shadow:0 6px 20px rgba(220,20,60,.5); }
.submit-btn:disabled { opacity:.5; cursor:not-allowed; transform:none; }
.modal-note { color:#aaa; font-size:12px; margin-top:14px; }

/* ===== Toast ===== */
.toast { position:fixed; top:30px; left:50%; transform:translateX(-50%); z-index:2000; padding:14px 28px; border-radius:30px; font-size:15px; font-weight:600; letter-spacing:1px; box-shadow:0 8px 30px rgba(0,0,0,.3); animation:toastIn .3s ease; pointer-events:none; }
.toast.error { background:linear-gradient(135deg,#FF4136,#C41E3A); color:#fff; }
.toast.success { background:linear-gradient(135deg,#2ECC40,#1B8A2A); color:#fff; }
@keyframes toastIn { from{opacity:0;transform:translateX(-50%) translateY(-20px)} to{opacity:1;transform:translateX(-50%) translateY(0)} }

/* ===== 响应式 ===== */
@media (max-width:900px) {
    .title { font-size:28px; letter-spacing:3px; }
    .grid-container { width:330px; height:330px; gap:4px; padding:6px; }
    .grid-cell { font-size:12px; border-radius:8px; }
    .grid-icon { font-size:22px; }
    .grid-name { font-size:11px; }
    .lantern { display:none; }
    .code-area { max-width:330px; }
}

@media (max-width:480px) {
    .grid-container { width:300px; height:300px; }
    .code-area { flex-direction:column; gap:6px; }
    .spin-btn { width:100%; }
}
