/**
 * 九宫格抽奖样式
 */

.maizi-lottery-box {
    max-width: 400px;
    margin: 0 auto;
    padding: 20px;
}

.maizi-lottery-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.maizi-lottery-item {
    aspect-ratio: 1;
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e8eb 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.maizi-lottery-item-inner {
    text-align: center;
    padding: 10px;
}

.maizi-lottery-item-inner img {
    width: 50px;
    height: 50px;
    object-fit: contain;
    margin-bottom: 5px;
}

.maizi-prize-name {
    display: block;
    font-size: 12px;
    color: #666;
    word-break: break-all;
}

/* 中奖高亮 */
.maizi-lottery-item.active {
    background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
    box-shadow: 0 0 20px rgba(252, 182, 159, 0.6);
    transform: scale(1.05);
}

.maizi-lottery-item.active .maizi-prize-name {
    color: #d35400;
    font-weight: bold;
}

/* 抽奖按钮 */
.maizi-lottery-btn,
button.maizi-lottery-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    border: none;
    outline: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.maizi-lottery-btn:hover,
button.maizi-lottery-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.maizi-lottery-btn:active,
button.maizi-lottery-btn:active {
    transform: scale(0.98);
}

.maizi-lottery-btn.disabled,
button.maizi-lottery-btn.disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.maizi-lottery-btn-inner {
    text-align: center;
}

.maizi-lottery-btn-inner span {
    color: #fff;
    font-size: 18px;
    font-weight: bold;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* ========== 样式：喜庆红金 ========== */
.lottery-style-festive .maizi-lottery-box {
    background: linear-gradient(135deg, #8B0000 0%, #DC143C 100%);
    border-radius: 20px;
    padding: 25px;
    box-shadow: 0 10px 40px rgba(139, 0, 0, 0.3);
}

.lottery-style-festive .maizi-lottery-item {
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    border: 2px solid #B8860B;
    border-radius: 8px;
}

.lottery-style-festive .maizi-prize-name {
    color: #8B0000;
    font-weight: bold;
}

.lottery-style-festive .maizi-lottery-item.active {
    background: linear-gradient(135deg, #fff 0%, #FFE4B5 100%);
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.8);
    border-color: #FFD700;
}

.lottery-style-festive .maizi-lottery-btn {
    background: linear-gradient(135deg, #FFD700 0%, #FF8C00 100%);
    border: 3px solid #B8860B;
    box-shadow: 0 5px 20px rgba(255, 140, 0, 0.5);
}

.lottery-style-festive .maizi-lottery-btn-inner span {
    color: #8B0000;
    text-shadow: 1px 1px 2px rgba(255, 215, 0, 0.5);
}

/* ========== 样式：科技蓝 ========== */
.lottery-style-tech .maizi-lottery-box {
    background: linear-gradient(135deg, #0a0a1a 0%, #1a1a3a 100%);
    border-radius: 20px;
    padding: 25px;
    box-shadow: 0 0 50px rgba(0, 150, 255, 0.2);
    border: 1px solid rgba(0, 150, 255, 0.3);
}

.lottery-style-tech .maizi-lottery-item {
    background: rgba(0, 100, 200, 0.2);
    border: 1px solid rgba(0, 150, 255, 0.4);
    border-radius: 10px;
}

.lottery-style-tech .maizi-prize-name {
    color: #00d4ff;
}

.lottery-style-tech .maizi-lottery-item.active {
    background: rgba(0, 200, 255, 0.3);
    box-shadow: 0 0 30px rgba(0, 200, 255, 0.6), inset 0 0 20px rgba(0, 200, 255, 0.2);
    border-color: #00d4ff;
}

.lottery-style-tech .maizi-lottery-btn {
    background: linear-gradient(135deg, #0066cc 0%, #00ccff 100%);
    border: 2px solid #00d4ff;
    box-shadow: 0 0 30px rgba(0, 200, 255, 0.4);
}

.lottery-style-tech .maizi-lottery-btn-inner span {
    color: #fff;
    text-shadow: 0 0 10px rgba(0, 200, 255, 0.8);
}

/* ========== 样式：清新绿 ========== */
.lottery-style-fresh .maizi-lottery-box {
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    border-radius: 24px;
    padding: 25px;
    box-shadow: 0 10px 40px rgba(76, 175, 80, 0.2);
}

.lottery-style-fresh .maizi-lottery-item {
    background: #fff;
    border: 2px solid #81c784;
    border-radius: 16px;
}

.lottery-style-fresh .maizi-prize-name {
    color: #2e7d32;
}

.lottery-style-fresh .maizi-lottery-item.active {
    background: linear-gradient(135deg, #a5d6a7 0%, #81c784 100%);
    box-shadow: 0 0 25px rgba(129, 199, 132, 0.6);
    border-color: #4caf50;
}

.lottery-style-fresh .maizi-lottery-btn {
    background: linear-gradient(135deg, #4caf50 0%, #8bc34a 100%);
    border: none;
    box-shadow: 0 5px 20px rgba(76, 175, 80, 0.4);
}

.lottery-style-fresh .maizi-lottery-btn-inner span {
    color: #fff;
}

/* ========== 样式：暗黑金 ========== */
.lottery-style-dark .maizi-lottery-box {
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    border-radius: 20px;
    padding: 25px;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
    border: 1px solid #444;
}

.lottery-style-dark .maizi-lottery-item {
    background: linear-gradient(135deg, #2d2d2d 0%, #3d3d3d 100%);
    border: 1px solid #555;
    border-radius: 12px;
}

.lottery-style-dark .maizi-prize-name {
    color: #d4af37;
}

.lottery-style-dark .maizi-lottery-item.active {
    background: linear-gradient(135deg, #3d3d3d 0%, #4d4d4d 100%);
    box-shadow: 0 0 30px rgba(212, 175, 55, 0.5);
    border-color: #d4af37;
}

.lottery-style-dark .maizi-lottery-btn {
    background: linear-gradient(135deg, #d4af37 0%, #b8860b 100%);
    border: none;
    box-shadow: 0 5px 25px rgba(212, 175, 55, 0.4);
}

.lottery-style-dark .maizi-lottery-btn-inner span {
    color: #1a1a1a;
    text-shadow: none;
}

/* ========== 样式：糖果粉 ========== */
.lottery-style-candy .maizi-lottery-box {
    background: linear-gradient(135deg, #fce4ec 0%, #f8bbd9 100%);
    border-radius: 30px;
    padding: 25px;
    box-shadow: 0 10px 40px rgba(233, 30, 99, 0.2);
}

.lottery-style-candy .maizi-lottery-item {
    background: #fff;
    border: 3px solid #f48fb1;
    border-radius: 20px;
}

.lottery-style-candy .maizi-prize-name {
    color: #c2185b;
}

.lottery-style-candy .maizi-lottery-item.active {
    background: linear-gradient(135deg, #f8bbd9 0%, #f48fb1 100%);
    box-shadow: 0 0 25px rgba(244, 143, 177, 0.6);
    border-color: #e91e63;
}

.lottery-style-candy .maizi-lottery-btn {
    background: linear-gradient(135deg, #e91e63 0%, #f06292 100%);
    border: none;
    border-radius: 50%;
    box-shadow: 0 5px 20px rgba(233, 30, 99, 0.4);
}

.lottery-style-candy .maizi-lottery-btn-inner span {
    color: #fff;
}

/* 转动动画 */
@keyframes lottery-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.maizi-lottery-item.rolling {
    animation: lottery-pulse 0.15s ease-in-out;
}

/* 中奖弹窗 */
.maizi-lottery-result,
#maizi-lottery-result,
#maizi-popup-result {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
    padding: 15px !important;
    background: rgba(0, 0, 0, 0.7) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 999999999 !important;
    opacity: 1 !important;
    visibility: visible !important;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    box-sizing: border-box !important;
    overflow: auto !important;
    -webkit-overflow-scrolling: touch;
}

.maizi-lottery-result:not(.show) {
    opacity: 0 !important;
    visibility: hidden !important;
}

.maizi-lottery-result.show {
    opacity: 1 !important;
    visibility: visible !important;
}

.maizi-lottery-result-box {
    background: linear-gradient(135deg, #fff 0%, #f8f9fa 100%) !important;
    border-radius: 20px !important;
    padding: 40px 50px !important;
    text-align: center !important;
    max-width: 360px !important;
    min-width: 280px !important;
    margin: 20px !important;
    transform: scale(1) !important;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3) !important;
    position: relative !important;
    overflow: hidden !important;
}

.maizi-lottery-result-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #667eea, #764ba2, #f093fb, #f5576c);
}

.maizi-lottery-result.show .maizi-lottery-result-box {
    transform: scale(1);
}

.maizi-lottery-result-icon {
    font-size: 60px;
    margin-bottom: 20px;
    line-height: 1;
}

.maizi-lottery-result-icon.win {
    color: #f39c12;
    text-shadow: 0 4px 15px rgba(243, 156, 18, 0.4);
}

.maizi-lottery-result-icon.lose {
    color: #95a5a6;
}

.maizi-lottery-result-text {
    font-size: 20px;
    color: #333;
    margin-bottom: 25px;
    font-weight: 500;
    line-height: 1.5;
    word-break: break-word;
}

.maizi-lottery-result-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    padding: 14px 40px;
    border-radius: 30px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.maizi-lottery-result-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.5);
}

/* 暗色模式适配 */
body.theme-dark .maizi-lottery-result-box {
    background: linear-gradient(135deg, #2d2d2d 0%, #1a1a1a 100%);
}

body.theme-dark .maizi-lottery-result-text {
    color: #eee;
}

/* 弹幕样式 */
.barrage {
    position: fixed;
    z-index: 999;
    pointer-events: none;
}

.barrage-item {
    display: inline-flex;
    align-items: center;
    background: rgba(255,255,255,0.95);
    padding: 5px 15px 5px 5px;
    border-radius: 25px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    white-space: nowrap;
}

.barrage-item img {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    margin-right: 8px;
}

.barrage-item span {
    font-size: 12px;
    color: #666;
}

/* 响应式 */
@media (max-width: 480px) {
    .maizi-lottery-box {
        padding: 10px;
    }
    
    .maizi-lottery-grid {
        gap: 6px;
    }
    
    .maizi-lottery-item-inner img {
        width: 35px;
        height: 35px;
    }
    
    .maizi-prize-name {
        font-size: 10px;
    }
    
    .maizi-lottery-btn-inner span {
        font-size: 14px;
    }
}


/* ========== 弹窗抽奖样式 ========== */
.maizi-lottery-popup-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: rgba(0, 0, 0, 0.7) !important;
    z-index: 99999999 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    margin: 0 !important;
    padding: 15px !important;
    box-sizing: border-box !important;
    overflow: auto !important;
    -webkit-overflow-scrolling: touch;
}

.maizi-lottery-popup {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 20px;
    padding: 25px;
    max-width: 360px;
    width: 90%;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    animation: popupSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes popupSlideIn {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.maizi-lottery-popup-close {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 28px;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    line-height: 1;
    transition: all 0.3s ease;
    z-index: 10;
}

.maizi-lottery-popup-close:hover {
    color: #fff;
    transform: rotate(90deg);
}

.maizi-lottery-popup-header {
    text-align: center;
    margin-bottom: 20px;
}

.maizi-lottery-popup-header h3 {
    color: #fff;
    font-size: 22px;
    margin: 0 0 10px 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.maizi-lottery-chances {
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    margin: 0;
}

.maizi-lottery-chances span {
    color: #ffd700;
    font-weight: bold;
}

.maizi-lottery-popup-body {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 15px;
}

.maizi-popup-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.maizi-popup-item {
    aspect-ratio: 1;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px;
    transition: all 0.3s ease;
}

.maizi-popup-item img {
    width: 35px;
    height: 35px;
    object-fit: contain;
    margin-bottom: 5px;
}

.maizi-popup-item span {
    font-size: 11px;
    color: #666;
    text-align: center;
    word-break: break-all;
    line-height: 1.2;
}

.maizi-popup-item.active {
    background: linear-gradient(135deg, #ffd700 0%, #ffb347 100%);
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.6);
    transform: scale(1.05);
}

.maizi-popup-item.active span {
    color: #8B4513;
    font-weight: bold;
}

.maizi-popup-btn {
    aspect-ratio: 1;
    background: linear-gradient(135deg, #ffd700 0%, #ff8c00 100%) !important;
    border-radius: 10px !important;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none !important;
    box-shadow: 0 4px 15px rgba(255, 140, 0, 0.4);
}

.maizi-popup-btn .btn-text {
    color: #8B0000;
    font-size: 16px;
    font-weight: bold;
}

.maizi-popup-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(255, 140, 0, 0.6);
}

.maizi-popup-btn.disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.maizi-lottery-popup-footer {
    text-align: center;
    margin-top: 15px;
}

.maizi-lottery-tip {
    color: rgba(255, 255, 255, 0.8);
    font-size: 12px;
    margin: 0;
}

/* 弹窗样式变体 */
.maizi-lottery-popup.lottery-style-festive {
    background: linear-gradient(135deg, #8B0000 0%, #DC143C 100%);
}

.maizi-lottery-popup.lottery-style-tech {
    background: linear-gradient(135deg, #0a0a1a 0%, #1a1a3a 100%);
    border: 1px solid rgba(0, 150, 255, 0.3);
}

.maizi-lottery-popup.lottery-style-fresh {
    background: linear-gradient(135deg, #4caf50 0%, #8bc34a 100%);
}

.maizi-lottery-popup.lottery-style-dark {
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    border: 1px solid #444;
}

.maizi-lottery-popup.lottery-style-candy {
    background: linear-gradient(135deg, #e91e63 0%, #f06292 100%);
}


/* ========== 弹窗抽奖手机端适配 ========== */
@media (max-width: 768px) {
    .maizi-lottery-popup-overlay {
        padding: 10px !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    .maizi-lottery-popup {
        width: calc(100% - 20px) !important;
        max-width: 340px !important;
        padding: 15px !important;
        border-radius: 15px !important;
        margin: auto !important;
        max-height: calc(100vh - 40px);
        overflow-y: auto;
    }
    
    .maizi-lottery-popup-header h3 {
        font-size: 18px;
    }
    
    .maizi-lottery-chances {
        font-size: 12px;
    }
    
    .maizi-lottery-popup-body {
        padding: 10px;
    }
    
    .maizi-popup-grid {
        gap: 6px;
    }
    
    .maizi-popup-item {
        padding: 5px;
        border-radius: 8px;
    }
    
    .maizi-popup-item img {
        width: 28px;
        height: 28px;
    }
    
    .maizi-popup-item span {
        font-size: 10px;
    }
    
    .maizi-popup-btn {
        border-radius: 8px !important;
    }
    
    .maizi-popup-btn .btn-text {
        font-size: 14px;
    }
    
    .maizi-lottery-tip {
        font-size: 11px;
    }
    
    /* 结果弹窗手机端 */
    .maizi-lottery-result-box {
        padding: 25px 20px !important;
        min-width: 240px !important;
        max-width: calc(100% - 40px) !important;
        margin: auto !important;
    }
    
    .maizi-lottery-result-icon {
        font-size: 45px;
    }
    
    .maizi-lottery-result-text {
        font-size: 15px;
    }
    
    .maizi-lottery-result-btn {
        padding: 12px 30px;
        font-size: 14px;
    }
}

@media (max-width: 375px) {
    .maizi-lottery-popup {
        padding: 12px;
    }
    
    .maizi-popup-grid {
        gap: 4px;
    }
    
    .maizi-popup-item span {
        font-size: 9px;
    }
}
